Execute Phase
Modes: unit loop (default when P<n> is omitted) executes every remaining phase through close-out,
with one gate/commit per phase; explicit phase P<n> executes exactly that phase;
legacy SPECs without ## Phases run once. --fix selects a fix unit.
First matching row wins:
| Invocation shape |
Queue |
target + explicit P<n> |
only the literal P<n> argument; ignore other unfinished phases |
| target, no phase |
only the literal unfinished phase IDs found in the ledger, in order |
| legacy SPEC without phases |
one legacy pass |
Never infer a phase ID absent from the invocation/ledger.
Turn contract
Load and verify the canonical Turn contract (11 boxes) before ending every turn. Skill-specific additions and push policy live only in PREFLIGHT.md. Missing reference → STOP.
Hard rules
- Honor Workflow conventions (branch/PR, gate-before-commit, docs language). Run
git branch --show-current before editing/committing; if main, create the
working branch first (unless the user explicitly uses main).
- Phases are
P1, P2, …. The <phase> argument and every reference in PLAN.md/TASKS.md/progress.md/commits is P1, P2, … ("phase N") — never S1/S2/"Step N". If a plan you're handed uses S1-style labels, normalize it to P1, … before executing and note it in decisions.md.
- Implement only the requested scope: all remaining ledger phases when omitted,
or exactly
P<n>. Never invent/bundle across phase boundaries; unit-loop mode
still gates and commits each phase.
- Stop after the gate passes; keep commits small and reviewable.
- Feature mode: update
TASKS.md, progress.md, testing.md, known-issues.md each phase (and decisions.md if architecture moved).
- Plan conflict: update
TASKS.md/PLAN.md and record why in decisions.md;
never silently diverge.
- Dependency gate before any work — the preflight resource owns it. No edit,
branch, or commit for an unmerged dependency closure unless the user passed
--force.
- Phase-lint before any edit — the preflight resource runs it after
dependency/own-status gates. Any FAIL stops unless the user passed
--force.
- Pre-execution review before any edit — a current, independently recorded
PLAN-REVIEW-PASS bound to the plan's exact bytes must exist (--fix: on the fix
unit). Missing, stale, or wrong-stage stops the turn with the gate block; this is
the one preflight gate --force does not reach — the block, no-forgery and legacy
rules live in pre-execution gate.
- Pre-write discovery before any repository write — after the read-only gates
and before branch creation, planning commit, or source/test edit, settle the
mapper contract (
implementation-discovery). It answers the seven evidence
questions, emits the fixed compact map, and routes READY | REPLAN | NEEDS-DESIGN | BLOCKED; only READY authorizes the first write.
Context budget (hard rule — context is repaid every turn)
- File cap: read at most 10 full files per phase beyond
SPEC.md, the phase
TASKS.md section and progress.md. Targeted ≤50-line reads and greps do not
count. If the cap would be exceeded, stop, record known/unknown facts in
Gotchas:, then proceed only with targeted evidence or report the blocker.
- Summarize: record needed facts with
file:line; never re-read summarized
files or quote whole files.
- Step 0: read only Workflow conventions, the architecture section for the
phase
Layer:, and the optional invariant document named by the map.
- Unit-loop reset: after each commit retain only the
progress.md receipt;
use a fresh worker per phase where possible, otherwise never re-read prior files.
Progressive loading — mandatory route before acting
This entrypoint carries the universal turn contract and handoff schema. Load only
the listed one-hop route resource immediately before its step.
- Every invocation: consume verification contract,
read/run preflight gates, and stop on a contracted
blocker before editing. This route owns NRS and Architectural invariants gates.
After the read-only pre-execution gate and before any branch/planning/source
write, load and settle the pre-write mapper
implementation-discovery — it emits
the fixed map and routes READY | REPLAN | NEEDS-DESIGN | BLOCKED.
- Without explicit
P<n>, read unit loop, then
execution contract, then exactly one
workflow: feature,
small/phased,
--fix, or legacy.
Never load another mode.
- Read only the needed policy:
- writing a forge body → forge body policy
- creating an issue → descope guard first
- finding out-of-scope work → opportunistic finding policy
- Before
progress.md, read handoff schema.
- For implementation/finish, read closeout; for a
folded finding also folding.
- Only for
/loop, external drivers, manual batching, or missing vendor
primitives, read batch and portability.
Fixed blocks in selected resources are normative and copied exactly. Missing or
unreadable required resource → STOP; never reconstruct from memory.
Portability
The contract is vendor-neutral. When slash commands, tiers or a loop primitive
are absent, read batch and portability and
use its fallback; never skip the workflow step.
Relationship to other skills
Planned by plan-feature/plan-fix; executes their SPEC. Explicit phases may
hand off to review-change at layer/accumulation/sensitivity checkpoints and must
at unit end. Unit-loop skips intermediate checkpoints and recommends the manual
/review-change → /fold-findings (only on REVIEW-FAIL) → re-run
/review-change path after opening the PR; review-change remains the manual
entry.
Independent work stays a proposal. A finished unit always opens its PR and flips
to done; audit-pr gates merge. Every invocation prints the next step.
Done when
- Requested scope is implemented (all remaining phases, one explicit phase, or
legacy pass), gate is green, per-phase docs are updated, and the work is
committed on the correct branch with nothing bundled beyond scope.
git status --porcelain is empty and an open-PR branch has nothing unpushed.
- A finished unit is
done, has an opened PR (URL printed), and recommends the
mandatory /review-change end review, then /fold-findings (only on
REVIEW-FAIL) and a re-run /review-change, with /audit-pr
as the merge gate.
1---2name: execute-phase3description: Implement all remaining phases of a planned feature/fix by default, or one explicit P<n>, with frozen acceptance, phase-local gates, commits, recovery, and final PR close-out. Use --fix for fix SPECs; --force is user-only.4license: MIT5---67# Execute Phase89Modes: **unit loop** (default when `P<n>` is omitted) executes every remaining phase through close-out,10with one gate/commit per phase; **explicit phase** `P<n>` executes exactly that phase;11legacy SPECs without `## Phases` run once. `--fix` selects a fix unit.1213First matching row wins:1415| Invocation shape | Queue |16|---|---|17| target + explicit `P<n>` | only the literal `P<n>` argument; ignore other unfinished phases |18| target, no phase | only the literal unfinished phase IDs found in the ledger, in order |19| legacy SPEC without phases | one legacy pass |2021Never infer a phase ID absent from the invocation/ledger.2223## Turn contract2425Load and verify the **canonical** [Turn contract](.claude/skills/orchestration-envelope/references/TURN_CONTRACT.md) (11 boxes) before ending every turn. Skill-specific additions and push policy live only in [PREFLIGHT.md](references/PREFLIGHT.md). Missing reference → STOP.2627## Hard rules2829- Honor Workflow conventions (branch/PR, gate-before-commit, docs language). Run30 `git branch --show-current` before editing/committing; if `main`, create the31 working branch first (unless the user explicitly uses `main`).32- **Phases are `P1, P2, …`.** The `<phase>` argument and every reference in `PLAN.md`/`TASKS.md`/`progress.md`/commits is `P1, P2, …` ("phase N") — **never** `S1`/`S2`/"Step N". If a plan you're handed uses `S1`-style labels, normalize it to `P1, …` before executing and note it in `decisions.md`.33- Implement only the requested scope: all remaining ledger phases when omitted,34 or exactly `P<n>`. Never invent/bundle across phase boundaries; unit-loop mode35 still gates and commits each phase.36- Stop after the gate passes; keep commits small and reviewable.37- Feature mode: update `TASKS.md`, `progress.md`, `testing.md`, `known-issues.md` each phase (and `decisions.md` if architecture moved).38- **Plan conflict:** update `TASKS.md`/`PLAN.md` and record why in `decisions.md`;39 never silently diverge.40- **Dependency gate before any work** — the preflight resource owns it. No edit,41 branch, or commit for an unmerged dependency closure unless the user passed `--force`.42- **Phase-lint before any edit** — the preflight resource runs it after43 dependency/own-status gates. Any FAIL stops unless the user passed `--force`.44- **Pre-execution review before any edit** — a current, independently recorded45 `PLAN-REVIEW-PASS` bound to the plan's exact bytes must exist (`--fix`: on the fix46 unit). Missing, stale, or wrong-stage stops the turn with the gate block; this is47 the one preflight gate `--force` does not reach — the block, no-forgery and legacy48 rules live in [pre-execution gate](references/PRE_EXECUTION_GATE.md).49- **Pre-write discovery before any repository write** — after the read-only gates50 and before branch creation, planning commit, or source/test edit, settle the51 mapper contract (`implementation-discovery`). It answers the seven evidence52 questions, emits the fixed compact map, and routes `READY | REPLAN |53 NEEDS-DESIGN | BLOCKED`; only `READY` authorizes the first write.5455## Context budget (hard rule — context is repaid every turn)5657- **File cap:** read at most 10 full files per phase beyond `SPEC.md`, the phase58 `TASKS.md` section and `progress.md`. Targeted ≤50-line reads and greps do not59 count. If the cap would be exceeded, stop, record known/unknown facts in60 `Gotchas:`, then proceed only with targeted evidence or report the blocker.61- **Summarize:** record needed facts with `file:line`; never re-read summarized62 files or quote whole files.63- **Step 0:** read only Workflow conventions, the architecture section for the64 phase `Layer:`, and the optional invariant document named by the map.65- **Unit-loop reset:** after each commit retain only the `progress.md` receipt;66 use a fresh worker per phase where possible, otherwise never re-read prior files.6768## Progressive loading — mandatory route before acting6970This entrypoint carries the universal turn contract and handoff schema. Load only71the listed one-hop route resource immediately before its step.72731. Every invocation: consume [verification contract](<../verification-contract/SKILL.md>),74 read/run [preflight gates](references/PREFLIGHT.md), and stop on a contracted75 blocker before editing. This route owns NRS and Architectural invariants gates.76 After the read-only pre-execution gate and before any branch/planning/source77 write, load and settle the pre-write mapper78 [`implementation-discovery`](<../implementation-discovery/SKILL.md>) — it emits79 the fixed map and routes READY | REPLAN | NEEDS-DESIGN | BLOCKED.802. Without explicit `P<n>`, read [unit loop](references/UNIT_LOOP.md), then81 [execution contract](references/EXECUTION_CONTRACT.md), then exactly one82 workflow: [feature](references/WORKFLOWS_FEATURE.md),83 [small/phased](references/WORKFLOWS_SMALL_PHASED.md),84 [`--fix`](references/WORKFLOWS_FIX.md), or [legacy](references/WORKFLOWS_LEGACY.md).85 Never load another mode.863. Read only the needed policy:87 - writing a forge body → [forge body policy](references/FORGE_BODY.md)88 - creating an issue → [descope guard](references/DESCOPE.md) first89 - finding out-of-scope work → [opportunistic finding policy](references/OPPORTUNISTIC_FINDING.md)904. Before `progress.md`, read [handoff schema](references/HANDOFF.md).915. For implementation/finish, read [closeout](references/CLOSEOUT.md); for a92 folded finding also [folding](references/FOLDING.md).936. Only for `/loop`, external drivers, manual batching, or missing vendor94 primitives, read [batch and portability](references/BATCH_AND_PORTABILITY.md).9596Fixed blocks in selected resources are normative and copied exactly. Missing or97unreadable required resource → STOP; never reconstruct from memory.9899## Portability100101The contract is vendor-neutral. When slash commands, tiers or a loop primitive102are absent, read [batch and portability](references/BATCH_AND_PORTABILITY.md) and103use its fallback; never skip the workflow step.104105## Relationship to other skills106107Planned by `plan-feature`/`plan-fix`; executes their SPEC. Explicit phases may108hand off to `review-change` at layer/accumulation/sensitivity checkpoints and must109at unit end. Unit-loop skips intermediate checkpoints and recommends the manual110`/review-change` → `/fold-findings` (only on `REVIEW-FAIL`) → re-run111`/review-change` path after opening the PR; `review-change` remains the manual112entry.113Independent work stays a proposal. A finished unit always opens its PR and flips114to `done`; `audit-pr` gates merge. Every invocation prints the next step.115116## Done when117118- Requested scope is implemented (all remaining phases, one explicit phase, or119 legacy pass), gate is green, per-phase docs are updated, and the work is120 committed on the correct branch with nothing bundled beyond scope.121- `git status --porcelain` is empty and an open-PR branch has nothing unpushed.122- A finished unit is `done`, has an opened PR (URL printed), and recommends the123 mandatory `/review-change` end review, then `/fold-findings` (only on124 `REVIEW-FAIL`) and a re-run `/review-change`, with `/audit-pr`125 as the merge gate.