The context window is Claude's working memory. Your conversation, file reads, command outputs and system prompts ALL live in this one fixed-size space. Handle it well and you get a productive 30-minute session. Handle it badly and Claude starts losing the plot after 10.
What Consumes Context
Some things eat way more context than others.
Source
Impact
Notes
Your messages
Low
Short prompts are efficient
Claude's responses
Medium
Long explanations add up
File reads (Read tool)
High
Large files consume significant space
Command outputs (Bash)
High
Verbose build/test output is expensive
CLAUDE.md
Low-Medium
Loaded once at session start
MCP tool calls
Medium
Each response adds to context
Conversation history
Cumulative
Every message stays until /compact or /clear
Signs of Context Degradation
Keep an eye out for these.
Claude "forgets" something you told it earlier
Answers get vaguer and more generic
Claude re-reads files it already read
The quality of its edits slips
Claude starts guessing when it should be checking
/compact: Your Best Friend
The /compact command squishes the conversation down into a summary while hanging on to the important stuff. Reach for it when any of these happen.
Context usage hits 60-70%
You just wrapped one subtask and you're starting another
Claude just read a bunch of big files
Wordy command outputs have bloated things
What /compact keeps.
Key decisions made during the conversation
File paths and functions you talked about
The current task and where it stands
Recent edits and why they were made
What /compact tosses.
Detailed file contents (Claude can re-read them if needed)
Wordy command outputs
Old reasoning that doesn't matter anymore
Repeated or redundant info
/clear: The Fresh Start
Use /clear in these situations.
You're switching to a totally unrelated task
The conversation has gone off the rails
Context is above 80% and even /compact won't free up enough
You want to try a different approach from scratch
Subagents for Context Isolation
When Claude uses the Agent tool to spawn a subagent, that agent gets its own context window. That's handy for a few things.
Exploring big codebases without cluttering your main session
Running complicated searches that spit out a ton of output
Handing off independent subtasks
The subagent only reports back a summary, so your main context stays clean.
The One-Task-Per-Session Pattern
Here's the context strategy that works best, hands down.
Start a session with one clear goal
Give Claude the task
Let it finish the task
End the session (or /clear for the next task)
Why this works.
All of Claude's context is focused on one thing
Nothing unrelated is fighting for attention
The results stay consistently good
You never hit the foggy zone halfway through a task
Practical Context-Saving Tips
1. Give File Paths Upfront
Example
# Context-expensive (Claude searches)
"Fix the bug in the login form"
# Context-cheap (Claude goes straight there)
"Fix the TypeError in src/components/LoginForm.tsx line 42"
2. Limit Output Verbosity
When you run commands, pipe them to head or use flags that cut down the output.
Example
# Instead of: npm test (which might dump 500 lines)
# Use: npm test -- --reporter=dot (minimal output)
3. Be Concise in Your Prompts
Every word you type costs context. Check out the difference.
Example
# Verbose (wastes context)
"Hey Claude, I was wondering if you could please take a look at
the authentication middleware and maybe if you have time could you
add some rate limiting to prevent abuse? I think that would be
really helpful for our production deployment."
# Concise (same request, less context)
"Add rate limiting to the auth middleware in src/middleware.ts.
Use 100 requests per minute per IP."
Same request, half the words. (Being polite to the robot is sweet, it's just not free.)
4. Don't Ask Claude to Explain Unless You Need It
"Add the feature" uses less context than "Add the feature and explain every decision." Save the explanations for when you're actually trying to learn something.
Monitoring Your Context
Run /context regularly. It draws a lil grid of what's filling your context window and suggests ways to free up space. Here's how to read the numbers.
0-40%. Tons of room. Work like normal.
40-60%. Healthy range for mid-task work.
60-70%. Start thinking about /compact.
70-85%. Compact now. Quality might already be slipping.
85%+. Compact right away or /clear. You're deep in foggy territory...
If you let it fill all the way up, Claude Code compacts automatically so your session doesn't just die. Doing it yourself first is still better, because you pick the moment (and you can tell /compact what to focus on).
TL;DR
The context window is limited working memory, and everything lives there
File reads and command outputs are the biggest context hogs
Use /compact at 60-70% to free up space and keep the important stuff
Use /clear when you switch to an unrelated task
Subagents keep exploratory work out of your main context
One task per session is the safest way to keep quality high
Give file paths and keep it short to avoid wasting context