Stage 3 of three-stage planning pipeline. Produce a file-level implementation plan via detail-planner/detail-reviewer loop, then get user approval. Inputs are confirmed intent (<first_session_id>-intent.md) and outline (<first_session_id>-outline.md) from prior stages.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Make Detail Plan?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nirecom-make-detail-plan)
---
name: make-detail-plan
description: Stage 3 of three-stage planning pipeline. Produce a file-level implementation plan via detail-planner/detail-reviewer loop, then get user approval. Inputs are confirmed intent (<first_session_id>-intent.md) and outline (<first_session_id>-outline.md) from prior stages.
model: sonnet
user-invocable: false
---
<!-- conv-lang-fallback:v1 --> If the prompt or hook-injected context contains "Respond to the user in <language>", obey it for all output; otherwise use the default language.
Produce a detailed implementation plan via a planner/reviewer discussion loop.
Read intent.md + outline.md before drafting.
## Procedure
When a hook blocks a sanctioned command, a fallback path is taken, or any unexpected outcome occurs, report via /supervisor-report (trigger conditions: rules/supervisor-reporting.md).
### MDP-1 — Resolve <PLANS_DIR> + read artifacts
Apply `skills/_shared/resolve-plans-dir.md` once; substitute the resolved absolute path for every `<PLANS_DIR>` below. Set `<INTENT_MD>` / `<OUTLINE_MD>` / `<DETAIL_MD>` to the output of `node "$AGENTS_MAIN_ROOT/bin/plan-artifact-path" --step clarify_intent` / `--step outline` / `--step detail` (every generation of the session chain shares the first_session_id names); substitute them for every `$INTENT_MD` / `$OUTLINE_MD` / `$DETAIL_MD` below. When the detail call fails, write no detail: halt and surface its stderr. Read intent and outline if present; otherwise proceed with task context alone.
### MDP-2 — Surface delivery plan
Run `bash "$AGENTS_MAIN_ROOT/skills/make-detail-plan/scripts/surface-delivery-plan.sh"` against outline.md.
### MDP-3 — Choose planner model
Run `bash -c 'node "$AGENTS_MAIN_ROOT/bin/workflow/read-complexity-evaluation" --session "$SESSION_ID" --stage detail'`. If line 1 is not `NONE`, use its `model=<alias>` and `signals=<csv-or-none>` lines directly.
If `NONE` (fail-open for sessions without persisted evaluation): follow `skills/_shared/jev-two-stage-judge.md` with point=`complexity-judge` stage=`detail`; use its `model=` and `SIGNALS_CSV` — never judge the level inline.
Emit (Claude text, not Bash): `Model selected: **<model= alias>** (signals: [ids from the `signals=` line, or "none"])`.
### MDP-4 — Initial draft
Delegate to **planner** (Agent tool, `subagent_type: detail-planner`, `model: <model= from MDP-3>`). Pass task context + intent/outline contents.
Read `rules/architecture-principles.md` (on-demand-only, never auto-injected) and pass its contents to every detail-planner launch as design constraints.
Every detail-planner prompt carries the canonical line of the `rules/shell-commands.md` Subagent Dispatch Prompts section.
Every detail-planner launch — here, the MDP-5 CONTINUE re-delegate, the MDP-7 revise and re-prompt, and the research re-prompt — passes the same `model: <model= from MDP-3>`.
Note: the Stop-guard silence during dispatch is automatic (PostToolUse marks the step `in_progress`). Do not emit `NEXT_STEP_PAUSE`.
### MDP-4a — Sentinel detection (fallback notice)
If planner draft's first line contains `<<DETAIL_SKIPPABLE_BY_PLANNER:`, this is a fallback notice indicating no pre-flight recorded verdict existed when the session was planned. Do NOT set MAX_EXTENSIONS=0. Proceed to MDP-5 normally. Sentinel absent → MDP-5 unchanged.
### MDP-5 — Codex review loop
Follows `skills/_shared/codex-review-loop.md` with: FORMAT=detail-plan, CAP=2, MAX_EXTENSIONS=1, PLANNER_AGENT=detail-planner, REVIEWER_AGENT=detail-reviewer, ACCEPTED_TRADEOFFS_FILE=the merged file `bin/resolve-accepted-tradeoffs-file` builds from the `outline` → `intent` chain, NON_APPROVED_VERDICT=NEEDS_REVISION.
Each round: invoke `"$AGENTS_MAIN_ROOT/skills/make-detail-plan/scripts/run-codex-review-loop.sh"` (Bash) with exported `AGENTS_MAIN_ROOT`, `SESSION_ID`, `PLANS_DIR`, `EXTENSIONS_USED` (required); `CTX_SURVEY_CODE`, `CTX_SURVEY_HISTORY` (optional — passed as `--context` when present + non-empty). Exit codes pass through.
`CTX_CONCERNS_LOG` is auto-generated by the wrapper from the ledger (`concern-ledger render-concerns-log`, format `detail-plan`) and auto-exported when non-empty — do not set it manually (#2185).
Detail-stage caller paths:
- RAW_FILE: `<PLANS_DIR>/<session-id>-codex-round-<N>-raw.md`
- CONCERNS_LOG: `<PLANS_DIR>/<session-id>-concerns-log.md`
- DEBUG_LOG: `<PLANS_DIR>/<session-id>-detail-debug.log`
Exit code → action: SSOT table in `skills/_shared/codex-review-loop.md`. **Exit 4 must NOT trigger `detail-reviewer` fallback** — halt + surface stderr. Only exit 3 falls back silently.
**exit 1 (CONTINUE):** save stdout to `<PLANS_DIR>/<session-id>-codex-round-<N>-raw.md` (`<N>` from `<CONTROL_DIR>/detail-plan-round-number.txt`, `<CONTROL_DIR>` = `node "$AGENTS_MAIN_ROOT/bin/workflow-control-dir" --session <session-id>`); re-delegate to planner and loop back to MDP-5.
**Exit 7 (FINALIZE_FAILED)** — `<CONTROL_DIR>/detail-plan-unresolved-concerns.json` could not be written: halt, surface the `## Concern Ledger: FINALIZE-FAILED` line, and emit no completion sentinel. After any ESCALATE, confirm the artifact with `bash "$AGENTS_MAIN_ROOT/bin/concern-ledger" check-finalized --plans-dir <PLANS_DIR> --session-id <session-id> --format detail-plan` before the sentinel.
### MDP-6 — Cap outcome dispatch
Apply only when the per-stage wrapper script (MDP-5) returns a non-zero non-one exit code indicating a cap was reached:
**Exit 5 (AUTO_EXTEND):** save stdout to the exit 1 `-raw.md` (`<N>` from `<CONTROL_DIR>/detail-plan-round-number.txt`), increment `EXTENSIONS_USED` by 1, then loop back to MDP-5 (no user confirmation). This is the budget-available path — `bin/review-loop-verdict` already verified budget > 0. The wrapper derives `EXTENSIONS_USED` from the review record and only cross-checks the exported value.
**exit 2 (ESCALATE):** Run `bash "$AGENTS_MAIN_ROOT/bin/review-loop-summarize-concerns" --budget-remaining 0 --ledger <CONTROL_DIR>/detail-plan-concern-ledger-cap-snapshot.txt --raw <RAW_FILE>` and present the output to the user. Stop the loop. This is the risk-signal-present ceiling path — a blocking concern requires human attention.
**exit 6 (HIGH_UNRESOLVED):** run `bash "$AGENTS_MAIN_ROOT/bin/review-loop-summarize-concerns" --budget-remaining 0 --ledger <CONTROL_DIR>/detail-plan-concern-ledger.txt --raw <RAW_FILE> --label detail-plan`; confirm artifact via `bash "$AGENTS_MAIN_ROOT/bin/concern-ledger" check-finalized --plans-dir <PLANS_DIR> --session-id <session-id> --format detail-plan`; stop loop, do not proceed to MDP-7; follow exit-codes.md "Escalation by format" (fix and re-run, or accept the residual HIGH). Exit 9 on a later re-run → return to that accept step.
`<RAW_FILE>` for terminal exits (2 or 6) = `<PLANS_DIR>/<session-id>-codex-round-<N>-raw.md`; `<N>` = value from `<CONTROL_DIR>/detail-plan-last-round.txt`. Exit 8: AskUserQuestion (`metadata.source=codex-review-loop.unchanged-rerun`) per exit-codes.md "Escalation by format".
Research/malformed-retry cap escalation: see `bash "$AGENTS_MAIN_ROOT/skills/make-detail-plan/scripts/cap-escalation-message.sh"` for message order.
### MDP-7 — Assemble + confirm
On reviewer `APPROVED`: assemble `<DETAIL_MD>` via the shared helper. Helper carries `## Issues` mechanically from outline.md; planner draft is the body source and holds the planner-written `## Accepted Tradeoffs (detail)` (the empty marker when none). `## Class members` is NOT carried into detail.md — its SSOT is intent.md (#2228). Upstream content is referenced, never copied: `skills/_shared/no-upstream-copy.md`.
Run `bash "$AGENTS_MAIN_ROOT/skills/_shared/assemble-mandatory.sh" --source-kind outline "$OUTLINE_MD" "$DETAIL_MD" "$DETAIL_MD"` (Bash). Do NOT instruct planner to author `## Issues` — helper strips planner-authored copies (including legacy or other-stage Accepted Tradeoffs and any `## Class members` residue). Helper exit non-zero → re-prompt planner once + re-assemble; second failure → halt.
After assemble-mandatory.sh succeeds, run `bash "$AGENTS_MAIN_ROOT/bin/check-issues-class-coverage" --mode detail "$DETAIL_MD"` (Bash). Exit non-zero → re-prompt planner once with the stderr output as revision feedback; second failure → halt. This gate fires before the gate check — blocks even on the `proceed` (auto-approval) path.
Gate check: apply skills/_shared/confirm-plan.md CPA-3 — run next-step --gate and follow GATE_ACTION.
At detail, `--gate` also folds in the outline→detail scope change, so it runs after the assembly above.
Issue the standalone call `bash "$AGENTS_MAIN_ROOT/bin/get-config-var" CONV_LANG`; when its stdout `<CONV_LANG>` is non-empty, write both the `proceed` one-paragraph summary and the `ask` one-line `<<WORKFLOW_CONFIRM_DETAIL: ...>>` summary in that language.
Apply the rest of the confirm-plan protocol (`skills/_shared/confirm-plan.md`) with `CONFIRM_DETAIL` flag and `<DETAIL_MD>` artifact.
- The approval presentation lists "Accepted upstream inconsistencies and user course corrections" per [`upstream-inconsistency-pause.md`](../_shared/codex-review-loop/upstream-inconsistency-pause.md); a re-run after B revises the existing detail as a diff per that procedure.
- **Revise** (skill-specific): ask what to change, send feedback to planner as new revision request, loop to MDP-5 (re-draft → re-review → re-confirm). Each revision consumes `revision_rounds`.
- Re-entering MDP-7 from a Revise loop: rerun the gate check from the trigger line, without `--scope-change-approved`.
- `GATE_ACTION=proceed`: emit `<<WORKFLOW_MARK_STEP_detail_complete>>` after one-paragraph summary (protocol CPA-3) that carries the plan-link line (protocol CPA-2).
- `GATE_ACTION=audit-wait` / `audit-block`: follow CPA-3.
- `GATE_ACTION=present-and-stop`: present the scope change line from `GATE_HINT` and the relevant detail plan section, then end the turn.
- After `present-and-stop`, on approval run the standalone `node "$AGENTS_MAIN_ROOT/bin/workflow/next-step" --gate --scope-change-approved` and follow its `GATE_ACTION` (normally `proceed`); on a change request, loop to MDP-5.
- `GATE_ACTION=ask`: follow the three CPA-3 steps — the plan presentation turn, then `echo "<<WORKFLOW_CONFIRM_DETAIL: {one-line summary}>>"` alone — as the next message when the turn end is blocked, otherwise in the next turn; after Allow, run Completion and co-emit either `echo "<<WORKFLOW_BRANCHING_COMPLETE: ...>>"` (per the Completion branching record) or the `write-tests` Skill invocation.
## Research Escalation
Planner reply starting with `NEEDS_RESEARCH` (first non-whitespace token) short-circuits before reviewer + runs `/deep-research`. Format spec: `planner.md`.
**Malformed** (missing/empty field, `skill:` ≠ `deep-research`): re-prompt once with one-line diagnostic. Second malformed → escalate. Malformed retries do NOT consume `research_rounds`.
Round counters (revision: 2, research: 2, malformed_retries: 1) — see codex-review-loop.md SSOT. `NEEDS_RESEARCH` does NOT consume `revision_rounds`; allowed at any planner turn.
Re-prompt template: run `bash "$AGENTS_MAIN_ROOT/skills/make-detail-plan/scripts/research-reprompt.sh"` for the template.
Subagent prompts may contain verbatim research (summarize-to-user applies to user-facing chat only). Double-emit of `<<WORKFLOW_MARK_STEP_research_complete>>` is harmless (`markStep` idempotent).
On cap: tell user which budget exhausted, how many times research ran, the pending question. Ask: "Approve further research, provide the answer directly, or adjust scope?" On escalation, do not mark the plan step complete.
## Skip Conditions / Skipping This Stage
See `bash "$AGENTS_MAIN_ROOT/skills/make-detail-plan/scripts/skip-conditions.sh"`.
## Rules
- Read intent/outline before planning — never plan from assumptions.
- Outline's Delivery plan must be surfaced in MDP-2 before planner subagent runs (required).
- Orchestrator chat during discussion loop is restricted to: (a) one status line per round (`Round N: APPROVED|NEEDS_REVISION (proceeding)`); (b) the plan-link line (protocol CPA-2); (c) the `Delivery plan (...)` summary from MDP-2; (d) the concern summary block rendered by the MDP-6 ESCALATE/HIGH_UNRESOLVED path when exit 2 or exit 6 fires — exactly one block per cap-reach event. No per-round natural-language summaries (the cap-reach summary in (d) is the sole exception). Diagnostics → `<session-id>-detail-debug.log`.
- Write the MDP-7 orchestrator-authored detail.md body in the PLAN_LANG language (see .env.example) from the first draft; do not draft in English and re-translate.
- Follow `rules/core-principles.md`.
- **One user-facing confirmation per run** — only the final plan approval in MDP-7. Never pause during intermediate revision rounds (MDP-4..5): write drafts silently, inform user with plain text only. Exception: pause mid-round only to confirm via AskUserQuestion (`metadata.source=glossary-drift.accept-unfixed`) whether to accept a `[glossary-drift ` concern unfixed, per `skills/_shared/glossary-drift-check.md`.
- Second exception: a `[upstream-inconsistency ` concern pauses the round for the user's decision, per `skills/_shared/codex-review-loop/upstream-inconsistency-pause.md`.
- Deliver user-facing analysis summaries (approach comparison, risk assessment, trade-off rationale) as turn-final assistant text or via AskUserQuestion preview/description — not as mid-turn text between tool calls, which is invisible in VS Code. <!-- askuser-none -->
- Planner + reviewer apply `skills/_shared/priority-hierarchy.md` — codex/reviewer concerns must not override approved intent.md / outline.md decisions.
- Report observations via /supervisor-report (trigger conditions: rules/supervisor-reporting.md).
## Completion
1. Run: `node "$AGENTS_MAIN_ROOT/bin/workflow/next-step" --advance --step detail --complete --next` (ENTIRE Bash command — no pipes / && / redirection). MUST run only after the `<<WORKFLOW_CONFIRM_DETAIL: ...>>` sentinel (MDP-7) has already fired in an earlier response — never combine them in the same Bash call. Follow the returned `ACTION`/`NEXT_SKILL`/`NEXT_HINT` per `CLAUDE.md` for the `write-tests` invocation below.
2. Record branching: Read `rules/branch.md` and `rules/worktree.md` (both on-demand-only, never auto-injected), then run `echo "<<WORKFLOW_BRANCHING_COMPLETE: branch: {name}|worktree: {path}|main>>"`.
The branching record is not written while the detail plan is unapproved; get the CONFIRM_DETAIL Allow first.
3. Invoke `write-tests` via Skill tool (or skip with `echo "<<WORKFLOW_WRITE_TESTS_NOT_NEEDED: {reason}>>"`) — matches the `ACTION=invoke NEXT_SKILL=write-tests` result from the `next-step --advance` call above.