agentleFS
arjunkshaharjunkshah/token-skill/skills/token-budget/SKILL.md

token-budget

Skill1 starsChanged 5 months agoMITView on GitHub

Reduce token usage from large coding-agent context while preserving completion-critical evidence and full recoverability. Use when tool output, logs, diffs, test failures, search results, transcripts, or accumulated session context are large or repetitive; when context limits approach; or when the user asks to reduce tokens, compact context, lower agent cost, or preserve progress across compaction.

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. toonight/get-shit-done-for-antigravity★ 952same name
    2. qyndex/claude-init★ 2same name
    3. debasish-tech/agent-skills★ 0same name
    4. Lucioway/way-stack★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. 0 are common, 15 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 15

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never compact the user's current request, acceptance criteria, active constraints, unresolved errors, or uncommitted-change warnings.

    line 12
  2. Distinctive:

    Keep exact commands, file paths, line references, failing test names, error messages, decisions, and latest task state.

    line 13
  3. Very specific:

    Prefer targeted reads (rg, line ranges, structured queries) over reading entire files.

    line 15
  4. Distinctive:

    Prefer summaries of successful output.

    line 16
  5. Distinctive:

    Do not reduce verification, skip tests, shorten required code, or stop early to save tokens.

    line 18
  6. Distinctive:

    Run the bundled CLI from the project root:

    line 22
  7. Distinctive:

    If a command is known or expected to be noisy, compact its first run rather than consuming the raw output and compacting only later.

    line 33
  8. Very specific:

    Use --max-chars 8000 for routine output and increase it when critical evidence does not fit.

    line 40
  9. Distinctive:

    Search first, then open only relevant ranges.

    line 44
  10. Distinctive:

    Run independent reads in parallel.

    line 45
  11. Distinctive:

    Do not re-read unchanged files or repeat successful commands.

    line 46
  12. Distinctive:

    Keep one short task ledger: objective, constraints, changed files, unresolved failures, next action.

    line 47
  13. Distinctive:

    After each milestone, replace stale exploration details with verified findings.

    line 48
  14. Distinctive:

    Keep user updates short; spend tokens on implementation and verification.

    line 49
  15. Distinctive:

    Use the capsule's source hash:

    line 53
  16. Distinctive:

    no requirement disappeared during compaction.

    line 68
  17. Distinctive:

    Read references/policy.md only when changing preservation rules or evaluating quality.

    line 70

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “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 Budget

Minimize context, not evidence.

Rules

  1. Never compact the user's current request, acceptance criteria, active constraints, unresolved errors, or uncommitted-change warnings.
  2. Keep exact commands, file paths, line references, failing test names, error messages, decisions, and latest task state.
  3. Archive the full source before omitting content. Treat a capsule without a retrievable archive as lossy.
  4. Prefer targeted reads (rg, line ranges, structured queries) over reading entire files.
  5. Prefer summaries of successful output; preserve failure output verbatim.
  6. Retrieve archived lines before acting when a capsule says evidence was omitted and the missing detail could affect correctness.
  7. Do not reduce verification, skip tests, shorten required code, or stop early to save tokens.

Compact large material

Run the bundled CLI from the project root:

TOKENOP_SCRIPT="${CLAUDE_SKILL_DIR:-$HOME/.agents/skills/token-budget}/scripts/tokenop.py"
test -f "$TOKENOP_SCRIPT" || TOKENOP_SCRIPT="$HOME/.codex/skills/token-budget/scripts/tokenop.py"
python3 "$TOKENOP_SCRIPT" compact PATH

Claude Code sets ${CLAUDE_SKILL_DIR}. Skills CLI installs the shared Codex copy under ~/.agents/skills; the fallback supports direct legacy installs.

If a command is known or expected to be noisy, compact its first run rather than consuming the raw output and compacting only later. For stdin:

COMMAND 2>&1 | python3 "$TOKENOP_SCRIPT" compact -

Use --max-chars 8000 for routine output and increase it when critical evidence does not fit. Read the emitted capsule instead of the original bulk output.

Work token-efficiently

  • Search first, then open only relevant ranges.
  • Run independent reads in parallel.
  • Do not re-read unchanged files or repeat successful commands.
  • Keep one short task ledger: objective, constraints, changed files, unresolved failures, next action.
  • After each milestone, replace stale exploration details with verified findings.
  • Keep user updates short; spend tokens on implementation and verification.

Recover omitted evidence

Use the capsule's source hash:

python3 PATH_TO_SKILL/scripts/tokenop.py retrieve SHA256 --lines START-END

Retrieve the full source by omitting --lines.

Before finishing

Confirm:

  • requested behavior is implemented;
  • relevant tests actually ran;
  • failures and limitations are stated;
  • no requirement disappeared during compaction.

Read references/policy.md only when changing preservation rules or evaluating quality.

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.