Compound Engineering Token Usage

Editorial diagram of reusable knowledge, context overhead, and token measurement

Written by

in


Reusable knowledge can reduce repeated investigation, but it is not free. Compound engineering token usage depends on what the agent loads, when it loads it, and whether the retrieved material still applies. A short, relevant solution record may replace several searches. A stale instruction file or a bundle of unrelated Skills may add context before useful work begins.

There is no credible universal savings percentage. Teams should measure the same task on the same repository revision with the same model and tool configuration, then inspect both token use and engineering correctness.

Why CE Can Save Tokens

Compound Engineering can reduce repeated work by distilling a completed investigation into a reusable artifact. The current ce-compound skill writes one durable learning to a solutions/ directory. Its lightweight path uses the current conversation, while its fuller path can gather additional evidence, including session history, before producing the document. [CE-COMPOUND-20260724]

For compound engineering token usage, this distillation is one stage in the current plan–work–review–compound cycle, not a guarantee that every later task will use fewer tokens.

The potential gain is straightforward: when a later task matches the recorded problem class, the agent can retrieve a focused explanation instead of rediscovering the same files, failed hypotheses, and validation steps. A reviewed solution can point directly to the affected subsystem and the test that distinguishes the real cause from a similar symptom.

That is only a potential. If retrieval returns the wrong solution, or the solution lacks version scope, the agent may spend more context verifying and correcting it. The useful unit is not “tokens removed.” It is verified work completed per unit of context.

The current plugin also includes ce-compound-refresh, which is intended to maintain stale and overlapping solution documents. [CE-REFRESH-20260724] Maintenance matters because compounding without pruning turns reuse into accumulation.

For structural retrieval fundamentals, see Knowledge Graph for AI Coding Assistants. The three-layer handoff is evaluated in OpenSpec Compound Engineering Layers.

Where Context Overhead Appears

Claude Code's context can include the conversation, instructions, file reads, tool results, auto memory, and loaded Skill content. Anthropic documents /context as a way to inspect the current context breakdown. [ANTHROPIC-CONTEXT-20260724]

Standing context, on-demand retrieval, and noisy overhead flowing into a task

Billing and context are related but not identical. Anthropic's current usage documentation distinguishes subscription usage from pay-as-you-go API usage, where /cost can report token-based cost. [ANTHROPIC-USAGE-20260724] A team measuring Claude Code context cost should record the authentication and billing mode rather than comparing unlike numbers.

Tool output is easy to overlook. Long logs, broad searches, generated plans, and repeated file reads all occupy context. A workflow can use fewer prompt words while still carrying more total context because its tools return too much evidence.

Skills, Notes, and Old Docs as Hidden Cost

Instruction and Skill systems load at different times. Anthropic's current documentation says CLAUDE.md instructions are loaded into context, while Skills advertise descriptions and load their full content when invoked. User-invoked-only Skills can avoid loading until called. [ANTHROPIC-MEMORY-20260724] [ANTHROPIC-FEATURES-20260724]

A Compound engineering token usage example should therefore count more than the final answer. Suppose two runs fix the same test failure. The first run opens 25 files and several tool outputs. The second loads one relevant solution, opens six files, and verifies the same test. The second may be more efficient—but only if both start from the same commit, use the same model and settings, and produce an equally correct result.

This creates several hidden costs:

  • a large CLAUDE.md sends rarely relevant guidance into many sessions;
  • broad Skill descriptions compete for attention even when full Skill bodies are not loaded;
  • overlapping solution documents make retrieval return several versions of the same lesson;
  • old path names and dependency versions trigger verification work;
  • full compounding gathers more evidence than a lightweight pass, even when the lesson is obvious.

Anthropic recommends keeping CLAUDE.md concise, with a target below roughly 200 lines, and notes that imported instruction content still loads into context. [ANTHROPIC-MEMORY-20260724] Its auto-memory mechanism limits the portion of MEMORY.md loaded at session start and allows topic files to be read on demand. [ANTHROPIC-MEMORY-20260724] Auto memory is a Claude Code host feature, not a feature supplied by Compound Engineering.

