--- license: cc-by-4.0 language: - en pretty_name: "Context U-curve: 36 coding-agent runs under six context-clearing policies" size_categories: - n<1K tags: - llm-agents - coding-agents - context-window - prompt-caching - token-usage - claude-code - benchmark configs: - config_name: default data_files: runs_ucurve.csv --- # Context U-curve: 36 coding-agent runs under six context-clearing policies How often should an LLM coding agent's context be cleared? This dataset holds every run behind the report **"Clear Every Third Task: A Measured U-Curve in the Context Economy of Coding Agents"** (Evgenii Arsentev, 2026; corrected version 1.2, DOI [10.5281/zenodo.22759217](https://doi.org/10.5281/zenodo.22759217); version 1.0: DOI 10.5281/zenodo.22699668). A fixed suite of twelve programming tasks was run under six session-length policies — a fresh session every 1, 2, 3, 4, 6 and 12 tasks — with six replicates each, holding the model, the tasks and their order constant. 36 runs, and no test failure in any run. 4086 is the total number of tests over the whole experiment, not a per-condition figure; per-condition totals are in the table below. The tests are written by the agent itself as part of each task, so their number varies from run to run (97 to 127). ## Correction (15 September 2026) The `modeled_cost_usd` column is kept as originally released and reflects incorrect prices: $3.00 and $15.00 per million input and output tokens, cache reads at $0.30 and every cache write at the 5-minute rate of $3.75. The model, `claude-sonnet-5`, is listed at $2.00 and $10.00, with cache reads at $0.20, and every cache write in these runs is a 1-hour write ($4.00). Corrected per-run costs are in `runs_ucurve_costs_v1.2.json` in Zenodo record version 1.2 (DOI [10.5281/zenodo.22759217](https://doi.org/10.5281/zenodo.22759217)). Token counters, model calls, wall-clock times and test results are unchanged. The summary table below uses the corrected costs. ## Summary by policy | tasks per session | runs | mean modeled cost, USD (corrected) | mean cache writes | mean cache reads | tests passed | |---|---|---|---|---|---| | 1 | 6 | 2.17 | 253k | 3.62M | 701/701 | | 2 | 6 | 1.85 | 170k | 3.58M | 697/697 | | 3 | 6 | 1.62 | 131k | 3.16M | 687/687 | | 4 | 6 | 1.70 | 123k | 3.47M | 699/699 | | 6 | 6 | 1.68 | 106k | 3.80M | 661/661 | | 12 | 6 | 1.78 | 88k | 4.45M | 641/641 | Cost is not monotone in session length and is lowest at every third task. Clearing after every task costs 33.5% more (p = 0.0022; 0.011 after Holm adjustment). Never clearing costs 9.7% more in the point estimate, which is not significant (p = 0.046; 0.14 after adjustment). Clearing every three, four or six tasks is indistinguishable. Cache writes fall with longer sessions while context carried per call rises; their product, cache reads, is U-shaped. Full statistics (exact permutation tests) are in the report. ## Fields One row per run. Counters only — no prompts, no model output, no file paths, no project names. | field | meaning | |---|---| | run_id | hash of the run directory name | | tasks_per_session | policy: a fresh session every N tasks (12 = never cleared) | | replicate | replicate number 1–6 | | sessions | sessions the run used | | model_calls | API calls made by the agent | | input_tokens / output_tokens | uncached input and model output tokens | | cache_write_tokens / cache_read_tokens | prompt-cache writes and reads | | total_tokens | sum of the four token counters | | modeled_cost_usd | modeled cost as originally released, at incorrect prices (see Correction) | | wall_clock_s | wall-clock duration of the run | | tests_total / tests_passed / tests_failed | verification suite result after the run | ## Tooling The run-efficiency metric from this study is implemented in [contextburn](https://github.com/arsentev-ai/contextburn) (`pip install contextburn`, MCP server `ai.arsentev/contextburn`). ## Citation ```bibtex @techreport{arsentev2026ucurve, author = {Arsentev, Evgenii}, title = {Clear Every Third Task: A Measured U-Curve in the Context Economy of Coding Agents}, year = {2026}, institution = {ARSENTEV.AI}, note = {Version 1.2}, doi = {10.5281/zenodo.22759217} } ``` Author: Evgenii Arsentev · ORCID [0000-0002-9120-7298](https://orcid.org/0000-0002-9120-7298) · [arsentev.ai/research](https://arsentev.ai/research) ## Mirrors and related records Kaggle copy of this dataset: https://www.kaggle.com/datasets/arsentevai/context-u-curve-of-coding-agents-36-runs OSF project with the report PDF and the data: https://osf.io/5qtwy/ (DOI 10.17605/OSF.IO/5QTWY) Demo of contextburn over these runs: DOI 10.5281/zenodo.22713920, https://www.youtube.com/watch?v=ep7LXFernwQ, https://archive.org/details/contextburn-demo-context-ucurve-2026 Podcast episode about this measurement: https://arsentev.ai/podcast/when-to-clear-agent-context All reports, datasets and DOIs: https://arsentev.ai/research