What is the /context Command in Claude Code
The /context
slash command is a context inspection tool introduced in Claude Code v1.0.86 that shows an approximation of your context usage across different components. It displays token consumption and remaining context window percentage for strategic context optimization.
How to Use It
Simply type /context
in your Claude Code session to get a detailed breakdown of context usage across all system components.
/context
The command displays token usage for:
- System Prompt - Core instructions and behavior definitions
- System tools - Built-in Claude Code functionality
- MCP tools - Model Context Protocol server integrations
- Memory files -
CLAUDE.md
and project context - Custom Agents - Specialized sub-agent definitions
- Messages - Current conversation history
Why Use It
The /context
command enables data-driven context engineering where you can optimize performance by understanding exactly how your context window is being consumed. This is essential for maintaining peak Claude Code performance throughout long sessions.
Benefits:
- Token Visibility - Clear breakdown of context consumption across all components
- Strategic Optimization - Make informed decisions about MCP tools and Custom Agents
- Performance Engineering - Identify context bloat before it impacts response quality
- Baseline Awareness - Understand fundamental context overhead for better planning
- Interactive Analysis - Ask Claude to review usage and suggest improvements
Context engineers use this tool to tactically enable/disable MCP tool functions and optimize Custom Agent efficiency with full knowledge of token consumption.
After running /context
, ask Claude: "Where is my context potentially inefficient?" to get optimization suggestions and create a feedback loop for continuous improvement.
Use /context
data to make informed decisions about which MCP tools provide sufficient value for their context overhead, eliminating guesswork from context optimization.
See Also: Context Inspection|Context Window Depletion|Custom Agents|Agent Engineering