cd /news/large-language-models/history-is-append-only-now-what-thin… · home › topics › large-language-models › article
[ARTICLE · art-174438] src=pub.towardsai.net ↗ pub= topic=large-language-models verified=true sentiment=· neutral

History Is Append-Only Now: What Thinking-Block Binding Means for Memory, Steering and Compaction

Anthropic's Fable 5.1 API now binds each thinking block to the system prompt, tool set, every earlier message, the model and the account, rejecting any request that replays a block after those change; enforcement applies by default to accounts created on or after 31 August 2026 (00:00 UTC), and the documentation states later models, including Fable 5.2 per secondhand reports, will enforce it for all users. The default behavior returns an error reading "Invalid `signature` in `thinking` block. The block is bound to a different conversation," while setting thinking.block_binding.prefix_mismatch_behavior to "drop_block" under the thinking-binding-controls-2026-08-01 beta header drops the failing block and every thinking block after it, succeeds without billing the dropped blocks, and returns an input_transformations array with a thinking_dropped entry and a reason such as prefix_binding_mismatch or model_binding_mismatch. Anthropic's "Preserved thinking" page directs developers to only append to the conversation and to use mid-conversation system messages, turn-scoped system messages, mid-conversation tool changes and per-message effort instead of editing the transcript, since parameters such as effort, max_tokens, output_config, tool_choice and metadata, plus cache_control markers, fall outside the prefix check.

key takeaway

On Fable 5.1 and later, treat the transcript as append-only: changing the system prompt, tools or any earlier message invalidates later thinking blocks, so set thinking.block_binding.prefix_mismatch_behavior to "drop_block" with the thinking-binding-controls-2026-08-01 beta header to drop unbilled b

by read27 min views9 publishedNov 23, 2026

Most API changes I write about add something. This one takes something away, and it does so quietly enough that I almost missed what it meant for my own designs.

Since Fable 5.1, a thinking block is no longer a free-floating piece of reasoning you can carry around in your history. It is bound to everything that came before it: the system prompt, the tool set, and every earlier message. Change any of those and replay the block, and the API refuses. For a while that only bit new accounts, which is why a lot of us never saw it. The docs say later models will enforce it for everyone, and the reports on Fable 5.2 say that moment has arrived.

My last three pieces in this area (on memory writes versus the prompt cache, on tail rent and compaction, and on steering a running agent) were mostly about money and control. Rebuild the prefix and you pay a cache write. Compact too often and you lose specifics. Let anyone steer and you lose provenance. Binding changes the category of the problem. Several of the designs I recommended in those articles are no longer just expensive on Fable. They are rejected.

So this is the follow-up. What the mechanism actually is, what it breaks, and the design rule I’m adopting because of it: treat the transcript as an append-only log, and move everything mutable into tools or into the next session.

I want to separate what I could verify from what I read secondhand, because a lot of the commentary this week blurs them. The only source I’m treating as authoritative for the mechanism is Anthropic’s “Preserved thinking” page.

What a block is bound to. On models with preserved thinking, a block is tied to what came before it (system, tools, and every earlier message), to the model, and to the account. The page's instruction on the first one is four words long: only append to the conversation. Thinking and redacted thinking blocks are not themselves part of the checked prefix, and with server-side compaction the checked prefix starts at the most recent compaction block.

What happens on a mismatch. By default the API rejects the request. The error reads like this, from the docs:

messages.1.content.0: Invalid `signature` in `thinking` block. The block is bound to adifferent conversation. Remove the block, or set`thinking.block_binding.prefix_mismatch_behavior` to "drop_block".

You can instead set thinking.block_binding.prefix_mismatch_behavior to "drop_block". That requires the thinking-binding-controls-2026-08-01 beta header; without it, the error message tells you so. With drop_block, the API removes the failing block and every thinking block after it in the conversation, the request succeeds, and the dropped blocks aren't billed. The response carries a top-level input_transformations array with a thinking_dropped entry, a path and a reason such as prefix_binding_mismatch or model_binding_mismatch. The default is "error".

Who is affected. On Fable 5.1 the check is enforced by default for accounts created on or after 31 August 2026 (00:00 UTC). A request that sets prefix_mismatch_behavior opts into enforcement regardless of account age, which is how you test from an older account. The docs also say later models will enforce the check for all users.

What is not an edit. This part matters as much as the rest. Request parameters outside system, tools and messages are not part of the prefix check: effort, max_tokens, output_config, tool_choice, metadata. Neither are cache_control markers. Removing thinking blocks from the start of the history is listed as valid too.

What Anthropic wants you to do instead. The page lists first-class alternatives for most transcript edits: mid-conversation system messages for new instructions, turn-scoped system messages for per-turn reminders, mid-conversation tool changes for adding and removing tools, and per-message effort.

