cd /news/ai-tools/why-you-keep-hitting-claude-code-s-u… · home › topics › ai-tools › article
[ARTICLE · art-178031] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=· neutral

Why you keep hitting Claude Code's usage limit: 8 fixes, measured on 6 billion tokens

A developer analyzed three months of Claude Code logs covering 6 billion tokens, 624 sessions and 2,193 subagents, finding that 71% of spend went to context re-read on every turn rather than model output. The largest single consumer was scheduled `claude -p` jobs that start fresh sessions and pay full startup cost each run, followed by long un-cleared conversations and subagents, which accounted for 60% of usage. The developer packaged the findings as a read-only Claude Code plugin, `agent-wrapped`, that inspects MCP servers, CLAUDE.md size, scheduled jobs and subagent model settings to surface token leaks.

recommendation

Clear context between tasks, disable unneeded MCP servers, trim CLAUDE.md, and set search-only subagents to Haiku or Sonnet to cut per-turn context cost.

more in playbook: Controlling LLM cost
read3 min views2 publishedNov 29, 2026

If Claude Code tells you "You've hit your session limit" more often than you expect, the cause is usually not the work you asked for. It's what rides along with every request.

I measured three months of my own logs (6 billion tokens, 624 sessions, 2,193 subagents) with Agent Wrapped. 71% of the spend was context (the conversation written to the prompt cache and read back each turn), not the model's answers. Here are the fixes that matter, roughly in order of what they saved.

In 7 of my 9 limit walls, the biggest consumer was a scheduled agent: a claude -p job running every 15 to 30 minutes. Each run starts a fresh session and pays the full startup cost (system prompt, tool definitions, memory files) before doing anything.

Fix: list what runs on a schedule (cron, Task Scheduler, launchd, ~/.claude/scheduled-tasks/). Run each job less often, or batch the work into fewer, larger runs.

/clear between tasks Every turn re-reads the entire conversation. Past about 150k tokens, each extra turn pays for all of it again. My most expensive sessions peaked above 500k tokens of context.

Fix: when you switch to a new task, /clear. The new task doesn't need the old task's 200k tokens riding along.

/compact before you walk away The prompt cache expires. Come back after a long and the whole conversation is written to the cache again at the full write price, which is much more than reading it.

Fix: at a natural stopping point, /compact and say what to keep (/compact keep the API design and the failing test). Coming back to a small context is cheap.

Caches are per model, and the tool list sits at the start of the prompt. Switching with /model, or connecting and disconnecting MCP servers partway through, throws the cache away and rewrites everything after it.

Fix: pick the model and tools at the start of a session.

Every connected server adds its tool descriptions to every request of every session and every subagent. My median subagent started at 28k tokens before doing any work.

Fix: /mcp and turn off what this project doesn't need.

CLAUDE.md and memory files load on every request. A 6,000-token CLAUDE.md costs 6,000 tokens on every turn.

Fix: keep only what the agent needs every time. Move rarely needed detail into separate files it reads on demand.

One big tool result (a PDF, a lock file, a full test log) is paid for when it arrives and again on every later turn of the session. I had 5,858 results over 4,000 tokens.

Fix: "read lines 100 to 180", Grep first, add | tail -50 to noisy commands, and give page ranges for PDFs. Put "keep command output short" in CLAUDE.md so it's the default.

Subagents were 60% of my usage. Much of that work is searching and summarizing, which a smaller model handles well.

Fix: in .claude/agents/<name>.md, add model: haiku or model: sonnet to agents that only search, read or summarize. Keep the top model for the main thread.

I packaged these checks as a Claude Code plugin. Install it:

/plugin install agent-wrapped --marketplace novastudio1shop-source/agent-wrapped

Then run /agent-wrapped:leak-check. Claude inspects your MCP servers, CLAUDE.md size, scheduled jobs, biggest sessions and subagent settings, and gives you a fix list. It's read-only.

For the actual numbers (tokens and API-price value per session, every cache rebuild, oversized context, the biggest tool results, and what was running before each time you hit the limit), open the free Agent Wrapped page. It reads your ~/.claude logs in the browser and uploads nothing. There's also a $9 version with the per-session detail and an export.

What's the biggest leak you've found in your own setup? I'm collecting them for the next version.

Independent tool, not made or endorsed by Anthropic.

── more in #ai-tools 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/why-you-keep-hitting…] indexed:0 read:3min 2026-11-29 · —