Synthetic local computation. No model or remote service is contacted.
Experiment workspace
Decision trace
The mechanism
A conversation is structured data with dependencies. Tool results refer to earlier calls, and keeping a result without its call can break that structure or cause framework repair to change the model-visible evidence. This lab compares a newest-message suffix, a suffix of complete turns and a conservative repair that removes incomplete turns from the naive selection. It never invents a result or executes a tool. Pair validation is intentionally separate from selection so the displayed budget can fit while the retained history is invalid.
Synthetic fixture and controls
The single-call fixture has three completed turns costing 40, 50 and 60 declared units. Each contains a user request, a call, a result and an assistant observation. The parallel fixture adds another call and result to the newest turn, costing 25 additional units. These are hand-assigned costs, not tokenizer measurements. The budget includes fixed instruction cost and a reserve for the next request. Both are subtracted before history selection. If they exceed the budget, the experiment reports an input error instead of discarding required material.
Expected outcomes
At budget 100, instruction cost 10 and reserve 20, the naive policy retains 70 history units but leaves the second turn result without its call. Its pair check fails. Whole-turn selection retains only turn three, costing 60 history units and 90 overall. Conservative repair drops the incomplete second turn and reaches the same 90-unit total. At budget 80, whole-turn selection keeps no completed turns because the newest 60-unit turn cannot fit the 50 available units. The policy stops instead of skipping over the newest turn to find older material.
Read the trace and retained records
Each trace step explains a retained message, a retained turn, a budget stop or a removed incomplete turn. The retained-message list shows turn, kind, cost and synthetic text. Pair errors identify orphan results, missing returns or duplicate call identifiers within a turn. Passing these checks establishes only the narrow structural invariant; it does not establish that the retained conversation contains every important user constraint. A result can be structurally valid and semantically insufficient. The article discusses preserving application state outside the rolling transcript.
Try a controlled comparison
Start with the default and predict which message becomes the first retained record. Switch to whole turns, then repair, and compare unused capacity. Increase the budget until another complete turn fits. Select the parallel fixture and observe the larger indivisible newest turn. Adjust the system and next-request reserves separately rather than treating all cost as history. The JSON export includes the entire synthetic fixture, selected records, errors, inputs and trace, making the comparison reproducible without a model account.
Limits and provider differences
The validator understands a simple local record schema and turn-scoped identifiers. It is not a provider serializer and does not implement reasoning blocks, multimodal payloads, signed content, actual tokenization or every provider ordering requirement. Current Pydantic AI can repair broken pairs before submission; its repair differs from this lab and can change visible evidence. No generated summary is evaluated here. Before adopting a policy, test actual serialized requests, cancellation and delayed results with the framework version in use. Keep unfinished operation state durable and never infer that dropping a message cancelled its tool.
Views are my own and do not represent any employer, past or present.