plugins/workflow/skills/output-compression/SKILL.md
Reduce CLI output noise before it reaches LLM context. Use when setting up repos, troubleshooting context overflow from build/test/git output, or when Bash tool output exceeds limits. Covers RTK (zero-config baseline) and tokf (per-project customization). Either or both may be installed — the skill adapts gracefully when one is absent.
npx skillsauth add rbergman/dark-matter-marketplace output-compressionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Build, test, and git output can consume 20-40% of context in a typical session. Output compression tools intercept CLI commands and emit only the signal, reducing noise by 60-99%.
Two tools serve this purpose with different trade-offs:
| | RTK | tokf |
|--|-----|------|
| Philosophy | Zero-config, batteries-included | Config-driven, per-project customization |
| Install | brew install rtk | brew install mpecan/tokf/tokf |
| Setup | rtk init --global | tokf hook install |
| Custom filters | Built-in only (30+ commands) | TOML per-project + Lua scripting (61+ built-in) |
| Per-repo config | No | .tokf/filters/ committed with repo |
| Multi-tool support | Claude Code, Cursor, Gemini, Codex, Copilot, etc. | Claude Code hook + CLI filter (tokf filter < input) |
| Best for | Global baseline across all repos | Surgical filtering when defaults aren't enough |
Use RTK as the global baseline. Add tokf when RTK's defaults don't handle a specific output pattern (e.g., test coverage tables overflowing Bash limits).
Related skills:
Before recommending or using either tool, check what's available:
command -v rtk &>/dev/null && echo "rtk: installed" || echo "rtk: not installed"
command -v tokf &>/dev/null && echo "tokf: installed" || echo "tokf: not installed"
| RTK | tokf | Recommendation |
|-----|------|----------------|
| Installed | Installed | Both active. RTK handles baseline, tokf handles project-specific overrides. No conflict. |
| Installed | Not installed | RTK handles everything. Suggest tokf only if a specific output isn't handled. |
| Not installed | Installed | tokf handles everything. |
| Neither | Neither | Suggest brew install rtk as the quick win. |
Never fail or error if a tool is missing. Suggest installation, don't require it.
brew install rtk
rtk init --global # installs PreToolUse hook, restart CC
That's it. RTK silently compresses output for git, test runners, linters, package managers, docker, kubectl, and more. No per-project config needed.
RTK installs a PreToolUse hook that rewrites Bash commands transparently. Four compression strategies: smart filtering, grouping, truncation, deduplication.
| Command | Reduction |
|---------|-----------|
| git status (large repo) | ~90% |
| npm test (100 tests) | ~94% |
| cargo test | ~98% |
rtk lint src breaks with positional args. RTK rewrites/dispatches in a way that treats positional args like src as npm package names (npx tries to fetch them). Call rtk lint with no positional args and let ESLint's files: config handle scope. Same applies to other tools where positional directory args are optional.rtk <command> works outside Claude Code — in justfile recipes, CI, shell scripts. See just-pro "Token-Efficient Recipes" for the pattern.Use when RTK's built-in filters don't handle a specific output, or when you need per-project filters shared across the team.
brew install mpecan/tokf/tokf # or: cargo install tokf, mise use -g tokf
tokf hook install # PreToolUse hook
tokf skill install # optional: agent filter authoring
For the specific problem of test coverage output exceeding Bash limits:
# .tokf/filters/npm/coverage.toml
command = ["npm run test:coverage", "npx vitest --coverage"]
strip_ansi = true
strip_empty_lines = true
# Drop the per-file coverage table, keep only the summary
skip = ["^\\s*[│|]", "^-{3,}", "^={3,}", "^File\\s"]
keep = ["^(All files|Statements|Branches|Functions|Lines)", "^(PASS|FAIL|Tests:)", "^Test Suites:"]
[on_success]
output = "Coverage: PASS (see full report in coverage/)"
[on_failure]
tail = 20
.tokf/filters/ # Project-local (committed)
└── ~/.config/tokf/filters/ # User-level (personal)
└── <built-in stdlib> # 61+ embedded filters
| Field | Purpose |
|-------|---------|
| command | Match pattern — string or array, supports wildcards |
| skip / keep | Regex line filtering (mutually exclusive) |
| replace | Pattern transformations with capture groups |
| dedup | Collapse consecutive identical lines |
| on_success / on_failure | Conditional output based on exit code |
| strip_ansi | Remove color escape codes |
| [lua_script] | Luau scripting for complex logic |
tokf ls # List available filters
tokf which "npm test" # Show matching filter
tokf eject cargo/build # Override a built-in locally
tokf verify # Test all project filters
tokf gain # Token savings stats
Symptoms: Commit fails because test:coverage output exceeds the Bash tool's output limit. Gates pass when run separately.
RTK: May handle automatically. Check: rtk --list | grep test
tokf: Create a project-local filter (see coverage example above) that keeps only the summary.
Quick workaround (no tools): npm run test:coverage > /tmp/coverage.txt 2>&1 && tail -5 /tmp/coverage.txt
RTK: Handles by default for most build tools.
tokf: tokf eject <build-tool> and customize the skip patterns.
Both tools handle this out of the box.
Set up CLI output compression for this project.
- Check what's installed:
command -v rtkandcommand -v tokf- If RTK installed: verify it's working (
rtk init --globalif not yet initialized)- If specific commands still produce excessive output, install tokf and create a filter in
.tokf/filters/- Commit
.tokf/so the team shares custom filters
development
Initialize a new repository with standard scaffolding - git, gitignore, AGENTS.md, justfile, mise, beads, and timbers. Use when starting a new project or setting up an existing repo for Claude Code workflows.
data-ai
Activate at session start when using Agent Teams for complex multi-agent work. Establishes team lead role with delegation protocols, teammate spawning, model selection, and beads integration. You coordinate the team; teammates implement.
data-ai
Use when creating a worktree, setting up a worktree, starting feature work that needs isolation, or before executing implementation plans. Covers git worktree creation under .worktrees/, gitignore setup, beads integration, and merge guardrails.
data-ai
Activate when you are a delegated subagent (not the orchestrator). Establishes subagent protocol with terse returns, details to history/, file ownership boundaries, and escalation rules. You implement; orchestrator reviews and commits.