pi-maestro-flow 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -72
- package/agents/cross-role-reviewer.md +1 -1
- package/agents/impeccable-agent.md +1 -1
- package/agents/ralph-executor.md +1 -1
- package/agents/team-worker.md +1 -1
- package/agents/workflow-analyzer.md +1 -1
- package/agents/workflow-codebase-mapper.md +1 -1
- package/agents/workflow-collab-planner.md +1 -1
- package/agents/workflow-debugger.md +1 -1
- package/agents/workflow-executor.md +1 -1
- package/agents/workflow-integration-checker.md +1 -1
- package/agents/workflow-nyquist-auditor.md +1 -1
- package/agents/workflow-phase-researcher.md +1 -1
- package/agents/workflow-planner.md +1 -1
- package/agents/workflow-project-researcher.md +1 -1
- package/agents/workflow-reviewer.md +1 -1
- package/agents/workflow-verifier.md +1 -1
- package/package.json +13 -4
- package/skills/codify-to-knowhow/SKILL.md +1 -1
- package/skills/delegation-check/SKILL.md +1 -1
- package/skills/domain-add/SKILL.md +5 -7
- package/skills/insight-challenge/SKILL.md +1 -1
- package/skills/learn-decompose/SKILL.md +4 -4
- package/skills/learn-follow/SKILL.md +5 -5
- package/skills/learn-investigate/SKILL.md +5 -5
- package/skills/learn-second-opinion/SKILL.md +5 -5
- package/skills/maestro/SKILL.md +9 -10
- package/skills/maestro-amend/SKILL.md +3 -3
- package/skills/maestro-analyze/SKILL.md +10 -13
- package/skills/maestro-blueprint/SKILL.md +8 -11
- package/skills/maestro-brainstorm/SKILL.md +11 -14
- package/skills/maestro-collab/SKILL.md +4 -4
- package/skills/maestro-companion/SKILL.md +3 -3
- package/skills/maestro-composer/SKILL.md +11 -12
- package/skills/maestro-execute/SKILL.md +9 -12
- package/skills/maestro-fork/SKILL.md +8 -11
- package/skills/maestro-grill/SKILL.md +13 -16
- package/skills/maestro-guard/SKILL.md +5 -5
- package/skills/maestro-help/SKILL.md +3 -3
- package/skills/maestro-impeccable/SKILL.md +7 -7
- package/skills/maestro-init/SKILL.md +9 -12
- package/skills/maestro-merge/SKILL.md +6 -8
- package/skills/maestro-milestone-audit/SKILL.md +3 -5
- package/skills/maestro-milestone-complete/SKILL.md +9 -12
- package/skills/maestro-milestone-release/SKILL.md +9 -11
- package/skills/maestro-next/SKILL.md +5 -5
- package/skills/maestro-overlay/SKILL.md +16 -16
- package/skills/maestro-plan/SKILL.md +9 -12
- package/skills/maestro-player/SKILL.md +5 -5
- package/skills/maestro-quick/SKILL.md +5 -7
- package/skills/maestro-ralph/SKILL.md +16 -17
- package/skills/maestro-ralph-cli/SKILL.md +6 -6
- package/skills/maestro-ralph-cli-execute/SKILL.md +2 -2
- package/skills/maestro-ralph-execute/SKILL.md +4 -4
- package/skills/maestro-ralph-v2/SKILL.md +18 -19
- package/skills/maestro-roadmap/SKILL.md +8 -9
- package/skills/maestro-swarm-workflow/SKILL.md +9 -9
- package/skills/maestro-tools-execute/SKILL.md +5 -7
- package/skills/maestro-tools-register/SKILL.md +7 -9
- package/skills/maestro-ui-codify/SKILL.md +9 -10
- package/skills/maestro-universal-workflow/SKILL.md +15 -15
- package/skills/maestro-update/SKILL.md +10 -10
- package/skills/manage-codebase-rebuild/SKILL.md +4 -6
- package/skills/manage-drift-realign/SKILL.md +8 -11
- package/skills/manage-harvest/SKILL.md +6 -9
- package/skills/manage-issue/SKILL.md +5 -8
- package/skills/manage-issue-discover/SKILL.md +8 -11
- package/skills/manage-kg-extractors/SKILL.md +3 -3
- package/skills/manage-knowhow/SKILL.md +3 -5
- package/skills/manage-knowhow-capture/SKILL.md +4 -6
- package/skills/manage-knowledge-audit/SKILL.md +6 -9
- package/skills/manage-status/SKILL.md +3 -5
- package/skills/manage-wiki/SKILL.md +5 -7
- package/skills/odyssey-debug/SKILL.md +13 -13
- package/skills/odyssey-improve/SKILL.md +15 -15
- package/skills/odyssey-planex/SKILL.md +16 -16
- package/skills/odyssey-review-test-fix/SKILL.md +11 -11
- package/skills/odyssey-ui/SKILL.md +10 -10
- package/skills/prompt-generator/SKILL.md +5 -5
- package/skills/quality-auto-test/SKILL.md +3 -5
- package/skills/quality-debug/SKILL.md +3 -5
- package/skills/quality-refactor/SKILL.md +3 -5
- package/skills/quality-retrospective/SKILL.md +10 -13
- package/skills/quality-review/SKILL.md +5 -8
- package/skills/quality-sync/SKILL.md +3 -5
- package/skills/quality-test/SKILL.md +4 -6
- package/skills/scholar-anti-ai-writing/SKILL.md +1 -1
- package/skills/scholar-citation-verify/SKILL.md +1 -1
- package/skills/scholar-experiment/SKILL.md +2 -2
- package/skills/scholar-ideation/SKILL.md +7 -7
- package/skills/scholar-latex-organizer/SKILL.md +1 -1
- package/skills/scholar-publish/SKILL.md +3 -3
- package/skills/scholar-rebuttal-pro/SKILL.md +3 -3
- package/skills/scholar-review/SKILL.md +1 -1
- package/skills/scholar-writing/SKILL.md +1 -1
- package/skills/security-audit/SKILL.md +2 -4
- package/skills/skill-generator/SKILL.md +3 -3
- package/skills/skill-iter-tune/SKILL.md +3 -3
- package/skills/skill-simplify/SKILL.md +1 -1
- package/skills/skill-tuning/SKILL.md +1 -1
- package/skills/spec-add/SKILL.md +5 -7
- package/skills/spec-load/SKILL.md +3 -5
- package/skills/spec-remove/SKILL.md +4 -6
- package/skills/spec-setup/SKILL.md +6 -8
- package/skills/team-adversarial-swarm/SKILL.md +5 -5
- package/skills/team-arch-opt/SKILL.md +2 -2
- package/skills/team-brainstorm/SKILL.md +3 -3
- package/skills/team-coordinate/SKILL.md +4 -4
- package/skills/team-designer/SKILL.md +1 -1
- package/skills/team-executor/SKILL.md +3 -3
- package/skills/team-frontend/SKILL.md +2 -2
- package/skills/team-frontend-debug/SKILL.md +3 -3
- package/skills/team-interactive-craft/SKILL.md +2 -2
- package/skills/team-issue/SKILL.md +3 -3
- package/skills/team-lifecycle-v4/SKILL.md +4 -4
- package/skills/team-motion-design/SKILL.md +2 -2
- package/skills/team-perf-opt/SKILL.md +3 -3
- package/skills/team-planex/SKILL.md +2 -2
- package/skills/team-quality-assurance/SKILL.md +3 -3
- package/skills/team-review/SKILL.md +3 -3
- package/skills/team-roadmap-dev/SKILL.md +3 -3
- package/skills/team-swarm/SKILL.md +4 -4
- package/skills/team-tech-debt/SKILL.md +2 -2
- package/skills/team-testing/SKILL.md +3 -3
- package/skills/team-ui-polish/SKILL.md +2 -2
- package/skills/team-uidesign/SKILL.md +2 -2
- package/skills/team-ultra-analyze/SKILL.md +4 -4
- package/skills/team-ux-improve/SKILL.md +3 -3
- package/skills/team-visual-a11y/SKILL.md +2 -2
- package/skills/workflow-skill-designer/SKILL.md +8 -8
- package/templates/business-test-report.json +68 -0
- package/templates/config.json +48 -0
- package/templates/context.md +16 -0
- package/templates/doc-index.json +11 -0
- package/templates/index.json +68 -0
- package/templates/issue.json +36 -0
- package/templates/plan.json +38 -0
- package/templates/project.md +60 -0
- package/templates/reflection-log.md +20 -0
- package/templates/roadmap.md +45 -0
- package/templates/scratch-index.json +19 -0
- package/templates/search-tool.json +1 -0
- package/templates/search-tools.md +47 -0
- package/templates/state.json +18 -0
- package/templates/task-summary.md +21 -0
- package/templates/task.json +89 -0
- package/templates/terminology-template.json +22 -0
- package/templates/uat.md +21 -0
- package/templates/validation.json +31 -0
- package/templates/verification.json +37 -0
- package/templates/workflow.md +14 -0
- package/templates/worktree-scope.json +9 -0
- package/templates/worktrees.json +26 -0
- package/workflows/agy-instructions.md +156 -0
- package/workflows/analyze.md +768 -0
- package/workflows/auto-test.md +705 -0
- package/workflows/blueprint.md +406 -0
- package/workflows/boundary-grill.md +50 -0
- package/workflows/brainstorm.md +508 -0
- package/workflows/business-test.md +574 -0
- package/workflows/chinese-response.md +25 -0
- package/workflows/claude-instructions.md +167 -0
- package/workflows/codebase-rebuild.md +267 -0
- package/workflows/codebase-refresh.md +168 -0
- package/workflows/codex-instructions.md +156 -0
- package/workflows/coding-philosophy.md +70 -0
- package/workflows/command-authoring.md +823 -0
- package/workflows/debug.md +409 -0
- package/workflows/delegate-usage.md +99 -0
- package/workflows/domain-add.md +121 -0
- package/workflows/drift-realign.md +396 -0
- package/workflows/execute.md +631 -0
- package/workflows/explore-usage.md +93 -0
- package/workflows/finish-work.md +124 -0
- package/workflows/fork.md +162 -0
- package/workflows/grill.md +494 -0
- package/workflows/harvest.md +478 -0
- package/workflows/impeccable.md +168 -0
- package/workflows/init.md +157 -0
- package/workflows/instruction-authoring-guide.md +97 -0
- package/workflows/integration-test.md +186 -0
- package/workflows/interview-mechanics.md +8 -0
- package/workflows/issue-analyze.md +20 -0
- package/workflows/issue-discover.md +238 -0
- package/workflows/issue-execute.md +110 -0
- package/workflows/issue-gaps-analyze.codex.md +256 -0
- package/workflows/issue-gaps-analyze.md +215 -0
- package/workflows/issue-plan.md +110 -0
- package/workflows/issue.md +338 -0
- package/workflows/knowhow.md +429 -0
- package/workflows/knowledge-audit.md +355 -0
- package/workflows/learn.md +271 -0
- package/workflows/maestro-chain-execute.md +20 -0
- package/workflows/maestro-link-coordinate.md +114 -0
- package/workflows/maestro-super.md +120 -0
- package/workflows/maestro.md +501 -0
- package/workflows/map.md +74 -0
- package/workflows/merge.md +122 -0
- package/workflows/milestone-audit.md +155 -0
- package/workflows/milestone-complete.md +167 -0
- package/workflows/milestone-release.md +82 -0
- package/workflows/odyssey-base-codex.md +305 -0
- package/workflows/odyssey-base.md +256 -0
- package/workflows/overlays.md +109 -0
- package/workflows/plan.md +520 -0
- package/workflows/quick.md +350 -0
- package/workflows/ralph-amend-goal.md +177 -0
- package/workflows/refactor.md +87 -0
- package/workflows/retrospective.md +471 -0
- package/workflows/review.md +448 -0
- package/workflows/roadmap-common.md +193 -0
- package/workflows/roadmap.md +106 -0
- package/workflows/shell-exec-protocol.md +30 -0
- package/workflows/skill-authoring.md +265 -0
- package/workflows/spec-generate.md +475 -0
- package/workflows/specs-add.md +123 -0
- package/workflows/specs-load.md +76 -0
- package/workflows/specs-remove.md +104 -0
- package/workflows/specs-setup.md +316 -0
- package/workflows/status.md +149 -0
- package/workflows/sync.md +116 -0
- package/workflows/tdd.md +255 -0
- package/workflows/test-gen.md +226 -0
- package/workflows/test.md +385 -0
- package/workflows/tools-spec.md +70 -0
- package/workflows/ui-codify-extract.md +372 -0
- package/workflows/ui-codify-knowhow.md +258 -0
- package/workflows/ui-codify-package.md +159 -0
- package/workflows/ui-codify.md +227 -0
- package/workflows/ui-design.md +393 -0
- package/workflows/ui-style.md +201 -0
- package/workflows/verify.md +557 -0
- package/workflows/wiki-connect.md +153 -0
- package/workflows/wiki-digest.md +180 -0
- package/workflows/wiki-manage.md +113 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
# Plan Workflow
|
|
2
|
+
|
|
3
|
+
5-phase pipeline: Context Collection -> Clarification -> Planning -> Plan Checking -> Confirmation.
|
|
4
|
+
|
|
5
|
+
Produces two-layer plan output: `plan.json` (overview with task_ids[] and waves[]) + `.task/TASK-{NNN}.json` (individual task definitions).
|
|
6
|
+
|
|
7
|
+
All output goes to `.workflow/scratch/{YYYYMMDD}-plan-[P{N}-|M{N}-]{slug}/`. Date-first ordering enables chronological sorting; scope prefix (`P{N}` for phase, `M{N}` for milestone, omit for standalone/adhoc) enables fallback identification.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
- None for standalone operation (state.json auto-bootstraps)
|
|
14
|
+
- For milestone scope: init + roadmap required
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Scope Resolution
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
Input: [milestone] argument OR --dir <path> OR --from <source>
|
|
22
|
+
|
|
23
|
+
Worktree guard: reject if milestone not in .workflow/worktree-scope.json owned scope
|
|
24
|
+
Auto-bootstrap: create minimal state.json if missing
|
|
25
|
+
|
|
26
|
+
Resolution priority (highest to lowest):
|
|
27
|
+
1. --from analyze:ANL-xxx → CONTEXT_DIR = artifact path, scope = "standalone"
|
|
28
|
+
Uses analyze conclusions.implementation_scope to seed task generation
|
|
29
|
+
2. --from blueprint:BLP-xxx → CONTEXT_DIR = blueprint path, scope = "standalone"
|
|
30
|
+
Uses blueprint requirements + architecture to seed task generation
|
|
31
|
+
3. --from <other> (@file, path/) → load context-package.json from path, scope = "standalone"
|
|
32
|
+
4. --dir <path> → CONTEXT_DIR = path, scope from state.json artifact or "standalone"
|
|
33
|
+
5. no arguments + roadmap → scope = "milestone", CONTEXT_DIR = latest analyze artifact for current_milestone
|
|
34
|
+
(ERROR E001 if no roadmap)
|
|
35
|
+
6. numeric arg → scope = "milestone", resolve MILESTONE_SLUG from roadmap.md,
|
|
36
|
+
CONTEXT_DIR = latest analyze artifact for milestone
|
|
37
|
+
(ERROR if no init + roadmap)
|
|
38
|
+
7. no arguments + no roadmap → search state.json for latest analyze artifact
|
|
39
|
+
Found → scope = "standalone", CONTEXT_DIR = artifact path
|
|
40
|
+
Not found → ERROR E001
|
|
41
|
+
|
|
42
|
+
Milestone resolution (when scope="milestone"):
|
|
43
|
+
FOR each ms in state.json.milestones[]:
|
|
44
|
+
IF ms matches milestone_number:
|
|
45
|
+
target_milestone = ms.id
|
|
46
|
+
BREAK
|
|
47
|
+
IF no match: target_milestone = current_milestone (fallback)
|
|
48
|
+
|
|
49
|
+
Use target_milestone (not current_milestone) for:
|
|
50
|
+
- artifact registration (P5 Step 4 milestone field)
|
|
51
|
+
- collision detection scope (P4.5)
|
|
52
|
+
- prior artifact lookups
|
|
53
|
+
|
|
54
|
+
OUTPUT_DIR = .workflow/scratch/{YYYYMMDD}-plan-[P{N}-|M{N}-]{slug}/
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Ad-hoc Milestone Auto-Creation (D-008)
|
|
58
|
+
|
|
59
|
+
When plan resolves to `scope == "standalone"` AND `state.json.current_milestone == null`:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
1. Generate adhoc milestone ID: "M-adhoc-{YYYYMMDD}-{HHmmss}"
|
|
63
|
+
2. Create milestone entry:
|
|
64
|
+
{
|
|
65
|
+
"id": "M-adhoc-{YYYYMMDD}-{HHmmss}",
|
|
66
|
+
"type": "adhoc",
|
|
67
|
+
"name": "Ad-hoc: {plan_slug or analyze_title}",
|
|
68
|
+
"status": "active",
|
|
69
|
+
"phases": [1],
|
|
70
|
+
"phase_slugs": { "1": "standalone" },
|
|
71
|
+
"roadmap_ref": null,
|
|
72
|
+
"created_at": "{ISO-8601}"
|
|
73
|
+
}
|
|
74
|
+
3. Push to state.json.milestones[]
|
|
75
|
+
4. Set state.json.current_milestone = milestone.id
|
|
76
|
+
5. Use this milestone ID for artifact registration (P5 Step 4)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Backward compatibility:** If `state.json.milestones[]` already has entries with `current_milestone != null`, skip creation (existing milestone takes precedence). Missing `type` field on legacy milestones defaults to `"standard"`.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Flag Processing
|
|
84
|
+
|
|
85
|
+
| Flag | Effect |
|
|
86
|
+
|------|--------|
|
|
87
|
+
| `--spec SPEC-xxx` | Load task-spec as requirements source |
|
|
88
|
+
| `--auto` | Skip P2 (clarification), proceed directly to P3 |
|
|
89
|
+
| `--gaps` | Load verification.json gaps, skip P1 exploration, plan only gap fixes |
|
|
90
|
+
| `--dir <path>` | Use arbitrary directory instead of milestone resolution (skip roadmap validation) |
|
|
91
|
+
| `--revise [instructions]` | Revise existing plan (skip P1-P3, load → modify → P4). Auto-discovers latest plan or use `--dir` |
|
|
92
|
+
| `--check <plan-dir>` | Standalone plan verification (P4 only, read-only) |
|
|
93
|
+
| `--tdd` | Generate TDD task chains (RED-GREEN-REFACTOR triplets). Load `@~/.maestro/workflows/tdd.md` for discipline and task structure |
|
|
94
|
+
| `--from <source>` | Load upstream context directly (analyze:ANL-xxx, blueprint:BLP-xxx, brainstorm:ID, @file, or path). Bypasses roadmap requirement for analyze/blueprint sources |
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Mode Routing
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
--check <plan-dir> → Check Mode (P4 only, read-only)
|
|
102
|
+
--revise → Revise Mode (load → modify → P4)
|
|
103
|
+
--tdd → TDD Mode: P1 → P2 → P3 (with TDD task chain generation) → P4 → P4.5 → P5
|
|
104
|
+
default → Create Mode: P1 → P2 → P3 → P4 → P4.5 → P5
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### TDD Mode
|
|
108
|
+
|
|
109
|
+
When `--tdd` is active:
|
|
110
|
+
1. Read `@~/.maestro/workflows/tdd.md` for TDD discipline, Iron Law, and task chain structure
|
|
111
|
+
2. In P3 (Planning), decompose each behavior into RED-GREEN-REFACTOR triplets per `tdd.md § Task Chain Generation`
|
|
112
|
+
3. Set `plan.json.tdd_mode = true` and include `tdd_groups[]`
|
|
113
|
+
4. Wave assignment follows TDD dependency rules: `{N}a → {N}b → {N}c`
|
|
114
|
+
5. Output is standard plan.json + .task/TASK-*.json — consumable by `maestro-execute` without modification
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## P1: Context Collection
|
|
119
|
+
|
|
120
|
+
**Purpose:** Gather all available context before planning.
|
|
121
|
+
|
|
122
|
+
### Steps
|
|
123
|
+
|
|
124
|
+
1. **Load user decisions**
|
|
125
|
+
- If `--from` specified: resolve to `context-package.json` → load
|
|
126
|
+
- `constraints[locked]` → immutable constraints (planner must respect)
|
|
127
|
+
- `constraints[open]` → implementer discretion
|
|
128
|
+
- `constraints[deferred]` → explicitly scoped out
|
|
129
|
+
- `requirements[]` → task scope input
|
|
130
|
+
- `insights[]` → role analysis context (data models, state machines, architecture decisions)
|
|
131
|
+
- `open_questions[]` → flag areas needing clarification in P2
|
|
132
|
+
- Else: read `${CONTEXT_DIR}/context.md` if exists, else warn (no upstream analyze)
|
|
133
|
+
- Merge: if both `--from` and `context.md` exist, context-package takes precedence; context.md supplements
|
|
134
|
+
|
|
135
|
+
2. **Load spec reference** (if `--spec` flag or index.json has blueprint_ref)
|
|
136
|
+
- Read from `.workflow/blueprint/${blueprint_ref}/`: blueprint-summary.md, requirements/_index.md, epics/_index.md
|
|
137
|
+
|
|
138
|
+
3. **Load project specs**
|
|
139
|
+
```
|
|
140
|
+
specs_content = maestro spec load --category arch
|
|
141
|
+
```
|
|
142
|
+
Pass to planner agent as project constraints context.
|
|
143
|
+
|
|
144
|
+
4. **Load codebase context**
|
|
145
|
+
- Read `.workflow/codebase/doc-index.json` if exists → extract relevant features, components, requirements
|
|
146
|
+
|
|
147
|
+
4a. **Wiki knowledge search** (optional, proceed without if unavailable)
|
|
148
|
+
- Extract 2-5 key terms from phase goal/title
|
|
149
|
+
- Run `maestro search "<phase_keywords>" --json 2>/dev/null`
|
|
150
|
+
- If results: take top 10 entries as prior knowledge context for planner agent
|
|
151
|
+
- If unavailable: log W003, continue
|
|
152
|
+
|
|
153
|
+
4b. **Load design reference** (if available)
|
|
154
|
+
- If `${PHASE_DIR}/design-ref/MASTER.md` exists: load MASTER.md, design-tokens.json, animation-tokens.json (optional), layout-templates/layout-*.json
|
|
155
|
+
- Every UI task must include in `read_first[]`: design-tokens.json, animation-tokens.json, relevant layout-*.json, MASTER.md
|
|
156
|
+
- Else if phase goal matches UI keywords (`landing|page|dashboard|frontend|UI|component|界面`): run `maestro-impeccable --chain build` (REQUIRED when design keywords matched)
|
|
157
|
+
|
|
158
|
+
5. **Load upstream analysis** (if available)
|
|
159
|
+
- If `${PHASE_DIR}/conclusions.json` exists with non-empty status: load as explorationContext (conclusions + explorations.json + perspectives.json)
|
|
160
|
+
- If `conclusions.implementation_scope` exists: use as primary planner input:
|
|
161
|
+
- `scope.objective` → task title/description
|
|
162
|
+
- `scope.acceptance_criteria` → convergence.criteria (grep-verifiable)
|
|
163
|
+
- `scope.target_files` → files[] + read_first[]
|
|
164
|
+
- `scope.priority` → task/wave ordering
|
|
165
|
+
- Skip parallel exploration
|
|
166
|
+
|
|
167
|
+
5b. **Merge context-package insights** (if `--from` was loaded)
|
|
168
|
+
- If context-package `insights[]` contain `area: "data-model"` or `area: "state-machine"`: inject as planner constraints
|
|
169
|
+
- Map `insights[].summary` to implementation guidance for relevant tasks
|
|
170
|
+
- These replace the need for a separate analyze step when brainstorm already provided sufficient role analysis
|
|
171
|
+
|
|
172
|
+
6. **Parallel exploration** (skip if `--gaps` or upstream analysis loaded)
|
|
173
|
+
- Exploration angles (1-4 based on complexity): architecture, implementation, integration, risk
|
|
174
|
+
- MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep: Spawn 1-4 `cli-explore-agent` in parallel, each with phase goal + success_criteria + one angle
|
|
175
|
+
- Output: `.process/exploration-{angle}.json`, `.process/explorations-manifest.json`, `.process/context-package.json`
|
|
176
|
+
|
|
177
|
+
6b. **CLI supplementary context** (runs in parallel with step 6, skip if `--gaps` or no CLI tools enabled)
|
|
178
|
+
```
|
|
179
|
+
IF no CLI tools enabled: skip
|
|
180
|
+
|
|
181
|
+
MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep:
|
|
182
|
+
Bash({
|
|
183
|
+
command: 'maestro delegate "PURPOSE: Gather implementation context for planning phase
|
|
184
|
+
TASK: Identify existing patterns for similar features | Map dependency graph of target modules | Find potential conflict points with other recent changes
|
|
185
|
+
MODE: analysis
|
|
186
|
+
CONTEXT: @**/*
|
|
187
|
+
EXPECTED: JSON { patterns: [{ name, files, description }], dependencies: [{ module, depends_on[] }], conflict_risks: [{ file, reason }] }
|
|
188
|
+
CONSTRAINTS: Focus on ${phase_goal} scope | Max 10 entries per category
|
|
189
|
+
" --role explore --mode analysis',
|
|
190
|
+
run_in_background: true
|
|
191
|
+
})
|
|
192
|
+
```
|
|
193
|
+
**On callback:** Parse result, merge into explorationContext as `cli_context` field. Planner uses patterns for task `read_first[]`, dependencies for wave ordering, conflict_risks for collision detection.
|
|
194
|
+
|
|
195
|
+
7. **Gap-mode context** (if `--gaps`)
|
|
196
|
+
|
|
197
|
+
Gap sources (in priority order, first non-empty wins, then additionals merged):
|
|
198
|
+
- **Primary**: `.workflow/issues/issues.jsonl` — filter by phase_ref + status in ["registered","diagnosed"], mark as "planning"
|
|
199
|
+
- **Fallback**: `${PHASE_DIR}/verification.json` gaps (when no issues found)
|
|
200
|
+
- **Additional**: `${PHASE_DIR}/uat.md` "Gaps" section — deduplicate against existing gaps
|
|
201
|
+
- **Enrichment**: `${PHASE_DIR}/.debug/*/understanding.md` — enrich matched gaps with root_cause, fix_direction, affected_files
|
|
202
|
+
|
|
203
|
+
Each gap: `{ issue_id, description, fix_direction, severity, source, context }`
|
|
204
|
+
|
|
205
|
+
ERROR if all sources empty. Set `explorationContext = all_gaps` (skip exploration agents).
|
|
206
|
+
|
|
207
|
+
### Output
|
|
208
|
+
- `.process/exploration-{angle}.json` (1-4 files, skipped if upstream analysis loaded)
|
|
209
|
+
- `.process/explorations-manifest.json` (skipped if upstream analysis loaded)
|
|
210
|
+
- `.process/context-package.json` (skipped if upstream analysis loaded)
|
|
211
|
+
- In-memory: explorationContext (from upstream analysis or parallel exploration)
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## P2: Clarification (Interactive)
|
|
216
|
+
|
|
217
|
+
**Purpose:** Resolve ambiguities before planning. Skipped with `--auto` flag.
|
|
218
|
+
|
|
219
|
+
### Steps
|
|
220
|
+
|
|
221
|
+
1. **Aggregate clarification needs**
|
|
222
|
+
- Extract `clarification_needs[]` from each exploration, deduplicate, sort by priority (blocking > important > nice-to-have)
|
|
223
|
+
|
|
224
|
+
2. **Interactive clarification rounds** (max 3 rounds, max 4 questions each)
|
|
225
|
+
- Present via AskUserQuestion, record answers, check for follow-ups
|
|
226
|
+
|
|
227
|
+
3. **Build clarification context** → `{ questions_asked, answers, decisions_made }`
|
|
228
|
+
|
|
229
|
+
### Output
|
|
230
|
+
- In-memory: clarificationContext
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## P3: Planning
|
|
235
|
+
|
|
236
|
+
**Purpose:** Generate the execution plan.
|
|
237
|
+
|
|
238
|
+
**Rules:**
|
|
239
|
+
- Main flow **MUST** spawn a planner agent (Agent tool) for P3 — inline planning is FORBIDDEN
|
|
240
|
+
- Agent produces both `plan.json` and `.task/TASK-{NNN}.json` — main flow MUST NOT create/modify these files
|
|
241
|
+
- Upstream analyze results (conclusions.json / implementation_scope) MUST be passed into planner spawn as `explorationContext` in the same step
|
|
242
|
+
|
|
243
|
+
### Standard Mode (default)
|
|
244
|
+
|
|
245
|
+
MUST spawn `workflow-planner` agent with: context.md, spec-ref, doc-index.json, explorationContext (incl. implementationScope from P1 Step 5), clarificationContext, phase goal + success_criteria, templates (plan.json, task.json).
|
|
246
|
+
|
|
247
|
+
**Task count guard**: Before spawning, assess scope complexity:
|
|
248
|
+
- Single feature / simple change → expect **1-4 tasks** max
|
|
249
|
+
- Medium feature (multiple files, cross-module) → expect **4-8 tasks** max
|
|
250
|
+
- Large milestone (>3 modules, 2+1 agent mode) → expect **8-16 tasks** max
|
|
251
|
+
- If planner outputs more tasks than these thresholds, re-prompt with explicit instruction to merge.
|
|
252
|
+
|
|
253
|
+
Agent responsibilities:
|
|
254
|
+
1. Decompose goal into tasks (when implementationScope exists: 1 scope item → 1 task)
|
|
255
|
+
2. Assign task IDs (TASK-001, TASK-002, ...), determine dependencies
|
|
256
|
+
3. Group into execution waves (implementationScope: order by scope.priority)
|
|
257
|
+
4. Estimate complexity/time
|
|
258
|
+
5. Set grep-verifiable `convergence.criteria` (from scope.acceptance_criteria when available)
|
|
259
|
+
6. Identify files per task (from scope.target_files when available), populate `read_first[]`
|
|
260
|
+
|
|
261
|
+
Output: `plan.json` (summary, approach, task_ids[], task_count, complexity, waves[]) + `.task/TASK-{NNN}.json` per task.
|
|
262
|
+
|
|
263
|
+
**Anti-splitting rules** (pass to planner; re-prompt if violated):
|
|
264
|
+
- One feature = one task (even if 3-5 files); never split a feature into per-file tasks
|
|
265
|
+
- Group simple unrelated changes into a batch task to minimize agent spawns
|
|
266
|
+
- depends_on only for genuine output dependencies; most tasks should be parallel
|
|
267
|
+
- Each task must be substantial (15-60 min); sub-5-min changes must be merged
|
|
268
|
+
- **Vertical slice for UI**: a user-facing feature is ONE end-to-end task/wave (backend endpoint + frontend wiring + integration); never split into backend-only/frontend-only. Each UI delivery wave needs ≥1 task carrying a `[UI-observable]` convergence criterion (verifiable user flow; runtime-checked by ralph frontend-verify gate)
|
|
269
|
+
|
|
270
|
+
### Deep Work Rules (MANDATORY for all modes)
|
|
271
|
+
|
|
272
|
+
Every TASK-*.json MUST include these fields — they are NOT optional:
|
|
273
|
+
|
|
274
|
+
1. **`read_first`** — Files the executor MUST read before touching anything. Always include:
|
|
275
|
+
- The file being modified (so executor sees current state, not assumptions)
|
|
276
|
+
- Any "source of truth" file referenced in context.md (reference implementations, existing patterns, config files, schemas)
|
|
277
|
+
- Any file whose patterns, signatures, types, or conventions must be replicated or respected
|
|
278
|
+
|
|
279
|
+
2. **`convergence.criteria`** — Verifiable conditions that prove the task was done correctly. Rules:
|
|
280
|
+
- Every criterion must be checkable with grep, file read, test command, or CLI output
|
|
281
|
+
- NEVER use subjective language ("looks correct", "properly configured", "consistent with")
|
|
282
|
+
- ALWAYS include exact strings, patterns, values, or command outputs that must be present
|
|
283
|
+
- Examples:
|
|
284
|
+
- Code: `auth.ts contains export function verifyToken(` / `test exits 0`
|
|
285
|
+
- Config: `.env.example contains DATABASE_URL=` / `Dockerfile contains HEALTHCHECK`
|
|
286
|
+
- Docs: `README.md contains '## Installation'` / `API.md lists all endpoints`
|
|
287
|
+
|
|
288
|
+
3. **`action`** — Must include CONCRETE values, not references. Rules:
|
|
289
|
+
- NEVER say "align X with Y", "match X to Y", "update to be consistent" without specifying the exact target state
|
|
290
|
+
- ALWAYS include the actual values: config keys, function signatures, class names, import paths, etc.
|
|
291
|
+
- If context.md has a comparison table or expected values, copy them into the action verbatim
|
|
292
|
+
- The executor should be able to complete the task from the action + implementation text alone
|
|
293
|
+
|
|
294
|
+
4. **`implementation`** steps — Each step must contain concrete values:
|
|
295
|
+
- Bad: "Update the config to match production"
|
|
296
|
+
- Good: "Add DATABASE_URL=postgresql://..., set POOL_SIZE=20, add REDIS_URL=redis://..."
|
|
297
|
+
|
|
298
|
+
**Why this matters:** Executor agents work from the task JSON. Vague instructions produce shallow one-line changes. Concrete instructions produce complete work.
|
|
299
|
+
|
|
300
|
+
### Plan Agent Model
|
|
301
|
+
|
|
302
|
+
Plan automatically selects agent mode based on milestone scope:
|
|
303
|
+
|
|
304
|
+
**Single agent mode** (default):
|
|
305
|
+
- Milestone involves ≤3 modules
|
|
306
|
+
- 1 workflow-planner agent, max 8 TASK JSON output
|
|
307
|
+
- Directly produces plan.json
|
|
308
|
+
|
|
309
|
+
**2+1 agent mode** (auto-triggered when milestone involves >3 modules):
|
|
310
|
+
- 2 parallel workflow-planner agents, each scoped to 2-3 modules
|
|
311
|
+
- Each agent produces max 8 TASK JSON (total max 16)
|
|
312
|
+
- +1 synthesis agent:
|
|
313
|
+
- Merges TASK JSON from both agents
|
|
314
|
+
- DAG analysis: dependency correctness, cycle detection, cross-module conflicts
|
|
315
|
+
- Terminology consistency check
|
|
316
|
+
- Wave ordering optimization
|
|
317
|
+
- Produces unified plan.json
|
|
318
|
+
|
|
319
|
+
Module count is derived from milestone phase definitions and analyze upstream context.
|
|
320
|
+
|
|
321
|
+
### Gap Mode (`--gaps`)
|
|
322
|
+
|
|
323
|
+
MUST spawn `workflow-planner` agent with: explorationContext (gap list from P1 Step 7), spec-ref, doc-index.json, phase goal + success_criteria, templates, mode = `gap-fix`.
|
|
324
|
+
|
|
325
|
+
Planner: for each gap emit one task — `type: "fix"`, `description`, `action` (concrete fix_direction), `read_first` (affected files), `convergence.criteria` (grep-verifiable), `issue_id` (if source == "issue"); assign IDs and waves; build plan.json.
|
|
326
|
+
|
|
327
|
+
Bidirectional linking (main flow, post-planner): update matching issues in `.workflow/issues/issues.jsonl` → `status: "planned"`.
|
|
328
|
+
|
|
329
|
+
### Output
|
|
330
|
+
- `plan.json` in PHASE_DIR
|
|
331
|
+
- `.task/TASK-{NNN}.json` files in PHASE_DIR/.task/
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## P4: Plan Checking
|
|
336
|
+
|
|
337
|
+
**Purpose:** Verify plan quality before execution.
|
|
338
|
+
|
|
339
|
+
### Steps
|
|
340
|
+
|
|
341
|
+
1. MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep: **Spawn workflow-plan-checker agent**
|
|
342
|
+
- Input: plan.json + all .task/TASK-*.json + index.json (success_criteria)
|
|
343
|
+
- Check dimensions: requirements coverage, feasibility, dependency correctness (no circular deps), convergence criteria quality (grep-verifiable, no subjective language), read_first completeness, action concreteness (no vague references), wave structure (no conflicting files), completeness (no orphan tasks), UI-observable coverage (when plan touches UI: each delivery wave has ≥1 `[UI-observable]` criterion)
|
|
344
|
+
|
|
345
|
+
2. **Revision loop** (max 3 rounds)
|
|
346
|
+
- Critical issues → re-spawn planner with issues, revise, re-check
|
|
347
|
+
- Warnings only → log and proceed
|
|
348
|
+
|
|
349
|
+
3. **Plan Confidence Scoring**
|
|
350
|
+
|
|
351
|
+
Dimensions (5): requirements_coverage, task_quality, dependency_correctness, estimation_accuracy, collision_safety. Factors (weights): completeness(.30), specificity(.25), structural_validity(.20), user_validation(.15), consistency(.10). Re-score after each revision round.
|
|
352
|
+
|
|
353
|
+
Quality mechanisms: Pressure Pass (mandatory before P4.5) — verify highest-complexity task's read_first/convergence.criteria/action. Devil's Advocate — requirements_coverage > 0.7 → "隐含需求?". Scope Minimizer — task_count exceeds guard → "最小可行任务集?". Stall Detection — delta < 5% → suggest broader revision.
|
|
354
|
+
|
|
355
|
+
4. **Plan Readiness Gate** (blocks P4.5)
|
|
356
|
+
|
|
357
|
+
Block if: requirements_coverage < 40% | task missing read_first/convergence.criteria | no pressure pass | circular deps. If blocked → AskUserQuestion: 修订计划 or 忽略风险并继续 (record residual_risks). Add confidence section to plan.json with `evidence_source: plan-checker findings (round N)`.
|
|
358
|
+
|
|
359
|
+
5. **Update index.json**
|
|
360
|
+
- Set `index.json.plan` = `{ task_ids, task_count, complexity, waves, executor_assignments: {}, confidence: overall_score }`
|
|
361
|
+
- Set `status: "planning"`, `updated_at: now()`
|
|
362
|
+
|
|
363
|
+
### Output
|
|
364
|
+
- Updated plan.json (if revised) with confidence section
|
|
365
|
+
- Updated .task/ files (if revised)
|
|
366
|
+
- Updated index.json with plan fields
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## P4.5: Collision Detection
|
|
371
|
+
|
|
372
|
+
**Purpose:** Warn if this plan's files overlap with existing plans in the same milestone.
|
|
373
|
+
|
|
374
|
+
**Skip if:** scope == "standalone" (no milestone context to compare against)
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
1. Collect task.files[] from all completed plans in current milestone
|
|
378
|
+
2. Collect task.files[] from new plan
|
|
379
|
+
3. Intersect → collisions (non-blocking warning)
|
|
380
|
+
碰撞 → WARN "{file} ← 已在 {plan_ids} 中规划"
|
|
381
|
+
无重叠 → "碰撞检测通过"
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**Note:** Only checks `task.files[]` (write targets). `task.read_first[]` (read-only references) are excluded.
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## P5: Confirmation
|
|
389
|
+
|
|
390
|
+
**Purpose:** Present plan to user and determine next action.
|
|
391
|
+
|
|
392
|
+
### Steps
|
|
393
|
+
|
|
394
|
+
1. **Display plan summary** — summary, approach, task count, wave structure, complexity, key dependencies, **plan confidence** (overall %, weakest dimension, pressure pass result)
|
|
395
|
+
|
|
396
|
+
2. **Present options via AskUserQuestion** (skip if `config.gates.confirm_plan == false`, auto-proceed)
|
|
397
|
+
- Execute now → build executionContext, hand off to /workflow:execute
|
|
398
|
+
- Verify plan quality → re-run P4 with stricter checks
|
|
399
|
+
- Just view → display full plan details, exit
|
|
400
|
+
- Modify → open specific task for editing, return to P4
|
|
401
|
+
|
|
402
|
+
3. **executionContext handoff** (if "Execute now")
|
|
403
|
+
```json
|
|
404
|
+
{
|
|
405
|
+
"planObject": { "plan": "plan.json contents", "tasks": { "TASK-001": "..." } },
|
|
406
|
+
"explorations": ["exploration-*.json contents"],
|
|
407
|
+
"clarifications": "clarificationContext",
|
|
408
|
+
"executionMethod": "config.json.execution.method || 'agent'",
|
|
409
|
+
"defaultExecutor": "config.json.execution.default_executor || 'gemini'",
|
|
410
|
+
"executorAssignments": "index.json.plan.executor_assignments || {}",
|
|
411
|
+
"phaseIndex": "index.json contents",
|
|
412
|
+
"specRef": "spec-ref contents (if loaded)"
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
Hand off to /workflow:execute with executionContext in memory.
|
|
416
|
+
|
|
417
|
+
4. **Register artifact in state.json**
|
|
418
|
+
- Find upstream analyze artifact by CONTEXT_DIR path
|
|
419
|
+
- Determine milestone: use target_milestone from scope resolution; if adhoc milestone was created in this session, use its ID
|
|
420
|
+
- Create artifact: `{ id: "PLN-{NNN}", type: "plan", milestone, phase, scope, path, status: "completed", depends_on, harvested: false, created_at, completed_at }`
|
|
421
|
+
- Append to `state.json.artifacts`, atomic write
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## Error Handling
|
|
426
|
+
|
|
427
|
+
| Error | Action |
|
|
428
|
+
|-------|--------|
|
|
429
|
+
| E001: No args and no roadmap | Provide milestone number or topic, or create roadmap |
|
|
430
|
+
| E004: No plan found to revise | Use --dir to specify plan, or create plan first |
|
|
431
|
+
| E005: Plan directory not found (--check) | Check path, use --dir |
|
|
432
|
+
| Milestone not found | Abort with message: "Milestone {milestone} not found. Run /maestro-roadmap first." |
|
|
433
|
+
| No context.md | Warn, proceed with exploration only |
|
|
434
|
+
| Exploration agent fails | Log error, continue with available explorations; flag plan as [LOW CONFIDENCE] (partial explorations) |
|
|
435
|
+
| Planner produces invalid JSON | Retry once, then abort with error details |
|
|
436
|
+
| Plan-checker exceeds 3 rounds | Accept plan with warnings, note in index.json; flag plan as [LOW CONFIDENCE] (checker unresolved) |
|
|
437
|
+
| User cancels clarification | Proceed with available context |
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## State Updates
|
|
442
|
+
|
|
443
|
+
| When | Field | Value |
|
|
444
|
+
|------|-------|-------|
|
|
445
|
+
| P1 start | index.json.status | "planning" |
|
|
446
|
+
| P3 complete | index.json.plan.* | Plan metadata |
|
|
447
|
+
| P4 pass | index.json.updated_at | Current timestamp |
|
|
448
|
+
| P5 "Execute now" | (handoff, no write) | executionContext in memory |
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## Revise Mode (`--revise`)
|
|
453
|
+
|
|
454
|
+
Incrementally modify an existing plan without rebuilding from scratch.
|
|
455
|
+
|
|
456
|
+
### Plan Discovery
|
|
457
|
+
|
|
458
|
+
- `--dir` specified → use directly
|
|
459
|
+
- Else → latest completed plan artifact for current milestone from state.json
|
|
460
|
+
- Not found → ERROR E004
|
|
461
|
+
|
|
462
|
+
### Execution Flow
|
|
463
|
+
|
|
464
|
+
1. **Load existing plan**
|
|
465
|
+
- Read `plan.json` + all `.task/TASK-*.json` from PLAN_DIR
|
|
466
|
+
- Show current plan summary: task count, waves, status per task
|
|
467
|
+
|
|
468
|
+
2. **Obtain revision instructions**
|
|
469
|
+
- If `--revise "instructions"` provided → parse as change directive
|
|
470
|
+
- If `--revise` without instructions → AskUserQuestion for what to change:
|
|
471
|
+
- Add/remove tasks
|
|
472
|
+
- Modify task scope, action, implementation
|
|
473
|
+
- Reorder waves or adjust dependencies
|
|
474
|
+
- Update convergence criteria
|
|
475
|
+
- Parse instructions into concrete changes
|
|
476
|
+
|
|
477
|
+
3. **Spawn `workflow-planner` agent for revision**
|
|
478
|
+
- Input: existing plan.json + all `.task/TASK-*.json` + parsed revision instructions + explorationContext (include implementation_scope if conclusions.json exists) + templates
|
|
479
|
+
- Planner:
|
|
480
|
+
- Modify affected TASK files in-place
|
|
481
|
+
- If tasks added/removed: re-sequence task IDs, regenerate wave assignments
|
|
482
|
+
- Update plan.json summary (task count, wave structure)
|
|
483
|
+
- Preserve unmodified tasks
|
|
484
|
+
|
|
485
|
+
4. **Re-run plan-checker (P4)**
|
|
486
|
+
- Validate modified plan with same checker as create mode
|
|
487
|
+
- Re-run collision detection against same-milestone plans
|
|
488
|
+
- Present check results for confirmation
|
|
489
|
+
|
|
490
|
+
5. **Update artifact**
|
|
491
|
+
- Overwrite plan files in existing scratch directory
|
|
492
|
+
- Update artifact timestamp in state.json (no new artifact created)
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
## Check Mode (`--check`)
|
|
497
|
+
|
|
498
|
+
Read-only plan verification without modification.
|
|
499
|
+
|
|
500
|
+
### Execution Flow
|
|
501
|
+
|
|
502
|
+
1. **Load plan** — read plan.json + .task/TASK-*.json from `--check` path (ERROR E005 if not found), plus roadmap.md
|
|
503
|
+
|
|
504
|
+
2. **Run checks** — plan-checker (task quality, convergence criteria), roadmap consistency, collision detection, dependency integrity
|
|
505
|
+
|
|
506
|
+
3. **Produce check report**
|
|
507
|
+
```
|
|
508
|
+
=== PLAN CHECK ===
|
|
509
|
+
Plan: {plan_dir}/plan.json
|
|
510
|
+
Tasks: {total} ({completed} done, {pending} pending)
|
|
511
|
+
Checker: {PASS|WARN|FAIL} ({issues} issues)
|
|
512
|
+
Roadmap: {aligned|drift detected}
|
|
513
|
+
Collision: {clear|{N} overlaps}
|
|
514
|
+
|
|
515
|
+
Suggested actions:
|
|
516
|
+
/maestro-plan --revise "fix instructions"
|
|
517
|
+
/maestro-execute --dir {plan_dir}
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
**No file modifications.** Pure verification + report.
|