Cursor engineers described how they optimized their agent harness—the wrapper that assembles requests, manages context, tools, and cache—and reduced token costs by 7% without losing agent quality. The effect is broken down into independent techniques: the system prompt was reduced by about 66% by abandoning commands like 'DO NOT' and 'You must', static tool descriptions were cut by 60% through dynamic loading, explicit cache breakpoints in the OpenAI API yielded 20% fewer cold cache misses, and line numbering in Read was left only on every tenth line. In addition to the technical breakdown in the blog, the team published a ready-made prompt that can be given to your own agent as a task for cheaply building or refactoring its harness.

image

What happened

The Cursor team published a blog post titled 'Improved Token Efficiency for Longer Agent Runs' dedicated to optimizing their own agent harness, and posted a long prompt built on these techniques on Telegraph for independently building a similar wrapper. According to the company's measurements, the total savings amounted to 7% of tokens per task without a drop in agent quality, with the effect verified through A/B tests on real production traffic rather than synthetic benchmarks. The system prompt was reduced by about 66%, replacing direct commands 'DO NOT' and 'You must' with tool descriptions. Static tool descriptions were cut by 60% through dynamic loading: everything needed less than 20% of the time was removed from the constant context. Explicit cache points in the OpenAI API, available with GPT-5.6, yielded 20% fewer cold cache misses, and sparse line numbering in Read—the line number is printed only on every tenth position—removed another 1.6% of cached read tokens.

Context

A harness is the wrapper around the model that assembles requests, manages context, the tool list, and cache, so it is precisely what it sends to the model that determines how many tokens are spent on a task. The key mechanism at Cursor is managing the cache boundary: variable data like skills, environment, and rules is moved beyond the cache boundary into a 'phantom user message', and cache breakpoints are placed after stable context layers and before the growing dialogue history so that the stable part is not recalculated anew. Savings are achieved by changing the composition and order of the context sent, not by asking the model to be more frugal. Cursor previously tested the same principle of dynamic context instead of static on MCP tools: moving them to dynamic loading yielded a 46.9% reduction in tokens in sessions with MCP, which is consistent with the new measurements. Methodologically, it is important that the numbers were obtained on production traffic: this reduces the risk of cherry-picking, but makes the metrics sensitive to the task profile, tool composition, and specific model.

Why this matters for the industry

For agent products, this is a direct impact on unit economics: the stated effect of a single pass—a 7% reduction in price per task—sets a reproducible benchmark that teams can compare their own measurements against. The techniques are applicable to any API with prompt caching and do not require changing the model, so the barrier to entry is low. The playbook has been published openly, and this devalues the 'smart wrapper' as a separate USP: basic optimization can now be reproduced by any team. If the numbers are confirmed by other teams, dynamic tool loading, cache breakpoints, and moving variable data beyond the cache boundary will likely become standard parts of harness frameworks, and protective instructions from the era of old models will begin to be mass-cleaned up; 'task cost' may become a standard dashboard metric on par with latency and quality. In the longer term—and this is an interpretation, not a fact from the sources—optimizing 'what to send to the model' can emerge as a separate engineering discipline with its own benchmarks, context profilers, and regression tests for cost, and agent economics will be optimized at the wrapper level as systematically as at the model level.

Why this matters for users

If you are building your own harness or pipeline around an LLM, you have a ready-made plan that can be applied the same day without changing the model. The first step is to measure the share of spending by source and billing type: output, uncached, and cached. Next, you need to clean up protective instructions left over from old models from the system prompt, replacing 'DO NOT' and 'You must' commands with tool descriptions. Only high-frequency tools like read, search, edit, and shell should be left static, while rare ones should be moved to dynamic loading. Then cache breakpoints are set after stable context layers, and line numbering in Read is moved to sparse mode with a number only on every tenth line. A separate quick path is to take the prompt from Telegraph and feed it to your own agent as a task for refactoring the harness; the technical breakdown in the Cursor blog explains why each technique works.

What is still unknown / limitations

The details of the A/B test methodology are not disclosed in the public materials: the sample size, traffic composition, set of models, and observation period remain unknown. It is also not disclosed how exactly 'no loss of quality' was operationalized—which quality metric was measured. All figures are vendor self-reported by Cursor, and there are no independent replications on other loads and APIs yet, so the transferability of the results to other pipelines is not confirmed. Finally, the effect for a specific pipeline is unknown in advance and depends on the share of static context and the cacheability of the sequence, so the starting point is your own measurement, not someone else's numbers.

Sources

Author

Look at AI, editorial team