Tool-Output Compactor for Claude Code
Keep long Claude Code sessions sharp: full logs go to disk, only exit code, first error, and failures come back into context.
Before & after
Same prompt, same agent — the only difference is the skill.
Long Claude Code sessions can use a lot of tokens. One approach is to periodically clean up old messages or delete files you're no longer working with. You could also try to be more concise in your requests or break large tasks into smaller sessions. Another option is to reduce the amount of verbose output from command-line tools by parsing it yourself first. You might also want to batch related work together. Have you considered breaking this into multiple sessions? That way each one stays more focused and manageable.
SESSION COMPRESSION REPORT BEFORE COMPACTION: • Raw shell output: 312 KB (git log, test runs, find commands) • Browser snapshots: 428 KB (screenshots of 12 pages) • JSON responses: 156 KB (API results, unfiltered) • Total session footprint: 896 KB (computes to ~178K tokens) AFTER COMPACTION: • Compressed shell output: 8 KB (errors + key lines only) • Snapshot summaries: 12 KB (DOM structure, no pixels) • API response extraction: 3 KB (used fields only) • Total session footprint: 23 KB (~5K tokens) • Time saved: 170K tokens = 2.1 hours of work capability COMPRESSION TIERS (configured): • Shell (tier 2): Capture exit code, last 5 lines, errors; drop intermediate output • Browser (tier 3): Store accessibility tree only; drop images • HTTP (tier 1): Extract response body fields matching schema JOURNAL ENTRY: Session ID: sess_20260731_proj42 Duration: 67 minutes Files edited: 12 Tasks opened: 3 Errors recovered: 2 (npm install timeout, redirect loop) Rollback available: /ctx-stats --since 45m --recover NEXT: Enable auto-compress when crossing 100K tokens.
About this skill
Build logs, test runs, and page dumps are what quietly wreck long Claude Code sessions. This skill routes noisy commands through a wrapper that keeps the full log on disk and returns only what Claude needs to act.
What it does
- Writes a wrapper that preserves the real exit code and surfaces the first error, not just the last 50 lines
- Sets quiet and structured modes for common test runners, package managers, and HTTP or browser checks
- Strips progress bars, colors, and repeated lines, and redacts obvious secrets from digests
- Keeps a small append-only journal of commands, failures, and log paths across the session
- Adds the CLAUDE.md rules so Claude uses the wrapper by default
What you get
A tested wrapper script, per-tool digest rules, a session journal, and measured before and after output sizes.
Best for
Developers running multi-hour Claude Code builds with heavy test, build, or e2e output.
SKILL.md preview
---
name: sandboxed-output-compactor
description: Stop noisy tool output from flooding a long Claude Code session - wrap builds, test runs, installs, browser snapshots, and HTTP fetches so the full raw output goes to a log file and only the useful slice (exit code, first error, failing tests, summary counts) comes back into context, plus a small session journal of commands, files, and errors. Use when the user says "my context fills up with build logs", "test output is eating my context", "Claude keeps losing track after npm install", "compress tool output", "make a wrapper that only shows errors", or casually "the logs are too long, fix it".
---
# Tool-Output Compactor for Claude Code
… (sign up to view the full skill)More ai & agents skills
View all AI & Agents skills →New Skill Scaffolder
Create a new Claude Code skill correctly: right mechanism, valid name and folder, a triggering description, and a smoke test.
Skill Library Lint and Overlap Report
Lint every skill in a repo at once: frontmatter, name-folder match, weak descriptions, overlapping triggers, broken refs, plus a CI script.
Self-Verifying Agent Loop: Plan, Check, Retry, Close
Turns a goal into a task plan with machine-run checks, executes with retry caps, escalates, and refuses to close until verified.
Skill Test Runner (Trigger and A/B)
Test a skill in fresh sessions: ready-to-run prompts, commands, and rubric for trigger recall, false triggers, and blind A/B.