| name | plan-issue-delivery |
|---|---|
| description | Orchestrate plan-driven issue delivery by sprint: split plan tasks, dispatch subagent PR work, enforce acceptance gates, and advance to the next sprint without main-agent implementation. |
Prereqs:
- Run inside (or have access to) the target git repository.
plan-toolingavailable onPATHfor plan parsing/linting.plan-issueavailable onPATHfor live GitHub orchestration mode.ghavailable onPATH, andgh auth statussucceeds only when using live mode (plan-issue).
Inputs:
- Plan file path (
docs/plans/...-plan.md). - Runtime workspace root (fixed):
$AGENT_HOME/out/plan-issue-delivery. - Repository slug for runtime namespacing (derived from
--repo <owner/repo>or local git remote). - Plan issue number (
--issue <number>) afterstart-plancreates the single issue. - Repository default branch (
DEFAULT_BRANCH, for examplemain), resolved once per plan issue. - Plan integration branch name (
PLAN_BRANCH, for exampleplan/issue-<number>), created fromDEFAULT_BRANCHafterstart-plan. - Persisted
PLAN_BRANCH_REF_PATHartifact under issue runtime for deterministic restarts. - Sprint number for sprint orchestration commands.
- Sprint approval comment URL (
SPRINT_APPROVED_COMMENT_URL) foraccept-sprint. - Plan-close approval comment URL (
PLAN_APPROVED_COMMENT_URL) forclose-plan. - Approval URL format for both gates:
https://github.com/<owner>/<repo>/(issues|pull)/<n>#issuecomment-<id>. - Final plan integration PR URL/number (
PLAN_INTEGRATION_PR) forPLAN_BRANCH -> DEFAULT_BRANCH. - Final integration merge strategy for
PLAN_BRANCH -> DEFAULT_BRANCH: prefer--squashwhen allowed, fallback to--mergewhen squash merge is unavailable by repo/branch policy. - Plan issue mention comment URL for final integration PR
(
PLAN_INTEGRATION_MENTION_URL), posted on the single plan issue. - Plan conformance review artifact path (
PLAN_CONFORMANCE_REVIEW_PATH) written by main-agent before final integration merge. - Final integration required-check verification artifact path (
PLAN_INTEGRATION_CI_PATH) written by main-agent before final integration merge. - Final integration CI policy:
- main-agent must require all required checks to pass before merge
no checks reportedis treated as a merge-blocking failure unless the user explicitly approves override in-thread
- Corrective implementation exception policy:
- default: main-agent requests follow-up back to the assigned lane
- exception: main-agent may apply a minimal corrective fix only when explicitly justified and documented in review evidence
- Local sync policy:
- after each
accept-sprint: sync localPLAN_BRANCHto latest remote state - after final integration merge +
close-plan: sync localDEFAULT_BRANCHto latest remote state
- after each
- Optional repository override (
--repo <owner/repo>) in live mode. - Typed subcommands:
start-plan,start-sprint,link-pr,ready-sprint,accept-sprint,status-plan,ready-plan,close-plan. - Main-agent init source prompt path (
MAIN_AGENT_INIT_SOURCE_PATH):$AGENT_HOME/prompts/plan-issue-delivery-main-agent-init.md. - Issue-scoped
MAIN_AGENT_INIT_SNAPSHOT_PATHcopied fromMAIN_AGENT_INIT_SOURCE_PATHduring issue runtime initialization. - Review evidence template path (
REVIEW_EVIDENCE_TEMPLATE_PATH):$AGENT_HOME/skills/workflows/issue/issue-pr-review/references/REVIEW_EVIDENCE_TEMPLATE.md. - Decision-scoped review evidence artifact path (
REVIEW_EVIDENCE_PATH) per review decision. - Mandatory subagent dispatch bundle:
- rendered
TASK_PROMPT_PATHfromstart-sprint - sprint-scoped
SUBAGENT_INIT_SNAPSHOT_PATHcopied from$AGENT_HOME/prompts/plan-issue-delivery-subagent-init.md - issue-scoped
PLAN_SNAPSHOT_PATHcopied from the source plan at sprint start - task-scoped
DISPATCH_RECORD_PATH(for example.../manifests/dispatch-<TASK_ID>.json) with artifact paths + execution facts + selected workflow-role metadata and optional runtime adapter metadata - plan task context per assignment (exact plan task section snippet and/or direct plan section link/path)
- rendered
- Canonical workflow roles:
implementation: sprint lanes that edit code, run tests, and own sprint PRsreview: read-only PR review evidence, plan-conformance audits, and diff checksmonitor: long-running CI/status polling and watch tasks
- Runtime role adapters:
- canonical workflow roles are repo truth; runtime-specific named roles are optional adapters
- reference mapping lives in
references/AGENT_ROLE_MAPPING.md - runtime examples such as Codex
[agents.<role>], Claude Code.claude/agents/, and OpenCodeopencode.jsonbelong to adapters, not repo contract - optional explicit installer/sync entrypoint:
$AGENT_HOME/scripts/plan-issue-adapter <install|sync|status> --runtime <codex|claude|opencode> [--apply]
- Dispatch role traceability:
- prompt manifest rows must record
workflow_role DISPATCH_RECORD_PATHmust recordworkflow_role- when a runtime uses named child-agent roles, also record
runtime_nameandruntime_role - if a named-role runtime falls back to a generic child agent, record
runtime_role=genericplusruntime_role_fallback_reason
- prompt manifest rows must record
- Local rehearsal policy:
- Default execution path is live mode (
plan-issue) in this main skill. - If the user explicitly requests rehearsal, load
references/LOCAL_REHEARSAL.mdand run that playbook.
- Default execution path is live mode (
- Required PR grouping controls:
- Authoritative grouping rules live in
## PR Grouping Steps (Mandatory). - Keep grouping flags consistent across
start-plan,start-sprint,ready-sprint,accept-sprint.
- Authoritative grouping rules live in
Outputs:
- Plan-scoped task-spec TSV generated from all plan tasks (all sprints) for one issue.
- Sprint-scoped task-spec TSV generated per sprint for subagent dispatch hints, including
pr_group. - Sprint-scoped rendered subagent prompt files + a prompt manifest
(
task_id -> prompt_path -> execution_mode -> workflow_role [-> runtime_role]) generated atstart-sprint. - Runtime artifacts and worktrees are namespaced under
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-<number>/.... - Issue-scoped main-agent init prompt snapshot
(
MAIN_AGENT_INIT_SNAPSHOT_PATH) is generated for deterministic orchestration restarts. - Decision-scoped review evidence artifacts
(
REVIEW_EVIDENCE_PATH) are generated under sprint runtime for eachrequest-followup|merge|close-prdecision. - Main-agent posts decision-scoped review-evidence PR comments and keeps those comment URLs traceable in issue-side sync actions.
- Issue-scoped plan snapshot (
PLAN_SNAPSHOT_PATH) is generated for dispatch fallback. - Sprint-scoped subagent companion prompt snapshot (
SUBAGENT_INIT_SNAPSHOT_PATH) is generated for immutable dispatch. - Task-scoped dispatch records (
DISPATCH_RECORD_PATH) are generated per assignment for traceability, including canonicalworkflow_roleand optional runtime adapter fields (runtime_name,runtime_role,runtime_role_fallback_reason). plan-tooling split-prsv2 emits grouping primitives only (task_id,summary,pr_group);plan-issuematerializes runtime metadata (Owner/Branch/Worktree/Notes).- Live mode (
plan-issue) creates/updates exactly one GitHub Issue for the whole plan (1 plan = 1 issue). ## Task Decompositionremains runtime-truth for execution lanes;start-sprintvalidates drift against plan-derived lane metadata before emitting artifacts.- Sprint task-spec/prompts are derived artifacts from runtime-truth rows (not a second execution source of truth).
link-prnormalizes PR references to canonical#<number>and updates taskPR/Statusfields.link-pr --task <task-id>auto-syncs all rows in the same runtime lane (per-sprint/pr-shared) to keep shared-lane PR/state consistent.link-pr --sprint <n>must resolve to a single runtime lane; use--pr-group <group>when sprintnhas multiple shared lanes.ready-sprintis a pre-merge review gate: linked sprint PRs should still be open and reviewable.- Sprint PR review verifies lane mapping, required checks, and target
baseRefName == PLAN_BRANCHbefore merge decisions. accept-sprintadditionally enforces sprint PRs are merged intoPLAN_BRANCHand syncs sprint taskStatustodonein live mode.start-sprintfor sprintN>1is blocked until sprintN-1is merged and all its task rows aredone.start-planinitializes and persistsPLAN_BRANCH(created fromDEFAULT_BRANCH) atPLAN_BRANCH_REF_PATH.- Final close path includes one main-agent integration PR (
PLAN_BRANCH -> DEFAULT_BRANCH) and persists traceability atPLAN_INTEGRATION_PR_PATH. - Main-agent must emit
PLAN_CONFORMANCE_REVIEW_PATHproving final merged scope matches plan task intent before merging integration PR. - Main-agent must emit
PLAN_INTEGRATION_CI_PATHproving required checks are green for the integration PR before merging integration PR. - Main-agent must post one plan-issue comment that mentions the final
integration PR (
#<number>) and persist its URL atPLAN_INTEGRATION_MENTION_PATH. - Main-agent must run local sync commands after merge gates so local branch
state reflects remote (
PLAN_BRANCHafter sprint acceptance,DEFAULT_BRANCHafter close-plan). - PR references in sprint comments and review tables use canonical
#<number>format. - Sprint start comments may still show
TBDPR placeholders until subagents open PRs and rows are linked. start-sprintcomments append the full markdown section for the active sprint from the plan file (for example Sprint 1/2/3 sections).- Dispatch hints can open one shared PR for multiple ordered/small tasks when grouped.
- Main-agent must launch subagents with the full dispatch bundle:
- rendered
TASK_PROMPT_PATHartifact SUBAGENT_INIT_SNAPSHOT_PATHartifact from$AGENT_HOME/out/plan-issue-delivery/...PLAN_SNAPSHOT_PATHartifact from$AGENT_HOME/out/plan-issue-delivery/...DISPATCH_RECORD_PATHartifact from$AGENT_HOME/out/plan-issue-delivery/...- selected
workflow_role - optional
runtime_name+runtime_role(orruntime_role_fallback_reasonwhen a named-role runtime falls back to generic) - assigned
PLAN_BRANCHbase-branch context for sprint PR creation - plan task section context (snippet/link/path)
- rendered
- Ad-hoc dispatch prompts that bypass the required bundle are invalid.
- Final issue close only after plan-level acceptance, merged-PR close gate, and integration mention gate.
close-planenforces integration mention + cleanup of all issue-assigned task worktrees before completion.- Definition of done: execution is complete only when
close-plansucceeds, the plan issue is closed (live mode), integration mention gate passes, plan-conformance gate passes, integration required-check gate passes, worktree cleanup passes, and required local sync commands succeed. - Error contract: if any gate/command fails, stop forward progress and report the failing command plus key stderr/stdout gate errors.
- Runtime task lanes stay stable across implementation, clarification, CI, and review follow-up unless main-agent explicitly reassigns them.
Exit codes:
0: success1: runtime failure / gate failure2: usage error
Failure modes:
- Plan file missing, sprint missing, or selected sprint has zero tasks.
- Required commands missing (
plan-tooling,plan-issue;ghonly required for live GitHub mode). - Typed argument validation fails (unknown subcommand, invalid flag, malformed
--pr-group, invalid--pr-grouping). link-prPR selector invalid (--prmust resolve to a concrete PR number).link-prtarget ambiguous (for example sprint selector spans multiple runtime lanes without--pr-group).- Live mode approval URL invalid.
- Runtime workspace root missing/unwritable (
$AGENT_HOME/out/plan-issue-delivery). - Issue/sprint runtime artifacts missing (for example
MAIN_AGENT_INIT_SNAPSHOT_PATH,REVIEW_EVIDENCE_PATH,TASK_PROMPT_PATH,PLAN_SNAPSHOT_PATH,SUBAGENT_INIT_SNAPSHOT_PATH,PLAN_BRANCH_REF_PATH,PLAN_INTEGRATION_PR_PATH,PLAN_INTEGRATION_MENTION_PATH, orDISPATCH_RECORD_PATHnot emitted under runtime root). PLAN_BRANCHis missing/unresolvable for sprint dispatch or differs from the persistedPLAN_BRANCH_REF_PATHvalue.- A sprint PR is linked with
baseRefName != PLAN_BRANCH. ready-sprintcheckpoint reached after sprint PRs were already merged without post-merge audit evidence + explicit follow-up decision.- Main-agent review decision attempted without validated review evidence (for
example missing
--enforce-review-evidence, missing/invalidREVIEW_EVIDENCE_PATH, or generic non-evidenced decision text). - Subagent dispatch launched without required bundle (
TASK_PROMPT_PATH,SUBAGENT_INIT_SNAPSHOT_PATH,PLAN_SNAPSHOT_PATH,DISPATCH_RECORD_PATH, plan task section snippet/link/path). - Subagent dispatch launched without canonical
workflow_rolerecorded in manifest/dispatch record. - Active runtime uses named child-agent roles but dispatch omitted
runtime_name/runtime_rolemetadata. - Named-role runtime fell back to generic dispatch without
runtime_role_fallback_reason. - Assigned task
Worktreeis outside$AGENT_HOME/out/plan-issue-delivery/.... - Final plan close gate fails (task status/PR merge not satisfied in live mode).
- Final plan close gate fails because the integration PR (
PLAN_BRANCH -> DEFAULT_BRANCH) is missing or unmerged. - Final plan close gate fails because
PLAN_CONFORMANCE_REVIEW_PATHis missing, incomplete, or reports unresolved plan mismatches. - Final plan close gate fails because
PLAN_INTEGRATION_CI_PATHis missing/invalid, required checks are not green, or checks returnno checks reportedwithout explicit user-approved override. - Final plan close gate fails because integration PR mention comment on the plan issue is missing/invalid/untraceable.
- Main-agent applies corrective implementation without explicit exception rationale and verification evidence.
- Local sync command fails after
accept-sprintor after finalclose-plan. - Worktree cleanup gate fails (any issue-assigned task worktree still exists after cleanup).
- Attempted transition to a next sprint that does not exist.
- Use one runtime root for this skill only:
RUNTIME_ROOT="$AGENT_HOME/out/plan-issue-delivery". - Namespace by repository and issue:
ISSUE_ROOT="$RUNTIME_ROOT/<repo-slug>/issue-<ISSUE_NUMBER>"SPRINT_ROOT="$ISSUE_ROOT/sprint-<N>"
- Required runtime artifacts:
MAIN_AGENT_INIT_SOURCE_PATH="$AGENT_HOME/prompts/plan-issue-delivery-main-agent-init.md"MAIN_AGENT_INIT_SNAPSHOT_PATH="$ISSUE_ROOT/prompts/plan-issue-delivery-main-agent-init.snapshot.md"REVIEW_EVIDENCE_TEMPLATE_PATH="$AGENT_HOME/skills/workflows/issue/issue-pr-review/references/REVIEW_EVIDENCE_TEMPLATE.md"REVIEW_EVIDENCE_PATH="$SPRINT_ROOT/reviews/<TASK_ID>-<decision>.md"PLAN_SNAPSHOT_PATH="$ISSUE_ROOT/plan/plan.snapshot.md"PLAN_BRANCH_REF_PATH="$ISSUE_ROOT/plan/plan-branch.ref"(contains canonicalPLAN_BRANCHname)PLAN_INTEGRATION_PR_PATH="$ISSUE_ROOT/plan/plan-integration-pr.md"(tracks finalPLAN_BRANCH -> DEFAULT_BRANCHPR)PLAN_CONFORMANCE_REVIEW_PATH="$ISSUE_ROOT/plan/plan-conformance-review.md"(final plan-task conformance verdict + evidence)PLAN_INTEGRATION_CI_PATH="$ISSUE_ROOT/plan/plan-integration-ci.md"(required-check verification for final integration PR)PLAN_INTEGRATION_MENTION_PATH="$ISSUE_ROOT/plan/plan-integration-mention.url"(tracks issue-comment URL that mentions final integration PR)TASK_PROMPT_PATH="$SPRINT_ROOT/prompts/<TASK_ID>.md"SUBAGENT_INIT_SNAPSHOT_PATH="$SPRINT_ROOT/prompts/plan-issue-delivery-subagent-init.snapshot.md"- prompt manifest under
"$SPRINT_ROOT/manifests/" DISPATCH_RECORD_PATH="$SPRINT_ROOT/manifests/dispatch-<TASK_ID>.json"
- Worktree path rules (must be absolute paths under
"$ISSUE_ROOT/worktrees"):pr-isolated:.../worktrees/pr-isolated/<TASK_ID>pr-shared:.../worktrees/pr-shared/<PR_GROUP>per-sprint:.../worktrees/per-sprint/sprint-<N>
start-plan(or immediate post-start-planissue runtime initialization) must copyMAIN_AGENT_INIT_SOURCE_PATHintoMAIN_AGENT_INIT_SNAPSHOT_PATHbefore anystart-sprint.start-plan(or immediate post-start-planissue runtime initialization) must resolveDEFAULT_BRANCH, create/pushPLAN_BRANCHfromDEFAULT_BRANCH, and persistPLAN_BRANCH_REF_PATHbefore anystart-sprint.start-sprintmust copy the source plan intoPLAN_SNAPSHOT_PATHbefore subagent dispatch.start-sprintmust copy$AGENT_HOME/prompts/plan-issue-delivery-subagent-init.mdintoSUBAGENT_INIT_SNAPSHOT_PATHbefore subagent dispatch.start-sprintmust emit oneDISPATCH_RECORD_PATHper assigned task before subagent dispatch.start-sprintdispatch artifacts must includePLAN_BRANCHas required base branch for sprint PR creation.- Subagent plan reference priority:
- assigned plan task snippet/link/path (primary)
PLAN_SNAPSHOT_PATH(fallback)- source plan path (last fallback)
- After every successful
accept-sprint, main-agent must sync localPLAN_BRANCH:git fetch origin --prunegit switch "$PLAN_BRANCH"(or create tracking branch fromorigin/$PLAN_BRANCHif missing)git pull --ff-only
close-planmust enforce final integration PR merged (PLAN_BRANCH -> DEFAULT_BRANCH), integration PR mention comment on plan issue, and worktree cleanup under"$ISSUE_ROOT/worktrees"; leftovers fail the close gate.close-planmust also enforce final conformance + integration CI artifacts:PLAN_CONFORMANCE_REVIEW_PATHpresent with pass verdictPLAN_INTEGRATION_CI_PATHpresent with required checks green (or explicit user-approved override)
- After successful
close-plan, main-agent must sync localDEFAULT_BRANCH:git fetch origin --prunegit switch "$DEFAULT_BRANCH"(or create tracking branch fromorigin/$DEFAULT_BRANCHif missing)git pull --ff-only
- Follow the shared task-lane continuity policy:
skills/workflows/issue/_shared/references/TASK_LANE_CONTINUITY.md - Treat each runtime row as one task lane that stays stable until merge/close.
- If a lane is blocked on missing/conflicting context or an external
dependency, keep the lane assignment intact, sync
blocked, and resume the same lane after clarification/unblock. - Replacement subagent dispatch is exceptional; when it happens, preserve runtime-truth facts and existing PR linkage unless the row is intentionally updated first.
- Canonical workflow roles are repo-owned and runtime-agnostic:
implementation: implementation-owned sprint lanes that edit code, update tests, and own sprint PRs.review: read-only PR review evidence, merged-diff audit, and plan-conformance analysis support for main-agent.monitor:gh pr checks --watch, CI/status polling, and other long-running wait tasks that do not own merge decisions.
- Main-agent remains the decision authority even when
review/monitorchild agents are used. - Persist
workflow_rolein sprint prompt manifests and eachDISPATCH_RECORD_PATH. - If the active runtime supports named child-agent roles, map
workflow_rolethrough a runtime adapter and additionally persistruntime_nameandruntime_role. - If a named-role runtime falls back to a generic child agent, record
runtime_role=genericplusruntime_role_fallback_reason; do not silently downgrade. - See
references/AGENT_ROLE_MAPPING.mdfor runtime adapter examples.
plan-issue(live GitHub orchestration)
- This skill intentionally keeps no repo-local wrapper script for
plan-issue. - Keep
plan-issueas the shared primitive on PATH; do not add duplicateplan-issue-*wrappers underskills/automation/. - Shared reusable logic belongs in shared references or automation libs, not new wrapper entrypoints.
- Local rehearsal playbook (
plan-issue-localandplan-issue --dry-run):references/LOCAL_REHEARSAL.md - Runtime layout and path rules:
references/RUNTIME_LAYOUT.md - Workflow-role to runtime-adapter mapping:
references/AGENT_ROLE_MAPPING.md - Runtime adapter installer/sync entrypoint:
$AGENT_HOME/scripts/plan-issue-adapter - Codex adapter guide + templates:
references/CODEX_ADAPTER.md - Claude Code adapter guide + templates:
references/CLAUDE_CODE_ADAPTER.md - OpenCode adapter guide + templates:
references/OPENCODE_ADAPTER.md - Review evidence template for main-agent decisions:
skills/workflows/issue/issue-pr-review/references/REVIEW_EVIDENCE_TEMPLATE.md - Shared task-lane continuity policy (canonical):
skills/workflows/issue/_shared/references/TASK_LANE_CONTINUITY.md - Shared main-agent review rubric (canonical):
skills/workflows/issue/_shared/references/MAIN_AGENT_REVIEW_RUBRIC.md - Shared post-review outcome handling (canonical):
skills/workflows/issue/_shared/references/POST_REVIEW_OUTCOMES.md
- Validate the plan (
plan-tooling validate) and lock grouping policy (metadata-first--strategy auto --default-pr-grouping groupby default). - Run
start-plan, then capture the emitted issue number once and reuse it for all later commands. - Initialize issue runtime workspace under
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-<number>/, and copyMAIN_AGENT_INIT_SOURCE_PATHintoMAIN_AGENT_INIT_SNAPSHOT_PATH; then resolveDEFAULT_BRANCH, createPLAN_BRANCH, and persistPLAN_BRANCH_REF_PATH. - Run
start-sprint, resolveworkflow_rolefor each spawned task and, when relevant, runtime adapter mapping, ensureMAIN_AGENT_INIT_SNAPSHOT_PATH+REVIEW_EVIDENCE_PATH+TASK_PROMPT_PATH+PLAN_SNAPSHOT_PATH+SUBAGENT_INIT_SNAPSHOT_PATH+DISPATCH_RECORD_PATHartifacts exist, recordworkflow_role(and optional runtime adapter metadata) in prompt manifests/dispatch records, dispatch subagents withPLAN_BRANCHbase-branch context, keep task lanes stable, and keep row state current vialink-pr. - For each sprint: implement/clarify/follow-up on subagent-owned lanes ->
ready-sprint(pre-merge review gate, PRs should still be open) -> main-agent review decisions + merge intoPLAN_BRANCH->accept-sprint-> localPLAN_BRANCHsync (git fetch+git switch+git pull --ff-only). - Repeat step 5 for each next sprint (
start-sprintis blocked until prior sprint is merged+done). - After final sprint acceptance, run
ready-plan, then execute final integration gates in order:- main-agent performs full plan conformance review against plan tasks, runtime
rows, merged sprint PRs, and current
PLAN_BRANCHdiff; writesPLAN_CONFORMANCE_REVIEW_PATH. - if conformance review finds mismatch, default action is lane follow-up dispatch on the original lane; main-agent corrective implementation is a documented exception only.
- open the final integration PR (
PLAN_BRANCH -> DEFAULT_BRANCH) and persistPLAN_INTEGRATION_PR_PATH. - wait for required checks to pass (
gh pr checks <integration-pr> --required --watch) and writePLAN_INTEGRATION_CI_PATH;no checks reportedis merge-blocking unless user explicitly approves override. - merge integration PR only after both gates pass, using squash-first fallback-to-merge strategy.
- post a plan-issue mention comment for the merged integration PR and persist
PLAN_INTEGRATION_MENTION_PATH. - run
close-planwith plan-level approval URL, then localDEFAULT_BRANCHsync (git fetch+git switch+git pull --ff-only).
- main-agent performs full plan conformance review against plan tasks, runtime
rows, merged sprint PRs, and current
- If rehearsal is explicitly requested, switch to
references/LOCAL_REHEARSAL.md.
- Resolve grouping intent from user instructions before any split command.
- If the user did not explicitly request grouping behavior, lock to
metadata-first auto (
--strategy auto --default-pr-grouping group). - Use explicit
group + deterministiconly when the user explicitly requests deterministic/manual grouping.- You must pass
--pr-groupand cover every task in scope.
- You must pass
- Use explicit
per-sprintonly when the user explicitly requests one shared lane per sprint.- Use
--strategy deterministic --pr-grouping per-sprint. - Do not pass
--pr-group; all tasks in the sprint share one PR group anchor.
- Use
- Keep the same grouping arguments across the same sprint flow
(
start-plan,start-sprint,ready-sprint,accept-sprint) to avoid row/spec drift.
- Do not stop after
start-plan,start-sprint,ready-sprint, oraccept-sprintas a final state. - A successful run must terminate at
close-planwith:- issue state
CLOSED - merged-PR close gate satisfied
PLAN_CONFORMANCE_REVIEW_PATHpresent with pass verdict and traceable evidencePLAN_INTEGRATION_CI_PATHpresent with required checks green (or explicit user override recorded)- final integration PR (
PLAN_BRANCH -> DEFAULT_BRANCH) merged - plan issue mention comment exists for final integration PR
- local
PLAN_BRANCHsync succeeded after each sprint acceptance - local
DEFAULT_BRANCHsync succeeded after final close - worktree cleanup gate passing
- issue state
- If any close gate fails, treat the run as unfinished and report:
- failing command
- gate errors (task status, PR merge, plan conformance, integration CI, integration PR, integration mention, local sync, approval URL, worktree cleanup)
- next required unblock action
- Confirm the plan file exists and passes
plan-tooling validate. - Default execution mode is live (
plan-issue ...). - If the user explicitly asks for local rehearsal, switch to
references/LOCAL_REHEARSAL.mdinstead of mixing rehearsal commands into this flow. - Lock PR grouping policy from user intent:
- no explicit user request: use metadata-first auto
(
--strategy auto --default-pr-grouping group) - explicit request for deterministic/manual grouping: use
--strategy deterministic --pr-grouping groupwith full--pr-groupcoverage - explicit request for one-shared-lane-per-sprint behavior: use
--strategy deterministic --pr-grouping per-sprint
- no explicit user request: use metadata-first auto
(
- Run
start-planto initialize plan orchestration (1 plan = 1 issuein live mode). - Capture the issue number immediately after
start-planand store it for reuse:- Example:
ISSUE_NUMBER=<start-plan output issue number> - Every follow-up command in this flow should use
--issue "$ISSUE_NUMBER".
- Example:
- Initialize issue runtime workspace and plan snapshot:
- Runtime root:
$AGENT_HOME/out/plan-issue-delivery - Issue root:
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-$ISSUE_NUMBER - Main-agent init source path:
$AGENT_HOME/prompts/plan-issue-delivery-main-agent-init.md - Main-agent init snapshot path:
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-$ISSUE_NUMBER/prompts/plan-issue-delivery-main-agent-init.snapshot.md - Copy main-agent init source prompt into the snapshot path before any
start-sprintexecution. - Snapshot path:
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-$ISSUE_NUMBER/plan/plan.snapshot.md - Subagent init snapshot path:
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-$ISSUE_NUMBER/sprint-<N>/prompts/plan-issue-delivery-subagent-init.snapshot.md - Dispatch record path:
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-$ISSUE_NUMBER/sprint-<N>/manifests/dispatch-<TASK_ID>.json - Plan branch ref path:
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-$ISSUE_NUMBER/plan/plan-branch.ref - Plan integration PR record path:
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-$ISSUE_NUMBER/plan/plan-integration-pr.md - Plan conformance review path:
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-$ISSUE_NUMBER/plan/plan-conformance-review.md - Plan integration CI verification path:
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-$ISSUE_NUMBER/plan/plan-integration-ci.md - Plan integration mention record path:
$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-$ISSUE_NUMBER/plan/plan-integration-mention.url - Resolve and persist branch contract:
DEFAULT_BRANCH="$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')"PLAN_BRANCH="plan/issue-$ISSUE_NUMBER"git fetch origin --prunegit checkout -B "$PLAN_BRANCH" "origin/$DEFAULT_BRANCH"git push -u origin "$PLAN_BRANCH"printf '%s\n' "$PLAN_BRANCH" > "$PLAN_BRANCH_REF_PATH"
- Runtime root:
- Run
start-sprintfor Sprint 1 on the same plan issue token/number:- main-agent verifies
MAIN_AGENT_INIT_SNAPSHOT_PATHexists before sprint dispatch - main-agent follows the locked grouping policy (default metadata-first auto
with
--default-pr-grouping group; switch only on explicit user request) and emits dispatch hints - main-agent assigns canonical workflow roles before spawning:
implementationfor implementation-owned sprint lanesreviewfor read-only audit/evidence helpers, when usedmonitorfor CI/status watch helpers, when used
- if the active runtime supports named child-agent roles:
- map the canonical
workflow_rolethrough the active runtime adapter - record
runtime_name+runtime_role - if the named-role adapter is unavailable, record
runtime_role=genericplusruntime_role_fallback_reason
- map the canonical
- main-agent starts subagents using dispatch bundles that include:
- rendered
TASK_PROMPT_PATHprompt artifact from dispatch hints SUBAGENT_INIT_SNAPSHOT_PATHcopied from$AGENT_HOME/prompts/plan-issue-delivery-subagent-init.mdPLAN_SNAPSHOT_PATHfrom issue runtime workspaceDISPATCH_RECORD_PATHfrom sprint manifest artifacts- selected
workflow_role - optional
runtime_name+runtime_role PLAN_BRANCH(required base branch for sprint PRs)- assigned plan task section snippet/link/path (from plan file or sprint-start comment section)
- rendered
- subagents create or re-enter assigned worktrees/PRs and implement tasks on their assigned lanes
- main-agent verifies
- While sprint work is active, link each subagent PR into runtime-truth rows with
link-pr:- task scope:
plan-issue link-pr --issue <number> --task <task-id> --pr <#123|123|pull-url> [--status <planned|in-progress|blocked>] - sprint scope:
plan-issue link-pr --issue <number> --sprint <n> --pr-group <group> --pr <#123|123|pull-url> [--status <planned|in-progress|blocked>] --taskauto-syncs shared lanes;--sprintwithout--pr-groupis valid only when the sprint target resolves to one runtime lane.- Use
in-progresswhile a lane is actively implementing, fixing CI, or addressing review follow-up. - Use
blockedwhile a lane is waiting on missing/conflicting context or another external unblock.
- task scope:
- If a lane is blocked by missing/conflicting context or another external dependency, stop forward progress, clarify/unblock it, and send work back to that same lane by default.
- Optionally run
status-plancheckpoints to keep plan-level progress snapshots traceable. - When sprint work is ready, run
ready-sprintas the pre-merge review checkpoint:- expected state: linked sprint PRs are open, CI-ready, and target
PLAN_BRANCH - if any sprint PR is already merged, switch to post-merge audit mode before acceptance:
- generate decision-scoped review evidence from merged diff/CI history
- decide follow-up on the same lane (reopen work via replacement PR) vs accept as-is
- expected state: linked sprint PRs are open, CI-ready, and target
- Main-agent reviews each sprint PR against the shared review rubric
(
skills/workflows/issue/_shared/references/MAIN_AGENT_REVIEW_RUBRIC.md), generatesREVIEW_EVIDENCE_PATHfromREVIEW_EVIDENCE_TEMPLATE_PATH, and executesissue-pr-reviewdecisions with--enforce-review-evidenceso eachrequest-followup|merge|close-praction is grounded in concrete evidence. Then records approval and requests follow-up back to the same subagent-owned lanes or merges/closes the PRs.- merge authority stays with main-agent
- sprint PR merges must target
PLAN_BRANCH, notDEFAULT_BRANCH
- After each review decision, apply
skills/workflows/issue/_shared/references/POST_REVIEW_OUTCOMES.mdto sync runtime-truth rows before any further dispatch or acceptance gate. - Run
accept-sprintwithSPRINT_APPROVED_COMMENT_URLin live mode to enforce merged-PR gate (merged intoPLAN_BRANCH) and sync sprint task status rows todone(issue stays open). - Sync local
PLAN_BRANCHafter each successfulaccept-sprint:git fetch origin --prunegit switch "$PLAN_BRANCH"(or create tracking branch fromorigin/$PLAN_BRANCHif missing)git pull --ff-only
- If another sprint exists, run
start-sprintfor the next sprint on the same issue; this is blocked until prior sprint is merged+done. - After the final sprint is implemented and accepted, run
ready-planfor final review:plan-issue ready-plan --issue <number> [--repo <owner/repo>] - Main-agent executes full plan-conformance review before integration merge,
then writes
PLAN_CONFORMANCE_REVIEW_PATH:- verify each plan task is fully satisfied by merged sprint PRs + current
PLAN_BRANCHdiff - if mismatch exists, default action is lane follow-up on the original lane
- main-agent corrective implementation is exceptional and must include explicit rationale + verification evidence
- verify each plan task is fully satisfied by merged sprint PRs + current
- Main-agent opens exactly one integration PR from
PLAN_BRANCHintoDEFAULT_BRANCH, then records the PR reference inPLAN_INTEGRATION_PR_PATH. - Main-agent verifies integration PR required checks are green before merge,
writes
PLAN_INTEGRATION_CI_PATH, and blocks merge when checks are not green:gh pr checks <integration-pr> --required --watchno checks reportedis merge-blocking unless user explicitly approves override in-thread
- Merge integration PR only after steps 19 and 21 pass.
- Main-agent posts one plan-issue comment that mentions the merged
integration PR (
#<number>) and records the comment URL inPLAN_INTEGRATION_MENTION_PATH. - Run
close-planwithPLAN_APPROVED_COMMENT_URLin live mode to enforce merged-PR/task + integration-PR + integration-mention gates, close the single plan issue, and force cleanup of task worktrees:plan-issue close-plan --issue <number> --approved-comment-url <comment-url> [--repo <owner/repo>] - Sync local
DEFAULT_BRANCHafter successful final close:git fetch origin --prunegit switch "$DEFAULT_BRANCH"(or create tracking branch fromorigin/$DEFAULT_BRANCHif missing)git pull --ff-only
Default command templates in this section use the fixed policy
--strategy auto --default-pr-grouping group. Only switch to deterministic
grouping or explicit per-sprint deterministic mode when the user explicitly
requests that behavior. Capture the ISSUE_NUMBER output from start-plan
once, then reuse it in all --issue flags. Keep approval URLs explicit per
gate: SPRINT_APPROVED_COMMENT_URL for accept-sprint,
PLAN_APPROVED_COMMENT_URL for close-plan. Sprint PRs target PLAN_BRANCH;
only the final integration PR targets DEFAULT_BRANCH. Before close-plan,
main-agent must complete conformance + required-check gates for the integration
PR, then post an issue comment that mentions the integration PR and keep that
comment URL.
-
Live mode (
plan-issue)-
Validate:
plan-tooling validate --file <plan.md> -
Start plan:
plan-issue start-plan --plan <plan.md> --strategy auto --default-pr-grouping group [--repo <owner/repo>] -
Initialize branch contract (after capturing
ISSUE_NUMBER):DEFAULT_BRANCH="$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')" PLAN_BRANCH="plan/issue-${ISSUE_NUMBER}" PLAN_BRANCH_REF_PATH="$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-${ISSUE_NUMBER}/plan/plan-branch.ref" git fetch origin --prune git checkout -B "$PLAN_BRANCH" "origin/$DEFAULT_BRANCH" git push -u origin "$PLAN_BRANCH" printf '%s\n' "$PLAN_BRANCH" > "$PLAN_BRANCH_REF_PATH"
-
Start sprint:
plan-issue start-sprint --plan <plan.md> --issue <number> --sprint <n> --strategy auto --default-pr-grouping group [--repo <owner/repo>] -
Link PR (task scope):
plan-issue link-pr --issue <number> --task <task-id> --pr <#123|123|pull-url> [--status <planned|in-progress|blocked>] [--repo <owner/repo>] -
Link PR (sprint lane scope):
plan-issue link-pr --issue <number> --sprint <n> [--pr-group <group>] --pr <#123|123|pull-url> [--status <planned|in-progress|blocked>] [--repo <owner/repo>]
-
Status checkpoint (optional):
plan-issue status-plan --issue <number> [--repo <owner/repo>] -
Ready sprint:
plan-issue ready-sprint --plan <plan.md> --issue <number> --sprint <n> --strategy auto --default-pr-grouping group [--repo <owner/repo>] -
Pre-merge review check (recommended before merge decisions):
gh pr view <pr-number> --json state,baseRefName,headRefName,isDraft,statusCheckRollup
- Expected:
state=OPEN,baseRefName=$PLAN_BRANCH, required checks green. - Treat
no checks reportedas blocking failure unless user explicitly approves override.
- Expected:
-
Accept sprint:
plan-issue accept-sprint --plan <plan.md> --issue <number> --sprint <n> --strategy auto --default-pr-grouping group --approved-comment-url <comment-url> [--repo <owner/repo>]
-
Local sync after sprint acceptance:
git fetch origin --prune git switch "$PLAN_BRANCH" || git switch -c "$PLAN_BRANCH" --track "origin/$PLAN_BRANCH" git pull --ff-only
-
Ready plan:
plan-issue ready-plan --issue <number> [--repo <owner/repo>] -
Write final plan conformance review (
PLAN_CONFORMANCE_REVIEW_PATH):PLAN_CONFORMANCE_REVIEW_PATH="$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-${ISSUE_NUMBER}/plan/plan-conformance-review.md" # Record per-task conformance verdicts and blocking mismatches before integration merge.
-
Final integration PR (
PLAN_BRANCH -> DEFAULT_BRANCH):gh pr create --base "$DEFAULT_BRANCH" --head "$PLAN_BRANCH" --title "plan(issue-${ISSUE_NUMBER}): merge ${PLAN_BRANCH} into ${DEFAULT_BRANCH}" --body "<summary>"
-
Verify integration required checks before merge and write
PLAN_INTEGRATION_CI_PATH:INTEGRATION_PR_NUMBER="<number>" PLAN_INTEGRATION_CI_PATH="$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-${ISSUE_NUMBER}/plan/plan-integration-ci.md" gh pr checks "$INTEGRATION_PR_NUMBER" --required --watch # If output contains "no checks reported", treat as blocking failure unless user explicitly approves override.
-
Merge integration PR only after conformance + required-check gates pass (prefer squash, fallback to merge when squash is unavailable):
if gh repo view --json squashMergeAllowed --jq '.squashMergeAllowed' | grep -q true; then gh pr merge "$INTEGRATION_PR_NUMBER" --squash || gh pr merge "$INTEGRATION_PR_NUMBER" --merge else gh pr merge "$INTEGRATION_PR_NUMBER" --merge fi
-
Mention integration PR on the plan issue and persist comment URL:
INTEGRATION_PR_NUMBER="<number>" PLAN_INTEGRATION_MENTION_PATH="$AGENT_HOME/out/plan-issue-delivery/<repo-slug>/issue-${ISSUE_NUMBER}/plan/plan-integration-mention.url" PLAN_INTEGRATION_MENTION_URL="<https://github.com/<owner>/<repo>/issues/${ISSUE_NUMBER}#issuecomment-...>" gh issue comment "$ISSUE_NUMBER" \ --body "Final integration PR merged: #${INTEGRATION_PR_NUMBER} (\`${PLAN_BRANCH}\` -> \`${DEFAULT_BRANCH}\`)." printf '%s\n' "$PLAN_INTEGRATION_MENTION_URL" > "$PLAN_INTEGRATION_MENTION_PATH"
-
Close plan:
plan-issue close-plan --issue <number> --approved-comment-url <comment-url> [--repo <owner/repo>] -
Local sync after final close:
git fetch origin --prune git switch "$DEFAULT_BRANCH" || git switch -c "$DEFAULT_BRANCH" --track "origin/$DEFAULT_BRANCH" git pull --ff-only
-
-
Explicit override patterns (only when user explicitly requests):
- Deterministic/manual split: use
--strategy deterministic --pr-grouping groupand pass full--pr-group <task-id>=<group>coverage. - Per-sprint single lane: use
--strategy deterministic --pr-grouping per-sprintand do not pass--pr-group.
- Main-agent is orchestration/review-only.
- Main-agent does not implement sprint tasks directly.
- Sprint implementation must be delegated to subagent-owned PRs.
- Main-agent should always assign
workflow_role=implementationto sprint implementation lanes. - Main-agent may assign
workflow_role=reviewandworkflow_role=monitoronly for read-only evidence gathering, audits, and status watches; these roles do not replace main-agent decision authority. - Sprint comments and plan close actions are main-agent orchestration artifacts; implementation remains subagent-owned.
- Allowed baseline exception: main-agent may open/manage exactly one
non-implementation integration PR (
PLAN_BRANCH -> DEFAULT_BRANCH) after all sprints are accepted. - Main-agent owns final plan-conformance review and integration required-check
gates before merging to
DEFAULT_BRANCH. - Default correction path for plan mismatches is follow-up on the original lane, not main-agent coding.
- Exceptional correction path (main-agent coding) is allowed only when:
- lane follow-up is unavailable or too risky for delivery timing
- fix scope is minimal and directly tied to plan conformance
- rationale, test evidence, and scope justification are recorded in review evidence
- Main-agent must post the integration PR mention comment on the plan issue
before
close-plan. - Main-agent owns required local sync commands after sprint acceptance and final
close (
git fetch+git switch+git pull --ff-only). - Review follow-up returns to the existing subagent-owned lanes by default; reassignment is explicit, not implicit.
- Main-agent review decisions should follow
skills/workflows/issue/_shared/references/MAIN_AGENT_REVIEW_RUBRIC.mdbefore callingissue-pr-review. - Main-agent review decisions must include decision-scoped evidence artifacts
generated from
skills/workflows/issue/issue-pr-review/references/REVIEW_EVIDENCE_TEMPLATE.md, and must executeissue-pr-reviewwith--enforce-review-evidence. - After
request-followuporclose-pr, main-agent should applyskills/workflows/issue/_shared/references/POST_REVIEW_OUTCOMES.mdbefore any new dispatch, acceptance gate, or next-sprint transition. - For
issue-pr-reviewexecution, prefer structured outcome flags (request-followup:--row-status,--next-owner;close-pr:--close-reason,--next-action, optional--replacement-pr,--row-status) to minimize ad-hoc comment formatting decisions.