symcc

Probe: does a lead wake-up turn reach symcc's turn-end hook, and do workers started there get symcc's hooks? #

Source: task T-389 (kept as a note by T-394). Claude Code 2.1.319, headless claude -p.

Question #

  1. Does a turn started by a timer calling $.prompt.submit on an idle session reach the plugin's turn hooks?
  2. Do workers started from those hooks get symcc's hooks (tool.check, tool.call, turn.complete)?
  3. Is there a $.agent.spawn option that keeps the hooks when you start from a timer?

Answer #

Yes to the first two. The wake-up turn reaches turn.start and turn.complete. An agent started inside either hook gets tool.check and tool.call for its own tool calls, and its end reaches turn.complete. The wake-up path works in headless runs.

The fastest safe place to start workers is the wake-up turn's turn.start, about 0.3 to 0.8 s after the wake-up is sent.

No to the third. AgentSpawnArgs is only prompt, description, subagentType, model, name, cwd (.claude-plugin/types/claude-code/index.d.ts:251). The docs say spawn "runs every hook but the calling one" (index.d.ts:3337). From a timer, the whole plugin seems to count as "the calling one" (a reading that fits every result). Starting through $.tool.call({tool:'Agent'}) is refused by the host ("that is $.agent.spawn").

Where the started agent gets hooks #

Where the agent was startedtool.checktool.callIts end reaches turn.complete
Timer ($.clock.after then $.agent.spawn)nonoyes
Lead tool call (tool.call hook)yesnoyes
session.startyesyesyes
prompt.submit hook, owner's promptyesyesyes
prompt.submit hook, plugin's own wake-uphook never runs
turn.start, owner's turnyesyesyes
turn.start, wake-up turnyesyesyes
Main turn.complete, owner's turnyesyesyes
Main turn.complete, wake-up turnyesyesyes
An agent's turn.complete (worker finishing)yesyesyes

Other facts:

Safest design #

Timer places that currently start agents and would need to queue: the heartbeat pump (hooks/register.tsx:157), the watchdog (:154), scout timers (hooks/plugin/scouts.ts:125, 289), the checker timer (hooks/plugin/checker.ts:71), and the timers in hooks/plugin/workers.ts:278-363.

How it was found #

A fresh probe plugin (a copy of T-384's) wrote every hook hit to a log file through $.fs.write. It ran 3 times with claude -p --input-format stream-json --plugin-dir ... --model haiku, with stdin kept open so the session sat idle between turns. Each started agent called mcp__probe__ping (answered only by the probe's tool.call hook, reply "PONG") and then Write (refused only by the probe's tool.check hook, reply "PROBE-DENY"). Cost was about $0.02 reported, under $0.10 estimated overall (not confirmed). The probe was deleted afterwards.

Not checked #

Next step #

Fix task in hooks/plugin/workers.ts, hooks/register.tsx, hooks/plugin/scouts.ts, hooks/plugin/checker.ts and tests/: a start queue emptied at session.start, main turn.start and turn.complete, with tellLead as the wake-up. Then repeat the live test -e check from a worker in the app.