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 reduce Claude Code’s initial context, keep always-loaded instructions short, move narrowly relevant guidance into scoped rules or skills, and start unrelated tasks with fresh conversation history. To avoid prompt-cache breaks in a custom API integration, keep the content before the cache breakpoint identical across requests. These are separate problems: smaller instructions reduce context content; a stable API prefix improves cache reuse.

First identify which problem you have

Claude Code’s initial context is the instructions and memory loaded for a session, along with conversation content as work proceeds. Project and user-level CLAUDE.md instructions and auto memory can contribute to that context. Claude Code also reads ancestor instruction files at launch and can bring in relevant subdirectory instructions when needed. Imported files are expanded into context too, so imports organize instructions but do not reduce their total context use. See Anthropic’s memory documentation.

Prompt caching is an API mechanism for reusing matching portions of requests. A cache break occurs when content expected to match the cached prefix changes before the breakpoint. Changing a CLAUDE.md file may affect what Claude Code loads, but shortening it does not automatically fix an API cache break; cache reuse also does not remove request content from the context window. Anthropic explains breakpoint behavior in its prompt caching documentation.

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

Reduce Claude Code’s always-loaded context

Inspect context before editing

In Claude Code, run /context to identify what is consuming context and /usage to inspect token usage. Use these results to find the actual source of overhead instead of trimming instructions that are not the cause. The commands and session-management options are covered in Anthropic’s cost management guidance.

Keep global instructions concise and durable

Reserve CLAUDE.md for information that is broadly useful across sessions: project conventions, architecture that is not obvious from the code, common commands, and rules that apply throughout the project. Anthropic’s current guidance recommends targeting fewer than 200 lines per CLAUDE.md file. That is a maintenance guideline, not a guaranteed token budget or a hard product limit.

Prefer concise, verifiable instructions over repeated or general advice. Review ancestor files, local overrides, rules, and imports for duplication or conflicts. If an instruction is imported, its content still loads; moving text into an import alone does not save context.

Scope occasional guidance to where it applies

Put folder- or file-specific rules in .claude/rules/ with path scoping, or use a skill for a procedure that is needed only for particular tasks. Subdirectory CLAUDE.md files can also keep relevant guidance close to the code it governs. This avoids treating every instruction as universally relevant; the scope must still match where the rule is needed.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Manage conversation history between tasks

Use /clear when work is unrelated

/clear starts a fresh conversation context, so unrelated work does not carry stale history into subsequent messages. If the earlier session may be useful, rename it before clearing so you can resume it later.

Use /compact to continue a long task

When continuing the same task, run /compact with a specific instruction about what the summary should preserve, such as “Focus on code samples and API usage.” Compaction summarizes earlier conversation; it is not a guarantee that every detail from that history remains available.

Use minimal startup only for suitable scripted calls

For scripted CLI calls that do not need project memory or customizations, --bare skips discovery of features including CLAUDE.md, auto memory, MCP servers, plugins, hooks, custom commands, and subagents. It can reduce startup-loaded context and speed scripted starts, but the tradeoff is that those features and instructions are not loaded. It is generally a poor fit for interactive coding sessions that rely on project-specific guidance. Check the current CLI reference for release-specific behavior.

The CLI also documents --exclude-dynamic-system-prompt-sections for specialized scripted, multi-user workloads. It moves per-user context out of the system prompt and into the first user message to improve cache reuse across users or machines doing the same task. This is a cache-reuse option, not a general way to reduce Claude Code’s context; verify current availability and behavior in the CLI reference before relying on it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep API prompt-cache prefixes stable

Place the breakpoint after shared content

In a custom API integration using explicit cache breakpoints, keep the prefix before the breakpoint identical from one request to the next. For a straightforward prompt, Anthropic says one breakpoint at the end of the static content is usually sufficient: place it on the last block that remains unchanged. Put changing content, such as a timestamp or the incoming user message, after that stable portion.

Use multiple breakpoints only when sections change at different rates

Multiple breakpoints can provide finer control when prompt sections change at different rates. Anthropic documents a maximum of four breakpoints. The number of breakpoints itself does not add cost; cache writes and reads are billed under the applicable token pricing and cache duration. Model support, minimum cacheable length, time-to-live, and prices can change, so check the current platform documentation before designing around specific limits or estimating costs.

Caching can lower the cost of repeated content, but cached content remains part of the request context. If content before the breakpoint changes, the request may need a new cache write instead of a cache hit.

Choose the fix that matches the symptom

Approach Best for Tradeoff
Shorten CLAUDE.md and move narrow guidance to scoped files or skills Reducing broadly loaded project guidance while retaining relevant instructions Requires correct scoping; imported content still consumes context.
/clear Removing stale conversation history before unrelated work Starts a fresh task context; preserve or resume the old session if its work is needed.
/compact with custom guidance Continuing a long task with a summarized history Summarization may not retain every detail.
--bare Minimal scripted startup when customizations are unnecessary Skips memory, project instructions, and other customization discovery.
Stable API prefix and breakpoint Improving cache reuse in custom API requests Requires stable content before the breakpoint; does not reduce context length.

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.

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