Smaller context for development agents: did the bill drop?
In the agents that develop Fuad Next, a smaller context and a new prefix came with an observed 45.5% drop in mean attributed cost per PR. The isolated cause and quality remain open.
A coding agent’s context can hold the conversation, the files it has read, command output and a block of fixed instructions that opens the session, which I call the prefix. Prompt caching charges the repeated portion at a lower rate than new input, but those rereads also cost money and, in a long session, can repeat on every call to the model. In this sample, before the change, the main agent’s calls carried on average about 454,000 tokens, which are units of text.
I shortened the context of the agents that develop Fuad Next in Claude Code and in Specsfy, which organizes the work into specifications (specs). They now warn above 200,000 tokens and compact near 300,000: the history becomes a summary, and the session continues from it. The prefix changed in the same period, and the data do not separate the two effects. The study follows the context of the development agents; it does not measure the context the app offers to the people who use it.
Compared with the PRs (pull requests) opened in the previous seven days, those opened after November 9, 2026, at 8:39 p.m. Brasília time and merged by the end of November 14 had a mean attributed cost per PR, in API equivalent, of US$12.31, against US$22.59, 45.5% less. The comparison is observational, with no repeated tasks and no randomization; almost all of the drop shows up in the cost of each call. Quality and the isolated effect of context remain undemonstrated.
The bill per PR
The dollar amounts use the same historical Anthropic API rates in both periods. Depending on the calculation, they are applied to recorded or estimated tokens, including in the counterfactual scenarios. They are a common yardstick and do not demonstrate savings on the subscription. The cost of a PR sums cache reads and writes, input and output of the main agent and of the subagents attributed to it, each call at its own model’s rate. Compaction summaries are left out, because the log does not say which PR each one belongs to.
The main comparison has 126 PRs opened in the seven days before the cutoff and merged, and 111 opened after it and merged by the end of November 14. On average, the cost per PR fell from US$22.59 to US$12.31, 45.5% less. The exploratory 95% interval, computed by resampling groups of linked PRs, runs from -57.5% to -6.1%: wide and entirely below zero. The median is the central value of the sorted costs, or the mean of the two central ones when there is an even number of PRs, and it is less sensitive to the few very expensive PRs. It went from US$17.55 to US$9.09, a point drop of 48.2%, but its interval runs from -66.4% to +0.4% and crosses zero, so the difference in the median is inconclusive. The 45.5% drop is not yet the net balance per accepted delivery, which would include summaries and rework.
In this cohort, I call cost per call the total attributed cost divided by the total number of calls, the requests to the model. The meter uses the same rates in both periods, so the cost per call changes with the amount and type of tokens each call carries and with the model that serves it. It fell 43.3%, from US$0.121 to US$0.069, with an interval of -46.1% to -37.3%. Calls per PR went from 186.6 to 179.5, -3.8% at the point estimate, with an interval of -23.4% to +55.4%, which allows for a drop and also for a large increase.
In two steps from the old mean: swapping only the number of calls for the new value, keeping the old cost per call, gives US$21.73; then applying the new cost per call gives the observed US$12.31. The first step moves US$0.87, and the second, US$9.42. The intermediate point is hypothetical, and the split is accounting on point values, sensitive to the order of the steps: it shows where the difference appears, without saying what caused it.
| PR cohort measure | Before | After | Change |
|---|---|---|---|
| Mean cost per PR, US$ | 22.59 | 12.31 | −45.5% |
| Mean calls per PR | 186.6 | 179.5 | −3.8% |
| Cost per call, US$ | 0.1211 | 0.0686 | −43.3% |
Five days against five days
The main comparison has unequal durations: seven days of openings before the cutoff against the rest of November 9 and the five full days from the 10th to the 14th. Counting only PRs merged by the close leaves out the ones still open and favors those that closed quickly. This design leaves a selection bias whose direction on the later mean was not measured.
To check, the data include two windows of exactly 120 hours. The earlier one runs from November 4 at 8:39 p.m. to November 9 at 8:39 p.m., Brasília time; the later one, from November 9 at 8:39 p.m. to November 14 at 8:39 p.m. A PR counts if it was opened and merged within its window, excluding the final instant. This cut closes 3 hours 21 minutes before the main comparison and also restricts the earlier period to 120 hours, requiring opening and merging within the window; that is why the numbers differ.
With 93 PRs before and 108 after, the mean cost per PR went from US$21.86 to US$12.28, a 43.8% drop, and the median from US$18.65 to US$8.93, 52.1% less. Mean calls per PR went from 183.5 to 178.2 (-2.8%), and the agents’ estimated active time from 39.3 to 32.8 minutes (-16.7%), with 93 and 107 PRs measured. These are descriptive numbers, with no interval of their own; the main comparison’s intervals do not apply to this cut.
Mean attributed cost per PR, API-equivalent US$
Main comparison
Five days against five days
Before outlined; After filled. Main: 126/111 PRs. Equal 120-hour windows: 93/108, no interval of their own. Common scale starting at zero; attributed costs, without the estimated summaries that have no PR.
See the numbers in a table
| Item | Mean attributed cost per PR, US$ | n |
|---|---|---|
| Main comparison, Before | 22.59 | 126 |
| Main comparison, After | 12.31 | 111 |
| Equal five-day windows, Before | 21.86 | 93 |
| Equal five-day windows, After | 12.28 | 108 |
Method and data
718b900MethodologyDownload JSONDownload CSVWith the same duration on both sides, the observed drop stays near 44%. That eases the concern that it comes only from the short period, without eliminating it. The equal windows only see PRs that opened and finished inside them, which favors short work on both sides, and the tasks are not the same. Even with counts of 93 and 108, the PRs are not independent of each other, because many share a session or spec.
Where the call got cheaper
In this analysis, I measured context size and the cost components in the logs of the conversations with the agents, which Claude Code stores as sessions. I read 95 sessions from the earlier period and 48 from the later one, all from Fuad Next development. One session can serve several PRs, and one PR can go through several sessions: sessions and PRs are distinct counting units of the same development work, and these numbers do not mix with those of the PR cohort.
In the main agent’s calls, mean context went from about 454,000 to 197,000 tokens, 56.7% less, with an interval of -58.8% to -54.2%. Before, 73.5% of those calls exceeded 300,000 tokens; after, none did. The cost per main call, which here already includes the estimate for compaction summaries, went from US$0.128 to US$0.079, a 38.6% drop (interval of -41.4% to -35.3%).
Within that cost, three components weigh the most and appear here in dollars per thousand main calls: cache reads, which are the repeated portion, charged at a reduced rate; one-hour cache writes, which are the charge for writing a new portion to the cache, with that duration, for reuse; and output, which is the text the model generates. The other components and the summaries are outside these three, so they do not add up to the main agent’s cost with the estimated summaries.
API-equivalent US$ per thousand main agent calls
Cache reads
Cache writes, 1 hour
Output
Three dominant components; not the total cost. Estimated summaries and smaller components are left out of these columns. Sample: 95 sessions before, 48 after. Same scale; Before outlined and After filled.
See the numbers in a table
| Item | US$ per thousand main-agent calls | n |
|---|---|---|
| Cache reads, Before | 90.25 | 95 |
| Cache reads, After | 38.70 | 48 |
| Cache writes, 1 hour, Before | 22.29 | 95 |
| Cache writes, 1 hour, After | 24.49 | 48 |
| Output, Before | 15.06 | 95 |
| Output, After | 13.88 | 48 |
Method and data
718b900MethodologyDownload JSONDownload CSVCache reads shrank by US$51.55 per thousand calls, from US$90.25 to US$38.70, more than the total drop of US$49.30. The rest of the bill gave back the difference: cache writes rose US$2.20 and were the visible component that pushed hardest toward an increase, while output fell slightly. The rise in writes is consistent with compacting more often, because after each summary the new context has to be written to the cache, but the data do not attribute all writes to compaction nor separate them from the new prefix.
The interpretation is an accounting one and consistent with the hypothesis about the joint change: with a smaller context and a new prefix, the component that shrank most was rereading. It does not measure how much of the result is due to context, prefix or different tasks.
Subagents, which the main agent launches for delegated tasks, change the picture depending on the denominator. In the sessions examined, their calls went from 2,133 to 8,776, while main calls went from 31,241 to 18,708, and subagent spending went from about US$120 to US$451. Dividing the sessions’ total cost (main agent, subagents and summaries) by all calls, the drop is 43.3%, from US$0.123 to US$0.070. Dividing the same numerator by main calls only, it is 22.1%, from US$0.132 to US$0.103, with an interval of -31.6% to -10.9%. The first rate says how much any call costs; the second, how much the system spends per call of the agent leading the work, with everything it delegated. The gap between the two comes from the greater weight of delegation in the later period, which has its own cost; the data do not say whether that delegation came from compaction, the prefix or the tasks. Neither rate is the 45.5% per PR. The first matches, when rounded, the cohort’s 43.3% drop in cost per call, but the calculations differ: the session one uses the sessions’ calls and includes the estimated summaries, and the cohort one uses the calls attributed to the selected PRs and leaves those summaries out.
What the compactions cost
Compacting has its own cost. The summary is generated by the model in a paid call; after it, the first call sends a context different from the previous one, and the new summary has to be written to the cache. In the 48 later sessions there were 207 compactions, against 34 in the 95 earlier ones. If that cost were high, it could eat up what was no longer reread.
Since the same session cannot be observed without compacting, the meter uses a counterfactual model. It keeps the sequence of calls that actually happened and, in each call after a compaction, until the next compaction or the end of the session, puts the removed portion back as if it were still in the context, with a cap of 970,185 tokens, the same in both periods. The difference in cache cost of these hypothetical calls is the estimated avoided cache use. It includes cache reads and also cache writes, when the model identifies that the cache would have been lost. The model does not simulate an agent working without compaction and does not know whether, with the full history, it would make more or fewer calls.
On the cost side go the estimated summary and a net cache adjustment on the first call after each compaction. That adjustment measures the cost difference of that call and does not prove that the whole prefix was rewritten. Of the 207 observed compactions, 206 have an assessable balance and one has none; the figures below are for the 206.
The balance starts at the estimated avoided cache use, US$472.19, a hypothetical value and not spending that took place. Subtracting the summaries, US$27.53, and the net cache adjustment, US$128.26, leaves the estimated balance of US$316.40.
Estimated US$ across the 206 assessable compactions
Modeled balance of the 206 assessable compactions, out of 207 observed. The balance deducts summaries and cache adjustment. It is not an observed discount and does not add to the per-PR drop.
See the numbers in a table
| Item | Estimated US$ across 206 evaluable compactions |
|---|---|
| Cache usage avoided | 472.19 |
| Summaries | -27.53 |
| Cache adjustment | -128.26 |
| Estimated balance | 316.40 |
Method and data
718b900MethodologyDownload JSONDownload CSVThe two costs total about US$155.80, about US$0.76 per compaction, of which US$0.13 is summary and US$0.62 is cache. In the model, they consumed 33% of the avoided cache use, and 67% remained. In 196 of the 206 compactions, the individual balance was positive. The conditional interval of the balance, from US$244.84 to US$395.26, describes the variation within the model and the observed sessions; it does not identify an effect nor correspond to a discount seen on an invoice.
This calculation does not combine with the PR one by subtraction. The cost per PR was already measured on the calls that happened, with the actual cache writes built in; deducting the cache adjustment again would count it twice. The estimated summaries are left out of the cost per PR because they have no attributed PR, and dividing their total by the 111 PRs would create an attribution the log does not make. That is why the 45.5% is not the full net balance per accepted delivery, and there is not yet a percentage that joins the two calculations.
Declared effort went up
If the later period had different work, such as simpler PRs, that difference could explain part of the drop, unrelated to context. Specsfy gives a clue about that shift. Effort is the 1-to-10 effort score recorded in the spec. In this analysis, each PR gets the score of its linked spec.
The mix moved the opposite way. Median Effort rose from 6 to 8, and the 7-to-8 band went from 44 of the 126 earlier PRs (34.9%) to 87 of the 111 later ones (78.4%). That does not prove the PRs got heavier: nobody checked whether the scale was used the same way in both periods. Lines of code, another size indicator and also imperfect, are missing for 42 of the 111 later PRs. The stability of work size per PR remains undemonstrated.
For each Effort band, the data compare the median cost per PR before and after, in dollars, with the number of PRs in each period. These are two values per band, with no time series between them, and no band has an interval.
Median attributed cost per PR, API-equivalent US$
Effort 1 to 4
Effort 5 to 6
Effort 7 to 8
Effort 9 to 10
Before outlined; After filled. Same scale and n per band. The line only connects the two periods. No interval per band; Effort 9 to 10 has only 1 PR before and 2 after.
See the numbers in a table
| Item | Median per PR, US$ | Mean per PR, US$ | n |
|---|---|---|---|
| 1 to 4, Before | 17.41 | 18.64 | 25 |
| 1 to 4, After | 18.85 | 18.26 | 6 |
| 5 to 6, Before | 16.15 | 18.91 | 56 |
| 5 to 6, After | 7.04 | 9.22 | 16 |
| 7 to 8, Before | 29.23 | 29.37 | 44 |
| 7 to 8, After | 8.77 | 12.16 | 87 |
| 9 to 10, Before | 29.24 | 29.24 | 1 |
| 9 to 10, After | 25.88 | 25.88 | 2 |
Method and data
718b900MethodologyDownload JSONDownload CSVIn the two bands with the most PRs on both sides, the median fell: from US$16.15 to US$7.04 in the 5-to-6 band (56 and 16 PRs) and from US$29.23 to US$8.77 in the 7-to-8 band (44 and 87). The 1-to-4 band rose from US$17.41 to US$18.85, with only 6 PRs after, against 25 before. The 9-to-10 band has 1 PR before and 2 after, at US$29.24 and US$25.88, and does not support generalization.
To compare similar work with a bit more care, I crossed the type declared in the PR title (feat, fix or other) with the Effort band and kept only the combinations with at least 5 PRs in each period. Four remained, covering 58 of the 126 earlier PRs and 77 of the 111 later ones. With each combination weighted as it was in the earlier period, the standardized mean cost falls 54.6%. The calculation is partial and exploratory, with no interval; it does not pair identical tasks and does not adjust for everything that changed. It reinforces the signal: comparing type with type and band with band, the observed drop does not go away.
Did the agent work more to compensate?
If the summary lost information, the agent could redo steps, and that would tend to show up as more calls, more tool actions or more time per PR, unless other differences between the work offset it. Tool actions and the logical steps of a task are not the same measure.
Time has no per-PR stopwatch. Activity is estimated from the request and response events to the model and from the tools, with priority for the durations the tools themselves record. Parallel intervals within the same PR are merged, and each inferred gap above 5 minutes is discarded entirely. The result is the agents’ estimated active time: it may include short waits, may miss long work that left no event, and does not measure human time or the full Specsfy cycle.
In calls per PR, the point estimate is -3.8%. Actions went from 198.3 to 189.3 per PR, -4.5%, and time from 39.5 to 33.2 minutes, -16.1%, with 126 PRs before and 110 after.
Change relative to the earlier period, %
95% CI: -23.4% to 55.4% · includes zero
95% CI: -24.4% to 55.0% · includes zero
95% CI: -34.6% to 38.8% · includes zero
Points: observed change. Bars: exploratory 95% intervals. All cross zero; they show neither a gain nor equivalence. Calls and actions: 126/111 PRs. Estimated activity: 126/110, inferred gaps above 5 minutes discarded.
See the numbers in a table
| Item | Change, % | Lower bound, % | Upper bound, % | PRs before | PRs after |
|---|---|---|---|---|---|
| Calls per PR, mean | -3.8 | -23.4 | 55.4 | 126 | 111 |
| Tool actions per PR, mean | -4.5 | -24.4 | 55.0 | 126 | 111 |
| Activity per PR, mean | -16.1 | -34.6 | 38.8 | 126 | 110 |
Method and data
718b900MethodologyDownload JSONDownload CSVAll three intervals cross zero and reach further toward an increase: an increase of up to about 55% in calls and actions, or of nearly 39% in time, still fits within the uncertainty. None of the three point drops can be called a gain. The intervals also do not show that volume stayed the same, because no equivalence margin was defined, and they do not incorporate the selection bias of already completed PRs. Their reach is limited: the point estimates do not show the increase in work that would cancel out the savings, and, in the cost-per-PR calculation, almost all of the difference appears in the cost per call.
Did quality keep up?
Spending less per PR is only worth it if the code stays good, and this is the weakest part of the data. There are two signals, both with partial coverage. CI, the set of automated continuous integration checks, passed on the PR’s first commit in 27 of the 45 earlier PRs with a record (60.0%) and in 46 of the 52 later ones (88.5%); only 45 of the 126 and 52 of the 111 have that record. Codex’s automated review recorded on average 2.52 findings per reviewed PR across 62 PRs before and 2.32 across 68 after.
In the available records, both signals moved in the favorable direction. With this coverage, that supports neither improvement, nor equivalence, nor absence of deterioration. Green CI on the first commit is different from an accepted delivery. The follow-up does not use a common window to surface late problems, and there is no interval that respects the dependence between PRs. The records of the already audited PRs come from the earlier readings, and those of the 7 new ones from the November 15 reading, so the set does not reconstruct the state at midnight on the 14th. Reverts were not checked in this reading, which does not mean zero reverts, and rework was not measured.
| Available signal | Before | After |
|---|---|---|
| Green CI on first commit | 27/45 (60.0%) | 46/52 (88.5%) |
| CI coverage | 45/126 PRs | 52/111 PRs |
| Findings per reviewed PR | 2.52 (62 PRs) | 2.32 (68 PRs) |
What this comparison supports
In the observed cohort, the Fuad Next development agents became cheaper per PR after the joint change in context and prefix. The mean attributed cost fell 45.5%, with an interval entirely below zero, and 43.8%, in a descriptive reading without an interval, in the windows of exactly five days. Almost all of the difference appears in the cost per call, and, in the sessions’ main calls, the component that shrank most was cache reads. The hypothesis that this change reduces spending has a favorable signal in these data, and I would keep the configuration while the investigation continues.
In the means of calls, actions and time, the main analysis did not demonstrate a change in any direction. Quality has favorable signals and insufficient coverage. The isolated effect of context does not show, because the prefix changed at the same time, the Effort mix changed and the tasks are not the same. The compactions left a positive balance in the counterfactual model, but there is not yet a net percentage per accepted delivery.
After seeing these numbers, I chose the criterion for the next stage: cost per accepted delivery, with quality maintained. Calls and time come in as explanation and do not need to fall for there to be savings. The proposal, not yet carried out, is to run the same Fuad Next tasks in two isolated environments, from the same repository state, varying only the context policy. Prefix, model, tools and cache conditions stay fixed, and the order of the configurations is randomized. Each side’s cost includes summaries, failed attempts and rework, and is divided by accepted deliveries, with the same acceptance criterion and the same quality follow-up on both sides.
Before collection, a pilot checks the measurement and estimates the variation between tasks to size the sample. Minimum savings, quality margin, follow-up window and budget still need to be defined in the protocol, before the main collection. Extending the current observation to seven full days would improve the descriptive comparison, but on its own would not settle the question of cause.
Data to check the numbers
Download full data, exclusions and checks (JSON)The panels below show additional comparisons from the same collection. The file includes the chart values and also cuts, exclusions and checks that do not fit in the main reading.
Scope and study limitations
Agent draft from the listed sources; reviewed and approved by Lucas Fuad