AGENT SKILL

dh-execute-plan

Orchestrate full plan execution: read plan.md, iterate sub-tasks delegating execution and review, resume on interruption, final-review sign-off, update index.md. Use when the user says 'execute plan', 'run the plan', or 'finish all tasks'.

License 许可
MIT
最近更新
2026-11-10
Stars
★ 8
Forks
1

01 前言 Front Matter

name
dh-execute-plan
license
MIT
metadata
{ "audience": "developers", "workflow": "development" }
description
Orchestrate full plan execution: read plan.md, iterate sub-tasks delegating execution and review, resume on interruption, final-review sign-off, update index.md. Use when the user says 'execute plan', 'run the plan', or 'finish all tasks'.
allowed-tools
read, write, edit, bash
compatibility
opencode, copilot, antigravity

03 SKILL.md 正文

Orchestrate the complete execution of a plan from start to finish. Iterate through all phases and their sub-tasks in order, delegate execution and review, handle interruptions, and produce a final sign-off.

Core Rules

  • Create a feature branch per plan execution
    • Check you are in main branch and create the feature branch.
    • If not in feature branch, ask user permission to continue before any change.
    • if working in monorepos with git submodules create a branch per submodule along with the branch of the main repository to align and trace commints between repositories.
  • Read the plan with the dh_plan_read tool ({ slug } → structured JSON: meta, phases[].title/status, subTasks[].phase/title/status). Fallback when the tool is unavailable: read ./docs/plans/<plan-slug>/plan.md manually, following the phased template markers (## Phases → ### Phase N: <title> → #### Sub-Task N.M: <title> with - **Status:** bullets). These tools are exposed by the project-scope dh MCP server; under Code Mode they are called as tools.dh.<tool>, and dh_<tool> is the tool's normalized name (permission actions match dh_*).
  • If the plan file does not exist, stop and report — suggest running the dh-planning skill first.
  • Paused handoff guard: if ./docs/plans/<plan-slug>/handoff.md exists with status: paused, do not start execution from plan statuses. Stop and direct the user to dh-resume-plan for that slug (it rehydrates context and detects drift). Bypass only on an explicit user instruction to skip rehydration.
  • Iterate phases in order; within each phase, iterate its sub-tasks in order.
  • Phase lifecycle: a phase becomes In Progress when its first sub-task starts; it becomes Completed only when ALL its sub-tasks are Completed.
  • Do not re-execute sub-tasks already marked Completed.
  • If a sub-task is marked In Progress, resume from it (don't restart from the beginning).
  • Update statuses with the dh_plan_update_status tool ({ slug, target: "phase"|"subtask", index: "N"|"N.M", status }): mark a sub-task In Progress before execution, Completed after its review passes, and a phase Completed only when all its sub-tasks are Completed. Fallback when the tool is unavailable: manual plan.md edits following the marker rules (only blank lines precede status bullets).
  • After each sub-task execution, run the dh-review skill before proceeding to the next.
  • If a review produces P0/P1 findings, stop and report — do not continue to the next sub-task (a blocked sub-task blocks its phase).
  • After the final sub-task, run the dh-final-review skill for sign-off.
  • Update ./docs/plans/index.md when the plan is fully complete.
  • Resolve the roster once per plan: before the first delegation, read ## Agent Selection in plan.md and validate its rows for the delegated, review, and final-review roles. If the section or a required row is absent or stale (a named agent no longer exists), run the selection protocol in ../dh-planning/references/agent-selection.md: discover the runtime agent list, then project config/agent directories, then global definitions; record the choices and generic fallbacks in the plan before continuing.
  • One delegated agent per sub-task: the active sub-task's Delegated to agent is the single executor. Implementation sub-tasks normally name the selected implementation agent; documentation/test-only sub-tasks name the matching selected role. There is no complexity- or type-based builder split. If the field is missing/empty/unknown or the named agent is unavailable, stop and report the gap — never substitute one silently.
  • Project type awareness is delegated to dh-execute-plan-task. The orchestrator does not re-detect project type — the task skill runs the software/non-software post-steps. Do not hardcode implementation, review, or final-review agent choices in the orchestration loop.
  • After plan completion (all projects): invoke dh-create-documentation to update docs and create the plan's evolution + observation notes (see its Custom Directives). This ensures knowledge persists beyond the active session.
  • After plan completion (software projects only): invoke dh-semver for determining the next version bump.

Workflow

Step 1: Read plan and assess state

Read the plan (via dh_plan_read; fallback: manual read) and determine the starting point using this ordered priority:

  1. Paused handoff: if ./docs/plans/<plan-slug>/handoff.md exists with status: paused, stop and direct the user to dh-resume-plan. Do not apply priorities 1–4 until the handoff is resumed or the user explicitly bypasses it.
  2. If all sub-tasks are Completed (every phase Completed), run dh-final-review skill only and proceed to Step 3. Skip the execution loop.
  3. Resume mode: if one or more phases are In Progress, start from the FIRST In Progress phase, then its FIRST sub-task marked In Progress or Pending.
  4. If all phases are Pending (all sub-tasks Pending), start from Phase 1's first sub-task.
  5. If the plan has no phases/sub-tasks, or every phase/sub-task has an unrecognized status, report the ambiguous state and stop.

Step 2: Execution loop

Iterate phases in order (skip phases already Completed); within each phase, iterate its sub-tasks starting from the determined starting point:

  1. Mark In Progress: Ensure the active sub-task is marked In Progress via dh_plan_update_status (target: "subtask"). If it is already In Progress (resume), leave the state. Marking the first sub-task of a phase also moves that phase to In Progress (phase lifecycle). Fallback: manual plan.md edit per the marker rules. This ensures resume works if interrupted.

0b. Resolve agents: confirm the plan's ## Agent Selection names available agents for the delegated, review, and (at the end) final-review roles, and confirm the active sub-task carries a Delegated to agent that matches one of them. A missing/empty/unknown field is a hard blocker: stop and ask the planner/user to fix the plan before delegating. A selected agent missing with no capability fallback also stops the run.

  1. Execute: Follow the dh-execute-plan-task skill to implement this sub-task. Since this is called from the orchestrator, dh-execute-plan-task skips its internal review and completion steps (per its orchestration guard).

  2. Verify: Run the dh-review skill to verify the sub-task result against its acceptance criteria and produce findings in ./docs/plans/<plan-slug>/tasks/review.md.

  3. Check findings: Read the review output:

    • If P0/P1 findings exist: stop the execution loop and report the blocking issues. Do not mark this sub-task Completed — a blocked sub-task blocks its phase (loop rule 2.4). Recommend fixing findings and re-running.
    • If no P0/P1 findings: mark the sub-task Completed via dh_plan_update_status (target: "subtask", status Completed). Fallback: manual edit.

3a. Close the phase: When ALL sub-tasks of the current phase are Completed, mark the phase Completed via dh_plan_update_status (target: "phase", status Completed; the tool refuses phase → Completed while any sub-task is open) and report the phase completion. Fallback: manual edit.

  1. Repeat: Continue to the next sub-task, then the next phase, until all phases are completed.

Step 3: Final sign-off

After all sub-tasks are completed and verified:

  1. Run the dh-final-review skill for the comprehensive final plan review.
  2. Read the final review verdict from ./docs/plans/<plan-slug>/tasks/review.md.
  3. If the verdict is Request changes: report the findings — do not mark the plan complete.
  4. If the verdict is Approve or Approve with comments: proceed to Step 4.

Step 4: Document evolution and close

After final sign-off passes and before marking the plan complete:

  1. Generate documentation (all projects): Invoke the dh-create-documentation skill to update project docs and create docs/evolution/<date>-<slug>.md (evolution note) + docs/evolution/observations/<date>-<hhmm>-<slug>.md (observation note), following its Custom Directives.

  2. Version bump (software projects only): Invoke the dh-semver skill to determine the correct version bump from commit history, generate a changelog, and create a git tag. Backfill: after dh-semver determines the version/tag, update the evolution note's version and the index Plan/Release entry with the new version/tag.

  3. Mark plan complete in ./docs/plans/index.md:

    • Locate the row for <plan-slug> and update the Status to Completed and Updated timestamp columns. If the slug is not found, append a new row.
    • Set the plan status to Completed.
  4. Report the plan completion with a summary:

    • Total sub-tasks completed
    • Final review verdict
    • Any deferred P2/P3 findings
    • Documentation generated (yes/no — details)
    • Version bump (if applicable)
    • Evolution & observation notes (paths)
    • Plan ready for merge

Resume Mode

The execution loop automatically handles interruptions:

  • A paused handoff takes precedence over status-based resume: run dh-resume-plan first. If the handoff is absent or already resumed, continue with the phase-aware priority in Step 1.
  • Step 2.0 explicitly marks the current sub-task as In Progress before delegating to dh-execute-plan-task. If the tool is interrupted, the next invocation reads the plan and finds this In Progress sub-task.
  • Resume from Step 1, which detects the phase-aware state (priority 2: first In Progress phase → its first In Progress/Pending sub-task) and continues the loop from there.
  • If interruption occurs after review but before the Completed mark, the sub-task remains In Progress on resume — re-run the review to verify before marking Complete.

Error Handling

  • Paused handoff present: do not execute around it — redirect to dh-resume-plan or get explicit confirmation to bypass.
  • Sub-task execution fails (validation keeps failing): dh-execute-plan-task stops after 3 validation attempts and reports the failure. Do not proceed to the next sub-task — the blocked sub-task blocks its phase (loop rule 2.4: never mark the phase Completed around a blocker).
  • Missing or invalid Delegated to agent: stop before any delegation and report the sub-task; the plan must be fixed rather than executed under a guessed owner.
  • Review produces blocking findings: Stop the execution loop. Recommend fixing the findings (using the address-review pattern) and re-running dh-execute-plan.
  • Final review fails: Report the verdict — do not mark the plan complete until findings are addressed.

Loop Integration (bundled)

This copy is bundled in the plugin; the loop below is the harness runtime contract (full text in repo-root AGENTS.md). Plan execution follows it in order — do not skip steps and never silently continue past a blocker:

  1. dh-planning (use dh-domain-check while planning)
  2. dh-execute-plan 2.1 dh-execute-plan-task (delegate code implementation through the dh-coding skill) 2.2 dh-simplify 2.3 dh-review + dh-code-review 2.4 IF hard blockers → stop and ask guidance; otherwise keep the dh-execute-plan-task loop
  3. dh-preflight + dh-artifact-check
  4. dh-final-review
  5. dh-create-documentation (also writes the evolution and observation notes)

Step 2.4 halts automation. When dh-execute-plan-task (or any loop step) hits a hard blocker — repeated validation failures (3 consecutive strikes), unresolved P0/P1 review findings, or missing preconditions that cannot be worked around — the loop STOPS: report the blocker and ask the user for guidance. Never silently continue, never skip the blocked step, and never mark sub-tasks Complete around a blocker. The rule applies at phase boundaries too: a blocked sub-task blocks its phase — do not mark the phase Completed around a blocker. Before stopping for a hard blocker or ending the session, run dh-pause-plan to preserve the phase/sub-task, git state, decisions, blockers, and next steps in handoff.md; resume later with dh-resume-plan.

References

  • Fast variant: dh-execute-plan-fast executes from plan_fast.md with no per-task gates and defers critical verification to plan end; plan.md stays the scope truth.
  • ../dh-planning/references/agent-selection.md: discovery, ranking, recording, and re-validation protocol for every delegated role.
  • dh-execute-plan-task skill: executes a single sub-task.
  • dh-review skill: verifies a single sub-task result.
  • dh-final-review skill: produces plan-level sign-off.
  • dh-create-documentation skill: updates docs and writes the evolution/observation notes after plan completion (all projects).

Doc search

Documentation management: delegate create / update / delete / retrieve of generated documents (excluding docs/plans) to the best available documentation agent (bundled documentation capability as fallback) — the main and only documentation owner (see dh-create-documentation).

Search generated documentation quickly: notesmd-cli search-content "<term>" --vault "<project-name>" or obsidian search query="<term>" (fallback: rg --glob '*.md' "<term>" docs/).

04 同仓库更多 Skills

andrescevp
andrescevp/development-harness

dh-simplify

Review changed code for reuse, quality, and efficiency (three parallel reviews), then fix findings directly. Use after making changes or when asked to clean up, refactor, simplify, or improve this code.

★ 8
andrescevp
andrescevp/development-harness

dh-setup

Audit system software, configure user MCPs/plugins, scaffold project QA (hooks + per-stack tools), bootstrap docs/architecture with the selected architecture agent, and write harness directives into AGENTS.md. Use to check requirements or setup the environment.

★ 8
andrescevp
andrescevp/development-harness

dh-semver

Apply strict Semantic Versioning — analyze commits since the last tag to determine the bump type (major/minor/patch from conventional commit prefixes), generate an automated changelog grouped by breaking changes, features, fixes, and chores, and create a git tag locally without pushing until confirmed, handling both conventional commits and manual version decisions. Use when preparing a release, invoked by dh-execute-plan after plan completion and dh-final-review for release readiness, or when the user asks "what version is next?", "bump version", "generate changelog", "tag release", or "what changed since last release?".

★ 8
andrescevp
andrescevp/development-harness

dh-review

Verify a plan sub-task against acceptance criteria, scope, done-when; review diff, validation, regression risk; structured verdict to tasks/review.md. Plan Alignment Mode (fast execution) is a separate mode: no sub-task selection, no diff review, no code review — it compares plan.md with plan_fast.md and writes tasks/review-fast.md (pre-execution) or tasks/review-fast-final.md (plan-end). Use after implementation, to review/verify the sub-task, or to check fast-plan alignment.

★ 8
andrescevp
andrescevp/development-harness

dh-resume-plan

Resume a paused phased plan from docs/plans/<slug>/handoff.md: validate the contract, detect drift, rehydrate context, mark the handoff resumed, and continue via dh-execute-plan resume mode. Use when the user says "resume the plan", "continue where we stopped", "pick up the plan", or "resume after a pause".

★ 8
andrescevp
andrescevp/development-harness

dh-preflight

Run tests, linters, static analysis as a release gate: auto-detect tooling, check dirty state, pass/fail verdict with actionable failures (no auto-fixes). Use to run preflight, pre-release check, or validate before release.

★ 8