Introduction
Many developers use Claude Code and look for ways to reduce token consumption by using skills and external tools.
But what if I told you that Claude Code includes several features enabled by default that silently impact your costs - through additional background API calls, bloating your context window, and breaking the prompt cache?
Beyond settings, our workflow habits have a significant impact. The way we run commands, fix mistakes, ask side questions, and manage long sessions can dramatically affect context size and the number of API calls made.
This article focuses on costs during ongoing work with Claude Code. For this purpose, I analyzed configuration files, environment variables, and actual API network traffic to understand what is really being sent to the model under the hood.
The goal isn't to argue that you should turn off every single feature, but rather to raise awareness of their hidden costs, allowing you to choose whether the benefit of each feature justifies its price.
This article is a follow-up to my previous article, where I explained how you can save up to 49% on a session's initial context.
Baseline Assumptions
- Claude Code version 2.1.278
- Claude Opus 5 model, unless specified otherwise.
- A Claude subscription which, according to Claude Code documentation, utilizes a one-hour TTL cache.
Features that consume tokens
Session recap
When we are in the middle of a session and no interaction occurs for at least 3 minutes, Claude Code generates a short summary of the conversation.
Is it added to the context?
The short summary is not added to the context.
Does this action consume tokens?
Yes. Generating the summary triggers an additional background API request that reuses the session's prompt cache. This action can run multiple times throughout a single session.
My recommendation
I recommend disabling it. If you ever need a summary, you can easily trigger it manually using the /recap command.
How to disable
You can disable this via the /config menu or by setting awaySummaryEnabled: false in your settings.json file.
Prompt suggestions
After receiving a response from Claude, it usually provides a prompt suggestion as a follow-up, which you can accept by pressing Tab and then Enter.
Is it added to the context?
Not added, as long as you don't use the suggested prompt.
Does this action consume tokens?
The prompt suggestion typically occurs after every single response Claude gives us. It runs as an additional background API request that reuses the session's prompt cache. This action can run many times during a session.
My recommendation
I rarely use Claude's suggestions, so the cost of this feature isn't worth it for me.
How to disable
You can disable this via the /config menu, or by setting promptSuggestionEnabled: false in settings.json, or by using the environment variable CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION: false.
opusplan model setting
This represents an automatic hybrid approach.
When the opusplan model is set, the transition between Opus and Sonnet models happens dynamically when entering or exiting plan mode.
Switching models mid-conversation invalidates the prompt cache, resulting in paying 20x to 80x more to rewrite tokens to the cache.
Auto memory
Auto memory allows Claude to accumulate knowledge and insights between sessions automatically without requiring us to write anything manually.
Is it added to the context?
Yes. You can read a detailed breakdown of its impact on the context in my previous article - How to Reduce Claude Code's Initial Context and Avoid Prompt Cache Breaks.
Does this action consume tokens?
Yes. During the conversation with Claude, the auto memory file (MEMORY.md) is updated, which consumes tokens.
My recommendation
I find it unnecessary. It can cause conflicts between the memory and other information in the context, and it takes up valuable context space.
How to disable
You can disable this via /memory, or by adding "autoMemoryEnabled": false to your settings.json, or by setting CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.
Auto mode
Claude Code features several permission modes:
- default - Manual mode
- acceptEdits
- plan
- auto
- dontAsk
- bypassPermissions
Note that default is not the actual default behavior. It is simply the name of the manual mode. The actual default permission mode is auto mode.
Auto mode allows a classifier model to decide on its own whether to approve an action or not. This classifier model uses Claude Sonnet 5 (as seen under "Cost and latency" in the link).
plan mode uses auto mode when available.
Does this action consume tokens?
Yes. Every permission decision automatically sends an API call to the classifier model, consuming additional tokens.
My recommendation
Use acceptEdits mode combined with pre-approving specific commands. For example:
JSON
{
"permissions": {
"defaultMode": "acceptEdits",
"allow": ["Bash(npm run build)", "Bash(npm test:*)", "Bash(git diff:*)", "Bash(git status)"]
}
}
How to disable
Disable Auto Mode entirely
You can completely prevent the use of auto mode by setting disableAutoMode: "disable" in settings.json. This will force the use of default (manual) mode as the default.
Prevent Auto Mode during Plan Mode
Additionally, you can prevent auto mode usage during plan mode by toggling "Use auto mode during plan" in /config or set "useAutoModeDuringPlan": false in settings.json.
Shell mode with ! prefix
You can run shell commands directly in Claude Code by prefixing the command with !.
! npm test
In practice, the shell command executes immediately on your machine, and behind the scenes, Claude Code sends both the command and its subsequent output as a prompt. Claude then responds to this prompt.
We could have simply prompted npm test and let Claude Code run it via the shell tool, but that would result in two API calls instead of one and inflate the context even further.
Is it added to the context?
Yes, both the shell command and its output are added to the context.
Does this action consume tokens?
Yes, the shell command and its output are sent as a prompt, consuming tokens as usual. Claude will independently decide how to respond to this output unless we guided it beforehand.
My recommendation
I prefer to review the shell output myself to decide what to do with it before Claude receives it.
Therefore, I configure Claude so the shell command and its output are not sent as a prompt, but only added to the context.
Once it is in the context, I can write a specific prompt telling Claude exactly what to do with that output. Additionally, this gives us the option to change our minds - if we regret running the command, we can use /rewind to remove the shell command and its output from the context before any API call is made.
How to disable
You can configure it so the output is added to the context without triggering a new API call by setting respondToBashCommands: false in settings.json.
Language Server Protocol (LSP) plugins
The LSP is a tool designed for two main purposes:
- It immediately identifies syntax/type errors and warnings in your code right after a file edit.
- It serves as a highly effective code navigation tool.
There is a Claude Code plugin that connects to the LSP, allowing Claude to receive this data and fix code issues without needing an extra build step to identify them. Furthermore, it allows for much more precise code navigation compared to standard grep-based searches.
Is it added to the context?
Yes, it is added as a tool named "LSP" along with its schema.
When used, the tool call (tool_use) and the LSP's response (tool_result) are added to the context like any other tool.
Does this action consume tokens?
Using LSP actually saves tokens for the following reasons:
- After every file edit, the LSP automatically reports errors and warnings, allowing Claude to fix issues without a separate build step.
- Code navigation is much more precise and efficient than running a
grepcommand and analyzing the output, which would otherwise fill the context with a large number of irrelevant results.
My recommendation
I believe it is crucial to use this plugin because it saves extra token-consuming API calls and performs actions faster than standard commands Claude would otherwise use, such as grep.
Check out this Reddit post comparing code navigation using Claude Code with and without LSP. The performance difference is clear.
Installing the plugin
The LSP binary and the Claude Code plugin depend on the programming language used in your project. You can find the list of LSP binaries and Claude Code plugins here.
You must install the LSP binary on your machine before installing the Claude plugin.
Context command (/context)
A command that outputs the number of tokens in the context, divided by categories (system prompt, system tools, messages, etc.).
Is it added to the context?
The text printed to the screen adds ~2,100 tokens to the context.
Every time you run the command, another 2,100 tokens are added (in addition to the previous ones).
Does this action consume tokens?
The /context command is not billed for tokens because it makes API calls for token counting, not for model inference.
However, because it injects 2,100 tokens into your context, you will pay for those tokens on every single subsequent prompt you send!
My recommendation
Add the token count of the context window to your terminal's statusline so you are always aware of your context window during a session.
Additionally, use this command only at the beginning of a conversation to understand how much space different components (skills, MCPs, etc.) consume, in order to perform context engineering.
Workflow Best Practices (Beyond Settings)
Delegate verbose operations to subagents
Subagents are specialized AI assistants that handle specific types of tasks.
If the main agent were to perform tasks like reading massive log files, it would fill your main conversation's context with irrelevant information. Instead, the main agent can delegate verbose tasks to a subagent, which does the heavy work and returns only the relevant conclusions to the main agent.
A subagent has its own context without the parent's conversation history and does not use the parent's cache.
You can create a custom subagent and configure its initial context, including parameters such as: model to use, effort level, skills to preload, persistent memory scope, and whether to load the CLAUDE.md file.
When using built-in subagents (Explore, Plan, General-purpose) in Claude Code, you can specify which model to use on a per-invocation basis.
Example: Spawn an Explore subagent on Haiku to find X
Use subagents wisely, or you will end up with unnecessary token consumption.
Side questions with /btw command
The /btw command is designed for asking a side question about your current session (including the full conversation history) without adding the question and the answer to your main conversation's context, and without using tools.
Because it uses the existing context, it successfully reads from the cache. However, note that the cache write will be for 5 minutes, unlike the 1 hour used in the main conversation.
Rewinding the conversation
If Claude provides an incorrect answer due to a poor prompt or a misunderstanding, don't argue with it in subsequent messages. Explaining "No, that's not what I meant, please undo that and try X" compounds unnecessary context that you will pay for on every subsequent turn.
Instead, run /rewind to roll back the conversation to the turn before the mistake occurred. Fix your initial prompt and regenerate. Your context window stays lean, clean, and focused.
Course-correct early (The ESC Key)
When you see Claude starting to generate an answer and realize it's heading in the wrong direction, you can stop it immediately by pressing the ESC key.
Is it added to the context?
Yes, your prompt and Claude’s partial response are added to the context.
Since this is irrelevant data, you can rewind the context to a previous state using the /rewind command.
Does this action consume tokens?
The act of stopping the generation does not consume tokens. You only pay for what Claude generated up to that point.
Stopping it early actually saves you from paying for the remaining output tokens Claude would have wasted on completing a wrong answer.
Output tokens are significantly more expensive than input tokens (often 5x the price).
Beware of Cache Misses on Idle Sessions
To maximize the benefits of prompt caching on Claude subscriptions, avoid leaving an active session idle for more than an hour without completing the task.
If the 1-hour cache expires, your next prompt will force a full cache rewrite of your entire context. Depending on the model, a cache write is 20x to 80x more expensive than a cache read under 1-hour cache TTL.
My recommendation
Always try to complete your task with Claude without leaving the session idle for over an hour.
Treat your sessions like focused sprints. Aim to finish your current interaction with Claude before taking a long break. Stepping away for more than an hour expires the cache, forcing a full cache rewrite for the entire context.
Resetting to a Clean Session
When we want to start a fresh session, we use the /clear command.
Is it added to the context?
While this initiates a new session, it ironically adds the /clear command itself into the new context, along with text explaining that this is a user command. This adds ~130 tokens.
Does this action consume tokens?
No. The command itself is executed locally and does not trigger an API call or consume tokens.
Workaround
If you want a truly empty context, you have two options:
- Restart the Claude Code CLI entirely.
- Run the
/rewindcommand and revert to the message that says "/clear". This gives you a completely empty context. Bug Note: There is currently a bug in Claude Code where rewinding to the very beginning of the conversation causes the Skills list to fail to load into the context. This means that if you later want to use a skill, Claude will have to read the skill files manually, which wasting tokens.
Conclusion
Efficient and cost-effective development with Claude Code isn't just about smart prompting. It requires a deep understanding of what happens behind the scenes to make informed use of tokens and properly manage context.
As we've seen, reducing costs comes down to two key areas:
- Precise system settings: Disabling default background features (recap summaries, prompt suggestions, classifier auto-modes) and enabling efficient tools like LSP.
-
Disciplined workflow habits: Interrupting generations early with
ESC, rolling back mistakes with/rewind, managing side questions with/btw, and delegating verbose text-analysis tasks to subagents.
Ultimately, the goal isn't to turn off every feature or limit your developer experience, but to manage your environment wisely - ensuring that every token you pay for brings real value to your codebase.
Here is a summary of the settings discussed in this article:
{
"promptSuggestionEnabled": false,
"awaySummaryEnabled": false,
"autoMemoryEnabled": false,
"respondToBashCommands": false,
"disableAutoMode": "disable",
"useAutoModeDuringPlan": false,
"permissions": {
"defaultMode": "acceptEdits",
"allow": [
"Bash(git status)",
"Bash(git diff:*)",
"Bash(npm test:*)",
"Bash(npm run build)"
]
}
}
Top comments (0)