Two more lines from the page shaped my thinking more than the error itself. One: don’t remove thinking from your stored history, because removing it is the only way reasoning is lost permanently. Two: if you have to remove secrets, personal data or injected text from history, also remove every thinking block after the first place that content appeared, and accept that Claude works without that reasoning. Redaction is still possible. It just has a price now, and the price is explicit.

Mikhail Petrusheuski’s article is the piece that framed this for .NET developers, and I want to report it accurately as his claim.

He says Fable 5.2 enforces binding for every account, not just new ones. I could not open Anthropic’s 5.2 migration page myself. Several other write-ups this week say the same thing, and one open-source chat client’s pull request reports checking it live on an older key (Fable 5.2 returned a 400 where 5.1 did not). That is consistent with the docs’ line about later models, so I’m treating it as very likely. But my evidence for it is secondhand, so read it with that label.

His lists, as he gives them:

Most of that matches the docs I could read. The one I can’t fully confirm is tool order. The docs describe the checked prefix as “the set of tools in tools", and "set" is consistent with order not mattering, but I didn't find a row that says it outright.

He also names .NET types from SDK 13.7.0. I haven’t verified those names, so I’m not reproducing them here. The code below talks to the HTTP API directly for the Anthropic path, which means it doesn’t depend on any SDK’s type names being stable.

Two different mechanisms care about your prefix: thinking-block binding and the prompt cache. They overlap a lot, but not perfectly.

+-----------------------------+------------------------+------------------------+---------------------------------------+| Change made mid-session     | Breaks thinking on     | Breaks prompt cache    | What to do instead                    ||                             | Fable                  |                        |                                       |+-----------------------------+------------------------+------------------------+---------------------------------------+| Edit the system prompt      | Yes (400 by default)   | Yes: system and all    | Freeze it at session start; append a  ||                             |                        | messages after it      | role: "system" message                |+-----------------------------+------------------------+------------------------+---------------------------------------+| Add a tool by rewriting     | Yes                    | Yes: tools sit first,  | Declare the full set up front; use    || the tools array             |                        | so everything misses   | tool_addition / tool_removal (beta)   |+-----------------------------+------------------------+------------------------+---------------------------------------+| Reorder tools               | No, per Petrusheuski   | Yes: different bytes   | Sort once by name, never reorder      ||                             | (docs say "the set")   | at the front           |                                       |+-----------------------------+------------------------+------------------------+---------------------------------------+| Edit or delete an old       | Yes                    | Yes: from that message | Append a correction. If you must      || message                     |                        | onward                 | redact, drop thinking after it        |+-----------------------------+------------------------+------------------------+---------------------------------------+| Append a system message     | No                     | No                     | This is the steering path             |+-----------------------------+------------------------+------------------------+---------------------------------------+| Change effort               | No (outside the        | Not sure               | Per-message effort, or pick it once   ||                             | checked prefix)        |                        | per session                           |+-----------------------------+------------------------+------------------------+---------------------------------------+

The “not sure” is honest. I know effort is outside the binding check because the docs say so. I don’t know whether flipping the top-level effort between requests costs a cache hit, and I’d rather leave the cell uncertain than guess. Per-message effort exists, I assume, partly so you never have to find out.

Let me be precise here, because “memory in the system prompt breaks thinking” is only half true. Rendering memory into the system prompt at session start is fine. That is a new conversation, and nothing is bound to it yet. What breaks is refreshing it mid-session: a new fact arrives, you rebuild the system prompt, and every thinking block in the session is now bound to a prompt that no longer exists.

This is where I have to correct myself. In my memory-writes-versus-prompt-cache piece I proposed two things that are now rejected on Fable. A policy that rebuilt the system prompt when the cache had gone cold (I called it a “free rebuild”), and an uncached tail block rendered into the final user turn and never stored in history. The first edits system mid-session. The second is worse than I realised: if the tail is in the user message you sent and is gone from the user message you store, then on the next turn that earlier message has changed. On a cache-only model it was a cost trade. On Fable it's a 400.

The more interesting question is whether you even want memory pushed into the prompt. Miodrag Cekikj’s Foundry Memory experiment is the best small piece of evidence I’ve seen this week, and he’s careful to call it small. His setup was an operations agent, with Microsoft Foundry Memory delivering a stored fact at the top of the conversation before the agent read the alert queue. In every delivered run the fact was extracted, stored, retrieved and injected. Of four clean runs, the agent used it correctly once and restarted the gateway the other three times. His fix kept Foundry Memory, switched off delivery, and gave the agent one read-only tool that searches the store with the agent’s own question. By his account that got 3 of 3 right, at a higher token cost.

