agentleFS
ppgrangerppgranger/token-saver/skills/token-saver-config/SKILL.md

token-saver-config

Skill154 starsChanged 6 months agoApache-2.0View on GitHub

Configure and diagnose token-saver compression settings. Use when the user asks about adjusting compression levels, checking processor status, debugging hook issues, or reviewing savings statistics.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run token-saver stats to see lifetime and per-command compression statistics.

    line 9
  2. Distinctive:

    If compression isn't working:

    line 52
  3. Very specific:

    Check that python3 (3.10+) is available in your PATH.

    line 53
  4. Very specific:

    Run token-saver explain "<the command>" to see the routing decision and why it was or wasn't wrapped.

    line 54
  5. Distinctive:

    Verify the hook itself responds correctly:

    line 56

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Token-Saver Configuration & Diagnostics

Check Status

Run token-saver stats to see lifetime and per-command compression statistics. Add --json for machine-readable output.

Check Why a Specific Command Was (or Wasn't) Compressed

There is no token-saver config subcommand — use explain and benchmark instead:

token-saver explain "git status"          # routing decision: compressible? which processor? why excluded?
token-saver benchmark "npm install" --dry-run   # measure compression without replacing real output

Configuration

Settings are read in this order (later wins): built-in defaults → ~/.token-saver/config.json → a project-level .token-saver.json found by walking up from cwd → TOKEN_SAVER_* environment variables. There is no CLI subcommand to write these files — edit ~/.token-saver/config.json directly, or set an environment variable.

The most commonly adjusted settings and their actual defaults:

  • enabled (bool, default true): master on/off switch.
  • min_input_length (int, default 1): minimum output length in characters before compression is attempted.
  • min_compression_ratio (float, default 0.0): a compression result below this fraction is discarded and the original output is returned instead.
  • wrap_timeout (int, default 300): max seconds a wrapped command may run before being killed.
  • chars_per_token (int, default 4): used only to estimate token counts for display (stats, benchmark) — not part of compression itself.
  • disabled_processors (list, default []): processor names (e.g. "docker", "kubectl") to turn off entirely.
  • max_output_bytes (int, default 10_000_000): hard cap on output length before compression even runs.

Example ~/.token-saver/config.json:

{
  "min_compression_ratio": 0.1,
  "disabled_processors": ["docker"]
}

Equivalent environment variables: TOKEN_SAVER_MIN_COMPRESSION_RATIO=0.1, TOKEN_SAVER_DISABLED_PROCESSORS=docker.

Security note: user_processors_dir, disabled_processors, and redaction_allowlist can only be set via the global ~/.token-saver/config.json or an environment variable — never via a project-level .token-saver.json (that file is auto-discovered from any directory you cd into, so it is not trusted with these).

See src/config.py's _DEFAULTS dict for the full, authoritative list of settings — this file lists only the ones users actually tune.

Debug Mode

Set TOKEN_SAVER_DEBUG=true to enable debug logging to ~/.token-saver/hook.log (or %APPDATA%\token-saver\hook.log on Windows).

Supported Processors

36 specialized processors, auto-discovered from src/processors/: git, gh (GitHub CLI), docker, kubectl, helm, terraform, pulumi, cdktf, ansible, nix, mise, npm/pip/cargo/go/maven/gradle/bun, package listing, python install, test runners (pytest, jest, go test, cargo test, …), lint output (eslint, ruff, pylint, clippy, …), build output, cloud CLIs (aws, gcloud, az), database queries, file listings, file content, environment/system info, network tools (curl, wget), search (grep, find, ripgrep), structured logs, syslog, ssh, jq/yq, act, just — plus a generic fallback for everything else.

Troubleshooting

If compression isn't working:

  1. Check that python3 (3.10+) is available in your PATH.
  2. Run token-saver explain "<the command>" to see the routing decision and why it was or wasn't wrapped.
  3. Set TOKEN_SAVER_DEBUG=true, trigger a compressible command, then check ~/.token-saver/hook.log for errors.
  4. Verify the hook itself responds correctly:
    echo '{"tool_name":"Bash","tool_input":{"command":"git status"}}' | python3 "${CLAUDE_PLUGIN_ROOT}/scripts/hook_pretool.py"
    A working hook prints a JSON object with hookSpecificOutput.updatedInput.command rewritten to invoke wrap.py.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.