| Shrink the instruction filesCLAUDE.md and AGENTS.md, global plus project, total about 11k tokens. They sit in every call, so their cost is 11k tokens times 54,683 calls. Move runbooks, notification rules and env manifests into Skills, which load only when a task needs them. Target under 200 lines combined. - Back up ~/.claude/CLAUDE.md and AGENTS.md
- Move runbook sections (Supabase, Railway, notifications, env manifest, UX, group chat) into Skills
- Rewrite both files to under 200 lines combined
- Add a Compact instructions block
- Count tokens before and after
Done 17 Sep: 11.4k → 3.4k tokens, rules moved into 10 load-on-demand skills. | Rules in the fixed prefix | 3.1% | 3.0% | opus Editing global rules needs judgment |
| Turn off unused MCP serversThe first call of each session writes about 40k tokens before you have said anything. About 11k is rules. The rest is the system prompt and the tool list from every connected MCP server. Run /mcp at session start and disable what the task does not need. This session has about 12 servers connected. - List every configured MCP server and plugin
- Flag the five that failed to connect this session
- Remove dead ones, mark rarely used ones for per-task enabling
- Report the tool-list token footprint before and after
Done 17 Sep: 4 dead servers removed (~1,100 tokens/call). Cloudflare connector must be removed at claude.ai/settings/connectors. | Tool list and system prompt | 7.7% | 7.3% | sonnet Config audit, low risk |
| CLIs instead of MCPgh, aws, railway and sentry-cli run through Bash and add nothing to the tool list. An MCP server for the same job adds its tool names to every call for the whole session. Same slice as the row above. - Map each MCP server to a CLI already installed (gh, railway, supabase, wrangler)
- Recommend which servers to drop for good
Done 17 Sep: Railway + Safari MCPs dropped; Railway CLI and Playwright skill cover them. | Tool list and system prompt | part of 7.7% | part of 7.3% | sonnet Same agent as the MCP audit |
| Trim tool output with hooksEvery test run, build log and file read stays in the conversation and is re-read on each later call. A PreToolUse or PostToolUse hook that greps or truncates output before it lands cuts this at the source. Measured as the re-read cost of tool results in history. - Read the current hooks docs
- Write a PreToolUse hook that caps Bash output at head and tail
- Register it in ~/.claude/settings.json
- Run a noisy command and confirm the cap
Done 17 Sep: Bash output capped to first 60 + last 40 lines; verified on a 500-line command. | Tool output re-read | 8.6% | 2.9% | sonnet Needs the hooks docs and a test |
| Compact earlierCost of every token above 200k in a call. In the 30-day window 40% of calls were over 200k. After auto-compact was set to 200k on 11 Sep that fell to 3%. Going to about 120k cuts it further. Add compact instructions so summaries keep the deploy plan and open bugs. - Set autoCompactWindow to 120000 in ~/.claude/settings.json
- Confirm CLAUDE_CODE_SUBAGENT_MODEL is still sonnet
Done 17 Sep: auto-compact at 120k; subagents default to Sonnet. | Tokens above 200k per call | 21.1% | 2.8% | haiku One settings key |
| Don't resume cold sessionsCold-resume cost is driven by SIZE, not resume frequency: 72% came from prefixes already >200k; only 55% from gaps under 6 hours. Login restore was $176/$1,032 total. The real lever is auto-compact at 120k (executed above), which prevents oversized prefixes before they rewrite. Measured on 30 days of real transcripts; cold-resume is secondary. - Start a fresh session per task
- Paste a three-line summary instead of resuming
| Cold-resume rewrites | 11.5% | 6.7% | none Behavior, already in the rules |
| Subagents for noisy workTests, doc fetches and log reads run in a subagent and only the summary returns to the main thread. This is what subagents themselves cost. Sonnet subagents do the same routine work at 40% of the price, which is why the share fell. - Verified by the settings check above
| Subagent spend | 16.8% | 14.1% | none Already set on 11 Sep |
| Context-editing APIAnthropic's server-side option that clears old tool results once they pass a token trigger. Only available if you build your own harness on the API or Agent SDK, and each clear breaks the cached prefix, so it can cost more than it saves unless tuned. Not measurable from Claude Code logs. API docs | Tool output re-read | n/a | n/a | none Only if a custom harness is built |
| Cache-fix proxyA community proxy that normalizes request order so resumed sessions hit the cache instead of rewriting. One author reports up to 20× on affected resumes. Not verified here. Targets the cold-resume slice. GitHub | Cold-resume rewrites | n/a | n/a | none Unverified, not installing |
| Wait for AnthropicThe full-history re-send on every call is a known open issue with no shipped fix. Issue 24147 | Everything above | n/a | n/a | none Nothing to do |