One correct in four against three in three is not a statistic. He says as much. It also isn’t about thinking-block binding at all; it’s a different platform and a different failure. What it gives me is a reason to believe the design that binding forces on me (memory through a tool, not through the prompt) might not be a downgrade. The agent asking for memory with its own question, at the moment it needs it, could be the better retrieval anyway. I’d want many more runs before I believed it strongly.

Steering is the easy one, because Anthropic already built the right shape. Instead of editing the top-level system field, you append a {"role": "system"} message where the new instruction becomes relevant. The docs say later system messages win over earlier ones, and mid-conversation system messages take precedence over the top-level system field for the turns that follow.

The constraints I found worth encoding: it can’t be messages[0], it has to follow a user message (or an assistant message ending in a server tool result), and the content is text only. It's model-gated, and an unsupported model returns a 400. For reminders that should only apply to one turn, there's clear_at: "next_user_message" behind the mid-conversation-system-clear-at-2026-08-21 beta header.

Compared to my steering-wheel article, this is a small change in code and a big one in meaning. There I injected steers as user messages labelled [steer from bob]. That was already append-only, so it survives binding. But a system-role message carries operator priority, which a user message with a label never had. The provenance problem from that piece doesn't go away. Whoever can append a system message is now steering with more authority, so who is allowed to call the steering helper matters even more.

Client-side compaction usually means: take a span in the middle of the transcript, summarise it, and put the summary where the span was. Every thinking block after that span is now bound to a history that doesn’t exist. The docs’ sanctioned path is server-side compaction, where the checked prefix restarts at the compaction block. Removing old thinking blocks from the start is also allowed. Rewriting the middle isn’t.

What surprised me is that even without binding, in-place compression isn’t the clear cost win I assumed. Ishank Choudhary put a 41-request agent session through billion-context, a local proxy that folds older history. By his numbers the final prompt was 2.9 times smaller, yet total input across the session was only about 12.5 percent lower, and on that short session the compressed run cost more once caching was counted. His recall check is telling too: the folded agent matched the full-history one, but it got there by paying for retrieval (six upstream rounds and about 90K input tokens against one 39K call).

His run was on a Gemini model, so binding isn’t involved. That actually makes it more useful to me: it isolates the economics. A fold changes the prefix, a changed prefix doesn’t hit the cache, and you pay to rebuild it. On Fable you pay that and lose the reasoning too. Billion-context’s own documentation says it folds in small ranges to keep most of the cache intact, which is the right instinct. But on a model that binds thinking to the prefix, any proxy that rewrites earlier messages is making an edit by definition, however small the range. That’s my inference from the docs, not something I’ve seen tested.

This also changes the ladder from my tail-rent piece. Destructive compaction was already the last rung. Now there are two versions of it: server-side compaction, which the API understands, and client-side surgery, which it rejects.

If the transcript is append-only and the system prompt is frozen, then the only clean moment to change what the agent “knows” by default is when a session starts. Anthropic’s dreaming cookbook is built entirely around that moment. A Managed Agents dynamic workflow reads finished sessions, distils them into a wiki-style memory store with an _index.md, and future sessions mount that store read-only. It can run every night from cron.

I used to read “visible next session” as a latency cost. Now I read it as the design. Writes happen offline, against finished transcripts, where nothing is bound to anything. Sessions read. A session that needs something it wasn’t started with asks for it through a tool. The two halves never touch the same prefix.

Here is the rule I’m adopting for every agent loop I own:

The code below is how I would wire that in .NET 8. It’s a single console project with two backends: Anthropic over raw HTTP, and Ollama through Microsoft.Extensions.AI.

dotnet new console -n AppendOnly --framework net8.0cd AppendOnlydotnet add package Microsoft.Extensions.AIdotnet add package Microsoft.Data.Sqlitedotnet add package OllamaSharp

The guard takes a snapshot of what a thinking block would be bound to: a hash of the system prompt, a hash of the tool definitions sorted by name, and one hash per message. Before each request it compares against the last committed snapshot. Any earlier message that changed, any shrink, any change to system or tools is an exception that names what moved.

Two decisions I went back and forth on. I hash full tool definitions, not just names, because the docs count editing an entry in tools as a change, and a reworded description would slip past a names-only check. And I strip cache_control before hashing, because the docs exclude it from the comparison and I don't want moving a breakpoint to trip the guard. Tool order is a warning, not an exception, because of the table above: probably fine for binding, definitely a cache miss.

