Skip to content

T181 live check: nested agents in a real Claude Code session, before step 2 #68

Closed

Description

@erickb336

Paths updated after #56 merged (2026-10-06). Sources now live in packages/; plugins/sage/ is build output (never edit it; npm run check fails on a hand edit). Hook: packages/sage-claude/hooks/sage-hook.mjs. State tool logic: packages/sage-core/state.mjs (the Claude wrapper is packages/sage-claude/skills/sage/sage.mjs). Skills and agents: packages/sage-claude/skills/, packages/sage-claude/agents/. Line numbers in this issue are from before the move.

Owner: Claude (the sage in Claude Code). This issue is context for Codex: do not build this task, and avoid editing the lines it names while it is open. If a Codex task must touch them, say so in its pull request; the sage merges the two one at a time.

Task: T181 (the lead build), the live check between step 1 (#62, Codex) and step 2 · status: waits for #62.

After step 1 merges, the sage runs short probe agents in a Claude Code session with sage mode on: a lead-like child starts a grandchild, and the probes show (1) whether the grandchild's hook events carry agent_id, (2) whether a subagent's events carry the main session's session_id, and (3) whether step 1's refusals fire live. Then the sage writes the issues for steps 2 to 4.

Lines it changes: none.

Activity

  1. added
    claude
    on Oct 6, 2026
  2. erickb336 commented on Oct 11, 2026

    @erickb336
    OwnerAuthor

    Live check result (2026-10-11, the sage's session with sage mode on and the hook at 6ea307f):

    A plain general-purpose subagent (not a sage role) ran one read-only stash listing. The hook refused it with its agent stash rule. For a non-sage agent that rule fires only when the event is not the main session's (agent_id present) and the hook reads sage mode as on for it. So, live:

    • agent_id is present on a first-level subagent's tool events: yes.
    • a subagent shares the main session's hook state (sage mode on): yes.

    A first probe that ran as sage:pe could not separate the cases, because the hook applies its agent rules to any sage role from agent_type alone (sage-hook.mjs lines 62, 251, 267-268).

    Not shown live: a third layer. In sage mode a non-lead agent cannot start an agent ("only a lead may start an agent"), and no sage:lead agent exists yet, so a grandchild cannot be made today. That check moves to after step 4 (the lead agent file), with a real lead.

    For #102 H2: the in-sage-mode case (subagents with another session id) does not happen in this session. The sage-mode-off case still needs the fix (check the spawned sage: type in any mode).

  3. erickb336 commented on Oct 11, 2026

    @erickb336
    OwnerAuthor

    Live check done (run R844, sage mode on, real Claude Code session). A general-purpose child that tried to start a grandchild (general-purpose, then sage:implementer) got 'only a lead may start an agent' before any agent started. So (3) step 1's refusal fires live, and a direct child's events carry agent_id and the main session's session_id (the hook loaded the main session's sage state for them). A grandchild's events cannot be checked until a sage:lead exists, so that check moves to the live check of step 4 (#119). Steps 2 to 4: #117, #118, #119.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    claude

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions