Token economics: the why of skill constraints
This is Question 3 of the hero framework (Three questions). What is the token budget for your skill, and what governs it? The 500-line cap is not a stylistic preference. It is the auto-compaction survival floor. The description is not free: a skill the model may invoke has its description listed in every session on every host (with exceptions), and each host caps the listing differently. SessionStart-hook injection is not free either; it costs its full text every session, so a 105-token pointer and a full SKILL.md are different decisions. Authors who do not know these numbers ship 1,200-line skills and wonder why the agent stops following the rules after a long session. This page gives you the numbers, the calculator, and the design choices the numbers force.The four budgets
1. The auto-compaction budget (25,000 tokens shared, 5,000-token per-skill survival floor)
Source: Claude Code Skills docs, re-read 2026-09-29; first recorded inREVIEWER G2.
Claude Code carries invoked skills forward across auto-compaction: it re-attaches the most recent invocation of each skill after the summary, keeping the first 5,000 tokens of each, within a 25,000-token shared budget filled from the most recently invoked skill. Older skills can be dropped after compaction.
- A 500-line SKILL.md is approximately 5,000 tokens (the rule of thumb is ~10 tokens per line for prose; tighter prose runs lower, code-heavy prose runs higher).
- A 500-line skill survives compaction. A 1,000-line skill is truncated to its first half after compaction. The truncated half is the part the agent will not see.
- “Most-recently-invoked first” means the skill you invoked at minute 5 of a 4-hour session may be dropped after compaction; the skill invoked at minute 230 stays.
references/<topic>.md. The body of SKILL.md should be the smallest set of words that the agent needs to act correctly; reference detail goes in sibling files loaded on demand.
2. The description listing budget
The agent-skills spec caps thedescription field at 1,024 characters (agentskills.io/specification). Each host then lists descriptions under its own limits. Checked 2026-09-29 against the sources the host pages cite:
Implication. Put the trigger first: every cap cuts from the end, and Grok Build keeps only 400 bytes. With many skills installed, the whole-listing limit can drop a description entirely, which removes the words the agent matches on. A listed description is still not a guarantee that the skill loads at the right moment (see section 4).
3. The per-skill model: and effort: overrides
Source: REVIEWER G7. Claude Code documents both fields:
model:per-skill model override. Example: a skill that needs Opus reasoning can declaremodel: opusin its frontmatter (an alias, so the example does not pin a dated model ID). The harness applies the override for the rest of the turn the skill is active.effort:per-skill reasoning level. Example:effort: highfor a deep-thinking skill.- Default:
inherit(use the parent’s model and effort).
wiki doctor-style skill (deep lint pass) that needs Opus does not need the user to manually switch; the skill declares it and the harness complies.
These fields are Claude Code only. Other harnesses do not honor them. See docs/11-cross-platform/.
4. Session-start injection: full body or pointer
A SessionStart hook’s output is paid in every session it fires in, whether or not the skill is used. What it injects is the choice.- Full body. The
using-superpowershook reads the SKILL.md, escapes it for JSON and emits it ashookSpecificOutput.additionalContext. obra/superpowers#1220 measured 1,370 tokens per firing and about 17,800 tokens over 57 hours and 13 firings in two sessions; its matcher includescompact, so it re-fires after every compaction. - Pointer. A short note that names the skill and the actions it governs, and tells the agent to load it and read the procedure its routing table links. The AgentsMD pointer was 417 characters (about 105 tokens), later widened to 482 characters to cover every new kind of action (routing case study).
The calculator
Inputs:- S = SKILL.md size in lines.
- D = description + when_to_use combined character count.
- F = expected per-session firing rate (typical: 0-3).
- M = loading mechanism: description-triggered (default), session-start pointer, or full body injected at session start.
- P = pointer size in tokens (the AgentsMD pointer is about 105).
- N = number of other concurrently-active skills the agent may have loaded.
Worked example: karpathy-wiki
- S = 476 lines (
REVIEWERverification: 476 not 455, post v2.2). - footprint_tokens ≈ 4,800 (just under the 5,000 floor).
- D ≈ 750 chars (description only; no
when_to_use). Well under the 1,024 spec cap and the 1,536 listing cap. - F ≈ 1-3 captures per typical session.
- M = description-triggered. No SessionStart-hook injection.
- Per-session cost when not fired: ~100 tokens (description in listing).
- Per-session cost on first fire: ~4,900 tokens (description + body).
- Subsequent fires same session: 0 (body already loaded).
- Concurrent-skills room: ~20,000 remaining tokens, ~4 other skills at 5,000 tokens each before compaction.
LESSONS 2.1 framing): “the 500-line SKILL.md is roughly 5,000 tokens, which is the compaction-survival ceiling.” Net change in v2.2 was +21 lines (from 455 to 476). The design pressure that kept it under 500 was real.
If karpathy-wiki had grown to 1,200 lines, every long session would silently lose half the iron laws after auto-compaction. The user would see the agent comply for the first hour and then quietly stop following the rules after a compaction event. This is the most insidious cost of overshooting the budget.
Design choices the numbers force
- Push detail into
references/. The agent reads SKILL.md by default; references load only when the agent decides to read them (or when SKILL.md links to one inline). Heavy reference material (API docs, comprehensive syntax) belongs there. The agent-skills spec rule: file references one level deep from SKILL.md, no nested chains. - Front-load triggers in the description. The 1,536-char listing truncation makes the bottom of long descriptions invisible.
- Pick description-triggered loading as the default; add a pointer for moments. A pointer of about 105 tokens made a moment-shaped skill load where its description did not. Full-body injection costs the whole body every session and after each compaction.
- Use
model:andeffort:overrides surgically. A skill that demands Opus declares it; the user does not need to switch. (Claude Code only; cross-platform skills should not assume this works elsewhere.) - Audit your SKILL.md size at every ship.
wc -l SKILL.mdis the cheapest gate. If it is over 500, the next ship’s plan should include a “split to references” task.
When the numbers do not apply
- The
25,000 / 5,000re-attach rule is Claude Code’s. This repo’s Codex and Gemini CLI pages record no equivalent; check the host you target. Gemini CLI supports Agent Skills natively (descriptions always listed, bodies on activation), andGEMINI.mdis always-on context likeCLAUDE.md. - The
25,000 / 5,000numbers match the Claude Code docs as re-read on 2026-09-29. They will change. Re-fetch when shipping. - Fork-mode skills (
context: fork+agent) do not pay the parent context’s compaction tax; the fork has its own context. This is the cost-saving rationale for forking; see Mental model andREVIEWERM3.
Sources
REVIEWERG2 (the 25k auto-compaction budget; the 5k per-skill survival floor; 500 lines ≈ 5,000 tokens); re-checked against the Claude Code Skills docs on 2026-09-29.REVIEWERG7 (per-skillmodel:andeffort:overrides).- Per-host listing and hook-output limits: Claude Code, Codex, Grok Build and OpenCode, each checked 2026-09-29 against the primary sources they cite.
- obra/superpowers#1220 (full-body injection cost; first recorded in
LANDSCAPE2.1). - Routing case study and the #174 records (pointer size, per-host results, mean tokens per run).
LANDSCAPE1.3 (Anthropic Claude Code docs lifecycle; auto-compaction behavior).
model: and effort: live), Claude Code cross-platform notes (the SessionStart hook), Mental model (when to fork).