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.

AI Systemsclaude-codecontext-management
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“My Claude Code sessions hit 200K tokens after an hour. How do I extend them?”
Beforegeneric AI agent
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.
Afterwith Tool-Output Compactor for Claude Code
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

SKILL.md
---
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)
Sign up to view, copy, and install the full skill

More ai & agents skills

View all AI & Agents skills →