skills/orchestrate-execution/SKILL.md
Steady execution: bootstrap, plan selection, stage loop, grading, difficulty completion gates, completion handoff to architect.
npx skillsauth add roborew/opencode orchestrate-executionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Hard Rules live in the orchestrate agent markdown; this skill adds protocol detail only for execution (steady path and completion gates). Non-negotiables—delegation, scribe trust, brevity—come from the agent, not from this file.
You execute an existing plan artifact by coordinating subagents. You do not edit files directly.
You have the Task tool to invoke subagents (scribe, worktree-env, developer, frontend-dev, ux-dev, verifier, helper, vision, senior-dev, review). You do not have write or edit tools—by design. Never ask the user to enable write/edit. Implementation is done by delegating to developer, frontend-dev, or ux-dev via Task. Linked-worktree env symlink setup before preflight is delegated to worktree-env. Markdown writes (artifact updates only) are done by delegating to scribe. You do not run final review or documentation—those are architect responsibilities after you prompt handoff. On completion, prompt user to switch to architect.
scribe for .plan/*.md and docs markdown writes.verifier at stage gates and before final completion. Run CodeRabbit gate via review once at orchestration completion (after the last verifier PASS for the artifact or the entire GitHub feature queue) — never per stage, per GitHub issue, or mid-queue.helper when any enforced condition is met (see orchestrate-recovery for trigger detail and recovery steps).scribe.@scribe prompting; invoke required subagents automatically.scribe, worktree-env, developer, frontend-dev, ux-dev, verifier, helper, vision, senior-dev, review) and never perform those tasks yourself.get_indexing_status for the workspace path. If the index is missing, stale, or not ready, call index_codebase, then re-check until ready. Run after preflight when the user opts in during bootstrap.env_gate_passed or env_gate_declined is already set this session. Do not show the work-selection menu until the user answers and any opted-in preflight finishes (or is skipped). Do not re-ask if preflight already passed or was declined this session..plan/<type>.<slug>.mdartifact_type + slug (derive from path when only path is provided)Run only when the user answers yes to the preflight prompt, requests a preflight rerun, or remediation requires it after Blocked / ENV_BLOCKED.
worktree-env via Task with load: full (instruct: run worktree-env skill—symlink .env and .env.local for linked git worktrees when applicable). If worktree-env reports Blocked, stop and request user remediation before calling developer.developer with an explicit preflight-only task (instruct: load preflight skill; run README, env symlinks, runtimes, command resolution, smoke check, claude-context). Return a concise preflight report to the user.Status: Blocked, stop and request remediation—do not start stages or issues until fixed.env_gate_passed: true for this session.Do not re-run the full gate between stages or between GitHub issues unless the user asks or recovery policy applies.
When no artifact path or feature:<slug> is provided (new session, greeting, unspecified task):
env_gate_passed or env_gate_declined is already set this session, ask: “Run preflight now? (yes/no)” and wait for the answer. Do not list work options yet.
yes → run Environment readiness gate above; on Blocked stop for remediation; on Ready continue.no → set env_gate_declined: true; do not run preflight this session unless the user later asks to rerun.env_gate_passed or env_gate_declined → do not ask again; continue.When the user provides a .plan path or feature:<slug> before bootstrap completed: if neither env_gate_passed nor env_gate_declined, ask the preflight yes/no first; then enter the stage or GitHub loop (preflight not required if they declined).
On fresh context, and before delegating discovery-heavy planning or review work:
claude-context get_indexing_status for the workspace path.index_codebase, then re-check until ready before continuing.claude-context is unavailable or indexing still fails after retry, report that readiness could not be confirmed. Continue only for non-discovery steps; any discovery-heavy child must still enforce its own readiness gate before falling back to bash, glob, or rg.After session bootstrap, when no artifact path or feature:<slug> is provided:
.plan last; numbers match display order).architect with the user's goal (e.g. Mode F sign-off, new planning).architect for non-backlog work unless the user supplies a feature:<slug>, issue #, or explicit execution scope—then use (1) or targeted issue flow as appropriate..plan selection below. Do not glob or list .plan/ before the user chooses (4)..plan selection (only after user chooses (4)).plan/ from disk first (non-negotiable). Before you write any plan filenames or counts to the user, you MUST use a filesystem tool in this turn: e.g. glob .plan/*.md (and .plan/**/*.md if you use nested plans), or list/read the .plan/ directory. Never invent, guess, or recall-from-memory what is in .plan/ — if you have not just received tool output for that listing, you are not allowed to present a plan list.*.md files whose basename does not end with .completed.md. Omit archived .plan/<type>.<slug>.completed.md after architect Mode B sign-off.architect.architect to create a plan, then return here with the plan path."If there are no active plans (only archived *.completed.md, directory missing, or empty after filtering), inform the user: "No active plans in .plan/ (archived *.completed.md files are omitted). Switch to architect to create a plan, provide a GitHub feature:<slug>, or choose GitHub backlog (1)."
.plan artifact)Use this path after spec fanout and impl issue-expand (feature:<slug>, state:ready-for-agent, opencode-task-yaml with stages[]). You have no bash tool — delegate every gh invocation and helper script to developer via Task (load: minimal for pure shell, load: full for implementation).
Load github-issue-run together with this skill when the user chooses GitHub execution or provides a feature:<slug> / kebab slug.
"${OPENCODE_CONFIG:-$HOME/.config/opencode}/skills/github-issue-run/lib/<script>.sh"
developer load: minimal: bash "$OC/skills/github-issue-run/lib/next-runnable-issue.sh" "<slug>" — capture stdout JSON.developer load: minimal: issue-state-transition.sh "<repo>" "<number>" state:in-progressopencode_meta from the discovery JSON.
stages is a non-empty array (from issue-expand): run GitHub issue stage loop below for this issue only — do not advance to the next issue until all stages pass verifier.acceptance and test_commands (fanout default).developer or frontend-dev per opencode_meta.owner with load: full. GitHub issue contract:
execution_mode: github_issueissue_number, repo, titleopencode_meta verbatimverifier with load: full and the same contract plus completion report.git_commit with Refs: #<issue_number> when files changed).state:ready-for-review; optional gh issue comment with summary and commit hash. Do not run CodeRabbit here — one feature-wide gate runs after the queue is exhausted (see Exit when queue empty).state:blocked or helper per orchestrate-recovery — do not advance queue.opencode_meta.stages)When stages[] is present, for each stage in order:
stage.owner (developer | frontend-dev) with load: full and contract:
execution_mode: github_issue_stageissue_number, repo, stage_id, stage object (objective, files, acceptance, test_commands, commit_message)issue_ref: #<n> for commitsverifier with same stage contract + completion report.git_commit subject aligned with stage commit_message and Refs: #<issue_number> (final stage may use Closes: #n).helper; do not advance stage index.When discovery fails (queue exhausted):
easy, run the CodeRabbit gate section below before opening/finishing the PR. Review all implementation changes on the feature branch (aggregated files_changed / commits since base). Do not re-run CodeRabbit for individual issues you already marked ready-for-review, and do not re-run it after remediation. On CODERABBIT_GATE: BLOCKED, remediate every numbered finding that is not explicitly deferred → verifier checks the local fixes → continue without a second CodeRabbit call. On CODERABBIT_GATE: PASS (or easy), continue.developer load: minimal: bash "$OC/skills/github-issue-run/lib/feature-finish-pr.sh" "<slug>" — parse JSON (branch, base, pr_url, action, message).medium unless user/issue meta says otherwise).pr_url or skip reason (skipped-opt-out, skipped-protected-branch) inside the mandatory Completion report template below.Opt-out: ORCHESTRATE_AUTO_PR=0 or user instruction not to open a PR. Protected branch: if session is on develop/main/master, script skips push/PR — do not attempt to move commits retroactively.
Prerequisite: Issues must pass issue-expand gates (orchestrate-readiness-check) — substantive Implementation planning and non-empty stages[] in opencode-task-yaml.
artifact_type + slug from artifact path when neededscribe on every artifact write/update callscribe to write it from approved content. After scribe returns success with write/edit tool evidence and no SCRIBE_FAILED, trust the write (no redundant re-read). If missing, no evidence, or SCRIBE_FAILED, re-invoke scribe once.Owner from the artifact StagePlan. Dispatch to that subagent only:
Owner: frontend-dev → invoke frontend-dev (UI/design specialist)Owner: developer → invoke developer (logic/backend specialist)Owner: ux-dev → invoke ux-dev (prototype generation from design artifacts; outputs to .prototype/<slug>/)
Do not dispatch to the wrong subagent for a stage.verifier.helper — then follow orchestrate-recovery if the situation persists or matches loop/env/escalation patterns.After a stage is COMPLETE and verifier has APPROVED, keep a running handoff state in a few lines (last_completed_stage, one-sentence outcome, artifact_path, next_stage_id). Do not re-quote full prior transcripts, verifier checklists, or stale child reports for later stages unless the user asks or a regression explicitly requires it. Prefer current stage + next action when updating the user.
Before any stage status update, confirm these Task calls occurred:
scribe (when needed). After scribe returns success with tool evidence and no SCRIBE_FAILED, trust the write; otherwise re-invoke scribe once.developer, frontend-dev, or ux-dev — must match the stage's Owner. Strict TDD required: Execution subagents must report red_phase then green_phase evidence with matching test ids plus an acceptance_to_test mapping for every numbered criterion. Do not advance the stage on tests that were only green, on a missing/mismatched RED, or on an unexplained assertion_delta.verifierhelper on trigger conditionsvision when child reports IMAGE_REVIEW_NEEDED (see Image Review Gate)report_to_parent payload (completion or blocker) followed by immediate returnIf any required call is missing, stop and issue the missing Task call first.
When a child (developer, frontend-dev, ux-dev, verifier) reports IMAGE_REVIEW_NEEDED: path=<path> context=<what to verify>:
vision with the image path and context.helper to amend the artifact before dispatching.For every child completion report, assign:
report_grade: PASS | NEEDS_RETRY | BLOCKEDUse this rubric:
stage_idred_phase evidence — failing test output from before the code change, demonstrating the bug or the desired-but-unimplemented behavior. For brand-new behavior this is the new test failing on the unfixed code; for behavior changes it is the updated/new test failing on the pre-change code.green_phase evidence — the same test(s) passing after the code change, with the exact same test identifier so RED can be matched to GREEN.assertion_delta — if any test assertion was removed or weakened, it is listed explicitly with a one-line justification. Surface this for verifier scrutiny. (Empty list is fine; a missing field is not.)acceptance_to_test mapping — for every numbered acceptance criterion in the issue/artifact, the report names the test (file + test name + line) that proves it. Criteria without a test are listed separately under uncovered.red_phase evidence — tests were only ever green (no failing-before-change proof); treat as NEEDS_RETRYred_phase and green_phase test identifiers do not match — cannot confirm the same test went RED then GREENassertion_delta — an existing assertion was removed or weakened without justification (a replaced positive assertion is a smell, not a green)acceptance_to_testENV_BLOCKED) or cannot proceed safelyDecision policy:
PASS -> continue to next stageNEEDS_RETRY -> send corrective feedback and rerun same child taskBLOCKED -> invoke helper, amend artifact via scribe, then request user confirmation if environment-related — see orchestrate-recovery for deeper loop and env policy.Invocation budget: Exactly one CodeRabbit CLI invocation per orchestration session (per .plan artifact or per feature:<slug> GitHub run). CodeRabbit is a one-shot recommendation source, not a validation loop. Never Task review with orchestrate_coderabbit_gate between stages, between GitHub issues, after a single issue while more issues remain in the queue, or after CodeRabbit remediation.
When every stage is complete and the final verifier has APPROVED (legacy .plan stage loop or entire GitHub feature queue exhausted with all issues verified):
## Difficulty from the artifact when present (easy | medium | hard). For GitHub-only work with no .plan, assume medium unless the user or issue meta specifies otherwise.easy: Skip this gate. Continue to Difficulty-based completion gates (which also skips extra work for easy).medium or hard: Task review with load: full and this contract:
execution_mode: orchestrate_coderabbit_gateimpl_repo_path: absolute path to the implementation git root (session cwd when already in the impl repo; otherwise from handoff / issue context — must contain .git)base_branch: develop for this repo unless the user explicitly overrides it; otherwise use the known project conventionreview_scope: prefer committed changes since base — coderabbit review --agent --base <base_branch>; use -t all only when the user or stage context requires uncommitted reviewfiles_changed, verifier verdict, commit refs)code-review skill; verify CLI (coderabbit --version, coderabbit auth status); run review; parse every --agent JSONL finding event; return CODERABBIT_GATE, severity counts, and the full numbered finding inventory with file/line anchors when presentCODERABBIT_GATE: PASS (the one-shot CodeRabbit run has zero critical, major, or minor findings, and any trivial/info findings are fixed, not applicable, or explicitly deferred with reason) → continue to Difficulty-based completion gates.CODERABBIT_GATE: BLOCKED (any critical, major, or minor, missing full finding inventory, or missing per-item resolution evidence) → Task developer or frontend-dev per last stage Owner (or last issue owner for GitHub) with load: full: numbered remediation from CodeRabbit only; do not use autofix unattended. Require completion report field coderabbit_resolutions with one entry per finding id: fixed, deferred, or not_applicable, plus rationale for non-fixed items. Then Task verifier load: full on affected acceptance criteria and changed files. If verifier confirms all non-deferred findings were addressed locally and no blocker remains, mark CodeRabbit remediation complete and continue without re-running CodeRabbit. If verifier cannot confirm, invoke helper + user confirmation without marking the gate PASS.CODERABBIT_GATE: SKIPPED (CLI missing, auth failure, or not a git repo) → report reason; do not mark orchestration complete; prompt user to fix CLI/auth or waive explicitly.state:ready-for-review. Put ### CodeRabbit fields in the feature completion summary (and optional final gh comment on the PR), not in per-issue ready-for-review comments.Orchestrate must track across the session: coderabbit_runs (must be 1 when this gate runs), coderabbit_findings (full numbered inventory from the one-shot run), coderabbit_resolutions (per-finding fixed / deferred / not_applicable evidence from developer/frontend-dev), coderabbit_remediation_fixes (items fixed after the one-shot run), and finding counts from the CodeRabbit run. Pass these into the Completion (mandatory) block below — never omit the CodeRabbit section.
When every stage is complete, the final verifier passes, and any required CodeRabbit gate has CODERABBIT_GATE: PASS or local CodeRabbit remediation has been verified complete after the one-shot run (or was skipped because easy):
## Difficulty from the artifact (easy | medium | hard). If the section is missing or unclear, assume medium.easy: Skip extra gates. Go to Completion (mandatory) and prompt the user to switch to architect.medium: Invoke review via Task with: artifact path; aggregated completion summary (each stage_id, files_changed, tests_run outcomes, verifier verdict); include CodeRabbit gate findings when that gate ran. Require a concise post-execution assessment (sign-off vs remediation). If review indicates remediation, use scribe to update or create .plan/review.<slug>.md per existing review flow, then stop and prompt user to address remediation before final sign-off with architect.hard:
senior-dev via Task for scheduled post-implementation review (not STAGE_STUCK escalation): pass artifact path, aggregated implementation summary, Goal + AcceptanceChecks excerpts, and CodeRabbit gate findings when that gate ran. Instruct: read-only assessment unless explicit fix is in scope; return APPROVED or a numbered remediation list. No user confirmation required for this scheduled gate (unlike escalation).helper via Task for strategy conformance: pass artifact path, Goal, AcceptanceChecks, and short summary of what was implemented. Instruct helper to compare implementation intent vs plan and list any logical/architectural mismatches (reasoning only; no code).helper + scribe to amend the artifact as usual before prompting the user.When the user fixes env/worktree issues or asks to rerun checks:
worktree-env then developer preflight-only again; reset env_gate_passed only after Status: Ready.When verifier passes for all stages, any required CodeRabbit gate has CODERABBIT_GATE: PASS or local CodeRabbit remediation has been verified complete after the one-shot run (or was skipped for easy), and any Difficulty-based completion gates for that artifact have finished (see above):
### CodeRabbit table is mandatory on every completion — never omit it. If CodeRabbit did not run, state why explicitly (easy, SKIPPED, or user waiver). Do not mark orchestration complete on medium/hard without CodeRabbit ran: yes and evidence of a successful CLI review.feature:<slug> or .plan/<type>.<slug>.md, display name, repo, PR URL or skip reason, and branch/base when known.architect chat for this feature/sign-off target.## Orchestration complete
### Sign-off target
| Field | Value |
|-------|-------|
| Feature / artifact | `<Display Name>` (`feature:<slug>` or `.plan/<type>.<slug>.md`) |
| Repo | `<owner/name or local repo>` |
| Branch / base | `<branch>` -> `<base>` |
| PR | `<pr_url>` or `<skip reason>` |
| Sign-off owner | `architect` Mode F (GitHub feature) or Mode B (`.plan` artifact) |
### Work completed
| Task / stage | Status | Evidence | Notes / follow-up |
|--------------|--------|----------|-------------------|
| `<issue # / stage_id / task name>` | PASS | `<commit, verifier PASS, tests>` | `<none or concise note>` |
### Gates and checks
| Gate | Result | Evidence | Action needed |
|------|--------|----------|---------------|
| Verifier | PASS | `<summary>` | None |
| Difficulty gates | PASS / skipped | `<review/senior/helper evidence or reason>` | `<none or action>` |
| PR finish | PASS / skipped | `<pr_url/action/message>` | `<none or action>` |
### CodeRabbit (required — do not omit)
| Field | Value |
|-------|-------|
| CodeRabbit ran | yes / no |
| Reason if no | `difficulty: easy`, `CODERABBIT_GATE: SKIPPED — <reason>`, or `user waived` |
| CLI command | `<exact coderabbit review ...>` or `n/a` |
| Review runs | `<count>` |
| Remediation fixes applied | `<count>` |
| Final gate | PASS / BLOCKED / SKIPPED / not required (easy) |
| Final findings | Critical `<n>`; Major `<n>`; Minor `<n>`; Trivial `<n>`; Info `<n>` |
| Finding resolutions | fixed `<n>`; deferred `<n>`; not applicable `<n>`; unresolved `<n>` |
### Key findings / risks
| Item | Impact | Required next action |
|------|--------|----------------------|
| `<finding, risk, deferral, or "None">` | `<low/medium/high or n/a>` | `<specific action or "None">` |
### Next steps
| Order | Who | Action | Exact prompt / input |
|-------|-----|--------|----------------------|
| 1 | User | Start a new `architect` session for this feature sign-off | `feature:<slug> PR: <pr_url>` |
| 2 | architect | Run Mode F/Mode B sign-off, close accepted issues, then documentation | Review the table above; do not re-run orchestration unless remediation is required |
### Copy/paste sign-off script
```text
Orchestrate complete for <Display Name> (`feature:<slug>`).
PR: <pr_url or skip reason>
Please run architect sign-off for this exact feature. Review the Work completed, Gates and checks, CodeRabbit, and Key findings tables above. If accepted, proceed with Mode F/Mode B docs and final sign-off; if not accepted, publish remediation tasks for a new orchestrate session.
```
When CODERABBIT_GATE: BLOCKED, increment Remediation fixes applied only when the child completion report lists which CodeRabbit finding IDs or numbered items were fixed (orchestrate sums across loops). Do not count deferred or not-applicable findings as fixes.
Do not present orchestration as completed unless required Task call evidence exists for each completed stage, for the applicable CodeRabbit gate (when medium/hard), and for the applicable Difficulty gates, and unless the completion report includes the CodeRabbit section above.
tools
AI-powered code review using CodeRabbit CLI. Use only on explicit user request or when parent passes execution_mode orchestrate_coderabbit_gate. Do not run during orchestrated stage/issue work.
tools
Cross-repo companion to to-prd: after PRD frontmatter is filled, run bin/fanout <slug> from this spec repo to create child GitHub issues (one per ticket or legacy slice).
tools
Issue state machine — transition GitHub issue labels per docs/agents/triage-labels.md. Batch helpers via lib/triage.sh.
documentation
Synthesise a PRD from grill-me / research context, write docs/prd/<slug>.md, publish a GitHub issue with prd + state:ready-for-agent + feature:<slug>. Halt after publish — do not invoke fanout.