Manage token and context usage in Claude Code
Manage Claude Code token and context usage with /context, /context all, and /usage commands.
Lesson Content
Check context usage
To see all of the content that consumes your current conversation window, run the /context command. This outputs a full breakdown of your current context, including what percentage of that context is used for your system prompt, system tools, MCP tools, memory files, skills, and messages. It also shows the amount of free space you have left in the context, as well as how much of it is reserved as a buffer for autocompaction.
You'll want to aim for as low of context usage as possible, while still retaining the functionality that you need. Look out for external tool integrations like MCP servers acting as spaces hog in particular, as they can quickly fill up context windows. Because of this, if you are having issues with context windows filling up, it could be a good idea to disable any plugins or skills that you don't currently use, and only enable them only when you're working on a task that needs access to them.
It's a good idea to periodically check the context with the /context command, just to ensure no bloat is entering your normal workflows. If you notice the context being used up really quickly, it could point to a sign that something wonky is going on with your build.
Check all context
While you can get a summary of the context window usage with /context, you can retrieve a much more detailed response by passing all to the end of this command:
/context allThis gives you a full breakdown of MCP tools, skills and plugins, along with exactly how many tokens they take up. In this list, note that although I have many MCP tools available, they aren't currently enabled, as they are grayed out. This means that they don't unnecessarily take up context within conversations unless or until they are enabled. You'll also want to follow a similar approach, and only enable these tools when necessary to avoid filling up the context window.
Check token usage
While /context shows you what's in your current conversation, the /usage command tells you how much of your plan's limits you've consumed. This is your bird's-eye view of overall usage across all of your Claude Code sessions.
To get a breakdown of your current last day or week of usage, you can tap d or w on the keyboard to see the consumption of those respective periods. This could help you pace yourself throughout the day or week, especially if you're on a plan with stricter limits. You can also scroll down a bit more to see what percentage of skills, subagents, plugins and MCP servers take up your overall usage.
Get your Claude Code stats
You can also toggle over to the Stats tab to see a cool rundown of all of your Claude Code usage, and page down and over to see your usage stats over specific models. If you tap r, you can cycle through the last 7 days, last 30 days, or all time usage of these models.
Join the discussion!
Comments
Want to comment on this lesson?
Log in to leave comments.