Original Reddit post

Hey everyone, If you are running long sessions with Claude Code (especially using the 1M context window), your token limits can vanish fast (especially the 5 hour limit). Every multi-turn file edit or long background task triggers massive re-caching. If you don’t control how Claude handles its context and subagents, you’ll burn through your credit allowance on redundant context overhead. Add these two parameters to your project’s .claude/settings.json file (or your global configuration) to keep your sessions lean: Your .claude/settings.json file should look like this: { “autoCompactWindow”: 200000, “subagentPromptCacheTtl”: “1h” } Default subagent cache ttl is 5 mins. Bonus tip: Avoid reactivating claude sessions when switching between multiple profiles. Another option is to switch to 200k but then it will trigger frequent compaction but it still helps overall. Hope this helps. submitted by /u/karthiksync

Originally posted by u/karthiksync on r/ClaudeCode