Repository navigation
Attribute subagent tool calls (agent_id): reasoning cursor isolation + queued core patch - #73
Merged
Merged
Conversation
…re patch Claude Code fires PreToolUse/PostToolUse for tool calls made inside a subagent, with the parent's session_id plus agent_id/agent_type. Lotor read neither. Two live probes on 2026-10-22: a child's Bash call was recorded as the parent's (unrecorded: tool-use-not-in-transcript), and it advanced the parent's reasoning cursor through 9,495 bytes of the parent's transcript. Grantable (src/reasoning): child calls use their own cursor (separate directory, hashed agent id), read the child transcript with sidechain lines included, carry agentId/agentType on the step, and are excluded from the parent's reconcile. Invalid agent ids are refused as agent-id-invalid. Core (queued for the signing sitting, not applied): proposals/agent-id-attribution.patch adds agentId/agentType to gate, policy-warn and grant-use rows only when present, and sessionId to egress-event. test/agent-id-attribution.test.js is todo until it lands. Built by glm-5.3-flash (WO-AGENT-ID, FIX1); second-family review by Claude Sonnet; patch hunks recounted (16, 0 mismatches). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
githubscum
added a commit
that referenced
this pull request
Oct 26, 2026
…e under signature Applied in the live install, each step signed by the owner: - precondition: live chain 42,567 entries, seq continuous (scan signed, 13668b04). - chain: verifyChain checks seq continuity (proposals/verifychain-seq-continuity, #74), signed 008521ce. - gate and hooks: subagent tool calls carry agentId/agentType on gate receipts (proposals/agent-id-attribution, #73), signed 74885c4c. - policy: matcher/3 folds CRLF so one commit has one stamp (proposals/l77-matcherhash-eol, #82, KNOWN-LIMITS 77), signed 7f124e65. - tests: agent-id describe todo marker removed; seq and l77 tests detect the landing on their own. Found during the sitting: KNOWN-LIMITS 82. The first apply, `git apply <patch>`, rewrote src/chain/index.js with no gate stop and no receipt, because the matcher reads paths from argv and the patch carries them in its bytes. It was reverted under signature (34b2dca0) and every patch was re-applied with its targets named via --include, which the matcher sees. Pin re-stamp follows in its own commit; mechanical, not a re-verification of every limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Claude Code now fires
PreToolUseandPostToolUsefor tool calls made inside a subagent. Those payloads carry the parent'ssession_idandtranscript_path, plusagent_idandagent_type. Lotor read neither field. Two live probes on 2026-10-22 showed what that does:echoshowed up as a parent reasoning step markedunrecorded: tool-use-not-in-transcript, because Lotor looked for it in the parent's transcript.A second probe found that a subagent's read of the chain stops at the self-mod gate. KNOWN-LIMITS 66 and 70 ("subagent tool use is outside the witness entirely") were true when measured on 2026-09-02 and are out of date for the current harness. The amendments are drafted separately and land with the core patch.
What changes
Grantable, takes effect on merge (
src/reasoning):reasoning/cursors/agents/<session>/<sha256(agent)>.json. A child call can no longer produce a parent cursor path, andloadCursordiscards a cursor whose sidechain mode doesn't match.agent_transcript_pathwhen present, otherwise from thesrc/ingest/subagents.jsconvention, with sidechain lines included.agentId/agentTypeand are excluded from the parent's reconcile.agent_idis refused asagent-id-invalid, with no cursor touched and no path escape.test/reasoning-subagent.test.js: 12 tests.Core, queued for the signing sitting, not applied here:
proposals/agent-id-attribution.patch(16 hunks acrossbin/hook-pre-tool-use.js,src/gate/index.js,bin/hook-post-tool-use.js):gated-action,policy-warnandgrant-userows gainagentId/agentTypeonly when present.egress-eventgainssessionId.test/agent-id-attribution.test.js: 7 cases,todountil the patch lands.proposals/agent-id-attribution.md.Evidence
npm ci: 1263 pass, 7 todo, 8 fail.@modelcontextprotocol/sdkorqrcode.c69f552in that clone.git apply --checkon the core patch. It touches protected paths, so it is the first signed step at the sitting.Open decisions (not changed by this PR)
session_id, so a grant issued to the parent session also covers its subagents' calls.policy-warnrows carry no agent fields.🤖 Generated with Claude Code