šŸ”€ Specialist Delegation Fixes — Playground

Three telemetry-driven fixes + three live-verified #2371 repairs. All examples below use the real shipped data.

1 Ā· Advisor nudge tester
2 Ā· Honest spawn telemetry
3 Ā· Registry names & advisory scope

general-purpose → specialist nudge (task-agent-advisor)

Type a task description as if passing it to Agent(subagent_type="general-purpose"). The same regex map that ships in the hook runs here:

debug example security example tests example frontend example genuinely generic
— type something —

Telemetry that motivated this: 424 real spawns — 17% general-purpose vs 10% specialists, and the old advisor whitelisted general-purpose so it could never suggest otherwise. The nudge is advisory: it never blocks, and generic stays correct for mixed tasks.

Spawn-log entries: fabricated depth → honest lineage

Before (every entry, nested or not)

{"timestamp":"…","subagent_type":"Explore",
 "description":"",   ← SubagentStart has no description/prompt
 "session_id":"…","agent_id":"a1b8c…",
 "spawn_depth":1}     ← fabricated: CC sends no parent_agent_id,
                      so NESTED spawns also logged 1 and the
                      depth ≄ 4 warning could never fire (#2371)

After (two honest sources)

// PreToolUse[Task] — the only event with the args:
{"timestamp":"…","source":"pretool",
 "subagent_type":"general-purpose",
 "description":"Investigate flaky CI failures",
 "session_id":"…","tool_use_id":"toolu_…"}

// SubagentStart — the only event with agent_id:
{"timestamp":"…","source":"start",
 "subagent_type":"general-purpose","description":"",
 "session_id":"…","agent_id":"ad54c…"
 /* spawn_depth OMITTED — no real lineage */}

Live-captured SubagentStart payload on CC 2.1.173 (the whole reason for the split):

{ session_id, transcript_path, cwd, agent_id, agent_type, hook_event_name }
→ no parent_agent_id Ā· no prompt Ā· no description Ā· no is_fork
→ depth telemetry stays dormant until anthropics/claude-code#16424 ships agent context

Agent() grants: bare names fail, scope is advisory (#2371)

Spawn attemptResult (live-verified, CC 2.1.173)
Agent(subagent_type="database-engineer")FAILS — "Agent type 'database-engineer' not found"
Agent(subagent_type="ork:database-engineer")resolves — registry knows only the namespaced type
Explore from an agent that never declared itsucceeds — the parenthesized grant is ADVISORY; CC enforces nothing

What shipped: all 16 grants across 11 agents rewritten to Agent(ork:…), Delegation tables updated, and the CI guard now FAILS any bare-name grant:

case "$ref" in
  *:*) ;;
  *) echo "FAIL: … bare Agent($ref) — runtime registry only resolves
      namespaced types (use Agent(ork:$ref), #2371)" ;;
esac

Workflow stages adopt specialists the same way — audit-full-mapreduce.mjs now routes shard-audit + refute stages to ork:security-auditor when mode === "security" (and stays generic for mixed modes, on purpose).