agentleFS
qyndexqyndex/claude-init/.claude/skills/token-budget/SKILL.md

token-budget

Skill2 starsChanged 5 months agoMITView on GitHub

Per-session token discipline — cache, delegate, compact. Use when output is getting verbose, context is filling, or cache hit-rate drops. Companion to context-budget (which inventories the harness); this governs in-session behavior.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    If the context-monitor hook injects an [output] warning, the previous turn exceeded the growth nudge — tighten immediately.

    line 22

“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

In-session token discipline. context-budget audits what the harness loads; this skill governs what the session spends. (Gap-audit G8: previously referenced from CLAUDE.md, README, ARCHITECTURE, RESEARCH §9, and prime-discipline but never shipped.)

Output rules (the model's own tokens)

  • Cite paths, don't paste files. src/foo.ts:42, never the contents.
  • No preamble, no postamble. No "I'll now read…", no "Let me know if…".
  • State results, don't narrate. One sentence per milestone, not per tool call.
  • Don't echo back what the user (or a hook) just said.
  • If the context-monitor hook injects an [output] warning, the previous turn exceeded the growth nudge — tighten immediately.

Input rules (what enters context)

  • Subagents for heavy reads (>3 files or >20K tokens) — their context dies with them; only the conclusion returns. Use Explore (Haiku).
  • Graphify MCP over grep for cross-module questions (>3 files).
  • memory-recall.sh before grepping .claude/memory/ — index-backed, ≤5 lines.
  • Read initiatives/active/<id>.STATE.md (≤60 lines) instead of re-deriving initiative state from specs/plans/tasks.

Cache rules

  • Don't rewrite prefix surfaces mid-session: CLAUDE.md, agents/*, skill frontmatter, settings. They invalidate the prompt cache for every later turn.
  • TTL is ~5 minutes and not configurable from Claude Code: turns spaced

    5min apart re-pay the cache write. Keep unattended loops tight.

  • Measure, don't guess: bash .claude/scripts/cost-report.sh day → cache_hit_rate in cost-summary.json; statusline shows cache:N%; harness-doctor warns under CACHE_HIT_MIN (default 40%).

Compact rules

  • Same task continuing → /compact "<focus hint>" at a clean boundary.
  • New task → /clear.
  • The context-monitor hook nudges at 60% and 80% estimated fill; at 80%, persist in-flight state (WIP commit, tasks/notes) before compaction.

References

  • docs/RESEARCH.md §9 (sources: Anthropic context-engineering + long-running-agents posts)
  • .claude/skills/context-budget/SKILL.md (harness-load inventory)
  • .claude/skills/prime-discipline/SKILL.md (session-start digest of these rules)

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.