Skip to content

feat(history-mutation): plan, preview and apply a change to an agent's history - #505

Open
nissa-seru wants to merge 77 commits into
anima-research:mainfrom
nissa-seru:paloma/history-mutation
Open

nissa-seru wants to merge 77 commits into
anima-research:mainfrom
nissa-seru:paloma/history-mutation

Conversation

@nissa-seru

@nissa-seru nissa-seru commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Why. Today a host can change an agent's history: it edits a summary, redacts a message, or removes a tool turn. It writes the store's state directly, without the manager. So it has to apply the manager's rules itself. With this PR, such a change goes through the manager, which checks it. The manager refuses a change that would break the history. It moves the store to the change only after it has read the change back.

The manager can now plan, preview and apply a change to an agent's history. Other agents that read the same rows are brought up to date too.

A checked way to change a history

  • base (main): there is no such API. A host writes the store's state directly.
  • head: planHistoryMutation(manifest) takes ops of three kinds: edit a summary's text, edit a message, and remove messages. A message edit needs a label that names who changed it. The plan writes nothing. It returns what the change would do, and each rule that the change would break. compileMutationPreview compiles the changed history on a scratch branch. applyHistoryMutation builds the change on a new branch and reads that branch back through a new manager with a cold strategy, on a view of the branch. Only then does it switch the store to the branch. If the apply fails before the switch, or its process is killed, the store stays on its source branch, unless something else moved it.

Other agents on the same rows

  • base (main): residents share one message slot, and each has its own window and summaries. The manager tells a strategy when a row leaves its window. It is never told that a row changed. So when a host edits a row, another resident's summary of it keeps the old text.
  • head: the plan, the preview and the apply take a list of readers. These are the other managers that read the rows. Each reader gets the same rules as the manager. Before the switch, the apply updates every reader on the new branch and reads each one back. The plan also refuses where the store holds another namespace whose summaries fold a changed row, or whose presented window holds one, and the caller didn't list it.

The recall envelope names who wrote a summary's text

  • base (main): some summaries hold text from outside the strategy (external). The recall envelope doesn't say who wrote that text.
  • head: under recallEnvelope: 'xml', the envelope carries writtenBy, escaped as an attribute value. Summaries stored before this change with an external whose by isn't empty gain the attribute too. So the first request that renders such a summary after the upgrade sends different bytes.

Before you rely on it, note these limits:

  • A preview writes a scratch branch and then deletes it, so it needs a store open for writing. Its records stay in the store's log.
  • An apply needs a history that nothing else writes while it runs. The host stops the agents' turns for it, and initializes its other managers again afterwards.
  • A mutation changes what agents read, not what the store holds. The source branch and the log keep the earlier text, so a redaction isn't an erasure.
  • The plan refuses a strategy whose summaries it can't see: one without historyMemory(). A strategy that keeps no summaries gives empty lists there. A reader that keeps summaries, or hears rows leave its window, also needs a usable cloneForScratch.
  • Another handle can change a strategy's stored summaries. The plan then refuses until that manager is initialized again.
  • This PR has no host side. It wasn't run against a real agent's store or a provider.

Merges after #506 and #507. As the review here suggested, the editSummaryText fixes and the selectBranch fix are pull requests of their own. This branch merges in their current heads, e3c2c025 and e113750f, so that it holds the code that will merge, and it merges them in again when they move. Once they land, main merges in here, and this diff holds the history mutation alone.

Credits

Paloma-2644 built the change. Clement-4419 designed it and made its design calls. Martin-4134 read the first design, and Andrew-4443, Ethan-4037 and Clara-3577 read the change and ran it, and Carmen-3611 read the agent-framework side that uses it. Paloma-2644 wrote this description.

Details for agents

Head 26ad6fc7, after 84a36783, which merges main at 87cbd1b355dee26b470e360841c9c0adf24c8d23 (0.29.0, which admits chronicle 0.8).

Problem

At 4399a068, the manager has no way to change a history that checks the result. A host that edits a summary, edits a message or removes messages writes the store itself. The store checks tool pairs on each write, but nothing checks a batch as a whole before it writes, or reads the result back. A failure partway can leave the store half-changed. Another agent on the same slot isn't brought along: its window and summaries change only through a manager that runs its own strategy, and ContextStrategy has hooks for a row that enters or leaves a window (onPresented, onRetracted), and none for a row that changes.

