[Bug] Context limit reached prematurely despite 70%+ free context available
Resolved 💬 7 comments Opened Feb 13, 2026 by SachinMeier Closed Mar 20, 2026
Bug Description
My Claude Code says context limit reached way too early. Even when my /context command says >70% context is free. This happens after 1-2 turns. I've uninstalled, reinstalled claude, tried the npm, brew, and curl installs, wiped my ~/.claude, etc. I've tried many different claude versions (2.1.[34,39,41] at least). Here is my full session:
▐▛███▜▌ Claude Code v2.1.41
▝▜█████▛▘ Opus 4.6 · Claude Max
▘▘ ▝▝ ~/Projects/Toolkit/tertiary
❯ /clear
⎿ (no content)
❯ in pr 688 can you explain why the shared/duct/src/providers/<ramp|rippling|gusto>/types.ts
file doesn't say autogenerated? were they not auto-generated? Don't read the whole files
since they're massive and will consume your context
⏺ Let me check the PR and the codegen script to understand this.
⏺ Bash(devbox run -- gh pr view 688 --json title,body | head -50)
⎿ Scope: all 16 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date
… +33 lines (ctrl+o to expand)
⏺ Read 4 files (ctrl+o to expand)
⏺ Yes, they are auto-generated — the codegen script at shared/duct/scripts/codegen.ts:221-223
generates them using the openapi-typescript library (astToString(ast)). The script writes the
output directly via fs.writeFileSync without prepending any header comment.
The resources.ts files do get a // Auto-generated by codegen.ts — do not edit manually comment
(line 191), but types.ts doesn't because the content comes straight from openapi-typescript's
astToString() — the codegen script doesn't inject a header before writing it.
So it's just an oversight. If you want to fix it, you'd add a banner before writing on line 223,
something like:
const banner = "// Auto-generated from " + specName + " by codegen.ts — do not edit manually\n"
fs.writeFileSync(path.join(providerDir, "types.ts"), banner + typesContent, "utf-8")
❯ can the openapi yaml/json files be excluded from the built images somehow? seems like that
would shrink image size signficiantly
⎿ Context limit reached · /compact or /clear to continue
❯ /context
⎿ Context Usage
⛁ ⛁ ⛀ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ claude-opus-4-6 · 50k/200k tokens (25%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁
⛀ ⛀ ⛁ ⛀ ⛁ ⛁ ⛁ ⛶ ⛶ ⛶ Estimated usage by category
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System prompt: 5k tokens (2.5%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System tools: 20.7k tokens (10.3%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ MCP tools: 15.1k tokens (7.5%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Custom agents: 676 tokens (0.3%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Memory files: 2.5k tokens (1.2%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Skills: 1.2k tokens (0.6%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ ⛀ ⛁ Messages: 6.3k tokens (3.1%)
⛁ Compact buffer: 3k tokens (1.5%)
⛶ Free space: 146k (72.8%)
and my status bar looks like: Opus 4.6 [██▌░░░░░░░] 25% | 50k/200k | ⬆ 79k ⬇ 48k
Environment Info
- Platform: darwin
- Terminal: iTerm.app
- Version: 2.1.41
- Feedback ID: 5dbe0c29-1395-4491-a970-66b93ebd0ba7
I've set these in my ~/.claude/settings.json:
"env": {
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "16384",
"CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE": "180000",
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
},...
Errors
I've redacted some paths here:
[{"error":"Error: File does not exist. Current working directory: /path/to/file\n at call (/$bunfs/root/claude:1309:6225)\n at async <anonymous> (/$bunfs/root/claude:5815:1669)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-02-13T18:27:49.363Z"},{"error":"Error: File does not exist. Current working directory: /path/to/file\n at call (/$bunfs/root/claude:1309:6225)\n at async <anonymous> (/$bunfs/root/claude:5815:1669)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-02-13T18:27:49.364Z"},{"error":"Error: File d…
Note: Content was truncated.
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