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,768 @@
|
|
|
1
|
+
# Workflow: Analyze
|
|
2
|
+
|
|
3
|
+
Multi-dimensional iterative analysis with CLI exploration, multi-perspective synthesis, discussion timeline, intent tracking, and decision extraction.
|
|
4
|
+
|
|
5
|
+
## Pipeline Position
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
maestro-brainstorm (optional upstream)
|
|
9
|
+
↓ ideas, scored options
|
|
10
|
+
maestro-analyze ← THIS
|
|
11
|
+
↓ analysis.md, discussion.md, conclusions.json, context.md, context-package.json
|
|
12
|
+
maestro-plan → maestro-execute (includes verification)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Architecture
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Full mode (-q omitted):
|
|
19
|
+
Phase 1: Setup & Scoping → session init, dimension selection, discussion.md
|
|
20
|
+
|
|
|
21
|
+
Phase 2: CLI Exploration → exploration-codebase.json, explorations.json/perspectives.json
|
|
22
|
+
| (cli-explore-agent 3-layer + multi-CLI parallel)
|
|
23
|
+
|
|
|
24
|
+
Phase 3: Interactive Discussion → discussion.md rounds (max 5)
|
|
25
|
+
| (Decision Recording Protocol, Intent Coverage)
|
|
26
|
+
|
|
|
27
|
+
Phase 4: Six-Dimension Scoring → 6 dimensions × 1-5 score + risk matrix
|
|
28
|
+
|
|
|
29
|
+
Phase 5: Synthesis & Conclusion → conclusions.json, analysis.md, final discussion.md
|
|
30
|
+
|
|
|
31
|
+
Phase 6: Decision Extraction → context.md (Locked/Free/Deferred)
|
|
32
|
+
└── Next Step: plan / issue / done
|
|
33
|
+
|
|
34
|
+
Quick mode (-q):
|
|
35
|
+
Phase 1: Setup (minimal) → load context, skip scoping
|
|
36
|
+
|
|
|
37
|
+
Phase 6: Decision Extraction → context.md (Locked/Free/Deferred)
|
|
38
|
+
└── Next Step: plan / done
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Arguments
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
$ARGUMENTS: "[milestone|topic] [-y] [-c] [-q] [--from <source>]"
|
|
45
|
+
|
|
46
|
+
(no args) -- Milestone-wide analysis (requires init + roadmap)
|
|
47
|
+
<milestone> -- Milestone number (milestone-scoped, requires init + roadmap)
|
|
48
|
+
<topic> -- Topic text (adhoc if milestone exists, standalone if not)
|
|
49
|
+
-y / --yes -- Auto mode, skip interactive scoping, auto-deepen
|
|
50
|
+
-c / --continue -- Resume from existing session
|
|
51
|
+
-q / --quick -- Quick mode, skip exploration + scoring, go straight to decision extraction
|
|
52
|
+
--from <source> -- Load upstream context package (grill:ID, brainstorm:ID, analyze:ID, @file, or path). Replaces --from-brainstorm
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Scope Routing
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
Worktree guard: If .workflow/worktree-scope.json exists, reject milestone args not in owned scope.
|
|
59
|
+
|
|
60
|
+
Auto-bootstrap: Create minimal .workflow/state.json if missing.
|
|
61
|
+
|
|
62
|
+
Scope determination → OUTPUT_DIR:
|
|
63
|
+
(no args) + milestone + roadmap → scope="milestone", mode="micro", OUTPUT_DIR=.workflow/scratch/{YYYYMMDD}-analyze-M{N}-{milestone_slug}/
|
|
64
|
+
(no args) without milestone/roadmap → ERROR E001
|
|
65
|
+
(number) + milestone + roadmap → scope="milestone", mode="micro", OUTPUT_DIR=.workflow/scratch/{YYYYMMDD}-analyze-M{N}-{milestone_slug}/
|
|
66
|
+
(number) without milestone/roadmap → ERROR
|
|
67
|
+
(text) + milestone → scope="adhoc", mode="macro", OUTPUT_DIR=.workflow/scratch/{YYYYMMDD}-analyze-{topic_slug}/
|
|
68
|
+
(text) without milestone → scope="standalone", mode="macro", OUTPUT_DIR=.workflow/scratch/{YYYYMMDD}-analyze-{topic_slug}/
|
|
69
|
+
|
|
70
|
+
Macro mode additions (scope="adhoc" or "standalone"):
|
|
71
|
+
- In Step 6 Synthesis, evaluate scope_verdict: "small" | "medium" | "large"
|
|
72
|
+
- large: 3+ independent subsystems or hard serial dependency barriers
|
|
73
|
+
- medium: 1-2 subsystems, parallelizable
|
|
74
|
+
- small: single-file or few-file change
|
|
75
|
+
- Write scope_verdict to context.md conclusions section
|
|
76
|
+
- Include scope_verdict in context-package.json for downstream consumption
|
|
77
|
+
|
|
78
|
+
Milestone resolution (when scope="milestone"):
|
|
79
|
+
IF numeric arg specified: target_milestone = that milestone number
|
|
80
|
+
ELSE: target_milestone = current_milestone (fallback)
|
|
81
|
+
IF target_milestone not found in state.json.milestones[]: ERROR
|
|
82
|
+
|
|
83
|
+
Use target_milestone for:
|
|
84
|
+
- artifact registration (milestone field in Step 8.9)
|
|
85
|
+
- loading prior artifacts (Step 1 context loading)
|
|
86
|
+
|
|
87
|
+
Create OUTPUT_DIR.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Output Structure
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
{OUTPUT_DIR}/
|
|
94
|
+
├── discussion.md # Full timeline: TOC, rounds, decisions, intent coverage
|
|
95
|
+
├── analysis.md # 6-dimension scoring summary + risk matrix + Go/No-Go (skip in -q)
|
|
96
|
+
├── exploration-codebase.json # Codebase exploration (skip in -q)
|
|
97
|
+
├── explorations.json # Single perspective aggregated findings (skip in -q)
|
|
98
|
+
├── perspectives.json # Multi-perspective findings + synthesis (skip in -q)
|
|
99
|
+
├── conclusions.json # Final synthesis, recommendations, decision trail (skip in -q)
|
|
100
|
+
├── context.md # Decision extraction: Locked/Free/Deferred decisions for plan
|
|
101
|
+
└── context-package.json # Standardized context package for cross-command consumption
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Phase Gates (Standard Mode, when `-q` and `--gaps` are BOTH absent)
|
|
107
|
+
|
|
108
|
+
MANDATORY and BLOCKING. Do NOT advance past a gate until ALL conditions are met.
|
|
109
|
+
|
|
110
|
+
**GATE 1: Step 4 → Step 5** (Exploration → Discussion)
|
|
111
|
+
- REQUIRED: cli-explore-agent completed (Step 4.1), `exploration-codebase.json` written with ≥1 code anchor
|
|
112
|
+
- REQUIRED: ≥1 maestro delegate CLI call completed (Step 4.2), output in `explorations.json` or `perspectives.json`
|
|
113
|
+
- REQUIRED: Baseline confidence scoring recorded in discussion.md (Step 4.6)
|
|
114
|
+
|
|
115
|
+
**GATE 2: Step 5 → Step 6** (Discussion → Scoring)
|
|
116
|
+
- REQUIRED: discussion.md contains ≥1 interactive round with user feedback (Step 5.3)
|
|
117
|
+
- REQUIRED: Confidence re-scored ≥1 time with delta shown (Step 5.8)
|
|
118
|
+
- REQUIRED: Pressure pass completed ≥1 time (Step 5.9)
|
|
119
|
+
|
|
120
|
+
**GATE 3: Step 6 → Step 7** (Scoring → Synthesis)
|
|
121
|
+
- REQUIRED: analysis.md written with all 6 dimensions scored
|
|
122
|
+
- REQUIRED: Each dimension score cites evidence from exploration-codebase.json or explorations.json — NOT from manual file reading
|
|
123
|
+
|
|
124
|
+
**GATE 4: Step 7 → Step 8** (Synthesis → Decision Extraction)
|
|
125
|
+
- REQUIRED: conclusions.json written with recommendations and decision trail
|
|
126
|
+
- REQUIRED: Intent Coverage Matrix shows no unresolved ❌ items (or user-confirmed deferrals)
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Process
|
|
131
|
+
|
|
132
|
+
### Step 1: Parse Input & Initialize Session
|
|
133
|
+
|
|
134
|
+
Parse $ARGUMENTS to determine mode and flags:
|
|
135
|
+
- `-c` present: locate existing session folder (discussion.md exists), resume from last round
|
|
136
|
+
- `-y` present: set AUTO_MODE=true
|
|
137
|
+
- `-q` present: set QUICK_MODE=true (skip Steps 2-7, jump to Step 8: Decision Extraction)
|
|
138
|
+
- Number (e.g., "3") = milestone scope: resolve milestone slug from roadmap, output to scratch/{YYYYMMDD}-analyze-M{N}-{milestone-slug}/
|
|
139
|
+
- Text (e.g., "microservices vs monolith") = adhoc/standalone scope: output to scratch/{YYYYMMDD}-analyze-{slug}/
|
|
140
|
+
- Missing/empty = milestone scope (if roadmap exists) or error E001
|
|
141
|
+
|
|
142
|
+
**Session initialization:**
|
|
143
|
+
- Session ID: `ANL-{slug}-{YYYY-MM-DD}`
|
|
144
|
+
- Output: `OUTPUT_DIR` (always under `.workflow/scratch/`)
|
|
145
|
+
|
|
146
|
+
**Load prior context** (milestone/phase scope):
|
|
147
|
+
1. Read `.workflow/project.md` — project vision, constraints, Validated requirements (already shipped), Active requirements (current scope)
|
|
148
|
+
2. Read `.workflow/roadmap.md` — phase structure and dependencies
|
|
149
|
+
3. Read `.workflow/state.json` → `current_milestone`, `artifacts[]`, `accumulated_context` (key_decisions, deferred items, blockers)
|
|
150
|
+
4. Find prior analyze artifacts from `state.json.artifacts[]` where type=analyze and same milestone → load their `context.md` to skip already-decided areas
|
|
151
|
+
5. **Load upstream context** (priority order):
|
|
152
|
+
a. If `--from` specified: resolve source → load `context-package.json` (see §9 of workflow-structure-guide.md)
|
|
153
|
+
- `--from grill:ID` → `state.json.artifacts[type=grill, id=ID].context_package` → load
|
|
154
|
+
- `--from brainstorm:ID` → `state.json.artifacts[type=brainstorm, id=ID].context_package` → load
|
|
155
|
+
- `--from @file` → create import session, delegate extraction → load context-package.json
|
|
156
|
+
- `--from path/` → load `path/context-package.json`
|
|
157
|
+
b. Else: auto-discover from `state.json.artifacts[]` where type=brainstorm and same milestone → if artifact has `context_package` field, load it; else fallback to reading `guidance-specification.md` directly
|
|
158
|
+
|
|
159
|
+
From loaded context-package:
|
|
160
|
+
- `constraints[status=locked]` → skip these areas (already decided)
|
|
161
|
+
- `constraints[status=open]` → prioritize for analysis
|
|
162
|
+
- `open_questions[]` → seed discussion topics
|
|
163
|
+
6. Load project specs: `specs_content = maestro spec load --category arch`
|
|
164
|
+
7. Load domain glossary: read `.workflow/domain/glossary.yaml`(如存在)— 分析过程中使用 canonical term names 保持术语一致性;新发现的术语候选记入 `context-package.json#domain.terminology[]`
|
|
165
|
+
|
|
166
|
+
**Load prior context** (adhoc/standalone scope):
|
|
167
|
+
1. Read `.workflow/project.md` (if exists) — project vision, Validated requirements, Active requirements, Key Decisions
|
|
168
|
+
2. Read `.workflow/state.json` (if exists) → `accumulated_context` (key_decisions, deferred, blockers)
|
|
169
|
+
3. Load project specs: `specs_content = maestro spec load --category arch`
|
|
170
|
+
4. Load domain glossary: read `.workflow/domain/glossary.yaml`(如存在)
|
|
171
|
+
|
|
172
|
+
**Quick mode routing**: If QUICK_MODE, skip to Step 8 (Decision Extraction) after loading context.
|
|
173
|
+
|
|
174
|
+
### Step 1.5: Archive Previous Artifacts
|
|
175
|
+
|
|
176
|
+
Skip if `-c` (resuming — working on existing session).
|
|
177
|
+
|
|
178
|
+
Before writing any new artifacts, archive existing ones to preserve history:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
ARCHIVE_TARGETS = ["discussion.md", "analysis.md", "explorations.json", "perspectives.json", "conclusions.json", "exploration-codebase.json"]
|
|
182
|
+
|
|
183
|
+
If any ARCHIVE_TARGETS exist in OUTPUT_DIR:
|
|
184
|
+
Move each existing target to OUTPUT_DIR/.history/{name}-{YYYY-MM-DDTHH-mm-ss}.{ext}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Step 2: Scoping & Dimension Selection
|
|
188
|
+
|
|
189
|
+
Skip if `-c` (resuming) or `-y` (auto mode uses defaults).
|
|
190
|
+
|
|
191
|
+
**Interactive scoping** via single AskUserQuestion (up to 3 questions):
|
|
192
|
+
|
|
193
|
+
1. **Focus** (multiSelect, header: "分析方向"): Present 3-4 directions from Dimension-Direction Mapping:
|
|
194
|
+
|
|
195
|
+
| Dimension | Directions |
|
|
196
|
+
|-----------|-----------|
|
|
197
|
+
| architecture | System Design, Component Interactions, Technology Choices, Design Patterns |
|
|
198
|
+
| implementation | Code Structure, Patterns, Error Handling, Algorithm Analysis |
|
|
199
|
+
| performance | Bottlenecks, Optimization, Resource Utilization, Concurrency |
|
|
200
|
+
| security | Vulnerabilities, Auth, Data Protection, Input Validation |
|
|
201
|
+
| concept | Foundation, Core Mechanisms, Patterns, Trade-offs |
|
|
202
|
+
| comparison | Solution Comparison, Pros/Cons, Technology Evaluation |
|
|
203
|
+
| decision | Criteria, Trade-off Analysis, Risk Assessment, Impact |
|
|
204
|
+
| external_research | Standard Stack, Architecture Patterns, Don't Hand-Roll, Common Pitfalls (external web search) |
|
|
205
|
+
|
|
206
|
+
**Auto-suggest `external_research`** when phase goal contains unfamiliar technology keywords or when no codebase patterns exist for the domain (codebase exploration in Step 4.1 returns empty relevant_files).
|
|
207
|
+
|
|
208
|
+
2. **Perspectives** (multiSelect, header: "分析视角"): Up to 4:
|
|
209
|
+
|
|
210
|
+
| Perspective | CLI Tool | Focus |
|
|
211
|
+
|-------------|----------|-------|
|
|
212
|
+
| Technical | gemini | Implementation, code patterns, feasibility |
|
|
213
|
+
| Architectural | claude | System design, scalability, interactions |
|
|
214
|
+
| Business | codex | Value, ROI, stakeholder impact |
|
|
215
|
+
| Domain Expert | gemini | Domain patterns, best practices, standards |
|
|
216
|
+
|
|
217
|
+
3. **Depth** (single-select, header: "分析深度"):
|
|
218
|
+
- Quick Overview / Standard / Deep Dive
|
|
219
|
+
|
|
220
|
+
**Auto mode defaults**: all dimensions relevant to topic, single comprehensive perspective, Standard depth.
|
|
221
|
+
|
|
222
|
+
### Step 3: Initialize discussion.md
|
|
223
|
+
|
|
224
|
+
Write initial `discussion.md` to output directory:
|
|
225
|
+
- Dynamic TOC (updated after each round/phase)
|
|
226
|
+
- Session metadata (id, topic, dimensions, perspectives, depth)
|
|
227
|
+
- User Intent section (original topic/question for intent tracking)
|
|
228
|
+
- Current Understanding block (replaceable — overwritten each round, NOT appended): initialized as "To be populated after exploration"
|
|
229
|
+
- Empty discussion timeline
|
|
230
|
+
- Dimension selection rationale
|
|
231
|
+
|
|
232
|
+
### Step 4: CLI Exploration
|
|
233
|
+
|
|
234
|
+
Codebase exploration FIRST, then (optionally) external research, then CLI analysis.
|
|
235
|
+
|
|
236
|
+
**Step 4.0: External Research** (only if `external_research` dimension selected)
|
|
237
|
+
|
|
238
|
+
Orchestrator performs targeted web searches, then hands results to `workflow-phase-researcher` agent for synthesis.
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
1. WebSearch 2-3 queries: "{phase_goal} standard library stack", "architecture patterns best practices", "common pitfalls mistakes"
|
|
242
|
+
Fetch top 1-2 results per query for official docs.
|
|
243
|
+
|
|
244
|
+
2. Hand raw search output to workflow-phase-researcher agent to synthesize into:
|
|
245
|
+
- ## Standard Stack: concrete library recommendations with versions
|
|
246
|
+
- ## Architecture Patterns: recommended patterns
|
|
247
|
+
- ## Don't Hand-Roll: problems with existing solutions
|
|
248
|
+
- ## Common Pitfalls: mistakes to avoid
|
|
249
|
+
Style: prescriptive ("use X"), cite sources, confidence levels (HIGH/MEDIUM/LOW).
|
|
250
|
+
Agent returns structured markdown only (no file writes).
|
|
251
|
+
|
|
252
|
+
3. Store agent output as researchContext (in-memory).
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
`researchContext` is passed into Step 4.2 CLI Analysis and Step 8 Decision Extraction.
|
|
256
|
+
If `external_research` not selected: `researchContext = null`.
|
|
257
|
+
|
|
258
|
+
**Step 4.1: Codebase Exploration** (cli-explore-agent) — MANDATORY, NOT SUBSTITUTABLE
|
|
259
|
+
|
|
260
|
+
MUST spawn cli-explore-agent; manual Read/Grep is not a substitute. Produces exploration-codebase.json required for Step 5.
|
|
261
|
+
|
|
262
|
+
Spawn cli-explore-agent with 3-layer exploration:
|
|
263
|
+
|
|
264
|
+
| Layer | Focus | Output |
|
|
265
|
+
|-------|-------|--------|
|
|
266
|
+
| Layer 1: Module Discovery (Breadth) | Search by topic keywords, identify ALL relevant files, map module boundaries | `relevant_files[]` |
|
|
267
|
+
| Layer 2: Structure Tracing (Depth) | Top 3-5 key files: trace call chains 2-3 levels deep, identify data flow | `call_chains[]`, `data_flows[]` |
|
|
268
|
+
| Layer 3: Code Anchor Extraction (Detail) | Each key finding: extract code snippet (20-50 lines) with file:line | `code_anchors[]` |
|
|
269
|
+
|
|
270
|
+
Output: `exploration-codebase.json` (single) or `explorations/{perspective}.json` (multi-perspective, parallel up to 4)
|
|
271
|
+
|
|
272
|
+
**Step 4.2: CLI Analysis** (AFTER exploration) — MANDATORY, NOT SUBSTITUTABLE
|
|
273
|
+
|
|
274
|
+
MUST invoke at least one maestro delegate CLI call. The orchestrator's own analysis is NOT independent verification — CLI tools provide cross-validation from a separate model/perspective.
|
|
275
|
+
|
|
276
|
+
Build exploration context from Step 4.1 findings, then spawn CLI analysis.
|
|
277
|
+
If `researchContext` is set (from Step 4.0), include it as additional context in each CLI call:
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
// Append to CLI prompt when researchContext exists:
|
|
281
|
+
"External research findings (treat as strong recommendations, not laws):
|
|
282
|
+
{researchContext}"
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
- **Single perspective**: one comprehensive CLI call with exploration context
|
|
286
|
+
- **Multi-perspective** (up to 4): parallel CLI calls per perspective, each with perspective-specific focus
|
|
287
|
+
|
|
288
|
+
CLI calls use `run_in_background: true`. Wait for results before continuing.
|
|
289
|
+
|
|
290
|
+
**Step 4.3: Aggregate Findings**
|
|
291
|
+
|
|
292
|
+
- Consolidate explorations + CLI results
|
|
293
|
+
- Multi-perspective: extract synthesis (convergent themes, conflicting views, unique contributions)
|
|
294
|
+
- Write to `explorations.json` (single) or `perspectives.json` (multi)
|
|
295
|
+
|
|
296
|
+
`explorations.json` includes `technical_solutions[]`: `{round, solution, problem, rationale, alternatives, status: proposed|validated|rejected, evidence_refs[], next_action}` — populated throughout Step 5 rounds.
|
|
297
|
+
|
|
298
|
+
**Step 4.4: Update discussion.md — Round 1**
|
|
299
|
+
|
|
300
|
+
Append Round 1 to discussion timeline:
|
|
301
|
+
- Sources used
|
|
302
|
+
- Key findings with code anchors
|
|
303
|
+
- Discussion points
|
|
304
|
+
- Open questions
|
|
305
|
+
|
|
306
|
+
**Step 4.5: Initial Intent Coverage Check**
|
|
307
|
+
|
|
308
|
+
Re-read original User Intent from discussion.md header. Check each intent item against Round 1 findings:
|
|
309
|
+
- ✅ addressed
|
|
310
|
+
- 🔄 in-progress
|
|
311
|
+
- ❌ not yet touched
|
|
312
|
+
|
|
313
|
+
Append initial Intent Coverage Check to discussion.md.
|
|
314
|
+
|
|
315
|
+
**Step 4.6: Baseline Confidence Scoring**
|
|
316
|
+
|
|
317
|
+
Dimensions = the 6 analysis dimensions. Factors (weights): findings_depth(.30), evidence_strength(.25), coverage_breadth(.20), user_validation(.15), consistency(.10). Score each factor per dimension from Round 1 results. Append baseline confidence table to discussion.md. Thresholds: <60% 继续深入 | 60-80% 需用户确认收敛 | >80% → proceed to synthesis (REQUIRED convergence threshold).
|
|
318
|
+
|
|
319
|
+
### Step 5: Interactive Discussion Loop
|
|
320
|
+
|
|
321
|
+
Max 5 rounds. Each round follows this sequence:
|
|
322
|
+
|
|
323
|
+
**5.1: Current Understanding Summary** (Round >= 2, BEFORE presenting new findings):
|
|
324
|
+
Generate 1-2 sentence recap linking previous round conclusions to current starting point.
|
|
325
|
+
|
|
326
|
+
**5.2: Present Findings** from latest exploration/analysis
|
|
327
|
+
|
|
328
|
+
**5.3: Gather Feedback**
|
|
329
|
+
|
|
330
|
+
AskUserQuestion (single-select, header: "分析反馈"):
|
|
331
|
+
- **继续深入** (Recommended) — deepen lowest-confidence dimension
|
|
332
|
+
- **调整方向** — different focus or specific questions
|
|
333
|
+
- **补充信息** — user has additional context, constraints, or corrections
|
|
334
|
+
- **分析完成** — sufficient, exit to scoring
|
|
335
|
+
|
|
336
|
+
Question text: `Round {N} | Confidence: {overall}% | 最弱: {weakest_dim} ({dim_score}%)`
|
|
337
|
+
|
|
338
|
+
**5.4: Process Response** (always record user choice + impact to discussion.md):
|
|
339
|
+
|
|
340
|
+
| Choice | Action |
|
|
341
|
+
|--------|--------|
|
|
342
|
+
| 继续深入 | AskUserQuestion sub-direction (below) → CLI/agent exploration → merge findings |
|
|
343
|
+
| 调整方向 | Capture new direction → new CLI exploration → Record Decision (old vs new, reason, impact) |
|
|
344
|
+
| 补充信息 | Capture user input → integrate → answer questions via CLI if needed → Record corrections |
|
|
345
|
+
| 分析完成 | Exit loop → Record why concluding |
|
|
346
|
+
|
|
347
|
+
**继续深入 sub-direction**: AskUserQuestion (single-select, header: "深入方向", max 4 options: 3 context-driven from unresolved questions/low-confidence findings/unexplored dimensions + 1 heuristic "换角度审视"). "Other" auto-provided for custom direction.
|
|
348
|
+
|
|
349
|
+
**5.5: Update discussion.md** after each round:
|
|
350
|
+
- **Append** Round N: user input, direction, Q&A, corrections, new insights
|
|
351
|
+
- **Append Technical Solutions** — for every solution proposed, validated, or rejected this round, record immediately using Technical Solution Record Format in `#### Technical Solutions`
|
|
352
|
+
- **Replace** `## Current Understanding` block with latest consolidated understanding
|
|
353
|
+
- **Update** `## Table of Contents` with links to new sections
|
|
354
|
+
|
|
355
|
+
**5.6: Round Narrative Synthesis** (append after each round):
|
|
356
|
+
```markdown
|
|
357
|
+
### Round N: Narrative Synthesis
|
|
358
|
+
**起点**: 基于上一轮的 [conclusions/questions],本轮从 [starting point] 切入。
|
|
359
|
+
**关键进展**: [New findings] [confirmed/refuted/modified] 了之前关于 [hypothesis] 的理解。
|
|
360
|
+
**决策影响**: 用户选择 [feedback type],导致分析方向 [adjusted/deepened/maintained]。
|
|
361
|
+
**当前理解**: 经过本轮,核心认知更新为 [updated understanding]。
|
|
362
|
+
**遗留问题**: [remaining questions driving next round]
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
**5.7: Intent Drift Check** (every round >= 2):
|
|
366
|
+
Re-read original User Intent. Check each item:
|
|
367
|
+
- ✅ addressed (in Round N)
|
|
368
|
+
- 🔄 in-progress
|
|
369
|
+
- ⚠️ implicitly absorbed (needs confirmation)
|
|
370
|
+
- ❌ not yet discussed
|
|
371
|
+
|
|
372
|
+
If ❌ or ⚠️ items exist → proactively surface to user at start of next round.
|
|
373
|
+
|
|
374
|
+
**5.8: Re-score Confidence** (every round):
|
|
375
|
+
Re-evaluate factors per dimension. Show delta: `Confidence: {prev}% → {current}% ({±N%}), {weakest_dim} 仍需深入`
|
|
376
|
+
|
|
377
|
+
**5.9: Quality Mechanisms**:
|
|
378
|
+
- **Pressure Pass** (mandatory ≥1 before Step 6): highest-confidence finding → pressure ladder (evidence demand → assumption probe → boundary/tradeoff → root cause check). Record under `#### 压力测试`.
|
|
379
|
+
- **Devil's Advocate**: dimension > 0.7 → challenge "如果 [finding] 不成立?" (once per dimension)
|
|
380
|
+
- **Scope Minimizer**: findings > 5 + scope expanding → "最小可行结论集?"
|
|
381
|
+
- **Stall Detection**: delta < 5% for 2 consecutive rounds → "分析可能停滞,建议切换方向或收敛"
|
|
382
|
+
|
|
383
|
+
**5.10: Pre-Synthesis Readiness Gate** (on "分析完成"):
|
|
384
|
+
Block if: ❌ items without deferral | any dimension < 40% | no pressure pass | unresolved contradictions | overall confidence < 80%. If blocked → AskUserQuestion: 补充后继续 or 忽略风险并继续 (record `residual_risks[]`, note accepted confidence level).
|
|
385
|
+
|
|
386
|
+
**Auto mode (-y)**: auto-deepen ≤3 rounds, readiness gate auto-overrides with residual risk recording.
|
|
387
|
+
|
|
388
|
+
### Step 6: Six-Dimension Scoring
|
|
389
|
+
|
|
390
|
+
Using all exploration findings, discussion insights, and user feedback, score across 6 dimensions:
|
|
391
|
+
|
|
392
|
+
| Dimension | Focus Areas | Score |
|
|
393
|
+
|-----------|------------|-------|
|
|
394
|
+
| Feasibility | Technical difficulty, team capability, time, tooling | 1-5 |
|
|
395
|
+
| Impact | User value, business value, tech debt reduction, DX | 1-5 |
|
|
396
|
+
| Risk | Failure modes, security, scalability, regression | 1-5 |
|
|
397
|
+
| Complexity | Integration points, dependencies, learning curve, testing | 1-5 |
|
|
398
|
+
| Dependencies | External services, internal modules, data, infrastructure | 1-5 |
|
|
399
|
+
| Alternatives | 2+ other approaches with tradeoffs | N/A |
|
|
400
|
+
|
|
401
|
+
Each dimension scored with specific evidence (code refs, data points from exploration).
|
|
402
|
+
|
|
403
|
+
Each 1-5 score justified by confidence factors from Step 4.6/5.8. Include per-dimension confidence % alongside the score.
|
|
404
|
+
|
|
405
|
+
Build probability-impact risk matrix from identified risks.
|
|
406
|
+
|
|
407
|
+
Formulate Go/No-Go/Conditional recommendation with overall confidence %. Write confidence summary (per-dimension scores + overall + pressure pass result + residual risks) to analysis.md.
|
|
408
|
+
|
|
409
|
+
### Step 7: Synthesis & Conclusion
|
|
410
|
+
|
|
411
|
+
**7.1: Intent Coverage Verification** (MANDATORY before synthesis):
|
|
412
|
+
|
|
413
|
+
```markdown
|
|
414
|
+
### Intent Coverage Matrix
|
|
415
|
+
| # | Original Intent | Status | Where Addressed | Notes |
|
|
416
|
+
|---|----------------|--------|-----------------|-------|
|
|
417
|
+
| 1 | [intent] | ✅ Addressed | Round N, Conclusion #M | |
|
|
418
|
+
| 2 | [intent] | 🔀 Transformed | Round N → M | Original: X → Final: Y |
|
|
419
|
+
| 3 | [intent] | ❌ Missed | — | Reason |
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
Gate: ❌ Missed items must be either (a) addressed in additional round or (b) confirmed deferred by user.
|
|
423
|
+
|
|
424
|
+
**7.2: Consolidate Insights**
|
|
425
|
+
|
|
426
|
+
Compile from all phases:
|
|
427
|
+
- Decision Trail from all rounds
|
|
428
|
+
- Key conclusions with evidence + confidence (high/medium/low)
|
|
429
|
+
- Recommendations with rationale + priority (high/medium/low) + actionable steps — **merge validated `technical_solutions[]` from explorations.json as high-priority recommendations**
|
|
430
|
+
- Open questions, follow-up suggestions
|
|
431
|
+
- Write to `conclusions.json`
|
|
432
|
+
|
|
433
|
+
**7.3: Write analysis.md** (legacy compatible — 6-dimension summary):
|
|
434
|
+
- Executive summary with overall assessment
|
|
435
|
+
- Per-dimension scores with key evidence
|
|
436
|
+
- Dimension summary table
|
|
437
|
+
- Risk matrix visualization
|
|
438
|
+
- Go/No-Go recommendation with confidence
|
|
439
|
+
|
|
440
|
+
**7.4: Final discussion.md Update**:
|
|
441
|
+
- Conclusions section: summary, ranked key conclusions, prioritized recommendations
|
|
442
|
+
- Current Understanding (Final): what established, what clarified/corrected, key insights
|
|
443
|
+
- Decision Trail: critical decisions, direction changes timeline, trade-offs
|
|
444
|
+
- Intent Coverage Matrix
|
|
445
|
+
- Session statistics: rounds, duration, sources, artifacts, decision count
|
|
446
|
+
|
|
447
|
+
**7.5: Interactive Recommendation Review** (skip in auto mode):
|
|
448
|
+
|
|
449
|
+
Present recommendations, batch-confirm via AskUserQuestion (max 4 per call, ordered by priority):
|
|
450
|
+
- **确认**: Accept as-is → review_status = "accepted"
|
|
451
|
+
- **修改**: Adjust scope/steps → review_status = "modified"
|
|
452
|
+
- **删除**: Not needed → review_status = "rejected"
|
|
453
|
+
|
|
454
|
+
Update conclusions.json with review_status for each recommendation.
|
|
455
|
+
|
|
456
|
+
### Step 8: Decision Extraction
|
|
457
|
+
|
|
458
|
+
**This step runs ALWAYS** — in full mode after synthesis, in quick mode (`-q`) as the main step.
|
|
459
|
+
|
|
460
|
+
**8.1: Identify Gray Areas**
|
|
461
|
+
|
|
462
|
+
Analyze phase goal + loaded context (project.md, roadmap, brainstorm, prior context.md files, exploration findings if available) to find undecided implementation areas.
|
|
463
|
+
|
|
464
|
+
**Domain-aware gray area generation:**
|
|
465
|
+
- Something users SEE: layout, density, interactions, states
|
|
466
|
+
- Something users CALL: responses, errors, auth, versioning
|
|
467
|
+
- Something users RUN: output format, flags, modes, error handling
|
|
468
|
+
- Something users READ: structure, tone, depth, flow
|
|
469
|
+
- Something being ORGANIZED: criteria, grouping, naming, exceptions
|
|
470
|
+
|
|
471
|
+
Generate 3-5 **phase-specific** gray areas.
|
|
472
|
+
Skip areas already decided in prior context.md files.
|
|
473
|
+
If `guidance-specification.md` loaded: skip MUST/MUST NOT areas (already locked), focus on SHOULD/MAY areas and gaps.
|
|
474
|
+
If full mode completed: use exploration findings + scoring to inform gray area quality.
|
|
475
|
+
|
|
476
|
+
**8.2: Area Selection** (skip if `-y`)
|
|
477
|
+
|
|
478
|
+
```
|
|
479
|
+
AskUserQuestion({
|
|
480
|
+
question: "Which areas need discussion for this phase?",
|
|
481
|
+
options: [
|
|
482
|
+
{ label: "Area 1: {title}", description: "{brief description}" },
|
|
483
|
+
{ label: "Area 2: {title}", description: "{brief description}" },
|
|
484
|
+
{ label: "Area 3: {title}", description: "{brief description}" },
|
|
485
|
+
{ label: "All areas", description: "Discuss everything" },
|
|
486
|
+
{ label: "Skip", description: "Context is clear enough — no decisions needed" }
|
|
487
|
+
]
|
|
488
|
+
})
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
If "Skip": write minimal context.md (empty Locked/Free/Deferred sections), proceed to Step 9.
|
|
492
|
+
|
|
493
|
+
**8.3: Deep-Dive Discussion**
|
|
494
|
+
|
|
495
|
+
For each selected area, conduct multi-round interactive dialog (3-4 questions per area):
|
|
496
|
+
|
|
497
|
+
```
|
|
498
|
+
AskUserQuestion({
|
|
499
|
+
question: "[{area}] {specific question about implementation choice}",
|
|
500
|
+
options: [
|
|
501
|
+
{ label: "Option A", description: "{description with tradeoffs}" },
|
|
502
|
+
{ label: "Option B", description: "{description with tradeoffs}" },
|
|
503
|
+
{ label: "Option C", description: "{description with tradeoffs}" }
|
|
504
|
+
]
|
|
505
|
+
})
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Record each decision using Decision Recording Protocol.
|
|
509
|
+
|
|
510
|
+
After questions per area: "More questions about {area}, or move to next?"
|
|
511
|
+
|
|
512
|
+
**Scope guardrail**: Phase boundary from roadmap.md is FIXED. Discussion clarifies HOW to implement, not WHETHER to add more. If user suggests new capabilities → "That belongs in its own phase. I will note it for later." → capture in Deferred.
|
|
513
|
+
|
|
514
|
+
**8.4: Classify Decisions**
|
|
515
|
+
|
|
516
|
+
- **Locked**: firm decisions that cannot be changed during implementation
|
|
517
|
+
- **Free**: open for implementation discretion (implementer can choose)
|
|
518
|
+
- **Deferred**: postponed to a later phase (captured but not acted on)
|
|
519
|
+
|
|
520
|
+
**If `researchContext` is set**: for each Free decision area, append a research-backed recommendation:
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
### Free — {area}
|
|
524
|
+
Implementer's choice. Research suggests: {relevant finding from researchContext}.
|
|
525
|
+
(e.g., "Standard Stack recommends React Query for server state. Common pitfall: avoid mixing with Redux for async.")
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
**8.5: Write context.md**
|
|
529
|
+
|
|
530
|
+
Write to `OUTPUT_DIR/context.md`:
|
|
531
|
+
|
|
532
|
+
```markdown
|
|
533
|
+
# Context: Phase {NN} -- {PHASE_TITLE}
|
|
534
|
+
|
|
535
|
+
**Date**: {date}
|
|
536
|
+
**Areas discussed**: {list of areas}
|
|
537
|
+
|
|
538
|
+
## Decisions
|
|
539
|
+
|
|
540
|
+
### Decision 1: {TITLE}
|
|
541
|
+
- **Context**: {what and why}
|
|
542
|
+
- **Options**:
|
|
543
|
+
1. {opt1}
|
|
544
|
+
2. {opt2}
|
|
545
|
+
- **Chosen**: {selected}
|
|
546
|
+
- **Reason**: {rationale}
|
|
547
|
+
|
|
548
|
+
## Constraints
|
|
549
|
+
|
|
550
|
+
### Locked
|
|
551
|
+
{decisions that are final and must be followed}
|
|
552
|
+
|
|
553
|
+
### Free
|
|
554
|
+
{decisions left to implementer discretion}
|
|
555
|
+
|
|
556
|
+
### Deferred
|
|
557
|
+
{ideas captured but postponed to later phases}
|
|
558
|
+
|
|
559
|
+
## Code Context
|
|
560
|
+
{relevant code references from exploration or discussion}
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
**8.6: Write context-package.json**
|
|
564
|
+
|
|
565
|
+
Write to `OUTPUT_DIR/context-package.json`:
|
|
566
|
+
|
|
567
|
+
```jsonc
|
|
568
|
+
{
|
|
569
|
+
"$schema": "context-package/1.0",
|
|
570
|
+
"source": {
|
|
571
|
+
"type": "analyze",
|
|
572
|
+
"artifact_id": "{artifact_id}",
|
|
573
|
+
"session_path": "{OUTPUT_DIR relative to .workflow/}",
|
|
574
|
+
"generated_at": "{ISO-8601}"
|
|
575
|
+
},
|
|
576
|
+
"requirements": [], // From conclusions.json implementation_scope items (if any)
|
|
577
|
+
"constraints": [], // Locked → { status: "locked" }, Free → { status: "open" }, Deferred → { status: "deferred" }
|
|
578
|
+
"domain": {}, // Inherit from upstream context-package if loaded via --from
|
|
579
|
+
"non_goals": [], // Deferred items → { title, rationale, ref: "context.md#Deferred" }
|
|
580
|
+
"insights": [], // From conclusions.json recommendations → { role: "analyzer", area, summary }
|
|
581
|
+
"open_questions": [], // Free decisions without strong recommendation → { area, question, options[] }
|
|
582
|
+
"references": [
|
|
583
|
+
{ "type": "analysis", "path": "context.md" },
|
|
584
|
+
{ "type": "conclusions", "path": "conclusions.json" }
|
|
585
|
+
]
|
|
586
|
+
}
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
Extraction mapping from context.md sections:
|
|
590
|
+
- Each "Locked" decision → `constraints[]` with `status: "locked"`, `ref: "context.md#Locked"`
|
|
591
|
+
- Each "Free" decision → `constraints[]` with `status: "open"`, `ref: "context.md#Free"`
|
|
592
|
+
- Each "Deferred" item → `non_goals[]` with `ref: "context.md#Deferred"`
|
|
593
|
+
- From `conclusions.json.implementation_scope[]` (if exists) → `requirements[]` with `{ id, title: scope.objective, acceptance: scope.acceptance_criteria, ref: "conclusions.json" }`
|
|
594
|
+
- From `conclusions.json.recommendations[]` → `insights[]`
|
|
595
|
+
|
|
596
|
+
**8.7: Update project.md Key Decisions** (phase mode only)
|
|
597
|
+
|
|
598
|
+
```
|
|
599
|
+
Phase mode only: Append each new Locked decision to .workflow/project.md "## Key Decisions" table.
|
|
600
|
+
Row format: | {decision title} | {rationale summary} | Phase {NN} — {date} |
|
|
601
|
+
Skip duplicates (match by title).
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
**8.8: Auto-create Issues from Deferred Items**
|
|
605
|
+
|
|
606
|
+
```
|
|
607
|
+
For each Deferred decision, create an issue in .workflow/issues/issues.jsonl:
|
|
608
|
+
id: "ISS-{YYYYMMDD}-{NNN}"
|
|
609
|
+
title: "Deferred: {item.title}"
|
|
610
|
+
status: "deferred", priority: 5, severity: "low"
|
|
611
|
+
source: "analyze", milestone_ref: target_milestone
|
|
612
|
+
description: "{item.context} -- Chosen to defer: {item.reason}"
|
|
613
|
+
tags: ["deferred", "analyze"]
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
### Step 8.9: Register Artifact
|
|
617
|
+
|
|
618
|
+
```
|
|
619
|
+
Register artifact in .workflow/state.json:
|
|
620
|
+
id: "ANL-{next sequential 3-digit id}"
|
|
621
|
+
type: "analyze", scope: scope, status: "completed"
|
|
622
|
+
milestone: target_milestone (null if standalone/adhoc)
|
|
623
|
+
phase: null (analyze operates at milestone level)
|
|
624
|
+
path: OUTPUT_DIR relative to .workflow/
|
|
625
|
+
context_package: "{OUTPUT_DIR}/context-package.json" // relative to .workflow/
|
|
626
|
+
harvested: false, created_at: session_start_time, completed_at: now()
|
|
627
|
+
Atomic write (tmp + rename).
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
### Step 9: Report & Next Step
|
|
631
|
+
|
|
632
|
+
Display summary:
|
|
633
|
+
- Overall assessment score and recommendation (full mode) or "Quick decision extraction" (quick mode)
|
|
634
|
+
- Decisions captured (Locked/Free/Deferred counts)
|
|
635
|
+
- Key conclusions (if full mode)
|
|
636
|
+
- Session stats
|
|
637
|
+
|
|
638
|
+
AskUserQuestion (single-select, header: "Next Step"):
|
|
639
|
+
- **快速执行** — build context from conclusions, invoke maestro-quick
|
|
640
|
+
- **进入规划** — phase planning (maestro-plan)
|
|
641
|
+
- **产出Issue** — convert recommendations to tracked issues
|
|
642
|
+
- **完成** — no further action
|
|
643
|
+
|
|
644
|
+
Handle selection:
|
|
645
|
+
|
|
646
|
+
| Choice | Action |
|
|
647
|
+
|--------|--------|
|
|
648
|
+
| 快速执行 | Build `taskDescription` from high/medium priority accepted recommendations. Assemble context from exploration. Invoke Skill immediately. |
|
|
649
|
+
| 进入规划 | **Implementation Scoping** (below), then invoke Skill. |
|
|
650
|
+
| 产出Issue | For each accepted/modified recommendation: create issue. |
|
|
651
|
+
| 完成 | No further action. |
|
|
652
|
+
|
|
653
|
+
**Implementation Scoping** (for "进入规划" only):
|
|
654
|
+
|
|
655
|
+
Before invoking maestro-plan, build and persist `implementation_scope` so the planner has concrete "what + done-when" specs:
|
|
656
|
+
|
|
657
|
+
```
|
|
658
|
+
// Step A: Build implementation_scope from accepted/modified recommendations (sorted by priority)
|
|
659
|
+
Each scope item:
|
|
660
|
+
objective: rec.action // WHAT
|
|
661
|
+
rationale: rec.rationale // WHY
|
|
662
|
+
priority: rec.priority
|
|
663
|
+
target_files: from rec.steps targets + matching code_anchors // WHERE
|
|
664
|
+
acceptance_criteria: from rec.steps verification/description // DONE WHEN
|
|
665
|
+
change_summary: "{target}: {description}" per step // HOW
|
|
666
|
+
|
|
667
|
+
// Step B: User scope confirmation (skip in auto/quick mode)
|
|
668
|
+
AskUserQuestion (single-select, header: "Scope确认"):
|
|
669
|
+
- "确认执行": Proceed to planning
|
|
670
|
+
- "调整范围": Narrow or expand scope
|
|
671
|
+
- "补充标准": Add/refine acceptance criteria
|
|
672
|
+
|
|
673
|
+
// Step C: Persist implementation_scope to conclusions.json
|
|
674
|
+
|
|
675
|
+
// Step D: Invoke plan
|
|
676
|
+
Phase mode: Skill({ skill: "maestro-plan", args: "{phase}" })
|
|
677
|
+
Scratch mode: Skill({ skill: "maestro-plan", args: "--dir {output_dir}" })
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
The planner reads `conclusions.json.implementation_scope` and maps:
|
|
681
|
+
- `scope.objective` → task title/description
|
|
682
|
+
- `scope.acceptance_criteria` → `convergence.criteria` (seed, planner makes grep-verifiable)
|
|
683
|
+
- `scope.target_files` → `files[]` + `read_first[]`
|
|
684
|
+
- `scope.priority` → task/wave ordering
|
|
685
|
+
|
|
686
|
+
Update index.json timestamps.
|
|
687
|
+
|
|
688
|
+
```
|
|
689
|
+
== maestro-analyze complete ==
|
|
690
|
+
Session: {session_id}
|
|
691
|
+
Output: {output_dir}/
|
|
692
|
+
Mode: {full|quick}
|
|
693
|
+
Rounds: {round_count} (full mode only)
|
|
694
|
+
Score: {recommendation} ({confidence}) (full mode only)
|
|
695
|
+
Decisions: {decision_count} (Locked: {n}, Free: {n}, Deferred: {n})
|
|
696
|
+
|
|
697
|
+
Files:
|
|
698
|
+
context.md — Locked/Free/Deferred decisions for plan
|
|
699
|
+
context-package.json — Standardized context package for cross-command consumption
|
|
700
|
+
discussion.md — Full discussion timeline (full mode)
|
|
701
|
+
analysis.md — 6-dimension scoring summary (full mode)
|
|
702
|
+
conclusions.json — Structured conclusions (full mode)
|
|
703
|
+
|
|
704
|
+
Next:
|
|
705
|
+
Skill({ skill: "maestro-quick", args: "{task}" }) — Quick execute
|
|
706
|
+
Skill({ skill: "maestro-plan", args: "{phase}" }) — Full phase planning (phase mode)
|
|
707
|
+
Skill({ skill: "maestro-plan", args: "--dir {output_dir}" }) — Plan in scratch dir (scratch mode)
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
---
|
|
711
|
+
|
|
712
|
+
## Decision Recording Protocol
|
|
713
|
+
|
|
714
|
+
Record immediately when any occur:
|
|
715
|
+
|
|
716
|
+
| Trigger | What to Record |
|
|
717
|
+
|---------|---------------|
|
|
718
|
+
| Direction choice | What chosen, why, alternatives discarded |
|
|
719
|
+
| Key finding | Content, impact scope, confidence, hypothesis impact |
|
|
720
|
+
| Assumption change | Old → new understanding, reason, impact |
|
|
721
|
+
| User feedback | Input, rationale for adoption/adjustment |
|
|
722
|
+
| Disagreement/trade-off | Conflicting views, trade-off basis, final choice |
|
|
723
|
+
| Scope adjustment | Before/after scope, trigger reason |
|
|
724
|
+
| **Technical solution proposed/validated/rejected** | Solution description, rationale, alternatives considered, status |
|
|
725
|
+
|
|
726
|
+
**Decision Record Format**:
|
|
727
|
+
```
|
|
728
|
+
> **Decision**: [Description]
|
|
729
|
+
> - **Context**: [Trigger]
|
|
730
|
+
> - **Options considered**: [Alternatives]
|
|
731
|
+
> - **Chosen**: [Approach] — **Reason**: [Rationale]
|
|
732
|
+
> - **Rejected**: [Why other options were discarded]
|
|
733
|
+
> - **Evidence Source**: [cli-explore-agent | maestro delegate | user input | exploration-codebase.json anchor] — REQUIRED, manual Read/Grep alone is INVALID
|
|
734
|
+
> - **Impact**: [Effect on analysis]
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
**Technical Solution Record Format**:
|
|
738
|
+
```
|
|
739
|
+
> **Solution**: [Description — what approach, pattern, or implementation]
|
|
740
|
+
> - **Status**: [Proposed / Validated / Rejected]
|
|
741
|
+
> - **Problem**: [What problem this solves]
|
|
742
|
+
> - **Rationale**: [Why this approach]
|
|
743
|
+
> - **Alternatives**: [Other options considered and why not chosen]
|
|
744
|
+
> - **Evidence**: [file:line or code anchor references]
|
|
745
|
+
> - **Next Action**: [Follow-up required or none]
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
## Discussion Timeline (discussion.md)
|
|
749
|
+
|
|
750
|
+
Each round appends:
|
|
751
|
+
- User feedback and direction choice
|
|
752
|
+
- New findings with code anchors
|
|
753
|
+
- Narrative Synthesis (起点 → 关键进展 → 决策影响 → 当前理解 → 遗留问题)
|
|
754
|
+
- Intent Coverage Check (Round >= 2)
|
|
755
|
+
|
|
756
|
+
Replaceable blocks (overwritten each round):
|
|
757
|
+
- `## Current Understanding` — latest consolidated understanding
|
|
758
|
+
- `## Table of Contents` — updated with new section links
|
|
759
|
+
|
|
760
|
+
## Error Handling
|
|
761
|
+
|
|
762
|
+
| Error | Resolution |
|
|
763
|
+
|-------|------------|
|
|
764
|
+
| cli-explore-agent fails | Retry once. If still fails: log W001 warning in discussion.md, flag all subsequent decisions as LOW CONFIDENCE (evidence gap), continue with available context |
|
|
765
|
+
| CLI timeout | Retry with shorter prompt; if still fails, mark perspective [LOW CONFIDENCE] (evidence gap) in discussion.md and continue |
|
|
766
|
+
| Max rounds reached | Force synthesis, offer continuation |
|
|
767
|
+
| No relevant findings | Broaden search, ask user for clarification |
|
|
768
|
+
| Session folder conflict | Append timestamp suffix |
|