// AppendOnlyHistoryGuard.csusing System.Security.Cryptography;using System.Text;using System.Text.Json;using System.Text.Json.Nodes;using Microsoft.Extensions.AI;namespace AppendOnly;public sealed class HistoryRewrittenException(string message) : InvalidOperationException(message);/// What a thinking block is bound to: system, the tool set, and every message before it.public sealed record PrefixSnapshot(    string SystemHash,    string ToolsHash,    string ToolOrderHash,    IReadOnlyList<string> MessageHashes);public sealed class AppendOnlyHistoryGuard{    PrefixSnapshot? _committed;    /// Raised for changes that keep thinking valid but cost a cache miss.    public event Action<string>? Warning;    /// Call before sending. Throws if anything already sent has changed.    public void Check(PrefixSnapshot next)    {        var prev = _committed;        if (prev is null) return;        if (prev.SystemHash != next.SystemHash)            throw new HistoryRewrittenException(                "system changed since the last request. Append a role: \"system\" message instead.");        if (prev.ToolsHash != next.ToolsHash)            throw new HistoryRewrittenException(                "tools changed. Declare the full set up front and use tool_addition / tool_removal.");        if (prev.ToolOrderHash != next.ToolOrderHash)            Warning?.Invoke("tool order changed: same set, but the cached prefix will miss.");        if (next.MessageHashes.Count < prev.MessageHashes.Count)            throw new HistoryRewrittenException(                $"history shrank from {prev.MessageHashes.Count} to {next.MessageHashes.Count} messages.");        for (var i = 0; i < prev.MessageHashes.Count; i++)            if (prev.MessageHashes[i] != next.MessageHashes[i])                throw new HistoryRewrittenException($"messages[{i}] changed after it was sent.");    }    /// Call after a successful response, with the assistant turn included exactly as returned.    public void Commit(PrefixSnapshot sent) => _committed = sent;    /// Server-side compaction restarts the checked prefix at the compaction block.    /// When you adopt it, start a new baseline from the compacted request.    public void Rebase() => _committed = null;}public static class Snapshots{    /// Snapshot of an Anthropic Messages request body. Pass the assistant content    /// returned by the API to include it in the committed prefix.    public static PrefixSnapshot FromAnthropic(JsonObject request, JsonArray? assistantContent = null)    {        var tools = (request["tools"] as JsonArray ?? new JsonArray()).Select(t => t!).ToList();        var byName = tools.OrderBy(t => t["name"]?.GetValue<string>(), StringComparer.Ordinal);        var messages = (request["messages"] as JsonArray ?? new JsonArray())            .Select(m => Hash(Canonical(m)))            .ToList();        if (assistantContent is not null)            messages.Add(Hash(Canonical(new JsonObject            {                ["role"] = "assistant",                ["content"] = assistantContent.DeepClone(),            })));        return new PrefixSnapshot(            SystemHash: Hash(Canonical(request["system"])),            ToolsHash: Hash(string.Join("\n", byName.Select(Canonical))),            ToolOrderHash: Hash(string.Join("\n", tools.Select(t => t["name"]?.GetValue<string>()))),            MessageHashes: messages);    }    /// Snapshot of a Microsoft.Extensions.AI history. Leading system messages count as    /// the system prompt; anything after the first non-system message is history.    public static PrefixSnapshot FromChat(IReadOnlyList<ChatMessage> history, IEnumerable<AITool>? tools)    {        var toolList = (tools ?? []).ToList();        var leading = history.TakeWhile(m => m.Role == ChatRole.System).ToList();        var rest = history.Skip(leading.Count);        string Describe(AITool t) =>            t.Name + ":" + (t is AIFunction f ? f.JsonSchema.GetRawText() : t.Description);        return new PrefixSnapshot(            SystemHash: Hash(string.Join("\n", leading.Select(m => m.Text))),            ToolsHash: Hash(string.Join("\n", toolList.OrderBy(t => t.Name, StringComparer.Ordinal).Select(Describe))),            ToolOrderHash: Hash(string.Join("\n", toolList.Select(t => t.Name))),            MessageHashes: rest.Select(m => Hash(JsonSerializer.Serialize(m, AIJsonUtilities.DefaultOptions))).ToList());    }    static string Hash(string s) =>        Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(s))).ToLowerInvariant();    /// Sorted keys, cache_control removed (the API leaves it out of the comparison).    static string Canonical(JsonNode? node) => Normalize(node)?.ToJsonString() ?? "null";    static JsonNode? Normalize(JsonNode? node) => node switch    {        JsonObject o => new JsonObject(o            .Where(p => p.Key != "cache_control")            .OrderBy(p => p.Key, StringComparer.Ordinal)            .Select(p => KeyValuePair.Create(p.Key, Normalize(p.Value)))),        JsonArray a => new JsonArray(a.Select(Normalize).ToArray()),        JsonValue v => JsonNode.Parse(v.ToJsonString()),        _ => null,    };}

The guard is stricter than the API in one place. The docs allow removing thinking blocks from the start of the history, and my guard treats that as an edit. I’m fine with that. If I ever want to trim leading thinking, I’d rather call Rebase() on purpose than have the guard quietly allow a class of edits.

