In short.
This Anthropic guide explains Claude's saved-thinking checks for API developers, with the catch that some requests can succeed while passing invalidated reasoning to the model. It describes how to preserve conversation history, distinguish model-dependent failure behavior and use explicit rejection or recovery controls. It is particularly useful for applications that rewrite instructions, tools or older messages. The examples were not executed; exact costs, SDK version requirements and redistribution rights remain unknown.
Researched and written by an AI model and checked by a second AI model. How it works
Covers the complete selected documentation page at [https://platform.claude.com/docs/en/build-with-claude/preserved-thinking/prefix-checks.md], including support metadata, append-only guidance, model-dependent outcomes, the Message Batches exception, beta controls, monitoring and request examples. Linked pages and the diagram beyond its supplied descriptive text are excluded. No code was executed, no live API behavior was verified and no performance or cost measurements were made.
The overview
Identity
Prefix checks on thinking blocks is a Claude documentation guide about reasoning blocks returned by supported models and sent back in later API requests. It explains how the API determines whether the conversation content preceding each block still matches the content that produced it.
The original source address is [https://platform.claude.com/docs/en/build-with-claude/preserved-thinking/prefix-checks.md]. The page declares its public documentation address as [https://platform.claude.com/docs/en/build-with-claude/preserved-thinking/prefix-checks].
Assessment
The guide is useful for diagnosing why previously accepted conversation history produces a 400 error, or why an accepted request can still contain reasoning based on changed content. Its practical strength is connecting specific application behaviors, such as rebuilding a system prompt or removing an intermediate thinking block, to documented failure modes.
It provides concrete prevention and monitoring guidance. It does not establish measured improvements in answer quality, reliability or performance, and its request examples have not been run.
Who it helps
The main audience is developers who store and resend Claude conversation history, especially in tool-using applications, libraries, proxies and gateways. Beginners need familiarity with system instructions, tool definitions and message history; experienced developers get precise details about signatures, request parameters and response transformations.
The page says no change is needed when Claude Code, claude.ai or Claude Managed Agents manages the history. It gives the same guidance for Claude Agent SDK history management when the supplied system prompt stays unchanged, and for append-only integrations whose requests are not rewritten in transit.
What it covers
The page explains the content checked before each thinking block, changes that invalidate it, deterministic error controls, recovery by dropping invalid blocks and monitoring through input_transformations. It includes request examples for cURL, the ant CLI, Python, TypeScript, C#, Go, Java, PHP and Ruby.
With prefix_mismatch_behavior unset, its model table specifies a 400 error for Claude Fable 5.2, Claude Mythos 5.2 and Claude Mythos 5.1. Claude Fable 5.1, Claude Opus 5.5, Claude Sonnet 5.5 and Claude Haiku 5.5 may return either a 400 error or an accepted request containing the failing blocks.
Message Batches has a separate documented default: items with the setting unset receive no mismatch error, and the API may drop the failing blocks.
Using it
Requirements
The check concerns thinking blocks produced by a model with preserved thinking and resent to a model supporting that feature. The page says other Claude API models, including Claude Opus 5, do not run this check and their blocks are not covered.
The explicit controls and response transformation array require the thinking-binding-controls-2026-08-01 beta header. The setting is thinking.block_binding.prefix_mismatch_behavior. Sending this setting when thinking is disabled or set to between_tools produces a 400 error on every model, according to the page. Minimum SDK versions are not specified.
The support metadata marks the feature stable across the Claude API, Amazon Bedrock variants, Claude Platform on AWS, Claude Models on Google Cloud variants and Microsoft Foundry. The body qualifies the detailed behavior as applying to the Claude API and some cloud platforms; it does not establish a complete platform-specific control matrix.
How it works
Each thinking block's signature records a fingerprint of its prefix: system instructions, tools and preceding message content, including text before the block in its own message. The API compares the current prefix with that record. It does not compare against the last request or rely on session IDs or user identities; identical content can pass in a new request or conversation fork.
Changing earlier content invalidates thinking that follows the change. Thinking before it and newly generated thinking remain valid. Thinking blocks themselves are not compared as prefix content, but retained blocks must preserve their original sequence: the oldest, newest or all blocks may be omitted, while removing a block between retained blocks breaks the required continuity.
The comparison uses parsed JSON, so formatting and key order do not matter. Parameters such as max_tokens and metadata, along with cache_control markers, do not count as prefix content. Token-threshold compaction and context editing change what Claude reads rather than the submitted content; after a threshold compaction block, comparison uses messages from that block onward plus system and tools.
Integration guidance
The recommended foundation is an append-only conversation. Return each assistant turn exactly as received, including thinking blocks with empty text. Construct system and tools once per conversation, retain those copies and place updates in new messages at the end.
For predictable rejection, send the beta header and set thinking.block_binding.prefix_mismatch_behavior to error on every request. For observing default behavior, send the header, leave the setting unset and inspect input_transformations. A thinking_mismatch_allowed entry identifies a failing block that reached the model, including its message path and prefix_binding_mismatch reason.
The setting applies only to the request carrying it. Blocks remain invalid on later requests while the conflicting change remains in place. The page recommends drop_block on later requests in an affected conversation after a 400 error, while warning against applying it indiscriminately to hide errors.
Concrete examples
An application that inserts today's date into its system prompt changes the prefix at midnight. Previously generated thinking can then become invalid. The page's alternative is to preserve the original system prompt and state the new date in an appended message.
The code examples request Claude Opus 5.5 with adaptive thinking, max_tokens of 16000 and prefix_mismatch_behavior set to drop_block. They ask for the greatest common divisor of 1071 and 462 and inspect input_transformations. Because these are first-turn requests with no saved thinking, the page says the transformation array is empty; this example does not demonstrate recovery from an actual mismatch. No example was executed.
Assessment & evidence
Limitations
A successful response does not establish that every thinking block passed the check. For models with variable default behavior, one request's result promises nothing about later requests. The page therefore recommends append-only construction, explicit error behavior or handling both possible outcomes.
Keeping application code append-only is insufficient if a library, proxy or gateway rewrites requests. The page also says URL-based file inputs and, on the Claude API, MCP tool lists are compared using fetched content, so an unchanged reference does not necessarily establish unchanged content.
Detailed procedures for changing tools, handling externally editable text, on-demand compaction and diagnosing the bound-to-a-different-conversation error are delegated to linked pages. Those procedures, live cloud behavior and SDK compatibility were not assessed.
Engineering tradeoffs
The central tradeoff is whether to preserve the context that produced saved reasoning, reject incompatible history or discard affected reasoning to continue. Preserving the prefix keeps earlier thinking usable. Explicit rejection makes a mismatch visible. Dropping blocks supports recovery while giving up those blocks.
The documented mechanism supports preferring prevention during normal operation and targeted recovery after failures. That is an engineering judgment based on the described behavior; the page provides no measured accuracy benefit or reliability comparison. Passing a prefix check establishes compatibility with preceding content, not correctness of the reasoning or final answer.
Other approaches
For developers seeking less custom history management, the page identifies Claude Code, claude.ai and Claude Managed Agents as history managers that require no change for this issue. It also identifies the Claude Agent SDK when its supplied system prompt remains unchanged. Their broader capabilities, costs and suitability are not compared.
Within a custom integration, append-only construction, explicit error handling and drop_block recovery serve different purposes. Calling models without preserved thinking avoids this particular check, but the page provides no comparison of the resulting model capabilities or costs.
Evidence
The source is the complete documentation page at [https://platform.claude.com/docs/en/build-with-claude/preserved-thinking/prefix-checks.md]. It supplies explanatory prose, support metadata, model behavior tables, request examples and a sample transformation entry.
These materials establish what the documentation describes. They do not establish observed API behavior or measured performance. No commands, SDK examples or API requests were executed, and linked pages were not assessed.
Access & freshness
Costs
No API token prices, subscription charges or expected implementation costs are provided. The cost of running the examples is unknown.
When invalid blocks are allowed through, the page says they are billed as input. With drop_block, the discarded blocks are not billed, but the page warns that dropping thinking can increase overall cost. The amount and detailed cost explanation are not established within this page.
Rights and permissions
The supplied page does not state a licence for its prose or code examples. Permission to redistribute or bundle those materials is unknown. API usage terms and rights concerning generated outputs are also not established by this page.
Freshness
The supplied page was captured on 15 November 2026 at 08:25:42 UTC. Its metadata labels the feature stable, while its explicit binding controls use the dated beta header thinking-binding-controls-2026-08-01. The cURL example specifies anthropic-version 2026-10-21.
These dates identify the documented interface and capture, rather than establishing a publication or last-update date. No such page date is supplied. Later model support, SDK changes and platform behavior are unknown.
Practical next steps
For an existing integration, inspect whether system instructions, tool definitions or earlier messages change between turns. Check that empty-text thinking blocks survive storage and replay, that retained blocks remain consecutive and that intermediaries preserve the outgoing request.
Choose append-only construction where possible. If using default mismatch behavior, handle 400 errors and inspect input_transformations for accepted mismatches. If deterministic rejection is needed, apply error on each request. For an affected conversation, consider the documented drop_block recovery approach with its cost warning.
Before implementation, confirm the required controls on the intended platform and SDK version. The page links to detailed recovery guidance at [https://platform.claude.com/docs/en/build-with-claude/preserved-thinking/fix-bound-to-a-different-conversation]; that linked procedure is not covered here.
