Wire the governed runtime into Claude Code agent teams. Classifies work into R1–R5, spawns bounded swarm teams for R3/R4, manages packet execution with reviewer barriers, enforces postflight gates, and sends completion notifications.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
npx skills add https://github.com/Chaddacus/chad_claude_configs --skill govern
O comando permanece em uma só linha. Role horizontalmente para revisá-lo antes de copiar.
Prefere uma cópia local? Baixe os arquivos disponíveis atualmente no SkillsMP.
Instruções da origem · Visualização somente leitura
name
govern
description
Wire the governed runtime into Claude Code agent teams. Classifies work into R1–R5, spawns bounded swarm teams for R3/R4, manages packet execution with reviewer barriers, enforces postflight gates, and sends completion notifications.
This skill is the runtime interpreter for the route manifest (~/.claude/state/route_manifest.json)
and the enforcer of the canonical 9-phase workflow (~/.claude/standards/WORKFLOW_PHASES.md).
It classifies work, enforces route-specific execution discipline, spawns agent teams for bounded swarms,
and gates closure on convergence and postflight evidence.
Phase mapping: govern's internal phases map to the canonical workflow as follows:
Phase 0 (Memory Retrieval) = WF Phase 3 (Research). Phase 1 (Route Classification) = WF Phase 2
(Classify). Phase 2 (Execute by Route) spans WF Phases 4–9 (Blueprint → Validate), with
/planning-gate owning Phase 5 (Plan) and the orchestration loop covering Phases 7–8
(Implement → Test). See WORKFLOW_PHASES.md for the full sequence and route × phase matrix.
Usage
/govern Add a helper function to utils.ts
/govern Add JWT auth to the API with refresh tokens
/govern --route R2 Fix the typo in the README
/govern --dry-run Refactor the billing module
Route the whole task through Hermes phase orchestrator (~/chad_work/hermes, REST :3345) instead of in-session dispatch. R3/R4 only. Greenfield uses 8 phases (plan/design/backend/frontend/test/e2e/security/validate); refactor uses 5 (index/plan/refactor/test/validate). Falls back to standard dispatch if Hermes is unreachable and --strict-hermes is not set.
--worker-runtime {claude|goose|opencode}
Override the dispatch profile's worker_runtime for this run. goose routes through ~/.claude/bin/goose_dispatch.py (ACP → Pro/Max subscription, no per-token cost). opencode routes through anthropic-concurrency-system. Default inherits from route_manifest.json profile.
Members per the team spec (respecting lane_caps and profile_overrides)
Create worktree for isolation:
Branch: govern-<track-id>
Workers operate in the worktree
Create tasks for each packet using TaskCreate:
Set addBlockedBy for DAG dependencies between packets
Include acceptance checks in task description
Sprint-contract ack (ENFORCED gate): send the planner's sprint contract
to the reviewer; on explicit ack, record it — R3/R4 dispatch_track blocks
with missing_reviewer_ack until this runs:
Reviewer rejects → planner revises criteria → re-ack. Never record an ack
the reviewer didn't give.
Enter the orchestration loop (Phase 3)
At reviewer barrier points → spawn reviewer, wait for verdict
On completion → postflight gates (Phase 4)
R4 — Conservative Bounded Swarm
Same as R3 with tighter constraints:
Reviewer is co-primary from the start (joins team at creation, not just at barriers)
Swarm cap: 2 (from manifest)
All lane caps: 1
Extra barrier: adaptation_generated_packets
Reviewer must approve the plan before any execution begins
All worker packets require explicit reviewer sign-off
Codex delegation: For complex investigation or fix sub-tasks within R4, use /codex:rescue to hand off asynchronously while Claude coordinates:
/codex:rescue --background investigate <specific problem>
/codex:rescue --resume apply the top fix from the last run
/codex:status # check progress
/codex:result # retrieve findings
Use codex resume <session-id> (from /codex:result output) to hand off into Codex directly.
R5 — Ambiguity Resolution
Identify the specific ambiguities preventing classification
Generate targeted clarifying questions (batch-limited per manifest)
Present questions to the user
On resolution, re-classify the prompt and re-enter Phase 2
Phase 3: Orchestration Loop (R3/R4)
The session running /govern acts as team lead (coordinator):
LOOP:
1. TaskList → get current task states
2. Compute runnable set:
- Tasks whose blockedBy are all completed
- Respect lane_caps (don't exceed per-lane concurrent limit)
- Respect route_swarm_cap (total concurrent active tasks)
3. Dispatch in frontier_dispatch_order:
validator → explorer → worker → reviewer
For each dispatchable task:
- TaskUpdate: set owner = agent name, status = in_progress
- SendMessage: packet instructions + acceptance checks + scope constraints
4. Wait for agent completion messages
5. On task completion:
- Handoff-integrity check FIRST (see "Truncation tripwire" below);
a result that fails it is a FAILED dispatch, not a completion
- TaskUpdate: mark completed with evidence
- Check reviewer_barrier_points:
- "closure": all required packets must be reviewer-approved before closing
- "high_risk_boundary_shrink": reviewer approves any scope reduction
- "adaptation_generated_packets" (R4): reviewer approves generated work
- If barrier hit → dispatch reviewer task, wait for verdict
- If reviewer rejects → create rework tasks, continue loop
- Recompute runnable set
6. Check terminal conditions:
- All required packets accepted + convergence → OBJECTIVE_COMPLETE
- No runnable packets + all blocked → ESCALATION_REQUIRED
- Retry budget exhausted (max 2 same-strategy) → boundary shrink
- No frontier movement for 2 cycles → escalate
7. If not terminal → GOTO 1
Timeout safety (no-nudge policy):
If an agent hasn't reported in 5 minutes, send ONE status ping via SendMessage.
No response after that single ping (10 min total) → the worker is DEAD to this
task: mark the task failed and respawn a FRESH worker with the stall folded
into its prompt ("previous worker stalled at ; <known cause/fix if any>").
Reassignment means fresh respawn — never resume-nudge the same stalled session.
Hard cap: one nudge per worker per task. A second stall by the SAME task's
replacement worker is a step problem, not a session problem — stop respawning
and fix the step (pre-authorize the command, add env determinism like
CI=1 npm install --no-audit --no-fund, or split the packet). "Nudge #3" must
never exist: babysitting a stalled context costs more than a clean window.
A stalled worker that eventually replies WITHOUT its mandatory handoff
artifacts still fails the truncation tripwire below — nudged-back-to-life is
not completion.
Respawns count toward the retry-policy caps below.
Track noop_cycle_count and no_frontier_movement_cycle_count per manifest thresholds
Truncation tripwire (handoff integrity):
maxTurns truncation cuts the END of an agent's output, so a turn-capped agent
looks like a finished one unless you check. Worker/planner/test-strategist
handoffs are contractually required to end with the literal final line
HANDOFF-COMPLETE. On any completion message:
Missing HANDOFF-COMPLETE final line, OR missing mandatory handoff artifacts
(worker: diff + test output + criterion mapping + verify:<slice-id>:exit=<code>
token) → treat as a FAILED dispatch. Never grade prose; never accept partial
artifacts as "close enough".
Respawn with the failure folded into the retry prompt ("your previous attempt
was cut off after X; resume from the last complete artifact"), under the same
retry policy caps below. Repeated truncation of the same packet → split the
packet, don't raise maxTurns first.
Effort escalation on rework dispatch:
When re-dispatching a slice that entered rework (via update-node --state rework), the auto-runtime records a suggested bumped effort in governance.slice_escalations[slice_id]. Resolve the effective effort for the dispatch via:
Use $EFFORT when invoking the agent for the retry. The helper returns base-effort unchanged if no escalation is recorded, so it's safe to always call. Ladder: low → medium → high → xhigh; ceiling is xhigh.
Phase 4: Postflight (R3/R4)
Compile artifacts in standard planning-gate schema: