moonshot-phase-runner
Master plan based phase-by-phase implementation automation with agent loop
SKILL.md
| Name | moonshot-phase-runner |
| Description | Master plan based phase-by-phase implementation automation with agent loop |
name: moonshot-phase-runner description: Use for large, phase-based, or long-running implementation work that should run from a prepared plan package. triggers:
- "phase runner"
- "run phase"
- "execute phase"
- "agent loop"
Moonshot Phase Runner
Role
Prepares phase-by-phase implementation based on master plan documents.
Handles plan validation, uncertainty resolution (Q&A), and execution preparation.
Emits handoff metadata so /moonshot-orchestrator can resume with consistent state.
This is the default public entrypoint for large, phase-based, or long-running implementation work. It owns the Intake-to-Plan transition for phase-driven execution.
Codex Rule References
When the active runtime is Codex, phase preparation must not rely on automatic .claude/rules/** loading.
Carry these rule files through SPRINT_CONTRACT.md policy anchors and phase-attempt inputs:
.claude/rules/basic-principles.md.claude/rules/workflow.md.claude/rules/context-management.md.claude/rules/communication.md.claude/rules/output-format.md.claude/rules/agents/agent-definition.md.claude/rules/agents/agent-delegation.md.claude/docs/guidelines/product-acceptance-gate.md.claude/docs/guidelines/memorygraph-workflow.md
Execution modes:
delegated-terminal: use the concrete autonomous loop backed byagent-loop.mjs; prefer this when the user expects uninterrupted end-to-end executionin-session-coordinator: the current session coordinates the loop, but each attempt must run as a fresh fork/sub-agent round; treat this as an interactive thin-coordinator mode, not the default autonomous runtime
Effort profile policy:
- Default phase, agentic, review, and high-risk work to
standard. - Use
economyonly for parity smoke or narrow read-only checks. - Use
standardfor simple/local bounded work. - Use
deepormaxonly when runtime/core/architecture/security risk, failed retry evidence, or hard long-horizon work justifies escalation. - Every
deepormaxrun must recordEffort escalation reasoninSPRINT_CONTRACT.md,QA_REPORT.md, and workflow evidence. - Model selection is provider-neutral and automatic. Codex maps the selected route to
-mplusmodel_reasoning_effort; Claude Code maps it to--modelplus--effort. - Evidence must include
selectedModelProvider,selectedModel,selectedModelEffort, andmodelSelectionReason. - Runtime capability evidence must include fork, MCP, shell, browser, worktree, tool inheritance, and fallback support status. Missing MCP/tool/browser support is a runtime capability condition and must be classified as
mcp_unavailable,tool_unavailable, orruntime_unavailable, not as a product implementation failure. - Before marking a deferred or optional tool unavailable, perform deferred/native tool lookup where the runtime supports it and record the lookup evidence in the active workflow artifact.
Retrieval and validation policy:
- Default retrieval budget is one compact MemoryGraph/CodeReviewGraph recall per stage.
- Repeat retrieval only for missing owner, date, path, API/schema, or failure fact.
- Stop retrieving when the core stage decision is answerable with compact evidence.
- Use
validationProfilevalues from.claude/verification.contract.yaml:prompt_only,docs_only,script_change,workflow_core, orruntime_adapter.
Phase replay policy:
- For long-running or tool-heavy Responses-style integrations, preserve assistant-item
phasevalues when replaying assistant history. - Use
commentaryfor progress/preamble updates andfinal_answeronly after return-boundary checks pass. - Do not add
phasemetadata to user messages.
Execution start policy:
- default: auto-start execution immediately after preparation
--prepare-only: stop after seeding state and return prepared execution metadata without executing it
Intent interpretation:
- Treat requests such as "continue", "proceed with the improvement work", "go ahead", "execute the phase", or equivalent user wording as execution intent, not packaging intent.
- Unless the user explicitly asks for planning/package-only behavior or passes
--prepare-only, the runner must setprepareOnly: falseandautoStartExecution: true. - For Codex or other runtimes where uninterrupted completion is the goal, prefer
delegated-terminalunless the user explicitly wants interactive coordination or the runtime can only satisfy the request throughin-session-coordinator.
Plan-directory completion rule:
- In default auto-start runs, the execution boundary is the entire active plan directory, not the current phase.
- If any phase in
phase-status.yamlremainspending,in_progress, or retryablefailed, the run must keep going through the delegated-terminal loop or the in-session coordinator loop. - A completed phase boundary is never a valid stop boundary by itself.
Automatic phase parallelization rule:
- Do not ask the user to choose a parallel phase count. The delegated-terminal loop owns automatic phase-wave planning.
- Before selecting a single next phase,
agent-loop.mjsmust askphase-parallel-planner.mjsto scan all actionable pending phases. - If the planner proves that two or more phases have no unmet dependencies, no target path overlap, and no manual/external-state ambiguity, the loop may route that wave through
phase-wave-coordinator.mjs. - Parallel phase workers must run in isolated Git worktrees. They must not write the shared main
phase-status.yamlconcurrently; the coordinator serializes merge and status updates after successful phase closeout. - If the planner or coordinator cannot prove safety, the loop must fall back to the existing sequential next-phase path and record the fallback reason.
PHASE_PARALLEL_AUTO=falseis the only kill switch. It is for emergency/runtime debugging, not normal user-facing workflow selection.
Goal runtime state rule:
- Runtime state is hybrid: SQLite owns machine state, Markdown/YAML artifacts own human/audit evidence.
- SQLite path defaults to
.claude/runtime-state.sqliteand is ignored by git. Override withPHASE_RUNTIME_DBonly for tests or explicit alternate workspaces. - Store
goalRuntime, lease, pause/resume/clear, budget/accounting, and event log state in SQLite; do not moveSPRINT_CONTRACT.md,QA_REPORT.md,SCORECARD.md,HANDOFF.md, or verification reports into the DB. - The default long-running path remains
delegated-terminal. Do not create a second public runner for goal mode; goal runtime is a control layer around the existing phase loop. - Use
node .claude/scripts/phase-goal-control.mjs status|pause|resume|clear <plan-dir>to inspect or control the active goal.pauseprevents the next continuation/attempt from starting; it does not delete artifacts.
Runtime status and resume read model:
- The human artifacts remain
SPRINT_CONTRACT.md,QA_REPORT.md,SCORECARD.md, andHANDOFF.md; machine consumers should read compact status from workflow evidence first. - Compact status must expose the active contract, latest verdict path/state, current blocker, lineage ids, and stale warnings for
phase-status.yaml,current-run.json, andlatest-dispatch.json. - Resume briefs must name the next action and carry the same lineage ids as the compact status so a resumed Codex or Claude attempt can detect stale projections before closeout.
Channel / return-boundary rule:
- While
phase-status.yamlreportsactiveExecutionStatus: active, user-facing updates must stay in progress/commentary form. - Do not emit a
finalanswer, closeout phrasing, or any wording that implies the run/session ended untilassert-return-allowedpasses or an explicit stop condition is recorded. - A phase milestone, refreshed execution artifacts, or a just-started next phase is not a valid terminal-response boundary.
Review and finish gate rule:
- The phase package may not be treated as complete until the required review and finish-closeout steps have actually run.
- For code-changing phases,
codex-review-codemust appear in applied workflow evidence beforeclean_finishis allowed. QA_REPORT.mdmay not claimNext path: clean_finishwhileReview completedis stillno.HANDOFF.mdand closeout fields may not remain seeded or placeholder-shaped when the phase is being closed.- Before a plan-directory completion summary, run the single closeout entrypoint:
node .claude/scripts/phase-closeout-finalize.mjs finalize --phase <NN> --status-file .claude/docs/phase-status.yaml --plan-dir <plan-dir> --master-plan <master-plan> --execution-root <execution-root> --json. - Use
phase-closeout-finalize.mjs finalize --dry-run --jsonbefore mutating state when a session already shows conflictingphase-status.yaml, workflow JSON, verdict, or traceability evidence. phase-closeout-finalize.mjsowns canonical final verdict creation, phase-status root reconciliation, workflow state reconciliation, goal runtime close, traceability/scenario placeholder generation, closeout verification, and Git closeout preflight. Do not run these steps as separate ad-hoc closeout decisions unless debugging the finalizer itself.- Before a plan-directory success return, the finalizer's phase closeout gate must pass, then
node .claude/scripts/phase-final-git-closeout.mjs assert-clean --plan-dir <plan-dir> --status-file <status-file>must pass after any finalizer writes are committed or intentionally staged. - Phase closeout requires master checklist,
phase-status.yaml, archived phase document paths, execution artifacts, verifier verdicts, scorecards, and criticalSCN-*evidence to agree. - If review or closeout evidence is missing, the run must stay inside the active plan-directory loop and remediate the missing steps instead of returning a summary.
MemoryGraph stage rule:
- Apply
.claude/docs/guidelines/memorygraph-workflow.mdacross the phase run. - The runner owns Intake and Plan recall before it delegates to plan writing, plan review, or execution.
- Each execution attempt must receive summarized
projectMemoryContext; do not inline raw MemoryGraph records into phase docs or attempt input. - Exclude
.claude/docs/ko/and omit MemoryGraph entries that duplicate system/developer/AGENTS/rules policy. - MemoryGraph unavailable -> record
boundaryStatus: not_checkedand continue unless a strict memory gate explicitly fails.
Failure prevention brief rule:
- Before building a phase-attempt prompt, the runner may read
.claude/cache/awtl/failed_turn_cases.jsonlas an ignored, repo-local cache. - Inject a
Failure Prevention Briefonly when a compact failed-turn case matches the active phase context; missing cache or no match is a no-op. - The brief must contain at most five one-sentence bullets and must not include raw trace JSON, prompt body, stdout, stderr, or secret-like strings.
- This cache read is independent of MemoryGraph availability and does not promote anything to long-term memory.
Usage
# Auto-resolve an existing plan or create one at docs/implementation
/moonshot-phase-runner
# Specify plan directory
/moonshot-phase-runner docs/implementation/
# Autonomous mode (skip Q&A)
/moonshot-phase-runner docs/implementation/ --autonomous
# Keep coordination in the current session
/moonshot-phase-runner docs/implementation/ --execution-mode in-session-coordinator
# Prepare only, do not auto-start execution
/moonshot-phase-runner docs/implementation/ --prepare-only
Workflow
/moonshot-phase-runner [<plan-dir>] [--autonomous] [--execution-mode <mode>] [--prepare-only]
│
├─ 0. MemoryGraph Intake Recall
│ └─ Run `project-memory-agent` with stage=intake/read_only
│ and merge only summarized `projectMemoryContext`
│
├─ 1. Plan Directory Resolution
│ ├─ Reuse explicit `<plan-dir>` when provided
│ ├─ Else reuse existing active plan directory if exactly one safe candidate exists
│ └─ Else run `moonshot-plan-writer` to create `docs/implementation`
│
├─ 2. Plan Directory Validation
│ └─ Verify master plan + phase docs exist
│
├─ 3. Create/Update phase-status.yaml
│ └─ Initialize each phase status
│
├─ 4. Seed execution bridge artifacts
│ └─ Prepare `execution/<phase>/SPRINT_CONTRACT.md`
│ and placeholders for `QA_REPORT.md`, `HANDOFF.md`, `SCORECARD.md`
│
├─ 5. Plan Review (unless --autonomous)
│ └─ Refresh MemoryGraph with stage=plan/read_only, then detect uncertainties → Q&A → planConfirmed: true
│
├─ 6. Resolve Execution Mode
│ ├─ delegated-terminal -> build dispatcher command
│ └─ in-session-coordinator -> build fresh-attempt command
│
├─ 7. Auto-Start Execution Skill (default)
│ └─ Refresh MemoryGraph with stage=execute/read_only, then execute `moonshot-phase-executor` in the current session
│ unless `--prepare-only` was requested
│
├─ 8. Automatic Phase-Wave Planning (delegated-terminal)
│ └─ Scan pending phases, run independent waves in isolated worktrees when safe,
│ otherwise use the sequential next-phase path
│
├─ 9. Enforce Review / Finish Gates
│ └─ A phase may advance only after MemoryGraph review, review evidence, completion evidence,
│ acceptance evidence, and finish-closeout artifacts are consistent
│
├─ 10. Enforce Final Git Closeout
│ └─ Before success return, audit main worktree status and phase worktree residue.
│ Dirty main changes or dirty phase worktrees require triage/commit/cleanup instead of success wording
│
└─ 11. Emit Handoff Summary
└─ Orchestrator-readable phaseRunnerResult after the active plan directory is actually done
Step 1: Plan Directory Resolution
When <plan-dir> is omitted, resolve it in this order:
- Reuse the active plan from
.claude/docs/phase-status.yamlif it points to an existing master plan. - Reuse
docs/implementationif it already contains exactly one valid master plan and phase files. - Reuse another single valid implementation-plan directory only if exactly one safe candidate exists.
- Otherwise run
/moonshot-plan-writerand create or refreshdocs/implementation.
Archived phase docs under <plan-dir>/close/ are history, not active phase candidates.
Phase discovery truth source:
- The runner discovers active phases from the non-recursive
<plan-dir>/NN-*.mdfile set, excluding00-*. - The master plan phase index is a required consistency contract, not the discovery source.
- If the selected master plan references phases 13-16 but root still contains stale phases 09-12, the runnable package has 8 active phases until those stale root docs are archived, moved, or explicitly reconciled.
Safety rule:
- If multiple candidate plan directories exist and there is no clear active one, stop and ask the user instead of guessing.
Resolution output:
planResolution:
source: "phase-status" # explicit | phase-status | discovered | plan-writer
planDir: "docs/implementation"
masterPlan: "docs/implementation/00-master-plan-v1.md"
Step 2: Plan Directory Validation
validation:
- Check directory exists
- Find master plan (00-master-plan.md or *master*.md)
- Count non-recursive root phase documents matching NN-*.md, excluding 00-*
- Compare the selected master plan's phase links/checklist against the root NN-*.md file set
- Run prepare-implementation-plan-state.mjs --dry-run before dispatch when stale execution or root phase documents may exist
output:
success: "✅ Found {N} phases in {plan-dir}"
failure: "❌ Master plan not found / phase inventory mismatch"
Step 3: Create phase-status.yaml
Creates .claude/docs/phase-status.yaml:
schemaVersion: "1.0"
masterPlan: "docs/implementation/00-master-plan.md"
autonomousMode: true
executionMode: "in-session-coordinator"
executionRoot: "docs/implementation/execution"
phases:
- number: 1
title: "Project Setup"
status: pending
planConfirmed: false
attempts:
total: 0
lastOutcome: pending
sprintContract: "docs/implementation/execution/01-project-setup/SPRINT_CONTRACT.md"
qaReport: "docs/implementation/execution/01-project-setup/QA_REPORT.md"
handoff: "docs/implementation/execution/01-project-setup/HANDOFF.md"
- number: 2
title: "Core Implementation"
status: pending
planConfirmed: false
When a phase reaches completed, move its phase doc into <plan-dir>/close/ and record archivedPhaseDoc in phase-status.yaml so active discovery stays clean.
Step 4: Seed Execution Bridge Artifacts
For each detected phase, prepare:
<plan-dir>/execution/<phase>/SPRINT_CONTRACT.md<plan-dir>/execution/<phase>/QA_REPORT.md<plan-dir>/execution/<phase>/HANDOFF.md<plan-dir>/execution/<phase>/SCORECARD.md
Rules:
SPRINT_CONTRACT.mdis seeded from the phase title and document path- seed artifacts from the execution templates under
.claude/templates/execution/ SPRINT_CONTRACT.mdmust carryPolicy Anchorsfor always-loaded rules, the active workspace contract, the verification contract, and any phase-specific guides required for the roundSPRINT_CONTRACT.mdmust carryHarness SelectionandContract Reviewfields before implementation beginsSPRINT_CONTRACT.mdshould also declare the expected downstream stage order, review cadence, and finish/handoff exit rule for the roundQA_REPORT.mdandHANDOFF.mdstart as placeholders and are updated during executionSCORECARD.mdstarts with objective weighted checks and controls whether the loop may declare the phase doneSCORECARD.mdshould be seeded from a scorecard profile:generic,saas,api-backend,frontend, orplatform- when traceability artifacts already exist, rebalance only the combined
REQ + SCNbudget from detectedREQ-*/SCN-*counts before the first attempt QA_REPORT.mdshould make the next path explicit: clean finish, retry loop, or resume-later handoffQA_REPORT.mdshould record runtime evidence depth and retry strategy when verification failsHANDOFF.mdshould record which review/verification checks must be rerun before closeoutSCORECARD.mdshould keepretryas the default verdict until the objective target score is met- do not overwrite an existing artifact that already contains work
Step 5: Plan Review (Optional)
When --autonomous flag is NOT specified:
actions:
1. Load each phase document
2. Run /moonshot-detect-uncertainty
3. If uncertainties found:
- Display questions
- Wait for user answers
- Update phase document
4. Set planConfirmed: true
When --autonomous flag IS specified:
- Skip Q&A
- Set all phases to planConfirmed: true
- Proceed with autonomous decision mode
Step 6: Resolve Execution Mode
Supported values:
delegated-terminal(default): external loop viaagent-loop.mjsin-session-coordinator: current session coordinates retries, but each attempt must be isolated
Mode A: delegated-terminal
Internal adapter command:
═══════════════════════════════════════════════════════════════
✅ Ready
═══════════════════════════════════════════════════════════════
📋 Plan: docs/implementation/00-master-plan.md
📦 Phases: 5
🤖 Mode: Autonomous
───────────────────────────────────────────────────────────────
Internal adapter:
───────────────────────────────────────────────────────────────
node .claude/scripts/moonshot-phase-dispatch.mjs docs/implementation/ --execution-mode delegated-terminal --execution-root docs/implementation/execution --runtime auto
───────────────────────────────────────────────────────────────
💡 Tip: Logs available at .claude/logs/agent-loop/
The delegated-terminal adapter automatically evaluates phase-level parallel waves. Users do not pass a public --parallel-phases option. The loop runs phase-parallel-planner.mjs; when it returns parallel_wave, phase-wave-coordinator.mjs executes those phases in isolated worktrees and serializes their merge/status updates. Ambiguous dependency, target overlap, manual smoke, or external-state signals force sequential fallback.
Mode B: in-session-coordinator
This mode keeps orchestration in the current session while preserving fresh-attempt isolation. It is not the strongest choice for uninterrupted autonomous runs in runtimes that cannot enforce the fresh-attempt loop programmatically.
Coordinator rules:
- The main session may decide the next attempt, but must not carry implementation chatter across rounds.
- Each round must start from artifact state only:
- phase document
SPRINT_CONTRACT.md- latest
QA_REPORT.md - latest
HANDOFF.mdwhen present
- Treat
SPRINT_CONTRACT.mdpolicy anchors as required round input, not optional notes - Keep the downstream stage order visible inside each round:
ready/isolate -> execute -> review -> verify -> finish/handoff - Each round must execute as a fresh fork/sub-agent attempt.
- Merge back summaries only: verdict, changed files, failed checks, next action.
- Do not treat a phase as cleanly complete until review, verification, and finish-stage closeout are all satisfied.
- Do not treat a critical
SCN-*as cleanly evidenced by smoke-only browser/runtime checks; clean finish requiresopen -> act -> mutate -> persist -> recoveror equivalent runtime evidence. - If the same failure class repeats twice, the next attempt must choose
partial_redesignorstop_and_handoff, not another unqualified same-direction retry. - Do not stop a round only because a checkpoint produced evidence or docs were refreshed; if in-scope work remains and no real stop condition exists, continue execution.
- If the round does not finish cleanly, update
QA_REPORT.mdandHANDOFF.mdbefore the next attempt.
Runtime note:
delegated-terminalhas a concrete Node loop (agent-loop.mjs) and is the preferred mode when the run should keep going without conversational re-entry..shwrappers remain available as compatibility entrypoints.in-session-coordinatordepends on the active runtime honoring the coordinator contract and may surface a resumable handoff instead of autonomously continuing.
Attempt contract:
attemptInput:
phaseNumber: 1
phaseTitle: "Project Setup"
phaseDoc: "docs/implementation/01-project-setup.md"
sprintContractPath: "docs/implementation/execution/01-project-setup/SPRINT_CONTRACT.md"
qaReportPath: "docs/implementation/execution/01-project-setup/QA_REPORT.md"
handoffPath: "docs/implementation/execution/01-project-setup/HANDOFF.md"
scorecardPath: "docs/implementation/execution/01-project-setup/SCORECARD.md"
priorAttemptSummary: "Build failed on migration ordering; retry with DB init fix"
attemptResult:
status: "partial"
summary: "Backend boots, but login flow still fails under E2E"
changedFiles: ["src/api/auth.ts", "tests/e2e/login.spec.ts"]
verification:
verdict: "failed"
failedChecks: ["browserFlows.login"]
score:
current: 70
target: 100
unmetChecklistItems: 2
blockingDefects: 1
verdict: "retry"
handoffRequired: true
The coordinator can loop in the current session only if the actual implementation/verifier work happens inside these fresh attempts.
Step 7: Auto-Start Execution Skill (Default)
Unless --prepare-only is set:
- execute
moonshot-phase-executorimmediately in the current session - pass
phaseRunnerResultas the handoff payload - keep command adapters behind the skill boundary
- when
executionMode == delegated-terminal, actually launchphaseRunnerResult.executionCommand/executionAdapterCommandin the current session and stay attached until that loop exits - do not replace delegated-terminal execution with a single conversational implementation round, partial checkpoint, or one-attempt summary
- for delegated-terminal runs, the first valid return boundary is loop exit only: all phases completed, retry cap reached, explicit user pause, or a real blocking failure recorded by the loop
- after any phase is marked
completed, immediately continue to the next actionable phase in the same active plan directory instead of returning a progress summary
When --prepare-only is set:
- stop after writing artifacts and
phase-status.yaml - surface prepared execution metadata for manual or downstream use
Step 8: Emit Handoff Summary
Return a structured summary for orchestrator:
phaseRunnerResult:
prepared: true
executionMode: in-session-coordinator
planResolutionSource: "plan-writer"
planDir: "docs/implementation/"
masterPlan: "docs/implementation/00-master-plan.md"
phaseStatusFile: ".claude/docs/phase-status.yaml"
executionRoot: "docs/implementation/execution"
executionRuntime: "auto"
executionSkill: "moonshot-phase-executor"
executionCommand: "node .claude/scripts/moonshot-phase-dispatch.mjs docs/implementation/ --execution-mode in-session-coordinator --execution-root docs/implementation/execution --runtime auto"
executionAdapterCommand: "node .claude/scripts/moonshot-phase-dispatch.mjs docs/implementation/ --execution-mode in-session-coordinator --execution-root docs/implementation/execution --runtime auto"
executionCoordinatorSkill: "moonshot-in-session-coordinator"
coordinatorPolicy: "fresh-fork-per-attempt"
autoStartExecution: true
prepareOnly: false
pendingPhases: 5
Mode meanings:
delegated-terminal: this skill prepares state and then immediately executes the command-layer adapter invocation for the real autonomous loopin-session-coordinator: this skill prepares state and expects the orchestrator/current runtime to execute each attempt as a fresh fork
Status File
.claude/docs/phase-status.yaml:
schemaVersion: "1.0"
masterPlan: "docs/implementation/00-master-plan.md"
autonomousMode: true
executionMode: "delegated-terminal"
executionRoot: "docs/implementation/execution"
preparedAt: "2026-02-08T15:00:00Z"
phases:
- number: 1
title: "Project Setup"
status: pending
planConfirmed: true
attempts:
total: 1
lastOutcome: failed
lastUpdatedAt: "2026-02-08T15:30:00Z"
sprintContract: "docs/implementation/execution/01-project-setup/SPRINT_CONTRACT.md"
qaReport: "docs/implementation/execution/01-project-setup/QA_REPORT.md"
handoff: "docs/implementation/execution/01-project-setup/HANDOFF.md"
- number: 2
title: "Core UI"
status: pending
planConfirmed: true
Optional closeout metadata:
archivedPhaseDoc: "docs/implementation/close/01-project-setup.md"
References
/moonshot-orchestrator: Phase implementation delegation/moonshot-plan-writer: Fallback plan creation when no safe plan dir exists/moonshot-detect-uncertainty: Pre-execution uncertainty detection.claude/scripts/moonshot-phase-dispatch.mjs: primary command-layer dispatcher for both execution modes.claude/scripts/agent-loop.mjs: primary autonomous execution loop behinddelegated-terminal.claude/scripts/moonshot-phase-dispatch.sh/.claude/scripts/agent-loop.sh: compatibility wrappers/moonshot-in-session-coordinator: Fresh-attempt coordinator forin-session-coordinator
Orchestrator Integration Contract
When called by /moonshot-orchestrator:
- Resolve
<plan-dir>first; if no safe plan exists, run/moonshot-plan-writerfordocs/implementation. - Prepare plan state and write
.claude/docs/phase-status.yaml. - Seed execution-bridge artifacts for each phase when missing.
- Return
phaseRunnerResultsummary withexecutionMode,executionRoot, and artifact paths (do not inline full phase docs). - Do not mark implementation complete here.
- If
prepareOnly != true, executephaseRunnerResult.executionSkillimmediately and passphaseRunnerResultas input. - If
executionMode == delegated-terminal, the execution path must launch the dispatcher/agent loop directly and must not stop after a single partial attempt summary. partial,retry, refreshed artifacts, or newly written handoff/checkpoint docs are not valid delegated-terminal stop reasons by themselves.- A single completed phase is not a stop reason while the active plan directory still has actionable phases.
- In auto-start execution, keep a live
phase-run-leaseattached to the dispatcher boundary and requirenode .claude/scripts/phase-run-lease.mjs assert-return-allowed <status-file> <runLeaseId> true falseto pass before any success return. - Before any success return, require the final git closeout audit to pass. If the audit reports dirty main changes or dirty phase worktrees, stop with
phase-final-git-closeout-requiredand leave the audit artifact path. - If
prepareOnly == true, stop after returning the prepared execution metadata. - If
executionMode == in-session-coordinator, orchestrator must keep the main session thin and run each implementation round as a fresh fork/sub-agent attempt. - Completion verification resumes only after the active attempt updates
phase-status.yamland execution artifacts. - Within each phase, preserve
ready/isolate -> execute -> review -> verify -> finish/handoffas the default stage order. - If the user's latest message expressed execution intent and
prepareOnly == truewas not explicitly requested, treat that result as a contract mismatch and continue through the auto-start execution path instead of returning a prepared-only summary.