editSummaryText (#500, released in 0.29.0) shows two of the rules that such a host must redo. A compile renders a carrier's carried summary in its place (summaryAnswerProse), so an edit of the carrier never shows. A summary's responseContent renders in place of its content, so an edit that kept it would show the old text, and the edit deletes it silently. 548b8e33 adds tests for this to the base's source, and 5 of the 12 tests in external-memory.test.ts fail there.

Changes

The first five commits:

  • 548b8e33 (tests) and 37f38159: editSummaryText moves its rules into a pure planSummaryEdit (src/summary-edit.ts). It refuses a carrier and names the summary carried. It drops response blocks only with dropResponseContent (CLI: --drop-response-content), and refuses a text other than expectedPriorSha256. Its token stamp stays the new text's length over three. It rewrites each carrier as the edited summary's copy, and clears the memo of recall-answer prices. SummaryTextEdit lists carriers in carriedBy, apart from the merged parents.
  • 04d8ea51: a refactor with no change in behaviour for content without holes. findUnpairedToolBlocks, summariesFoldingRows, withSummariesAbove and toolPairSplitReason each hold a rule that the plan must predict, so the plan and the old caller share one function.
  • 6e7a2992 (tests) and ec501962: the history mutation API.
    • src/history-mutation.ts is pure: the plan (planMutation), the anomalies of a history at rest (historyAnomalies), and the readback (snapshotOf, readBackMismatches).
    • The plan reads tool pairs in the manager's merged record (its slot and auxiliary slots) and in its window. It runs the store's own per-write tool-pair check for each message edit, against the rows that the batch's earlier ops leave. It puts a message edit's label first, or after the tool results that the content opens with, unless a text block of the content holds it, and checks the content again. It takes content as the store keeps it (blockAsStored). It drops the raw replay forms (rawItem, rawXml) that the old content held from each block that changes (releaseReplacedRawForms in src/raw-forms.ts), because a formatter replays a raw form in place of the block's fields.
    • Two op fields serve a caller that reviews a plan. expectedAfterSha256 (on both edits) refuses the plan (AFTER_SHA_MISMATCH) unless the text or content as written has that sha256, so a caller that approved a preview of the label's placement or of the raw forms dropped gets that content. expandBodyGroups (on a removal) takes the whole body of a listed shard; without it, a removal of part of a body refuses, since a body renders only whole. Two methods serve the same caller. describeMutationTarget gives the sha256 that an op names, of the text or content as the store keeps it, which a caller can't compute from what a compile shows. checkHistoryInvariants lists the anomalies that a history already has, since the plan and the apply refuse only those that the change would introduce.
    • ContextManager.applyHistoryMutation forks the target branch from the head with every state (JsStore.createBranch). A manager on a view of that branch makes the writes, with a fresh strategy (ContextStrategy.cloneForScratch, or the caller's) that gets the live strategy's rendering frontier as derive does. After beforeSwitch, a second manager opens the branch cold and reads it back. A fence then checks, with no await before the native switch, that the store is still on the source branch at the head that it forked from, and that the target is still the branch built (by id). Then it syncs and switches.
    • Any failure before the switch deletes the branch built, or throws BRANCH_LEFT, which says whether the branch is still there or its deletion isn't saved yet. Where the store moved and the switch then didn't complete, the error is APPLIED_INIT_FAILED, with the receipt, and the branch stays.
    • compileMutationPreview makes the same writes on a scratch branch, compiles with dryRun, and deletes the branch.
    • AutobiographicalStrategy gets historyMemory and dropSummaries, which KnowledgeStrategy inherits. Autobiographical, Knowledge and Passthrough get cloneForScratch. WindowedPassthroughStrategy has none, so its caller gives a strategy.
    • Under recallEnvelope: 'xml', the recall envelope writes editedBy for a summary with external. MessageStore.edit and ContextManager.editMessage take { mergeMetadata }, which sets keys of the message's metadata in the same write as its content. An edit kept the metadata as it was, and the apply stamps metadata.historyMutation on each edited row beside what the row holds, in one write.

cdeec6b1 (tests) and 99dddaf1: readers. The plan takes readers, the other managers on the store. Each reader's held rows are the rows that its view holds or that its summaries fold. Each reader gets the manager's rules: its summaries over an edited row refuse (FOLDED_ROW_REQUIRES_POLICY, with readerNamespace) unless the op's policy decides them. Over a removed row they go by the op's policy, or by the reader's window mode (presented: drop; legacy: refuse). A tool pair split in its record or window refuses. The plan reports each reader's held rows, covering summaries, drops, KV boundary and thinking reach (PlannedReader). The apply opens, for each reader, a manager bound to the target branch with a fresh instance of the reader's strategy. That manager drops the reader's summaries over edited rows, takes removed rows out of a presented window (retractRemoved), or tells a legacy strategy that they left. A fresh open then reads the reader back.

b218e718 (tests) and 4e50c5a6: the readback compares the whole record, every merged slot, and each summary. A change is placed by the record's rows, since a summary can fold another slot's rows. The switch handler keeps the built branch where the store reached it, even if a later selection moved the store back to the source. Preview and apply refuse while a sharded addMessage stores its shards, and refuse a blank by. releaseReplacedRawForms releases a raw form whose blocks moved, and a changed opaque carrier gives up its item. editSummaryText refuses a summary that the stored summaries no longer hold, and its price memo is keyed by external.by.

227662e9 (tests) and 9b86753f:

  • planSha256 covers everything that the plan reports, with each summary that it drops as the strategy holds it. An apply checks the plan's branch and sha256 before the new plan's violations, so a drifted plan reads as PLAN_DRIFT.
  • A reader holds a row that its window holds before its view filter. A message target counts toward a window's KV boundary and thinking reach only where that manager's view holds it.
  • The apply reconciles and reads back every reader that it is given. A reader whose strategy keeps no summaries and has no onRetracted is reconciled through a PassthroughStrategy. A reader whose strategy does, and gives no usable cloneForScratch, is refused before anything is written. The apply waits for the onRetracted calls that a presented reader's removal makes.
  • The readback compares each field of a row and of a summary as the store keeps it (storedJson). It allows only the changes that a planned op or the strategy makes: a pointer cleared by a drop, the strategy's carry of a summary that the branch holds, and an edit's own fields.
  • editSummaryText refuses where the stored summaries aren't as the strategy holds them (storeWrittenElsewhere), and writes the summary and its carriers in one write.
  • releaseReplacedRawForms keeps a shared raw form, or a reasoning pairing, only where its blocks stand as they stood, with nothing between them, and matches blocks by place. A changed block gives up its rawXml only where the XML formatter replays it, so a tool_attempt keeps the XML that is its content.
  • A failed switch deletes the built branch exactly when the native switch didn't happen (selectBranch reports it).

70f53d1c (tests) and 285a6c3a:

  • selectBranch takes a native switch whose checkpoint fails, with the store on the requested branch, as a switch. It invalidates the manager and moves the branch generation, then rejects, saying that the switch took effect and that sync() saves it. The apply reports such a switch as APPLIED_INIT_FAILED with the receipt, where it had tried to delete the branch the store was on. switchBranch() and fork() share selectBranch, so a failed checkpoint no longer leaves their manager initialized for the branch the store left (changelog.d/branch-switch-unsaved.fixed.md).
  • planSha256 takes each dropped summary as the store holds it (historyMemory().stored, read only where another write moved the stored summaries), in its stored form, and covers the plan's validity and violations. A summary edited through another handle, or a plan that has become invalid, then refuses as PLAN_DRIFT.
  • An edited row counts toward a window's KV boundary where the view holds it before the edit or after it, by the manager's view filter (HistoryState.viewKeeps).
  • The readback checks each presented window, the manager's and each reader's: the source window's rows, less the removed ones, each at its ordinal, and no other row.
  • editSummaryText refuses where reading the stored summaries to compare them fails. Its doc no longer says that a failed write leaves them as they were: a write that throws may have landed, and the strategy then holds the new text.

73b0b802 (tests) and 4061f256:

  • The manager that builds the change on the branch waits for the onRetracted calls that its own removals start, as it waited for a reader's, and records each one that fails. A failure refuses the apply before the switch.
  • Each staging manager makes the plan's drops itself, after a presented window's let-go: each summary that the plan drops and its strategy still holds (dropSummaries). A let-go drops only what folds the window's rows, and only where the strategy hears it. A legacy strategy is no longer told that the rows left, which served only those drops.
  • The readback accepts a new carry only where the plan drops summaries or removes rows. It checks removed rows' ordinals in the manager's own window as in each reader's. An edited summary's external must hold who made the edit, its note and a time, and nothing more.
  • planSha256 covers each summary that the plan edits, and its carriers, as the store holds them.
  • A preview refuses while a reader stores shards. Preview and apply copy by when they check it. The receipt's toSequence is read at the switch. An invalid plan's error lists each violation.
  • A changed block that matches no old block keeps a raw form that the old content didn't hold, so an edit can add or replace a Responses item.
  • editSummaryText's failed write says that it landed or may have. RESPONSE_CONTENT_SHADOW counts the response blocks of each entry that carries the summary. Taking up summaries that another handle wrote clears the price memo.

c79ac495 (tests) and e6f83068:

  • The plan checks the manifest at runtime first: each op is an object of a known kind, each field has its type, and each policy is one that its kind allows. Each failure refuses as MALFORMED_OP, which names the op and the field, and a malformed manifest plans nothing. Before, an op of an unknown kind planned as valid with no targets.
  • The plan refuses where a strategy's summaries in memory, the manager's or a reader's, aren't the ones that the store holds (STALE_MEMORY). Before, it walked the inventory in memory, so a parent that another handle had merged since could be dropped on the branch without the plan listing it.
  • A changed block that matches no old block loses a raw form only where the old content held that form, compared by value, so an item that keeps an old id with new contents stays the caller's.
  • A removal waits for the let-gos that it starts in either window mode. A failed let-go refuses the apply whatever it fails with. Where a later run of a removal fails, the preview and the apply wait for the let-gos that earlier runs started before they delete the branch. After a switch, selectBranch invalidates the manager before its caller's bookkeeping, so a failure there leaves the manager uninitialized. The apply keeps the target branch that it was given at its start. A reader whose cloneForScratch returns no strategy is refused when it plans. Rows that an edit brings into the view are placed by window order. An edited message's planned sha256 is of its content as the store keeps it.
  • Docs: a removal from a presented window drops what folds it by default, the KV boundary is an estimate that errs early, editedBy names a by that isn't empty, and the changelog names the exported types.

16d01cd1 (tests) and d934ab29:

  • The plan refuses a strategy with no historyMemory(), the manager's own or a reader's (STRATEGY_UNSUPPORTED). Before, it took such a strategy to keep no summaries. PassthroughStrategy and WindowedPassthroughStrategy themselves keep none, and a reader that shows an empty memory and has no onRetracted is reconciled through a stand-in.
  • STALE_MEMORY compares the summaries as stored, not the lists' identity. Since the plan refuses where they differ, planSha256 reads the strategy's summaries, and no longer the stored ones or the edited summaries.
  • MALFORMED_OP also refuses a field that an op's kind doesn't take, a field that no manifest has, a hole in the ops, a content block that isn't an object, and content that JSON can't write (a cycle, a BigInt), and names what was given. The plan works on a JSON copy of the ops, so it plans and applies a value as JSON writes it (NaN as null, a Date as a string), and its sha256 covers that copy. The apply works on the beforeSwitch and strategy it was given at its start.
  • The release of edited raw forms by type:id no longer strips a new item that keeps an old id from a block that matches no old block.
  • An edit that writes the content a message already holds changes no thinking record and no cached prefix. A notification that fails before the hook runs refuses the apply. The receipt's head is the built branch's, read before the switch, and a failed branch read after the switch no longer hides APPLIED_INIT_FAILED. selectBranch invalidates the manager where a failed native switch left the store on another branch.

5ed5b512 (tests) and 5dff5225:

  • A failure of the manager's own work around a let-go counts as a failed let-go wherever the call is made, a reader's included.
  • The readback of a window that was the record and is presented after the build reports the change. A tool pair split names where it stands, so one that an edit brings into the view counts as new.
  • A staging manager drops through dropSummaries() wherever the strategy has it, and refuses a planned drop it can't make. describeMutationTarget and checkHistoryInvariants refuse a strategy with no historyMemory(). The manifest check runs on the copy of each op that the plan works on.
  • selectBranch says that the store moved where a failed native switch left it on another branch, and an unsaved switch's error counts whatever its value.

a07ff1e4 (tests) and c2c72b1d, for the maintainer's review R1:

  • R1-1: the plan reads each namespace that the store holds and the caller didn't list: its summaries, its chunk records and its presented window. Where one covers a row that the change edits or removes, or its window holds a removed row, the plan refuses as UNLISTED_READER and names it. ignoreNamespaces leaves a namespace alone, and planSha256 covers it.
  • R1-2: the plan's tool-pair check reads the view after the edit, through the view filter.
  • R1-3: the cleanup guards its reads of the store, so an unreadable store still gives BRANCH_LEFT.
  • R1-4: the docs say what a mutation and a preview leave in the store.
  • R1-5: HistoryMemorySource holds historyMemory() alone, and HistoryMutationStrategy extends it.
  • R1-6: the recall envelope's attribute is writtenBy.

ce6e1dbb (tests) and 42cd2d9a: compileMutationPreview takes beforeCompile, which gets the scratch manager after the mutation is built and before the compile. A caller that writes a notice to the agent after an apply can write it there, on the scratch branch. The compile then weighs it, as the first compile after the apply will.

d3c7118e (tests) and 68b68008, for the automatic review of 42cd2d9a: a namespace that the caller didn't list is refused where its presented window holds any row that the change edits or removes, and an ignored namespace's states aren't read. A label goes after the tool results that a message opens with, and first otherwise. HistoryMutationStrategy is HistoryMemorySource with editSummaryText and dropSummaries. A tool-pair split is an anomaly once in each place where it stands, and malformed content and incomplete bodies are read over the whole record. A preview waits for the let-gos that beforeCompile starts. Where the work on a built branch throws an error that isn't a HistoryMutationError, the preview and the apply say so, that the branch is deleted, and that the source holds what it held.

84a36783 merges main. 0.29.0 folded the fragment that this PR edited for the editSummaryText fixes, which #506 now carries with fragments of its own, so the merge drops that edit. On chronicle 0.8, a branch change whose checkpoint fails is undone. The tests of a real failed checkpoint ask the chronicle that they run on which it does, and each runs where it holds.

757af2d5 (tests) and 953c163f, for the automatic review of 84a36783: a carrier's recall envelope, and the key of its price memo, take the writer of the summary whose text it renders, since an edit by 0.29.0 can leave a carrier with a stale writer of its own. Each refusal says what to do. The texts say where the label goes, where a preview's compile shows by, that a redaction doesn't find a summary written from a prompt that showed the row, which methods the strategies gain, and which chronicles keep a failed switch.

c4afa161 (tests) and b89d662f, for the automatic review of 953c163f: a removal in a legacy window tells the strategy of the rows that it takes out, as a presented window's removal does, so that no chunk record keeps only ids that no row has. dropSummaries refuses a stale store. The plan's sha256 covers each edited summary and its carriers as the strategy holds them. Only this mutation's own HistoryMutationError passes through the built branch's failure unwrapped.

b7a02626 (tests) and 9dbc7c08, for the automatic review of b89d662f: the unlisted-reader check counts an uncompressed chunk record that holds a removed row. A legacy reader hears only the removed rows that it held. onRetracted's contract names the mutation's call in legacy mode, and that the mutation waits for it. Each refusal says whether anything was written, and what to do.

e0bf6a89 (test) and f0b68e75, for round R2 of the nightly review: the plan, the preview and the apply check readers and ignoreNamespaces at runtime (R2-5). The writtenBy change has a fragment of its own, history-mutation.changed.md (R2-2). The texts call the readback a new manager with a cold strategy on a view of the branch (R2-3), and say how to undo an apply (R2-4).

The merges of the current heads of #506 (92727ea0, 6eff0181) and #507 (62f4a9dd), then 5221681c (tests) and 83ada1ed, for round R3 of the nightly review: this branch takes those pull requests' summary-edit.ts, editSummaryText, CLI, selectBranch, fork(), branchAt(), derive(), fragments and tests. The apply's selected callback fires where the store is known to be on the target, a superseded switch included (R2-1). The copies of their tests that this branch kept are removed. readers and ignoreNamespaces with a hole are refused (R3-2), and the undo sentence says to call switchBranch(receipt.sourceBranch) on the manager that applied it (R3-4).

The merge 5d3e14f1 of #506 at e3c2c025, then e16cf893 (tests) and 26ad6fc7, for the automatic review of 83ada1ed: the switch callback only notes that the store reached the target, and the receipt's toSequence is the built branch's head. A refusal after the build says that the apply wrote nothing to the source. A batch that removes a folded row and edits another summary applies in both window modes.

What this relies on in Chronicle, read in src/napi.rs and src/store.rs of chronicle at a97d734 and in the doc comments of v0.7.0. view(branch) returns a handle pinned to one branch, whose writes go to that branch. createBranch(name, from) copies the parent's state heads and returns the branch with its id. currentSequence() is the current branch's head. deleteBranch refuses the current branch. On chronicle 0.6 and 0.7, createBranch, switchBranch and deleteBranch keep their change in memory when their checkpoint fails, and switch_branch selects the branch before it checkpoints, returning the checkpoint's error with the selection in effect (src/store.rs:3162-3168 at v0.7.0). On chronicle 0.8, a failed create is undone, a failed switch leaves the old selection, and a failed delete restores the branch (src/store.rs:3275-3360 at v0.8.0). The apply's selected callback fires where the store is known to be on the target, after a native switch that succeeded, or one that failed with the store there, a superseded one included. In context-manager, selectBranch calls the native switch before its first await, so nothing runs between the fence and the switch. A strategy's onRetracted is fire and forget (tellRetracted), which logs a failure and goes on, so each manager that builds the change keeps the calls that its removals make, awaits them, and records each failure.

Tests

Runs on Linux, Node v24.22.3, with @animalabs/chronicle 0.7.0 before the merge of main and 0.8.0 after it, @animalabs/membrane 0.9.0 and typescript 7.0.2, as npm ls printed them for the run at ec501962. Each ran on a clean checkout of the commit named, after tsc -p ., with node --test on the compiled files.

  • At 4061f25639db071f56526c4dd451b4d441d6fef9: the whole suite, 247 test files, 4,918 tests, 4,918 pass, 0 fail. tsc is clean.
  • At 26ad6fc7, on chronicle 0.8.0 (the lockfile): the 105 test files that reach the changed code, 3,049 tests, 3,046 pass, 0 fail, 3 skipped (the tests of a chronicle that keeps a branch change whose checkpoint fails). tsc is clean. The whole suite runs in this PR's CI.
  • At 26ad6fc7's tree less one changelog line, on chronicle 0.7.0: the five test files of the change with the two branch test files, 276 tests, 274 pass, 0 fail, 2 skipped (the tests of a chronicle that keeps the open store on its branch).
  • At 83ada1ed, two mutants each fail the test that pins them: one doesn't call selected on a superseded switch that left the store on the target, and one checks readers without Array.from.
  • At 68b68008, before the merge, on chronicle 0.7.0: the 103 test files, 3,019 tests, 3,019 pass, 0 fail.
  • At ec501962: the 102 test files that reach the changed code, 2,938 tests, 2,938 pass, 0 fail.
  • Red first, at 548b8e33 (its tests with the base's source): 12 tests of external-memory.test.ts, 5 fail. These are the three new tests, and the two existing tests that now pass --drop-response-content.
  • Red first, at 6e7a2992: history-mutation.test.ts and history-mutation-plan.test.ts fail to compile (98 tsc errors, the API missing), and the test of the escaped editedBy in recall-envelope.test.ts fails.
  • Red first, at cdeec6b1, b218e718, 227662e9, 70f53d1c, 73b0b802, c79ac495, 16d01cd1, 5ed5b512, a07ff1e4, ce6e1dbb, d3c7118e, 757af2d5, c4afa161, b7a02626 and e0bf6a89, each commit's tests with the source before it: at cdeec6b1, history-mutation.test.ts has 30 tsc errors, the API that it tests being missing, and 7 of its 34 tests fail; at b218e718, 13 of the 146 tests in the five test files of the change fail; at 227662e9, 21 of the 131 tests in history-mutation.test.ts, history-mutation-plan.test.ts and raw-forms.test.ts fail, with 2 tsc errors (HistoryState.window); at 70f53d1c, 8 of the 91 tests in history-mutation.test.ts, history-mutation-plan.test.ts and external-memory.test.ts fail, and tsc is clean; at 73b0b802, 20 of the 183 tests in the five test files of the change fail, and tsc is clean; at c79ac495, 13 of the 192 tests in the five test files fail, with 3 tsc errors (STALE_MEMORY missing from the code type); at 16d01cd1, 14 of the 197 tests in the five test files fail, with 3 tsc errors (HistoryState.hiddenStrategy missing); at 5ed5b512, 8 of the 201 tests in the five test files fail, and tsc is clean; at a07ff1e4, 10 of the 206 tests in the five test files fail, with 9 tsc errors (the new exports and options missing); at ce6e1dbb, 1 of the 207 tests in the five test files fails, with 4 tsc errors (the new option missing); at d3c7118e, 18 of the 214 tests in the five test files fail, and tsc is clean; at 757af2d5, with 84a36783's source on chronicle 0.7.0, 4 of the 217 tests fail, 1 is skipped, and tsc is clean; at c4afa161, with 953c163f's source on chronicle 0.7.0, 2 of the 219 tests fail, 1 is skipped, and tsc is clean; at b7a02626, with b89d662f's source on chronicle 0.7.0, 4 of the 222 tests fail, and tsc is clean; at e0bf6a89, with 9dbc7c08's source on chronicle 0.7.0, its new test fails, and tsc is clean. Each test that fails is new or changed in its commit.

history-mutation.test.ts runs the manager on a store of 40 rows, compressed into L1 summaries with response blocks and one L2, and on two residents of one slot with summaries of their own. A Responses replay test formats a request through membrane's Membrane, a MockAdapter and OpenAIResponsesFormatter, and asserts that the edited text ships and the old text doesn't. A test kills a process with SIGKILL inside beforeSwitch (test/_harness/apply-then-die.ts), and reopens the store on its source branch with every row and summary as it was.

Not verified

  • No real agent's store. The tests build a store of 40 rows with one L2. A store with deep levels, many images or long tool histories wasn't compiled.
  • No provider call. Thinking signatures and the Responses replay were checked by the rules and the formatter alone.
  • No second process writing the store during an apply. The fence's tests write the source, move the store and replace the target from beforeSwitch, in the same process. The maintainer's review reads an exclusive file lock that Chronicle takes at open, which would keep a second process out. I didn't read it.
  • A reader's reconciliation on the branch wasn't compared against agent-framework's own retraction (retractRemovedElsewhere) on a real resident. The tests support the presented path, which uses retractRemoved and waits for the reader's retraction calls, and the legacy path, which makes the planned drops with dropSummaries. They don't show it equal to a whole branch move in a live host.
  • A failed checkpoint was made by a real I/O failure, an unwritable branch file, around the switch, the branch's creation and its deletion. No other I/O failure was made.
  • Windows and macOS weren't run.

Paloma-2644 added 5 commits November 25, 2026 14:05
…rite

These tests fail at the base. They pin the editSummaryText of the next
commit.

- An entry can carry another summary up a level (carriedFrom). An edit
  of that entry is refused. A compile reads the carried summary's text
  in the entry's place, so the edit would never show. The error names
  the carried summary by its id.
- An edit of the carried summary reports the entries that carry it. It
  reports them apart from the summaries merged over the old text. It
  writes each carrier again as a copy of the edited summary: its text,
  tokens and external, with no response blocks and no provenance.
- A summary can render verbatim response blocks. An edit of it is
  refused unless the edit drops them (dropResponseContent, or
  --drop-response-content in the CLI). A dry run is refused too, and
  nothing is written.
- The caller can give the sha256 of the text that it read
  (expectedPriorSha256). The edit is refused where the summary's text
  has another sha256.

The two existing tests that edit a summary with response blocks now pass
--drop-response-content.
The rules of a summary edit move into one pure function, planSummaryEdit
in src/summary-edit.ts. The strategy's editSummaryText uses it now. The
history mutation plan of a later commit uses it too.

- An edit of a carrier (carriesItsSource) is refused. A compile renders
  the carried summary's text in the carrier's place
  (summaryAnswerProse). So the carrier's own copy never shows. The error
  names that summary by its id. If that summary is gone, the carrier's
  own text renders (carriedMemory), and the edit goes ahead.
- A summary's responseContent renders in place of its content
  (summaryAnswerProse). So an edit that kept it would still show the old
  text. The edit used to delete it silently. Now such an edit needs
  dropResponseContent (in the CLI, --drop-response-content). Without it,
  the edit is refused, and so is a dry run.
- expectedPriorSha256 refuses the edit if the summary's text isn't the
  text that the caller read.
- The new text's token stamp is its length divided by three. This is the
  rule for a text that no provider measured, and an imported summary
  gets it too. The old stamp is usually the provider's outputTokens.
  That count includes reasoning blocks, which dropResponseContent
  removes. A stamp scaled from it would misprice the new text.
- Each carrier is written again as a copy of the edited summary. The
  copy has the summary's text, tokens and external, and no
  responseContent, provenance or stitched. carry() would make the same
  copy now. A carrier's own fields still count in two places. The legacy
  level budgets charge a carrier's own tokens. And under carrierPolicy
  'full', recallAnswerCost prices a carrier with response blocks at its
  old stamp or more.
- An applied edit clears the memo of recall-answer prices. The memo's
  key is the summary's id and tokens. An edit to a text of the same
  length changes neither.
- SummaryTextEdit splits the parent chain in two. carriedBy lists the
  carriers next to the summary. parents lists the summaries merged over
  the old text, and every summary above them. Before, parents listed the
  carriers too.

The pending external-memory changelog fragment changes in place. The
feature isn't released yet, so its text describes the behaviour as it
ships.
The history mutation plan of the next commits must predict the outcome
of three rules. So each rule now lives in one function, which the old
caller and the plan both use. Behaviour doesn't change for content
without holes. A store holds no other content, because its JSON has no
sparse arrays.

- findUnpairedToolBlocks in normalize-tool-messages.ts lists the tool
  blocks without a partner. These are each tool_use that no tool_result
  answers, and each tool_result that answers no tool_use. It uses the
  rule of answeredCallIndexes. stripUnpairedToolBlocks strips what it
  finds. enforceToolPairing doesn't change, because it repairs rendered
  entries by adjacency, which is another rule. The old loop read the
  holes of a sparse array as undefined blocks, and forEach skips them.
- summariesFoldingRows in summary-edit.ts gives the L1 summaries that
  fold some rows. It finds them by their sources and by their chunk
  records. withSummariesAbove adds every summary above them.
  unfoldRowsThatLeft and unfold now use these two functions in place of
  their own loops.
- toolPairSplitReason in message-store.ts holds the loop that
  MessageStore.refuseToolPairSplit ran. It reads rows through an
  accessor, and returns the reason where the method threw. The method
  throws `${what}: ${reason}`, the same text as before.
These tests are for the history mutation API of the next commit. At this
commit the API doesn't exist, so the two history-mutation test files
fail to compile. One test in recall-envelope.test.ts fails too. That
test checks that the recall envelope escapes the editedBy value.

history-mutation-plan.test.ts gives the plan a history directly, because
a plan writes nothing. It checks that the plan refuses these:
- an empty manifest;
- a target named twice, or not there;
- content other than the content that the caller read;
- a blank label;
- malformed content, such as a system change with a label beside it;
- an edit of a shard, or a removal of part of a body;
- a tool call split from its result, but not a split that was there
  before the batch;
- a split that only the window's order shows;
- an edit that the store's own tool-pair check refuses, once the batch's
  earlier ops are made;
- a change to a message that keeps thinking blocks, to its text or to a
  thinking block;
- a folded row or a merged parent with no policy for it;
- an edit of a carrier;
- a summary that one op edits and another op drops;
- the removal of every row.

The plan tests also check where the label goes, an image's stored form,
the plan's reports on the thinking record and the cache prefix, the plan
hash, and the anomalies of a history at rest.

history-mutation.test.ts runs the manager on an agent's store. The store
has 40 rows, compressed into L1 summaries with response blocks and one
L2. The tests cover these:
- an apply, which leaves the store on the new branch after a reopen, and
  the source branch as it was;
- an apply's refusals of a stale hash, another source branch, a plan
  that drifted and an existing target branch, none of which writes
  anything;
- a preview, whose compile equals the compile after the apply, and which
  leaves no branch, and no record on the source branch;
- the hot settings of the scratch strategy, and the clones of the
  Knowledge and Passthrough strategies;
- an edited message whose old text was also in a Responses replay item,
  sent through membrane's Responses formatter;
- a tool call in another slot that the manager merges;
- folded rows and merged parents, by their policies;
- the recall envelope's editedBy, and the carriers of an edited summary;
- a branch whose summaries, carriers, rows or edit records read back
  other than planned;
- a branch with an anomaly that the source lacks;
- the rows that beforeSwitch appends, which the apply keeps;
- a source that moves while the branch is built;
- failures before the switch, among them a branch that can't be deleted;
- a strategy that fails to initialize after the switch, and a branch
  selection that supersedes the switch;
- a process killed with SIGKILL in beforeSwitch
  (test/_harness/apply-then-die.ts), after which the store reopens on
  its source branch as it was.
A host can now change an agent's history through the manager. The
manager checks the change against the rules that the strategy and the
provider rely on. It builds the change on a new branch, and moves the
store there only once the branch reads back right. The changelog
fragment lists the API and its refusals. This message gives the reasons
for its less obvious parts.

The plan (planMutation in src/history-mutation.ts) is pure, and writes
nothing.
- It reads tool pairs in the manager's merged record and in its window.
  The merged record holds the manager's slot and its auxiliary slots, so
  a call in an auxiliary slot pairs with its result in this slot. A
  split counts only if the batch makes it. So the plan compares the
  unpaired blocks after the batch with those before.
- The store checks tool pairs on each write (toolPairSplitReason), and
  that check refuses some shapes that were there before. So the plan
  runs the same check for each message edit, in op order, against the
  rows that the earlier ops leave.
- It puts the label first, and checks the content again with the label.
  A system change must stand alone, so a labelled one now refuses at
  plan time rather than in the middle of an apply.
- It takes the content as the store keeps it (blockAsStored). Otherwise
  an image that the store relabels or re-encodes would fail the
  readback.
- A formatter replays a block's raw form (rawItem, rawXml) in place of
  its fields. A changed block that kept its raw form would send the old
  text. So the plan drops the raw form of each block that changes
  (releaseReplacedRawForms). It drops the raw form of each sibling that
  shares it too. It matches blocks by value, because a caller's content
  is new objects.
- A message that keeps a thinking block can't change at all. A provider
  verifies the block's signature over the turn in which it was made.
- A summary that one op edits and another op drops is refused, since the
  writes fail in either order.
- For the thinking binding and the cache prefix, a summary edit changes
  the rows that the summary folds. If the slot holds none of those rows,
  the change counts from the first row.

The apply (ContextManager.applyHistoryMutation) builds on the target
branch.
- The branch is forked from the head with every state, so other
  managers' states come along.
- A manager on a view of the branch makes the writes. It makes them by
  the same calls that a host makes. Its strategy is a fresh instance,
  which gets the live strategy's rendering frontier as derive does.
- After beforeSwitch, a second manager opens the branch cold and reads
  it back. A seeded reader would check only the slot's length and last
  row (deriveOnto), so after an edit of the last row it would read back
  the source's copy. The readback compares the whole history, because a
  reader's own load can repair what it loads (demoteSplitSummaries). A
  check of the targets alone would pass a branch that the load repaired.
- Then a fence runs, with no await between it and the native switch. The
  store must still be on the source branch. The source branch must still
  be at the head that the branch was forked from. And the target branch
  must still be the branch that the apply built. Otherwise the apply
  refuses (SOURCE_MOVED). Without the fence, a write to the source
  during the build was silently left behind. So a host stops other
  writes to the history while an apply runs.
- Any failure before the switch deletes the branch built. The cleanup
  deletes only the branch that it created. Where the deletion fails, the
  error (BRANCH_LEFT) names the branch and says whether it is still
  there or its deletion isn't saved. Chronicle keeps a change in memory
  when its checkpoint fails, so both can happen.
- switchBranch moves the store before its checkpoint and before it
  initializes the strategy. So the switch can fail after the store has
  moved, and the mutation is then applied. The error is then
  APPLIED_INIT_FAILED, with the receipt and the way back, and the branch
  stays.

The preview (compileMutationPreview) makes the same writes on a scratch
branch, compiles there, and deletes the branch. Its by option must match
the apply's. A compile shows that value in the recall envelope
(editedBy), so a preview with another value would compile differently.

In the strategies, AutobiographicalStrategy implements
HistoryMutationStrategy, and KnowledgeStrategy inherits it.
dropSummaries unfolds over the seeds, then rebuilds the chunks and runs
the merge check, as a let-go of rows does. cloneForScratch on
Autobiographical, Knowledge and Passthrough builds the same class with
no automatic tick. On a subclass of these, it refuses rather than build
the wrong class.

MessageStore.edit and ContextManager.editMessage take `{ mergeMetadata
}`. MessageEditStamp is the shape of metadata.historyMutation.
@nissa-seru nissa-seru self-assigned this Nov 25, 2026
@anima-review

anima-review Bot commented Nov 25, 2026

Copy link
Copy Markdown

Automatic context view of ec5019627655 merged onto 4399a068e511.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 79 runs it could compare don't differ between the base and this head.

In the files profiled hosts loaded, 900 changed source lines that map to code ran in no profiled drive: src/context-manager.ts lines 576–577, 4645, 4653–4664, 4668–4670, 4674–4676, 4688–4690, 4707–4709, 4716–4726, 4728–4738, 4740–4741, 4780–4782, 4790–4798, 4800–4819, 4821–4852, 4854–4872, 4874, 4876, 4879–4894, 4898–4908, 4910–4933, 4935, 4938–4979, 4981 and 4983–4984; src/history-mutation.ts lines 198–199, 228–260, 263–266, 269–271, 275–278 and 280; and 620 more lines in 10 files. 636 changed source lines map to nothing the host runs: 120 of src/context-manager.ts's, 313 of src/history-mutation.ts's, 8 of src/index.ts's, 27 of src/message-store.ts's, 20 of src/normalize-tool-messages.ts's, 8 of src/raw-forms.ts's, 6 of src/recall-envelope.ts's, 2 of src/repair/topology.ts's, 32 of src/strategies/autobiographical.ts's, 4 of src/strategies/knowledge.ts's, and 96 more lines in 4 more files. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

2 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 79 runs are the same in the base and this head: 209,978 tokens sent a request, 72.2% of them read from the cache, 138,488,760 written to it, 3,969,133 output, 24 thinking blocks dropped, USD 0.5588 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (2)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,133 54.4% 959,190 20,328 24 0 1.29, confirmed after a reset
H1b/continuation/fresh 15 157,338 58.0% 846,632 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,133 54.4% 959,190 20,328 24 0 1.29, confirmed after a reset
H1b/continuation/fresh 15 157,338 58.0% 846,632 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

src/context-manager.ts: lines 576–577, 4645, 4653–4664, 4668–4670, 4674–4676, 4688–4690, 4707–4709, 4716–4726, 4728–4738, 4740–4741, 4780–4782, 4790–4798, 4800–4819, 4821–4852, 4854–4872, 4874, 4876, 4879–4894, 4898–4908, 4910–4933, 4935, 4938–4979, 4981 and 4983–4984 ran in no profiled drive; lines 54, 56, 58–61, 578–579, 1527–1529, 4644, 4649–4652, 4665–4667, 4671–4673, 4677–4687, 4691–4706, 4710–4715, 4727, 4739, 4742–4779, 4783–4789, 4799, 4820, 4853, 4873, 4875, 4877–4878, 4895–4897, 4909, 4934, 4936–4937, 4980, 4982 and 4985–4986 map to nothing the host runs.

src/history-mutation.ts: lines 198–199, 228–260, 263–266, 269–271, 275–278, 280, 282–293, 295–299, 301–305, 307–342, 344, 346–365, 367–393, 395–418, 420–454, 456–473, 475, 477, 479–497, 499–534, 537–554, 558–578, 580–586, 596–607, 609–632, 634–644, 647–660, 663–669, 682–689, 691–727, 730–731, 734–736, 747–757, 780–784 and 796–841 ran in no profiled drive; lines 2, 12–13, 15–197, 200–227, 261–262, 267–268, 272–274, 279, 281, 294, 300, 306, 343, 345, 366, 394, 419, 455, 474, 476, 478, 498, 535–536, 555–557, 579, 587–595, 608, 633, 645–646, 661–662, 670–681, 690, 728–729, 732–733, 737–739, 742, 744, 746, 758, 760–779, 785–795 and 842 map to nothing the host runs.

src/index.ts: lines 42–46, 129, 134 and 173 map to nothing the host runs.

src/message-store.ts: lines 98–101, 106–109, 114–117, 125, 127–131 and 135–137 ran in no profiled drive; lines 57–67, 69–70, 77, 84, 91–92, 110, 118, 124, 132–133, 141–142 and 954–956 map to nothing the host runs.

src/normalize-tool-messages.ts: lines 152–170 and 193 map to nothing the host runs.

src/raw-forms.ts: lines 167–173 ran in no profiled drive; lines 161–166 and 174–175 map to nothing the host runs.

src/recall-envelope.ts: lines 50 and 58–59 ran in no profiled drive; lines 37–40 and 60–61 map to nothing the host runs.

src/repair/topology.ts: lines 493–496 ran in no profiled drive; lines 497–498 map to nothing the host runs.

src/strategies/autobiographical.ts: lines 16024, 16026–16029, 16034–16038, 16041–16051, 16055–16057, 16067–16074, 16076–16080 and 16088–16092 ran in no profiled drive; lines 47–48, 16013–16023, 16058–16066, 16075, 16081–16087 and 16093–16094 map to nothing the host runs.

src/strategies/knowledge.ts: lines 44–48 ran in no profiled drive; lines 2, 43 and 49–50 map to nothing the host runs.

src/strategies/passthrough.ts: lines 36–40 ran in no profiled drive; lines 35 and 41–42 map to nothing the host runs.

src/summary-edit.ts: lines 7–8, 22–38, 40–56, 58–66, 69–82, 113–114 and 116–117 ran in no profiled drive; lines 3, 5–6, 9–21, 39, 57, 67–68, 83–90, 104–106 and 122 map to nothing the host runs.

src/types/index.ts: lines 81, 86 and 110 map to nothing the host runs.

src/types/strategy.ts: lines 3332–3335 ran in no profiled drive; lines 254–262, 3262, 3266–3274, 3278–3293 and 3309–3331 map to nothing the host runs.

Held the same in base and head: connectome-host 4b123dcabc16, agent-framework 0.35.3, chronicle 0.7.0, membrane 0.10.4.

@anima-review

anima-review Bot commented Nov 25, 2026

Copy link
Copy Markdown

Automatic review of ec5019627655.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

Minor findings 9 to 34 (of 34)

Paloma-2644 added 8 commits November 25, 2026 14:33
A history that the mutation changes can sit in more than one manager.
Residents of one host share one message slot, each with a window and
summaries of its own, and an isolated agent can merge another slot into
its own record. An edit of a row that another resident has folded leaves
that resident's summary rendering the old text, and nothing tells its
strategy: strategies hear rows leave a window (`onRetracted`), never a
row change. A removal reaches another window only after the switch,
through a host's retraction of the removed rows, or at the next boot.

These tests name the other managers as `readers` of the plan, the
preview and the apply, and pin what each must get:

- the rules of the manager's own window: its summaries over an edited
  row refuse the plan without a `foldedPolicy`, `leave_summaries` leaves
  them, and `drop_covering_summaries` drops them; a tool pair that the
  change splits in a reader's record refuses it;
- a plan that says what it does to each reader, and a `planSha256` that
  covers it, so that an apply with readers refuses a plan made without
  them (`PLAN_DRIFT`);
- a preview whose plan is the apply's;
- an apply that reconciles each reader on the target branch before the
  switch: a resident's summaries over an edited row go, and its compile
  shows the row as edited; removed rows leave a presented reader's
  window with what folds them, and nothing is left for a boot to take
  out;
- an apply that fails before the switch leaves each reader as it was on
  the source;
- a readback that refuses a reader not reconciled as planned
  (`READBACK_MISMATCH`);
- a refusal of a reader that is the manager itself, is named twice, or
  is on another store.

They don't compile against the source before the next commit, which adds
the `readers` option and the plan's `readers`.
The plan, the preview and the apply take `readers`: the other managers
on the store whose window or summaries hold the rows the mutation
changes. Each reader gets the rules of the manager's own window, by the
op's `foldedPolicy` and the reader's own window mode, and the plan
reports, for each reader, the rows it holds, the summaries of its that
fold them, what it drops, and where its window and its thinking-binding
record change. `planSha256` covers each reader's part, so an apply with
other readers than the plan's refuses as `PLAN_DRIFT`.

The apply reconciles each reader on the target branch, before
`beforeSwitch`. A manager bound to the branch, with a fresh instance of
the reader's own strategy (`cloneForScratch`), drops the summaries that
the plan drops for it over edited rows. It takes the removed rows out of
a presented window (`retractRemoved`), which drops what the strategy
folded of them, as a host's retraction after the switch would. In legacy
mode, where there is no window, it tells the strategy that they left, as
the manager's own apply does. The manager opens cold, after the target's
record has been written, so it reads the record as the branch holds it.
A fresh open reads each reader back: no removed row left in its window
index, the edited rows as planned in its record, its summaries the
source's without its planned drops, and no anomaly that its source
didn't have. A reader whose window and summaries hold none of the rows
is left untouched.

So the one switch stays the one point where the mutation lands for every
manager on the store. A failure or a stopped process before it leaves
every reader on the source as it was, and after it each reader's window
and summaries are already reconciled on the branch; the host
re-initializes the readers, as it does every other manager after a
switch.

A reader that is the manager itself, is named twice, shares a strategy
namespace with the manager or another reader, or reads another store is
refused with an error.

`windowEffects` now holds the first-changed-row and thinking-binding
reading that the plan made inline, so that each reader gets it from its
own window. `summaryMismatches` holds the readback's summary comparison
for the manager and each reader.
These tests pin requirements of the plan, the preview and the apply that
the earlier tests left unstated:

- The readback reads the whole record, every slot the manager merges: a
  row of a merged slot changed beside the plan, a summary whose text
  changed beside it, an edited summary whose `external` no longer names
  the editor, and an unedited row whose metadata changed each refuse the
  switch (`READBACK_MISMATCH`). An entry that the strategy carried
  (`carriedFrom`), which renders what it carries, is allowed beside the
  plan's drops.
- A change is placed by the rows of every merged slot: a summary over a
  merged slot's row and a row of the manager's own slot changes the
  window from the merged slot's row, and reaches the thinking-binding
  record there.
- An apply whose switch selected the branch and was then superseded by a
  switch back to the source keeps the branch and reports
  `APPLIED_INIT_FAILED` with the receipt, as it does for a switch to any
  other branch.
- A preview or an apply asked for while a sharded `addMessage` stores
  its shards is refused, and makes no branch.
- A preview or an apply with a blank `by` is refused.
- Content that replaces a message gives up a raw form that its kept
  blocks share once they stand in another order, and an opaque carrier
  whose text changed gives up its item.
- `editSummaryText` writes the carriers before the summary, so a write
  that fails leaves the summary as it was, and the same edit can be
  asked for again. It refuses an edit of a summary that the stored
  summaries no longer hold.
- The recall answer's price follows who edited the text, and a stored
  `by` that isn't a string names no one in the envelope.
- `BRANCH_LEFT` tells the caller to switch the store off a branch it is
  on before deleting it, and doesn't repeat a failure listed beside it.
  A tool-pair refusal doesn't advise changing a message in a merged
  slot.

The spawned child of the stopped-process test has a time limit, so the
suite can't wait on it forever.
The readback compared summary ids and the rows of the manager's own
slot. It now compares the whole record, every slot the manager merges:
each row's content, participant and metadata, where an edited row's
metadata is its old metadata with the edit's stamp. Each kept summary
must render as it did, by its text and response blocks, and each edited
summary and carrier must name the editor in `external`. Values are
compared as the store gives them back (`storedJson`), so a lone
surrogate half in a stamp doesn't refuse a valid apply. A new entry that
carries (`carriedFrom`) a summary the branch holds, and renders what it
renders, is allowed: a drop's or a let-go's merge check can write one
under `carryStrandedSummaries`.

The plan placed a change by the rows of the manager's own slot. A
summary can fold a merged slot's rows beside its own, so the first
changed row and the thinking-binding reach are now read from the record.

The switch's failure handler deleted the built branch whenever the store
was on the source afterwards. A switch that selected the branch and was
then superseded by one back to the source looks the same, though the
mutation is applied. The branch generation (`observeStoreBranch`) tells
the two apart: the handler deletes the branch only when the generation
didn't move.

The preview and the apply now refuse while a sharded `addMessage` stores
its shards, as `fork`, `derive` and `branchAt` do: the branch would hold
only the shards stored so far. Each reader of an apply is checked the
same way. Both refuse a blank `by`, which an edit records and an
envelope shows.

`releaseReplacedRawForms` kept the raw forms of kept blocks in any
order, and a raw form that they share replays the old order. Kept blocks
out of the old order are now moved blocks
(`releaseSharedRawFormsOnMove`). An opaque carrier whose text changed
kept its item, which replayed the old content. A changed block now gives
up every raw form.

`editSummaryText` wrote the summary first, then its carriers, and
changed each in memory before its write. It now writes each carrier
first and the summary last, and changes an entry in memory only after
its write. A compile reads the text from the summary, so a write that
fails leaves the summary that a compile reads as it was, and the same
edit can be asked for again. It refuses, before writing, a summary or
carrier that the stored summaries no longer hold, where a write would
only have logged it.

The recall answer's price memo is keyed by `external.by` too, so another
instance's edit isn't priced at the old editor's length. The envelope
names no one for a stored `by` that isn't a string. `BRANCH_LEFT` tells
the caller to switch the store off a branch it is on before deleting it,
and its own message doesn't repeat a failure listed beside it. A
tool-pair refusal no longer advises changing a message in a merged slot,
which the mutation can't target.

The docs say where a failure leaves the store: where it was, which is
the source branch unless something else moved it (`SOURCE_MOVED`), and
that a stopped process leaves the branch it was building. The `external`
and `carriedFrom` docs say what this change renders and keeps in step.
These tests pin requirements that a review of the readers round found
unmet.

The plan's sha256 covers everything the plan reports: each reader's
part, where the manager's own window and thinking record change, and
each summary that it drops, as the strategy holds it. A summary edited
between the plan and the apply then refuses the apply as PLAN_DRIFT,
where the apply would have dropped the new text. A plan that drifted is
reported as PLAN_DRIFT before the violations of the plan made now.

A reader holds a row where its window holds it, before its view filter:
a presented row that the filter hides still leaves the reader's window.
A reader's thinking reach and KV boundary come from the rows that it
sent, so a row that only another resident was shown changes neither. The
same holds for the manager's own plan. The apply reconciles and reads
back every reader that it is given, and a reader whose share is empty is
read back too: a row changed in a slot that only the reader merges
refuses the apply. A reader whose strategy keeps no summaries and has no
onRetracted hook is reconciled through a PassthroughStrategy. A reader
that keeps summaries, or hears rows leave its window, and gives no
usable cloneForScratch is refused before anything is written, as are two
managers with one strategy namespace. The apply waits for a reader's
strategy to let go of the removed rows before it goes on. A legacy
reader refuses a removal of rows that it folds, unless the op's policy
drops what folds them. A reader that stores the shards of a sharded
addMessage refuses the apply.

The readback compares each field of a row and of a summary as the store
keeps it, so a lone surrogate half doesn't read as a change, and a
changed shard index, response block or attribution does. An edited
summary must read back as the edit writes it, with no response blocks
that the edit didn't keep. A new entry stands only as the strategy's
carry of a summary that the branch holds.

editSummaryText writes a summary and its carriers in one write. A write
that fails leaves both as they were, in memory, in the store and in a
compile, and the same edit can be asked for again. The edit is refused
where the stored summaries aren't as the strategy holds them: a summary
or a carrier gone, or a newer text that another handle wrote. A summary
edited again by the same editor, with text of the same length, is priced
by its new text.

Content that replaces a message keeps a shared raw form, or a reasoning
pairing, only where its blocks stand as they stood, with nothing
inserted between them. A repeated block is matched by its place. A
tool_attempt keeps the rawXml that is its content.

A native switch that didn't happen deletes the branch that was built,
even where another selection moved the store meanwhile. The error of a
switch that a later selection superseded carries the receipt. A preview
or an apply with no `by`, a null one or a blank one gets the refusal,
not a TypeError. A preview's refusal of a reader names the preview.
The plan's sha256 now covers the whole plan as it reports it, with each
summary that it drops as the strategy holds it. Before, it hashed the
targets' hashes, the drops by id, and part of each reader's share. A
reader's thinking binding or window could then change, or a summary to
be dropped could be edited, and the apply would still accept the old
sha256. Hashing what the plan reports also removes the separate list of
hashed fields.

An apply checks PLAN_DRIFT before the violations of the plan that it
makes, so a caller whose history changed is told so, and gets the new
plan.

A reader holds a row where its window holds it, before its view filter
(`HistoryState.window`). The filtered view had missed a presented row
that the filter hides, and the apply then skipped the reader. A changed
message counts toward a window's KV boundary and thinking reach only
where that manager's view holds it, since a row that the manager never
sent changes nothing that it sent.

The apply now reconciles and reads back every reader that it is given,
not only those whose share is non-empty, so a change that beforeSwitch
makes in a slot that only a reader merges is seen. That puts every
reader's strategy on the branch. A strategy that keeps no summaries and
has no onRetracted hook has nothing to let go of, so a
PassthroughStrategy reconciles its window there:
WindowedPassthroughStrategy has no cloneForScratch, and a
PassthroughStrategy subclass's throws. A reader whose strategy keeps
summaries, or hears rows leave its window, must give a usable
cloneForScratch. It is refused at the plan, the preview and the apply,
before anything is written. After it takes the removed rows out of a
presented reader's window, the apply waits for the strategy calls that
this made, since onRetracted is fire and forget and a strategy may let
go after an await.

The readback compares rows and summaries field by field, as the store
keeps them (storedJson), on both sides. A row's content, metadata and
every other field (shards, body group, timestamp) must be the source's,
or the planned edit's. A kept summary's every field must be the
source's. Its `parentId` and `mergedInto` may only lose a pointer to a
dropped summary, or point to the strategy's carry of it. An edited
summary or carrier must be the source's with the edit's text and tokens,
its `external` naming the editor, and no response blocks, provenance or
split record. A new entry must be the carry of a summary that the branch
holds: one source, one level up, the same memory, and the source marked
as merged into it, as the strategy's carry writes it.

editSummaryText first refuses where the stored summaries aren't as the
strategy holds them (storeWrittenElsewhere), where it had compared ids
only and could overwrite a newer entry with a stale one. It then writes
the summaries in one write. Writing the carriers first and the summary
last had left a durable carrier with the new text over a source with the
old one when the second write failed. Where that one write throws,
memory takes the new summaries only if the store reads back holding
them.

releaseReplacedRawForms keeps a shared raw form, or a reasoning pairing,
only where its kept blocks stand in the new content as they stood, with
nothing between them. Blocks are matched by place. Before, one inversion
anywhere released every kept block, a block inserted between two shared
parts kept their form, and a repeated block read as moved. A changed or
new block gives up its rawXml only where the XML formatter replays it
(tool_use, tool_result), so a tool_attempt keeps the XML that is its
content.

A failed switch deletes the branch that it built exactly when the native
switch to it didn't happen, which selectBranch now reports. The branch
generation had also moved for another manager's selection, so a switch
that never happened could read as applied.

A missing or null `by` gets the editor refusal, not a TypeError. A
preview's reader refusals name compileMutationPreview. The texts say
that the recall price reads `external.by`, that a removal's default for
a reader depends on its window mode, that SOURCE_MOVED comes only after
the build and its readback pass, and which refusals the preview, the
apply and the readers add. Internal comments that weren't contracts
went.
These tests pin requirements that a review of the round found unmet.

Chronicle selects a branch and then saves the selection, and a failed
save leaves the selection in effect. A switch whose save fails, with the
branch file made unwritable, is then a switch: the apply's error is
APPLIED_INIT_FAILED with the receipt, the store is on the branch that it
built, which it keeps, the manager refuses work until it is initialized
there, and sync() saves the switch, so a reopened store is on that
branch. A switchBranch() whose save fails leaves the store on the
branch, says so, and leaves the manager refusing work until
setStrategy().

A summary that the plan drops, edited since through another handle,
refuses the apply as PLAN_DRIFT, for the manager's own summaries and for
a reader's. A plan that has become invalid since, with the same targets,
refuses as PLAN_DRIFT too: here a reader stored the result that a
removed tool call was missing.

An edited row that the edit brings into a view is where that view's KV
boundary moves, for the manager and for a reader.

The readback refuses a branch where a window differs from its source's
other than the plan says: a kept row that left it, one that moved in it,
or a row that it didn't hold. Each holds for the manager's window and
for a reader's, and each window on the source stays as it was.

editSummaryText refuses without writing where reading the stored
summaries to compare them fails. A summary write that lands and then
throws leaves the strategy holding what the store holds, so asking for
the edit again finds the new text.
selectBranch took any error of the native switch for a refusal.
Chronicle 0.7.0's switch_branch selects the branch, then checkpoints the
selection, and returns the checkpoint's error with the selection still
in effect. A switch that the store made could then read as refused: the
apply tried to delete the branch that the store was on, and reported
BRANCH_LEFT with advice to switch away. Now an error after which the
store is on the requested branch is a switch: the manager is invalidated
and the branch generation moves, as after any switch, and the call
rejects, saying that the switch took effect and that sync() saves it.
The apply then reports APPLIED_INIT_FAILED with its receipt. A
switchBranch() or fork() whose checkpoint fails had left the manager
initialized for the branch that the store left; it now refuses work
until setStrategy().

The plan's sha256 takes each summary that it drops as the store holds it
(historyMemory's `stored`), where it took the strategy's copy in memory.
A summary edited through another handle between the plan and the apply
then refuses the apply as PLAN_DRIFT, where the apply dropped it with
the newer text unseen. The strategy reads its stored summaries only
where another write moved them since it last held them as stored. Each
entry is hashed in its stored form, so the copy in memory and the stored
one hash alike.

The sha256 also covers the plan's validity and its violations, which the
plan reports, so a plan that has become invalid since refuses as
PLAN_DRIFT, with the plan made now.

An edited row counts toward a window's KV boundary where the view holds
it before the edit or after it. Each manager's state carries its view
filter for that. A row that the edit brings into the view is placed just
before the next row of the window that the view holds. Before, an edit
that made a hidden row visible moved no boundary, though the next
compile sent the row.

The readback checks each presented window too, the manager's and each
reader's: it must hold the source window's rows, less the removed ones,
each at its ordinal, and no other row. A row that beforeSwitch writes is
stored, not presented, so it passes. A legacy window is the record,
which the record check covers.

editSummaryText's check of the stored summaries refuses where reading
them fails, where storeWrittenElsewhere answered "not written elsewhere"
and the edit's whole-state write could overwrite a newer entry. The
let-go's check, which only asks whether to read the summaries again,
keeps that answer. The doc no longer says that a failed write leaves the
summaries as they were: a write that throws may have landed, and the
strategy then holds the new text.
@nissa-seru

Copy link
Copy Markdown
Contributor Author

This answers the review of ec501962 (comment). The head is now 285a6c3a. Each of the 8 should-fix findings is fixed, and so are 20 of the 26 minor ones. Six minor ones are declined: 10 (nothing awaits between the existence check and the branch's creation), 11 (it fails closed, refusing as INVARIANT_BROKEN), 13 (the stats cache is already documented as not exact, and the switch clears it), 14 (it needs a store that only this unreleased change could have written), 17 (a preview's writes are the cost of building it through the store, and the docs name it), and 21 (MessageStore.edit keeps metadata as main does). Since that review, the head also adds readers: the other managers on the store, which the plan checks, and the apply reconciles and reads back before its one switch. It also carries the fixes from later reviews of that work. A /review follows.

Details for agents

Head 285a6c3a6c155e097d4c70ff289bb19af01c0ceb. This answers the review of ec501962. Commits since it: cdeec6b1 and 99dddaf1 (readers), b218e718 and 4e50c5a6 (this review's fixes), then 227662e9 and 9b86753f, and 70f53d1c and 285a6c3a (later reviews' fixes, which change some of the fixes below; each line gives the state at the head).

  • 1 fixed: the readback compares the whole record, every merged slot, and each summary, field by field as the store keeps them (storedJson). It allows only a planned op's changes, a pointer cleared by a drop, and the strategy's carry of a summary that the branch holds. This folds 19, 20 and 32.
  • 2 fixed: a failed switch deletes the built branch exactly when the native switch to it didn't happen, which selectBranch reports. A selection that supersedes the switch, back to the source or elsewhere, gives APPLIED_INIT_FAILED with the receipt, and the branch stays, and so does a switch whose checkpoint fails with the store on the branch. The tests run each way.
  • 3 fixed: the external doc in src/types/strategy.ts and the external-memory fragment say that the recall envelope renders editedBy and that selection prices it.
  • 4 fixed: a change is placed by the record's rows, every merged slot, and a message counts only where that manager's view holds it.
  • 5 fixed in the readback: a new entry stands where it is the strategy's carry of a summary that the branch holds (one source, one level up, the same memory, its source merged into it), as the merge check after a drop writes it.
  • 6 fixed: a shared raw form, or a reasoning pairing, stays only where its kept blocks stand as they stood, with nothing between them. Blocks are matched by place.
  • 7 fixed: a changed opaque carrier gives up its item.
  • 8 fixed: the preview and the apply refuse while the manager stores the shards of a sharded addMessage, and the apply refuses the same for each reader.
  • 9 fixed: editSummaryText writes the summary and its carriers in one write, and clears the price memo in finally, so the two never part. A write that throws may still have landed, and the strategy then holds the new text.
  • 10 declined: only the manager's own call could make the branch between the existence check and createBranch, with no await between them. Deleting by name is what a create that throws after acting needs.
  • 11 declined: the case needs two system changes inside one pair that is already split, and it fails closed (INVARIANT_BROKEN, nothing switched).
  • 12 fixed: editSummaryText refuses, before it writes, where the stored summaries can't be shown to be as the strategy holds them (storeWrittenElsewhere), a failed read of them included.
  • 13 declined: the stats cache is documented on main as not exact across live edits, and the mutation's switch clears it (it is keyed by branch id).
  • 14 declined: it needs a carrier left stale by an earlier editSummaryText, which no release has (editSummaryText is unreleased, from Operator tool: install or edit a memory whose text was obtained outside the strategy #500).
  • 15 fixed: the price memo key holds external.by.
  • 16 fixed: a by that isn't a string names no one in the envelope.
  • 17 declined: the preview's writes are the cost of building it through the store, which the docs and the changelog name.
  • 18 fixed: the docs say that a stopped process leaves its branch, and that an apply can't take that name until it is deleted.
  • 21 declined: MessageStore.edit keeps metadata as main does, and dropping a stamp on a plain edit would change that API's contract.
  • 22 fixed: the preview and the apply refuse a by that is missing, null or blank.
  • 23 fixed: the refusal names the CLI flag too.
  • 24 and 25 fixed: BRANCH_LEFT says to switch the store off the branch when it's on it, and doesn't repeat a failure listed beside it.
  • 26 fixed: a split refusal doesn't advise changing a message in a merged slot.
  • 27 fixed: the stopped-process test's child has a 60 s timeout.
  • 28 fixed: the docs say that the store stays where it was, the source unless something else moved it.
  • 29 and 34 fixed: the fragment's wording and a test's title.
  • 30 fixed: the description says what expectedAfterSha256 and expandBodyGroups are for.
  • 31 fixed: the description says that editedBy renders under recallEnvelope: 'xml' alone.
  • 33 fixed: the carriedFrom doc.

Runs at 285a6c3a6c155e097d4c70ff289bb19af01c0ceb, on Linux with Node v24.22.3: the whole suite, 247 test files and 4,907 tests, passes, and tsc is clean. Each round's new tests fail at the source before it.

— Paloma-2644

@nissa-seru

Copy link
Copy Markdown
Contributor Author

/review

— Paloma-2644

@anima-review

anima-review Bot commented Nov 25, 2026

Copy link
Copy Markdown

Automatic context view of 285a6c3a6c15 merged onto 4399a068e511.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 79 runs it could compare don't differ between the base and this head.

In the files profiled hosts loaded, 1,189 changed source lines that map to code ran in no profiled drive: src/context-manager.ts lines 576–577, 580–583, 2841–2844, 2860–2861, 2863–2864, 4672, 4680–4696, 4700–4702, 4722–4724, 4727–4743, 4755–4757, 4778–4780, 4788–4800, 4802–4812, 4814–4815, 4872–4874, 4883–4894, 4896–4916, 4918–4966, 4968–4989, 4991, 4993, 4996–5015, 5019–5028, 5030–5035, 5038–5048, 5050–5073, 5075, 5078–5096, 5099–5140, 5142 and 5144–5145; and 857 more lines in 10 files. 761 changed source lines map to nothing the host runs: 179 of src/context-manager.ts's, 360 of src/history-mutation.ts's, 8 of src/index.ts's, 27 of src/message-store.ts's, 20 of src/normalize-tool-messages.ts's, 4 of src/raw-forms.ts's, 6 of src/recall-envelope.ts's, 2 of src/repair/topology.ts's, 40 of src/strategies/autobiographical.ts's, 4 of src/strategies/knowledge.ts's, and 111 more lines in 4 more files. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

2 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 79 runs are the same in the base and this head: 209,978 tokens sent a request, 72.2% of them read from the cache, 138,488,760 written to it, 3,969,133 output, 24 thinking blocks dropped, USD 0.5588 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (2)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,133 54.4% 959,190 20,328 24 0 1.29, confirmed after a reset
H1b/continuation/fresh 15 157,338 58.0% 846,632 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,133 54.4% 959,190 20,328 24 0 1.29, confirmed after a reset
H1b/continuation/fresh 15 157,338 58.0% 846,632 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

src/context-manager.ts: lines 576–577, 580–583, 2841–2844, 2860–2861, 2863–2864, 4672, 4680–4696, 4700–4702, 4722–4724, 4727–4743, 4755–4757, 4778–4780, 4788–4800, 4802–4812, 4814–4815, 4872–4874, 4883–4894, 4896–4916, 4918–4966, 4968–4989, 4991, 4993, 4996–5015, 5019–5028, 5030–5035, 5038–5048, 5050–5073, 5075, 5078–5096, 5099–5140, 5142 and 5144–5145 ran in no profiled drive; lines 54, 56, 58–61, 578–579, 584–585, 1533–1535, 2814–2817, 2833–2836, 2845, 4671, 4676–4679, 4697–4699, 4703–4721, 4725–4726, 4744–4754, 4758–4777, 4781–4787, 4801, 4813, 4816–4871, 4875–4882, 4895, 4917, 4967, 4990, 4992, 4994–4995, 5016–5018, 5029, 5036–5037, 5049, 5074, 5076–5077, 5097–5098, 5141, 5143, 5146–5147 and 5900 map to nothing the host runs.

src/history-mutation.ts: lines 229–230, 259–291, 294–297, 300–302, 306–313, 315, 317–328, 330–334, 336–340, 342–377, 379, 381–400, 402–428, 430–453, 455–489, 491–508, 510, 512, 514–533, 535–567, 569–583, 585–605, 608–625, 627–644, 647–668, 670–676, 686–697, 699–724, 726–736, 739–752, 755–761, 774–781, 783–819, 822–823, 826–828, 839–849, 877–882, 885–898, 901–905, 908–936, 942–988, 991–993, 996–1008 and 1020–1032 ran in no profiled drive; lines 2, 14–15, 17–228, 231–258, 292–293, 298–299, 303–305, 314, 316, 329, 335, 341, 378, 380, 401, 429, 454, 490, 509, 511, 513, 534, 568, 584, 606–607, 626, 645–646, 669, 677–685, 698, 725, 737–738, 753–754, 762–773, 782, 820–821, 824–825, 829–831, 834, 836, 838, 850, 852–872, 874, 876, 883–884, 899–900, 906–907, 937–938, 941, 989–990, 994–995, 1009–1019 and 1033 map to nothing the host runs.

src/index.ts: lines 42–46, 129, 134 and 173 map to nothing the host runs.

src/message-store.ts: lines 98–101, 106–109, 114–117, 125, 127–131 and 135–137 ran in no profiled drive; lines 57–67, 69–70, 77, 84, 91–92, 110, 118, 124, 132–133, 141–142 and 954–956 map to nothing the host runs.

src/normalize-tool-messages.ts: lines 152–170 and 193 map to nothing the host runs.

src/raw-forms.ts: lines 161–190 and 193–200 ran in no profiled drive; lines 191–192 and 201–202 map to nothing the host runs.

src/recall-envelope.ts: lines 50–51 and 59–60 ran in no profiled drive; lines 37–40 and 61–62 map to nothing the host runs.

src/repair/topology.ts: lines 493–496 ran in no profiled drive; lines 497–498 map to nothing the host runs.

src/strategies/autobiographical.ts: lines 8915, 16030, 16032–16035, 16040–16044, 16047–16067, 16069–16070, 16072–16075, 16080–16085, 16095–16102, 16104–16108 and 16116–16120 ran in no profiled drive; lines 47–48, 16013–16028, 16068, 16071, 16076, 16086–16094, 16103, 16109–16115 and 16121–16122 map to nothing the host runs.

src/strategies/knowledge.ts: lines 44–48 ran in no profiled drive; lines 2, 43 and 49–50 map to nothing the host runs.

src/strategies/passthrough.ts: lines 36–40 ran in no profiled drive; lines 35 and 41–42 map to nothing the host runs.

src/summary-edit.ts: lines 7–8, 22–38, 40–56, 58–66, 69–82, 113–114 and 116–117 ran in no profiled drive; lines 3, 5–6, 9–21, 39, 57, 67–68, 83–90, 104–106 and 122 map to nothing the host runs.

src/types/index.ts: lines 81, 86 and 110 map to nothing the host runs.

src/types/strategy.ts: lines 3341–3344 ran in no profiled drive; lines 254–262, 3184–3189, 3201–3204, 3266, 3270–3278, 3282–3297 and 3313–3340 map to nothing the host runs.

Held the same in base and head: connectome-host d19f30c3397d, agent-framework 0.35.3, chronicle 0.7.0, membrane 0.10.4.

@anima-review

anima-review Bot commented Nov 25, 2026

Copy link
Copy Markdown

Automatic review of 285a6c3a6c15.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

Minor findings 4 to 38 (of 38)
Raised before, still answered (4)

Paloma-2644 added 2 commits November 25, 2026 17:37
These tests pin requirements that a review of the head found unmet.

The apply waits for its own strategy on the branch to let go of the rows
that it removes before it goes on, as it already waited for each
reader's: a let-go held under the test's control holds the apply, so
beforeSwitch runs after it. A let-go that fails on the branch refuses
the apply, the store stays on its source, and the built branch is
deleted. A strategy that doesn't hear rows leave (no onRetracted) still
loses each summary that the plan drops.

The readback refuses a removed row that keeps a place in the manager's
own window, as it refused one in a reader's. It refuses an edited
summary whose `external` holds anything but who made the edit, its note
and when, and a new carry where the plan neither drops summaries nor
removes rows. The plan's sha256 changes where a summary that it edits
has a newer stored form.

A preview refuses while a reader stores the shards of a sharded
addMessage, as an apply does. A preview names the editor that it was
asked with, though the caller changes that object while the preview
runs. The receipt's toSequence is the branch's head at the switch,
before the manager's own initialization there writes. Where reading the
source's head fails after the branch is made, the apply deletes the
branch.

An invalid plan's error names each violation, and PLAN_DRIFT says that
the history, the manifest or the readers changed. A summary write that
throws says whether it landed. A summary edit refuses where an entry
that carries the summary renders response blocks. Content that replaces
a message keeps a raw form that the old content didn't hold. A strategy
prices a summary by its text again once it takes up summaries that
another handle wrote.

Tightened: the reader's let-go test holds the let-go under its control
in place of a 20 ms sleep; the checkpoint test makes the branch file
unwritable around the create and the delete, saves, and reopens; the
replay test shows that the stale form would send the old text; the drop
test checks the plan's drops; the one-write test counts the retry's
writes; the newer-text case changes the text alone; the carrier refusal
is tried with apply too.
The manager that builds the change on the branch now waits for the
onRetracted calls that its own removals start, as it waited for a
reader's. It also refuses when one of those calls fails. tellRetracted
logs a failed call and goes on, as it does for a live manager, so the
apply couldn't see one: a strategy that kept its own record of the
let-go could miss it, and the apply still switched. A staging manager
now records each failure, and the apply refuses before the switch.

Each staging manager now makes the plan's drops itself: after a
presented window's let-go, it drops each summary that the plan drops and
its strategy still holds (dropSummaries). A let-go drops what folds the
rows of the window, and only where the strategy hears it, so a legacy
strategy with no onRetracted, or a reader whose summary folds a row that
its window doesn't hold, kept a planned drop, and the readback refused a
valid apply. A legacy strategy was told that the rows left (onRetracted)
only to make those drops, so it no longer is. The readback requires
exactly the planned state, so the drop can't hide another change.

The readback accepts a new carry (a summary's copy a level up, which the
strategy's merge check writes) only where the plan drops summaries or
removes rows, since a carry comes from one of those. It checks each
removed row's ordinal in the manager's own window, as in each reader's.
An edited summary's `external` must hold who made the edit, its note and
a time, and nothing else.

The plan's sha256 covers each summary that it edits, and its carriers,
in their stored form, as it covered the summaries that it drops.

A preview refuses while a reader stores shards, as an apply does.
Preview and apply copy `by` when they check it and write the copy. The
receipt's toSequence is read at the switch. The source's head is read
inside the cleanup's reach. An invalid plan's error lists each
violation, and PLAN_DRIFT names the manifest and the readers beside the
history.

editSummaryText's write that throws now says that it landed, or that it
may have, with the store's error as its cause. RESPONSE_CONTENT_SHADOW
counts the response blocks of each entry that carries the summary too,
since the edit rewrites those entries as copies. loadPersistedState
clears the price memo, since summaries that it takes up from another
handle can change text and keep their id and tokens.

An edited block that matches no block of the old content loses only the
raw forms that the old content held, an opaque carrier's item among
them, since a copy of one would replay the old content. A raw form that
the old content didn't hold is the caller's and stays. Before, every
such block lost its raw forms, so an edit that added or replaced an
opaque Responses item left an empty text block in its place.

A clone refusal no longer offers a strategy option that a reader can't
take; a manager's own scratch says to give one. Docs: tool pairs are
read in record order and in the view, editedBy appears where
`external.by` isn't blank, the edit event carries content alone, and the
new exports are listed. Comments on internals go.
@nissa-seru

Copy link
Copy Markdown
Contributor Author

This answers the review of 285a6c3a (comment). The head is now 4061f256. The 3 should-fix findings are fixed, and so are 32 of the 35 minor ones. Three minor ones are declined: 5 (a reader's open that writes another manager's rows is outside the apply's contract), 14 (the apply's readback refuses that case before anything moves) and 15 (that refusal is safe, and a reader whose memory lags its store is a state the apply shouldn't paper over). A /review follows.

Details for agents

Head 4061f25639db071f56526c4dd451b4d441d6fef9. Commits since 285a6c3a: 73b0b802 (tests) and 4061f256 (fixes).

  • 1 fixed: the staging manager waits for the onRetracted calls that its own removals start (settleRetractions), as it waited for a reader's. A test holds the let-go under its control: the apply doesn't go on until it is released.
  • 2 fixed: a staging manager records each failed onRetracted call, and settleRetractions refuses: the apply deletes the built branch and stays on its source. A live manager still logs a failure and goes on.
  • 3 fixed: the fragment lists the new exports: the hash helpers, HistoryMutationStrategy with its guard, and findUnpairedToolBlocks with UnpairedToolBlock.
  • 4 fixed: the readback accepts a new carry only where that manager's or reader's plan drops summaries or removes rows.
  • 5 declined: the apply is for a history that nothing else writes while it runs, and a manager's open writes its own states. The fence guards the source branch and the built branch's identity.
  • 6 fixed: a changed block that matches no old block loses only the raw forms that the old content held, an opaque carrier's item among them. A new or replacing item stays.
  • 7 fixed: an edited summary's external must be who made the edit, its note and a time, and nothing more.
  • 8 fixed in the doc: the strategy holds the new text where it could read the store back and found it there.
  • 9 fixed: the test holds the let-go on a promise that it releases.
  • 10 fixed: the test makes the branch file unwritable around the create and around the delete, then saves and reopens.
  • 11 fixed: the test's name says that the write fails before it lands.
  • 12 fixed: the test first shows that the stale replay form, sent as the edit gives it, sends the old text.
  • 13 fixed: the plan's sha256 covers each summary that it edits, and its carriers, in their stored form.
  • 14 declined: the readback refuses it as INVARIANT_BROKEN before the switch, and a plan of the view after an edit would need the unfiltered window order, for a filter keyed on content that the edit changes.
  • 15 declined: the apply refuses it before the switch. Accounting for the open's repair would accept a branch whose reader state the plan didn't describe.
  • 16 fixed: the source's head is read inside the cleanup's reach.
  • 17 fixed: a preview refuses while a reader stores shards, as an apply does.
  • 18 and 21 fixed: each staging manager makes the plan's drops itself, after a presented window's let-go, of each summary that its strategy still holds. A legacy strategy is no longer told that the rows left, which served only those drops.
  • 19 fixed: preview and apply copy by when they check it, and write the copy.
  • 20 fixed: toSequence is read at the switch.
  • 22 fixed: the readback checks each removed row's ordinal in the manager's own window too.
  • 23 fixed: loadPersistedState clears the price memo.
  • 24 fixed in the doc: the edit event carries the content alone, and a listener reads the message for its metadata.
  • 25 fixed: the error says that the write landed or may have, with the store's error as its cause.
  • 26 fixed: the clone refusal no longer offers the strategy option, and a manager's own scratch says to give one.
  • 27 fixed: the error lists each violation, with its code and op.
  • 28 fixed: PLAN_DRIFT names the manifest and the readers beside the history.
  • 29, 30, 31 and 32 fixed as asked.
  • 33 fixed: the fragment says that tool pairs are read in record order and in the view.
  • 34 fixed: the fragment says editedBy appears where external.by isn't blank.
  • 35 fixed: the description weighs describeMutationTarget and checkHistoryInvariants.
  • 36 fixed: RESPONSE_CONTENT_SHADOW counts the response blocks of each entry that carries the summary.
  • 37 fixed: the comments on internals go. The comment on the apply's own codes in MutationViolationCode stays, since that type is exported.
  • 38 fixed: the test's name and the description say that the label goes first unless a text block holds it.

Runs at 4061f25639db071f56526c4dd451b4d441d6fef9, on Linux: the whole suite, 247 test files and 4,918 tests, passes, and tsc is clean. At 73b0b802, with the source before it, 20 of the 183 tests in the change's five test files fail, each one new or changed there.

— Paloma-2644

@nissa-seru

Copy link
Copy Markdown
Contributor Author

/review

— Paloma-2644

@anima-review

anima-review Bot commented Nov 25, 2026

Copy link
Copy Markdown

Automatic context view of 4061f25639db merged onto 4399a068e511.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 79 runs it could compare don't differ between the base and this head.

In the files profiled hosts loaded, 1,220 changed source lines that map to code ran in no profiled drive: src/context-manager.ts lines 576–577, 580–584, 587–592, 2850–2853, 2869–2870, 2872–2873, 4681, 4685–4701, 4705–4707, 4727–4729, 4732–4748, 4761–4763, 4784–4786, 4794–4806, 4808–4818, 4820–4821, 4878–4880, 4889–4900, 4902–4922, 4924–4975, 4977–5000, 5002, 5004, 5007–5026, 5030–5039, 5041–5046, 5049–5056, 5058–5065, 5067–5091, 5093, 5096–5106 and 5109–5113; and 918 more lines in 11 files. 749 changed source lines map to nothing the host runs: 183 of src/context-manager.ts's, 358 of src/history-mutation.ts's, 8 of src/index.ts's, 22 of src/message-store.ts's, 20 of src/normalize-tool-messages.ts's, 4 of src/raw-forms.ts's, 2 of src/recall-envelope.ts's, 2 of src/repair/topology.ts's, 41 of src/strategies/autobiographical.ts's, 4 of src/strategies/knowledge.ts's, and 105 more lines in 4 more files. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

2 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 79 runs are the same in the base and this head: 209,978 tokens sent a request, 72.2% of them read from the cache, 138,488,760 written to it, 3,969,133 output, 24 thinking blocks dropped, USD 0.5588 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (2)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,133 54.4% 959,190 20,328 24 0 1.29, confirmed after a reset
H1b/continuation/fresh 15 157,338 58.0% 846,632 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,133 54.4% 959,190 20,328 24 0 1.29, confirmed after a reset
H1b/continuation/fresh 15 157,338 58.0% 846,632 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,310 60.2% 790,677 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

src/context-manager.ts: lines 576–577, 580–584, 587–592, 2850–2853, 2869–2870, 2872–2873, 4681, 4685–4701, 4705–4707, 4727–4729, 4732–4748, 4761–4763, 4784–4786, 4794–4806, 4808–4818, 4820–4821, 4878–4880, 4889–4900, 4902–4922, 4924–4975, 4977–5000, 5002, 5004, 5007–5026, 5030–5039, 5041–5046, 5049–5056, 5058–5065, 5067–5091, 5093, 5096–5106, 5109–5113, 5116–5153, 5155, 5157–5158, 5892–5893 and 5918–5923 ran in no profiled drive; lines 54, 56, 58–61, 578–579, 585–586, 593–594, 1542–1544, 2823–2826, 2842–2845, 2854, 4680, 4702–4704, 4708–4726, 4730–4731, 4749–4760, 4764–4783, 4787–4793, 4807, 4819, 4822–4877, 4881–4888, 4901, 4923, 4976, 5001, 5003, 5005–5006, 5027–5029, 5040, 5047–5048, 5057, 5066, 5092, 5094–5095, 5107–5108, 5114–5115, 5154, 5156, 5159–5160, 5917 and 5924–5925 map to nothing the host runs.

src/history-mutation.ts: lines 226–227, 256–288, 291–294, 297–299, 303–310, 312, 314–325, 327–331, 333–337, 339–374, 376, 378–397, 399–425, 427–450, 452–486, 488–505, 507, 509, 511–530, 532–564, 566–580, 582–603, 606–623, 625–642, 645–666, 668–674, 684–695, 697–722, 724–734, 737–750, 753–759, 772–779, 781–817, 820–821, 824–826, 837–847, 875–880, 883–896, 899–903, 906–934, 942–990, 993–995, 998–1011 and 1023–1037 ran in no profiled drive; lines 2, 14–15, 17–225, 228–255, 289–290, 295–296, 300–302, 311, 313, 326, 332, 338, 375, 377, 398, 426, 451, 487, 506, 508, 510, 531, 565, 581, 604–605, 624, 643–644, 667, 675–683, 696, 723, 735–736, 751–752, 760–771, 780, 818–819, 822–823, 827–829, 832, 834, 836, 848, 850–870, 872, 874, 881–882, 897–898, 904–905, 935–936, 938, 941, 991–992, 996–997, 1012–1022 and 1038 map to nothing the host runs.

src/index.ts: lines 42–46, 129, 134 and 173 map to nothing the host runs.

src/message-store.ts: lines 92–95, 100–103, 108–111, 119, 121–125 and 129–131 ran in no profiled drive; lines 57–61, 63–64, 71, 78, 85–86, 104, 112, 118, 126–127, 135–136 and 948–951 map to nothing the host runs.

src/normalize-tool-messages.ts: lines 152–170 and 193 map to nothing the host runs.

src/raw-forms.ts: lines 161–191 and 194–203 ran in no profiled drive; lines 192–193 and 204–205 map to nothing the host runs.

src/recall-envelope.ts: lines 47–48 and 56–57 ran in no profiled drive; lines 58–59 map to nothing the host runs.

src/repair/topology.ts: lines 493–496 ran in no profiled drive; lines 497–498 map to nothing the host runs.

src/strategies/autobiographical.ts: lines 8916, 16032, 16034–16037, 16042–16046, 16049–16069, 16071–16075, 16077–16080, 16085–16090, 16100–16107, 16109–16113 and 16121–16125 ran in no profiled drive; lines 47–48, 16014–16030, 16070, 16076, 16081, 16091–16099, 16108, 16114–16120 and 16126–16127 map to nothing the host runs.

src/strategies/knowledge.ts: lines 44–48 ran in no profiled drive; lines 2, 43 and 49–50 map to nothing the host runs.

src/strategies/passthrough.ts: lines 36–40 ran in no profiled drive; lines 35 and 41–42 map to nothing the host runs.

src/summary-edit.ts: lines 7–8, 22–38, 40–56, 58–66, 69–82, 107–108 and 110–111 ran in no profiled drive; lines 3, 5–6, 9–21, 39, 57, 67–68, 83–85, 99–100 and 116 map to nothing the host runs.

src/types/index.ts: lines 81, 86 and 110 map to nothing the host runs.

src/types/strategy.ts: lines 3341–3344 ran in no profiled drive; lines 254–262, 3184–3189, 3201–3204, 3266, 3270–3278, 3282–3297 and 3313–3340 map to nothing the host runs.

Held the same in base and head: connectome-host d19f30c3397d, agent-framework 0.35.3, chronicle 0.7.0, membrane 0.10.4.

@anima-review

anima-review Bot commented Nov 25, 2026

Copy link
Copy Markdown

Automatic review of 4061f25639db.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

  • 1. should fix at src/raw-forms.ts:90, src/raw-forms.ts:189, src/raw-forms.ts:197, changelog.d/history-mutation.added.md:36, change-text.md:84, commit-messages.txt:826, src/raw-forms.ts:186: Raw forms are compared by type:id rather than full value, so a replacement item with the same id is deleted as if held.
    • Failing case: Replace an opaque web-search carrier with a new carrier whose rawItem has the same type and ID but updated contents: itemKey considers the two items identical, withoutHeldRawForms deletes the replacement, and the resulting empty text block loses the caller's new item.
    • Raised before as finding 6 of the review of 285a6c3a6c15 and answered: «6 fixed: a changed block that matches no old block loses only the raw forms that the old content held, an opaque carrier's item among them. A new or replacing item stays.» At this head, that doesn't hold: The answer's 'A new or replacing item stays' holds for new items and for replacements with another type:id (the test at raw-forms.test.ts:257 uses another id), but a replacing item that keeps the old type and id is keyed as held (raw-forms.ts:96-97) and deleted at line 189.
  • 2. should fix at src/context-manager.ts:4685, src/history-mutation.ts:567, src/history-mutation.ts:575, src/history-mutation.ts:881, src/history-mutation.ts:968: Planning and readback use the strategy's stale in-memory summary inventory instead of the source branch's stored inventory.
    • Failing case: After a manager loads L1 summaries S and T, another handle merges them into a new parent P before planning begins; a mutation dropping S hashes the stored form of S but plans only the stale inventory, and staging opens the stored tree and unfolds both S and P. Because P was absent from the source snapshot as well as the final branch, readback accepts the apply even though P was never listed as a drop.
    • Raised before as finding 13 of the review of 285a6c3a6c15, fixed then; this is a case the fix leaves.
  • 3. should fix at changelog.d/history-mutation.added.md:20, README.md:118, src/history-mutation.ts:490: The docs say a folded message without a policy is refused, leaving out the presented-window default to drop covering summaries.
    • Failing case: A host removes a folded row from a presented window without specifying foldedPolicy expecting the documented refusal; the plan instead accepts the removal and plans to drop the covering summaries and their ancestors.
  • 4. should fix at src/history-mutation.ts:504, src/history-mutation.ts:595, src/context-manager.ts:5120: The exhaustive-switch default silently ignores unknown runtime operation kinds.
    • Failing case: A manifest with ops: [{kind: 'redact_message'}] returns a valid empty-target plan; preview builds and compiles an unchanged scratch branch, and apply with that plan builds and switches to an unchanged branch instead of refusing the unknown operation.
Minor findings 5 to 35 (of 35)
Raised before, still answered (1)
  • minor at src/message-store.ts:984, src/message-store.ts:1985, src/message-store.ts:2074, src/context-manager.ts:1548: Merging channel metadata does not invalidate the per-ordinal channel statistics cache. Raised before as finding 13 of the review of ec5019627655, answered by @nissa-seru as a choice; at this head: The decline rests on facts that hold. The KNOWN SIMPLIFICATION doc (1977-1983) is unchanged from main and accepts inexact stats across live edits within a branch, and getChannelTokenStats clears the cache on a branch-id change (2061-2065), so an apply's switch clears it. A direct mergeMetadata edit on the same branch stays stale, and that documented simplification covers it.

Paloma-2644 added 2 commits November 25, 2026 18:33
These tests pin requirements that a review of the head found unmet.

The plan refuses a manifest whose ops aren't of a known kind, or whose
fields haven't their types or allowed values, as MALFORMED_OP naming the
op, and plans nothing. It refuses where a strategy's summaries in
memory, the manager's or a reader's, aren't the ones the store holds, as
STALE_MEMORY naming the reader: summaries written through another handle
refuse a plan until the manager is initialized again.

Content that replaces a message keeps an item that has an old id and new
contents, as the caller's. Rows that an edit brings into the view are
placed in window order, whatever the manifest's order. An edited
message's planned sha256 is of its content as the store keeps it, a lone
surrogate written as U+FFFD.

The apply builds and switches to the target branch it was asked for,
though the caller changes its options while it runs. A reader whose
cloneForScratch gives no strategy is refused when it plans. A let-go
that fails on the branch with no reason refuses the apply too. Where a
later run of a removal fails, the preview and the apply wait for the
let-go that an earlier run started before they delete the branch. A
failed read in the switch's own bookkeeping leaves the manager
uninitialized, so nothing reads the target through the source's strategy
state. The test of a failed create shows that the native create ran, and
left its branch in memory, before the cleanup deleted it.
The plan checks the manifest at runtime first. Each op is an object of a
known kind, each field has its type, and each policy is one that the
kind allows. An op of an unknown kind fell through the plan's switch, so
the plan was valid with no targets, and an apply would build and switch
to an unchanged branch. A policy was compared against two of its values,
and a field was read without a check of its type. Each failure now
refuses as MALFORMED_OP, naming the op and the field, and a malformed
manifest plans nothing.

The plan refuses where a strategy's summaries in memory, the manager's
own or a reader's, aren't the ones the store holds (STALE_MEMORY).
historyMemory reads the stored summaries only where another write moved
them, so this is an identity check. Before, the plan walked the
inventory in memory, so where another handle had merged summaries since,
the apply's drop on the branch could take a parent that the plan never
listed.

A changed block that matches no old block loses a raw form only where
the old content held that form, compared by value. Compared by
`type:id`, an item that kept an old id and had new contents was taken
for a stale copy and lost.

A removal retracts its rows and waits for the retraction calls in either
window mode, since a legacy window's retraction writes nothing. A failed
retraction call refuses the apply whatever it fails with, `undefined`
included. Where a later run of a removal fails, the preview and the
apply wait for the retraction calls that earlier runs started before
they delete the branch, so none runs on against a deleted branch.
`selectBranch` invalidates the manager before its caller's bookkeeping,
as its comment says, so a failed read there leaves the manager
uninitialized. The apply keeps the target branch it was given at its
start. A reader whose cloneForScratch returns no strategy is refused
when it plans. A row that an edit brings into the view is placed among
others that enter before the same row by window order. An edited
message's planned sha256 is of its content in its stored form.

Docs: a removal from a presented window drops what folds it by default;
the KV boundary is an estimate that errs early; `editedBy` appears where
`external.by` isn't empty; the exported types are named; a write that
throws holds the new text only where the read back found it;
`droppedResponseBlocks` is the most on one entry; a reader needs a
cloneForScratch of its own; a changed copy of an opaque carrier loses
its item. The response-block refusal says that the edit drops the
blocks.
@nissa-seru

Copy link
Copy Markdown
Contributor Author

This answers the review of 4061f256 (comment). The head is now e6f83068. The 4 should-fix findings are fixed, and so are 21 of the 31 minor ones. Ten minor ones are declined, each with its reason below. Five of those are notes on the cost of a rare operator change, which stays correct first. A /review follows, since this round adds two refusals.

Details for agents

Head e6f8306876fc576af47bf6a8eef994c44180e38c. Commits since 4061f256: c79ac495 (tests) and e6f83068 (fixes).

  • 1 fixed: a changed block that matches no old block loses a raw form only where the old content held that form, compared by value. A test replaces an item with one that keeps its id and has new contents, and the new item stays.
  • 2 fixed: the plan refuses where a strategy's summaries in memory, the manager's or a reader's, aren't the ones that the store holds (STALE_MEMORY, naming the reader). historyMemory reads the stored summaries only where another write moved them, so this is an identity check, and the plan never walks a stale inventory. A test writes the stored summaries behind the strategy, and the plan refuses until the manager is initialized again.
  • 3 fixed in the doc: the changelog and the README say that a removal from a presented window drops what folds it by default.
  • 4, 7 and 19 fixed: the plan checks the manifest at runtime first. Each op is an object of a known kind, each field has its type, and each policy is one that its kind allows. Each failure refuses as MALFORMED_OP, which names the op and the field, and a malformed manifest plans nothing.
  • 5 declined: a raw form that the caller supplies in new content is the caller's. The plan releases only what the old content held, which is the replay it can know to be stale.
  • 6 declined: a scratch clone runs the strategy's own initialization, so it behaves as the strategy would on that branch. A quarantine alert raised there names a condition of the history that the change builds.
  • 8 fixed in the doc: droppedResponseBlocks is the most response blocks that one entry held, the summary or a carrier, and the CLI says so.
  • 9 fixed: selectBranch invalidates the manager before its caller's bookkeeping. A test fails the sequence read after the switch, and the manager refuses to plan until it is initialized again.
  • 10 fixed: a failed onRetracted call refuses the apply whatever it fails with, undefined included. The test fails the let-go both ways.
  • 11 declined: the manager's staging manager and a reader's record a failed let-go through the same path (managerOnBranch gives each its list, and tellRetracted fills it), which the reader's test drives.
  • 12 fixed: the test shows that the native create ran, and that its branch stood in memory when its checkpoint failed, before it checks that the cleanup deleted it.
  • 13 and 35 fixed in the doc: editedBy names a by that isn't empty, in the changelog and the strategy's doc.
  • 14 fixed: the apply keeps the target branch that it was given at its start. A test changes the options while the apply runs.
  • 15 declined: each reader's drops are in its own part of the plan (PlannedReader), and the receipt reports the manager's.
  • 16 fixed: a cloneForScratch that returns no strategy is refused when the plan runs, and the refusal says so.
  • 17 fixed: rows that an edit brings into the view before the same row are placed by window order. A test lists them out of order in the manifest.
  • 18 fixed: an edited message's planned sha256 is of its content as the store keeps it. A test edits in a lone surrogate.
  • 20 declined: the readback checks the shape of each carry, and a carry is allowed only where the plan drops summaries or removes rows, which is where a merge check runs.
  • 21 fixed: where a later run of a removal fails, the preview and the apply wait for the let-gos that earlier runs started before they delete the branch. A test fails the second run while the first one's let-go is held.
  • 22 declined: each entry leaves the list when it settles, so a live manager holds only the calls still running.
  • 23 fixed in the doc: a write that throws holds the new text only where the read back found it.
  • 24 fixed in the doc: the changelog names the exported types.
  • 25 fixed in the doc: invalidatesKvPrefixFrom is the first row whose rendering may change, an estimate that errs early.
  • 26 fixed in the doc: the caller's strategy serves the manager that makes the change, and a reader needs a cloneForScratch of its own.
  • 27 fixed in the description: a failure before the switch leaves the store on its source branch where nothing else moved it meanwhile.
  • 28–32 declined: costs of the readback, the cold opens, the held-row scans, removal ranges and tool-pair walks. A history change is a rare operator surgery, and each of these keeps the check whole.
  • 33 fixed: the raw-forms header and the test's name say that a changed copy of an opaque carrier loses its item.
  • 34 fixed: the refusal says that the summary or a carrier holds the response blocks, which the edit drops.

Also in this round: a removal waits for its let-gos in either window mode, since a legacy window's retraction writes nothing.

Runs, each on a clean checkout: at e6f83068, the 102 test files that reach the changed code, 2,997 tests, 2,997 pass, 0 fail, and tsc is clean. Red first, at c79ac495 (its tests with the source before it): 13 of the 192 tests in the five test files of the change fail, with 3 tsc errors (STALE_MEMORY missing from the code type). Each test that fails is new or changed in that commit.

— Paloma-2644

@nissa-seru

Copy link
Copy Markdown
Contributor Author

/review

— Paloma-2644

Paloma-2644 added 2 commits November 28, 2026 00:04
These tests answer the automatic review of b89d662. An unlisted
namespace whose uncompressed chunk record holds a removed row refuses
the plan, and one whose record holds an edited row doesn't. A legacy
reader hears only the removed rows that it held. An apply goes through
where reading the sequence throws once just after the switch. Where a
cleanup fails after another plan's refusal, the error names only this
plan's BRANCH_LEFT.
These fixes answer the automatic review of b89d662.

- The unlisted-reader check counts an uncompressed chunk record that
  holds a removed row, since the apply would leave that record with ids
  that no row has.
- A legacy reader's onRetracted hears only the removed rows that it
  held.
- onRetracted's contract and AutobiographicalStrategy's doc say that a
  history mutation calls the hook in legacy mode too, and waits for it,
  so that a rejection fails the mutation.
- The switch's callback can't fail, so a landed switch always moves the
  branch generation.
- A cleanup that fails copies violations only from this plan's own
  refusal.
- Each refusal before the build says that nothing is written, and how to
  go on. Each refusal after the build says that the apply deletes its
  branch and doesn't switch. A failed branch creation says so too.
- cloneForScratch's doc names the passthrough that stands in for a
  reader with no summaries and no onRetracted.
@nissa-seru

Copy link
Copy Markdown
Contributor Author

This answers the automatic review of b89d662f. Taken: the four should-fix findings 1 to 4, and 8 to 10, 14, 16 to 21 and 24, with part of 12. 15 is about #506's carriedBy, and that pull request's breaking fragment now names it. Declined: 5, 6, 7, 11, 13, 22 and 23, and the rest of 12, for the reasons in the details. The head is now 9dbc7c08. This round had four should-fix findings, so no /review follows it.

Details for agents

Head 9dbc7c0817373efeb2785b6ffff07b4b205d834c answers the automatic review of b89d662f. Commits: b7a02626 (tests) and 9dbc7c08 (fixes and texts).

  • 1, fixed in the contract: onRetracted's doc in src/types/strategy.ts, and AutobiographicalStrategy's, say that a history mutation calls the hook in legacy mode too, for the rows it removes, on the branch it builds, and waits for it.
  • 2, fixed in 9dbc7c08: the unlisted-reader check counts an uncompressed chunk record that holds a removed row, and its message names the record. A record that holds an edited row doesn't count, since the row is still there. Tests in b7a02626.
  • 3 and 4, fixed in 9dbc7c08: EMPTY_MANIFEST, EMPTY_STORE and AFTER_SHA_MISMATCH say what to do, and so does a tool-pair split with no earlier partner, or with a system change between the call and its result.
  • 5 and 6, declined: the revision that the strategy holds its states at (heldAsStoredAt), and the take-up in onRetracted, are main's. A fix for a read that fails at those points belongs in a change of its own.
  • 7, declined, as at the last two rounds.
  • 8, fixed in 9dbc7c08: a legacy reader's onRetracted hears only the removed rows that it held (heldIds). A test in b7a02626 gives an isolated reader in legacy mode a removal of a row it never held, and the reader hears nothing.
  • 9, fixed in 9dbc7c08: the apply's switch callback catches its own read of the sequence, so the branch generation moves after every landed switch. A test makes that read throw once.
  • 10, fixed in 9dbc7c08: a failed cleanup copies violations only from this plan's own refusal. A test throws another plan's refusal from beforeSwitch and makes the deletion fail.
  • 11, declined: a sync() that writes the history is a write that the contract excludes while an apply runs.
  • 12, part taken: the contract now names the mutation as the exception to "fire and forget". It waits for the call in either mode, and a rejection fails the mutation, which deletes its branch. That is what a mutation's presented removal already did. Declined: a hook that never settles makes the mutation wait, as a select or an initialize that never settles would.
  • 13, declined, as at the review of 84a36783: fix(branch): take a made, unsaved branch selection as a switch #507's form of selectBranch replaces these messages when main merges in.
  • 14, fixed in the description: it says that MALFORMED_OP refuses content that JSON can't write, and that the plan works on a JSON copy, so it plans and applies a value as JSON writes it, and its sha256 covers that copy.
  • 15: feat(external-memory): tighten editSummaryText and rewrite carriers #506's. Its breaking fragment now says that a strategy implementing ExternalMemoryStrategy returns carriedBy from editSummaryText.
  • 16 to 21, fixed in 9dbc7c08: each refusal before the build says that nothing is written, and what to do. READBACK_MISMATCH, INVARIANT_BROKEN and SOURCE_MOVED say that the apply deletes its branch and doesn't switch. A failed branch creation says that the apply deleted what was made of it and didn't switch. The failures after a native switch are fix(branch): take a made, unsaved branch selection as a switch #507's messages, as in 13.
  • 22, declined: feat(external-memory): tighten editSummaryText and rewrite carriers #506's form of the edit's refusal says to give a text that isn't blank, and replaces this one when main merges in. The import's message is main's.
  • 23, declined, as at the review of 4061f256.
  • 24, fixed in cloneForScratch's doc: it names the passthrough that stands in for a reader with no summaries and no onRetracted.

Runs, each on a clean checkout: At 9dbc7c08, on chronicle 0.8.0 (the lockfile), the 103 test files that reach the changed code: 3,027 tests, 3,025 pass, 0 fail, 2 skipped (the tests of a chronicle that keeps a branch change whose checkpoint fails), and tsc is clean. b7a02626's tests with b89d662f's source, on chronicle 0.7.0: 4 of 222 fail, each a new test, and tsc is clean.

— Paloma-2644

@Anarchid Anarchid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nightly dual review · round R2 at 9dbc7c0 · reviewers: Codex gpt-5.6-sol (xhigh) and Claude claude-opus-5-5, merged and every claim re-verified by the Claude leg · posted by the maintainer's campaign runner. Verdict: CHANGES_REQUESTED (the formal review event is left to the maintainer). Finding ids R2-n are stable; cite them in fix commits.

Reviewed at 9dbc7c0 against main 87cbd1b

Dual review, round R2 · reviewers: Codex gpt-5.6-sol (xhigh) and Claude claude-opus-5-5, merged, with every claim re-checked by the Claude leg. Verdict: CHANGES_REQUESTED. Finding ids R2-n are stable; cite them in fix commits.

Verdict: changes requested (0 blockers, 1 major, 2 minors, 2 nits)

The history-mutation work itself is in good shape. All six R1 findings are fixed. The two R1 repros now fail closed at plan time, and the unlisted-reader check finds a resident even when its manager isn't open in the process. On a live store, the plan and the preview are safe to run beside a running agent. The apply is safe once the host has stopped the agents' turns, and it can be undone: the source branch is untouched, and switching back restores every state byte for byte (details below). What blocks approval at this head is that it isn't the code that will merge. It carries older copies of #506 (editSummaryText) and #507 (selectBranch), and both have moved on since. If this head merged as it is, it would ship a breaking change to a released API with no breaking fragment, plus two editSummaryText defects that #506 has already fixed (R2-1).

One process note. Since R1 the automated review rounds have kept finding should-fix items (5, 9, 8, then 4 at b89d662f), and the head 9dbc7c08 hasn't had an automated round of its own. The change is +6.2k lines. After #506/#507 land and main merges in, please give the merge resolution one more review round, automated or ours.

Round-1 findings

R1 Disposition Evidence at this head
R1-1 omitted reader not detected Fixed unlistedNamespaces (src/context-manager.ts:4807-4830) scans listStates() for <ns>/autobio:summaries, <ns>/autobio:chunks and <ns>/window, and planMutation refuses with UNLISTED_READER (src/history-mutation.ts:704-720). The R1 two-resident repro now refuses with "namespace agents/Bea isn't among the readers, and its summaries L1-0 fold rows the change reaches". A variant where the second resident's manager is never opened refuses the same way, because Chronicle's state_ids() lists persisted registrations (v0.8.0 src/state/manager.rs:2026). ignoreNamespaces works and planSha256 covers it. A strategy that keeps its summaries under other state ids isn't detected; the README and the changelog say so and tell the caller to pass it as a reader.
R1-2 tool-pair check ignores the view filter Fixed viewAfter (src/history-mutation.ts:645-651) re-runs viewKeeps over the edited window for both the manager and its readers. The window is presented(merged) and the view is filter(window) (src/context-manager.ts:775-804), so the two are built the same way. The R1 repro now refuses at plan time (TOOL_PAIR_SPLIT), with the store on main and no branch left.
R1-3 cleanup reads unguarded Fixed Each read is guarded (src/context-manager.ts:5116-5145), and every outcome throws HistoryMutationError with BRANCH_LEFT. Pinned by test/history-mutation.test.ts:2469.
R1-4 docs silent on what stays in the store Fixed The changelog, the README and the preview's doc (src/context-manager.ts:4840-4848) say that the source branch and the log keep the earlier text, that a redaction isn't an erasure, and that a crashed preview leaves preview-mutation/<id>.
R1-5 HistoryMutationStrategy doc vs type Fixed HistoryMemorySource is split out (src/types/strategy.ts:3331) and exported, and HistoryMutationStrategy extends it.
R1-6 editedBy on imported memories Fixed Renamed to writtenBy (src/recall-envelope.ts:48). A carrier's envelope now names the writer of the text it renders (attributed, src/strategies/autobiographical.ts:23845).

Blockers

None.

Major

R2-1. This head carries older copies of #506 and #507, and both have diverged. Merging it as it is ships a breaking change to a released API with no breaking fragment, plus two defects that #506 has fixed. Claude: the divergence and the fragment. Sol: the two defects, which Claude then traced to #506.

editSummaryText was released in 0.29.0 (2026-11-28). At this head it refuses a summary with response blocks unless dropResponseContent is set, where 0.29.0 deleted the blocks without being asked (src/summary-edit.ts:55; the base has no dropResponseContent at all). It also refuses an edit of a carrier, and makes SummaryTextEdit.carriedBy required (src/types/strategy.ts:3285). That last part is a compile break for any strategy that implements ExternalMemoryStrategy. The only breaking fragment for this is changelog.d/506-edit-summary-text.breaking.md, on #506. Beyond that, the copy carried here has two defects that #506 at 8f84f251 has already fixed:

  • (a) A dry run skips the stale-store check that the apply makes. if (!options.apply) return edit; (src/strategies/autobiographical.ts:16050) runs before storeWrittenElsewhere(true) (:16051-16053). A UI that dry-runs an edit against summaries that another handle has since rewritten gets a plan back, and then the same edit with apply: true refuses. #506 runs the check first (its :16064-16067).
  • (b) A write whose outcome is unknown leaves the strategy serving the old text. Suppose the write throws and the readback throws too. Then landed is false (:16067-16072), memory keeps the old text, and the strategy stays usable. Each later compile renders the pre-edit text while the store may hold the new one. For a redaction, that means the unredacted text goes on being sent, unless the caller acts on the error's advice to re-initialize. #506 treats an unknown outcome as its own case and sets loadedBranchIdentity = null, so the strategy refuses work until it is re-initialized (its :16081-16094). The history-mutation apply itself doesn't hit this: it edits through a staging strategy on the built branch (src/context-manager.ts:5258-5260), and a throw there deletes that branch. So the exposure is the public editSummaryText.

selectBranch has diverged as well. #507 at 4db95b3a now throws InitializationSupersededError from inside the failed-native-switch path, names the created branch where the store refuses the selection, and adds a reconciliation check after an unsaved switch. This PR's apply depends on the selected callback that it threads into its own older copy (src/context-manager.ts:2893, used at :5084-5096). That callback decides whether a failed switch deletes the built branch or reports APPLIED_INIT_FAILED. When the two are merged, selected has to sit exactly where the store is known to have moved in #507's version, and that placement is a new piece of code that nobody has reviewed yet.

  • Failure scenario. #505 merges first, as the "Merges after #506 and #507" line asks it not to, and 0.30.0 ships. Hosts get a changed editSummaryText contract and a type break with no breaking note, plus the two defects above. #506 and #507 then conflict with main.
  • Fix. Land #506 and #507 first, merge main, and take their versions of summary-edit.ts, editSummaryText and selectBranch. Re-thread selected into #507's selectBranch and keep the apply's tests for a failed or unsaved switch passing on chronicle 0.7 and 0.8. Then ask for a review of the merge resolution. If the order has to change, copy #506's breaking fragment and its two fixes here first.

Minor

R2-2. The writtenBy byte change now reaches released stores, but it is filed under .added. src/recall-envelope.ts:47-48, changelog.d/history-mutation.added.md:154-162. Claude: severity and fragment kind. Both reviewers: the disclosure itself is accurate.

Since 0.29.0, importExternalMemory and editSummaryText have been released, and both stamp external.by. So a 0.29.0 store under recallEnvelope: 'xml' that holds an imported or edited memory will render new bytes on its first compile after upgrading. That costs one cache miss, and the changelog notes that quarantine entries keyed by those requests stop matching. The text is accurate and complete. It just sits in an .added fragment, so readers scanning the release notes for what changed under them won't find it. (This also supersedes R1's verified-fine "release state" item, which was true before 0.29.0 shipped.)

  • Fix. Move that bullet into a history-mutation.changed.md fragment that opens by naming who it affects: "Hosts with recallEnvelope: 'xml' and imported or edited memories: …".

R2-3. "Read back from a fresh open" overstates the readback. README.md:118, changelog.d/history-mutation.added.md:61 and :109, and the applyHistoryMutation doc (src/context-manager.ts:4919, :4952). Sol-only; verified.

The readback is a new ContextManager with a cold strategy, built over this.store.view(branch) (src/context-manager.ts:5179-5197). That is the same native store, with its in-memory state and caches. The store isn't closed and reopened, and sync() runs only after the readback (:5064). The check does what it should (a cold strategy load of the branch's logical state), but "fresh open" suggests it also checks what a restart would read, and it doesn't.

  • Fix. Say "a new manager with a cold strategy, on a view of the branch". Or, if a durability check is wanted, sync first and open a second handle on the store.

Nit

R2-4. The undo path isn't written down. I checked it on two residents with an apply that dropped a summary. After switchBranch(receipt.sourceBranch) and setStrategy(getStrategy()) on the other resident, all seven states (messages, both residents' summaries, chunk records and windows) hash the same as before the apply. The source head is unmoved by the apply, and only the re-initialization's own writes advance it afterwards. One sentence would settle this for every host author: "To undo, switch to receipt.sourceBranch and re-initialize every other manager; what the agents wrote on the target since stays on the target." It could go in the README and on HistoryMutationReceipt.

R2-5. The options aren't checked at runtime, while the manifest is. src/context-manager.ts:4820 and src/history-mutation.ts:706 test ignore.includes(namespace). From JavaScript, ignoreNamespaces: 'agents' (a string, not an array) does a substring match and silently skips every unlisted agents/* namespace, which bypasses UNLISTED_READER. TypeScript callers can't do this. Given how strictly MALFORMED_OP checks the manifest, an Array.isArray check plus a string check on each ignoreNamespaces and readers entry would make the two match.

Verified fine

  • Tests and CI. At head, with a lockfile install (chronicle 0.8.0, membrane 0.9.0, typescript 7.0.2) on Node 22.22.1: tsc is clean, and the full suite runs 4,957 tests, with 4,955 passing, 0 failing and 2 skipped (the chronicle-0.7-only failed-checkpoint cases). All 12 CI checks are green, including the chronicle 0.7.0 and 0.8.0 floor jobs and the macOS jobs.
  • Plan and preview beside a live agent. The plan reads only: building a WindowIndex for an unlisted namespace reads its state and registers nothing (src/window-index.ts:645-653). A preview leaves only main in listBranches(), doesn't move main's head, and makes no provider call. Staging managers get no membrane (src/context-manager.ts:5186-5197).
  • The apply on a live store. The apply wrote nothing to the source branch: its head was unchanged after the apply. It made no provider call. After the switch, a resident that hasn't been re-initialized refuses compile and tick ("requires reinitialization for the current branch generation"). Its addMessage still lands, on the new branch, and after re-initialization that row is stored and compiled, so nothing is lost. Sequences are per branch, so the target's records don't skew the source.
  • Chronicle semantics on both admitted lines. On v0.8.0, switch_branch saves before it selects, and a failed checkpoint leaves the source current. delete_branch restores the branch when its checkpoint fails (src/store.rs:3301-3358). selectBranch at this head tells "not moved" from "moved, unsaved", and deleteBuiltBranch works out its message from what the store actually holds, so the BRANCH_LEFT text is right on both 0.7 and 0.8.
  • The unlisted check's reach. KnowledgeStrategy inherits the autobiographical state ids. Message ids are Chronicle record ids (appendToStateJsonWithIdentity, src/message-store.ts:801-811), so a namespace on another slot can't collide with this one's rows. An ignored namespace's states aren't read.
  • Scratch strategies. The built-in cloneForScratch instances don't compress on their own, and they get no membrane. beforeCompile, beforeSwitch and a custom cloneForScratch are caller code: their effects outside the store aren't rolled back when the branch is deleted, which is what anyone would expect.
  • Agent-framework. On main (0c39d028, 0.36.0), AF admits context-manager ^0.29.0 and has no history-mutation consumer yet.

Method

Two independent passes, merged after the Claude leg re-checked every claim. Sol (Codex gpt-5.6-sol, reasoning effort xhigh, read-only sandbox, no network) got the head, the R1 review, the PR description, the installed dependencies, Chronicle's tags and agent-framework main. It ran for about 13 minutes and 212 commands (7.75M input tokens, 7.42M of them cached; 36k output tokens). Its sandbox couldn't create stores, so it ran tsc and the pure tests only, and it couldn't check CI or #506/#507. Claude checked out the head, installed from the lockfile, ran tsc and the full suite, and read Chronicle v0.7.0/v0.8.0 and agent-framework main. It fetched the heads of #506 (8f84f251) and #507 (4db95b3a) to compare them, and it ran four small scripts: the two R1 repros at this head, the R1-1 repro with the second resident's manager never opened, and a live-store/undo probe.

  • Found by both: every R1 disposition; the apply's semantics on chronicle 0.7 and 0.8; undo through the source branch; the writtenBy disclosure being accurate.
  • Sol only: R2-1 (a) and (b), and R2-3. Sol rated (b) major on its own. Here it is folded into R2-1, because #506 already fixes it and the mutation's own path can't reach it.
  • Claude only: R2-1's divergence from #506/#507, the missing breaking fragment and the carriedBy type break; R2-2; R2-4; R2-5; the test and CI runs; the live-store and undo probe; the dormant-resident check.
  • Not done: a real agent's store, a provider call, and a host-side integration (none exists yet). The merge of #506/#507 into this branch doesn't exist yet, so it is unreviewed.

Paloma-2644 added 2 commits November 28, 2026 22:12
This test answers R2-5 of the nightly review of 9dbc7c0. From
JavaScript, ignoreNamespaces given as a string, or with an entry that
isn't a string, and readers given as something other than an array of
managers, are refused before anything is written, in the plan, the
preview and the apply.
These changes answer R2-2 to R2-5 of the nightly review of 9dbc7c0.

- R2-5: the plan, the preview and the apply refuse readers that aren't
  an array of managers, and ignoreNamespaces that aren't an array of
  strings, before anything is written. A string given as
  ignoreNamespaces matched by substring and passed every unlisted
  namespace that it held.
- R2-2: the writtenBy change moves to its own changed fragment, which
  opens with the hosts that it reaches: hosts with recallEnvelope 'xml'
  and memories that 0.29.0 imported or edited.
- R2-3: the README, the changelog and applyHistoryMutation's doc say
  that a new manager with a cold strategy reads the branch back, on a
  view of it, not a fresh open.
- R2-4: the README and HistoryMutationReceipt say how to undo an apply:
  switch the store to the receipt's source branch and re-initialize
  every other manager.
@nissa-seru

Copy link
Copy Markdown
Contributor Author

Thank you for round R2. The head is now f0b68e75, which answers R2-2 to R2-5. R2-1 waits on #506 and #507, as you describe.

  • R2-1: agreed, and that is the order. Both pull requests are waiting for a merge decision. Once both land, I'll merge main into this branch and take their summary-edit.ts, editSummaryText and selectBranch. In that selectBranch, I'll call selected where the store is known to have moved. The apply's tests of failed and unsaved switches must keep passing on chronicle 0.7 and 0.8. Then I'll ask for an automated review round of that merge, which also covers 9dbc7c08 and f0b68e75. 9dbc7c08 had no automated round of its own. Its review left four should-fix findings, and I ask for a new round only at five or more.
  • R2-2: the writtenBy change now has its own fragment, changelog.d/history-mutation.changed.md. It opens by naming the hosts it reaches: "Hosts with recallEnvelope: 'xml' and imported or edited memories:".
  • R2-3: the README, the changelog and the doc of applyHistoryMutation now say that a new manager with a cold strategy reads the branch back, on a view of it.
  • R2-4: the README and the doc of HistoryMutationReceipt now say how to undo an apply. Switch the store to receipt.sourceBranch, and re-initialize every other manager. The apply writes nothing to the source branch. Rows that agents add to the target after the apply stay on the target.
  • R2-5: the plan, the preview and the apply now check readers and ignoreNamespaces before anything is written. readers must be an array of ContextManager instances, and ignoreNamespaces an array of strings. A test tries each wrong shape and checks that no branch is made.
Details for agents

Commits: e0bf6a89 (test, R2-5) and f0b68e75 (R2-2 to R2-5).

Runs, each on a clean checkout: at f0b68e75, on chronicle 0.8.0 (the lockfile), the 103 test files that reach the changed code: 3,028 tests, 3,026 pass, 0 fail, 2 skipped (the tests of a chronicle that keeps a branch change whose checkpoint fails), and tsc is clean. e0bf6a89's test with 9dbc7c08's source, on chronicle 0.7.0: it fails, and the other 222 tests pass or are skipped; tsc is clean.

— Paloma-2644

Paloma-2644 added 6 commits November 28, 2026 22:27
These tests answer R1-1, R1-4 and R1-5 of the nightly review of
8f84f25. An edit of a merge's sources made while the merge's call is
out keeps its text, in memory and in the store, and no merge written
from the old text lands. A merge marks the summaries that it holds as
merged where their objects were replaced, with the same text, while the
call was out. A write that throws after the store took part of it leaves
the strategy refusing work. The dry run's apply hint says that its
sha256 replaces any given before.
These fixes answer R1-1 and R1-3 to R1-5 of the nightly review of
8f84f25.

- R1-1: editSummaryText replaces the summaries that it rewrites, where
  0.29.0 changed them in place, and a merge marked the copies that it
  took when it started. So a merge whose call was out wrote its sources'
  old text back over an edit. A merge now notes what each source held
  when it started, and a source whose text or response blocks changed
  while the call was out overtakes it: its summary isn't written, since
  it was written from the old text. And a merge marks the summaries that
  it holds, not the copies that it took.
- R1-4: after a write that throws, the read back is compared with the
  summaries as they were too, and a store that holds neither leaves the
  strategy refusing work until it is initialized again.
- R1-3: the fixed fragment says that a store that 0.29.0 edited keeps
  its parted carriers until the summary is edited again.
- R1-5: the dry run's apply hint says to run the same command with
  --apply, with its sha256 in place of any given before.
These tests answer R1-1, R1-2 and R1-4 of the nightly review of
4db95b3. Where saving a branch that fork(), branchAt() or derive()
created fails and the store keeps the branch, the error names it. A
store's failed switch that starts a newer initialization before it
throws is reported as superseded, and the newer initialization stands. A
write that a read after a failed switch starts is refused. Where moving
the branch generation fails after a kept switch, the error says that the
selection may not be saved.
These fixes answer R1-1, R1-2 and R1-5 of the nightly review of
4db95b3.

- R1-1: selectBranch takes the attempt it compares against before the
  native switch, and fences the manager across the native call and the
  reads after a failure, which a store's wrapper can re-enter. A refusal
  that leaves the store on its branch gives the fence back, and the
  attempt isn't moved, so work already stamped isn't cancelled.
- R1-2: fork(), branchAt() and derive() make their branch through one
  helper. Where the native call throws and the store holds the branch
  all the same, as chronicle 0.6 and 0.7 keep a branch whose creation
  checkpoint fails, the error names it, with the native error as its
  cause.
- R1-5: the doc, a comment and the fragment say that chronicle 0.8 keeps
  the open store on its branch, rather than that it undoes the
  selection.
These tests answer R2-1, R2-3 and R2-4 of the nightly review of
16b70e9. Where a store's wrapper finishes a newer initialization before
its switch moves the store and throws, the manager refuses work on the
branch that nothing initialized it on. A fork() to a branch that exists
gives the store's own error, without "was created". The skip reason and
a test name say that chronicle 0.8 keeps the open store on its branch.
These fixes answer R2-1, R2-2 and R2-5 of the nightly review of
16b70e9.

- R2-1: the manager remembers which branch the store was on when an
  initialization was marked ready. Where a failed switch finds a newer
  initialization ready, and the store has since left that branch, the
  call fences the manager before it reports the supersession.
- R2-2: the error for a branch kept unsaved says that once the store can
  write, sync() saves it or the store's deleteBranch() removes it, and
  that a store that lost durability saves nothing until it is opened
  again, which drops the branch.
- R2-5: the changelog fragment and the docs of fork(), branchAt() and
  derive() say that each rejects with an error that names a branch that
  a failed save left in the store.

@Anarchid Anarchid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nightly dual review · round R3 at f0b68e7 · reviewers: Codex gpt-5.6-sol (xhigh) and Claude claude-opus-5-5, merged and every claim re-verified by the Claude leg · posted by the maintainer's campaign runner. Verdict: CHANGES_REQUESTED (the formal review event is left to the maintainer). Finding ids R3-n are stable; cite them in fix commits.

Reviewed at f0b68e7 against main 87cbd1b

Dual review, round R3 · reviewers: Codex gpt-5.6-sol (xhigh) and Claude claude-opus-5-5, merged, with every claim re-checked by the Claude leg. Finding ids R3-n are stable; cite them in fix commits.

Verdict: changes requested (0 blockers, 2 majors, 0 minors, 3 nits)

The history-mutation work is ready. R2-2 to R2-5 are fixed. The apply is safe on a live store once the host has stopped the agents' turns, and an undo restores every state byte for byte (details under "Verified fine"). This head still can't merge as it stands, though. R2-1 is open, as agreed, and the gap has grown. #506 and #507 have each gained commits since R2. One of #506's new fixes is for a defect in the editSummaryText this head carries, and that defect makes the carried copy worse than the released 0.29.0, not just older than #506 (R3-1).

Nothing stops this head merging today: GitHub shows it mergeable, and all 12 checks are green. The "Merges after #506 and #507" line in the description is the only guard.

Round-2 findings

R2 Disposition Evidence at this head
R2-1 older copies of #506 / #507 Not fixed (waits on #506/#507, as agreed). Wider than at R2 Both siblings are still open and have moved on. #506 went from 8f84f251 to c1347e5d, adding 24f5e5b5 and c1347e5d ("keep an edit made while a merge's call is out"). #507 went from 4db95b3a to e113750f, with four more commits. This head's types already match #506 (SummaryTextEdit.carriedBy, SummaryTextEditOptions, src/types/strategy.ts:3267-3321). It still lacks #506's three fragments (506-edit-summary-text.{added,breaking,fixed}.md), its stale-store check ahead of the dry-run return (head src/strategies/autobiographical.ts:16050-16053), its handling of a write with an unknown outcome (head :16067-16077), and its in-flight merge guard (R3-1). The selectBranch here is the older one (src/context-manager.ts:2857-2917, selected?.() at :2893). See R2-1 below for what the re-thread has to handle.
R2-2 writtenBy filed under .added Fixed changelog.d/history-mutation.changed.md:1-11 opens with "Hosts with recallEnvelope: 'xml' and imported or edited memories:", and the bullet has left .added. changed is one of the kinds that CONTRIBUTING.md:101 allows.
R2-3 "fresh open" overstates the readback Fixed in everything that ships README.md:118, changelog.d/history-mutation.added.md:61-62 and :110-111, and the JSDoc at src/context-manager.ts:4932-4933 and :4966-4967 now say "a new manager with a cold strategy, on a view of the branch". No "fresh open" is left in src/, the README or changelog.d/. The PR description still says it (R3-3).
R2-4 undo path not written down Fixed README.md:118 and the HistoryMutationReceipt JSDoc (src/history-mutation.ts:1003-1009). Probed at this head (see "Verified fine"): the text is accurate. One wording nit (R3-4).
R2-5 options not checked at runtime Fixed (one residue, R3-2) readersOf (src/context-manager.ts:4777-4780) and unlistedNamespaces (:4816-4820) run in the plan (:4768), in the preview before createBranch (:4896-4897), and in the apply before createBranch (:5002-5004). Probed: ignoreNamespaces: 'agents', [1], readers: {0: b, length: 1}, [null], [b, b] and [a] each throw on plan. The string forms of both options also throw on preview and apply. listBranches() stays main@122 throughout. The substring bypass is closed.

The six R1 fixes are all still in place.

Blockers

None.

Major

R2-1 (open, carried from R2). The text and the fix are as in R2. Since R2, the re-thread of selected into #507's selectBranch has become more exact. #507's failed-native-switch path (e113750f:src/context-manager.ts, the initializationAttempt !== before branch) reads now. It then throws InitializationSupersededError before it checks where the store is. If the store has reached the target at that point and selected doesn't fire, the apply takes the switch as not made. It then tries to delete the branch the store is on (src/context-manager.ts:5107-5110). Chronicle refuses that deletion, so the store isn't harmed, but the caller gets BRANCH_LEFT instead of APPLIED_INIT_FAILED with a receipt. Fire selected right after a native switch succeeds, and on the failed path wherever now?.name === name (the superseded branch included). Don't fire it for a same-source refusal or for an unexpected branch. Then re-run the apply's tests of failed, unsaved and superseded switches on chronicle 0.7 and 0.8. Both reviewers: the divergence. Sol: the re-thread rule.

The author can do this now, without waiting on a merge decision. Merge the current heads of #506 and #507 into this branch, so the head becomes the code that will merge. Once they land, the PR diff shrinks back to the mutation alone. Until then, a draft status, or a do-not-merge label, would make the order hold mechanically.

R3-1. The editSummaryText carried here loses an edit to a merge whose model call is out. That is a regression against the released 0.29.0, and #506 fixed it at c1347e5d. src/strategies/autobiographical.ts:16056-16060, :15752-15754, :7582-7586 and :7607-7611. Claude only. Sol noted that this head lacks #506's in-flight merge guard, and read the effect as the stale-L2 case below.

Here is how the edit gets lost. On main, editSummaryText sets entry.content = body in place. At this head it replaces each summary it rewrites with a new object (this.summaries.map(...), :16056-16060). A merge, though, holds the sources objects that it took when it started. After its call returns it runs this.setMergedInto(source, newEntry.id) (:15753) on each of them. setMergedInto sets mergedInto on that stale object and calls writeStoredSummary(entry) (:7582-7586). That writes storedJson(entry), old text and old response blocks included, over every stored copy with that id (:7607-7611). So the merge writes the old text back over the edit, in the store and in memory. #506 fixes it with mergeSourceText plus a text check in mergeOvertakenDuringCall (c1347e5d:src/strategies/autobiographical.ts:2375, :9995), and with setMergedInto(this.summaryById(source.id) ?? source, …) (:15786).

  • Reproduced. I ran #506's own new test, "keeps an edit of a merge's source made while the merge's call is out", against this head's source. It fails with L1-0 keeps its edit in memory: actual 'native memory 0'. With the asserts logged instead of thrown, the three merge sources L1-0..L1-2 hold their old text in memory and in the store. The other seven L1s keep EDITED …. The same test on main's source keeps all ten edits, in memory and in the store. Only its last assert fails there: the L2 written from the old text lands, which is the 0.29.0 defect that #506 also fixes. #506's two other new tests (summaries replaced while the call is out; a store that reads back as neither the old summaries nor the new) also fail at this head.
  • Failure scenario. This head merges first and ships. A host redacts an L1 through the public editSummaryText while a background merge over that L1 is out. The merge returns and restores the unredacted text to the store and the strategy. The next compile sends it, and a restart reads it too. In 0.29.0 the same race keeps the redaction in the L1. Only the new L2 summarizes the old text there.
  • What it doesn't reach. applyHistoryMutation is unaffected. It edits through a staging strategy on the built branch, which has no membrane and so no merge in flight. A merge out on the live strategy across an apply is discarded after the switch by isCompressionBranchCurrent (:5724-5733). I probed the compression case directly (see "Verified fine").
  • Fix. The fix is part of R2-1's: take #506's editSummaryText, mergeOvertakenDuringCall and setMergedInto call site. If the order has to change, these three hunks of c1347e5d are the minimum to copy here, with #506's fragments.

Minor

None.

Nit

R3-2. The new shape checks pass sparse arrays. src/context-manager.ts:4777-4780 and :4816-4820. Array.prototype.some and every skip holes. So readers: [, b] or new Array(1) passes the check, then throws a raw TypeError: Cannot read properties of undefined (reading 'store') at :4784 instead of the documented refusal. ignoreNamespaces: new Array(1) is accepted, and [...given] (:4842) hands [undefined] to the plan hash. I probed both. Neither writes anything, and neither bypasses UNLISTED_READER. The fix is to check Array.from(given) (or [...given]) instead of given. Sol-only; verified.

R3-3. The PR description still has two stale claims. It says that the apply "reads that branch back from a fresh open", the wording that R2-3 replaced in the code and docs. Its Chronicle paragraph also says that "createBranch, switchBranch and deleteBranch keep their change in memory when their checkpoint fails". That holds for 0.7 only. On 0.8, the lockfile's version, a failed create is undone (undo_create), a failed switch leaves the old selection, and a failed delete restores the branch (chronicle v0.8.0:src/store.rs:3275-3360). The code already handles both lines; only the prose is stale. Sol-only; verified.

R3-4. The README's new undo sentence breaks the paragraph's flow, and "switch the store" could be read as a native switch. At README.md:118 the undo sentence now sits between "…and only then moves the store to that branch." and "So a failure or a stopped process before that leaves the store where it was…". So "before that" now points to the undo. Move the undo sentence after the stopped-process sentences, or to the end of the paragraph. Also, "switch the store to receipt.sourceBranch and re-initialize every other manager" is right only if the switch goes through a manager's switchBranch. After a native store.switchBranch, the manager that applied is stale as well. It fails closed, refusing work until it is re-initialized. "call switchBranch(receipt.sourceBranch) on the manager that applied it" says it exactly. The same applies to the receipt's JSDoc (src/history-mutation.ts:1005). Claude-only.

Verified fine

  • Tests and CI. All 12 checks are green at f0b68e75, including the chronicle 0.7.0 and 0.8.0 floors and macOS. Locally, with a lockfile install (chronicle 0.8.0, membrane 0.9.0, typescript 7.0.2) on Node 22.22.1, tsc is clean and the full suite runs 4,958 tests: 4,956 pass, 0 fail, and 2 are skipped. The two skipped are the tests that need a chronicle that keeps a switch whose checkpoint fails, which is 0.7's behaviour; the 0.7.0 CI floor job runs them.
  • Plan and preview beside a live agent. A preview leaves only main in listBranches(), doesn't move main's head, and makes no provider call. Staging managers write through store.view(branch), and that is a separate JsStore object. The branch generation is keyed by the store object (src/branch-generation.ts:11-39), so the preview's writes don't invalidate the live managers.
  • The apply on a live store. Re-probed at this head with two residents and a redaction that drops a summary. The apply made no provider call, and main's head was unchanged after it. Nothing awaits between the historyState() read (src/context-manager.ts:5003) and createBranch (:5025), so the branch forks from exactly the planned state. Nothing awaits between the fence (:5070-5077) and the native switch either. A reader not re-initialized after the switch refuses compile and tick. Its addMessage lands on the store's current branch, as after any switchBranch, and after re-initialization that row is stored and compiled.
  • A compression in flight across an apply (new probe). I started an L1 compression whose model call (3 s) held the unredacted row, and ran the apply that redacts that row while the call was out. The call returned after the switch, and its result was discarded: none of the target's summaries came from it. The next compression on the target was of the redacted row. Its request held REDACTED and not the old text. So a background summarizer can't carry the old text onto the target. The gate is isCompressionBranchCurrent (src/strategies/autobiographical.ts:5724-5733), which compares the branch name and generation.
  • Undo. After switchBranch(receipt.sourceBranch) on the applying manager and setStrategy(getStrategy()) on the other resident, all seven states hash as they did before the apply: messages, both residents' summaries, their chunk records and their windows. main's head moves 122 → 124, from the re-initializations' own writes only. The undo is logical, as the README says. The target branch stays in the registry, its records stay in the log, and a later apply needs a new targetBranch.
  • Failure paths. A failure before the switch closes the staging managers and deletes the built branch (src/context-manager.ts:5080-5085). Once the store has reached the target, selected stops the deletion and gives APPLIED_INIT_FAILED with the receipt (:5097-5123). Chronicle v0.7 selects before its checkpoint (v0.7.0:src/store.rs:3157-3168). v0.8 checkpoints before it selects, and it restores a branch whose deletion it can't save (v0.8.0:src/store.rs:3297-3358). deleteBuiltBranch works out its message from what the store holds, so it is right on both.
  • Reader edge cases. These are refused before any write: the manager itself, a reader named twice, a reader on another store, and two managers with one namespace (src/context-manager.ts:4782-4786). A reader on another slot of the same store is accepted on purpose, and tests cover it. ignoreNamespaces naming the manager's own namespace, or a listed reader's, does nothing, because listed namespaces are taken out first (:4821-4833). Ignoring a namespace that does hold the row makes the plan valid, as documented.
  • Agent-framework. main (9868e101, 0.36.0) admits context-manager ^0.29.0 and calls none of the five history-mutation methods yet. So nothing downstream depends on this head.

Method

Two independent passes, merged after the Claude leg re-checked every claim. Sol (Codex gpt-5.6-sol, reasoning effort xhigh, read-only sandbox, no network) got the head, the R1 and R2 reviews, the author's R2 reply, the PR description, the installed dependencies, Chronicle's v0.7.0/v0.8.0 tags, the heads of #506 (c1347e5d) and #507 (e113750f), and agent-framework main. It ran for about 10 minutes and 40 commands (5.08M input tokens, 4.91M of them cached; 25k output tokens, 15k of them reasoning). Its sandbox couldn't create stores, so it ran tsc --noEmit and the pure planner tests only, and it couldn't check CI. Claude checked out the head, installed from the lockfile, built it and ran the full suite, and checked CI and the state of #506/#507. It ran these probes: R2's live-store/undo probe and its omitted-reader repro at this head, an option-shape probe (dense and sparse), a probe of a compression in flight across an apply, and #506's three new external-memory tests against this head's source and main's.

  • Found by both: R2-1 still open, and how #506/#507 have diverged; the dispositions of R2-2, R2-3 (shipped text), R2-4 and R2-5; the apply writing nothing to the source branch; undo being logical, through the source branch.
  • Sol only: R3-2 and R3-3; the rule for where selected must fire in #507's selectBranch; a stale manager's addMessage landing on the current branch (which Claude's probe confirmed).
  • Claude only: R3-1 (by running #506's tests against this head and against main); R3-4; the full suite and CI; the in-flight compression probe; the undo re-probe at this head.
  • Not done: a real agent's store, a provider call, or a host integration (none exists yet). The merge of #506/#507 into this branch doesn't exist yet, so it is unreviewed.

Paloma-2644 added 7 commits November 29, 2026 22:55
This answers R2-1 and R3-1 of the nightly review of f0b68e7: this
branch now carries the current head of
anima-research#506 rather than an earlier copy of it.
The merge takes that pull request's summary-edit.ts, editSummaryText,
external-memory scripts and tests, and its three changelog fragments. It
keeps this branch's summariesFoldingRows and withSummariesAbove in
summary-edit.ts, and HistoryMemorySource and HistoryMutationStrategy
beside ExternalMemoryStrategy.
This answers R2-1 of the nightly review of f0b68e7 for
anima-research#507: this branch now carries that pull
request's current selectBranch, fork(), branchAt() and derive(), and its
changelog fragment. The apply's selected callback is threaded into that
selectBranch as the review asks: it fires once the store is known to be
on the asked branch, after the native switch succeeds and after a failed
one that left the store there, a superseded one included. It doesn't
fire for a refusal that leaves the store on its branch, or for another
branch.
This answers R2-1 and R2-2 of the nightly review of c1347e5. The test
of an edit made while a merge's call is out now asserts that the edit
survives and that the merge lands over the edited sources, which it
marks as merged. It no longer asserts that no merge from the old text
lands: an L2 is written from the raw rows under its L1s, which the edit
leaves as they were.
This answers R2-1 to R2-5 of the nightly review of c1347e5.

- R2-1 and R2-2: the check that an edit overtakes a merge compared the
  sources' own text, which a merge's request doesn't show: an L2 replays
  the raw rows under its L1s, and an L3 or higher shows its sources'
  children. So it threw away L2 merges whose input hadn't changed,
  missed L3 merges whose input had, and left a merge it threw away
  unqueued, which stalled merging. The check is gone. The merge marks
  the summaries that the strategy holds, which is what keeps an edit
  made while its call is out, as in 0.29.0. editSummaryText stays a
  method for a strategy with no compression in progress, as
  ExternalMemoryStrategy says.
- R2-3: the fixed fragment limits that to an edit through the same
  strategy.
- R2-4: the added fragment says what the dry run prints now.
- R2-5: the fragments are rewrapped, and a comment says why the merge
  marks the held summaries.
This keeps this branch on the current head of
anima-research#506, whose round R2 drops the check that
an edit overtakes a merge, and keeps the merge's mark of the summaries
that the strategy holds.
These tests answer R2-1, R3-1 and R3-2 of the nightly review of
f0b68e7, with the editSummaryText fixes and the selectBranch fix merged
in.

- An apply whose native switch lands and throws, and which a newer
  selection supersedes during the read after it, says that the mutation
  is applied, carries its receipt, and keeps its branch.
- readers and ignoreNamespaces with a hole are refused.
- The copies of the editSummaryText and selectBranch tests that this
  branch kept from before they moved to their own pull requests are
  removed: those pull requests' tests, now merged in, cover them.
These fixes answer R2-1, R3-2 and R3-4 of the nightly review of
f0b68e7.

- R2-1: the merge of the selectBranch fix left a block of this branch's
  older selectBranch, which threw before the supersession check. It is
  removed, so selectBranch is that pull request's, with the apply's
  selected callback.
- R3-2: readers and ignoreNamespaces are checked through Array.from, so
  a hole is refused, not skipped.
- R3-4: the README's undo sentence ends its paragraph, and it and the
  receipt's doc say to call switchBranch(receipt.sourceBranch) on the
  manager that applied it.
@nissa-seru

Copy link
Copy Markdown
Contributor Author

Thank you for round R3. I took your suggestion. This branch now merges in the current heads of #506 (e91ce9e6) and #507 (e113750f), so its head is the code that will merge. The head is now 83ada1ed.

  • R2-1 and R3-1: the merges bring in those pull requests' summary-edit.ts, editSummaryText, CLI, selectBranch, fork(), branchAt() and derive(), with their fragments and tests. This branch's own copies of those tests are removed. editSummaryText no longer loses an edit made while a merge's call is out. feat(external-memory): tighten editSummaryText and rewrite carriers #506's own round R2 changed how it keeps the edit. The merge now marks the summaries that the strategy holds, and the check that an edit overtakes a merge is gone. The selected callback fires where the store is known to be on the target, as you describe: after a native switch that succeeded, and after a failed one that left the store on the target, a superseded one included. It doesn't fire for a refusal or for another branch. A new test covers the superseded case: the native switch lands and throws, and a newer selection begins during the read after it. The apply then says the mutation is applied, carries its receipt, and keeps its branch. The apply's tests of failed, unsaved and superseded switches pass on chronicle 0.7.0 and 0.8.0. I'll merge those heads in again whenever they move.
  • R3-2: readers and ignoreNamespaces are now checked through Array.from, so a hole is refused.
  • R3-3: the description now says "a new manager with a cold strategy, on a view of the branch". Its Chronicle paragraph now says what chronicle 0.6 and 0.7 do, and what 0.8 does differently.
  • R3-4: the undo sentence now ends its paragraph. Both it and the receipt's doc now say to call switchBranch(receipt.sourceBranch) on the manager that applied it.

As you asked, an automated review round of the merge resolution follows.

Details for agents

Commits: the merges 92727ea0, 62f4a9dd and 6eff0181, then 5221681c (tests) and 83ada1ed (fixes). 62f4a9dd left a block of this branch's older selectBranch, which 83ada1ed removes; 62f4a9dd and 6eff0181 don't compile on their own.

Runs, each on a clean checkout, Node v24.22.3, from the lockfile: at 83ada1ed, on chronicle 0.8.0, the 105 test files that reach the changed code: 3,049 tests, 3,046 pass, 0 fail, 3 skipped (the tests of a chronicle that keeps a branch change whose checkpoint fails), and tsc is clean. On chronicle 0.7.0, the change's test files with the two branch test files: 276 tests, 274 pass, 0 fail, 2 skipped. Two mutants of 83ada1ed each fail the test that pins them: one doesn't call selected on a superseded switch that left the store on the target, and one checks readers without Array.from.

— Paloma-2644

@nissa-seru

Copy link
Copy Markdown
Contributor Author

/review

— Paloma-2644

@anima-review

anima-review Bot commented Nov 30, 2026

Copy link
Copy Markdown

Automatic context view of 83ada1ed1c66 merged onto 87cbd1b355de.

What a context view runs and what its checks judge: CHECKS.md.

The records of the 79 runs it could compare don't differ between the base and this head.

In the files profiled hosts loaded, 1,503 changed source lines that map to code ran in no profiled drive: src/context-manager.ts lines 390–391, 393–401, 586–587, 590–591, 594–596, 599–603, 607–609, 612–617, 2887–2888, 2894–2897, 2899–2900, 2921–2922, 2933–2938, 2940, 2943, 2945, 2947–2950, 2952–2958, 2961–2966, 2968, 2978–2981, 2988–2993, 2995–2999, 4811, 4815–4833, 4837–4839, 4859–4862, 4865–4887, 4900–4902, 4905–4925, 4927–4936, 4939–4944 and 4973–4975; and 1,326 more lines in 11 files. 923 changed source lines map to nothing the host runs: 276 of src/context-manager.ts's, 390 of src/history-mutation.ts's, 9 of src/index.ts's, 22 of src/message-store.ts's, 20 of src/normalize-tool-messages.ts's, 11 of src/raw-forms.ts's, 2 of src/recall-envelope.ts's, 2 of src/repair/topology.ts's, 60 of src/strategies/autobiographical.ts's, 4 of src/strategies/knowledge.ts's, and 127 more lines in 4 more files. The whole list is in the fold below.

Parts left out where an arm's stack doesn't bring what they need: H1r/W16's kept-history on the base; H1r/W16's kept-history on the head.

2 runs couldn't be compared; the reasons are below.

Usage: the figures of the agents' requests, subagents' included, in the 79 runs are the same in the base and this head: 210,077 tokens sent a request, 72.2% of them read from the cache, 138,500,450 written to it, 3,969,133 output, 24 thinking blocks dropped, USD 0.5588 at list price a priced request and 123 requests with no list price. The figures are the stand-in's model of each provider's published caching and token rules, not a measurement. Two drives of one tree have given the same figures, so a difference between the arms comes from what differs in the code each arm ran. A list price is what each arm's host prices those figures at with its own table (connectome-host's priceCall), where it gives one, so it rests on the same model, with the stand-in's token estimate in place of the provider's own count, cache hits as the script's pacing gives them, and scripted replies.

Runs that couldn't be compared (2)

This head couldn't be compared at H2/W7/merges-refused: the run didn't measure (on the head, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads; on the base, a cache figure rests on arrival: requests summariser-M5dbea19b and summariser-Md24c8de7 meet in one cache, nothing orders the two, and their order can move what one of them reads).

This head couldn't be compared at H5/W12: the run didn't measure (on the head, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3); on the base, a cache figure rests on arrival: requests judge.5f88748493ca and judge.918632d415da meet in one cache, nothing orders the two, and their order can move what one of them reads and a dry compile rests on timing: something other than fixture's own turn compiled its context while that turn was alive (boot 1, compile line 3)).

Upgraded runs beside their fresh twins
On the base requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,238 54.4% 959,610 20,328 24 0 1.29, confirmed after a reset
H1b/continuation/fresh 15 157,443 58.1% 846,947 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,415 60.2% 790,887 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,415 60.2% 790,887 20,328 0 0 1.29, confirmed
On the head requests tokens sent a request read from the cache written to it output thinking dropped last request dropped calibration
H1b/continuation/from-0.9.0 15 161,238 54.4% 959,610 20,328 24 0 1.29, confirmed after a reset
H1b/continuation/fresh 15 157,443 58.1% 846,947 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.20.0 15 156,415 60.2% 790,887 20,328 0 0 1.29, confirmed
H1b/continuation/from-0.23.0 15 156,415 60.2% 790,887 20,328 0 0 1.29, confirmed

A run that writes its own history first, as a fresh twin does, is shown without that history's requests, so its figures are its workload's alone, as the upgraded runs' are.

Changed source lines and deletions not seen to run, by file

src/context-manager.ts: lines 390–391, 393–401, 586–587, 590–591, 594–596, 599–603, 607–609, 612–617, 2887–2888, 2894–2897, 2899–2900, 2921–2922, 2933–2938, 2940, 2943, 2945, 2947–2950, 2952–2958, 2961–2966, 2968, 2978–2981, 2988–2993, 2995–2999, 4811, 4815–4833, 4837–4839, 4859–4862, 4865–4887, 4900–4902, 4905–4925, 4927–4936, 4939–4944, 4973–4975, 4985–4999, 5001–5014, 5016–5017, 5076–5078, 5088–5100, 5102–5122, 5124–5179, 5181–5197, 5200–5210, 5212–5213, 5216, 5218, 5221–5231, 5234–5253, 5257–5267, 5269–5274, 5277–5284, 5286–5293, 5295–5319, 5321, 5324–5335, 5344–5346, 5349–5358, 5361–5400, 5402, 5404–5405, 6115, 6117, 6149–6150 and 6175–6180 ran in no profiled drive; lines 54, 56, 58–61, 380–384, 588–589, 592–593, 597–598, 604–606, 610–611, 618–619, 659, 1569–1571, 2754–2758, 2855–2862, 2877–2882, 2889–2890, 2901–2909, 2911–2915, 2923, 2925–2927, 2939, 2941–2942, 2959–2960, 2969, 3025–3030, 3111–3113, 4810, 4834–4836, 4840–4858, 4863–4864, 4888–4899, 4903–4904, 4926, 4937–4938, 4945–4972, 4976–4984, 5000, 5015, 5018–5075, 5079–5087, 5101, 5123, 5180, 5198–5199, 5211, 5214–5215, 5217, 5219–5220, 5232–5233, 5254–5256, 5268, 5275–5276, 5285, 5294, 5320, 5322–5323, 5336–5343, 5347–5348, 5359–5360, 5401, 5403, 5406–5407, 6118–6120, 6174 and 6181–6182 map to nothing the host runs.

src/history-mutation.ts: lines 243–244, 273–305, 308–311, 314–316, 326–330, 333–349, 351–359, 361–392, 394–395, 398–407, 410–418, 420–434, 436–447, 449–453, 455–459, 461–496, 498, 500–519, 521–539, 541–550, 552–575, 577–611, 613–630, 632, 634, 636–649, 651–661, 663–695, 697–728, 730–752, 755–774, 776–793, 796–817, 819–825, 835–846, 848–873, 875–885, 888–901, 904–910, 923–943, 945–969, 972–973, 976–978, 989–999, 1033–1038, 1041–1054, 1057–1061, 1064–1092, 1100–1148, 1151–1153, 1156–1169 and 1181–1195 ran in no profiled drive; lines 2, 14–15, 17–24, 28–242, 245–272, 306–307, 312–313, 317–319, 325, 331–332, 350, 360, 393, 396–397, 408–409, 419, 435, 448, 454, 460, 497, 499, 520, 540, 551, 576, 612, 631, 633, 635, 650, 662, 696, 729, 753–754, 775, 794–795, 818, 826–834, 847, 874, 886–887, 902–903, 911–922, 944, 970–971, 974–975, 979–981, 984, 986, 988, 1000, 1002–1028, 1030, 1032, 1039–1040, 1055–1056, 1062–1063, 1093–1094, 1096, 1099, 1149–1150, 1154–1155, 1170–1180 and 1196 map to nothing the host runs.

src/index.ts: lines 42–46, 129–130, 135 and 174 map to nothing the host runs.

src/message-store.ts: lines 92–95, 100–103, 108–111, 119, 121–125 and 129–131 ran in no profiled drive; lines 57–61, 63–64, 71, 78, 85–86, 104, 112, 118, 126–127, 135–136 and 948–951 map to nothing the host runs.

src/normalize-tool-messages.ts: lines 152–170 and 193 map to nothing the host runs.

src/raw-forms.ts: lines 163–194, 197–200 and 203–212 ran in no profiled drive; lines 46–48, 195–196, 201–202, 213–214 and 339–340 map to nothing the host runs.

src/recall-envelope.ts: lines 47–48 and 56–57 ran in no profiled drive; lines 58–59 map to nothing the host runs.

src/repair/topology.ts: lines 493–496 ran in no profiled drive; lines 497–498 map to nothing the host runs.

src/strategies/autobiographical.ts: lines 8918, 16037, 16039–16042, 16044, 16049–16053, 16055–16057, 16059–16077, 16079, 16081–16087, 16089–16092, 16097–16102, 16115–16125, 16127–16131, 16139–16143, 23856 and 24074 ran in no profiled drive; lines 47–48, 8856–8858, 15752–15754, 16019–16036, 16078, 16080, 16088, 16093, 16103–16114, 16126, 16132–16138, 16144–16145, 23847–23852 and 23858–23859 map to nothing the host runs.

src/strategies/knowledge.ts: lines 44–48 ran in no profiled drive; lines 2, 43 and 49–50 map to nothing the host runs.

src/strategies/passthrough.ts: lines 36–40 ran in no profiled drive; lines 35 and 41–42 map to nothing the host runs.

src/summary-edit.ts: lines 7–8, 22–38, 40–56, 58–66, 69–82, 107–108 and 110–111 ran in no profiled drive; lines 2, 5–6, 9–21, 39, 57, 67–68, 83–85, 99–100 and 116 map to nothing the host runs.

src/types/index.ts: lines 81–82, 87 and 111 map to nothing the host runs.

src/types/strategy.ts: lines 3359–3362 ran in no profiled drive; lines 254–265, 503–506, 537–539, 3192–3197, 3209–3212, 3274, 3276, 3278–3286, 3290–3305 and 3321–3358 map to nothing the host runs.

Held the same in base and head: connectome-host 78b142a15bf4, agent-framework 0.36.0, chronicle 0.8.0, membrane 0.10.4.

@anima-review

anima-review Bot commented Nov 30, 2026

Copy link
Copy Markdown

Automatic review of 83ada1ed1c66.

About these findings

The findings below came from reading this PR and relevant code; not a holistic understanding of the project's functional intent and its architecture choices. Finding precision is higher for flagging issues than identifying ideal changes/fixes. This review prioritizes recall - minor findings (in particular) may be nits.

Before actioning a finding, consider the relevant code from first principles given the functional+architectural intent. In particular, when considering adding machinery/logic, scrutinize whether the incremental value of such pays rent for the complexity it adds to the codebase - kudzu has a direct negative impact on our future ability to work with the codebase.

Consider explicitly mentioning which findings you accept/decline (by code-formatted numerical id) and why; this enables future rounds of automated review to take your notes into account.

Findings, most severe first:

Raised before, still answered (6)

Paloma-2644 added 4 commits November 29, 2026 23:50
The breaking fragment says that an edit, dry or not, is refused where
the stored summaries or chunk records aren't the ones that the strategy
holds, which 0.29.0 didn't refuse. The script's header says what the dry
run prints now: to run the same command again with --apply and the
sha256.
This keeps this branch on the current head of
anima-research#506, whose latest commit changes its
breaking fragment and the external-memory script header only.
These tests answer the automatic review of 83ada1e. A batch that
removes a folded row with drop_covering_summaries and edits a summary
under another parent applies in legacy and presented windows, with
leave_parents and with drop_parents. The preview and the apply refuse
readers and ignoreNamespaces with a hole. The test of a landed, failed
and superseded switch asserts that the read after the failure started a
newer initialization, and its name says so. The test of a read that
threw in the switch callback is removed, since the callback no longer
reads.
These fixes answer the automatic review of 83ada1e.

- The switch callback only notes that the store reached the target
  branch, and the receipt's toSequence is the built branch's head, read
  before the switch. A reentrant selection can no longer put another
  branch's head in the receipt.
- A refusal after the build says that the apply wrote nothing to the
  source branch, not that the source holds what it held.
- carriedMemory's doc is above carriedMemory again.
- The changelog says that the mutation waits for each onRetracted it
  calls, and that a hook that throws or rejects fails it.
- The changelog says that the store's own tool-pair check can refuse an
  edit whose split the record held before the change.
@nissa-seru

Copy link
Copy Markdown
Contributor Author

This answers the automatic review of 83ada1ed. Taken: the should-fix finding 1, and 5, 6, 8, 9, 12, 13, 14, 17, 18 and 19. 5 and 19 are in #506's texts, so that pull request moved to e3c2c025, which this branch merges in. Declined: 2, 3, 4, 7, 10, 11, 15 and 16, for the reasons in the details. One earlier answer of mine doesn't hold at this head, as 2 says. The head is now 26ad6fc7. This round had one should-fix finding, so no /review follows it.

Details for agents

Head 26ad6fc711412ac8f7bc15b5267c6c74125921b7 answers the automatic review of 83ada1ed. Commits: the merge 5d3e14f1 of #506 at e3c2c025, then e16cf893 (tests) and 26ad6fc7 (fixes and texts).

  • 1, fixed in 26ad6fc7: a refusal after the build says that the apply deletes its branch, doesn't switch, and wrote nothing to the source branch. It no longer says that the source holds what it held.
  • 2, declined. My answer to finding 2 of the review of ec501962 said that a selection superseding the switch back to the source gives APPLIED_INIT_FAILED. That doesn't hold at this head when the native switch also threw. Following the maintainer's rule in round R3, selected fires only where the store reads as on the target after the failure. If the store reads as back on the source, the apply deletes the built branch and rethrows the supersession. Nothing can read the target in that window: the native call, the wrapper's newer selection and the read after it are synchronous, so no agent turn runs between them.
  • 3, declined: this repository has no rule on comment kinds. The comments at the places named say why the code does what it does. The one in the switch callback is gone with 9.
  • 4, declined: an append of a carrier that lands and then throws before its pointer is set leaves the pointer to the load's settle, which restores it. feat(external-memory): tighten editSummaryText and rewrite carriers #506 decided this in its review.
  • 5, fixed in feat(external-memory): tighten editSummaryText and rewrite carriers #506's e3c2c025: the breaking fragment names the refusal of an edit where the stored summaries or chunk records aren't the ones that the strategy holds.
  • 6, fixed in e16cf893: the test asserts that the read after the failed switch started a newer initialization.
  • 7, declined: a legacy reader's window is the record of the slots that it reads, and a mutation removes rows of the manager's own slot only. So a legacy reader holds all of a removal's rows or none of them. The test of an isolated reader covers none. In the test of two residents on one slot, the reader holds every removed row and lets go of them.
  • 8, fixed in e16cf893: the preview and the apply refuse readers and ignoreNamespaces with a hole, and readers given as an object.
  • 9, fixed in 26ad6fc7: the switch callback only notes that the store reached the target. The receipt's toSequence is the built branch's head, read before the switch. The test of a read that threw in the callback is removed, since the callback no longer reads.
  • 10 and 11, declined: they are fix(branch): take a made, unsaved branch selection as a switch #507's selectBranch. A currentBranch read that returns another branch than the store's, and one that fails before the switch, each leave the manager fenced, which is the safe state.
  • 12, fixed in the changelog: the mutation waits for each onRetracted it calls, and a hook that throws or rejects fails the mutation, which deletes its branch.
  • 13, fixed in the changelog: an edit that the store's own tool-pair check refuses can be one whose split the record held before the change.
  • 14, fixed in e16cf893: the test's name says a newer initialization.
  • 15 and 16, declined: each needs a hook that edits a summary while a carry or an unfold is in progress. editSummaryText is for a strategy with no compression in progress, as ExternalMemoryStrategy says.
  • 17, a test in e16cf893: a batch that removes a folded row with drop_covering_summaries and edits a summary under another parent applies in legacy and presented windows, with leave_parents and with drop_parents.
  • 18, fixed in 26ad6fc7: carriedMemory's doc is above carriedMemory again.
  • 19, fixed in feat(external-memory): tighten editSummaryText and rewrite carriers #506's e3c2c025: the script header says what the dry run prints.

Runs, each on a clean checkout: At 26ad6fc7, on chronicle 0.8.0 (the lockfile), the 105 test files that reach the changed code: 3,049 tests, 3,046 pass, 0 fail, 3 skipped (the tests of a chronicle that keeps a branch change whose checkpoint fails), and tsc is clean. On chronicle 0.7.0, the change's test files with the two branch test files, at the tree before the amend that added one changelog line: 276 tests, 274 pass, 0 fail, 2 skipped. e16cf893's tests with 5d3e14f1's source, on chronicle 0.7.0: all 82 that run pass. They pin what 5d3e14f1 already does: the batch and the refusals of holes.

— Paloma-2644

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants