[Bug] Parallel sub-agents inherit full parent context, causing excessive token consumption without cost warnings
Bug Description
Hi — reporting a session-cost issue with Claude Code on Claude Opus 4.7 (1M context).
DATE: 2026-04-28
MODEL: claude-opus-4-7 (1M context)
OUTCOME: ~425K tokens consumed in a single session (~$10 USD), hit 96% of my usage limit, blocked from Claude for ~4 hours. The session produced no usable deliverable for the task I requested.
WHAT HAPPENED
The model launched 4 parallel sub-agents (forks) for research without estimating or warning me about the cost. One of the forks was tasked with reading 24 local files with known keywords — work that a single grep command would have done at <20K tokens, but as a fork it consumed 106K tokens because forks inherit the full parent context (~120K tokens of system prompts + conversation history) on top of doing the task.
TOKEN USAGE FROM THE 4 FORKS (numbers reported by the model itself):
- Fork 1 (local file scan, replaceable by grep): 106,421 tokens
- Fork 2 (web research, MLRR T-MEC): 70,062 tokens
- Fork 3 (web research, labor reform): 82,057 tokens
- Fork 4 (web research, Audi data): 68,890 tokens
Subtotal forks: 327,430 tokens
Parent conversation (estimated, no API to query): ~95–110K tokens
WHAT I'D LIKE
- Clarification on whether tokens consumed by sub-agent forks count against my user usage limit (they appear to).
- Consideration for partial restoration of my usage limit given the wasteful execution pattern.
- Forward the following product feedback to the Claude Code team.
PRODUCT FEEDBACK
- No warning when the user usage limit approaches 80/90/95%.
- No way for the model to query its own session cost in real time before launching expensive operations (no internal
/costequivalent). - No automatic warning when a batch of parallel forks is about to replicate large amounts of inherited context.
- The model's documented heuristic ("forks are cheap because they share prompt cache") encourages over-forking even when a simple
grep/Readwould be both faster and cheaper. The cache-sharing
claim is true for cache HIT cost, but does not eliminate the cost of replicated input on first use across N parallel forks.
- When a fork's transcript is in
/private/tmp/...and the system prompt warns the model not to read it, the only way to preserve fork output across sessions is to write it to disk — which costs
additional output tokens. Suggest an API to retrieve fork output as plain text.
I can share a full technical report from the session if helpful. Thank you
Environment Info
- Platform: darwin
- Terminal: Apple_Terminal
- Version: 2.1.122
- Feedback ID: 031a11b1-8a6e-46f3-8981-e108deda3570
Errors
[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/diego/.local/share/claude/versions/2.1.122 (expected in multi-process scenarios)\n at x86 (/$bunfs/root/src/entrypoints/cli.js:2769:2177)\n at jw8 (/$bunfs/root/src/entrypoints/cli.js:2769:1257)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-28T20:22:46.717Z"},{"error":"MaxFileReadTokenExceededError: File content (39501 tokens) exceeds maximum allowed tokens (25000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n at qm7 (/$bunfs/root/src/entrypoints/cli.js:4852:12789)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-28T20:47:43.655Z"},{"error":"AxiosError: Request failed with status code 403\n at Cn (/$bunfs/root/src/entrypoints/cli.js:115:1194)\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:120:12716)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:865:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/src/entrypoints/cli.js:122:2467)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-28T20:48:33.470Z"},{"error":"AxiosError: Request failed with status code 403\n at Cn (/$bunfs/root/src/entrypoints/cli.js:115:1194)\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:120:12716)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:865:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/src/entrypoints/cli.js:122:2467)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-28T20:48:52.329Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:120:13313)\n at emit (node:events:92:22)\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:119:3321)\n at request (/$bunfs/root/src/entrypoints/cli.js:122:2467)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-28T21:08:49.760Z"},{"error":"Error: Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest: timeout of 30000ms exceeded\n at hj5 (/$bunfs/root/src/entrypoints/…
Note: Content was truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