Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To use fewer tokens in Claude Code, reduce the amount of irrelevant context it has to process: clear stale history when you change tasks, compact related work with a focused instruction, keep always-loaded project guidance short, and filter or delegate noisy work selectively. Anthropic says token costs scale with context size—the more context Claude processes, the more tokens you use. These techniques manage context and workflow; Anthropic does not publish a measured percentage saving for them.

1. Clear context when you switch to unrelated work

When you move to a different task, use /clear rather than carrying the previous conversation into the next one. Anthropic notes that stale context can waste tokens on subsequent messages. The command is a poor fit when the next question continues the same task, because clearing also discards useful conversational context.

If you may return to the old work, rename the session before clearing it, then resume it when needed. Use /usage to inspect usage; its displayed information can include context and cache behavior and, on supported plans and versions, usage attribution. See Anthropic’s cost-management guidance and CLI reference for current command behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Compact related work with an explicit focus

For a task that should continue, use /compact instead of starting over. Tell Claude what the summary needs to retain—for example, /compact Focus on code samples and API usage. Anthropic also documents project-level compact instructions in CLAUDE.md.

A compacted history is a summary, not a guarantee that every detail will survive. Name the state the task depends on, such as relevant decisions, code paths, test results, or API details. After compaction, check that critical information is still available before relying on it. Anthropic describes this workflow in its cost-management documentation.

3. Keep project instructions lean and load specialized guidance only when needed

Claude Code reads CLAUDE.md files at session start, so material placed there can become part of context across tasks. Keep that file focused on durable project facts, such as conventions and build commands. Move instructions that apply only to particular files or occasional procedures out of the always-loaded guidance.

Use path-scoped rules for file-specific guidance

Put guidance for particular parts of a repository in .claude/rules/ and use path patterns to scope when it applies. Anthropic says these rules load when Claude works on matching files. This avoids making every session carry instructions for unrelated areas of the codebase.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use skills for repeatable procedures

Turn multi-step procedures or specialized reference material into skills rather than leaving all of it in the project’s base instructions. Skill bodies load when invoked or when Claude determines they are relevant. See Anthropic’s guides to project memory and skills for configuration details.

4. Filter noisy work and delegate only when it helps

Filter input before it reaches the conversation

Hooks can preprocess noisy input so Claude sees only the useful part. Anthropic’s example is filtering a 10,000-line log for errors so that matching lines, rather than the full log, enter context. The line count illustrates the filtering use case; it is not a measured token-savings figure. A skill can also provide domain knowledge that would otherwise require repeated exploration. Details and examples are in Anthropic’s cost-management guidance.

Use subagents to isolate side work, not to make it free

A subagent can handle bounded research or exploration in its own context and return a concise summary, keeping search results, file contents, or logs from flooding the main conversation. But subagents make their own model requests, which count toward usage limits. Delegation is therefore a way to isolate context and may improve workflow efficiency; it does not guarantee lower total token use. Keep the assignment narrow and ask for only the findings the main session needs. Anthropic says focused subagents can be routed to a faster, lower-cost model such as Haiku; available models and relative costs can change. See the documentation on custom subagents.

Which context control should you use?

Approach Best fit What it changes Setup
/clear Unrelated next task Removes the previous conversation from the new task’s context Quick session command
/compact with an instruction Continuing related work Summarizes history around the information you specify Quick session command; compact instructions can also be configured in CLAUDE.md
Path-scoped rules or skills Guidance needed only for certain files or procedures Limits when specialized instructions enter context Requires project configuration
Hooks or subagents Noisy input or bounded side work Filters input or isolates exploration from the main context; subagents still make requests Requires workflow or configuration choices
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Two more controls to check

Choose a model suited to the task

Anthropic recommends Sonnet for most coding tasks and reserving Opus for complex architectural decisions or multi-step reasoning; simple subagent tasks may use Haiku. Confirm the currently available models and their costs before choosing based on price, because both can change. The recommendation is in Anthropic’s cost documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect MCP and context use

Anthropic says MCP tool definitions are deferred by default and recommends /context to inspect context use. Prefer CLI tools when they can do the job, and disable MCP servers that are not active. This helps you identify avoidable overhead rather than assuming every configured integration is contributing equally. See Manage costs effectively for the current guidance.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.