Why your Claude Code context fills up, and what I do about it
Every Claude Code session runs on a budget you never see. Before you type a word, part of the context window is already spoken for. Then every file Claude reads, every command it runs and every message you send takes another bite. When it gets tight, older stuff gets summarized away, and Claude starts losing track of things you told it an hour ago.
I built a small context window budget demo in the lab so you can feel this instead of just reading about it. Pick “Long debugging day,” push the tool output slider up, and watch the room for the reply shrink. Then hit “Compact the conversation” and see what you get back. The numbers are rough on purpose. The tradeoffs are the point.
Here’s what’s actually filling the window, and what I do about each piece.
What loads before you type
The system prompt and tool definitions go in first. That’s Claude Code itself, and you don’t control much of it.
Then comes your stuff. Your CLAUDE.md files, auto memory, the short descriptions of any skills you have installed, and your MCP servers. MCP tool definitions are deferred by default now, so only the tool names and each server’s instructions load until Claude actually needs one. That’s a lot better than it used to be. But ten connected servers is still ten servers’ worth of names and instructions sitting there for the whole session, whether you touch them or not.
None of this is huge on its own. It just never goes away.
What piles up while you work
This is where the real growth happens.
Files read. Every file Claude opens lands in context. Ask a vague question and it may read a dozen files to orient itself.
Conversation turns. Your messages and Claude’s replies, all of them, for the whole session.
Tool output. The big one. A full test run, a stack trace, a diff that touched a lockfile, a log you asked it to look through. Claude Code sends the whole conversation with every request, so the 3,000 line log from this morning is still riding along this afternoon.
If you play with the demo for a minute, you’ll see tool output and conversation turns are what actually crowd out the reply. The fixed stuff at the top matters, but the pile in the middle matters more.
What I actually do about it
I look before I guess. /context shows a colored grid of what’s using space right now, broken down by category, with suggestions. Half the time the answer is obvious once you see it.
I clear between unrelated tasks. /clear starts a fresh conversation and keeps your project memory. This is the single biggest habit. Old conversation about a bug you already fixed is just noise for the next task. You can pass a name, like /clear auth-fix, so it’s easy to find with /resume if you need to go back.
I compact with a focus. Claude Code compacts on its own when the window gets close to full, but the automatic pass has to guess what matters. Running it yourself with instructions works better: /compact keep the failing test names and the fix we agreed on. You can also put a “Compact instructions” section in CLAUDE.md so the automatic pass knows what to keep.
I hand noisy work to subagents. Running the test suite, digging through logs, reading docs, exploring a part of the codebase I don’t know. A subagent does that in its own context window and only sends back a summary. The giant output never touches my main session.
I trim MCP servers. /mcp lets you disable servers you’re not using today. And if there’s a CLI that does the job, like gh for GitHub, I lean on that instead. Claude can just run the command, and there’s no server listing sitting in context.
I keep CLAUDE.md short. It loads every session, so every line costs you every time. Anthropic’s own guidance is to keep it under about 200 lines. Workflow specific stuff, like how to run a release or review a migration, works better as a skill, which only loads when it’s used.
I use /btw for side questions. Quick “wait, what does this flag do” questions don’t need to live in the conversation forever.
What doesn’t help much
Jumping to the 1M token window doesn’t fix a messy session. It gives you more room, and some days that’s exactly what you need. But a sloppy session just gets sloppier before compaction kicks in, and every request still carries all of it. Flip the demo between 200k and 1M with the same sliders and you’ll see what I mean.
Giant pasted logs are the other trap. Paste the 30 lines that matter, not the 3,000 around them.
Try it
Go play with the context window budget demo. Start with “Fresh session,” then jump to “Long debugging day” and see how fast the room for the reply disappears. Then run /context in your next real session and compare. Odds are it’ll change at least one habit.