GENESISCODE DOCTOR AI
GENESIS REPAIR KNOWLEDGE NETWORK

AI Agent Token Efficiency: Context, Caching, Tools & Subagents

Cursor's September 23, 2026 engineering report describes product-specific changes that reduced its agent harness token costs by 7% without a measured reduction in agent quality. Cursor says its work included trimming roughly 66% of the system prompt, dynamically loading tool descriptions, improving cache behavior, reducing file-read representation overhead and using subagents selectively. Those numbers are evidence from Cursor's own harness, not universal savings targets for another product. The transferable production lesson is to treat context as a measured systems budget: establish a representative task baseline, attribute tokens to static instructions, retrieved context, tool schemas, file reads and subagent handoffs, then change one layer at a time while tracking cost, latency, tool errors, task success, review effort and regressions. Token reduction is useful only when the agent remains correct, secure and operable.

Common symptoms

  • Long-running coding agents become progressively more expensive even when the final task is small
  • Large static prompts and tool schemas consume context before the model has seen the user's actual problem
  • Prompt-cache hit rates are unstable because common context changes position or formatting between turns
  • Subagents reduce the main thread's context load but create extra calls, coordination overhead or duplicated work
  • A team reports lower token usage but has not checked task quality, latency, tool errors or reviewer workload

Possible causes

  • Static instructions, examples and tool definitions can occupy a large fraction of every request even when only a subset is relevant
  • Frequently changing context placed before stable content can invalidate or weaken provider prompt-cache reuse
  • Verbose file representations, repeated line metadata and duplicated retrieved content add tokens without always adding decision value
  • Loading every tool description up front makes the context budget scale with integration count rather than current task need
  • Subagent isolation can save main-context space while adding its own model calls and coordination tax
HOW TO FIX IT

Work from the safest step to the harder repair.

  1. Step 1. Build a representative evaluation set before optimizing. Include short edits, repository navigation, multi-file fixes, tool-heavy tasks, long sessions and failure-recovery cases that resemble real production usage.
  2. Step 2. Capture a baseline for each task: input/output tokens, cache-read and cache-write tokens where the provider exposes them, model cost, wall-clock latency, tool calls, tool errors, retries, task success, test results and human review effort. Do not optimize against token count alone.
  3. Step 3. Break the context into accountable layers: system instructions, policy/safety text, conversation history, retrieved repository context, tool definitions, file content, generated summaries and subagent handoffs. Rank the largest repeat contributors before rewriting anything.
  4. Step 4. Trim static instructions only when their behavior is covered by evaluation. Remove duplication, stale examples and prose that can be stated more compactly, but preserve authorization, security, data-handling and stop-condition rules even when they cost tokens.
  5. Step 5. Load tool schemas on demand when the harness supports it. Keep a compact discovery surface and expand only the tools relevant to the current task. Cursor reports a substantial reduction in sessions that called MCP tools after moving tool descriptions to dynamic loading, but treat that as a vendor-specific result to reproduce locally rather than a promised percentage.
  6. Step 6. Stabilize prompt-cache prefixes. Keep reusable instructions and other high-reuse context in a consistent order and format; move volatile request-specific material after stable content when the model/provider's documented caching semantics support that design.
  7. Step 7. Measure cache misses explicitly. A context change that saves raw prompt tokens can cost more overall if it destroys high-value cache reuse, increases latency or causes retries. Compare cold-cache and warm-cache runs rather than averaging them together.
  8. Step 8. Compress file and retrieval context semantically, not blindly. Remove repetitive representation overhead and duplicate snippets, but keep identifiers, line/location evidence and neighboring code when they are needed for safe edits, debugging or review.
  9. Step 9. Use subagents for work that benefits from isolation, parallel exploration or a different model profile. Account for their full tokens, latency and coordination messages; do not count only the parent agent's smaller context as a savings.
  10. Step 10. Evaluate model routing separately from context optimization. A cheaper model, smaller context or fewer tool definitions can lower cost while reducing correctness. Use the same task set and acceptance criteria for every comparison.
  11. Step 11. Preserve least-privilege tool permissions, secret boundaries, authorization checks and deterministic engineering gates. Token efficiency does not justify widening repository, filesystem, network, deployment or credential access.
  12. Step 12. Ship changes incrementally with a rollback path. Watch task success, test failures, security findings, tool-error rate, latency, review time and cost after deployment; revert optimizations that merely move cost into retries, human cleanup or production defects.