It’s also stricter about shape. "content": "hi" and "content": [{"type": "text", "text": "hi"}] hash differently. Whether the API treats them as the same prefix I don't know, and I'd rather store one shape consistently than find out.

The notes live in SQLite with FTS5 (Microsoft.Data.Sqlite’s bundled SQLite includes it). The class has two halves on purpose. Upsert is only for the between-session job. Recall opens the database read-only, so even a confused agent can't write memory mid-run through this path.

// NotesStore.csusing System.ComponentModel;using System.Text;using System.Text.RegularExpressions;using Microsoft.Data.Sqlite;using Microsoft.Extensions.AI;namespace AppendOnly;public sealed class NotesStore(string dbPath){    /// Writer side. Called by the offline consolidation job, never by a running session.    public static void Upsert(string dbPath, string key, string body)    {        var cs = new SqliteConnectionStringBuilder { DataSource = dbPath, Mode = SqliteOpenMode.ReadWriteCreate };        using var conn = new SqliteConnection(cs.ToString());        conn.Open();        using var tx = conn.BeginTransaction();        var create = conn.CreateCommand();        create.CommandText = "CREATE VIRTUAL TABLE IF NOT EXISTS notes USING fts5(key, body);";        create.ExecuteNonQuery();        var delete = conn.CreateCommand();        delete.CommandText = "DELETE FROM notes WHERE key = $k;";        delete.Parameters.AddWithValue("$k", key);        delete.ExecuteNonQuery();        var insert = conn.CreateCommand();        insert.CommandText = "INSERT INTO notes (key, body) VALUES ($k, $b);";        insert.Parameters.AddWithValue("$k", key);        insert.Parameters.AddWithValue("$b", body);        insert.ExecuteNonQuery();        tx.Commit();    }    /// Reader side. Read-only connection: a session can look, not write.    public string Recall(string query, int limit = 5)    {        if (!File.Exists(dbPath)) return "No notes yet.";        var fts = ToFtsQuery(query);        if (fts.Length == 0) return "Query had no searchable words.";        var cs = new SqliteConnectionStringBuilder { DataSource = dbPath, Mode = SqliteOpenMode.ReadOnly };        using var conn = new SqliteConnection(cs.ToString());        conn.Open();        var cmd = conn.CreateCommand();        cmd.CommandText = """            SELECT key, snippet(notes, 1, '[', ']', '...', 32)            FROM notes WHERE notes MATCH $q ORDER BY rank LIMIT $n;            """;        cmd.Parameters.AddWithValue("$q", fts);        cmd.Parameters.AddWithValue("$n", limit);        var sb = new StringBuilder();        using var r = cmd.ExecuteReader();        while (r.Read()) sb.Append("- ").Append(r.GetString(0)).Append(": ").Append(r.GetString(1)).Append('\n');        return sb.Length == 0 ? "No matching notes." : sb.ToString();    }    /// Words of 3+ letters, quoted, OR-ed. Quoting keeps FTS5 syntax out of model input.    static string ToFtsQuery(string query) => string.Join(" OR ",        Regex.Split(query, @"[^\p{L}\p{Nd}]+")             .Where(w => w.Length > 2)             .Distinct(StringComparer.OrdinalIgnoreCase)             .Select(w => $"\"{w}\""));    public AIFunction AsTool() => AIFunctionFactory.Create(        ([Description("What you want to know, in your own words.")] string query) => Recall(query),        name: "recall_notes",        description: "Search notes consolidated from earlier sessions. Read-only. " +                     "Call it before assuming you don't know a project fact or a past decision.");}

The tool is declared once, at session start, in both backends. The Anthropic path builds its JSON schema from the same AIFunction, so the two definitions can't drift apart.

If you prefer files to a database, the dreaming cookbook’s shape works just as well: markdown notes with an _index.md, mounted read-only. The property that matters isn't the storage. It's that the session reads and something else writes.

// Steering.csusing System.Text.Json.Nodes;using Microsoft.Extensions.AI;namespace AppendOnly;public static class Steering{    /// Anthropic: append a mid-conversation system message instead of editing "system".    /// Rules from the docs: never messages[0], must follow a user turn (a user message or    /// tool_result; or an assistant turn ending in a server tool result), text only.    /// thisTurnOnly needs the anthropic-beta header mid-conversation-system-clear-at-2026-08-21.    public static void AppendSystem(JsonArray messages, string instruction, bool thisTurnOnly = false)    {        if (messages.Count == 0)            throw new InvalidOperationException("The first instruction belongs in the top-level system field.");        var lastRole = messages[messages.Count - 1]?["role"]?.GetValue<string>();        if (lastRole != "user")            throw new InvalidOperationException(                "Queue the steer and apply it after the next user turn or tool_result.");        var msg = new JsonObject { ["role"] = "system", ["content"] = instruction };        if (thisTurnOnly) msg["clear_at"] = "next_user_message";        messages.Add(msg);    }    /// Microsoft.Extensions.AI: same rule on a ChatMessage list.    /// Check what your IChatClient adapter does with a system message in the middle:    /// an adapter that folds every system message into one top-level system field    /// turns this append back into the edit you were avoiding.    public static void AppendSystem(IList<ChatMessage> history, string instruction)    {        if (history.Count == 0 || history[^1].Role != ChatRole.User)            throw new InvalidOperationException(                "Queue the steer and apply it after the next user turn.");        history.Add(new ChatMessage(ChatRole.System, instruction));    }}

