Token efficiency · internal reference · 2026-07-24

Where the tokens go

Every session starts with a 200,000 token window. A by-the-book startup used to spend about 70% of it on overhead we control before the first task: giant brain files read wholesale, a 39KB design spec loaded for sessions that never touch design, and a parent folder file still quoting last year's prices. After this pass, the same startup spends about 11%. The rest of the window now belongs to the work.

This page covers three things: how the hive mind already saves tokens, where it was leaking, and what we adopted from three peer recommendations. Every number traces to a measured receipt in the run record.

SwarmSystem · Hive MindMeasured 2026-07-24 · windows-primaryRun: one-shot 2026-07-24-token-optimization-review
The numbers
0%→11%
Controllable overhead at start
0%
Startup reads cut
0%
Injected stack cut
0
Entries archived, zero deleted

The 70% and 11% figures count the overhead we control: the instruction stack plus the startup reads. The system prompt and the tool menus add roughly another 23k on top of that, and those are not ours to cut. The bars below show the whole window, so their totals run higher.

Cost framing is context budget and rate-limit headroom, not dollars: we run on subscription. A leaner window means deeper sessions, fewer compactions, and less lost state. Every spawned subagent inherits the standing stack, so each KB cut here is cut from every agent too.

The window

One window, before and after

Each bar is the full 200k context window. Red depth shows what standing overhead consumed before any real work. The dark segment is what was left to think in.

Context window at session start
Before~163k consumed · ~37k free
After~45k consumed · ~155k free
System + tools (est.) MCP + skill menus (est.) Instruction stack Startup reads Free working space

Before the fix, roughly 163 thousand tokens of the 200 thousand token window were consumed at session start, dominated by 110 thousand tokens of wholesale brain file reads. After the fix, roughly 45 thousand tokens are consumed and 155 thousand remain free. Of that reduction, 118 thousand tokens came from overhead we control.

What this buys: the window that used to be over 80% gone at "hello" now starts 78% free. The session gets to think in the space that used to be overhead.
The ladder

How the hive saves tokens: six rungs

The system already ran most of this before today. Every mechanism is the same move, applied at a different layer: defer until needed. The ladder mirrors ponytail's own ladder for code. That skill stays untouched; it is rung six.

1

Don't spawn

The swarm-gate hook scores every prompt and declines multi-agent swarms on most of them (session cap: 3). Main thread first; subagents only for isolated research.

Receipt: docs/swarm-gate-audit.md · mostly SKIP verdicts, standing no-swarm-init rule in CLAUDE.md
2

Don't load

Hundreds of MCP tools sit deferred behind ToolSearch (Search Atlas alone is ~500 tools, listed by name only). 31 skills load frontmatter at startup and full text on demand. As of today the 39KB visual design spec joins them: on demand, behind a 5-line pointer.

Receipt: ToolSearch active · skills menu ~100 tokens each vs full text · visual-design.md now at docs/reference/
3

Don't reread

One-shot runs write every phase to a run directory, so later phases read files instead of dragging conversation history. Generated indexes answer connectivity questions without grepping. Hook outputs over 10KB persist to disk with a 2KB preview.

Receipt: 157 run directories · docs/reference indexes · persisted hook outputs live in this session's log
4

Retrieve, don't read

brain-search queries the whole memory corpus and returns the top five hits. The startup ritual now uses it instead of reading four archive-sized brain files wholesale. The memory index stays one line per entry.

Receipt: 401 logged queries · selftest 6/6 · ritual rewritten in CLAUDE.md + workflow.md today
5

Route down (and up)

New today. The subagent default was already pinned to haiku in settings.json, which we only noticed during this pass. The standing rule now routes by task: cheap default for mechanical work, explicit upgrade for judgment work so council-grade analysis never silently rides the cheap model.

Receipt: CLAUDE.md routing table · CLAUDE_CODE_SUBAGENT_MODEL=haiku confirmed in settings.json env
6

Write less

Ponytail, active on every response at level full: the laziest solution that works, shortest diff, no speculative scaffolding, output measured in what it deletes. Untouched by this run, exactly as asked.

Receipt: PONYTAIL MODE ACTIVE in every session start · skill usage log at 810 events
The leak

The leak: signals that grew into archives

The startup ritual was written before brain-search existed. It told every session to read the brain files in full. Those files kept growing, and by this week the ritual was reading a 1MB status board, a 265KB pattern file, and a 242KB "read-first signal" that had become a 984-line log. The retrieval layer built to prevent exactly this was sitting one command away.

Measured before and after
ItemBeforeAfterWhat changed
brain/STATUS.md984 lines · 242KB28 linesBack to a NOW / NEXT / BLOCKED signal. All 123 dated entries moved unchanged to brain/history/, indexed by brain-search.
Startup reads (ritual total)~110k tokens~5.3k tokensstatus-board, lessons, patterns left the wholesale-read list. They are retrieval targets now; the startup hook already injects the last 5 lessons.
visual-design.md39KB, always loaded0.7KB pointerFull spec moved to docs/reference/, loaded only for visual work. Non-visual sessions stop paying for it.
Desktop CLAUDE.md573 lines · 16KB18 linesNow a pointer to canonical sources. It was still quoting the old offer stack, which contradicted current pricing in every session. That trap is closed.
MEMORY.md (auto-memory index)151 lines · 19.4KB117 lines · 15.6KBStatus prose compressed to true index lines. Every memory link preserved.
Injected stack (all always-loaded files)122KB · ~30.3k tokens67KB · ~16.7k tokens45% lighter, and every spawned agent inherits the lighter version.
permissions.deny0 rules8 rulesnode_modules, build output, the 270MB call database, and 520MB of forensic files are now unreadable by rule. Narrow on purpose: .env stays readable because the credential flow wants it.
Nothing was deleted. The history file answered a retrieval query on the first test after a qmd index refresh (the index was 13 days stale, a find of its own; freshness now rides the quarterly audit).

The one paragraph that outlives this page (now in CLAUDE.md): standing context is a budget. Anything retrievable on demand must not be always loaded. A new always-loaded file needs a recorded reason in docs/decisions.md, and the quarterly re-audit prunes regrowth.

Peer review

Three peer inputs, reviewed honestly

Verdicts per item: AdoptedAdaptedAlready runningSkipped

Jonathan Duque · five quick wins
  • AdoptedRun /cost and /context first. He was right that we were optimizing blind: sessions were unmeasured. Baseline receipts now live in the run record, a habit line sits in workflow.md, and the quarterly audit re-measures.
  • AdaptedModel-routing rules in CLAUDE.md. The audit found our subagent default was already pinned to haiku, so his risk runs backwards here: judgment work silently riding the cheap model. Our rule routes UP for judgment, down stays the default. His 50 to 75% saving applies where the default is the expensive model.
  • AdaptedKeep CLAUDE.md under ~300 lines. Our project file was fine; the weight hid in the stack around it (a 573-line parent file, a 39KB rules file). We applied the principle to the whole stack: 45% cut.
  • AdoptedDedupe MEMORY.md against CLAUDE.md. Real overlap found and removed, 20% lighter with every link intact.
  • Adoptedpermissions.deny for what Claude never needs. Eight narrow rules. We followed his own caution and did NOT deny .env: it is a wanted path here, and denying a wanted path costs tokens on every bounce.
Score: 5 of 5 useful. Two landed as written, three needed local adaptation because the hive's defaults differ from a stock setup.
AMM token-optimizer skill · reviewed, mined, not installed

The full skill (95 files) is methodically sound: measure, audit in parallel, synthesize, implement with backups, verify. We took six ideas straight into this pass: tiered instruction architecture, cache-friendly ordering (stable content first), the deny-rule warnings, compaction timing at phase boundaries, the session-folder pattern (we already run it as one-shot run dirs), and "optimization entropy," the reason our quarterly re-audit exists.

We did not install it. It ships a 1.6MB measurement script, ~60 Python files, its own SessionStart / PreCompact / SessionEnd hooks, and a keep-warm daemon. This workspace already registers eight hook types, and our standing rule sends every third-party kit through VET.md plus security-radar before it touches config. The audit it automates, we ran by hand in one session, and its audit phases would have missed our actual leak: the brain-file ritual is not part of a stock setup.

Verdict: mined, not installed. The checklist is the value; the machinery is surface area we do not need yet.
Fikeshway · orchestration state
  • Already runningMemory split by business, project, client, session. Ours: brain/, memory/, clients/, session logs.
  • Already runningRegistries so agents fetch only what they need. Ours: routing table, tool catalogs, module indexes, data registry.
  • Already runningContext engine + RAG instead of massive prompts. Ours: brain-search. The startup ritual was the one place we ignored our own engine; fixed today.
  • Already runningApproval gates before expensive work. Ours: operator gates, swarm-gate, workflow budgets.
  • PartialMulti-LLM routing. We route within one family by tier (haiku / sonnet / top) plus a Gemini fallback lane; full cross-vendor routing is not worth its complexity at our scale yet.
  • PartialFull telemetry on cost and tokens. Dashboard AI calls are metered per machine; Claude Code sessions now have a measured baseline and a re-audit cadence rather than live telemetry.
  • FutureSemantic caching, dynamic context budgeting, automatic compression. On the roadmap below with trigger conditions, not built on spec.
His end goal matches ours word for word: agents get smarter when they carry only what they need. That is the ladder.
Future proofing

What fills each rung next

Nothing below gets built on spec. Each item has a trigger; until the trigger fires, building it would be the same mistake the leak was: paying standing cost for on-demand value.

Roadmap with triggers
RungCandidateTrigger to build
2 · Don't loadTrim SessionStart hook injections (two skills inject full text every session, ~8 to 10KB)Next hook maintenance pass; needs its own careful review because hooks have blast radius
3 · Don't rereadLean session resume / semantic caching across projects/cost anomalies show repeat cold-resume cost, or cross-client work starts re-deriving the same context
5 · RouteLightweight-model pre-screen before expensive reasoning loopsA recurring agent loop exceeds its workflow budget twice
MeasurePer-session token telemetry (beyond baseline + quarterly)The quarterly audit shows regrowth, or /cost anomalies recur in session logs
AllQuarterly re-audit: re-measure every file in the baseline table, prune regrowth, refresh the qmd indexStanding bead, first due 2026-10-24
Compaction discipline rides along free: compact at phase boundaries (after a plan, a commit, a diagnosis), never mid-task.
Receipt
SELF-AUDIT · measured 2026-07-24 stack 30.3k → 16.7k tokens startup reads ~110k → ~5.3k entries archived 123 · deleted 0 contradictions removed 1 (offer stack) deny rules 8 em dashes on this page ? console errors ? CHECKING