Claude Code can use more tokens than a short prompt suggests because its billable usage may include much more than the text you type: conversation history, tool activity, repository context, and repeated work after edits. Four especially easy-to-miss drains are large context files, long-running conversation history, broad or repeated tool reads, and iterative exploration; their impact depends on the model, task, settings, and how usage is measured.
What counts as token use
A token is a unit of text processing, not a word or a line of code. Token counts vary with language, punctuation, formatting, and code; a file with many symbols or identifiers may tokenize differently from ordinary prose of the same length. Input and output are also distinct: the model reads input and generates output, and providers may report or price those categories differently.
In a coding session, the apparent prompt is only one part of the exchange. Claude Code can use a command-line interface and tools to inspect files, run commands, and make changes. Relevant tool results can then be supplied back to the model. The exact behavior and usage display depend on the version and configuration, so a visible terminal command should not automatically be treated as either a model-generated response or a fixed token charge.
Another source of confusion is the difference between total processing and billed usage. Some services expose separate categories, such as input, output, or cached tokens; caching may affect pricing without making the underlying conversation shorter. Check the usage information for the model and account you use rather than assuming one counter represents every kind of work.
Drain 1: Repository instructions and context files
Claude Code may read project guidance and other files to understand how a repository works. Instructions in files such as project-level guidance documents can be valuable: they may explain build commands, conventions, or constraints. But a large file, duplicated guidance, or instructions loaded across many sessions can add context before the requested task begins.
For example, asking for a one-line change does not mean the model sees only that line if it also needs project instructions, nearby code, and relevant configuration. Context is useful when it prevents mistakes; the drain occurs when unrelated material is routinely included.
- Keep project guidance focused on durable, high-value facts rather than copying whole manuals into it.
- Remove duplicated or obsolete instructions and link to detailed documents when the tool can retrieve them only when needed.
- Scope a request to the relevant package or files where practical, while allowing the tool to inspect more if the task requires it.
Drain 2: Conversation history carried forward
As a session grows, earlier messages and results may remain relevant to later turns. A follow-up such as “now add tests” can depend on the previous discussion, code changes, and tool output. The current message may be short, but the accumulated context needed to answer it can be much larger.
Long sessions also preserve details that no longer matter: abandoned approaches, pasted logs, and repeated explanations. Whether older context is retained, summarized, or managed in another way depends on the product and settings; do not assume every turn resends an identical full transcript. Still, an increasingly large working context is a common reason usage rises over a session.
When switching to an unrelated task, start a fresh session if that fits your workflow. For a continuing task, summarize only the decisions and current state that matter, and avoid pasting the same log or file repeatedly.
Drain 3: Broad and repeated tool reads
Tool use can multiply the amount of information involved. Searching a repository, opening files, examining command output, and checking tests may all provide useful evidence. But broad searches can surface many irrelevant matches, and verbose output can return far more text than the model needs to make the next decision.
A task that sounds small can also require several cycles: inspect, edit, run a check, read the failure, revise, and test again. The commands themselves are not necessarily all model tokens; the content returned to and processed by the model is the key distinction. Large logs, generated files, or repeated file dumps can make that content unnecessarily bulky.
- Ask for a specific behavior or location when you know it, rather than requesting a general tour of the repository.
- Prefer focused test commands and concise output. If a test fails, share the relevant error and surrounding context rather than an entire unrelated log.
- Exclude generated or vendor directories from searches when they are not relevant, using the project’s available tools and configuration.
Drain 4: Exploration, retries, and oversized tasks
Unclear requests can lead to more investigation than expected. If “clean up this code” has no defined scope, the tool may need to inspect several areas, infer intent, and compare options. A large task can likewise require planning and multiple edits before it is clear what should change. That work may be justified, but it costs more than a narrowly defined fix.
Retries are another hidden drain. A failed test, an incorrect edit, or a misunderstood requirement can trigger another round of reading and generation. More output can also result when the requested answer includes explanations, alternatives, or a broad code review in addition to the implementation.
Reduce avoidable exploration by stating the desired outcome, constraints, relevant files if known, and how to verify completion. For example: “In the parser, reject empty input; add a focused test; run the parser test suite. Do not change the public API.” This guides the work without forbidding necessary investigation.
How to manage usage without harming the result
Token reduction is not the only goal. Cutting out context that explains a subtle bug can make the answer less accurate and cause costly rework. Aim to reduce irrelevant information, not the evidence the task needs.
- Break a broad project into clear tasks with testable outcomes.
- Keep instructions concise and remove repeated background from prompts.
- Use targeted searches and checks, then provide relevant excerpts instead of huge outputs.
- Ask for a concise response when a long explanation is not useful.
- Review the service’s usage reporting, model selection, and any caching or context settings available to your account; interfaces and billing details can change.
These habits may reduce unnecessary processing, but no prompt-writing trick guarantees a fixed token count. A difficult debugging task can legitimately require more context and iterations than a simple change.
Frequently Asked Questions
Does Claude Code count every terminal command as tokens?
Not necessarily. A command run by a tool is distinct from text generated by the model. The command’s output may matter if it is returned to the model, and usage reporting can separate categories. Consult the relevant usage display for the exact accounting.
Why does a short follow-up still use a lot of tokens?
It may rely on earlier conversation context, repository instructions, files, or tool results. The number of words in the newest message alone does not show how much information is needed to answer it.
Does starting a new session reduce token use?
It can avoid carrying irrelevant context from an unrelated task, but it may also require the tool to rediscover project details. For ongoing work, preserve a brief, accurate summary; for a separate task, a clean session can be more efficient.
Are cached tokens the same as fewer tokens?
No. Caching can change how repeated input is handled or priced, depending on the service, but it does not necessarily mean the conversation contains less context. Check the provider’s definitions for the usage fields shown.
Should I tell Claude Code not to read files?
Usually not as a blanket rule. File inspection is often necessary for accurate changes. Instead, identify relevant areas and ask for focused checks while allowing additional inspection when the task requires it.