Phase: Capability-based spawn gate (remove Explore gate)

phase-pal-e-agency-8a-capability-spawn-gate Phase

phase
Goal: Refactor the spawn gate hook to gate on agent capability (write access) rather than agent type, unblocking discovery-stage research agents.
Owner: Dev agent
Repo: forgejo_admin/claude-custom
Depends on: None

Problem

The check-agent-spawn.sh hook gates ALL agent types with scoping requirements:
  • Explore agents: require #N or Issue pattern
  • general-purpose agents: require plan- pattern
  • dev/QA agents: require #N or Issue pattern
This blocks legitimate discovery/research work. Explore agents are architecturally read-only (no Edit, Write, or Bash tools). Gating them with issue references is pure friction — they cannot cause failures. The DORA principle: anything that blocks flow without reducing change failure rate is waste.
The scoping pipeline has a discovery stage that precedes plans: research → plan → phase → issue → agent → PR. Research agents operate in the pre-plan stage. Gating them with plan/issue requirements blocks the discovery that feeds scoping.

Fix

  • Remove the gate for Explore agents entirely — they are read-only by architecture (tools exclude Edit, Write, NotebookEdit, Agent). Zero failure risk = zero gate needed.
  • Keep dev/QA gate — write access requires issue traceability.
  • Keep general-purpose (Dottie) gate — pal-e-docs write access requires plan context. But general-purpose used for pure research should not be gated. Add discovery-intent bypass: if the prompt contains research-oriented keywords ("research", "investigate", "explore", "understand", "how does", "what is") AND does NOT contain write-intent keywords ("create", "update", "fix", "implement", "deploy"), bypass the plan gate.
This aligns with the three-layer enforcement model: capabilities (disallowedTools) > agent-level (frontmatter) > global hooks (settings). The spawn gate is layer 3 — it should match the risk profile set by layers 1 and 2.
  • plan-pal-e-agency — parent plan
  • agent-spawn-conventions — the SOP this hook enforces
  • convention-agent-autonomy — autonomy levels and escalation triggers