Count duplication across formats. The same rule repeated in CLAUDE.md, a Skill, three solution records, and an agent prompt creates both token overhead and an authority problem.

Retrieval and Expiration Strategies

Start with a context budget by layer. Keep standing instructions small. Retrieve solution documents only after the task has a sufficiently specific subsystem or symptom. Load graph neighborhoods, logs, and long reference files on demand. Limit the number of retrieved artifacts and show why each matched.

Rank evidence by scope and freshness, not text similarity alone. A solution tied to the current package and a recent compatible revision should outrank a semantically similar note for another service. Return the revision, review status, and invalidation condition with the excerpt.

Expire records through explicit triggers:

  • referenced symbols or files disappear;
  • a dependency or schema version moves beyond the documented range;
  • the fix is reverted or superseded;
  • a new reviewed solution covers the same problem class;
  • the owning team marks the assumption invalid.

Use ce-compound-refresh as one maintenance input, then keep human review for high-impact conflicts. [CE-REFRESH-20260724] A proposed external code graph can help detect renamed or removed symbols, but that is not an official Compound Engineering integration and its extracted facts still require revision checks.

That proposed code knowledge graph should expose revision-aware nodes and edges with queryable provenance so an agent can inspect why a structural fact matched.

The best retrieval system can also answer “nothing reliable found.” Filling the context window with weak matches is worse than letting the agent inspect the repository directly.

Limits and Measurement Notes

Use a matched evaluation harness. Freeze the repository commit, task, acceptance tests, model, agent version, authentication mode, enabled tools, and context limits. Run enough repeated trials to account for model variability. Record:

Matched experiment lanes comparing context volume, tool paths, and verified correctness

  • input and output tokens where the interface exposes them;
  • tool calls, files opened, and tool-output volume;
  • time to a test-passing result;
  • irrelevant or stale artifacts retrieved;
  • reviewer corrections and regressions;
  • success against the same acceptance tests.

Token counts alone can reward a short but wrong answer. Cost alone can be distorted by caching, model choice, or billing plan. A fair result states the full setup and separates observed measurements from explanations.

Do not extrapolate a single repository result into “Compound Engineering saves X percent.” Report the task family and confidence interval if the sample permits it. If a proposed external graph changes retrieval, test it as a separate variable instead of combining it with new instructions, a new model, and a changed Skill set.

FAQ

How should teams measure context waste?

Measure context that was loaded but neither used nor needed to reach the verified result. Track unopened retrievals, repeated file reads, stale guidance, duplicate instructions, and long tool outputs. Compare matched runs and include correction rate so a smaller but inaccurate context is not counted as an improvement.

When should a Skill be retired?

Retire or narrow it when its trigger no longer maps to a real task, its instructions duplicate a better source, its dependencies are obsolete, or it repeatedly loads irrelevant context. Preserve a versioned record when audit history matters, but remove it from active discovery and default use.

What context should load only on demand?

Long reference documents, historical solutions, detailed logs, generated graph neighborhoods, and subsystem-specific procedures should usually wait until the task identifies a relevant scope. Repository-wide safety rules and essential commands can remain standing instructions, provided they stay concise.

How does Compound Engineering work with Claude Code?

Compound Engineering is a plugin workflow that can run in Claude Code, while Claude Code supplies the host context, instruction, Skill, and memory mechanisms. [CE-README-20260724] [ANTHROPIC-FEATURES-20260724] The two should not be described as one memory product.

Conclusion

Compound engineering token usage improves when durable knowledge replaces repeated investigation and only relevant artifacts enter context. It worsens when instructions, Skills, old notes, and tool output accumulate without ownership or expiry.

Measure controlled tasks, not anecdotes. Record correctness alongside tokens and cost, expose what loaded, and change one context variable at a time. That produces a result a team can reproduce instead of a savings claim it cannot defend.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *