3 min read

How agents.md affects coding-agent costs

agents.mdкодовые агентыпромпт-инжиниринг

A short agents.md lowers the cost of a looping coding agent because its instructions are sent again with every model call. Minimal tool output and concise reports further reduce output tokens and history growth. In the cited benchmark, initial prompt prefixes differed by 12–15 times before meaningful work began.

Repeated context is what consumes the budget

I would look first not at the patch length, but at the text the agent carries through every iteration. The original discussion of a cyclic task describes a strict workflow: find a bug, form a hypothesis, implement a fix, and test it, while the agent mostly emits tool calls and short reports.

The key point is that instructions from agents.md are included in repeated model calls. An unnecessary sentence may seem harmless once, but it becomes a permanent tax on every new step. At the same time, conversation history grows, and verbose answers are fed back into the context of the next call.

The scale of the problem is clear in the cited prefix benchmark. One agent sent 1,147 to 1,642 tokens before doing substantive work; another sent 15,983 to 20,330. That is roughly a 12–15x difference on a trivial request, before the task had properly begun.

A related analysis of repository context also reports that files such as AGENTS.md can increase inference costs by more than 20% per session, sometimes without a noticeable improvement in results. This is not an argument for removing instructions altogether. Instead, every line should earn its place by influencing agent behavior.

A short loop matters more than a cheap model

The main gain does not come from silence for its own sake, but from using fewer tokens before reaching a working fix. A compact agents.md reduces the permanent prefix and makes it less likely that the agent will accompany every tool call with literary commentary.

For long tasks, the effect compounds quickly: instructions repeat, history expands, and test results and patch plans are sent back to the model again. I would therefore track initial context size, the number of loop passes, and the volume of intermediate reports separately. Total session cost is more useful than the cost of a single call.

But over-compression can also break the workflow. If agents.md loses completion criteria, testing rules, or change constraints, the agent may make more faulty iterations and consume all of the savings. Real optimization begins when a short prompt preserves the necessary constraints rather than merely containing fewer words.

Ultimately, the cheapest coding agent is not the one that talks the least, but the one that reaches a verified fix in the fewest meaningful cycles.

We previously examined how context costs and reasoning-mode settings in Claude Opus 4.6 affect the final price of requests. That analysis complements the case for concise task instructions that reduce agent token consumption.