The queue is deliberate. A steer can arrive while the model is mid-turn, and there’s no legal place to put it until the next user turn or tool result. Rather than hunting for a spot, the loop drains the queue at exactly the moments the placement rules allow.

That comment about adapters is the doubt I’d check first in a Microsoft.Extensions.AI stack. I haven’t confirmed what the current Anthropic adapter does with a ChatRole.System message in the middle of the list. If it hoists system messages into the top-level field, my "append" becomes a system prompt edit on the wire. That's one reason the Anthropic path below talks JSON directly.

drop_block is a diagnostic tool and a migration bridge. I wouldn't ship it as the steady state, because it silently costs you reasoning. But it's the cheapest way to find out which of your requests are edits. Run a normal session with it on and look at input_transformations. Empty on every turn means your history is intact.

Turn one, saved to a file:

curl -sS https://api.anthropic.com/v1/messages \  -H "x-api-key: $ANTHROPIC_API_KEY" \  -H "anthropic-version: 2023-06-01" \  -H "anthropic-beta: thinking-binding-controls-2026-08-01" \  -H "content-type: application/json" \  -d '{    "model": "claude-fable-5-2",    "max_tokens": 16000,    "thinking": { "type": "adaptive", "block_binding": { "prefix_mismatch_behavior": "drop_block" } },    "system": "You are a coding agent.",    "messages": [ { "role": "user", "content": "Fix the failing test." } ]  }' > turn1.json

Turn two replays the assistant content exactly as returned. JSON has no comments, so here it is in words: block_binding is only accepted with the thinking-binding-controls-2026-08-01 beta header on the request; without the header, the field itself is a 400.

jq -n --slurpfile r turn1.json '{  model: "claude-fable-5-2",  max_tokens: 16000,  thinking: { type: "adaptive", block_binding: { prefix_mismatch_behavior: "drop_block" } },  system: "You are a coding agent.",  messages: [    { role: "user", content: "Fix the failing test." },    { role: "assistant", content: $r[0].content },    { role: "user", content: "Now run it again." }  ]}' > turn2.request.jsoncurl -sS https://api.anthropic.com/v1/messages \  -H "x-api-key: $ANTHROPIC_API_KEY" \  -H "anthropic-version: 2023-06-01" \  -H "anthropic-beta: thinking-binding-controls-2026-08-01" \  -H "content-type: application/json" \  -d @turn2.request.json | jq '.input_transformations'

To see the failure mode, change system in the jq template and run turn two again. According to the docs, the response then lists the dropped block like this:

{  "input_transformations": [    {      "type": "thinking_dropped",      "path": "messages.1.content.0",      "reason": "prefix_binding_mismatch"    }  ]}

That path is the useful part. It tells you which block lost its binding, and from there you diff system, tools and messages up to that turn to find the edit.

One console app, four modes. anthropic runs the guarded loop against the API. anthropic-diagnose is the same loop with drop_block on, logging input_transformations. ollama is the local version. note is the writer the between-session job calls.

