Repository navigation
CORE (signing sitting): v3 V3-04: reasoning trace chained per step (R3) - #69
Conversation
The KNOWN-LIMITS numbering test requires contiguous entries, so numbers follow the merge order #65, #66, #64, #63, #60, #62, #61, #67, #68, #69, #70, #71: #62 takes 75, #61 takes 76, this PR takes 77. Every citation on this branch moves with it (KNOWN-LIMITS.md heading and the limit 53 note, src/views/matcher-history.js header, test/matcher-history.test.js comment). On this branch alone the numbering test reports 75 and 76 missing; that clears once #62 and #61 are on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The KNOWN-LIMITS numbering test requires contiguous entries, so numbers follow the merge order #65, #66, #64, #63, #60, #62, #61, #67, #68, #69, #70, #71: #62 takes 75, #61 takes 76, #67 takes 77, this PR takes 78. Every citation on this branch moves with it: KNOWN-LIMITS.md heading, CHANGELOG.md, docs/receipt-coverage.md, and the V3-03 proposal note. The staged .patch carries no limit number and is unchanged. On this branch alone the numbering test reports 75, 76 and 77 missing; that clears once #62, #61 and #67 are on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merge-order notes, no change pushed to this branch Order: #65, #66, #64, #63, #60, #62, #61, #67, #68, #69, #70, #71. This PR adds no KNOWN-LIMITS entry, so it needs no renumbering. Expected conflicts (not rebased, per instruction):
Full 12-PR simulation with these resolutions: 1225 tests, 1218 pass, 0 fail, 7 todo. |
Second-family review (minimax-m3): fixes and rejectionsEvery finding was checked against the code before any change. Commits: RejectedB1 (hunk 1 malformed): false positive. Hunk 1 is unchanged. The hunk There is a related problem the review did not name. With S3 ( FixedB2: harness noise read as the operator. Confirmed. A
The fail-first fixture has thinking, then a S1: S2: an unsigned empty Weak tests strengthened
Not changed (nits, verified by reading, out of scope for this pass)N1 (the 4096-claim bound) and N2 ( Store cost: merge order
|
The KNOWN-LIMITS numbering test requires contiguous entries, so numbers follow the merge order #65, #66, #64, #63, #60, #62, #61, #67, #68, #69, this branch moves with it (KNOWN-LIMITS.md heading and the limit 53 note, src/views/matcher-history.js header, test/matcher-history.test.js comment). On this branch alone the numbering test reports 75 and 76 missing; that clears once #62 and #61 are on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New src/reasoning module: at each tool call, read the transcript forward from a per-session byte cursor, collect the thinking and text blocks since the previous action, and append one reasoning-step receipt (digests, counts, lengths, kind). No reasoning text on the chain. Session-end ingest reconciles every step (matched / late / mismatched) into a digest-bound sidecar. The PostToolUse wiring is a patch under proposals/ for the signing sitting; bin/ is core and was not edited. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- B2: isHumanPrompt now decides "operator speaking" on the text that
survives the chapters view's noise strippers (claudeUserText, exported,
behaviour unchanged). A <system-reminder> or <local-command-*> user line
no longer closes the segment and files the next action as none.
- S1: KIND_ORDER matches the documented precedence (thinking-redacted
above text-inline-reasoning); a test pins every adjacent pair.
- S2: an unsigned empty or whitespace-only thinking block is now
thinking-empty (shallowest kind), never none, so the step agrees with
the parser's session.thinkingBlocks that a block existed.
- Store cost: appendReceiptGuarded(build, { withChain: false }). Ignored
by the current store; with the tail-only store (PR #72) the per-step
append stops reading the whole chain.
- Tests: fail-first system-reminder fixture, bare <think> tag, exact
partialLineBytes, each cursor-reset reason pinned (incl. path-changed),
no-session-id, tamper test self-contained with a guarded index.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With core.autocrlf=true the staged .patch is checked out CRLF, its blank context lines become "\r", and git apply rejects it as corrupt before reading a hunk. --ignore-whitespace does not help. Patch content unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a8404bc to
e0f8609
Compare
Applied in the live install, each step signed by the owner: - store: tail-only append (proposals/store-tail-append, #72); PENDING_LANDING flipped in the same change. Precondition: live chain 37,173 entries, seq continuous. - hooks: V3-02 session-open reach certificate (#70), V3-04 per-step reasoning (#69), V3-03 tool I/O digest (#71), applied from git's stored patches. - chain: canonicaliser keeps an own __proto__ key in the hash (found while fixing #70); existing hashes unchanged (live chain had zero such keys). - tests: hook-wiring todo markers removed. npm test: 1292 tests, 1292 pass, 0 fail, 0 todo. Deferred to the post-merge evaluation: the #68 matcher line-ending fix, the KNOWN-LIMITS pin re-stamp (needs re-verification of every limit), verifyChain seq continuity, keyed digests, R2 on every tool call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What it does
V3-04, rung R3. Before this change, reasoning reached the chain only at session end, as a transcript hash and a thoughts/1 sidecar. Nothing bound an action to the reasoning that came before it. This PR adds that binding.
src/reasoning/index.js(new). At each tool call it reads the transcript forward from a per-session byte cursor. It collects the assistant's thinking and text blocks since the previoustool_useand appends onereasoning-step/1receipt for that action. The receipt holds full SHA-256 digests, block counts, lengths, asegmentDigestand the kind of reasoning exposed.src/ingest/index.js. The session-end pass recomputes every step from the whole transcript and reconciles it against the per-step receipts on the chain:matched,late(filled in here) ormismatched(surfaced, never smoothed). The result is areasoningfield (reasoning-trace/1) on the session receipt, bound by digest to a sidecar at<home>/reasoning/<session>-s<n>.jsonl. This follows the thoughts/1 pattern.proposals/v3-04-hook-post-tool-use.patch: one import plus one never-throwing call inbin/hook-post-tool-use.js, placed before the egress fast path.bin/is core, and the live self-mod gate blocks edits tobin/*.jsin any checkout, this clone included. The builder did not edit it and did not route around that.Lotor captures; it does not judge intent. R3 is recorded as evidence to read, never as declared intent.
Reasoning-kind taxonomy and detection
The kind comes from the blocks that actually landed, never from a requested think flag or a model id (V3-01: the think flag is a request, not a switch).
thinking-unsignedthinkingblock, non-empty text, nosignaturethinking-signedthinkingblock, non-empty text, non-emptysignaturethinking-redactedredacted_thinkingblock, ORthinkingwith empty text and a non-emptysignature(digest is taken over the opaque payload)redacted_thinkingblocks seentext-inline-reasoningtextblock containing<think>or</think>: R3 leaked into R0text-onlytext, no reasoning blocknoneunrecordednonekindis the deepest kind present, in the table's order.kindslists every kind present, so a mixed step loses nothing."Full" vs "summarized" thinking cannot be told apart from a Claude Code transcript. No marker distinguishes them; every thinking block carries the same fields (
type,thinking,signature). So Lotor never asserts "full".thinking-signedmeans "readable, vendor-signed, fidelity undetermined", andthinking-unsignedis the nearest the record can show to full, without proving it. This matches V3-01 finding 6 and the spec's "reach overclaimed" risk.Finding. The existing parser skips empty thinking blocks, so today signature-only thinking reads as "no thinking". That is R3 misfiled as absent. Locally this was the largest single class of thinking blocks for the current Claude models. The per-step path records it as
thinking-redacted. The parser itself is unchanged here (it is out of scope, and changing it would moveparserVersionHash).Segments
tool_useand before this one.tool_useblocks under one message id) share the segment and carrybatchIndex0, 1 and so on.unattributedBlocksat session end and is not credited to the next turn's first action.isSidechainlines are skipped.tool_use_idis the match key. Without it, the fallback is tool name plus canonical input digest, recorded asmatchedBy.Absence and the race
tool_useline is flushed. The receipt getsstatus: unrecorded,kind: unrecorded,reason: tool-use-not-in-transcript, andtranscript.partialLineByteswhen a partial line was seen. A partial trailing line is never consumed. The session-end pass marks the steplatewith its real kind.no-session-id,no-transcript-path,transcript-missing,transcript-unreadable: <code>.lateat session end.malformedLines). CRLF is stripped.transcript.cursorReset. Rewrites are caught by a head digest over the first 4 KB. Already-claimed ids are never recorded twice.appendReceiptGuarded), so parallel hooks cannot interleave.Privacy
paramsDigest. A keyed digest would block outside verification. That trade-off is the owner's call.Measured overhead (E5)
Synthetic data, this machine, in-process, 40 steps each, transcript about 0.9 MB:
The transcript side is flat because the cursor reads only the new bytes. Cost grows with chain size for one reason:
createStoreplusappendReceiptGuardedeach re-read the whole chain on every append. That cost already exists today, but only on matched-rule calls. This PR makes it per tool call. The fix is a tail-only append insrc/store, which is core and is not in this PR. It should be decided before the patch is applied on a large live chain. Node process start-up for the hook is not included: the hook process already exists.npm test
Baseline on
main@ 5198a07 was 1056 pass, 0 fail. The new tests aretest/reasoning-per-step.test.js(17) andtest/reasoning-hook-wiring.test.js(1,todo). They were confirmed failing first: with the module moved aside, the suites fail at import. Coverage:latereconcilekindbreaksverify()No pin or freshness stamp was re-stamped, and none failed.
Left open, and why
test/reasoning-hook-wiring.test.jsistodo. It asserts the wired hook lands onereasoning-step, and it fails until the patch is applied.test/core-classification.test.jsnow listssrc/reasoningas GRANTABLE, with the same reason asingest. This is a proposal: keep it, or move it toCORE_DIRSplusselfModFragmentsForBase().Overlap with parallel work
V3-03 (tool I/O digest) also edits
bin/hook-post-tool-use.js. This PR's hook change is two hunks: one import, and one call just afterparsePayload, beforematchEgress. Apply them in either order. Expect a trivial context conflict in that region. V3-02 (reach certificate) can read R3 presence fromreasoning-step.kindon the chain, which is computed from what was recorded, not from what was configured.Signing-sitting steps
src/reasoning/index.js, the ingest hunk and the patch.src/reasoning(GRANTABLE as proposed, or core).git apply proposals/v3-04-hook-post-tool-use.patch. If CRLF checkout trips it, add--ignore-whitespace.todooption intest/reasoning-hook-wiring.test.js, then runnpm test.🤖 Generated with Claude Code