# M Plan Implement

> Execute and verify a plan previously generated by /m_plan, including deployment to the real declared environment rather than treating local checks as release proof. Loads existing artifacts from .m_plan/<task-slug>/, walks 05_step_plan.md, enforces 06_deploy_plan.md real-target deploy/smoke gates, updates 09_verification.md, then reports Done / Changed / Not done. /goal mode is opt-in. Use when user invokes /m_plan_implement, says "execute the plan", "run the m_plan", "implement the spec", "finish what was planned", or asks to resume a paused m_plan run.

- Skill: `denysfast/m-plan-implement` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add denysfast/m-plan-implement`
- Raw SKILL.md: https://api.skillmd.com/api/skills/denysfast/m-plan-implement/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: denysfast (https://skillmd.com/u/denysfast)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/denysfast/m-plan-implement

---


# m_plan_implement

Follow-up to `m_plan`. Reads existing artifacts, drives them to completion. No re-planning. Default mode: direct walk. `/goal` mode: opt-in.

## Inputs
- `$ARGUMENTS`: optional task slug. If absent, auto-detect.

## Phase A — Load the plan

1. **List** `.m_plan/*/` directories.
   - None → `No plans found. Run /m_plan first.` Stop.
   - One → use it.
   - Many → list with last-modified, ask via `AskUserQuestion` (max 4; on overflow, ask user to type the slug; if that tool is unavailable in this harness, ask in chat as a numbered list and wait).

2. **Read present files.** A plan is valid with at minimum `01_architecture.md`, `04_implementation_requirements.md`, `05_step_plan.md`, `09_verification.md`. Other files are optional — treat missing as N/A. Read whichever subset exists in parallel.

3. **Extract:**
   - Step IDs S01..S<N> + per-step check commands from `05`.
   - Verification rows V-* + current state from `09`.
   - Build / test commands from `07_test_plan.md` if present, else from `CLAUDE.md`.
   - Smoke + e2e IDs from `08_e2e_plan.md` if present.
   - Deploy steps, real target hosts/services, release commands, rollback commands, and post-deploy smoke probes from `06_deploy_plan.md` if present.
   - If `06` is missing or does not name a real target, inspect repo-local ops docs (`AGENTS.md`, `CLAUDE.md`, `README`, `docs/`, deploy scripts, compose/k8s/systemd files) for an unambiguous deploy path. If still ambiguous, mark deploy as blocked. Do not silently replace deploy with localhost checks.

4. **Detect resume state.** Summarize: `Already done: <N>. Open: <M>. Blocked: <K>.` Ask `Resume / Restart / Stop`.

5. **Readiness check.** If `03_infra_requirements.md` exists, list its secrets/access requirements and ask `Ready? (yes / no — name the blocker)`. Any open `[!]` in `09` — including the `V-READY-*` deploy/e2e go/no-go rows seeded by `/m_plan` Phase 0 — must be resolved (re-probe and flip to `[x]`) or explicitly converted to `[~]` before proceeding. Do not start the walk with an unresolved deploy/e2e readiness blocker.

6. **Deployment reality gate + browser preflight.** Before editing code, decide whether this plan has an actual runtime surface and a real deploy target, and whether you can run any browser/UI checks `08` requires. **Deploy reality invariant:** local build / unit / dev-server checks on this workstation are *preflight only* — they never satisfy `V-DEPLOY-*`, `V-SMOKE-*`, or `V-E2E-*` rows unless `06` declares this workstation as the target. If this plan deploys anything or has browser checks, **read `templates/deploy_rules.md` now** for the full gate + preflight checklist before proceeding.

## Phase B — Execute (default: direct walk)

Walk `05_step_plan.md` step by step:
- Respect dependency order. After each step's per-step check passes, flip its `V-STEP-Sxx` to `[x]` via `Edit`.
- On failing check: diagnose, retry **once**. Second failure → `[!]` blocker, stop, jump to Phase C.
- After all steps: local preflight build/test (delegate noisy runs to the `m_code-test-runner` agent, keep only the summary) → (if `08` exists) e2e against the intended target when possible — run browser/UI checks through the available browser MCP (Playwright/Chrome, or macOS computer-use) only after the Phase A §7 access preflight passes → real deploy → post-deploy smoke from outside or on the target host.
- Update other `V-*` rows as their evidence appears in the transcript.

**Deviation logging (mandatory).** Any time the run drifts from `01–08`, append a one-line entry under `## Deviations` in `09_verification.md` **immediately** — do not wait for Phase C. A deviation is any of:
- A file touched that is not in `04`'s "Files to add / modify / delete".
- A different approach taken mid-step (e.g., used a different library than `01` named).
- A smoke / e2e check skipped or replaced.
- A per-step check replaced with a different command than `05`/`07` declares.
- A local check used where the plan expected deploy, remote smoke, or target-environment verification.

Format: `- Sxx / V-XXX-YY — plan said: <one quote>. Did: <…>. Why: <…>.`

**Deploy walks `06` like steps walk `05`, but only against the real target.** When every non-deploy `V-*` is `[x]`/`[~]`, run `06`'s "Deploy order" entries in declared order, each followed by its matching smoke check. Stop on first failure; flip the matching `V-DEPLOY-XX` to `[!]`. **Read `templates/deploy_rules.md`** for the deploy walk + real-environment deploy rules (what counts as observing the running artifact, SSH/CI handling, destructive-action policy, post-deploy smoke) — they all enforce the deploy reality invariant.

**Final V-* sweep (before declaring DONE).** After everything above, re-read `09_verification.md` from disk and, for every still-`[ ]` row, attempt a deterministic check from current repo / build state: greps, file existence, signature matches, last build/test output. Flip what passes to `[x]`. Anything that cannot be deterministically verified stays `[ ]` and becomes a "Not done" item in Phase C.

**Opt-in `/goal` mode** — if user said `use /goal` or the run will span sessions, emit:
```
/goal Complete every checkbox in .m_plan/<slug>/09_verification.md. For each, run the cited command, paste output, flip [ ]→[x]. Stop after <N_steps * 4 + 20> turns and explain residual blockers.
```

### Rules during execution
- Never edit `01–08` to change scope. Contract from `/m_plan`.
- Never delete a `V-*` row. Only flip state.
- `[~]` skip needs a one-line reason inline. No confirmation required.
- `[!]` blocker needs description + entry under "Blockers".
- Commit policy follows `06` if present; otherwise one commit per step.
- Deploy from `06` or the discovered real deploy path runs automatically after every non-deploy `V-*` is `[x]`/`[~]`. If no real deploy path can be identified for a deployable runtime, stop with `V-DEPLOY-*` blocked instead of reporting DONE.

## Phase C — Three-section report

Re-read `09_verification.md` from disk, then emit the three-section report using the skeleton in `templates/report_format.md` (all headers mandatory, kept even if empty). If not DONE, name the smallest action that unblocks each open / blocked item.

## Rules
- Never regenerates the plan. If `01–08` are wrong → stop, tell user to re-run `/m_plan` or edit manually.
- Never writes secrets / prod hostnames into artifacts or commits.
- All three report sections are mandatory; empty sections kept (explicit empty = info).
- Trust artifacts: blockers were resolved in `/m_plan` Phase 0. New blockers mid-flight escalate, never silently bypass.

## Files in this skill
- `SKILL.md` — this file (core algorithm)
- `templates/deploy_rules.md` — deploy reality gate + browser preflight + real-environment deploy rules (read on deploy)
- `templates/report_format.md` — Phase C report skeleton (read at report time)
- `evals/evals.json` — test cases

