plan-orchestrator@1.1.0

This commit is contained in:
valentinsilyutin committed 2026-11-30 00:36:22 +04:00
1 parent 961f8cb07d
commit d365506aad
1 file changed
+27 -16
+27 -16
View File
@@ -4,7 +4,7 @@ description: 'Step-by-step execution of an agreed plan by subagents: plan phase
license: MIT license: MIT
metadata: metadata:
author: Valentin Silyutin author: Valentin Silyutin
version: "1.0.0" version: "1.1.0"
--- ---
# Plan orchestration # Plan orchestration
@@ -19,8 +19,7 @@ How to run a multi-step plan: one step per subagent, planning and work as two ph
Do not use: Do not use:
- one task or a couple of edits — a subagent plus two phases costs more than doing it directly; - one task or a couple of edits — a subagent plus two phases costs more than doing it directly;
- research without edits, reviews, answering a question; - research without edits, reviews, answering a question.
- a plan the user wants to drive themselves — only the "user leads" mode applies (section 8).
## Why this shape ## Why this shape
@@ -43,7 +42,7 @@ Translate the templates before sending. Keep paths, commands, file and function
One call to the questions tool, two questions, defaults first: One call to the questions tool, two questions, defaults first:
1. **Who drives execution**: the agent (default) / the user. 1. **Who drives execution**: the agent (default) / the user (section 8).
2. **Commits**: after every step (default) / one at the end / none. 2. **Commits**: after every step (default) / one at the end / none.
The loop never starts while planning: edits are forbidden in plan mode. The plan is agreed and the user has left plan mode first. The loop never starts while planning: edits are forbidden in plan mode. The plan is agreed and the user has left plan mode first.
@@ -52,20 +51,29 @@ No questions tool available — ask the same two questions as plain text and wai
## 1. The plan ## 1. The plan
A step is not a heading; it is a self-contained assignment. Required fields: A step is not a heading; it is a self-contained assignment. Every field is required except Risks:
| Field | What to write | | Field | What to write |
|---|---| |---|---|
| Goal | what must change in behaviour or appearance | | Goal | what must change in behaviour or appearance |
| Files | paths this step is allowed to touch | | Files | paths this step is allowed to touch |
| Acceptance criteria | checkable statements, not "make it neat" | | Acceptance criteria | checkable statements, not "make it neat" |
| Checks | project commands and what a human verifies by hand | | Checks | project commands, who runs each (subagent or orchestrator), and what a human verifies by hand |
| Do not touch | neighbouring entities, contracts, dependencies | | Do not touch | neighbouring entities, contracts, dependencies |
| Risks | what may break and how to notice it | | Risks (optional) | orchestrator-only context the subagent cannot derive from the code: hazards the user mentioned, or that follow from how steps connect. Empty when none |
Steps follow dependency order. Parallel runs are allowed only for steps that share no files, and only by an explicit decision, never by default. Steps follow dependency order. Parallel runs are allowed only for steps that share no files, and only by an explicit decision, never by default.
Track progress with the todo tool when the environment has one. Otherwise print a status table after each step. Create a journal file in one case only: the context is running out and the plan would be lost. Discover the project's real checks first (`AGENTS.md`, `package.json` scripts, Makefile) — never invent commands. Split them in the plan; each check has exactly one owner and runs once per tree state:
- fast, file-scoped checks (lint, format, typecheck, unit tests of the touched modules) → the subagent, at the end of its work phase; it applies the formatter to its own files itself;
- slow or repo-wide checks (integration, contract, e2e, full suite) → the orchestrator, once, at final verification. Exception: when a step changes a contract or shared code, the orchestrator runs the matching contract tests at that step's verification, not only at the end.
Write the plan to a file before launching any subagent: one markdown file in a fresh temp directory (the environment's preferred temp location if it names one, otherwise `mktemp -d`). It holds the full steps, the check split, the execution mode and user decisions. Tell the user the path once.
Each step is a checkbox with a status: pending → in progress when its subagent launches → done after verification (with the commit hash once committed), or failed/blocked with the reason. Edit that one line at each transition; record user decisions as they happen.
Track progress with the todo tool when the environment has one — it mirrors the file, and the file is the source of truth. Otherwise print a status table after each step.
## 2. Loop over a step ## 2. Loop over a step
@@ -82,7 +90,7 @@ You work in the repository <path> (<stack>). Reply and write comments in <projec
Step <N> of <M>: <title> Step <N> of <M>: <title>
<the whole step: goal, files, acceptance criteria, checks, what must not be touched> <the whole step: goal, files, acceptance criteria, checks, what must not be touched, risks>
Phase 1 — plan only. Do not edit files, do not create anything, do not commit. Phase 1 — plan only. Do not edit files, do not create anything, do not commit.
@@ -119,10 +127,10 @@ Execute your plan.
Rules: <project constraints: do not commit, add no dependencies, touch no files outside the list, do not edit generated files, comment language>. Rules: <project constraints: do not commit, add no dependencies, touch no files outside the list, do not edit generated files, comment language>.
At the end run the project checks and return a report: At the end run your assigned checks (fast, scoped to your files; apply the formatter yourself) and return a report:
- what changed, per file, one line each with the reason; - what changed, per file, one line each with the reason;
- which acceptance criteria are met and what proves it; - which acceptance criteria are met and what proves it;
- checks: command → result; - checks: command → actual output or exit status;
- what remains unverified and which risks exist; - what remains unverified and which risks exist;
- what the user must look at by hand. - what the user must look at by hand.
``` ```
@@ -133,12 +141,12 @@ Session not kept or lost — pass the plan back as text, but never start a new s
This is the orchestrator's job, not the subagent's. Go through the checklist before moving on: This is the orchestrator's job, not the subagent's. Go through the checklist before moving on:
- [ ] `git status --short` — only the step's files, no unrelated changes; - [ ] `git status --short` against the saved snapshot — the subagent changed only the step's files; pre-existing user edits are not its doing;
- [ ] the diff is read in full, not by the heading; - [ ] the diff is read in full, not by the heading;
- [ ] every acceptance criterion is checked in the code, not by the report's word; - [ ] every acceptance criterion is checked in the code, not by the report's word;
- [ ] no debug output, commented-out blocks or dead code; - [ ] no debug output, commented-out blocks or dead code;
- [ ] no new dependencies, generated files rebuilt by their generator rather than edited by hand; - [ ] no new dependencies, generated files rebuilt by their generator rather than edited by hand;
- [ ] project checks from `AGENTS.md` or `package.json` are run by you, not taken on trust; - [ ] checks: the subagent's report shows real command → result for its assigned checks; a claim without output counts as not run. Rerun yourself only what failed, was skipped or looks doubtful — not the whole suite again;
- [ ] manual checks are collected into a list for the user. - [ ] manual checks are collected into a list for the user.
A failure is no reason to rewrite the code yourself. Continue the subagent's session with a concrete list of findings. Two failed attempts — stop and ask the user: continue, revert the step, or replan. A failure is no reason to rewrite the code yourself. Continue the subagent's session with a concrete list of findings. Two failed attempts — stop and ask the user: continue, revert the step, or replan.
@@ -151,6 +159,7 @@ By default one step is one commit, after green checks.
- `git add -A` is allowed only when the tree has no foreign changes. Otherwise stage the step's files one by one. - `git add -A` is allowed only when the tree has no foreign changes. Otherwise stage the step's files one by one.
- The subagent never commits: the orchestrator does, otherwise the history stops matching the plan. - The subagent never commits: the orchestrator does, otherwise the history stops matching the plan.
- Commits disabled by the user — do not commit at all, but keep running the checks. - Commits disabled by the user — do not commit at all, but keep running the checks.
- One commit at the end — after final verification (section 6), a single commit for the whole plan.
## 5. Stop signals ## 5. Stop signals
@@ -169,7 +178,7 @@ Proceeding silently is fine only for cosmetic drift: different line order, a ren
After the last step: After the last step:
1. Run the full project checks. 1. Run the full project checks once, on the final tree.
2. A table: step → commit → status. 2. A table: step → commit → status.
3. What remains open and why. 3. What remains open and why.
4. What the user verifies by hand: screens, gestures, states, devices. 4. What the user verifies by hand: screens, gestures, states, devices.
@@ -181,6 +190,7 @@ After the last step:
- Restate the step no longer than in the plan: a long prompt is read worse than a short one. - Restate the step no longer than in the plan: a long prompt is read worse than a short one.
- The user's answers are passed on faithfully, without guesswork. - The user's answers are passed on faithfully, without guesswork.
- Run two steps in one subagent and you lose the commit and verification boundary. - Run two steps in one subagent and you lose the commit and verification boundary.
- After context compaction or a new session, read the plan file and resume from the first unfinished step, checking `git status` and `git log` against it. The file, not memory, is the source of truth.
## 8. User-led mode ## 8. User-led mode
@@ -196,8 +206,9 @@ Every other section still applies: phases, verification, stop signals.
## 9. Do not ## 9. Do not
- Do not pack two steps into one subagent. - Do not pack two steps into one subagent.
- Do not take "checks are green" on trust. - Do not take "checks are green" on trust — a claim without output counts as not run.
- Do not commit while the tree holds foreign changes. - Do not run the same check twice on an unchanged tree.
- Do not commit foreign changes — stage only the step's files.
- Do not let the subagent commit. - Do not let the subagent commit.
- Do not implement a step yourself when the agent drives: verification then becomes self-verification. - Do not implement a step yourself when the agent drives: verification then becomes self-verification.
- Do not retell the whole plan after every step — status and decisions only. - Do not retell the whole plan after every step — status and decisions only.