Need the actual code? Go to GenesisCodeDoctor.com to search the Code Store or request code for the exact platform, error, and repair you are working on.

BEFORE YOU PASTE CODE

Protect the working site first.

  • Use non-sensitive representative repositories and least-privilege tools for context-efficiency experiments.
  • Keep a fixed evaluation suite so prompt/tool changes can be compared against the same quality and safety acceptance criteria.
  • Record cold-cache and warm-cache measurements separately and include retries, subagents and human review when calculating total task cost.
STOP AND GET HELP WHEN

Do not turn a repair into a larger outage.

  • Do not present Cursor's reported 7% harness savings, prompt reduction or tool-loading percentages as guaranteed savings for another agent, model or repository.
  • Do not remove security, authorization, privacy, compliance or destructive-action guardrails simply because they consume context.
  • Do not optimize only the parent agent while ignoring tokens and latency spent by subagents, retries or background tool calls.
  • Do not treat a higher cache-hit rate as success if task quality, freshness or repository correctness falls.
  • Do not benchmark with secrets, customer data or unrestricted production credentials merely to reproduce realistic context sizes.
HOW GENESIS HANDLES IT

Diagnose the exact failure before choosing a repair.

Genesis separates the visible symptom from the underlying technical cause. Run the supported diagnostic first, review the evidence, and then use a matching repair only when the failure is actually verified.

Platform scope
AI coding agents · agent harnesses · prompt caching · MCP/tools · retrieval · subagents
Category
AI engineering · Context management · Cost/performance governance
Last updated
2026-09-23
REPAIR PROFILE

Know the complexity before you edit.

Difficulty
Advanced
Change risk
Medium

These labels describe implementation complexity and blast radius, not a guaranteed repair time.

AUTHORITATIVE SOURCES

Verify time-sensitive platform details at the source.

COMMON QUESTIONS

Before you make the change

Did Cursor prove that every coding agent can cut token costs by 7%?

No. Cursor reports a 7% reduction for its own harness changes without a measured quality reduction. Use that as engineering evidence that context design matters, not as a universal savings forecast.

Should I remove most of my system prompt to save tokens?

Only after measuring behavior. Remove duplication and stale prose, but keep rules that protect authorization, secrets, destructive actions, compliance and required engineering gates.

Why can dynamic tool loading help?

Tool schemas can be large. Loading only task-relevant definitions can reduce repeated static context, but the harness still needs reliable discovery, permissions and error handling.

Are subagents always cheaper?

No. They can isolate context and parallelize work, but they also create additional model calls and coordination. Measure the whole task, not just the parent conversation.

What should I measure besides tokens?

Track task success, tests, security findings, latency, tool errors, retries, model cost, cache behavior and human review effort. A token-saving change that creates more failures is not an efficiency win.

RELATED REPAIR GUIDES

Continue from easy to harder.

NEED THE CODE?

Get the code you need from Genesis Code Doctor.

Once you know the platform and the verified problem, search the Genesis Code Doctor Code Store for a matching package. If the exact integration or repair is not there, use Request a Code and describe the platform, official documentation, desired behavior, and sanitized error—never send your secret key.

Next step

Start with a free diagnostic. If Genesis verifies a problem and a compatible treatment exists, continue to the matching Code Store product or repair path. If you cannot find the exact code you need, request it at GenesisCodeDoctor.com rather than forcing a generic snippet into the wrong platform.