maestro-flow 0.3.38 → 0.3.40
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/.claude/agents/workflow-analyzer.md +2 -0
- package/.claude/agents/workflow-debugger.md +2 -0
- package/.claude/agents/workflow-executor.md +2 -0
- package/.claude/agents/workflow-integration-checker.md +1 -0
- package/.claude/agents/workflow-nyquist-auditor.md +1 -0
- package/.claude/agents/workflow-planner.md +2 -0
- package/.claude/agents/workflow-reviewer.md +2 -0
- package/.claude/agents/workflow-verifier.md +2 -0
- package/.claude/commands/learn-decompose.md +176 -176
- package/.claude/commands/learn-follow.md +167 -167
- package/.claude/commands/learn-investigate.md +221 -221
- package/.claude/commands/learn-retro.md +303 -303
- package/.claude/commands/learn-second-opinion.md +167 -167
- package/.claude/commands/maestro-amend.md +300 -300
- package/.claude/commands/maestro-analyze.md +130 -126
- package/.claude/commands/maestro-brainstorm.md +104 -100
- package/.claude/commands/maestro-composer.md +354 -354
- package/.claude/commands/maestro-execute.md +120 -114
- package/.claude/commands/maestro-fork.md +86 -86
- package/.claude/commands/maestro-init.md +78 -78
- package/.claude/commands/maestro-learn.md +140 -140
- package/.claude/commands/maestro-link-coordinate.md +1 -1
- package/.claude/commands/maestro-merge.md +61 -61
- package/.claude/commands/maestro-milestone-release.md +96 -96
- package/.claude/commands/maestro-overlay.md +178 -178
- package/.claude/commands/maestro-plan.md +154 -138
- package/.claude/commands/maestro-player.md +404 -404
- package/.claude/commands/maestro-quick.md +56 -56
- package/.claude/commands/maestro-ralph-execute.md +7 -18
- package/.claude/commands/maestro-ralph.md +48 -12
- package/.claude/commands/maestro-roadmap.md +1 -1
- package/.claude/commands/maestro-ui-design.md +93 -93
- package/.claude/commands/maestro-update.md +176 -176
- package/.claude/commands/maestro-verify.md +96 -90
- package/.claude/commands/maestro.md +121 -121
- package/.claude/commands/manage-codebase-rebuild.md +75 -75
- package/.claude/commands/manage-codebase-refresh.md +57 -57
- package/.claude/commands/manage-harvest.md +94 -94
- package/.claude/commands/manage-issue-discover.md +77 -77
- package/.claude/commands/manage-issue.md +73 -73
- package/.claude/commands/manage-knowhow-capture.md +193 -193
- package/.claude/commands/manage-knowhow.md +77 -77
- package/.claude/commands/manage-learn.md +67 -67
- package/.claude/commands/manage-status.md +51 -51
- package/.claude/commands/manage-wiki.md +62 -62
- package/.claude/commands/quality-auto-test.md +5 -1
- package/.claude/commands/quality-debug.md +125 -115
- package/.claude/commands/quality-refactor.md +55 -55
- package/.claude/commands/quality-retrospective.md +78 -78
- package/.claude/commands/quality-review.md +114 -108
- package/.claude/commands/quality-sync.md +51 -51
- package/.claude/commands/quality-test.md +107 -103
- package/.claude/commands/spec-add.md +49 -49
- package/.claude/commands/spec-load.md +51 -51
- package/.claude/commands/spec-remove.md +51 -51
- package/.claude/commands/spec-setup.md +51 -51
- package/.claude/commands/wiki-connect.md +62 -62
- package/.claude/commands/wiki-digest.md +69 -69
- package/.codex/skills/learn-decompose/SKILL.md +113 -113
- package/.codex/skills/learn-follow/SKILL.md +1 -1
- package/.codex/skills/learn-investigate/SKILL.md +83 -83
- package/.codex/skills/learn-retro/SKILL.md +83 -83
- package/.codex/skills/learn-second-opinion/SKILL.md +86 -86
- package/.codex/skills/maestro/SKILL.md +304 -304
- package/.codex/skills/maestro-analyze/SKILL.md +11 -3
- package/.codex/skills/maestro-brainstorm/SKILL.md +451 -397
- package/.codex/skills/maestro-composer/SKILL.md +213 -213
- package/.codex/skills/maestro-execute/SKILL.md +346 -318
- package/.codex/skills/maestro-fork/SKILL.md +56 -2
- package/.codex/skills/maestro-init/SKILL.md +40 -16
- package/.codex/skills/maestro-learn/SKILL.md +80 -80
- package/.codex/skills/maestro-link-coordinate/SKILL.md +257 -257
- package/.codex/skills/maestro-merge/SKILL.md +1 -1
- package/.codex/skills/maestro-milestone-audit/SKILL.md +1 -1
- package/.codex/skills/maestro-milestone-complete/SKILL.md +40 -9
- package/.codex/skills/maestro-milestone-release/SKILL.md +70 -70
- package/.codex/skills/maestro-overlay/SKILL.md +1 -1
- package/.codex/skills/maestro-plan/SKILL.md +29 -4
- package/.codex/skills/maestro-player/SKILL.md +323 -323
- package/.codex/skills/maestro-quick/SKILL.md +1 -1
- package/.codex/skills/maestro-ralph/SKILL.md +693 -578
- package/.codex/skills/maestro-roadmap/SKILL.md +518 -468
- package/.codex/skills/maestro-ui-design/SKILL.md +109 -12
- package/.codex/skills/maestro-verify/SKILL.md +27 -9
- package/.codex/skills/manage-codebase-rebuild/SKILL.md +3 -2
- package/.codex/skills/manage-codebase-refresh/SKILL.md +1 -1
- package/.codex/skills/manage-harvest/SKILL.md +91 -91
- package/.codex/skills/manage-issue/SKILL.md +19 -6
- package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
- package/.codex/skills/manage-knowhow/SKILL.md +95 -95
- package/.codex/skills/manage-knowhow-capture/SKILL.md +110 -110
- package/.codex/skills/manage-learn/SKILL.md +1 -1
- package/.codex/skills/manage-status/SKILL.md +1 -1
- package/.codex/skills/manage-wiki/SKILL.md +55 -55
- package/.codex/skills/quality-auto-test/SKILL.md +553 -547
- package/.codex/skills/quality-debug/SKILL.md +345 -334
- package/.codex/skills/quality-refactor/SKILL.md +1 -1
- package/.codex/skills/quality-retrospective/SKILL.md +292 -292
- package/.codex/skills/quality-review/SKILL.md +365 -364
- package/.codex/skills/quality-sync/SKILL.md +1 -1
- package/.codex/skills/quality-test/SKILL.md +507 -498
- package/.codex/skills/spec-add/SKILL.md +101 -101
- package/.codex/skills/spec-load/SKILL.md +77 -77
- package/.codex/skills/spec-map/SKILL.md +1 -1
- package/.codex/skills/spec-remove/SKILL.md +69 -69
- package/.codex/skills/spec-setup/SKILL.md +1 -1
- package/.codex/skills/team-coordinate/SKILL.md +2 -1
- package/.codex/skills/team-executor/SKILL.md +116 -115
- package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -1
- package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +14 -6
- package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +16 -4
- package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +7 -1
- package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +16 -4
- package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +8 -2
- package/.codex/skills/team-quality-assurance/SKILL.md +2 -1
- package/.codex/skills/team-quality-assurance/roles/scout/role.md +9 -2
- package/.codex/skills/team-review/SKILL.md +2 -1
- package/.codex/skills/team-review/roles/reviewer/role.md +10 -1
- package/.codex/skills/team-review/roles/scanner/role.md +10 -1
- package/.codex/skills/team-tech-debt/SKILL.md +144 -143
- package/.codex/skills/team-tech-debt/roles/executor/role.md +9 -5
- package/.codex/skills/team-tech-debt/roles/scanner/role.md +10 -0
- package/.codex/skills/team-tech-debt/roles/validator/role.md +8 -2
- package/.codex/skills/team-testing/SKILL.md +2 -1
- package/.codex/skills/team-testing/roles/executor/role.md +8 -2
- package/.codex/skills/team-testing/roles/generator/role.md +8 -2
- package/.codex/skills/wiki-connect/SKILL.md +73 -73
- package/.codex/skills/wiki-digest/SKILL.md +87 -87
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +6 -0
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
- package/dashboard/dist-server/shared/agent-types.d.ts +2 -0
- package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +2 -0
- package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -0
- package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
- package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
- package/dashboard/dist-server/src/commands/delegate.js +18 -0
- package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
- package/dashboard/dist-server/src/config/cli-tools-config.d.ts +6 -0
- package/dashboard/dist-server/src/config/cli-tools-config.js +2 -0
- package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
- package/dist/shared/agent-types.d.ts +2 -0
- package/dist/shared/agent-types.d.ts.map +1 -1
- package/dist/src/agents/cli-agent-runner.d.ts +2 -0
- package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
- package/dist/src/agents/cli-agent-runner.js +4 -0
- package/dist/src/agents/cli-agent-runner.js.map +1 -1
- package/dist/src/commands/config.d.ts.map +1 -1
- package/dist/src/commands/config.js +29 -1
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/delegate.d.ts +2 -0
- package/dist/src/commands/delegate.d.ts.map +1 -1
- package/dist/src/commands/delegate.js +18 -0
- package/dist/src/commands/delegate.js.map +1 -1
- package/dist/src/commands/launcher.d.ts.map +1 -1
- package/dist/src/commands/launcher.js +27 -4
- package/dist/src/commands/launcher.js.map +1 -1
- package/dist/src/config/cli-tools-config.d.ts +6 -0
- package/dist/src/config/cli-tools-config.d.ts.map +1 -1
- package/dist/src/config/cli-tools-config.js +2 -0
- package/dist/src/config/cli-tools-config.js.map +1 -1
- package/dist/src/core/overlay/applier.d.ts.map +1 -1
- package/dist/src/core/overlay/applier.js +65 -5
- package/dist/src/core/overlay/applier.js.map +1 -1
- package/dist/src/core/overlay/loader.d.ts.map +1 -1
- package/dist/src/core/overlay/loader.js +9 -4
- package/dist/src/core/overlay/loader.js.map +1 -1
- package/dist/src/core/overlay/types.d.ts +2 -0
- package/dist/src/core/overlay/types.d.ts.map +1 -1
- package/dist/src/core/overlay/types.js +2 -0
- package/dist/src/core/overlay/types.js.map +1 -1
- package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
- package/dist/src/tui/tools-ui/ToolsDashboard.js +1 -1
- package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
- package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
- package/dist/src/tui/tools-ui/ToolsOverview.js +51 -4
- package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
- package/package.json +1 -1
- package/shared/agent-types.ts +2 -0
- package/workflows/analyze.md +24 -2
- package/workflows/auto-test.md +12 -0
- package/workflows/brainstorm.md +11 -1
- package/workflows/debug.md +13 -4
- package/workflows/delegate-protocol.codex.md +65 -0
- package/workflows/plan.md +14 -4
- package/workflows/test.md +10 -0
|
@@ -1,221 +1,221 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: learn-investigate
|
|
3
|
-
description:
|
|
4
|
-
argument-hint: "<question> [--scope <path>] [--max-hypotheses N]"
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Write
|
|
8
|
-
- Bash
|
|
9
|
-
- Glob
|
|
10
|
-
- Grep
|
|
11
|
-
- Agent
|
|
12
|
-
- AskUserQuestion
|
|
13
|
-
---
|
|
14
|
-
<purpose>
|
|
15
|
-
Systematic investigation workflow for understanding questions (not bug-fixing). Inspired by gstack `/investigate` with its 4-phase approach, scope lock, and 3-strike escalation rule.
|
|
16
|
-
|
|
17
|
-
Unlike `quality-debug` which is designed for fixing bugs during execution phases, this command is for answering "how does X work?", "why does Y happen?", "what would happen if Z?" questions. It produces structured evidence trails and understanding documents that persist to the learning system.
|
|
18
|
-
</purpose>
|
|
19
|
-
|
|
20
|
-
<context>
|
|
21
|
-
Arguments: $ARGUMENTS
|
|
22
|
-
|
|
23
|
-
**Target:** First argument is the question or topic to investigate (quoted string or keywords).
|
|
24
|
-
|
|
25
|
-
**Flags:**
|
|
26
|
-
- `--scope <path>` — Restrict investigation to files under this directory (default: entire project)
|
|
27
|
-
- `--max-hypotheses N` — Maximum hypotheses to test before escalating (default: 3)
|
|
28
|
-
|
|
29
|
-
**Storage written:**
|
|
30
|
-
- `.workflow/learning/investigate-{slug}/evidence.ndjson` — Structured evidence log (one JSON line per evidence)
|
|
31
|
-
- `.workflow/learning/investigate-{slug}/understanding.md` — Evolving understanding document
|
|
32
|
-
- `.workflow/learning/investigate-{slug}/report.md` — Final investigation report
|
|
33
|
-
- `.workflow/learning/lessons.jsonl` — Investigation findings as insights (source: "investigate")
|
|
34
|
-
- `.workflow/learning/learning-index.json` — Updated index
|
|
35
|
-
|
|
36
|
-
**Storage read:**
|
|
37
|
-
- Source files within scope
|
|
38
|
-
- `maestro wiki search "<question>"` — Prior knowledge about the topic
|
|
39
|
-
- `.workflow/learning/lessons.jsonl` — Prior related investigations
|
|
40
|
-
- `.workflow/specs/debug-notes.md` — Known gotchas and patterns
|
|
41
|
-
- `.workflow/codebase/architecture.md` — Structural context (if exists)
|
|
42
|
-
</context>
|
|
43
|
-
|
|
44
|
-
<execution>
|
|
45
|
-
|
|
46
|
-
### Stage 1: Frame the Question
|
|
47
|
-
- Parse question from arguments
|
|
48
|
-
- Determine scope (--scope or full project)
|
|
49
|
-
- Generate investigation slug from question keywords
|
|
50
|
-
- Create `.workflow/learning/investigate-{slug}/` directory
|
|
51
|
-
- Search prior knowledge:
|
|
52
|
-
- `maestro wiki search "<question>"` for related entries
|
|
53
|
-
- Grep `lessons.jsonl` for related insights
|
|
54
|
-
- Read `debug-notes.md` for known gotchas
|
|
55
|
-
|
|
56
|
-
Write initial `understanding.md`:
|
|
57
|
-
```markdown
|
|
58
|
-
# Investigation: {question}
|
|
59
|
-
## Initial Understanding
|
|
60
|
-
- Prior knowledge: {summary of wiki/lessons findings}
|
|
61
|
-
- Scope: {path or "full project"}
|
|
62
|
-
- Started: {timestamp}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Stage 2: Evidence Collection
|
|
66
|
-
Systematically gather evidence related to the question:
|
|
67
|
-
|
|
68
|
-
1. **Code search**: Grep for keywords from the question across the scoped files
|
|
69
|
-
2. **File inspection**: Read the most relevant files identified by search
|
|
70
|
-
3. **Import/dependency tracing**: Follow imports to understand the dependency chain
|
|
71
|
-
4. **Git history**: `git log --oneline -10 -- <relevant-files>` for recent changes
|
|
72
|
-
|
|
73
|
-
For each piece of evidence, append to `evidence.ndjson`:
|
|
74
|
-
```json
|
|
75
|
-
{"ts": "ISO", "type": "code|git|search|doc", "source": "file:line", "relevance": "high|medium|low", "content": "...", "note": "why this matters"}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Stage 3: Pattern Matching
|
|
79
|
-
Compare collected evidence against known patterns:
|
|
80
|
-
- Check `debug-notes.md` entries for matching situations
|
|
81
|
-
- Check `lessons.jsonl` for related technique/pattern/gotcha entries
|
|
82
|
-
- Identify: does this match a documented pattern, or is it novel?
|
|
83
|
-
|
|
84
|
-
Update `understanding.md` with pattern analysis section.
|
|
85
|
-
|
|
86
|
-
### Stage 4: Hypothesis Formation
|
|
87
|
-
From evidence and patterns, generate ranked hypotheses:
|
|
88
|
-
- Each hypothesis: a specific, testable claim about "how/why"
|
|
89
|
-
- Rank by plausibility (evidence strength)
|
|
90
|
-
- Write hypotheses to `understanding.md`
|
|
91
|
-
|
|
92
|
-
```markdown
|
|
93
|
-
## Hypotheses
|
|
94
|
-
1. **[HIGH]** {hypothesis 1} — Evidence: {refs}
|
|
95
|
-
2. **[MEDIUM]** {hypothesis 2} — Evidence: {refs}
|
|
96
|
-
3. **[LOW]** {hypothesis 3} — Evidence: {refs}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Stage 4.5: CLI Supplementary Exploration (optional)
|
|
100
|
-
|
|
101
|
-
**Skip if** no enabled CLI tools or hypotheses are trivially testable.
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
IF no CLI tools enabled: skip to Stage 5
|
|
105
|
-
|
|
106
|
-
hypothesis_summary = hypotheses.map(h => "${h.rank}: ${h.claim}").join("\n")
|
|
107
|
-
|
|
108
|
-
Bash({
|
|
109
|
-
command: 'maestro delegate "PURPOSE: Gather evidence for investigation hypotheses
|
|
110
|
-
TASK: For each hypothesis, trace relevant call chains and data flows | Find corroborating or contradicting code patterns
|
|
111
|
-
MODE: analysis
|
|
112
|
-
CONTEXT: @${scope_path}/**/*
|
|
113
|
-
EXPECTED: JSON array of { hypothesis_rank, evidence: [{ file, line, supports: bool, explanation }] }
|
|
114
|
-
CONSTRAINTS: Focus on code-level evidence only | Max 5 evidence items per hypothesis
|
|
115
|
-
|
|
116
|
-
Hypotheses:
|
|
117
|
-
${hypothesis_summary}
|
|
118
|
-
" --role explore --mode analysis',
|
|
119
|
-
run_in_background: true
|
|
120
|
-
})
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
**On callback:** Parse result, append each evidence item to `evidence.ndjson` with `type: "cli-exploration"`. Pass as supplementary context to Stage 5 testing.
|
|
124
|
-
|
|
125
|
-
### Stage 5: Hypothesis Testing
|
|
126
|
-
For each hypothesis (in rank order):
|
|
127
|
-
|
|
128
|
-
1. **Design test**: What specific evidence would confirm or disprove this?
|
|
129
|
-
2. **Execute test**: Code trace, targeted search, data inspection, or experiment
|
|
130
|
-
3. **Record result**: Append to `evidence.ndjson` with `type: "test"`
|
|
131
|
-
4. **Update understanding**: Mark hypothesis as confirmed / disproved / inconclusive
|
|
132
|
-
|
|
133
|
-
```markdown
|
|
134
|
-
## Test Results
|
|
135
|
-
### Hypothesis 1: {claim}
|
|
136
|
-
- Test: {what was done}
|
|
137
|
-
- Result: CONFIRMED / DISPROVED / INCONCLUSIVE
|
|
138
|
-
- Evidence: {file:line references}
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Stage 6: 3-Strike Escalation
|
|
142
|
-
If `--max-hypotheses` hypotheses all fail:
|
|
143
|
-
|
|
144
|
-
1. **Broaden scope**: If scope was restricted, suggest expanding. AskUserQuestion:
|
|
145
|
-
```
|
|
146
|
-
{N} hypotheses tested, none confirmed.
|
|
147
|
-
A) Broaden scope to full project
|
|
148
|
-
B) I have a new hypothesis: [user provides]
|
|
149
|
-
C) Escalate — this needs deeper investigation
|
|
150
|
-
```
|
|
151
|
-
2. **Search wiki for clues**: `maestro wiki search` with alternative keywords
|
|
152
|
-
3. **If still stuck**: Mark as INCONCLUSIVE with what was learned and what remains unknown
|
|
153
|
-
|
|
154
|
-
### Stage 7: Synthesize & Report
|
|
155
|
-
Write final `report.md`:
|
|
156
|
-
|
|
157
|
-
```markdown
|
|
158
|
-
# Investigation Report: {question}
|
|
159
|
-
|
|
160
|
-
## Answer
|
|
161
|
-
{confirmed understanding or "INCONCLUSIVE: ..."}
|
|
162
|
-
|
|
163
|
-
## Evidence Trail
|
|
164
|
-
| # | Type | Source | Relevance | Finding |
|
|
165
|
-
|---|------|--------|-----------|---------|
|
|
166
|
-
| 1 | code | file:line | high | ... |
|
|
167
|
-
|
|
168
|
-
## Hypotheses Tested
|
|
169
|
-
| Hypothesis | Result | Key Evidence |
|
|
170
|
-
|-----------|--------|-------------|
|
|
171
|
-
| ... | confirmed/disproved | file:line |
|
|
172
|
-
|
|
173
|
-
## Key Learnings
|
|
174
|
-
- {learning 1}
|
|
175
|
-
- {learning 2}
|
|
176
|
-
|
|
177
|
-
## Open Questions
|
|
178
|
-
- {what remains unknown}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Stage 8: Persist
|
|
182
|
-
1. Append findings to `lessons.jsonl`:
|
|
183
|
-
- Confirmed hypotheses → `category: "technique"` or `"pattern"`
|
|
184
|
-
- Disproved hypotheses → `category: "gotcha"` (what looked true but wasn't)
|
|
185
|
-
- `source: "investigate"`, tags: `["investigate", "{question-slug}"]`
|
|
186
|
-
- Stable INS-id from `hash("investigate" + question + finding_title)`
|
|
187
|
-
2. Update `learning-index.json`
|
|
188
|
-
3. Display summary with answer and next steps
|
|
189
|
-
|
|
190
|
-
**Next-step routing:**
|
|
191
|
-
- Save finding to specs → `/spec-add debug <finding>`
|
|
192
|
-
- Follow-along on discovered code → `/learn-follow <path>`
|
|
193
|
-
- Decompose patterns found → `/learn-decompose <module>`
|
|
194
|
-
- Create wiki entry for understanding → `maestro wiki create --type note`
|
|
195
|
-
</execution>
|
|
196
|
-
|
|
197
|
-
<error_codes>
|
|
198
|
-
| Code | Severity | Condition | Recovery |
|
|
199
|
-
|------|----------|-----------|----------|
|
|
200
|
-
| E001 | error | No question provided | Provide a question as the first argument |
|
|
201
|
-
| E002 | error | Scope path does not exist | Check --scope path is valid |
|
|
202
|
-
| W001 | warning | No prior knowledge found in wiki/lessons | Proceed with fresh investigation |
|
|
203
|
-
| W002 | warning | Evidence collection found very few matches (<3) | Broaden search terms or expand scope |
|
|
204
|
-
| W003 | warning | All hypotheses inconclusive — escalating | Investigation marked INCONCLUSIVE |
|
|
205
|
-
</error_codes>
|
|
206
|
-
|
|
207
|
-
<success_criteria>
|
|
208
|
-
- [ ] Question parsed and investigation slug generated
|
|
209
|
-
- [ ] Investigation directory created under `.workflow/learning/`
|
|
210
|
-
- [ ] Prior knowledge loaded from wiki and lessons
|
|
211
|
-
- [ ] Evidence collected and logged to `evidence.ndjson` (structured NDJSON)
|
|
212
|
-
- [ ] Pattern matching performed against debug-notes and lessons
|
|
213
|
-
- [ ] At least 1 hypothesis formed and tested
|
|
214
|
-
- [ ] `understanding.md` tracks evolving understanding with timestamps
|
|
215
|
-
- [ ] `report.md` written with answer, evidence trail, hypothesis results
|
|
216
|
-
- [ ] Findings appended to `lessons.jsonl` with stable INS-ids
|
|
217
|
-
- [ ] `learning-index.json` updated
|
|
218
|
-
- [ ] 3-strike escalation triggered if all hypotheses fail
|
|
219
|
-
- [ ] No files modified outside `.workflow/learning/`
|
|
220
|
-
- [ ] Summary displayed with answer and next-step routing
|
|
221
|
-
</success_criteria>
|
|
1
|
+
---
|
|
2
|
+
name: learn-investigate
|
|
3
|
+
description: Investigate questions with hypothesis testing and evidence logging
|
|
4
|
+
argument-hint: "<question> [--scope <path>] [--max-hypotheses N]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Agent
|
|
12
|
+
- AskUserQuestion
|
|
13
|
+
---
|
|
14
|
+
<purpose>
|
|
15
|
+
Systematic investigation workflow for understanding questions (not bug-fixing). Inspired by gstack `/investigate` with its 4-phase approach, scope lock, and 3-strike escalation rule.
|
|
16
|
+
|
|
17
|
+
Unlike `quality-debug` which is designed for fixing bugs during execution phases, this command is for answering "how does X work?", "why does Y happen?", "what would happen if Z?" questions. It produces structured evidence trails and understanding documents that persist to the learning system.
|
|
18
|
+
</purpose>
|
|
19
|
+
|
|
20
|
+
<context>
|
|
21
|
+
Arguments: $ARGUMENTS
|
|
22
|
+
|
|
23
|
+
**Target:** First argument is the question or topic to investigate (quoted string or keywords).
|
|
24
|
+
|
|
25
|
+
**Flags:**
|
|
26
|
+
- `--scope <path>` — Restrict investigation to files under this directory (default: entire project)
|
|
27
|
+
- `--max-hypotheses N` — Maximum hypotheses to test before escalating (default: 3)
|
|
28
|
+
|
|
29
|
+
**Storage written:**
|
|
30
|
+
- `.workflow/learning/investigate-{slug}/evidence.ndjson` — Structured evidence log (one JSON line per evidence)
|
|
31
|
+
- `.workflow/learning/investigate-{slug}/understanding.md` — Evolving understanding document
|
|
32
|
+
- `.workflow/learning/investigate-{slug}/report.md` — Final investigation report
|
|
33
|
+
- `.workflow/learning/lessons.jsonl` — Investigation findings as insights (source: "investigate")
|
|
34
|
+
- `.workflow/learning/learning-index.json` — Updated index
|
|
35
|
+
|
|
36
|
+
**Storage read:**
|
|
37
|
+
- Source files within scope
|
|
38
|
+
- `maestro wiki search "<question>"` — Prior knowledge about the topic
|
|
39
|
+
- `.workflow/learning/lessons.jsonl` — Prior related investigations
|
|
40
|
+
- `.workflow/specs/debug-notes.md` — Known gotchas and patterns
|
|
41
|
+
- `.workflow/codebase/architecture.md` — Structural context (if exists)
|
|
42
|
+
</context>
|
|
43
|
+
|
|
44
|
+
<execution>
|
|
45
|
+
|
|
46
|
+
### Stage 1: Frame the Question
|
|
47
|
+
- Parse question from arguments
|
|
48
|
+
- Determine scope (--scope or full project)
|
|
49
|
+
- Generate investigation slug from question keywords
|
|
50
|
+
- Create `.workflow/learning/investigate-{slug}/` directory
|
|
51
|
+
- Search prior knowledge:
|
|
52
|
+
- `maestro wiki search "<question>"` for related entries
|
|
53
|
+
- Grep `lessons.jsonl` for related insights
|
|
54
|
+
- Read `debug-notes.md` for known gotchas
|
|
55
|
+
|
|
56
|
+
Write initial `understanding.md`:
|
|
57
|
+
```markdown
|
|
58
|
+
# Investigation: {question}
|
|
59
|
+
## Initial Understanding
|
|
60
|
+
- Prior knowledge: {summary of wiki/lessons findings}
|
|
61
|
+
- Scope: {path or "full project"}
|
|
62
|
+
- Started: {timestamp}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Stage 2: Evidence Collection
|
|
66
|
+
Systematically gather evidence related to the question:
|
|
67
|
+
|
|
68
|
+
1. **Code search**: Grep for keywords from the question across the scoped files
|
|
69
|
+
2. **File inspection**: Read the most relevant files identified by search
|
|
70
|
+
3. **Import/dependency tracing**: Follow imports to understand the dependency chain
|
|
71
|
+
4. **Git history**: `git log --oneline -10 -- <relevant-files>` for recent changes
|
|
72
|
+
|
|
73
|
+
For each piece of evidence, append to `evidence.ndjson`:
|
|
74
|
+
```json
|
|
75
|
+
{"ts": "ISO", "type": "code|git|search|doc", "source": "file:line", "relevance": "high|medium|low", "content": "...", "note": "why this matters"}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Stage 3: Pattern Matching
|
|
79
|
+
Compare collected evidence against known patterns:
|
|
80
|
+
- Check `debug-notes.md` entries for matching situations
|
|
81
|
+
- Check `lessons.jsonl` for related technique/pattern/gotcha entries
|
|
82
|
+
- Identify: does this match a documented pattern, or is it novel?
|
|
83
|
+
|
|
84
|
+
Update `understanding.md` with pattern analysis section.
|
|
85
|
+
|
|
86
|
+
### Stage 4: Hypothesis Formation
|
|
87
|
+
From evidence and patterns, generate ranked hypotheses:
|
|
88
|
+
- Each hypothesis: a specific, testable claim about "how/why"
|
|
89
|
+
- Rank by plausibility (evidence strength)
|
|
90
|
+
- Write hypotheses to `understanding.md`
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
## Hypotheses
|
|
94
|
+
1. **[HIGH]** {hypothesis 1} — Evidence: {refs}
|
|
95
|
+
2. **[MEDIUM]** {hypothesis 2} — Evidence: {refs}
|
|
96
|
+
3. **[LOW]** {hypothesis 3} — Evidence: {refs}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Stage 4.5: CLI Supplementary Exploration (optional)
|
|
100
|
+
|
|
101
|
+
**Skip if** no enabled CLI tools or hypotheses are trivially testable.
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
IF no CLI tools enabled: skip to Stage 5
|
|
105
|
+
|
|
106
|
+
hypothesis_summary = hypotheses.map(h => "${h.rank}: ${h.claim}").join("\n")
|
|
107
|
+
|
|
108
|
+
Bash({
|
|
109
|
+
command: 'maestro delegate "PURPOSE: Gather evidence for investigation hypotheses
|
|
110
|
+
TASK: For each hypothesis, trace relevant call chains and data flows | Find corroborating or contradicting code patterns
|
|
111
|
+
MODE: analysis
|
|
112
|
+
CONTEXT: @${scope_path}/**/*
|
|
113
|
+
EXPECTED: JSON array of { hypothesis_rank, evidence: [{ file, line, supports: bool, explanation }] }
|
|
114
|
+
CONSTRAINTS: Focus on code-level evidence only | Max 5 evidence items per hypothesis
|
|
115
|
+
|
|
116
|
+
Hypotheses:
|
|
117
|
+
${hypothesis_summary}
|
|
118
|
+
" --role explore --mode analysis',
|
|
119
|
+
run_in_background: true
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**On callback:** Parse result, append each evidence item to `evidence.ndjson` with `type: "cli-exploration"`. Pass as supplementary context to Stage 5 testing.
|
|
124
|
+
|
|
125
|
+
### Stage 5: Hypothesis Testing
|
|
126
|
+
For each hypothesis (in rank order):
|
|
127
|
+
|
|
128
|
+
1. **Design test**: What specific evidence would confirm or disprove this?
|
|
129
|
+
2. **Execute test**: Code trace, targeted search, data inspection, or experiment
|
|
130
|
+
3. **Record result**: Append to `evidence.ndjson` with `type: "test"`
|
|
131
|
+
4. **Update understanding**: Mark hypothesis as confirmed / disproved / inconclusive
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
## Test Results
|
|
135
|
+
### Hypothesis 1: {claim}
|
|
136
|
+
- Test: {what was done}
|
|
137
|
+
- Result: CONFIRMED / DISPROVED / INCONCLUSIVE
|
|
138
|
+
- Evidence: {file:line references}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Stage 6: 3-Strike Escalation
|
|
142
|
+
If `--max-hypotheses` hypotheses all fail:
|
|
143
|
+
|
|
144
|
+
1. **Broaden scope**: If scope was restricted, suggest expanding. AskUserQuestion:
|
|
145
|
+
```
|
|
146
|
+
{N} hypotheses tested, none confirmed.
|
|
147
|
+
A) Broaden scope to full project
|
|
148
|
+
B) I have a new hypothesis: [user provides]
|
|
149
|
+
C) Escalate — this needs deeper investigation
|
|
150
|
+
```
|
|
151
|
+
2. **Search wiki for clues**: `maestro wiki search` with alternative keywords
|
|
152
|
+
3. **If still stuck**: Mark as INCONCLUSIVE with what was learned and what remains unknown
|
|
153
|
+
|
|
154
|
+
### Stage 7: Synthesize & Report
|
|
155
|
+
Write final `report.md`:
|
|
156
|
+
|
|
157
|
+
```markdown
|
|
158
|
+
# Investigation Report: {question}
|
|
159
|
+
|
|
160
|
+
## Answer
|
|
161
|
+
{confirmed understanding or "INCONCLUSIVE: ..."}
|
|
162
|
+
|
|
163
|
+
## Evidence Trail
|
|
164
|
+
| # | Type | Source | Relevance | Finding |
|
|
165
|
+
|---|------|--------|-----------|---------|
|
|
166
|
+
| 1 | code | file:line | high | ... |
|
|
167
|
+
|
|
168
|
+
## Hypotheses Tested
|
|
169
|
+
| Hypothesis | Result | Key Evidence |
|
|
170
|
+
|-----------|--------|-------------|
|
|
171
|
+
| ... | confirmed/disproved | file:line |
|
|
172
|
+
|
|
173
|
+
## Key Learnings
|
|
174
|
+
- {learning 1}
|
|
175
|
+
- {learning 2}
|
|
176
|
+
|
|
177
|
+
## Open Questions
|
|
178
|
+
- {what remains unknown}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Stage 8: Persist
|
|
182
|
+
1. Append findings to `lessons.jsonl`:
|
|
183
|
+
- Confirmed hypotheses → `category: "technique"` or `"pattern"`
|
|
184
|
+
- Disproved hypotheses → `category: "gotcha"` (what looked true but wasn't)
|
|
185
|
+
- `source: "investigate"`, tags: `["investigate", "{question-slug}"]`
|
|
186
|
+
- Stable INS-id from `hash("investigate" + question + finding_title)`
|
|
187
|
+
2. Update `learning-index.json`
|
|
188
|
+
3. Display summary with answer and next steps
|
|
189
|
+
|
|
190
|
+
**Next-step routing:**
|
|
191
|
+
- Save finding to specs → `/spec-add debug <finding>`
|
|
192
|
+
- Follow-along on discovered code → `/learn-follow <path>`
|
|
193
|
+
- Decompose patterns found → `/learn-decompose <module>`
|
|
194
|
+
- Create wiki entry for understanding → `maestro wiki create --type note`
|
|
195
|
+
</execution>
|
|
196
|
+
|
|
197
|
+
<error_codes>
|
|
198
|
+
| Code | Severity | Condition | Recovery |
|
|
199
|
+
|------|----------|-----------|----------|
|
|
200
|
+
| E001 | error | No question provided | Provide a question as the first argument |
|
|
201
|
+
| E002 | error | Scope path does not exist | Check --scope path is valid |
|
|
202
|
+
| W001 | warning | No prior knowledge found in wiki/lessons | Proceed with fresh investigation |
|
|
203
|
+
| W002 | warning | Evidence collection found very few matches (<3) | Broaden search terms or expand scope |
|
|
204
|
+
| W003 | warning | All hypotheses inconclusive — escalating | Investigation marked INCONCLUSIVE |
|
|
205
|
+
</error_codes>
|
|
206
|
+
|
|
207
|
+
<success_criteria>
|
|
208
|
+
- [ ] Question parsed and investigation slug generated
|
|
209
|
+
- [ ] Investigation directory created under `.workflow/learning/`
|
|
210
|
+
- [ ] Prior knowledge loaded from wiki and lessons
|
|
211
|
+
- [ ] Evidence collected and logged to `evidence.ndjson` (structured NDJSON)
|
|
212
|
+
- [ ] Pattern matching performed against debug-notes and lessons
|
|
213
|
+
- [ ] At least 1 hypothesis formed and tested
|
|
214
|
+
- [ ] `understanding.md` tracks evolving understanding with timestamps
|
|
215
|
+
- [ ] `report.md` written with answer, evidence trail, hypothesis results
|
|
216
|
+
- [ ] Findings appended to `lessons.jsonl` with stable INS-ids
|
|
217
|
+
- [ ] `learning-index.json` updated
|
|
218
|
+
- [ ] 3-strike escalation triggered if all hypotheses fail
|
|
219
|
+
- [ ] No files modified outside `.workflow/learning/`
|
|
220
|
+
- [ ] Summary displayed with answer and next-step routing
|
|
221
|
+
</success_criteria>
|