Last updated 13 October 2026
Use planning mode to forecast token usage
The risk of blind execution during large tasks
You are standing at the edge of a major refactor. You need to change how the data layer interacts with the service layer across fifty files. You type your prompt into Claude Code and hit enter. In the default permission mode, the agent might start working immediately. This behavior is helpful for small fixes, but for a structural change, it can quickly consume your daily budget. The agent uses the Glob tool to find files and then the Read tool to ingest them. If your project has many large files, the input tokens for those files will fill your context window before the agent even writes a single line of code.
Every time the agent uses a tool, it generates a new turn in the conversation. These turns add up. If the agent makes a mistake in its initial assumptions, you pay for those tokens twice: once for the incorrect work and once for the correction. You need a way to see what the agent intends to do before it starts the expensive process of reading and writing files. Forecasting your token usage is not about getting a perfect invoice in advance. It is about understanding the scope of the work so you can decide if the task is worth the current cost.
Switching to planning mode for a strategy overview
The most effective way to forecast costs is to use the planning mode. You can cycle through permission modes by pressing Shift+Tab inside a session. When you reach the plan mode, the agent changes its behavior. Instead of executing tools like Edit or Write, it creates a strategy. It will still use tools like Read or Glob to understand the codebase, but it will not attempt to modify anything. This creates a pause in the workflow where you can review the proposed steps.
In this mode, the agent will list the files it intends to modify and the logic it will apply. You can see if it plan to touch five files or five hundred. Each file the agent touches adds to the total cost. By reviewing this list, you can identify if the agent has misunderstood the scope. If the plan looks too broad, you can refine your prompt while still in the planning phase. This prevents the agent from starting a massive Write operation that you would later have to revert, saving both time and money.
Requesting a specific token and file breakdown
While in planning mode, you can explicitly ask the agent for a breakdown of the expected work. Ask the agent to estimate how many files it needs to read and how many it needs to edit. You can also ask it to describe the size of the edits. A plan that involves minor changes to ten files is much cheaper than a plan that involves a complete rewrite of three large files. The agent cannot give you a cent-for-cent price because it does not know the exact length of its future responses, but it can give you a scale of magnitude.
Look for the Task tool calls in the agent output. These represent the logical steps the agent has identified. Every step will carry the context of the previous steps. If the agent identifies twenty separate tasks, the context window will grow significantly by the time it reaches the final task. If the estimate seems too high, you can instruct the agent to break the work into smaller, independent sessions. This allows you to use the /clear command between sessions to reset the context window and keep costs down.
Managing context weight with the compact command
Context is the primary driver of cost in Claude Code. Every file the agent reads and every thought it processes stays in the context window. As the session continues, every new prompt becomes more expensive because you are paying for the entire history. If you have spent a long time in planning mode, your context window might already be heavy with the details of your brainstorming session. Before you move from planning to execution, you should consider the state of your context.
Use the /compact command to manage this growth. This command summarizes the conversation so far and removes the redundant details of the back-and-forth exchange. By running /compact after you have finalized a plan but before you start the execution, you shed the weight of the initial planning tokens. This ensures that the actual code generation starts with a leaner context. It reduces the cost of every subsequent tool use during the execution phase. You can also use /clear if the plan is simple enough for you to start a fresh session with a more specific prompt.
Monitoring multiple sessions in adhdTerminal
When you are managing several large refactors at once, keeping track of the status and cost of each one is difficult in a standard terminal. This is where adhdTerminal becomes useful. It allows you to run multiple Claude Code sessions side by side as tiles on a wall. Each tile shows whether the session is working, waiting for your input, or idle. You can see the last few exchanges of the conversation directly on the tile, which helps you monitor the planning process without switching windows.
If you have four different plans running in four tiles, you can quickly identify which one has a scope that is spiraling out of control. You can see the cost estimates and file lists for all projects at a glance. Because adhdTerminal keeps your sessions organized and visible, you are less likely to leave an expensive session running or forget to /compact a bloated context window. It provides a high-level view of your terminal budget that a single command line interface cannot match.
Configuring tool permissions for safer budgeting
You can create a permanent safety net by editing your configuration. Claude Code looks for a settings.json file in the .claude directory of your project or in your home directory. Within this file, you can find a permissions key. You can set specific tools to require manual approval even when you are not in planning mode. For example, you can set the Edit and Write tools to always ask for permission while allowing the Read and Glob tools to run automatically.
This configuration creates a hybrid environment. The agent can browse your code and build a mental model, but it must stop and ask you before it performs any action that would significantly increase the output token count. This gives you a chance to see the /cost of the session so far and the specific changes proposed. By forcing a pause before the Write tool is invoked, you ensure that you never spend tokens on a large file write that you did not explicitly authorize. This is especially useful when working in a repository that you do not fully trust yet.
Verifying actual spend with cost and usage commands
To verify your forecasts, you must use the built-in reporting commands. The /cost command shows you the exact spend for the current session. You should run this after the agent completes its plan but before you approve the execution. This gives you a baseline. If the planning phase alone cost more than you expected, it is a clear signal that the execution phase will be significantly more expensive. The /cost command breaks down the spend so you can see if the majority of the cost came from input tokens or output tokens.
For a broader view, use the /usage command. This shows your total spend across all sessions for the day and the month. Checking /usage regularly helps you stay within a set budget. If you notice that your daily spend is reaching its limit, you might choose to postpone a large refactor until the next billing cycle or the next day. These commands provide the hard data you need to adjust your planning strategy. If a certain type of prompt consistently leads to high costs, you can change how you write your project instructions in the future.
Refining project instructions in CLAUDE.md
Your project instructions in the CLAUDE.md file play a huge role in token consumption. If this file tells the agent to always check for related tests or to always read the documentation folder, the agent will use the Read tool more often. You can lower your forecasted costs by being more specific in these instructions. You can tell the agent to ignore certain directories or to only focus on the files you explicitly name in your prompt. This limits the initial exploration phase and keeps the context window small.
You can also use subdirectories to hold specific CLAUDE.md files. If you are working in a large monorepo, a CLAUDE.md file in the root might be too general. By placing a more specific instruction file in the subdirectory for your specific service, you guide the agent to only look at relevant files. This prevents the agent from using the Glob tool across the entire repository, which can be a major source of hidden token costs. Well-defined instructions are the most effective way to ensure that the plans the agent generates are lean and targeted.
Resuming sessions and mobile monitoring
Sometimes a plan is so large that you need to step away and consider the cost before proceeding. You do not have to leave the terminal open. You can quit the session with Ctrl+C and return later. When you are ready, use the command claude --resume to see a list of your previous sessions. You can pick up exactly where the planning phase ended. This allows you to manage your budget over time rather than feeling pressured to hit the confirm button immediately.
If you are using adhdTerminal, this process is even more flexible. The app saves your wall of tiles, so your planned sessions are right where you left them when you restart your computer. You can also use the free iPhone app to mirror your wall. This is useful for checking the status of a long-running plan while you are away from your desk. You can see the final cost estimate on your phone and even send the next task to start the execution phase if the forecast meets your budget. This end to end encrypted link ensures you are always in control of your developer tools and your spending.
Questions people ask
Does planning mode itself cost tokens?
Yes, planning mode still uses tokens because the agent must read your files and process your instructions to generate a strategy. However, it is much cheaper than execution because the agent does not generate large blocks of code or perform multiple write operations. It helps you avoid the much higher costs of incorrect or unwanted code generation.
How can I see my total spend for the current day?
You should use the /usage command inside any active Claude Code session. This command provides a summary of your spending across all sessions for the current day and month. It is the best tool for tracking your overall progress against a specific project budget.
What should I do if a plan looks too expensive?
If the plan involves too many files, you should use the /clear command to reset the session and then provide a more narrow prompt. You can also edit your CLAUDE.md file to restrict the agent to specific directories. Always run /compact before starting the actual work to keep the context window as small as possible.
Read next
- Add build instructions to your CLAUDE.md fileImprove project context by adding specific build commands and environment requirements to your CLAUDE.md file for the AI to follow.
- Add common error fixes to CLAUDE.mdImprove project memory by adding a section for common errors and their fixes to your CLAUDE.md configuration file.
- Add custom shell aliases for Claude CodeSpeed up your workflow by creating shell aliases for common Claude Code invocations and project-specific startup commands.
- Add test commands to a CLAUDE.md fileUnderstand how to define specific test runners and environment flags in your CLAUDE.md file so the tool runs the correct test suite.