// Program.csusing System.Collections.Concurrent;using System.Net.Http.Json;using System.Text.Json.Nodes;using AppendOnly;using Microsoft.Extensions.AI;using OllamaSharp;// Usage://   dotnet run -- note <key> <text>        offline writer (consolidation job only)//   dotnet run -- anthropic                guarded loop, needs ANTHROPIC_API_KEY//   dotnet run -- anthropic-diagnose       same loop with drop_block, logs input_transformations//   dotnet run -- ollama                   local loop (OLLAMA_URL, OLLAMA_MODEL)// In a chat: "/steer <text>" queues a system message for the next legal spot.const string SystemPrompt = """    You are a coding agent working in one repository.    Notes from earlier sessions are available through the recall_notes tool.    Later system messages override earlier instructions.    """;var dbPath = Environment.GetEnvironmentVariable("NOTES_DB") ?? "notes.db";var mode = args.FirstOrDefault() ?? "anthropic";if (mode == "note"){    if (args.Length < 3) { Console.Error.WriteLine("usage: note <key> <text>"); return 2; }    NotesStore.Upsert(dbPath, args[1], string.Join(' ', args.Skip(2)));    Console.WriteLine($"stored {args[1]}");    return 0;}var notes = new NotesStore(dbPath);var recall = notes.AsTool();var steers = new ConcurrentQueue<string>();var guard = new AppendOnlyHistoryGuard();guard.Warning += w => Console.Error.WriteLine($"[cache] {w}");return mode switch{    "anthropic" => await RunAnthropic(diagnose: false),    "anthropic-diagnose" => await RunAnthropic(diagnose: true),    "ollama" => await RunOllama(),    _ => 2,};string? ReadUserLine(){    while (true)    {        Console.Write("> ");        var line = Console.ReadLine();        if (line is null || line == "/quit") return null;        if (line.StartsWith("/steer ")) { steers.Enqueue(line[7..]); Console.WriteLine("(steer queued)"); continue; }        return line;    }}async Task<int> RunAnthropic(bool diagnose){    var key = Environment.GetEnvironmentVariable("ANTHROPIC_API_KEY")              ?? throw new InvalidOperationException("ANTHROPIC_API_KEY is not set");    var model = Environment.GetEnvironmentVariable("ANTHROPIC_MODEL") ?? "claude-fable-5-2";    // Frozen for the whole session: system and tools never change after this line.    var tools = new JsonArray(new JsonObject    {        ["name"] = recall.Name,        ["description"] = recall.Description,        ["input_schema"] = JsonNode.Parse(recall.JsonSchema.GetRawText()),    });    var messages = new JsonArray();    using var http = new HttpClient { Timeout = TimeSpan.FromMinutes(10) };    while (ReadUserLine() is { } line)    {        messages.Add(new JsonObject { ["role"] = "user", ["content"] = line });        for (var step = 0; step < 8; step++)        {            // The last message is a user turn or a tool_result here, so steers are legal.            while (steers.TryDequeue(out var s)) Steering.AppendSystem(messages, s);            var request = new JsonObject            {                ["model"] = model,                ["max_tokens"] = 16000,                ["system"] = SystemPrompt,                ["tools"] = tools.DeepClone(),                ["messages"] = messages.DeepClone(),            };            if (diagnose)                request["thinking"] = new JsonObject                {                    ["type"] = "adaptive",                    ["block_binding"] = new JsonObject { ["prefix_mismatch_behavior"] = "drop_block" },                };            guard.Check(Snapshots.FromAnthropic(request)); // throws locally instead of a 400 remotely            using var msg = new HttpRequestMessage(HttpMethod.Post, "https://api.anthropic.com/v1/messages")            {                Content = JsonContent.Create(request),            };            msg.Headers.Add("x-api-key", key);            msg.Headers.Add("anthropic-version", "2023-06-01");            if (diagnose) msg.Headers.Add("anthropic-beta", "thinking-binding-controls-2026-08-01");            using var resp = await http.SendAsync(msg);            var body = JsonNode.Parse(await resp.Content.ReadAsStringAsync())!;            if (!resp.IsSuccessStatusCode)            {                // A binding 400 is permanent for that request. Retrying the same body won't help.                Console.Error.WriteLine("API error: " + body.ToJsonString());                break;            }            if (body["input_transformations"] is JsonArray t && t.Count > 0)                Console.Error.WriteLine("[binding] " + t.ToJsonString());            var content = body["content"]!.AsArray();            guard.Commit(Snapshots.FromAnthropic(request, content));            messages.Add(new JsonObject { ["role"] = "assistant", ["content"] = content.DeepClone() }); // as returned            if (body["stop_reason"]?.GetValue<string>() != "tool_use")            {                Console.WriteLine(string.Concat(content                    .Where(b => b!["type"]!.GetValue<string>() == "text")                    .Select(b => b!["text"]!.GetValue<string>())));                break;            }            var results = new JsonArray();            foreach (var call in content.Where(b => b!["type"]!.GetValue<string>() == "tool_use"))            {                var query = call!["input"]?["query"]?.GetValue<string>() ?? "";                results.Add(new JsonObject                {                    ["type"] = "tool_result",                    ["tool_use_id"] = call["id"]!.GetValue<string>(),                    ["content"] = notes.Recall(query),                });            }            messages.Add(new JsonObject { ["role"] = "user", ["content"] = results });        }    }    return 0;}async Task<int> RunOllama(){    var url = Environment.GetEnvironmentVariable("OLLAMA_URL") ?? "http://localhost:11434";    var model = Environment.GetEnvironmentVariable("OLLAMA_MODEL") ?? "qwen3:8b";    IChatClient client = new ChatClientBuilder(new OllamaApiClient(new Uri(url), model))        .UseFunctionInvocation()        .Build();    var options = new ChatOptions { Tools = [recall] };    var history = new List<ChatMessage> { new(ChatRole.System, SystemPrompt) };    while (ReadUserLine() is { } line)    {        history.Add(new ChatMessage(ChatRole.User, line));        while (steers.TryDequeue(out var s)) Steering.AppendSystem(history, s);        guard.Check(Snapshots.FromChat(history, options.Tools));        var response = await client.GetResponseAsync(history, options);        history.AddRange(response.Messages); // tool calls and results included, as returned        guard.Commit(Snapshots.FromChat(history, options.Tools));        Console.WriteLine(response.Text);    }    return 0;}

