token-budget
/token-budget
Use when the context is filling up or a token budget comes up, before a large read or a long delegated task, and when a skill or prompt grows too long.
- Author
- byerlikaya ↗
- Repository
- claude-starter-kit ↗
- Licence
- MIT
- Last repository change
- 13.11.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 1
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- SKILL.md zawiera komentarze HTML (1). Nie widać ich w podglądzie Markdown, a model je czyta.
What it does and when to use it
Use when the context is filling up or a token budget comes up, before a large read or a long delegated task, and when a skill or prompt grows too long.
Original author description
Use when the context is filling up or a token budget comes up, before a large read or a long delegated task, and when a skill or prompt grows too long.
How it works
- Rules
SKILL.md preview
--- name: token-budget description: | Use when the context is filling up or a token budget comes up, before a large read or a long delegated task, and when a skill or prompt grows too long. --- # Token & Context Discipline <!-- routing-eval reads the next line; why it sits in the body: AGENT_TEMPLATE.md --> Trigger phrases: "token budget", "token cost", "context window", "context management", "context is full", "clear context", "running out of context" A subagent exists for context management: it runs in its own window and returns **only its summary** to the main thread — intermediate noise (file reads, searches, logs) never enters the main context. **Warning — measured, not guessed.** Each subagent re-pays its **full context from scratch**: in a real transcript the first turn was `cache_read=0`, every token `cache_creation` — nothing is shared with the main thread's cache. A **no-op** subagent (task = "reply DONE") already cost **~10k tokens with restricted tools and ~16k with full tool access**; that floor is base system prompt + tool schemas, paid fresh every time. Of the always-on material only the **skill listing (~2.5–3k tokens) is inherited** by a subagent — the discipline (`DISCIPLINE.md`/CLAUDE.md) and the agent descriptions are **not** injected into it. (A crew agent is given one ~600-byte block of the rules it cites at SubagentStart, by `agent-outcome.sh`; nothing else.) So a delegation is worth it for **isolation / parallelism / a clean window**, or when the isolated work would otherwise cost the main thread **more than that ~10–16k floor** — never by default. ## Rules 1. **Output = summary.** The agent returns a short, structured summary to the main thread; it does **not** return raw logs / file dumps / long code. 2. **Move to a file.** Heavy output (a plan, scan report, inventory) is written to `docs/*.md`; a **summary + pointer** comes back. (local, in gitignore) 3. **Delegation threshold.** Noisy/heavy work (reading many files, scanning, research) → subagent. A single tool-call / small work → **main thread**. Concretely: if the isolated work won't save the main thread more than the **~10–16k fresh-context floor** a subagent costs, keep it on the main thread — delegate for isolation, not to shave a few reads. 4. **A RESUMED agent re-pays its GROWN context, not its floor.** Continuing an agent that already ran keeps its whole history, so the next turn starts from wherever it got to. Measured across four turns of one agent: 167k → 187k → 207k → **211k tokens**, and that last turn was a single word of seed text. The floor in rule 3 is the cost of a FRESH agent; a long-running one passes it many times over. Continue it for the context it holds — a running verification, a migration it is mid-way through — and open a fresh one, or stay on the main thread, for a small correction that does not need any of that history. 5. **Built-in agents are on this budget too.** `Explore`, `general-purpose` and the rest cost exactly what a Crewforth agent costs; one repo-mapping `Explore` measured 520 s and ~150k tokens. Crewforth owns no search agent, so reaching for a built-in is correct — just size the request the way rule 3 sizes any other delegation. 6. **Least tooling.** An agent holds only the tools it needs; extras accidentally pollute the context + burn the limit. 7. **Lean SKILL.md.** Skills load into the main context; heavy reference goes to a separate file, only when needed. 8. **Targeted reading.** Instead of reading a whole file, pinpoint with Grep/Glob. Index first, then fetch: list or count (`grep -l`, `grep -c`, `git diff --stat`, the headings), then read only the hits. A `file:line` you were handed (crew-map, a task card, a finding) is where to open the file with offset/limit, not a reason to read all of it or search for it again. After a compaction, file content still in context (the summary, a kept tool output) is a record of that moment: read the file again before editing it. 9. **Measure fill, don't guess.** `bash .claude/hooks/context-usage.sh` (Bash tool, not PowerShell) reads it from the transcript; crew-session-manager recommends continue or handoff+clear; the user runs `/clear` at a phase boundary. 10. **Bound what a command hands back.** All of the rules above govern the context's own footprint; none of them govern what a single `Bash` call dumps into it. A `find` over a monorepo, an unfiltered log, a full test run — each returns everything to the main thread whether or not any of it is read. Ask for the answer, not the corpus: `grep -c` over `grep`, `| tail -20` over the whole file, `--quiet`/`--porcelain` where the tool has one, and a redirect to a file plus a pointer when the output is genuinely needed later (rule 2). When the first bounded look was not enough, redirect the full output to a file and grep it; never re-run the command with a bigger head/tail, which pays for the same output again and again. **A test or build run keeps its own status.** `npm test | tail -20` exits with tail's status, which is 0 when the suite failed. Use `set -o pipefail` before the pipe, or `cmd > .crewforth/run.log 2>&1; echo "exit=$?"; tail -20 .crewforth/run.log`. An exit code read through a pipe without pipefail is the pipe's, not the suite's. 11. **Cut what nothing reaches — with evidence, not a hunch.** Every installed skill spends its name and description in EVERY session, forever. `bash .claude/eval/utilization.sh` (Bash tool, not PowerShell; a file install only) reports which skills actually fired in this project's transcripts and how many bytes the cold ones cost, which is the list `doctor.sh` §4a's `skillOverrides: name-only` advice needs and never had. Read it as evidence, not a verdict: a skill that only fires during an incident is doing its job by existing. `--all-projects` widens the scope; by default it reads this project only and prints names and counts, never paths or content. `--tools` does the same for tools and MCP servers: available in five or more sessions and never called, printed as a deny proposal you apply yourself. 12. **A dispatch carries paths, not history.** The prompt of an `Agent` call names the files, the task card and, when there is more to say, a brief file to read; it never pastes the conversation, a long diff or earlier tool output. The subagent re-pays every byte of it (the floor above) and reads what it needs itself. 13. **Trimming keeps the constraints.** When you shorten or summarise text (a handoff, a brief, a finding), every sentence that carries a must, a cannot, a limit or a number survives; the colour around it is what goes. 14. **A loaded tool's schema is paid on every request,** used or not. A deferred tool (tool search) costs only its name until it is loaded. How much a server costs depends on its schemas and is not measured by Crewforth. `utilization.sh --tools` (rule 11) sees only the deferred ones, the cheap case; a loaded tool nobody calls has to be found in the settings that load it.
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · byerlikaya/claude-starter-kit | 90 | MIT |
| byerlikaya/claude-starter-kit | 90 | MIT |
| tonone-ai/tonone | 90 | MIT |
Database snapshot: 13.11.2026 · package version fca70c853bd6 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 100input-token-overheads
Use when context window is filling up too fast or input token cost is too high. Audits overhead sources. - 90token-optimization
Use the token-optimizer MCP tools to reduce context/token usage when reading, searching, or editing files, or when the context window is filling up. Trigger when reading large files, re-reading files already seen, searching a big/unknown tree, making edits to large files, or… - 100session-handoff
Capture current session state and generate a handoff prompt for seamless continuation in a new session. Use when context window is filling up, before ending a long session, or when explicitly requested. - 100context-ops
Manage this session's own conversation context — compress the chat history to free up token budget, or clear it to start a fresh conversation. Use when the context window is filling up, the session has grown too long, token pressure is high, or the user wants to wipe the history… - 90memory-optimization
Summarizing context, pruning history, and managing token budget efficiency. Use when: memory optimization. - 100context-budget
Use when a long-horizon task is filling the context window and you must decide what to keep, offload, drop, or hand off to a fresh window — when to compact, what the summary must preserve, and whether to isolate a read-heavy subtask in a subagent. NOT dollar spend or caps (that…