name: plan-execute
description: >-
Autonomously executes a staged implementation plan (generated by /plan-stage)
stage by stage via run_workflow, spawning a fresh implementer agent per stage
followed by repeated fresh plan-audit agents until an audit pass reports zero
remaining gaps and makes zero file modifications (default cap: 10 rounds per
stage). Use when the user invokes /plan-execute or asks to execute and
audit-until-clean a staged plan in docs/.
Staged Plan Autonomous Executor (/plan-execute)
Execute a staged plan from plan-stage end to end without pausing between stages: each stage is implemented by a fresh subagent, then audited repeatedly by fresh plan-audit subagents until an audit pass makes zero fixes and reports zero remaining gaps.
[!TIP]
For maximum end-to-end persistence on long plans, you can invoke this skill inside /goal (e.g., /goal /plan-execute docs/MY_PLAN.md).
1. Discover, Select & Stage the Plan
Before launching run_workflow, resolve the target plan through this interactive discovery flow (plus extract any optional arguments from the user's request):
1A. Fast-Path (Explicit File Path Provided)
If the user explicitly named a plan file path (e.g., /plan-execute docs/STAGED_PLAN_PHASE_8.md):
1B. Source Picker (ask_question)
When invoked without an explicit plan file path, ask the user where to discover plans using ask_question:
- Question:
"Where should I discover the implementation plan from?"
- Options:
(Recommended) docs/ folder in current workspace (auto-falls back to Antigravity brain if no docs/ folder exists)
Antigravity brain folder (last 3 created plans for this project)
Custom folder path
- If the user picks
Custom folder path (or supplies a folder via "Other") without providing the path yet, ask them for the folder path in plain text before continuing.
1C. Discover Plans & Show Plan Picker (ask_question)
Run discover_plans.py with the chosen source (resolving <skill-dir> to this plan-execute skill directory):
docs:python "<skill-dir>/scripts/discover_plans.py" --source docs --cwd "<workspace>"
brain:python "<skill-dir>/scripts/discover_plans.py" --source brain --cwd "<workspace>"
custom:python "<skill-dir>/scripts/discover_plans.py" --source custom --folder "<folder_path>" --cwd "<workspace>"
Then inspect the returned JSON:
- If
fallback_used == "brain", briefly inform the user that <workspace>/docs/ was missing or empty, so discovery automatically fell back to the Antigravity brain folder.
- If
plans is empty (or error is returned), inform the user cleanly and offer to choose another source or create/stage a plan first.
- Otherwise, call
ask_question so the user can pick the plan to execute:
- List plans newest-created first (already sorted by
created_timestamp descending), prefixing the first option with (Recommended).
- Format each option clearly with creation date and staged badge:
<filename> — created <created_at> [Staged] or <filename> — created <created_at> [Unstaged]
(append [All Projects] when scope_tag == "All Projects").
1D. Staged Check & Optional Auto-Staging
Inspect the chosen plan's is_staged flag (true if the file starts with [STAGED PLAN] on line 1 or contains ## Stage Tracker):
- If
is_staged == true: skip staging and immediately proceed to Section 2 (run_workflow).
- If
is_staged == false: call ask_question:
- Question:
"<filename> (created <created_at>) is not staged yet. Would you like to stage it with /plan-stage before executing?"
- Options:
(Recommended) Yes — stage it with /plan-stage (saves to docs/STAGED_PLAN_<NAME>.md) and start executing immediately
No — cancel without executing
- If Yes: read and execute plan-stage using the selected plan file as the source plan (saving
docs/STAGED_PLAN_<NAME>.md with [STAGED PLAN] on line 1). Once saved, immediately launch Section 2 (run_workflow) on that newly saved staged plan with no extra confirmation prompt.
- If No: stop cleanly without executing and tell the user execution was cancelled so they can edit the plan or run
/plan-stage manually later.
1E. Optional Execution Arguments
Extract any optional arguments from the user's request (keep defaults when omitted):
plan_path (string): resolved path to the staged plan markdown file.
start_stage (int | null, default null): first stage number to consider (earlier stages are skipped).
end_stage (int | null, default null): last stage number to consider (later stages are skipped).
max_audit_rounds (int, default 10): maximum fresh plan-audit subagent passes per stage before halting.
auto_commit (bool, default false): whether to create a local git commit (feat(stage-<k>): <title> [verified]) after a stage passes its clean audit.
2. Launch the Orchestrator via run_workflow
Register the dedicated worker subagent (define_subagent):
Before calling run_workflow, register plan_execute_worker once per conversation so child workflow agents run on model="inherit" (your active model) without inheriting two-phase Plan/Execute (Orchestrator) [plan review due] pre-tool hooks that deadlock type_name="self" + model="inherit":
Name: "plan_execute_worker"
Description: "Autonomous stage implementer and plan-audit worker for /plan-execute workflows."
SystemPrompt: "You are an autonomous software engineering worker executing a single stage or plan-audit pass inside a /plan-execute workflow. Follow all scope, verification, and zero-diff rules in the prompt, and return your structured result via the finish tool."
EnableWriteTools: true
EnableMCPTools: true
EnableSubagentTools: false
Call run_workflow with the bundled Python orchestrator script:
ScriptPath: <skill-dir>/scripts/run_staged_plan.py (resolve to the scripts/run_staged_plan.py file inside this installed plan-execute skill directory).
Description: "Execute staged plan <filename> (implement + audit-until-clean per stage)"
Args:{
"plan_path": "<resolved-plan-path>",
"start_stage": null,
"end_stage": null,
"max_audit_rounds": 10,
"auto_commit": false,
"agent_type": "plan_execute_worker",
"model": "inherit"
}
- Leave
WaitMsBeforeAsync unset / 0 so the workflow runs in the background and notifies you automatically when it finishes (do not poll).
[!IMPORTANT]
Permissions Requirement: Child agents inside run_workflow cannot prompt the user interactively for terminal command approval; any command requiring approval is automatically denied. Ensure the workspace Tool Execution Policy allows the project's build, lint, type-check, and test commands to run without prompting (e.g., always-proceed or proceed-in-sandbox with required commands allowed).
3. Execution Guarantees
The workflow script run_staged_plan.py enforces these invariants automatically:
- Deterministic plan parsing first: Parses standard
plan-stage documents (## Stage Tracker + ## Stage ... Prompts) directly in Python (0 LLM tokens), falling back to a parser agent only for non-standard layouts.
- Deadlock-safe worker & model tier: Runs implementer and auditor agents via
agent_type="plan_execute_worker" + model="inherit" (your active conversation model). If invoked directly with self+inherit under two-phase Plan/Execute mode and hit by the finish deadlock, it automatically retries once with model="pro" and surfaces child transcript.jsonl paths on any finish failure.
- Resumability: Reads
## Stage Tracker and automatically skips stages already marked [x] Done.
- Exclusive Stage Tracker ownership: Neither implementer nor auditor agents may edit
## Stage Tracker; only the orchestrator transitions a stage from [~] In Progress to [x] Done.
- Goal-style stage execution: Strips the leading
/goal prefix from each stage's prompt and runs it with strict completion rules and cumulative Stages 1..k vs. future Stages k+1..N boundary guards.
- Strict dual verification per audit pass: Every audit round captures a git working-tree snapshot (status, staged/unstaged diffs, and SHA-256 content hashes of non-cache untracked files) before and after a fresh
plan-audit agent runs. A stage advances only when:
passed == true,
verification_passed == true,
fixes_made == 0,
remaining_gaps == [], and
files_modified_during_audit == [] (falls back to checks 1–4 in non-git directories).
- Safe failure & cap policy: If
max_audit_rounds (default 10) is reached without a clean pass, or an implementer reports hard external blockers, the workflow halts immediately, leaves the stage marked [~] In Progress for clean resume, and outputs the remaining gaps/diffs/blockers.
4. Final Reporting
Once run_workflow completes:
- Provide a clickable
file:// link to the staged plan (docs/<PLAN>.md).
- Present a concise summary table with one row per stage:
Stage | Title | Status | Audit Rounds | Verification Gate
- If halted early: clearly display the halted stage number, whether it stopped on an implementer blocker or hit
max_audit_rounds, the exact remaining gaps / touched files / blockers returned by the workflow, and the exact resume instruction (fixing the blocker and re-running /plan-execute <plan_path>).
1---2name: plan-execute3description: Autonomously executes a staged implementation plan (generated by /plan-stage) stage by stage via run_workflow, spawning a fresh implementer agent per stage foll4---5---6name: plan-execute7description: >-8 Autonomously executes a staged implementation plan (generated by /plan-stage)9 stage by stage via run_workflow, spawning a fresh implementer agent per stage10 followed by repeated fresh plan-audit agents until an audit pass reports zero11 remaining gaps and makes zero file modifications (default cap: 10 rounds per12 stage). Use when the user invokes /plan-execute or asks to execute and13 audit-until-clean a staged plan in docs/.14---1516# Staged Plan Autonomous Executor (`/plan-execute`)1718Execute a staged plan from [plan-stage](../plan-stage/SKILL.md) end to end without pausing between stages: each stage is implemented by a fresh subagent, then audited repeatedly by fresh [plan-audit](../plan-audit/SKILL.md) subagents until an audit pass makes **zero fixes** and reports **zero remaining gaps**.1920> [!TIP]21> For maximum end-to-end persistence on long plans, you can invoke this skill inside `/goal` (e.g., `/goal /plan-execute docs/MY_PLAN.md`).2223---2425## 1. Discover, Select & Stage the Plan2627Before launching `run_workflow`, resolve the target plan through this interactive discovery flow (plus extract any optional arguments from the user's request):2829### 1A. Fast-Path (Explicit File Path Provided)30If the user explicitly named a plan file path (e.g., `/plan-execute docs/STAGED_PLAN_PHASE_8.md`):31- Skip Steps **1B** and **1C**.32- Inspect the file with [discover_plans.py](./scripts/discover_plans.py):33 ```bash34 python "<skill-dir>/scripts/discover_plans.py" --inspect "<path>" --cwd "<workspace>"35 ```36- If `exists == false`, tell the user the file was not found and stop. Otherwise proceed straight to **Step 1D**.3738### 1B. Source Picker (`ask_question`)39When invoked **without** an explicit plan file path, ask the user where to discover plans using `ask_question`:40- **Question:** `"Where should I discover the implementation plan from?"`41- **Options:**42 1. `(Recommended) docs/ folder in current workspace (auto-falls back to Antigravity brain if no docs/ folder exists)`43 2. `Antigravity brain folder (last 3 created plans for this project)`44 3. `Custom folder path`45- If the user picks `Custom folder path` (or supplies a folder via "Other") without providing the path yet, ask them for the folder path in plain text before continuing.4647### 1C. Discover Plans & Show Plan Picker (`ask_question`)48Run [discover_plans.py](./scripts/discover_plans.py) with the chosen source (resolving `<skill-dir>` to this `plan-execute` skill directory):49- `docs`:50 ```bash51 python "<skill-dir>/scripts/discover_plans.py" --source docs --cwd "<workspace>"52 ```53- `brain`:54 ```bash55 python "<skill-dir>/scripts/discover_plans.py" --source brain --cwd "<workspace>"56 ```57- `custom`:58 ```bash59 python "<skill-dir>/scripts/discover_plans.py" --source custom --folder "<folder_path>" --cwd "<workspace>"60 ```6162Then inspect the returned JSON:63- If `fallback_used == "brain"`, briefly inform the user that `<workspace>/docs/` was missing or empty, so discovery automatically fell back to the Antigravity brain folder.64- If `plans` is empty (or `error` is returned), inform the user cleanly and offer to choose another source or create/stage a plan first.65- Otherwise, call `ask_question` so the user can pick the plan to execute:66 - List plans **newest-created first** (already sorted by `created_timestamp` descending), prefixing the first option with `(Recommended)`.67 - Format each option clearly with creation date and staged badge:68 `<filename> — created <created_at> [Staged]` or `<filename> — created <created_at> [Unstaged]`69 (append ` [All Projects]` when `scope_tag == "All Projects"`).7071### 1D. Staged Check & Optional Auto-Staging72Inspect the chosen plan's `is_staged` flag (`true` if the file starts with `[STAGED PLAN]` on line 1 or contains `## Stage Tracker`):73- **If `is_staged == true`:** skip staging and **immediately** proceed to **Section 2** (`run_workflow`).74- **If `is_staged == false`:** call `ask_question`:75 - **Question:** `"<filename> (created <created_at>) is not staged yet. Would you like to stage it with /plan-stage before executing?"`76 - **Options:**77 1. `(Recommended) Yes — stage it with /plan-stage (saves to docs/STAGED_PLAN_<NAME>.md) and start executing immediately`78 2. `No — cancel without executing`79 - If **Yes:** read and execute [plan-stage](../plan-stage/SKILL.md) using the selected plan file as the source plan (saving `docs/STAGED_PLAN_<NAME>.md` with `[STAGED PLAN]` on line 1). Once saved, **immediately** launch **Section 2** (`run_workflow`) on that newly saved staged plan with no extra confirmation prompt.80 - If **No:** stop cleanly without executing and tell the user execution was cancelled so they can edit the plan or run `/plan-stage` manually later.8182### 1E. Optional Execution Arguments83Extract any optional arguments from the user's request (keep defaults when omitted):84- `plan_path` (`string`): resolved path to the staged plan markdown file.85- `start_stage` (`int | null`, default `null`): first stage number to consider (earlier stages are skipped).86- `end_stage` (`int | null`, default `null`): last stage number to consider (later stages are skipped).87- `max_audit_rounds` (`int`, default `10`): maximum fresh `plan-audit` subagent passes per stage before halting.88- `auto_commit` (`bool`, default `false`): whether to create a local git commit (`feat(stage-<k>): <title> [verified]`) after a stage passes its clean audit.8990---9192## 2. Launch the Orchestrator via `run_workflow`93941. **Register the dedicated worker subagent (`define_subagent`):**95 Before calling `run_workflow`, register `plan_execute_worker` once per conversation so child workflow agents run on `model="inherit"` (your active model) without inheriting two-phase Plan/Execute (`Orchestrator`) `[plan review due]` pre-tool hooks that deadlock `type_name="self"` + `model="inherit"`:96 - `Name`: `"plan_execute_worker"`97 - `Description`: `"Autonomous stage implementer and plan-audit worker for /plan-execute workflows."`98 - `SystemPrompt`: `"You are an autonomous software engineering worker executing a single stage or plan-audit pass inside a /plan-execute workflow. Follow all scope, verification, and zero-diff rules in the prompt, and return your structured result via the finish tool."`99 - `EnableWriteTools`: `true`100 - `EnableMCPTools`: `true`101 - `EnableSubagentTools`: `false`1021032. **Call `run_workflow`** with the bundled Python orchestrator script:104 - **`ScriptPath`**: `<skill-dir>/scripts/run_staged_plan.py` (resolve to the `scripts/run_staged_plan.py` file inside this installed `plan-execute` skill directory).105 - **`Description`**: `"Execute staged plan <filename> (implement + audit-until-clean per stage)"`106 - **`Args`**:107 ```json108 {109 "plan_path": "<resolved-plan-path>",110 "start_stage": null,111 "end_stage": null,112 "max_audit_rounds": 10,113 "auto_commit": false,114 "agent_type": "plan_execute_worker",115 "model": "inherit"116 }117 ```118 - Leave `WaitMsBeforeAsync` unset / `0` so the workflow runs in the background and notifies you automatically when it finishes (do **not** poll).119120> [!IMPORTANT]121> **Permissions Requirement:** Child agents inside `run_workflow` cannot prompt the user interactively for terminal command approval; any command requiring approval is automatically denied. Ensure the workspace Tool Execution Policy allows the project's build, lint, type-check, and test commands to run without prompting (e.g., `always-proceed` or `proceed-in-sandbox` with required commands allowed).122123---124125## 3. Execution Guarantees126127The workflow script [run_staged_plan.py](./scripts/run_staged_plan.py) enforces these invariants automatically:128129- **Deterministic plan parsing first:** Parses standard `plan-stage` documents (`## Stage Tracker` + `## Stage ... Prompts`) directly in Python (0 LLM tokens), falling back to a parser agent only for non-standard layouts.130- **Deadlock-safe worker & model tier:** Runs implementer and auditor agents via `agent_type="plan_execute_worker"` + `model="inherit"` (your active conversation model). If invoked directly with `self+inherit` under two-phase Plan/Execute mode and hit by the finish deadlock, it automatically retries once with `model="pro"` and surfaces child `transcript.jsonl` paths on any finish failure.131- **Resumability:** Reads `## Stage Tracker` and automatically skips stages already marked `[x] Done`.132- **Exclusive Stage Tracker ownership:** Neither implementer nor auditor agents may edit `## Stage Tracker`; only the orchestrator transitions a stage from `[~] In Progress` to `[x] Done`.133- **Goal-style stage execution:** Strips the leading `/goal ` prefix from each stage's prompt and runs it with strict completion rules and cumulative `Stages 1..k` vs. future `Stages k+1..N` boundary guards.134- **Strict dual verification per audit pass:** Every audit round captures a git working-tree snapshot (status, staged/unstaged diffs, and SHA-256 content hashes of non-cache untracked files) before and after a fresh `plan-audit` agent runs. A stage advances **only** when:135 1. `passed == true`,136 2. `verification_passed == true`,137 3. `fixes_made == 0`,138 4. `remaining_gaps == []`, **and**139 5. `files_modified_during_audit == []` (falls back to checks 1–4 in non-git directories).140- **Safe failure & cap policy:** If `max_audit_rounds` (default `10`) is reached without a clean pass, or an implementer reports hard external blockers, the workflow halts immediately, leaves the stage marked `[~] In Progress` for clean resume, and outputs the remaining gaps/diffs/blockers.141142---143144## 4. Final Reporting145146Once `run_workflow` completes:1471481. Provide a clickable `file://` link to the staged plan (`docs/<PLAN>.md`).1492. Present a concise summary table with one row per stage:150 - `Stage` | `Title` | `Status` | `Audit Rounds` | `Verification Gate`1513. **If halted early:** clearly display the halted stage number, whether it stopped on an implementer blocker or hit `max_audit_rounds`, the exact remaining gaps / touched files / blockers returned by the workflow, and the exact resume instruction (fixing the blocker and re-running `/plan-execute <plan_path>`).