Context Windows & ECC
How large context windows change agent behavior, how prompt caching cuts token costs, and what ECC (Everything Claude Code) is
title: "Context Windows & ECC" description: "How large context windows change agent behavior, how prompt caching cuts token costs, and what ECC (Everything Claude Code) is" section: "Ecosystem" readTime: "10 min"
Context Windows & ECC
Context window size determines what an agent can "see" at once. Understanding how context works, and how to use it efficiently, is one of the highest-leverage skills for AI-assisted development.
Two different things share the "ECC" abbreviation online. This page uses ECC for the community project Everything Claude Code (covered below). "Extended Context Caching" is not an Anthropic term: the real feature is prompt caching, covered in Prompt Caching.
What Is the Context Window?
The context window is the total amount of text (measured in tokens) that the model can process in a single request. Everything in the window (conversation history, files, instructions, tool results) competes for this space.
Rough token estimates (these are order-of-magnitude guides; the current Claude tokenizer produces roughly 30% more tokens than older ones for the same text):
| Content | Approximate Tokens |
|---|---|
| 1 line of code | 5–15 tokens |
| 1 file (100 lines) | 500–1,500 tokens |
| Full README | 1,000–5,000 tokens |
| Small codebase (20 files) | 10,000–30,000 tokens |
| Large codebase (200 files) | 100,000–300,000 tokens |
Context Windows (October 2026)
| Model | API ID | Context Window |
|---|---|---|
| Claude Fable 5.1 | claude-fable-5-1 | 1M tokens |
| Claude Opus 5.5 | claude-opus-5-5 | 1M tokens |
| Claude Sonnet 5.5 | claude-sonnet-5-5 | 1M tokens |
| Claude Haiku 5.5 | claude-haiku-5-5 | 1M tokens (prompts over 100K tokens are billed at higher rates) |
| OpenAI GPT-6 Astra / GPT-6.1 Sol / GPT-6 Luna | gpt-6-astra, gpt-6.1-sol, gpt-6-luna | 1.05M tokens |
| Google Gemini 3.8 Flash | gemini-3.8-flash | 1,048,576 tokens |
Sources: Anthropic's models overview and pricing pages, OpenAI's models page, and Google's Gemini API models page. Model lineups change often; check each provider's docs before hard-coding an ID. For a full comparison, see Model Comparison.
A bigger window does not mean you should fill it. Cost, latency, and accuracy all benefit from sending only what the task needs.
Prompt Caching
Prompt caching is Anthropic's mechanism for reusing prompt prefixes across requests. When a large portion of your prompt stays the same between calls (a system prompt, a codebase excerpt), the API reads it from cache at a fraction of the normal input price.
Cost Breakdown
| Operation | Price vs. base input |
|---|---|
| Cache write, 5-minute lifetime | 1.25x |
| Cache write, 1-hour lifetime | 2x |
| Cache read (hit) | 0.1x (0.05x on Opus 5.5 and Sonnet 5.5; 0.025x on Fable 5.1) |
Example: loading a 50,000-token codebase context into Claude Opus 5.5 ($4 per million input tokens) for 10 agent iterations:
- Without caching: 500,000 tokens at $4/MTok = $2.00
- With caching: 50,000-token 5-minute write ($5/MTok) + 450,000 cache-read tokens ($0.20/MTok) = about $0.34, roughly 83% cheaper
A cache entry expires after a period of inactivity, and each hit refreshes it. See Anthropic's pricing page for current rates.
Using Prompt Caching from the API
// Direct API usage: mark the stable prefix with cache_control
const response = await anthropic.messages.create({
model: "claude-opus-5-5",
max_tokens: 4096,
system: [
{
type: "text",
text: largeCodebaseContext,
cache_control: { type: "ephemeral" } // cache the prefix up to this block
}
],
messages: [{ role: "user", content: userPrompt }]
});The API also supports automatic caching with a single top-level cache_control field. See the prompt caching docs for breakpoints and the 1-hour option.
Prompt Caching in Claude Code
Claude Code manages caching for you. It orders each request so rarely-changing content comes first: system prompt and tool definitions, then project context (CLAUDE.md, auto memory), then the conversation. A cache hit needs an exact prefix match, so some actions force a one-time slower, pricier turn while the cache rebuilds:
- Switching models with
/model(each model has its own cache) - Changing effort level on some models
- Connecting or removing an MCP server when tool search is not deferring its tools
- Compacting the conversation (replaces history with a summary)
Actions that keep the cache include editing files, changing permission mode, invoking skills, and /rewind.
Practical consequences:
- CLAUDE.md is read once at session start. Editing it mid-session does not invalidate the cache, but it also does not apply until
/clear,/compact, or a restart. - Cache lifetime: the default is 5 minutes, and 1 hour for the main conversation on a Claude subscription within plan usage. Set
promptCacheTtl(5mor1h) in settings, orCLAUDE_CODE_PROMPT_CACHE_TTL, to choose. - Check hit rate with
/usage, which shows a prompt cache line for the session. - Pick your model and effort at the start, and run
/compactat natural breaks between tasks.
See How Claude Code uses prompt caching for the full list.
ECC (Everything Claude Code)
Everything Claude Code (ECC) is a community-maintained, MIT-licensed "agent harness" project at github.com/affaan-m/ECC (the project was previously named everything-claude-code). It is not an Anthropic product. It bundles agents, skills, command shims, hooks, rules, and memory/continuous-learning workflows, and works best with Claude Code; Codex is supported and other tools such as Cursor get more limited adapters. At the time of writing, its README lists dozens of agents and hundreds of skills, and counts change between releases.
Install it inside Claude Code as a plugin:
/plugin marketplace add https://github.com/affaan-m/ECC
/plugin install ecc@eccPer the README, you need Node.js 18+ and Claude Code 2.1 or newer, and you should choose one install method per harness, since stacking methods can duplicate skills and hooks. Verify with /plugin list ecc@ecc. The README also documents a guided setup via npx ecc-universal and a lower-context profile without hooks.
Third-party skills, hooks, and agents run with your permissions. Read what a plugin installs before enabling it, and prefer a minimal profile. Install steps and contents change between releases, so treat the repository README as the source of truth.
How Context Affects Agent Behavior
The "Lost in the Middle" Problem
Models often attend unevenly to long context. Information at the start and end of the window tends to be used more reliably than information buried in the middle.
[High attention] Start of context (system prompt, CLAUDE.md)
[Lower attention] Middle of a long conversation
[High attention] Most recent message
Mitigation: put durable constraints in CLAUDE.md or rules rather than mid-conversation notes, and restate critical requirements in the latest message. For hard guarantees, use hooks and permission rules rather than instructions alone.
Context Compaction in Claude Code
When the context fills up, Claude Code automatically compacts it: it replaces the earlier conversation with a summary, freeing space for new content. Project-root CLAUDE.md and auto memory are reloaded afterward, but details from earlier in the session may be lost.
/context # see what is consuming context
/compact focus on the auth work # compact now, with instructions on what to keep
/clear # start fresh (previous conversation stays resumable)Run /compact yourself at a natural break instead of waiting for auto-compaction mid-task. You can also tune the window with claude --autocompact <auto|tokens> or the /autocompact command.
Optimizing Context Usage
What to Include
| Content | Include? | Why |
|---|---|---|
| CLAUDE.md / project context | Always (keep it concise) | Read every session; cheap once cached, but long files still crowd the window |
| Directly relevant source files | Yes | Enable accurate edits |
| Test files for the module | Yes | Ground truth for behavior |
| Unrelated modules | No | Wastes context, increases cost |
node_modules, build output | Never | Millions of tokens, no value |
Reference Files Precisely in Cursor
Cursor's @ references add the files you name to the context. Reference the specific file or symbol the task needs rather than a whole directory:
# Broad: pulls in far more than the task needs
@src/routes/ Fix the auth middleware
# Better: point at the file that contains the problem
@src/routes/auth.ts Fix the token validation
Context Hygiene in Claude Code
# Start a fresh session for unrelated tasks (don't carry old context)
claude
# Continue the most recent conversation in this directory
claude --continue
# Open the session picker, or resume by name or ID
claude --resume
claude --resume auth-refactor
# Name a session at startup so it is easy to resume
claude -n auth-refactorInside a session, /resume opens the picker and /rename names the current one.
Large Codebase Strategies
Let the Agent Explore
Claude Code finds code itself with its search tools, and its built-in read-only Explore subagent keeps bulky search results out of your main context. Prefer asking a question over pasting files.
Repo Map Strategy
If you want to hand over a compact overview, generate a "map" of exported symbols instead of whole files:
# Generate a repo map: file paths plus exported declarations
git ls-files 'src/*.ts' 'src/**/*.ts' | \
xargs grep -HE "^export (function|class|const|interface|type)" > /tmp/repo-map.txt
claude -p "Using this repository map, which modules handle authentication?" < /tmp/repo-map.txtVery Large Windows
With a roughly 1M-token window (Claude, GPT-6, and Gemini 3.x all offer one), you can fit many mid-sized repositories in a single request. For example, with Claude Code:
# Concatenate a source tree, then ask a whole-repo question
find src -name "*.ts" -o -name "*.tsx" | sort | \
xargs -I {} sh -c 'echo "=== {} ==="; cat {}' > /tmp/full-context.txt
cat /tmp/full-context.txt | claude -p "Analyze inter-module dependencies and identify the top 5 architectural coupling issues"Check the token count first. A "1M window" is roughly 555K words on the current Claude tokenizer, and quality on needle-in-a-haystack questions varies, so verify answers against the code.