Skip to main content
This walkthrough is a system-design reasoning exercise, not a claim about Claude Code’s confirmed internals. Where a section shows a number, it is cited below. Where it shows a worked example, it is labelled illustrative — no invented figures are attached to it. That line matters: keep it intact if you remix this.

Sourced figures

Prompt caching — up to 90% cost / 85% latency reduction

Anthropic’s own published figures for long, cached prompts. Used on the token-reduction question as the one lever with an official number; the other five levers are real patterns shown without invented percentages. Anthropic documentation — prompt caching

Model-routing hook — ~90% mean token savings, 350-line threshold, 10–30s added latency

From Spotify Engineering’s “Portal / shunt” post (Sept 2026). This is a third-party plugin, not native Claude Code behaviour — only the PreToolUse hook mechanism itself is native. The real mechanism is a single binary line-count check; it does not detect “reasoning need.” Edits, debugging, architecture decisions and safety-critical code are excluded from routing by design, not per-call detection. Treat the 90% as that team’s result on one Java monorepo, not a universal one. engineering.atspotify.com — Portal / shunt

Multi-agent research — +90.2% task success, ~15× token cost, 80% of the gap explained by token spend

From Anthropic’s “How we built our multi-agent research system.” This is Anthropic’s Research system (Opus lead + Sonnet subagents on breadth-first search tasks), not Claude Code specifically. Anthropic explicitly notes the pattern is worse for tightly-coupled work like most coding — which is exactly why the following question gates delegation instead of applying it everywhere. anthropic.com/engineering — built-multi-agent-research-system

Context rot — referenced qualitatively, no single stat

From Anthropic’s “Effective context engineering for AI agents.” As tokens accumulate, models measurably lose the ability to use the full window well. Left number-free on purpose — Anthropic doesn’t publish one single figure for it. anthropic.com/engineering — effective-context-engineering

Seven local stores — observed layout, not a stable API

Based on inspecting Claude Code’s local ~/.claude directory. The JSONL session-log format and location are independently confirmed by community tooling; treat the other exact paths as an observed layout of a specific version, not a documented stable public API.

git worktree isolation — native, documented feature

isolation: worktree is a documented, native Claude Code feature: a separate working directory with its own branch, sharing the parent repo’s history. code.claude.com/docs — worktrees

Core tool set & planning — real, documented features

Read / Grep / Glob / LS, Edit / Write, Bash, Plan Mode and TodoWrite are real, documented Claude Code features. code.claude.com/docs

Deliberately illustrative

The following are framed as reasoning, not measured benchmarks — keep that framing if you reuse them:
  • The two-task worked example (small rename vs. OAuth refactor) — an application of the delegation gate, not data.
  • The general lever list for token reduction, aside from the cited caching figure — real, common patterns shown without invented numbers.

About this project

This guide is built with Mintlify. Its content was migrated from the original question-and-answer walkthrough. Published figures and their caveats are retained; diagrams are rendered with Mermaid. Back to the walkthrough