Saving tokens and context with ECC: context-budget, timely compaction and model choice
To save tokens with ECC, measure first: /context gives you real session usage and /ecc:context-budget --audit estimates what your install takes (on the minimal profile, about 12,500 tokens in skill, agent and command descriptions alone). Then trim: remove agents for languages you do not use, compact at phase changes, and use Sonnet by default with Opus only for architecture.
This is part 7 of the complete ECC guide. Below: the real measurement we ran, the settings.json tweaks ECC recommends, when to compact and when not to, and how to stop MCP servers from eating your context window.
Why ECC can get expensive
Every installed skill, agent and command advertises its description to the model so it knows when to use it. One description is a few lines, but ECC ships hundreds. And the common rules load in full every session.
This is not only a money problem on API billing: on a Pro or Max subscription a full context means earlier compaction, worse answers in long sessions and quota burned faster.
Step 1: measure with /context and /ecc:context-budget
ECC does not invent its own live meter. Run /ecc:context-budget on its own and it tells you to use the native command:
/context # live breakdown of the context window
/context all # expanded viewWe checked: that was literally its answer (5 seconds, 0.12 USD). To estimate what your install weighs you must ask for the audit explicitly:
/ecc:context-budget --auditWe ran it against the minimal profile installed in part 2 (prompt in Spanish, so the screenshot is in Spanish):
| What | Estimated tokens |
|---|---|
| Descriptions of 54 skills | ~4,600 |
| Descriptions of 72 agents | ~4,000 |
| Descriptions of 99 commands | ~3,900 |
| **Always-loaded subtotal** | **~12,500** |
| `AGENTS.md` (only if imported) | ~3,300 |
| MCP catalog (only if enabled) | ~3,100 |
These are the skill's own estimates (bytes ÷ 4), not a model measurement. The audit took 39 seconds and cost 0.24 USD, and it caught something useful: our session had the full plugin and the manual profile loaded at once, so commands were duplicated with and without the ecc: prefix. That is the install mistake from part 2, seen from the context side.
Step 2: trim what you do not use
The three optimizations the audit proposed, which match what we would do:
- One source. Either the plugin or a manual install, never both.
- Remove agents for other languages. There are about 35
*-reviewerand*-build-resolveragents. On a JavaScript project, deleting the Go, Rust, C++, Swift, Kotlin, Flutter and other ones saves about 2,000 tokens. - Sort what remains with
/ecc:agent-sortor/ecc:config-gc: daily items stay, occasional ones move to a "library" that is not advertised to the model.
Step 3: the settings.json tweaks ECC recommends
The README suggests adding this to ~/.claude/settings.json:
{
"model": "sonnet",
"env": {
"CLAUDE_CODE_EFFORT_LEVEL": "medium",
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "50",
"CLAUDE_CODE_SUBAGENT_MODEL": "haiku"
}
}| Setting | Default | ECC recommends | Effect per ECC |
|---|---|---|---|
| `model` | opus | sonnet | About 60% lower cost; handles 80%+ of tasks |
| `CLAUDE_CODE_EFFORT_LEVEL` | model-dependent | medium | Less reasoning on simple tasks |
| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | 95 | 50 | Compacts earlier; better quality in long sessions |
| `CLAUDE_CODE_SUBAGENT_MODEL` | — | haiku | Cheaper subagents |
The figures in that table come from ECC's README, not from our measurements. Two caveats: with CLAUDE_CODE_SUBAGENT_MODEL=haiku, agents whose frontmatter asks for sonnet or opus may perform worse, so test it with your reviewers; and on Bedrock, Vertex or Foundry the sonnet alias may point to a model without effort controls, as the README itself warns.
When you need real reasoning (architecture, a bug you do not understand), switch with /model opus and switch back afterwards.
Step 4: compact at the right moment
Compacting mid-task is the fastest way to make the agent forget variable names and paths. The strategic-compact skill suggests doing it at phase changes:
Compact:
- After research, before implementation.
- After finishing a milestone, before the next one.
- After debugging, before going back to the feature.
- After a failed approach, before trying another.
Do not compact: in the middle of an implementation.
With ECC's hooks on, one of them suggests /compact every ~50 tool calls. And if you are about to stop, prefer /save-session and a fresh session, as covered in part 6.
Step 5: watch your MCP servers
Every MCP tool advertises its description. ECC warns that with too many MCP servers enabled a 200,000-token window can shrink to about 70,000 usable tokens, and recommends:
- Fewer than 10 MCP servers per project.
- Fewer than 80 active tools in total.
- Disabling unused ones with
/mcp.
That is why ECC ships only one default connector (chrome-devtools) and turns the rest into skills that call a CLI or API when needed.
Other ways to spend less
/clearbetween unrelated tasks: free and instant./costto watch session spend on API billing.- If ECC's cost warnings bother you on a subscription:
ECC_CONTEXT_MONITOR_COST_WARNINGS=off. - For shorter model replies, see the Caveman skill, which tackles the other side: output tokens.
Conclusion
Saving with ECC means measuring before trimming: /context for the session, /ecc:context-budget --audit for the install, one install source and no agents for languages you never touch. Sonnet by default and compacting between phases do the rest. In part 8, the last one, we audit the security of this whole setup with AgentShield.
// source code
Help us grow
codigoagente is free, with no paywalls. If this article helped you, any of these keeps the blog going.
- Share it with someone who'll find it usefulWhatsAppLinkedInXFacebook
- Meet our sponsorSafe Build Labs
More on AI agents

- Skills for your agents
- Claude Code

guide · Marketing psychology guide for AI agents · #3
- Skills for your agents
- Claude Code

guide · Marketing psychology guide for AI agents · #2
- Skills for your agents
- Claude Code