LLM Context Is Append-Only Now: A New Constraint for Agent Development
This article explains why modern LLM APIs treat conversation history as append-only, why modifying the prefix invalidates cached reasoning and raises token cost, latency, and quality risk, and how to redesign context management by translating edits into appended records. It covers five common practices that break the prefix, an append-based alternative with examples, the placement of fixed instructions, and practical guidance for building stable, cost-efficient agents.
1. The Core Change: Conversation Prefixes Are Now Append-Only
Over the past two years, teams building agents on top of large language models have settled into a set of habits that assume the context can be rewritten at any time: rewriting the system prompt on the fly, trimming old tool logs, compressing early turns into summaries, switching output structures by stage, and dynamically adjusting the tool list based on permissions. These techniques work well in long-context scenarios, but they all rest on an implicit assumption — that the conversation history is a draft you can edit whenever you want.
The new API behavior removes that assumption. As illustrated by the migration notes for a new generation of LLM APIs on a given platform, once multi-turn history has been submitted, you can only append to it; you cannot go back and modify it. Any change to the prefix is treated as a prefix invalidation, and all reasoning intermediates produced after the change point are discarded. The model has to derive them again.
It is worth stressing that this is not merely a cache hit-rate issue. The relevant documentation states explicitly that discarding reasoning intermediates is part of a safety measure. That means even if you are willing to pay for the repeated computation, you cannot bypass it with a switch such as “disable caching.” For developers, this is a hard constraint, not a tunable parameter.
2. Why Rewriting the Prefix Is So Costly
Reasoning intermediates are the “chain of thought” that a model accumulates step by step across multiple turns. Their value lies in reuse: the second and third requests can continue directly from the previous derivation, avoiding repeated computation. Once the prefix changes, that trajectory no longer matches the new prefix and must be thrown away entirely.
This creates three kinds of cascading cost:
- Higher token cost: discarded reasoning has to be redone, which is equivalent to paying repeatedly for the same logic on every turn.
- Longer latency: recomputation happens on the request path, unpredictably stretching end-to-end response time — something interactive products are especially sensitive to.
- Lower output quality: the documentation states clearly that output quality degrades when reasoning cannot be recovered. This is the most underestimated point: rewriting the prefix does not just make things slower and more expensive, it can also make results unstable.
3. Five Common Context-Management Practices That All Cross the Line
Checking common practices one by one, almost all of them fall under the definition of “prefix modification”:
- Dynamically assembling the system prompt: rewriting the opening system instructions each turn based on retrieval results — change the beginning, and everything after it is invalidated.
- Trimming tool returns retroactively: shortening tool results in the history when logs get too long counts as modifying already-submitted history.
- Replacing original text with history summaries: compressing early multi-turn conversation into a summary and substituting it is a typical case of overwriting the old prefix with new content.
- Switching models mid-session: changing models means changing the reasoning agent, so prior reasoning intermediates cannot carry over.
- Changing the end user or organization ownership: a change in the subject boundary likewise triggers prefix invalidation.
A code-review agent under active maintenance often hits four of these at once. Developers usually believe their context trimming is carefully designed, when in fact every trim wipes out derivation the model has already completed.
4. The Fix: Translate “Modification” into “Append”
The new paradigm can be summarized in one sentence: append to the end of the context in chronological order, and write configuration changes as new records at the end too.
| Previous practice | Append-based alternative |
|---|---|
| Modify reasoning-effort parameters | Append a configuration-change record at the end; keep request-level parameters unchanged |
| Switch the structured output format | Append it as a configuration-change record instead of rewriting the existing format |
| Adjust the available tool list | Append available tools, or use an allowlist to scope what can be called in the current turn |
| Rewrite the fixed instructions at the beginning | Append a new developer message at the end to override the semantics |
| Trim old tool output | Complete the trimming before the first submission to the model, and never change it afterward |
An illustrative append-style layout:
[0] developer: Fixed specification (never changed after submission)[1] user: Task description[2] tool: Raw return (already trimmed before first submission)[3] developer: Config change — reasoning effort raised to a higher level from this turn on[4] developer: Config change — only retrieval tools allowed from this turn on[5] user: Follow-up question
The key point: semantic “overrides” are achieved through trailing appends, while the physical history stays immutable.
5. An Easily Overlooked Detail: Where Fixed Instructions Live
Another easy-to-miss change is that the top-level instruction field has been moved after the input. If you want fixed instructions to benefit from prefix reuse, you need to move them into the first developer message in the input; otherwise that content is billed as uncached input. For long system prompts and long-term business rules that rarely change, this single adjustment directly affects the cost structure.
6. Implementation Recommendations
- Treat context as an immutable log: allow appends only, and prohibit any form of in-place rewriting.
- Trim upfront: perform all truncation, redaction, and summarization before the first submission, then treat the result as read-only.
- Model configuration changes as events: represent adjustments to parameters, formats, and tool scope as numbered configuration events appended to the tail.
- Keep the subject stable: avoid switching models or changing user/organization ownership mid-session.
- Close the observability gap: record prefix invalidation counts, recomputed tokens, and latency changes as a basis for capacity and cost evaluation.
Under the append-only constraint, the focus of context management shifts from “how to gracefully rewrite history” to “how to design an append-only timeline that never looks back.” The earlier you complete this layer of abstraction, the more controllable your agent’s cost and stability become.
