Context Management
Control what Claude sees to get precise, focused assistance.
What is Context?
Context is all previous text in your conversation:
- Every message you've sent and Claude has sent
- All file content shared or read
- System instructions from CLAUDE.md files
- Tool outputs from commands Claude has run
- Current goals and constraints you've established
Claude uses this text to predict each response. When the context window fills (fixed size in tokens), older content gets truncated. Each new session starts fresh.
How Context Affects Responses
Claude predicts each token based on all previous text in the conversation. When your context contains mixed topics (authentication, UI design, database), all of these influence the next prediction. This creates unfocused, scattered responses.
Sharp focus = better results: When context contains only information relevant to your current task, predictions stay precisely on target.
Steering with Context
Start clean and focused:
/clear # Start fresh for new tasksBe specific about your current task and set explicit boundaries:
> Debug JWT token expiration - focus only on token generation and validation> Only work on the login endpoint - don't suggest changes to signupControl information flow:
- Add context progressively (start narrow, add details as needed)
- Show only relevant code (not entire files)
- Use
/compact <topic>when context fills to refocus
Refocus the conversation:
> Let's stick to fixing the token issue - save optimization ideas for later> Start fresh session for that - this one is focused on authenticationExample: Focused vs Scattered
Scattered context (poor results):
> Fix the login bug
> Also, what about adding OAuth?
> And should we redesign the UI?
[Claude suggests changes across all three areas, none deep]Focused context (sharp results):
> /clear
> Debug why JWT tokens expire immediately. Focus only on token validation.
[Share only auth middleware code]
[Claude provides deep analysis of token expiration issue with specific fix]Related
- Extended Thinking - How extended thinking affects context usage
- Memory - Persistent project context via CLAUDE.md
- Prompting - Clear communication techniques