🎛️ Phase 4 — Advisor enforces specialist routing
The broadest, fastest activation lever: one hook flip that affects all 37 agents at once. When the model spawns general-purpose for a clearly domain-shaped task, the advisor now turns a note the model ignored into an active permission decision.
The flip — one branch in task-agent-advisor.ts
BEFORE · whisper (ignored)
// general-purpose + domain match
return outputAllowWithContext(
"This task looks like `ork:security-auditor`'s
domain — consider it over general-purpose…"
);
// → additionalContext. Model free to ignore.
// telemetry: 14% specialist / 74% generic 🔴
AFTER · ask (active choice)
return outputAsk(
"This task matches `ork:security-auditor`'s
domain — prefer it over general-purpose.
Approve general-purpose only if multi-domain."
);
// → permissionDecision:"ask"
// CC surfaces the specialist; redirects on confirm.
// continue:true — never a hard deny ✅
How it fires
model spawns Task(subagent_type="general-purpose", "audit upload endpoint for vulns")
│
▼ PreToolUse[Task] → task-agent-advisor
matchSpecialistDomain() → "ork:security-auditor" (narrow regex; multi-domain tasks don't match)
│
▼ permissionDecision: "ask"
CC: "prefer ork:security-auditor over general-purpose?" → approve → re-spawn as specialist ✅
Conservative by design
| Choice | Why |
ask, not deny | continue stays true; a false-positive just lets you approve general-purpose. No hard block. |
| Only the specialist branch | Bash-nudge / synonym / casing branches stay advisory — unchanged. |
| Narrow domain regexes | Genuinely multi-domain tasks don't match → never reach the ask. |
| All 37 agents at once | No per-agent wiring needed — complements Phase 2's per-skill spawns. |
✅ Why this is THE lever: Phase 2 proved per-agent wiring is narrow (only ~1-2 agents have clean skill homes). This single hook flip redirects every generic→specialist decision across the whole catalog — the fastest path to "agents get spawned better."
⚠️ Honest caveat: "better" ships now; proven better needs telemetry to accumulate. Measure the lift with audit-activation (#2628) over the next sessions: 14% → ?. If ask is consistently confirmed, a future step could escalate the highest-confidence matches to auto-redirect.
OrchestKit · branch feat/activation-phase4-advisor · full hook suite 336 files / 8853 tests / 0 fail · playground