[{"data":1,"prerenderedAt":848},["ShallowReactive",2],{"blog-context-rot-compaction-long-running-agents-en":3},{"slug":4,"published":5,"minutes":6,"category":7,"tags":8,"keywords":14,"about":26,"sources":36,"cover":70,"og":71,"expertise":72,"locales":73,"lang":74,"title":77,"description":78,"coverAlt":79,"metaTitle":80,"takeaways":81,"faq":87,"toc":103,"blocks":137,"others":578},"context-rot-compaction-long-running-agents","2026-10-16",10,"agents",[9,10,11,12,13],"Context rot","Compaction","Context engineering","Long-running agents","Agent memory",[15,16,17,18,19,20,21,22,23,24,25],"context rot","context rot LLM","compaction AI agents","context engineering","long-running agents context window","Claude compaction API","context editing clear tool results","OpenAI responses compaction","lost in the middle LLM","agent context management","sub-agents context isolation",[27,30,33],{"name":28,"url":29},"Context window","https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FLarge_language_model#Context_window",{"name":31,"url":32},"Attention (machine learning)","https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FAttention_(machine_learning)",{"name":34,"url":35},"Intelligent agent","https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FIntelligent_agent",[37,40,43,46,49,52,55,58,61,64,67],{"title":38,"url":39},"Chroma: Context Rot: How Increasing Input Tokens Impacts LLM Performance (Jul 2025)","https:\u002F\u002Fresearch.trychroma.com\u002Fcontext-rot",{"title":41,"url":42},"Liu et al.: Lost in the Middle: How Language Models Use Long Contexts (2023)","https:\u002F\u002Farxiv.org\u002Fabs\u002F2307.03172",{"title":44,"url":45},"Modarressi et al.: NoLiMa: Long-Context Evaluation Beyond Literal Matching (2025)","https:\u002F\u002Farxiv.org\u002Fabs\u002F2502.05167",{"title":47,"url":48},"Anthropic: Effective context engineering for AI agents (Sep 2025)","https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Feffective-context-engineering-for-ai-agents",{"title":50,"url":51},"Anthropic: Effective harnesses for long-running agents (Nov 2025)","https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Feffective-harnesses-for-long-running-agents",{"title":53,"url":54},"Claude API docs: Compaction at a token threshold","https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fcompaction-threshold",{"title":56,"url":57},"Claude API docs: Compaction on demand","https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fcompaction-on-demand",{"title":59,"url":60},"Claude API docs: Context editing","https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fcontext-editing",{"title":62,"url":63},"Claude API docs: Memory tool","https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fagents-and-tools\u002Ftool-use\u002Fmemory-tool",{"title":65,"url":66},"OpenAI API docs: Compaction","https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fguides\u002Fcompaction",{"title":68,"url":69},"Cognition: Don't Build Multi-Agents","https:\u002F\u002Fcognition.ai\u002Fblog\u002Fdont-build-multi-agents","\u002Fimages\u002Fblog\u002Fcontext-rot-compaction-long-running-agents\u002Fcover.webp","\u002Fimages\u002Fblog\u002Fcontext-rot-compaction-long-running-agents\u002Fog.jpg","ai-engineer",[74,75,76],"en","de","hu","Context rot in long-running agents: clearing, compaction, memory and sub-agents","Why LLM accuracy drops as context grows, and how clearing tool results, compaction, notes and sub-agents keep long-running agents on track.","An agent's context size rising over turns, kept in a band by clearing old tool results and compaction instead of growing to the window limit.","Context rot and compaction in long agent runs · Balázs Csorba",[82,83,84,85,86],"Context rot is the accuracy drop as input grows: on NoLiMa, 11 of 13 long-context models fell below half their short-context baseline at 32K tokens.","Agents are hit hardest because the loop appends every tool call and result, filling the window with stale, distractor-heavy content.","Clear old tool results first; Claude's context editing does it by rule, with clear_at_least to keep cache rewrites worthwhile.","Compaction summarises older turns server-side on Claude and OpenAI, but it is lossy, so write domain instructions and keep recent turns verbatim.","Plans, progress files and git survive any compaction; use sub-agents for read-only exploration and keep writes in one agent with full context.",[88,91,94,97,100],{"q":89,"a":90},"What is context rot?","Context rot is the decline in an LLM's accuracy as its input gets longer, long before the context window is full. Studies such as Lost in the Middle, NoLiMa and Chroma's Context Rot report show that models use long inputs unevenly and become less reliable as irrelevant or distracting content accumulates.",{"q":92,"a":93},"What is compaction in AI agents?","Compaction replaces the older part of a conversation with a model-written summary and continues from it, so a long task fits in a smaller, more focused context. The Claude API offers it at a token threshold or on demand, and OpenAI's Responses API offers it through a compaction threshold or a standalone compact endpoint.",{"q":95,"a":96},"Is compaction enough to keep a long-running agent on track?","Usually not on its own. Anthropic reports that even with compaction, agents tended to attempt too much at once or declare work finished early. Persisting a plan, a progress log, a feature list and git commits, and reading them at the start of each session, made long runs coherent.",{"q":98,"a":99},"What is the difference between context editing and compaction?","Context editing removes specific content by rule, such as old tool results or thinking blocks, without summarising anything. Compaction summarises older turns into a shorter block. Clearing is cheaper and safer; compaction keeps more of the conversation's meaning but loses detail the summary does not capture.",{"q":101,"a":102},"Should I use sub-agents to avoid context rot?","For read-only exploration, yes: a sub-agent can search in its own window and return a summary of about 1,000 to 2,000 tokens. For work that writes or changes things, keep one agent with full context, because sub-agents that cannot see each other's decisions tend to produce conflicting results.",[104,107,110,113,116,119,122,125,128,131,134],{"id":105,"title":106},"what-is-context-rot","What the research shows",{"id":108,"title":109},"why-agents-rot-faster","Why agents are hit hardest",{"id":111,"title":112},"four-levers","Four levers: clear, compact, offload, isolate",{"id":114,"title":115},"clear-tool-results","Clearing old tool results",{"id":117,"title":118},"compaction","Compaction: summarise and continue",{"id":120,"title":121},"notes-and-memory","Notes and memory outside the window",{"id":123,"title":124},"sub-agents","Sub-agents: isolation with a price",{"id":126,"title":127},"just-in-time-context","Load less in the first place",{"id":129,"title":130},"measuring-context-rot","Measuring it in your own agent",{"id":132,"title":133},"checklist","Checklist",{"id":135,"title":136},"sources","Sources",[138,145,148,151,154,194,197,198,207,215,216,261,270,271,287,289,304,307,308,313,386,388,395,398,399,410,429,430,433,441,442,453,485,486,489,507,515,516,534,541,542],{"type":139,"content":140},"paragraph",[141,144],{"tag":142,"children":143},"strong",[9]," is the drop in an LLM's accuracy as its input gets longer, well before the context window is full. A 1M-token window does not mean the model uses the millionth token as well as the hundredth. For a chat that hardly matters. For an agent that runs for hours and appends every file it reads and every command it runs, it is the main reason quality falls off late in a task.",{"type":139,"content":146},[147],"This article collects the evidence, explains why agents are hit hardest, and walks through the four levers that work in practice: clearing old tool results, compaction, notes and memory outside the window, and sub-agents with their own context. It includes the current Claude and OpenAI API mechanics for each, and the harness patterns that keep a long run coherent.",{"type":149,"level":150,"id":105,"text":106},"heading",2,{"type":139,"content":152},[153],"Three lines of work point the same way. None of them uses agent workloads, which, if anything, means real agents fare worse:",{"type":155,"head":156,"rows":163},"table",[157,159,161],[158],"Study",[160],"Setup",[162],"Finding",[164,174,184],[165,170,172],[166,169],{"tag":142,"children":167},[168],"Lost in the Middle"," (Liu et al., 2023)",[171],"Multi-document QA and key-value retrieval with the relevant item at different positions",[173],"Accuracy is highest when the relevant information is at the start or end, and drops significantly in the middle, even for long-context models",[175,180,182],[176,179],{"tag":142,"children":177},[178],"NoLiMa"," (Modarressi et al., ICML 2025)",[181],"Needle-in-a-haystack where question and needle share minimal wording; 13 models claiming at least 128K context",[183],"At 32K tokens, 11 of 13 models fell below 50% of their short-context baseline; GPT-4o dropped from 99.3% to 69.7%",[185,190,192],[186,189],{"tag":142,"children":187},[188],"Context Rot"," (Chroma, July 2025)",[191],"18 models including GPT-4.1, Claude 4, Gemini 2.5 and Qwen3 on controlled simple tasks",[193],"Performance grows increasingly unreliable as input grows; on LongMemEval every model did significantly better with focused ~300-token prompts than with full ~113K-token prompts",{"type":139,"content":195},[196],"Chroma's report adds two details that matter for agents. Distractors, content that looks relevant but is not, hurt more as context grows, and the Claude models in the study tended to abstain under that ambiguity rather than guess. And, counter-intuitively, models did better on a shuffled haystack than on a coherent one. The conclusion of the report is the useful one: whether the relevant information is in the context matters less than how it is presented.",{"type":149,"level":150,"id":108,"text":109},{"type":139,"content":199},[200,201,206],"The ",{"tag":202,"to":203,"children":204},"link","\u002Fblog\u002Fagent-loop-explained",[205],"agent loop"," appends every tool call and every tool result to the history and sends all of it back on the next turn. After two hours of work the context is mostly stale file reads, old test output and superseded plans: exactly the distractor-heavy, low-signal input the studies above punish. Anthropic's context engineering guide frames it as an \"attention budget\": a transformer relates every token to every other token, n² pairs for n tokens, so each added token thins the attention left for the ones that matter. The guide's working rule is to find \"the smallest possible set of high-signal tokens\" for the next step.",{"type":139,"content":208},[209,210,214],"The second problem is cost. Every token in the history is billed again on every turn; caching softens that (see ",{"tag":202,"to":211,"children":212},"\u002Fblog\u002Fllm-cost-latency-prompt-caching-routing",[213],"prompt caching and routing","), but a context that only grows makes every later step slower and more expensive as well as less accurate.",{"type":149,"level":150,"id":111,"text":112},{"type":155,"head":217,"rows":226},[218,220,222,224],[219],"Lever",[221],"What it does",[223],"What you lose",[225],"Reach for it when",[227,237,245,253],[228,231,233,235],[229,230],"tag","children",[232],"Drops old tool results (and optionally inputs or thinking) by rule",[234],"The raw output, which the agent can usually re-fetch",[236],"Tool output dominates the context; first and cheapest step",[238,239,241,243],[229,230],[240],"Replaces older turns with a model-written summary",[242],"Detail the summary did not keep",[244],"Long back-and-forth that must stay one conversation",[246,247,249,251],[229,230],[248],"Agent writes notes, plans and progress to files or a memory store",[250],"Nothing, if the agent reads them back",[252],"Multi-session work with clear milestones",[254,255,257,259],[229,230],[256],"A sub-agent explores in its own window and returns a short summary",[258],"The sub-agent's reasoning; coordination gets harder",[260],"Broad search or research that would flood the main window",{"type":262,"attrs":263,"inner":267,"caption":268},"diagram",{"viewBox":264,"role":265,"aria-labelledby":266},"0 0 720 300","img","cr-saw-t cr-saw-d","\u003Ctitle id=\"cr-saw-t\">Context size over an agent run, with and without management\u003C\u002Ftitle>\u003Cdesc id=\"cr-saw-d\">Line chart of input tokens per turn. Without management the context grows steadily until it hits the window limit. With tool-result clearing the growth is slower. With compaction the line rises to a trigger, drops to a short summary, and rises again in a sawtooth, staying in a lower range where accuracy is better.\u003C\u002Fdesc>\u003Cpath d=\"M70 260H690\" class=\"d-line\" \u002F>\u003Cpath d=\"M70 260V30\" class=\"d-line\" \u002F>\u003Ctext x=\"20\" y=\"150\" text-anchor=\"middle\" class=\"d-label\" transform=\"rotate(-90 20 150)\">input tokens per turn\u003C\u002Ftext>\u003Ctext x=\"380\" y=\"288\" text-anchor=\"middle\" class=\"d-label\">turns\u003C\u002Ftext>\u003Cpath d=\"M70 50H690\" class=\"d-line d-dash\" \u002F>\u003Ctext x=\"686\" y=\"44\" text-anchor=\"end\" class=\"d-small\">window limit\u003C\u002Ftext>\u003Cpath d=\"M70 150H690\" class=\"d-dash d-line\" \u002F>\u003Ctext x=\"686\" y=\"144\" text-anchor=\"end\" class=\"d-small\">trigger\u003C\u002Ftext>\u003Cpath d=\"M70 250L430 52\" class=\"d-line\" fill=\"none\" \u002F>\u003Cpath d=\"M70 250L690 120\" class=\"d-line d-dash\" fill=\"none\" \u002F>\u003Cpath d=\"M70 250L230 150L236 232L396 150L402 232L562 150L568 232L690 170\" class=\"d-line-accent\" fill=\"none\" \u002F>\u003Cpath d=\"M90 76H110\" class=\"d-line\" \u002F>\u003Ctext x=\"116\" y=\"80\" text-anchor=\"start\" class=\"d-small\">no management\u003C\u002Ftext>\u003Cpath d=\"M90 96H110\" class=\"d-line d-dash\" \u002F>\u003Ctext x=\"116\" y=\"100\" text-anchor=\"start\" class=\"d-small\">clearing\u003C\u002Ftext>\u003Cpath d=\"M90 116H110\" class=\"d-line-accent\" \u002F>\u003Ctext x=\"116\" y=\"120\" text-anchor=\"start\" class=\"d-small\">compaction\u003C\u002Ftext>",[269],"Illustrative, not measured: clearing slows growth, compaction keeps the context in a band. The point of both is to stay where the model is accurate, not just under the limit.",{"type":149,"level":150,"id":114,"text":115},{"type":139,"content":272},[273,274,277,278,282,283,286],"Anthropic calls tool result clearing \"one of the safest lightest touch forms of compaction\": once the agent has read a file and acted on it, the full file contents rarely need to stay. On the Claude API this is ",{"tag":142,"children":275},[276],"context editing"," (beta header ",{"tag":279,"children":280},"code",[281],"context-management-2025-06-27","). The ",{"tag":279,"children":284},[285],"clear_tool_uses_20250919"," strategy activates above a trigger (default 100,000 input tokens), keeps the most recent tool uses (default 3) and replaces older results with a placeholder:",{"type":279,"code":288},"response = client.beta.messages.create(\n    model=\"claude-opus-5-5\",\n    max_tokens=16000,\n    betas=[\"context-management-2025-06-27\"],\n    tools=tools,\n    messages=messages,\n    context_management={\"edits\": [{\n        \"type\": \"clear_tool_uses_20250919\",\n        \"trigger\": {\"type\": \"input_tokens\", \"value\": 30000},\n        \"keep\": {\"type\": \"tool_uses\", \"value\": 3},\n        \"clear_at_least\": {\"type\": \"input_tokens\", \"value\": 5000},\n        \"exclude_tools\": [\"web_search\"],   # results you never want dropped\n    }]},\n)",{"type":139,"content":290},[291,292,295,296,299,300,303],"Two settings deserve attention. ",{"tag":279,"children":293},[294],"exclude_tools"," protects results the agent cannot cheaply recreate. ",{"tag":279,"children":297},[298],"clear_at_least"," exists because clearing invalidates the cached prompt prefix at the point of the edit; if a clearing pass only frees a few hundred tokens, the cache rewrite costs more than it saves. A separate ",{"tag":279,"children":301},[302],"clear_thinking_20251015"," strategy does the same for old thinking blocks.",{"type":139,"content":305},[306],"You can do the same in your own harness without any beta: keep the last few tool results verbatim and replace older ones with a one-line stub such as \"read src\u002Forder.ts (412 lines), see notes\". The stub keeps the trajectory legible while dropping the bulk.",{"type":149,"level":150,"id":117,"text":118},{"type":139,"content":309},[310,312],{"tag":142,"children":311},[10]," replaces older turns with a summary and continues from it. Anthropic describes how Claude Code does it: the model summarises the history, keeping architectural decisions, unresolved bugs and implementation details while discarding redundant tool outputs. Both big APIs now offer it server-side:",{"type":314,"ordered":315,"items":316},"list",false,[317,342,365],[318,321,322,325,326,329,330,333,334,337,338,341],{"tag":142,"children":319},[320],"Claude, at a token threshold"," (beta ",{"tag":279,"children":323},[324],"compact-2026-01-12","): add ",{"tag":279,"children":327},[328],"compact_20260112"," to ",{"tag":279,"children":331},[332],"context_management.edits",". The default trigger is 150,000 input tokens, with a minimum of 50,000. ",{"tag":279,"children":335},[336],"instructions"," replaces the default summarisation prompt entirely, and ",{"tag":279,"children":339},[340],"pause_after_compaction"," stops after the summary so you can re-insert recent turns verbatim.",[343,321,346,349,350,353,354,356,357,360,361,364],{"tag":142,"children":344},[345],"Claude, on demand",{"tag":279,"children":347},[348],"compact-2026-09-04","): send the conversation with ",{"tag":279,"children":351},[352],"\"compaction\": {\"type\": \"summarize\"}","; the response is a single signed ",{"tag":279,"children":355},[117]," block with ",{"tag":279,"children":358},[359],"stop_reason"," ",{"tag":279,"children":362},[363],"\"compaction\"",", which goes first in your next request in place of the summarised messages. Your application decides when.",[366,369,370,373,374,377,378,381,382,385],{"tag":142,"children":367},[368],"OpenAI Responses API",": set ",{"tag":279,"children":371},[372],"context_management"," with ",{"tag":279,"children":375},[376],"compact_threshold"," on ",{"tag":279,"children":379},[380],"responses.create",", or call the standalone compact endpoint. The returned compaction item is encrypted and \"not intended to be human-interpretable\"; with ",{"tag":279,"children":383},[384],"store=false"," the flow is ZDR-friendly.",{"type":279,"code":387},"response = client.beta.messages.create(\n    model=\"claude-opus-5-5\",\n    max_tokens=16000,\n    betas=[\"compact-2026-01-12\"],\n    tools=tools,\n    messages=messages,\n    context_management={\"edits\": [{\n        \"type\": \"compact_20260112\",\n        \"trigger\": {\"type\": \"input_tokens\", \"value\": 120000},\n        \"instructions\": (\n            \"Summarise for continuing this task in a new context window. Keep: the goal, \"\n            \"constraints the user stated, decisions made and why, files changed, failing \"\n            \"tests and their errors, open questions, the next step. Drop raw tool output.\"\n        ),\n    }]},\n)\nmessages.append({\"role\": \"assistant\", \"content\": response.content})   # keep the compaction block",{"type":389,"variant":390,"title":391,"body":392},"callout","warn","Append the whole response",[393],[394],"The compaction block lives in the response content. If your loop appends only the text of the reply, the compaction state is silently lost and the next request sends the full history again. Also count the cost: compaction is an extra sampling step that appears as its own entry in the usage iterations and counts toward rate limits.",{"type":139,"content":396},[397],"A summary is lossy by design. What the default prompt drops is usually what bites later: the user's constraint from turn three, the reason an approach was abandoned. Write your own instructions for your domain, keep the last few turns verbatim, and test it: run tasks that need a fact from before the compaction and check the agent still has it.",{"type":149,"level":150,"id":120,"text":121},{"type":139,"content":400},[401,402,405,406,409],"Anthropic's November 2025 harness article is blunt: \"compaction isn't sufficient\". Even a frontier model looping across context windows tended to try to one-shot an app or to declare the project done early. What fixed it was state on disk. An initializer session writes an ",{"tag":279,"children":403},[404],"init.sh",", a ",{"tag":279,"children":407},[408],"claude-progress.txt"," log and an initial git commit; for their example app it also wrote a feature list of more than 200 requirements, all marked failing. Every later session reads the progress file and git history, makes incremental progress on one feature and leaves structured updates.",{"type":139,"content":411},[412,413,416,417,420,421,423,424,428],"This is the offload lever, and it is the one I rely on most for coding agents: a plan file, a progress log and small commits are cheap, survive any compaction or crash, and are readable by the human reviewing the work. For agents that are not file-based, Claude's memory tool (",{"tag":279,"children":414},[415],"memory_20250818",") gives the same pattern as a tool: the model reads and writes files under ",{"tag":279,"children":418},[419],"\u002Fmemories",", and your application executes those operations against storage you control. Because it is your storage, the handler must reject paths outside ",{"tag":279,"children":422},[419],". What to store, and how to keep it from being poisoned, is covered in ",{"tag":202,"to":425,"children":426},"\u002Fblog\u002Fai-agent-memory-design",[427],"designing memory for AI agents",".",{"type":149,"level":150,"id":123,"text":124},{"type":139,"content":431},[432],"A sub-agent gets a task, its own clean context window and its own tools. It may burn tens of thousands of tokens exploring, but returns, in Anthropic's words, \"a condensed, distilled summary of its work (often 1,000-2,000 tokens)\". The main agent's window only ever sees the summary. That is the strongest lever against rot for search-heavy work, such as \"find every place that computes VAT\" across a large codebase.",{"type":139,"content":434},[435,436,440],"The price is coordination. Cognition's \"Don't Build Multi-Agents\" argues for sharing full agent traces rather than individual messages, because actions carry implicit decisions and sub-agents that cannot see each other's decisions produce conflicting results. My rule: sub-agents for read-only exploration and research that returns facts; one agent with full context for anything that writes. ",{"tag":202,"to":437,"children":438},"\u002Fblog\u002Fmulti-agent-systems-when-worth-it",[439],"When multi-agent systems are worth it"," goes deeper.",{"type":149,"level":150,"id":126,"text":127},{"type":139,"content":443},[444,445,448,449,452],"The cheapest token to manage is the one never added. Anthropic describes \"just in time\" context: the agent keeps lightweight identifiers (file paths, stored queries, links) and loads data only when needed, using tools like ",{"tag":279,"children":446},[447],"head",", ",{"tag":279,"children":450},[451],"tail"," and targeted queries instead of reading whole objects. Tool design does the rest:",{"type":314,"ordered":315,"items":454},[455,460,465,470],[456,459],{"tag":142,"children":457},[458],"Paginate and truncate tool output"," by default, with a clear note on how to get more.",[461,464],{"tag":142,"children":462},[463],"Return summaries plus handles,"," not raw dumps: \"143 matching orders, first 10 below, query id q_17\".",[466,469],{"tag":142,"children":467},[468],"Keep stable instructions short and up front,"," and put the current goal and constraints near the end of the context, where the Lost in the Middle results say models attend best.",[471,474,475,479,480,484],{"tag":142,"children":472},[473],"Prefer retrieval to stuffing."," The trade-off between long context and search is covered in ",{"tag":202,"to":476,"children":477},"\u002Fblog\u002Frag-2026-hybrid-agentic-long-context",[478],"RAG in 2026","; for coding agents, ",{"tag":202,"to":481,"children":482},"\u002Fblog\u002Ftoken-saving-tools-coding-agents-top-20",[483],"token-saving tools"," ranks the options by evidence.",{"type":149,"level":150,"id":129,"text":130},{"type":139,"content":487},[488],"Context rot is a property of your workload, so measure it there. Three cheap signals:",{"type":314,"ordered":490,"items":491},true,[492,497,502],[493,496],{"tag":142,"children":494},[495],"Log input tokens per turn"," in your traces and chart task success against the context size at which each task ended. If success falls in the upper buckets, your trigger is too high.",[498,501],{"tag":142,"children":499},[500],"Plant a constraint early and test it late."," An eval task that states a rule in turn one (\"never touch the payments module\") and needs it after a compaction tells you whether your summary keeps what matters.",[503,506],{"tag":142,"children":504},[505],"Compare a fresh session."," Re-run failed late-stage steps in a new session seeded only with the notes and progress file. If the fresh session succeeds, the problem was the context, not the model.",{"type":139,"content":508},[509,510,514],"Those checks fit directly into the trajectory evals and traces you already have; ",{"tag":202,"to":511,"children":512},"\u002Fblog\u002Fagent-observability-opentelemetry",[513],"agent observability with OpenTelemetry"," shows how to capture token counts per span.",{"type":149,"level":150,"id":132,"text":133},{"type":314,"ordered":490,"items":517},[518,520,522,524,526,528,530,532],[519],"Treat the context window as a budget for accuracy, not a storage limit.",[521],"Paginate and truncate tool output; return handles and summaries.",[523],"Clear old tool results first, with exclusions for results that are expensive to recreate.",[525],"Compact with domain-specific instructions, keep recent turns verbatim, and append the full response so the compaction block survives.",[527],"Keep plans, progress and decisions on disk or in a memory store the agent reads at the start of every session.",[529],"Use sub-agents for read-only exploration that returns short summaries; keep writes in one agent with full context.",[531],"Put the current goal and constraints at the end of the context.",[533],"Measure success against context size and test that early constraints survive compaction.",{"type":139,"content":535},[536,537,428],"If your agents degrade on long tasks and you want a second opinion on the harness, see ",{"tag":202,"to":538,"children":539},"\u002Fexpertise\u002Fai-engineer",[540],"AI engineering",{"type":149,"level":150,"id":135,"text":136},{"type":314,"ordered":490,"items":543},[544,548,551,554,557,560,563,566,569,572,575],[545],{"tag":546,"href":39,"children":547},"a",[38],[549],{"tag":546,"href":42,"children":550},[41],[552],{"tag":546,"href":45,"children":553},[44],[555],{"tag":546,"href":48,"children":556},[47],[558],{"tag":546,"href":51,"children":559},[50],[561],{"tag":546,"href":54,"children":562},[53],[564],{"tag":546,"href":57,"children":565},[56],[567],{"tag":546,"href":60,"children":568},[59],[570],{"tag":546,"href":63,"children":571},[62],[573],{"tag":546,"href":66,"children":574},[65],[576],{"tag":546,"href":69,"children":577},[68],[579,630,689,773],{"slug":580,"published":5,"minutes":581,"category":7,"tags":582,"keywords":588,"about":599,"sources":608,"cover":624,"og":625,"expertise":72,"locales":626,"lang":74,"title":627,"description":628,"coverAlt":629},"browser-agents-e2e-testing-playwright",7,[583,584,585,586,587],"Playwright","E2E testing","Coding agents","MCP","Test automation",[589,590,591,592,593,594,595,596,597,598],"playwright test agents","playwright planner generator healer","ai e2e testing","playwright mcp","llm generated playwright tests","self-healing tests","browser agent testing","playwright init-agents","ai test automation 2026","playwright cli skills",[600,602,605],{"name":583,"url":601},"https:\u002F\u002Fplaywright.dev\u002F",{"name":603,"url":604},"End-to-end testing","https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FSystem_testing",{"name":606,"url":607},"Model Context Protocol","https:\u002F\u002Fmodelcontextprotocol.io\u002F",[609,612,615,618,621],{"title":610,"url":611},"Playwright docs: Test agents (planner, generator, healer)","https:\u002F\u002Fplaywright.dev\u002Fdocs\u002Ftest-agents",{"title":613,"url":614},"Microsoft: Playwright MCP README (MCP vs CLI, accessibility snapshots)","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fplaywright-mcp",{"title":616,"url":617},"Playwright docs: Best practices","https:\u002F\u002Fplaywright.dev\u002Fdocs\u002Fbest-practices",{"title":619,"url":620},"Playwright docs: Locators","https:\u002F\u002Fplaywright.dev\u002Fdocs\u002Flocators",{"title":622,"url":623},"Browserbase: Stagehand README (act, extract, observe)","https:\u002F\u002Fgithub.com\u002Fbrowserbase\u002Fstagehand","\u002Fimages\u002Fblog\u002Fbrowser-agents-e2e-testing-playwright\u002Fcover.webp","\u002Fimages\u002Fblog\u002Fbrowser-agents-e2e-testing-playwright\u002Fog.jpg",[74,75,76],"Browser agents for E2E testing: let agents write Playwright tests, not run them","Where AI agents help with end-to-end tests: Playwright planner, generator and healer, MCP or CLI, and the guardrails that keep healed tests honest.","An agent explores a web app, writes a Markdown test plan, turns it into Playwright tests, and a healer repairs locators while assertions stay under review.",{"slug":631,"published":5,"minutes":632,"category":7,"tags":633,"keywords":638,"about":650,"sources":658,"cover":683,"og":684,"expertise":72,"locales":685,"lang":74,"title":686,"description":687,"coverAlt":688},"a2a-protocol-agent-interoperability",12,[634,635,586,636,637],"A2A","AI agents","Interoperability","Agent security",[639,640,641,642,643,644,645,646,647,648,649],"a2a protocol","agent2agent protocol","a2a vs mcp","a2a agent card","agent-card.json well-known","a2a protocol 1.0","a2a task lifecycle","agent to agent communication protocol","a2a security","a2a json-rpc grpc","agent session smuggling",[651,654,655],{"name":652,"url":653},"Agent2Agent protocol","https:\u002F\u002Fa2a-protocol.org\u002F",{"name":606,"url":607},{"name":656,"url":657},"Linux Foundation","https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FLinux_Foundation",[659,662,665,668,671,674,677,680],{"title":660,"url":661},"A2A Protocol Specification (latest, v1.0)","https:\u002F\u002Fa2a-protocol.org\u002Flatest\u002Fspecification\u002F",{"title":663,"url":664},"A2A: a2a.proto, the normative data model (GitHub)","https:\u002F\u002Fgithub.com\u002Fa2aproject\u002FA2A\u002Fblob\u002Fmain\u002Fspecification\u002Fa2a.proto",{"title":666,"url":667},"A2A docs: A2A and MCP","https:\u002F\u002Fa2a-protocol.org\u002Flatest\u002Ftopics\u002Fa2a-and-mcp\u002F",{"title":669,"url":670},"A2A docs: Agent discovery","https:\u002F\u002Fa2a-protocol.org\u002Flatest\u002Ftopics\u002Fagent-discovery\u002F",{"title":672,"url":673},"Google Developers Blog: Announcing the Agent2Agent Protocol (Apr 2025)","https:\u002F\u002Fdevelopers.googleblog.com\u002Fen\u002Fa2a-a-new-era-of-agent-interoperability\u002F",{"title":675,"url":676},"Linux Foundation: Launch of the Agent2Agent Protocol Project (Jun 2025)","https:\u002F\u002Fwww.linuxfoundation.org\u002Fpress\u002Flinux-foundation-launches-the-agent2agent-protocol-project-to-enable-secure-intelligent-communication-between-ai-agents",{"title":678,"url":679},"Linux Foundation: A2A surpasses 150 organizations in its first year (Apr 2026)","https:\u002F\u002Fwww.linuxfoundation.org\u002Fpress\u002Fa2a-protocol-surpasses-150-organizations-lands-in-major-cloud-platforms-and-sees-enterprise-production-use-in-first-year",{"title":681,"url":682},"Unit 42: Agent Session Smuggling in Agent2Agent Systems (Oct 2025)","https:\u002F\u002Funit42.paloaltonetworks.com\u002Fagent-session-smuggling-in-agent2agent-systems\u002F","\u002Fimages\u002Fblog\u002Fa2a-protocol-agent-interoperability\u002Fcover.webp","\u002Fimages\u002Fblog\u002Fa2a-protocol-agent-interoperability\u002Fog.jpg",[74,75,76],"The A2A protocol explained: agent cards, tasks, and where it fits next to MCP","What the Agent2Agent protocol standardizes in v1.0: agent cards, tasks, bindings, security, how it differs from MCP, and when it is worth using.","Two AI agents from different organizations exchange tasks over A2A, each connected to its own tools through MCP, with an agent card published at a well-known URL.",{"slug":690,"published":691,"minutes":692,"category":7,"tags":693,"keywords":699,"about":708,"sources":718,"cover":767,"og":768,"expertise":72,"locales":769,"lang":74,"title":770,"description":771,"coverAlt":772},"ai-assisted-development-economics","2026-10-01",11,[694,695,696,697,698],"AI coding agents","Developer productivity","Engineering economics","Team cost","GDPR",[700,701,702,703,704,705,706,707],"AI coding agents cost","developer productivity AI study","METR AI developer slowdown","AI coding break-even cost model","one senior engineer vs team","AI coding agent vs agency","DORA AI adoption report","GDPR processor contract AI coding tools",[709,712,715],{"name":710,"url":711},"General Data Protection Regulation","https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FGeneral_Data_Protection_Regulation",{"name":713,"url":714},"Randomized controlled trial","https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FRandomized_controlled_trial",{"name":716,"url":717},"Bus factor","https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FBus_factor",[719,722,725,728,731,734,737,740,743,746,749,752,755,758,761,764],{"title":720,"url":721},"METR: early-2025 AI and experienced open-source developers","https:\u002F\u002Fmetr.org\u002Fblog\u002F2025-07-10-early-2025-ai-experienced-os-dev-study\u002F",{"title":723,"url":724},"Becker et al.: arXiv 2507.09089","https:\u002F\u002Farxiv.org\u002Fabs\u002F2507.09089",{"title":726,"url":727},"METR: developer productivity experiment design, February 2026","https:\u002F\u002Fmetr.org\u002Fblog\u002F2026-02-24-uplift-update\u002F",{"title":729,"url":730},"Peng et al.: GitHub Copilot controlled experiment, arXiv 2302.06590","https:\u002F\u002Farxiv.org\u002Fhtml\u002F2302.06590v1",{"title":732,"url":733},"Cui et al.: three field experiments with software developers","https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002F?p=1148213",{"title":735,"url":736},"DORA: State of AI-assisted Software Development 2025","https:\u002F\u002Fresearch.google\u002Fpubs\u002Fdora-2025-state-of-ai-assisted-software-development-report\u002F",{"title":738,"url":739},"Google Cloud: highlights from the 2024 DORA report","https:\u002F\u002Fcloud.google.com\u002Fblog\u002Fproducts\u002Fdevops-sre\u002Fannouncing-the-2024-dora-report",{"title":741,"url":742},"Stack Overflow: Developer Survey 2025, AI","https:\u002F\u002Fsurvey.stackoverflow.co\u002F2025\u002Fai",{"title":744,"url":745},"Ziftci et al.: Migrating Code At Scale With LLMs At Google","https:\u002F\u002Farxiv.org\u002Fabs\u002F2504.09691",{"title":747,"url":748},"Alshahwan et al.: Automated Unit Test Improvement using Large Language Models at Meta","https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.09171",{"title":750,"url":751},"GitClear: AI Copilot Code Quality: 2025 Look Back at 12 Months of Data","https:\u002F\u002Fwww.gitclear.com\u002Fai_assistant_code_quality_2025_research",{"title":753,"url":754},"GDPR, Regulation (EU) 2016\u002F679, Article 28","https:\u002F\u002Feur-lex.europa.eu\u002Feli\u002Freg\u002F2016\u002F679\u002Foj\u002Feng",{"title":756,"url":757},"Anthropic: Commercial Terms of Service","https:\u002F\u002Fwww.anthropic.com\u002Flegal\u002Fcommercial-terms",{"title":759,"url":760},"Claude: pricing","https:\u002F\u002Fclaude.com\u002Fpricing",{"title":762,"url":763},"Claude Platform: data residency","https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fdata-residency",{"title":765,"url":766},"GitHub Copilot: plans and pricing","https:\u002F\u002Fgithub.com\u002Ffeatures\u002Fcopilot\u002Fplans","\u002Fimages\u002Fblog\u002Fai-assisted-development-economics\u002Fcover.webp","\u002Fimages\u002Fblog\u002Fai-assisted-development-economics\u002Fog.jpg",[74,75,76],"One senior with coding agents versus a team: what the evidence says","The METR, DORA, Microsoft and GitHub studies on AI coding tools, what they do not prove, and a break-even cost model for one senior versus a team or agency.","Cover art for AI coding economics: a draft-to-ship pipeline where agents speed up drafting, and review and quality costs take part of the gain back.",{"slug":774,"published":775,"minutes":692,"category":7,"tags":776,"keywords":780,"about":789,"sources":801,"cover":842,"og":843,"expertise":72,"locales":844,"lang":74,"title":845,"description":846,"coverAlt":847},"spec-driven-development-coding-agents","2026-09-30",[777,585,778,779,540],"Spec-driven development","Acceptance criteria","Plan mode",[781,782,783,784,785,786,787,788],"spec-driven development","spec driven development coding agents","acceptance criteria for coding agents","AI coding agent plan mode","GitHub Spec Kit","Kiro specs requirements design tasks","vibe coding vs spec-driven development","EARS requirements syntax",[790,793,795,798],{"name":791,"url":792},"Vibe coding","https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FVibe_coding",{"name":785,"url":794},"https:\u002F\u002Fgithub.com\u002Fgithub\u002Fspec-kit",{"name":796,"url":797},"EARS (Easy Approach to Requirements Syntax)","https:\u002F\u002Falistairmavin.com\u002Fears\u002F",{"name":799,"url":800},"Kiro","https:\u002F\u002Fkiro.dev",[802,805,807,810,813,816,818,821,824,827,829,831,834,836,839],{"title":803,"url":804},"Birgitta Böckeler: Understanding Spec-Driven-Development: Kiro, spec-kit, and Tessl (martinfowler.com, 15 October 2025)","https:\u002F\u002Fmartinfowler.com\u002Farticles\u002Fexploring-gen-ai\u002Fsdd-3-tools.html",{"title":806,"url":794},"GitHub Spec Kit: README",{"title":808,"url":809},"GitHub Spec Kit: spec-driven.md methodology","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fspec-kit\u002Fblob\u002Fmain\u002Fspec-driven.md",{"title":811,"url":812},"Kiro documentation: specs","https:\u002F\u002Fkiro.dev\u002Fdocs\u002Fspecs\u002F",{"title":814,"url":815},"Kiro: Introducing Kiro","https:\u002F\u002Fkiro.dev\u002Fblog\u002Fintroducing-kiro\u002F",{"title":817,"url":797},"Alistair Mavin: EARS, the Easy Approach to Requirements Syntax",{"title":819,"url":820},"Anthropic: Best practices for Claude Code","https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fbest-practices",{"title":822,"url":823},"Cline documentation: Plan and Act","https:\u002F\u002Fdocs.cline.bot\u002Ffeatures\u002Fplan-and-act",{"title":825,"url":826},"OpenAI: Codex slash command reference","https:\u002F\u002Flearn.chatgpt.com\u002Fdocs\u002Freference\u002Fslash-commands",{"title":828,"url":721},"METR: early-2025 AI and experienced open-source developer productivity (July 2025)",{"title":830,"url":727},"METR: We are changing our developer productivity experiment design (February 2026)",{"title":832,"url":833},"Thoughtworks Technology Radar: Spec-driven development","https:\u002F\u002Fwww.thoughtworks.com\u002Fradar\u002Ftechniques\u002Fspec-driven-development",{"title":835,"url":792},"Wikipedia: Vibe coding",{"title":837,"url":838},"Anthropic: Claude API pricing","https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fabout-claude\u002Fpricing",{"title":840,"url":841},"Anthropic: Prompt caching","https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fprompt-caching","\u002Fimages\u002Fblog\u002Fspec-driven-development-coding-agents\u002Fcover.webp","\u002Fimages\u002Fblog\u002Fspec-driven-development-coding-agents\u002Fog.jpg",[74,75,76],"Spec-driven development for coding agents: agree the plan before the code","Vibe coding breaks on real codebases. Write a spec with acceptance criteria, a plan and tasks, let the agent tick them off, and review before the first line of code.","Cover art for spec-driven development: a pipeline from spec and plan to tasks and verification, with a review gate before any code is written.",1792177152132]