A few choices worth explaining:

docker run -d --name ollama -p 11434:11434 -v ollama:/root/.ollama ollama/ollamadocker exec ollama ollama pull qwen3:8bdotnet run -- note release-process "Release branches are cut on Tuesdays; hotfixes go to main first, then cherry-pick."dotnet run -- note test-command "Run tests with: dotnet test -c Release --filter Category!=Integration"export OLLAMA_URL=http://localhost:11434export OLLAMA_MODEL=qwen3:8bdotnet run -- ollama

I want to be clear about what transfers and what doesn’t. Thinking-block binding is an Anthropic API behaviour. Ollama doesn’t sign anything, and nothing local will return a 400 because you edited an old message. On a local model, the guard isn’t protecting reasoning.

What it protects there is prefix reuse. llama.cpp’s server can reuse the KV cache for the part of a new prompt that matches the previous one (its cache_prompt option), and Ollama runs on llama.cpp. Reuse only works for an unchanged prefix, so the same discipline (frozen system, sorted tools, history that only grows) is what gives a local runtime the chance to skip reprocessing. I haven't verified how Ollama exposes or tunes that reuse, so I treat it as a reason to keep the habit, not a saving I can quote. On your own GPU a miss costs time to first token, not money.

The real benefit of running the same guard locally is simpler: one loop design for both backends. If the local agent never trips the guard, the hosted one won’t either.

The 5.2 enforcement scope. Petrusheuski says every account, several other write-ups agree, and one project reports a live check. I couldn’t open Anthropic’s own 5.2 migration page. If you run older accounts, the cheapest way to settle it for yourself is the drop_block test above, which opts in to enforcement regardless of account age.

The SDK names. Petrusheuski’s .NET types for SDK 13.7.0 are unverified by me, which is why the Anthropic path here is raw HTTP. If you use an SDK, check two things in its source: that it sends assistant content back unchanged, and where it puts a system message that sits in the middle of the list.

Tool order. Safe for binding according to Petrusheuski and consistent with the docs’ “set” wording, but I didn’t find it stated outright. The guard warns rather than throws, and the cache miss is real either way.

Effort and the cache. Outside the binding check, per the docs. Whether changing it costs a cache hit, I don’t know.

Whether tool-read memory is actually better. Cekikj’s one-of-four versus three-of-three is suggestive, tiny, from a different platform, and he says so. Binding forces me toward tool-read memory regardless. I’d like the evidence to catch up with the decision before I call it a win.

The price of drop_block. It stops the 400s, but it drops the failing block and every later one. Those dropped blocks aren't billed, but the model then has to think again without them, and the cache restarts. That makes it a good diagnostic and a reasonable bridge. As a permanent setting it would hide exactly the bugs this whole article is about.

Thinking about it now, the rule is the same one databases settled on long ago. You don’t update the log, you append to it, and anything that has to change gets materialised somewhere else. The API now enforces that for agent transcripts. My job is to stop fighting it.

Update (23 November 2026): Since I published this, Anthropic’s docs have caught up with the claim I was most careful about. The Fable 5.2 migration guide now says the prefix check is enforced for every account, whatever its age, so the 5.2 question in “What I’m still unsure about” is settled. Three details are worth adding:

  • For Fable 5.2 thinking blocks, changing the tool list between requests is an edit. For Fable 5.1 or Opus 5.5 blocks it isn’t, so a harness can pass on 5.1 and fail on 5.2 without a single line changing.

  • Both migration guides call drop_block a stopgap. The 5.2 prompting guide says that when thinking was dropped on every turn, the model thought again and used more output tokens. Use it to find the edit, not to live with it.

  • The same guide warns that cautious notes like “never retry” can pile up in memory and keep being followed after they stop being true. That gives the between-session consolidation job a second duty: pruning, not just adding.

Sources: Fable 5.2 migration guide, Prefix checks, Prompting Claude Fable 5.2

Tags: ai-agents, llm, anthropic, claude, dotnet, csharp, agent-memory, prompt-caching, context-engineering, ollama, software-architecture

History Is Append-Only Now: What Thinking-Block Binding Means for Memory, Steering and Compaction was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

── more in #large-language-models 4 stories · sorted by recency
── more on @anthropic 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/history-is-append-on…] indexed:0 read:27min 2026-11-23 · —