@alecsibilia/luca 13.0.0-alpha.1
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/LICENSE +201 -0
- package/README.md +47 -0
- package/bin/luca.js +3 -0
- package/dist/chunks/branch.mjs +47 -0
- package/dist/chunks/bun-runtime.mjs +46 -0
- package/dist/chunks/checks.mjs +53 -0
- package/dist/chunks/claim-verify.mjs +465 -0
- package/dist/chunks/classify.mjs +105 -0
- package/dist/chunks/confidence.mjs +199 -0
- package/dist/chunks/doctor.mjs +158 -0
- package/dist/chunks/hook.mjs +696 -0
- package/dist/chunks/init.mjs +715 -0
- package/dist/chunks/muninndb-health.mjs +66 -0
- package/dist/chunks/phase.mjs +38 -0
- package/dist/chunks/pr-review.mjs +122 -0
- package/dist/chunks/preferences.mjs +61 -0
- package/dist/chunks/repair.mjs +111 -0
- package/dist/chunks/repo.mjs +58 -0
- package/dist/chunks/retro.mjs +86 -0
- package/dist/chunks/roadmap.mjs +58 -0
- package/dist/chunks/rules.mjs +527 -0
- package/dist/chunks/stale-mcp-server.mjs +90 -0
- package/dist/chunks/state.mjs +57 -0
- package/dist/chunks/stray-local-install.mjs +200 -0
- package/dist/chunks/telemetry.mjs +165 -0
- package/dist/chunks/todo.mjs +151 -0
- package/dist/chunks/vault-init.mjs +300 -0
- package/dist/chunks/verification.mjs +95 -0
- package/dist/chunks/version.mjs +70 -0
- package/dist/chunks/workflow.mjs +47 -0
- package/dist/claude/.claude/agents/architect.md +410 -0
- package/dist/claude/.claude/agents/build.md +111 -0
- package/dist/claude/.claude/agents/discuss.md +93 -0
- package/dist/claude/.claude/agents/discussion.md +149 -0
- package/dist/claude/.claude/agents/execute.md +416 -0
- package/dist/claude/.claude/agents/executor.md +161 -0
- package/dist/claude/.claude/agents/fast.md +84 -0
- package/dist/claude/.claude/agents/finalize.md +484 -0
- package/dist/claude/.claude/agents/learner.md +160 -0
- package/dist/claude/.claude/agents/plan-reviewer.md +129 -0
- package/dist/claude/.claude/agents/plan.md +96 -0
- package/dist/claude/.claude/agents/research.md +327 -0
- package/dist/claude/.claude/agents/researcher.md +78 -0
- package/dist/claude/.claude/agents/review.md +283 -0
- package/dist/claude/.claude/agents/reviewer.md +163 -0
- package/dist/claude/.claude/agents/shadow-scanner.md +257 -0
- package/dist/claude/.claude/agents/triage.md +230 -0
- package/dist/claude/.claude/agents/verifier.md +131 -0
- package/dist/claude/.claude/commands/bug-diagnose.md +12 -0
- package/dist/claude/.claude/commands/gh-issue-triage.md +14 -0
- package/dist/claude/.claude/commands/gh-pr-address.md +235 -0
- package/dist/claude/.claude/commands/gh-prepare.md +12 -0
- package/dist/claude/.claude/commands/grill-me.md +12 -0
- package/dist/claude/.claude/commands/lu-review.md +51 -0
- package/dist/claude/.claude/commands/lu.md +75 -0
- package/dist/claude/.claude/commands/luca-init.md +14 -0
- package/dist/claude/.claude/commands/luca-telemetry-report.md +12 -0
- package/dist/claude/.claude/commands/memory-audit.md +12 -0
- package/dist/claude/.claude/commands/milestone-new.md +122 -0
- package/dist/claude/.claude/commands/phase-discuss.md +45 -0
- package/dist/claude/.claude/commands/phase-execute.md +39 -0
- package/dist/claude/.claude/commands/phase-plan.md +53 -0
- package/dist/claude/.claude/commands/repo-cleanup.md +80 -0
- package/dist/claude/.claude/commands/todo-add.md +28 -0
- package/dist/claude/.claude/commands/todo-check.md +36 -0
- package/dist/claude/.claude/hooks/context-refresher.ts +285 -0
- package/dist/claude/.claude/hooks/continuation-messages.ts +215 -0
- package/dist/claude/.claude/hooks/pipeline-guard.ts +182 -0
- package/dist/claude/.claude/settings.json +41 -0
- package/dist/claude/skills/arch-audit/SKILL.md +161 -0
- package/dist/claude/skills/autopilot/SKILL.md +1299 -0
- package/dist/claude/skills/bug-diagnose/SKILL.md +102 -0
- package/dist/claude/skills/choose/SKILL.md +124 -0
- package/dist/claude/skills/gh-issue-triage/SKILL.md +97 -0
- package/dist/claude/skills/gh-pr-address/SKILL.md +235 -0
- package/dist/claude/skills/gh-prepare/SKILL.md +209 -0
- package/dist/claude/skills/grill-me/SKILL.md +46 -0
- package/dist/claude/skills/lu/SKILL.md +112 -0
- package/dist/claude/skills/lu-review/SKILL.md +51 -0
- package/dist/claude/skills/luca-init/SKILL.md +91 -0
- package/dist/claude/skills/luca-telemetry-report/SKILL.md +145 -0
- package/dist/claude/skills/luca-write-surface/SKILL.md +213 -0
- package/dist/claude/skills/memory-audit/SKILL.md +217 -0
- package/dist/claude/skills/milestone-audit/SKILL.md +545 -0
- package/dist/claude/skills/milestone-complete/SKILL.md +168 -0
- package/dist/claude/skills/milestone-gaps/SKILL.md +60 -0
- package/dist/claude/skills/milestone-new/SKILL.md +125 -0
- package/dist/claude/skills/note/SKILL.md +162 -0
- package/dist/claude/skills/phase-add/SKILL.md +91 -0
- package/dist/claude/skills/phase-assumptions/SKILL.md +92 -0
- package/dist/claude/skills/phase-discuss/SKILL.md +165 -0
- package/dist/claude/skills/phase-execute/SKILL.md +1786 -0
- package/dist/claude/skills/phase-insert/SKILL.md +100 -0
- package/dist/claude/skills/phase-plan/SKILL.md +461 -0
- package/dist/claude/skills/phase-remove/SKILL.md +113 -0
- package/dist/claude/skills/phase-research/SKILL.md +80 -0
- package/dist/claude/skills/post-init-tour/SKILL.md +58 -0
- package/dist/claude/skills/progress/SKILL.md +271 -0
- package/dist/claude/skills/project-new/SKILL.md +609 -0
- package/dist/claude/skills/quick/SKILL.md +256 -0
- package/dist/claude/skills/rename-audit/SKILL.md +52 -0
- package/dist/claude/skills/repo-audit/SKILL.md +88 -0
- package/dist/claude/skills/repo-cleanup/SKILL.md +80 -0
- package/dist/claude/skills/seed-memory/SKILL.md +235 -0
- package/dist/claude/skills/session-pause/SKILL.md +126 -0
- package/dist/claude/skills/session-plan/SKILL.md +112 -0
- package/dist/claude/skills/session-resume/SKILL.md +75 -0
- package/dist/claude/skills/todo-add/SKILL.md +85 -0
- package/dist/claude/skills/todo-check/SKILL.md +77 -0
- package/dist/claude/skills/workflow-save/SKILL.md +277 -0
- package/dist/index.d.mts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.mjs +69 -0
- package/dist/shared/luca.B3Mimc0P.mjs +52 -0
- package/dist/shared/luca.B3saVjJm.mjs +163 -0
- package/dist/shared/luca.BYdjkfnz.mjs +217 -0
- package/dist/shared/luca.BmhNkYe2.mjs +56 -0
- package/dist/shared/luca.C4gMUoBd.mjs +358 -0
- package/dist/shared/luca.CQ3g1xrD.mjs +19 -0
- package/dist/shared/luca.CRmaAfXR.mjs +713 -0
- package/dist/shared/luca.CrXzXueR.mjs +57 -0
- package/dist/shared/luca.DTomPq7I.mjs +91 -0
- package/dist/shared/luca.DjDTeDCi.mjs +1904 -0
- package/dist/shared/luca.HZxBTBgD.mjs +201 -0
- package/dist/shared/luca.TSMg1t7I.mjs +10 -0
- package/dist/shared/luca.dM-MKlNE.mjs +25 -0
- package/dist/shared/luca.naWEcQ4B.mjs +7 -0
- package/package.json +76 -0
|
@@ -0,0 +1,1299 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: autopilot
|
|
3
|
+
description: Autonomous orchestrator that drives backlog, roadmap, plan, execute, and milestone workflows with configurable oversight.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<main>
|
|
7
|
+
# Luca Autopilot
|
|
8
|
+
|
|
9
|
+
Autonomous orchestrator that drives the full Luca workflow: backlog scan, WSJF prioritization, roadmap revision, phase planning, execution, and milestone completion — with configurable human oversight levels.
|
|
10
|
+
|
|
11
|
+
**Arguments:** `[--oversight=flagged|milestone|phase|full-auto] [--skip-backlog] [--max-phases=N] [--no-swarm] [--dry-run]`
|
|
12
|
+
|
|
13
|
+
## Sub-agent/Sub-skill Delegation Requirements
|
|
14
|
+
|
|
15
|
+
This skill is a **meta-orchestrator**. It chains other SKILLS and AGENTS in an autonomous loop.
|
|
16
|
+
|
|
17
|
+
**Sub-skills invoked (via Skill tool):**
|
|
18
|
+
|
|
19
|
+
- `phase-discuss` — Context gathering for all phases (depth scales with complexity)
|
|
20
|
+
- `phase-plan` — Auto-generate plan.md files for phases
|
|
21
|
+
- `phase-execute` — Full execution pipeline (waves, harness, verification, code review)
|
|
22
|
+
- `milestone-complete` — Archive and complete milestones
|
|
23
|
+
- `milestone-new` — Start new milestones (if cross_milestone enabled)
|
|
24
|
+
- `git-commit` — Commit orchestrator-level changes
|
|
25
|
+
|
|
26
|
+
**Sub-agents spawned (via Task tool):**
|
|
27
|
+
|
|
28
|
+
- `lu-cognition` — Cognitive pre-flight at session start
|
|
29
|
+
- `lu-router` — Classify complexity for each phase
|
|
30
|
+
- `lu-pm-planner` — WSJF scoring and backlog prioritization (fallback for `--no-swarm` roadmap revision)
|
|
31
|
+
- `lu-roadmap-architect` — Architectural impact analysis for roadmap revision (swarm specialist)
|
|
32
|
+
- `lu-roadmap-prioritizer` — WSJF scoring and milestone scoping for roadmap revision (swarm specialist)
|
|
33
|
+
- `lu-roadmap-qa` — Testing gap analysis and QA impact for roadmap revision (swarm specialist)
|
|
34
|
+
- `lu-roadmap-synthesizer` — Merges specialist analyses into unified roadmap proposal (swarm synthesizer)
|
|
35
|
+
|
|
36
|
+
**CRITICAL — WORKFLOW COMPLIANCE IS MANDATORY:**
|
|
37
|
+
|
|
38
|
+
1. You are an **orchestrator**. Do NOT execute plans, verify code, or review code yourself. Invoke the appropriate sub-skills and sub-agents as described below.
|
|
39
|
+
2. **Every step in this skill spec is a binding instruction, not a suggestion.** You MUST NOT skip, simplify, or substitute workflow steps — even if you believe an alternative approach would produce equivalent results. The workflow exists because specific tool usage (TeamCreate, SendMessage, Skill, Task) was intentionally designed and validated.
|
|
40
|
+
3. **If a step says to use TeamCreate, you MUST use TeamCreate.** If a step says to use Skill, you MUST use Skill. Do not replace TeamCreate with parallel Task calls. Do not replace sub-agent delegation with self-performed analysis. Do not rationalize deviations with "functionally equivalent" reasoning.
|
|
41
|
+
4. **The only valid way to skip a step is when the spec explicitly provides a skip condition** (e.g., complexity gating, `--no-swarm` flag, oversight level). If no skip condition is documented, the step is mandatory.
|
|
42
|
+
</main>
|
|
43
|
+
|
|
44
|
+
<configuration>
|
|
45
|
+
## Step 0: Configuration & Pre-Flight
|
|
46
|
+
|
|
47
|
+
### 0a. Read Autopilot Config
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
CONFIG=$(cat .luca/config.json 2>/dev/null || echo '{}')
|
|
51
|
+
# Read workflow state from .luca/state.json via the luca CLI
|
|
52
|
+
STATE_JSON=$(luca state read 2>/dev/null || echo '{"initialized":false}')
|
|
53
|
+
ROADMAP=$(cat .luca/roadmap.md 2>/dev/null || echo "")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Extract autopilot settings (with defaults):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
OVERSIGHT=$(echo "$CONFIG" | bun -e "
|
|
60
|
+
const c = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
|
|
61
|
+
console.log(c.autopilot?.oversight ?? 'milestone');
|
|
62
|
+
")
|
|
63
|
+
MAX_PHASES=$(echo "$CONFIG" | bun -e "
|
|
64
|
+
const c = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
|
|
65
|
+
console.log(c.autopilot?.max_phases_per_session ?? 10);
|
|
66
|
+
")
|
|
67
|
+
AUTO_PLAN=$(echo "$CONFIG" | bun -e "
|
|
68
|
+
const c = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
|
|
69
|
+
console.log(c.autopilot?.auto_plan_phases ?? true);
|
|
70
|
+
")
|
|
71
|
+
SKIP_UAT=$(echo "$CONFIG" | bun -e "
|
|
72
|
+
const c = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
|
|
73
|
+
console.log(c.autopilot?.skip_uat_in_autopilot ?? true);
|
|
74
|
+
")
|
|
75
|
+
GAP_RETRIES=$(echo "$CONFIG" | bun -e "
|
|
76
|
+
const c = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
|
|
77
|
+
console.log(c.autopilot?.gap_closure_retries ?? 1);
|
|
78
|
+
")
|
|
79
|
+
CROSS_MILESTONE=$(echo "$CONFIG" | bun -e "
|
|
80
|
+
const c = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
|
|
81
|
+
console.log(c.autopilot?.cross_milestone ?? false);
|
|
82
|
+
")
|
|
83
|
+
BACKLOG_SCAN=$(echo "$CONFIG" | bun -e "
|
|
84
|
+
const c = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
|
|
85
|
+
console.log(c.autopilot?.backlog_scan ?? true);
|
|
86
|
+
")
|
|
87
|
+
SWARM_ENABLED=$(echo "$CONFIG" | bun -e "
|
|
88
|
+
const c = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
|
|
89
|
+
console.log(c.autopilot?.swarm_enabled ?? true);
|
|
90
|
+
")
|
|
91
|
+
MAX_PARALLEL=$(echo "$CONFIG" | bun -e "
|
|
92
|
+
const c = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
|
|
93
|
+
console.log(c.autopilot?.max_parallel_phases ?? 3);
|
|
94
|
+
")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 0b. Apply CLI Flag Overrides
|
|
98
|
+
|
|
99
|
+
- If `--oversight=<level>` passed: override OVERSIGHT
|
|
100
|
+
- If `--max-phases=N` passed: override MAX_PHASES
|
|
101
|
+
- If `--skip-backlog` passed: set BACKLOG_SCAN=false
|
|
102
|
+
- If `--no-swarm` passed: set SWARM_ENABLED=false (force serial execution)
|
|
103
|
+
- If `--dry-run` passed: set DRY_RUN=true (display plan, don't execute)
|
|
104
|
+
|
|
105
|
+
### 0c. Cognitive Pre-Flight
|
|
106
|
+
|
|
107
|
+
Unless the session already has cognitive context loaded:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
Task(
|
|
111
|
+
agent: "lu-cognition",
|
|
112
|
+
prompt: "Run cognitive pre-flight for autopilot session. Load project identity via mcp__muninn__muninn_recall_tree(vault: 'default', id: 'brain:project-identity'). Recall relevant patterns via mcp__muninn__muninn_recall(vault: 'default', context: 'relevant patterns and decisions for planning and workflow'). Clear previous session context via mcp__muninn__muninn_forget(vault: 'default', id: 'session:*')."
|
|
113
|
+
)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 0d. Display Session Start & Initialize State Machine
|
|
117
|
+
|
|
118
|
+
Advance the workflow from `idle` to `triage` (the canonical entry point — the legacy "preflight" step is folded into `triage` in v13):
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
luca state advance --to-step triage 2>/dev/null || true
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
126
|
+
Luca AUTOPILOT ► SESSION START
|
|
127
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
128
|
+
|
|
129
|
+
Oversight: {OVERSIGHT}
|
|
130
|
+
Max phases: {MAX_PHASES}
|
|
131
|
+
Auto-plan: {AUTO_PLAN}
|
|
132
|
+
Backlog scan: {BACKLOG_SCAN}
|
|
133
|
+
Cross-milestone: {CROSS_MILESTONE}
|
|
134
|
+
Swarm: {SWARM_ENABLED} (max {MAX_PARALLEL} parallel)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
After cognitive pre-flight completes, advance to the next pipeline step. The exact target depends on classification; in v13 the canonical sequence is `triage → research → discuss → architect → plan`:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
luca state advance --to-step research 2>/dev/null || true
|
|
141
|
+
```
|
|
142
|
+
</configuration>
|
|
143
|
+
|
|
144
|
+
<backlog_scan>
|
|
145
|
+
## Step 1: Backlog Scan & Unplanned Detection
|
|
146
|
+
|
|
147
|
+
**Skip if:** `--skip-backlog` passed OR `BACKLOG_SCAN=false`
|
|
148
|
+
|
|
149
|
+
### 1a. Read Pending Todos
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
TODOS=$(luca todo list --status pending 2>/dev/null || echo "")
|
|
153
|
+
TODO_COUNT=$(echo "$TODOS" | grep -c '.' 2>/dev/null || echo "0")
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Backlog state is MuninnDB-backed; `luca todo list` is the canonical read surface.
|
|
157
|
+
|
|
158
|
+
If TODO_COUNT == 0: Skip to Step 3 (execute existing roadmap).
|
|
159
|
+
|
|
160
|
+
### 1b. Read roadmap.md
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
ROADMAP_CONTENT=$(cat .luca/roadmap.md 2>/dev/null || echo "")
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 1c. Detect Unplanned Work
|
|
167
|
+
|
|
168
|
+
For each todo returned by `luca todo list --status pending`:
|
|
169
|
+
|
|
170
|
+
1. Read the todo's title + area + body from the JSON output (or via `muninn_read --id <todo-id>`)
|
|
171
|
+
2. Search ROADMAP_CONTENT for any reference to:
|
|
172
|
+
- The todo's title (case-insensitive substring match)
|
|
173
|
+
- The todo's slug / id
|
|
174
|
+
3. If neither found: classify as **unplanned**
|
|
175
|
+
4. If found in a phase with `- [ ]` plans: classify as **planned but incomplete** (normal)
|
|
176
|
+
|
|
177
|
+
### 1d. Display Backlog Summary
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
181
|
+
Luca AUTOPILOT ► BACKLOG SCAN
|
|
182
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
183
|
+
|
|
184
|
+
◆ {TODO_COUNT} pending todos found
|
|
185
|
+
◆ {UNPLANNED_COUNT} not yet in roadmap
|
|
186
|
+
◆ {PLANNED_INCOMPLETE} in roadmap, incomplete
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
If UNPLANNED_COUNT == 0: Skip to Step 3.
|
|
190
|
+
</backlog_scan>
|
|
191
|
+
|
|
192
|
+
<roadmap_revision>
|
|
193
|
+
## Step 2: Roadmap Revision
|
|
194
|
+
|
|
195
|
+
**Only runs when unplanned todos exist (Step 1c found UNPLANNED_COUNT > 0).**
|
|
196
|
+
|
|
197
|
+
### 2a. Analyze Pending Todos
|
|
198
|
+
|
|
199
|
+
Read all todo contents for the prompt:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
TODO_CONTENTS=$(luca todo list --status pending --format json)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Branch based on SWARM_ENABLED:**
|
|
206
|
+
|
|
207
|
+
> **MANDATORY ROUTING — DO NOT SKIP OR SUBSTITUTE:**
|
|
208
|
+
> The path below is determined by the SWARM_ENABLED flag. If SWARM_ENABLED == true (the default), you MUST follow Path B and use TeamCreate to create a formal agent team. You MUST NOT substitute parallel Task calls for TeamCreate — they are not equivalent. The team infrastructure (TeamCreate, SendMessage, shared task lists) exists for coordination, auditability, and architectural consistency. Path A is ONLY valid when `--no-swarm` is explicitly passed or `swarm_enabled: false` is set in config.json.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
#### Path A: Single-Agent (--no-swarm fallback)
|
|
213
|
+
|
|
214
|
+
**If SWARM_ENABLED == false:** Use the original single lu-pm-planner agent path.
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
Task(
|
|
218
|
+
agent: "lu-pm-planner",
|
|
219
|
+
prompt: """
|
|
220
|
+
<planning_context>
|
|
221
|
+
**Mode:** roadmap-revision (extended)
|
|
222
|
+
|
|
223
|
+
**All Pending Todos:**
|
|
224
|
+
{TODO_CONTENTS}
|
|
225
|
+
|
|
226
|
+
**Current roadmap.md:**
|
|
227
|
+
{ROADMAP_CONTENT}
|
|
228
|
+
|
|
229
|
+
**Current workflow state (from `luca state read`):**
|
|
230
|
+
{STATE_CONTENT}
|
|
231
|
+
|
|
232
|
+
**Instructions:**
|
|
233
|
+
1. Score ALL pending todos by WSJF (Business Value + Time Criticality + Risk Reduction / Effort)
|
|
234
|
+
2. For todos already referenced in roadmap.md: validate their current priority ordering
|
|
235
|
+
3. For unplanned todos (not referenced in ROADMAP):
|
|
236
|
+
a. Determine if the todo fits the scope of an existing incomplete phase
|
|
237
|
+
b. If yes: recommend adding it to that phase
|
|
238
|
+
c. If no: group related unplanned todos into proposed new phases with goals
|
|
239
|
+
d. If a todo is COMPLEX/CRITICAL or architecturally distinct: flag it for potential new milestone
|
|
240
|
+
4. Return a revised phase ordering with WSJF rationale
|
|
241
|
+
5. Provide dependency recommendations for new phases
|
|
242
|
+
|
|
243
|
+
**Output:** ResultEnvelope with:
|
|
244
|
+
- status: "success"
|
|
245
|
+
- summary: Human-readable revision proposal
|
|
246
|
+
- artifacts: Each proposed change (new phases, reordered phases, todos absorbed)
|
|
247
|
+
- issues: Any warnings (dependency conflicts, milestone-worthy items, estimation uncertainty)
|
|
248
|
+
</planning_context>
|
|
249
|
+
"""
|
|
250
|
+
)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Skip to Step 2b with the lu-pm-planner's ResultEnvelope.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
#### Path B: Team-Based Swarm (default)
|
|
258
|
+
|
|
259
|
+
**If SWARM_ENABLED == true (default):** Use a 3-specialist + 1-synthesizer swarm for richer analysis.
|
|
260
|
+
|
|
261
|
+
##### 2a-swarm-i. Create Roadmap Revision Team
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
TeamCreate(
|
|
265
|
+
team_name: "roadmap-revision-{timestamp}",
|
|
266
|
+
description: "Specialist swarm for roadmap revision analysis"
|
|
267
|
+
)
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Create 3 tasks for the specialist agents:
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
TaskCreate(
|
|
274
|
+
subject: "Architectural impact analysis",
|
|
275
|
+
description: "Analyze pending todos for architectural risk, dependency ordering, and domain boundary impact",
|
|
276
|
+
activeForm: "Analyzing architecture impact"
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
TaskCreate(
|
|
280
|
+
subject: "WSJF scoring and prioritization",
|
|
281
|
+
description: "Score pending todos by WSJF and recommend phase absorption, new phases, or milestones",
|
|
282
|
+
activeForm: "Scoring todos by WSJF"
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
TaskCreate(
|
|
286
|
+
subject: "QA and testing gap analysis",
|
|
287
|
+
description: "Assess QA impact, testing gaps, tech debt severity, and verification requirements",
|
|
288
|
+
activeForm: "Analyzing QA impact"
|
|
289
|
+
)
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
##### 2a-swarm-ii. Spawn 3 Specialists in Parallel
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
Task(
|
|
296
|
+
team_name: "roadmap-revision-{timestamp}",
|
|
297
|
+
name: "architect",
|
|
298
|
+
subagent_type: "lu-roadmap-architect",
|
|
299
|
+
prompt: """
|
|
300
|
+
You are a roadmap architect specialist (lu-roadmap-architect role).
|
|
301
|
+
|
|
302
|
+
**All Pending Todos:**
|
|
303
|
+
{TODO_CONTENTS}
|
|
304
|
+
|
|
305
|
+
**Current roadmap.md:**
|
|
306
|
+
{ROADMAP_CONTENT}
|
|
307
|
+
|
|
308
|
+
**Current workflow state (from `luca state read`):**
|
|
309
|
+
{STATE_CONTENT}
|
|
310
|
+
|
|
311
|
+
**Instructions:**
|
|
312
|
+
1. Read all pending todos and the current roadmap
|
|
313
|
+
2. Explore the src/ directory structure to understand domain layout and dependency tiers (T0-T3)
|
|
314
|
+
3. For each todo, assess: domain boundary impact, dependency tier implications, cross-cutting concerns, circular dependency risk
|
|
315
|
+
4. Rate each todo: LOW / MEDIUM / HIGH architectural risk
|
|
316
|
+
5. Recommend phase placement and ordering constraints
|
|
317
|
+
6. Send your complete ResultEnvelope to the lead via SendMessage
|
|
318
|
+
|
|
319
|
+
**READ-ONLY:** Do NOT create, modify, or delete files. Output analysis only.
|
|
320
|
+
**Output:** ResultEnvelope JSON with status, summary, artifacts (per-todo risk + placement), issues (warnings)
|
|
321
|
+
"""
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
Task(
|
|
325
|
+
team_name: "roadmap-revision-{timestamp}",
|
|
326
|
+
name: "prioritizer",
|
|
327
|
+
subagent_type: "lu-roadmap-prioritizer",
|
|
328
|
+
prompt: """
|
|
329
|
+
You are a roadmap prioritizer specialist (lu-roadmap-prioritizer role).
|
|
330
|
+
|
|
331
|
+
**All Pending Todos:**
|
|
332
|
+
{TODO_CONTENTS}
|
|
333
|
+
|
|
334
|
+
**Current roadmap.md:**
|
|
335
|
+
{ROADMAP_CONTENT}
|
|
336
|
+
|
|
337
|
+
**Current workflow state (from `luca state read`):**
|
|
338
|
+
{STATE_CONTENT}
|
|
339
|
+
|
|
340
|
+
**Instructions:**
|
|
341
|
+
1. Read all pending todos and the current roadmap
|
|
342
|
+
2. Score each todo using WSJF: (Business Value + Time Criticality + Risk Reduction) / Effort
|
|
343
|
+
3. Effort mapping: TRIVIAL=1, SIMPLE=2, MODERATE=3, COMPLEX=5, CRITICAL=8
|
|
344
|
+
4. For each todo, recommend: absorb (into which phase), new-phase (with goal), or new-milestone
|
|
345
|
+
5. Rank all todos by WSJF descending
|
|
346
|
+
6. Send your complete ResultEnvelope to the lead via SendMessage
|
|
347
|
+
|
|
348
|
+
**READ-ONLY:** Do NOT create, modify, or delete files. Output analysis only.
|
|
349
|
+
**Output:** ResultEnvelope JSON with status, summary, artifacts (per-todo WSJF + action), issues (warnings)
|
|
350
|
+
"""
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
Task(
|
|
354
|
+
team_name: "roadmap-revision-{timestamp}",
|
|
355
|
+
name: "qa-analyst",
|
|
356
|
+
subagent_type: "lu-roadmap-qa",
|
|
357
|
+
prompt: """
|
|
358
|
+
You are a roadmap QA specialist (lu-roadmap-qa role).
|
|
359
|
+
|
|
360
|
+
**All Pending Todos:**
|
|
361
|
+
{TODO_CONTENTS}
|
|
362
|
+
|
|
363
|
+
**Current roadmap.md:**
|
|
364
|
+
{ROADMAP_CONTENT}
|
|
365
|
+
|
|
366
|
+
**Current workflow state (from `luca state read`):**
|
|
367
|
+
{STATE_CONTENT}
|
|
368
|
+
|
|
369
|
+
**Instructions:**
|
|
370
|
+
1. Read all pending todos and the current roadmap
|
|
371
|
+
2. Survey test infrastructure: Glob for __tests__/**/*.test.ts, read bunfig.toml
|
|
372
|
+
3. For each todo, assess: affected test suites, testing gaps, tech debt severity, CI/CD impact, verification requirements
|
|
373
|
+
4. Rate each todo: LOW / MEDIUM / HIGH QA impact
|
|
374
|
+
5. Recommend verification mode per todo: Quick / Standard / Full / Full+Human
|
|
375
|
+
6. Send your complete ResultEnvelope to the lead via SendMessage
|
|
376
|
+
|
|
377
|
+
**READ-ONLY:** Do NOT create, modify, or delete files. Output analysis only.
|
|
378
|
+
**Output:** ResultEnvelope JSON with status, summary, artifacts (per-todo QA impact + verification), issues (warnings)
|
|
379
|
+
"""
|
|
380
|
+
)
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
##### 2a-swarm-iii. Collect Specialist Results
|
|
384
|
+
|
|
385
|
+
Wait for all 3 specialists to send their ResultEnvelopes (10-minute timeout per specialist).
|
|
386
|
+
|
|
387
|
+
**Graceful degradation:**
|
|
388
|
+
- If 1 specialist times out or errors: proceed with 2 specialist outputs, note the gap
|
|
389
|
+
- If 2 specialists time out: proceed with 1 output, set confidence to LOW
|
|
390
|
+
- If all 3 fail: fall back to Path A (single lu-pm-planner)
|
|
391
|
+
|
|
392
|
+
##### 2a-swarm-iv. Spawn Synthesizer
|
|
393
|
+
|
|
394
|
+
After collecting specialist outputs, spawn the synthesizer with all results:
|
|
395
|
+
|
|
396
|
+
```
|
|
397
|
+
Task(
|
|
398
|
+
team_name: "roadmap-revision-{timestamp}",
|
|
399
|
+
name: "synthesizer",
|
|
400
|
+
subagent_type: "lu-roadmap-synthesizer",
|
|
401
|
+
prompt: """
|
|
402
|
+
You are a roadmap synthesizer (lu-roadmap-synthesizer role).
|
|
403
|
+
|
|
404
|
+
**Architect Analysis:**
|
|
405
|
+
{ARCHITECT_RESULT}
|
|
406
|
+
|
|
407
|
+
**Prioritizer Analysis:**
|
|
408
|
+
{PRIORITIZER_RESULT}
|
|
409
|
+
|
|
410
|
+
**QA Analysis:**
|
|
411
|
+
{QA_RESULT}
|
|
412
|
+
|
|
413
|
+
**Current roadmap.md:**
|
|
414
|
+
{ROADMAP_CONTENT}
|
|
415
|
+
|
|
416
|
+
**Instructions:**
|
|
417
|
+
1. Cross-reference all 3 specialist analyses per todo
|
|
418
|
+
2. Resolve conflicts (priority vs architecture, priority vs QA)
|
|
419
|
+
3. Build unified phase ordering: architectural prerequisites first, then high-WSJF items
|
|
420
|
+
4. Group related todos into phases based on domain affinity, effort similarity, shared test requirements
|
|
421
|
+
5. Assign verification modes per phase based on QA analysis
|
|
422
|
+
6. Flag milestone-worthy items
|
|
423
|
+
7. Produce a unified ResultEnvelope matching the format Step 2b expects
|
|
424
|
+
|
|
425
|
+
**Conflict resolution rules:**
|
|
426
|
+
- Architecture safety > WSJF priority (isolate HIGH-risk items even if prioritizer says absorb)
|
|
427
|
+
- QA prerequisites > priority ordering (test infrastructure before consumers)
|
|
428
|
+
- When architect + QA both flag HIGH: strongly recommend isolation + Full verification
|
|
429
|
+
|
|
430
|
+
**READ-ONLY:** Do NOT create, modify, or delete files. Output analysis only.
|
|
431
|
+
**Output:** ResultEnvelope JSON with:
|
|
432
|
+
- status: "success"
|
|
433
|
+
- summary: Human-readable revision proposal with change table
|
|
434
|
+
- artifacts: Each proposed change (new phases, reordered phases, todos absorbed)
|
|
435
|
+
- issues: All specialist warnings + synthesis-level concerns
|
|
436
|
+
"""
|
|
437
|
+
)
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
##### 2a-swarm-v. Cleanup and Continue
|
|
441
|
+
|
|
442
|
+
1. Shutdown all teammates:
|
|
443
|
+
```
|
|
444
|
+
SendMessage(type: "shutdown_request", recipient: "architect")
|
|
445
|
+
SendMessage(type: "shutdown_request", recipient: "prioritizer")
|
|
446
|
+
SendMessage(type: "shutdown_request", recipient: "qa-analyst")
|
|
447
|
+
SendMessage(type: "shutdown_request", recipient: "synthesizer")
|
|
448
|
+
TeamDelete()
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
2. Feed the synthesizer's ResultEnvelope into Step 2b (unchanged).
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
### 2b. Present Proposed Changes
|
|
456
|
+
|
|
457
|
+
Display the proposal ResultEnvelope:
|
|
458
|
+
|
|
459
|
+
```
|
|
460
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
461
|
+
Luca AUTOPILOT ► ROADMAP REVISION PROPOSAL
|
|
462
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
463
|
+
|
|
464
|
+
{summary from proposal ResultEnvelope}
|
|
465
|
+
|
|
466
|
+
| Change | Detail |
|
|
467
|
+
|--------|--------|
|
|
468
|
+
| New phases | {count} proposed |
|
|
469
|
+
| Reordered | {count} phases |
|
|
470
|
+
| Absorbed | {count} todos into existing phases |
|
|
471
|
+
| Flagged | {count} items for new milestone |
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### 2c. Oversight Gate: Approve Changes
|
|
475
|
+
|
|
476
|
+
- If OVERSIGHT == "full-auto" or "flagged": auto-approve all changes
|
|
477
|
+
- If OVERSIGHT == "milestone" or "phase": present changes and ask:
|
|
478
|
+
|
|
479
|
+
```
|
|
480
|
+
Options:
|
|
481
|
+
1. Approve all — Apply proposed changes to roadmap.md
|
|
482
|
+
2. Review details — Show full breakdown of each change
|
|
483
|
+
3. Approve with modifications — Let me adjust before applying
|
|
484
|
+
4. Skip — Proceed with existing roadmap (ignore unplanned work)
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
### 2d. Apply Changes
|
|
488
|
+
|
|
489
|
+
If approved:
|
|
490
|
+
1. Update roadmap.md with new/reordered phases
|
|
491
|
+
2. Create phase directories for new phases: `mkdir -p .luca/phases/{NN}-{phase-name}`
|
|
492
|
+
3. Commit changes:
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
git add .luca/roadmap.md .luca/phases/
|
|
496
|
+
bun run commit --message="revise roadmap with unplanned backlog items" --type=docs --scope=autopilot --no-push --skip-checks
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### 2e. GitHub Issue & Branch
|
|
500
|
+
|
|
501
|
+
**After applying roadmap changes, ensure a GitHub issue and feature branch exist for the milestone.**
|
|
502
|
+
|
|
503
|
+
Read workflow state and check for an existing GitHub issue/ticket reference (issue metadata lives in MuninnDB `session:*` engrams, not in `.luca/state.json`):
|
|
504
|
+
|
|
505
|
+
\`\`\`bash
|
|
506
|
+
STATE_JSON=$(luca state read 2>/dev/null || echo '{"initialized":false}')
|
|
507
|
+
# Recall any session-bound GitHub issue ref:
|
|
508
|
+
# mcp__muninn__muninn_recall(vault: "<repo_vault>", context: "GitHub issue for current milestone", tags: ["session","github"])
|
|
509
|
+
\`\`\`
|
|
510
|
+
|
|
511
|
+
**If no issue exists:**
|
|
512
|
+
|
|
513
|
+
- If OVERSIGHT == "full-auto" or "flagged": auto-create issue and branch
|
|
514
|
+
- If OVERSIGHT == "milestone" or "phase": present options (Create / Skip / Abort)
|
|
515
|
+
|
|
516
|
+
**Auto-create flow:**
|
|
517
|
+
|
|
518
|
+
1. Extract milestone name from roadmap.md (e.g., "v1.4.0 — Developer Experience & Verification")
|
|
519
|
+
2. Generate issue body from roadmap.md summary + MuninnDB recall (`mcp__muninn__muninn_recall_tree(vault: '<repo_vault>', id: 'brain:project-requirements')`)
|
|
520
|
+
3. Create issue:
|
|
521
|
+
```bash
|
|
522
|
+
gh issue create --title "feat(framework): {milestone-name}" --body "{body}"
|
|
523
|
+
```
|
|
524
|
+
4. Extract issue number from output
|
|
525
|
+
5. Create feature branch:
|
|
526
|
+
```bash
|
|
527
|
+
git checkout -b {issue_number}--{milestone-slug}
|
|
528
|
+
```
|
|
529
|
+
6. Push branch:
|
|
530
|
+
```bash
|
|
531
|
+
git push -u origin {branch_name}
|
|
532
|
+
```
|
|
533
|
+
7. Record the issue and branch references in MuninnDB so the active session has durable context:
|
|
534
|
+
\`\`\`
|
|
535
|
+
mcp__muninn__muninn_remember(
|
|
536
|
+
vault: "<repo_vault>",
|
|
537
|
+
concept: "session:autopilot-milestone",
|
|
538
|
+
content: "GitHub issue #{issue_number} / branch {branch_name} — autopilot milestone",
|
|
539
|
+
tags: ["session","autopilot","github"]
|
|
540
|
+
)
|
|
541
|
+
\`\`\`
|
|
542
|
+
|
|
543
|
+
**If issue already exists:**
|
|
544
|
+
|
|
545
|
+
- Verify it is still open: `gh issue view {number} --json state`
|
|
546
|
+
- Ensure we are on the correct feature branch
|
|
547
|
+
- If not on feature branch: `git checkout {branch_name}` or create it
|
|
548
|
+
- Continue to Step 3
|
|
549
|
+
</roadmap_revision>
|
|
550
|
+
|
|
551
|
+
<execution_order>
|
|
552
|
+
## Step 3: Determine Execution Order
|
|
553
|
+
|
|
554
|
+
### 3a. Parse Incomplete Phases
|
|
555
|
+
|
|
556
|
+
Re-read roadmap.md (may have been updated in Step 2):
|
|
557
|
+
|
|
558
|
+
```bash
|
|
559
|
+
ROADMAP=$(cat .luca/roadmap.md)
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
For each phase in roadmap.md:
|
|
563
|
+
1. Check if ALL plans are marked `[x]` — if so, phase is complete, skip it
|
|
564
|
+
2. Check if any plans are marked `[ ]` — phase has incomplete work
|
|
565
|
+
3. Check if no plans are listed — phase needs planning (plan.md generation)
|
|
566
|
+
4. Build list of incomplete phases
|
|
567
|
+
|
|
568
|
+
### 3b. Build Dependency Graph
|
|
569
|
+
|
|
570
|
+
For each incomplete phase, extract `**Depends on:**` line:
|
|
571
|
+
- Parse phase numbers from the dependency reference
|
|
572
|
+
- Build adjacency list: phase -> [dependent phases]
|
|
573
|
+
|
|
574
|
+
### 3c. Topological Sort
|
|
575
|
+
|
|
576
|
+
Sort phases respecting dependencies:
|
|
577
|
+
- Phases with no dependencies come first
|
|
578
|
+
- Phases whose dependencies are all complete come next
|
|
579
|
+
- Phases with incomplete dependencies are deferred until their dependencies complete
|
|
580
|
+
|
|
581
|
+
### 3d. Group Independent Phases (Swarm Detection)
|
|
582
|
+
|
|
583
|
+
If SWARM_ENABLED == true:
|
|
584
|
+
|
|
585
|
+
Group phases into "levels" based on the dependency DAG:
|
|
586
|
+
- **Level 0**: phases with no dependencies (or all deps already complete)
|
|
587
|
+
- **Level 1**: phases whose only dependencies are Level 0 phases
|
|
588
|
+
- **Level N**: phases whose dependencies are all in levels 0..N-1
|
|
589
|
+
|
|
590
|
+
For each level with 2+ phases:
|
|
591
|
+
- Mark as **PARALLEL** — will use agent team
|
|
592
|
+
- Cap group size at MAX_PARALLEL (excess phases overflow to a new group at the same level)
|
|
593
|
+
|
|
594
|
+
For each level with 1 phase:
|
|
595
|
+
- Mark as **SERIAL** — will execute normally via existing Steps 4a-4i
|
|
596
|
+
|
|
597
|
+
If SWARM_ENABLED == false:
|
|
598
|
+
- Every level contains exactly 1 phase — all execution is serial
|
|
599
|
+
|
|
600
|
+
### 3e. Apply Max Phases Limit
|
|
601
|
+
|
|
602
|
+
If MAX_PHASES is set and total phase count across all levels exceeds it:
|
|
603
|
+
- Truncate levels to fit within MAX_PHASES
|
|
604
|
+
- Note deferred phases in log
|
|
605
|
+
|
|
606
|
+
### 3f. Display Execution Plan
|
|
607
|
+
|
|
608
|
+
```
|
|
609
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
610
|
+
Luca AUTOPILOT ► EXECUTION PLAN
|
|
611
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
612
|
+
|
|
613
|
+
| Level | Phases | Mode | Depends On |
|
|
614
|
+
|-------|--------|------|------------|
|
|
615
|
+
| 0 | Phase 87, 88, 89 | PARALLEL (team) | None |
|
|
616
|
+
| 1 | Phase 90 | SERIAL | Level 0 |
|
|
617
|
+
| 2 | Phase 91, 92 | PARALLEL (team) | Level 1 |
|
|
618
|
+
|
|
619
|
+
Total: {N} phases across {L} levels
|
|
620
|
+
Parallel levels: {P} (will use agent teams)
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
If `--dry-run`: Display this plan and EXIT. Do not proceed to execution.
|
|
624
|
+
</execution_order>
|
|
625
|
+
|
|
626
|
+
<phase_loop>
|
|
627
|
+
## Step 4: Level-Based Execution Loop
|
|
628
|
+
|
|
629
|
+
**Initialize tracking state:**
|
|
630
|
+
|
|
631
|
+
```
|
|
632
|
+
COMPLETED_PHASES=[]
|
|
633
|
+
PARKED_PHASES=[]
|
|
634
|
+
LEVEL_INDEX=0
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
**For each level in execution_levels (from Step 3d):**
|
|
638
|
+
|
|
639
|
+
Check the level's mode:
|
|
640
|
+
- If **SERIAL** (1 phase): execute via Steps 4a-4i (existing serial path)
|
|
641
|
+
- If **PARALLEL** (2+ phases, SWARM_ENABLED): execute via Steps 4-swarm-a through 4-swarm-h
|
|
642
|
+
|
|
643
|
+
> **MANDATORY:** When the level mode is PARALLEL, you MUST use TeamCreate to create an agent team and spawn teammates via Task with `team_name`. Do NOT substitute with individual Task calls or attempt to execute parallel phases yourself. The team infrastructure ensures proper coordination, worktree isolation, and merge sequencing.
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
|
|
647
|
+
### Serial Execution Path (Steps 4a-4i)
|
|
648
|
+
|
|
649
|
+
Used for single-phase levels OR when SWARM_ENABLED == false.
|
|
650
|
+
|
|
651
|
+
### 4a. Dependency Check
|
|
652
|
+
|
|
653
|
+
Verify all phases listed in `Depends on:` are either:
|
|
654
|
+
- Already marked complete in roadmap.md, OR
|
|
655
|
+
- In COMPLETED_PHASES from this session
|
|
656
|
+
|
|
657
|
+
If any dependency is in PARKED_PHASES:
|
|
658
|
+
- Park this phase too: "Blocked by parked phase {X}"
|
|
659
|
+
- Add to PARKED_PHASES
|
|
660
|
+
- Continue to next phase
|
|
661
|
+
|
|
662
|
+
### 4b. Oversight Gate (Phase Level)
|
|
663
|
+
|
|
664
|
+
- If OVERSIGHT == "phase":
|
|
665
|
+
|
|
666
|
+
```
|
|
667
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
668
|
+
Luca AUTOPILOT ► PHASE {NN}: {Name}
|
|
669
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
670
|
+
|
|
671
|
+
Goal: {phase goal}
|
|
672
|
+
Depends on: {dependencies}
|
|
673
|
+
Plans: {plan count or "needs planning"}
|
|
674
|
+
|
|
675
|
+
Options:
|
|
676
|
+
1. Continue — Plan and execute this phase
|
|
677
|
+
2. Skip — Park this phase and move to next
|
|
678
|
+
3. Stop — End autopilot session
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
Wait for user input. Route by choice.
|
|
682
|
+
|
|
683
|
+
- If OVERSIGHT == "milestone", "flagged", or "full-auto": auto-continue.
|
|
684
|
+
|
|
685
|
+
### 4c. Complexity Classification
|
|
686
|
+
|
|
687
|
+
Spawn lu-router to classify:
|
|
688
|
+
|
|
689
|
+
```
|
|
690
|
+
Task(
|
|
691
|
+
agent: "lu-router",
|
|
692
|
+
prompt: "Classify complexity for Phase {NN}: {phase_goal}. Consider file count, scope, and risk. Output: TRIVIAL, SIMPLE, MODERATE, COMPLEX, or CRITICAL."
|
|
693
|
+
)
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
Advance the pipeline step (the legacy "routing" step is folded into `triage` → `research`/`discuss` in v13). Complexity is recorded in the orchestrator's reasoning and passed to every subagent — there's no separate state field for it:
|
|
697
|
+
|
|
698
|
+
```bash
|
|
699
|
+
luca state advance --to-step discuss 2>/dev/null || true
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
### 4d. Discussion (Always Runs)
|
|
703
|
+
|
|
704
|
+
Discussion always runs. The discussion depth and model tier scale with complexity via the routing table.
|
|
705
|
+
|
|
706
|
+
```
|
|
707
|
+
Skill(skill: "phase-discuss", args: "{phase_number}")
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
Advance the pipeline step after discussion:
|
|
711
|
+
|
|
712
|
+
```bash
|
|
713
|
+
luca state advance --to-step architect 2>/dev/null || true
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
### 4e. Planning
|
|
717
|
+
|
|
718
|
+
Check if `plan.md` already exists for this phase (canonical per LUCA_DIR_CONTRACT — one plan.md per phase, not many):
|
|
719
|
+
|
|
720
|
+
```bash
|
|
721
|
+
PLAN_EXISTS=$([ -f ".luca/phases/{phase_dir}/plan.md" ] && echo "true" || echo "false")
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
If PLAN_EXISTS == "false" and AUTO_PLAN == true:
|
|
725
|
+
|
|
726
|
+
```
|
|
727
|
+
Skill(skill: "phase-plan", args: "{phase_number}")
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
If PLAN_EXISTS == "false" and AUTO_PLAN == false:
|
|
731
|
+
- Park this phase: "No plan and auto_plan disabled"
|
|
732
|
+
- Add to PARKED_PHASES
|
|
733
|
+
- Continue to next phase
|
|
734
|
+
|
|
735
|
+
If PLAN_EXISTS == "true": skip planning (plan already exists).
|
|
736
|
+
|
|
737
|
+
Advance the pipeline step to execute:
|
|
738
|
+
|
|
739
|
+
```bash
|
|
740
|
+
luca state advance --to-step execute 2>/dev/null || true
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
### 4f. Execution
|
|
744
|
+
|
|
745
|
+
Build execution flags:
|
|
746
|
+
|
|
747
|
+
```bash
|
|
748
|
+
EXEC_FLAGS="{phase_number}"
|
|
749
|
+
if [ "$SKIP_UAT" = "true" ]; then
|
|
750
|
+
EXEC_FLAGS="$EXEC_FLAGS --skip-uat"
|
|
751
|
+
fi
|
|
752
|
+
# Note: If OVERSIGHT == "phase", do NOT skip UAT (human available)
|
|
753
|
+
if [ "$OVERSIGHT" = "phase" ]; then
|
|
754
|
+
EXEC_FLAGS="{phase_number}" # No --skip-uat
|
|
755
|
+
fi
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
Invoke the full execution pipeline:
|
|
759
|
+
|
|
760
|
+
```
|
|
761
|
+
Skill(skill: "phase-execute", args: "{EXEC_FLAGS}")
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
### 4g. Result Handling
|
|
765
|
+
|
|
766
|
+
Parse the phase-execute outcome from the workflow state and the active phase's `verify.json`:
|
|
767
|
+
|
|
768
|
+
```bash
|
|
769
|
+
VERIFICATION=$(cat .luca/phases/{phase_dir}/verify.json 2>/dev/null || echo "")
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
**Route by outcome:**
|
|
773
|
+
|
|
774
|
+
**If phase passed (verification status: "passed"):**
|
|
775
|
+
1. Add to COMPLETED_PHASES
|
|
776
|
+
2. Update roadmap.md plans to `[x]`
|
|
777
|
+
3. Log to MuninnDB: `mcp__muninn__muninn_remember(vault: "default", concept: "session:findings", content: "{timestamp} [PHASE-COMPLETE] Phase {NN} passed")`
|
|
778
|
+
4. Display:
|
|
779
|
+
|
|
780
|
+
```
|
|
781
|
+
◆ Phase {NN}: {Name} — PASSED ✓
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
5. Continue to next phase
|
|
785
|
+
|
|
786
|
+
**If gaps found (verification status: "gaps_found"):**
|
|
787
|
+
1. Attempt gap closure (up to GAP_RETRIES times):
|
|
788
|
+
|
|
789
|
+
```
|
|
790
|
+
Skill(skill: "phase-plan", args: "{phase_number} --gaps")
|
|
791
|
+
Skill(skill: "phase-execute", args: "{phase_number} --gaps-only --skip-uat")
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
2. Re-check verification
|
|
795
|
+
3. If still failing after GAP_RETRIES:
|
|
796
|
+
- If OVERSIGHT == "flagged" or "phase": PAUSE and present failure to user
|
|
797
|
+
- If OVERSIGHT == "milestone" or "full-auto": park phase
|
|
798
|
+
|
|
799
|
+
**If human_needed (verification requires manual check):**
|
|
800
|
+
- If OVERSIGHT == "phase" or "flagged": PAUSE and present to user
|
|
801
|
+
- If OVERSIGHT == "milestone" or "full-auto": park phase with reason "requires human verification"
|
|
802
|
+
|
|
803
|
+
**If CRITICAL code review issues found:**
|
|
804
|
+
- Always PAUSE regardless of oversight (safety gate)
|
|
805
|
+
- Present issues and options: Fix / Park / Stop
|
|
806
|
+
|
|
807
|
+
### 4h. Learning Capture
|
|
808
|
+
|
|
809
|
+
Learning capture always runs (model tier scales with complexity via routing table):
|
|
810
|
+
- TRIVIAL/SIMPLE: standard (fast model tier)
|
|
811
|
+
- MODERATE: standard (fast model tier)
|
|
812
|
+
- COMPLEX: full (fast model tier)
|
|
813
|
+
- CRITICAL: full + debrief (balanced model tier)
|
|
814
|
+
|
|
815
|
+
Learning is already handled by phase-execute internally. No additional action needed here.
|
|
816
|
+
|
|
817
|
+
### 4i. Progress Display
|
|
818
|
+
|
|
819
|
+
After each phase:
|
|
820
|
+
|
|
821
|
+
```
|
|
822
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
823
|
+
Luca AUTOPILOT ► PROGRESS
|
|
824
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
825
|
+
|
|
826
|
+
Completed: {COMPLETED_PHASES count}/{total}
|
|
827
|
+
Parked: {PARKED_PHASES count}
|
|
828
|
+
Remaining: {remaining count}
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
---
|
|
832
|
+
|
|
833
|
+
### Parallel Execution Path (Swarm Mode)
|
|
834
|
+
|
|
835
|
+
Used for levels with 2+ independent phases when SWARM_ENABLED == true.
|
|
836
|
+
|
|
837
|
+
### 4-swarm-a. Oversight Gate (Parallel Level)
|
|
838
|
+
|
|
839
|
+
- If OVERSIGHT == "phase":
|
|
840
|
+
|
|
841
|
+
```
|
|
842
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
843
|
+
Luca AUTOPILOT ► PARALLEL LEVEL {N}
|
|
844
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
845
|
+
|
|
846
|
+
Phases: {phase list with goals}
|
|
847
|
+
Mode: PARALLEL (agent team, max {MAX_PARALLEL} concurrent)
|
|
848
|
+
|
|
849
|
+
Options:
|
|
850
|
+
1. Continue — Plan and execute all phases in parallel
|
|
851
|
+
2. Serial — Demote to serial execution for this level
|
|
852
|
+
3. Skip — Park all phases in this level
|
|
853
|
+
4. Stop — End autopilot session
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
- If OVERSIGHT == "milestone", "flagged", or "full-auto": auto-continue.
|
|
857
|
+
|
|
858
|
+
### Phase A: Parallel Planning with Lead Review Gate
|
|
859
|
+
|
|
860
|
+
### 4-swarm-b. Create Planning Team
|
|
861
|
+
|
|
862
|
+
```
|
|
863
|
+
TeamCreate(
|
|
864
|
+
team_name: "autopilot-plan-L{N}-{timestamp}",
|
|
865
|
+
description: "Parallel planning for {count} independent phases"
|
|
866
|
+
)
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
Create a task for each phase to plan:
|
|
870
|
+
|
|
871
|
+
```
|
|
872
|
+
For each phase in this level:
|
|
873
|
+
TaskCreate(
|
|
874
|
+
subject: "Plan Phase {NN}: {goal}",
|
|
875
|
+
description: "Generate plan.md for phase {NN}",
|
|
876
|
+
activeForm: "Planning Phase {NN}"
|
|
877
|
+
)
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
### 4-swarm-c. Spawn Planning Teammates (in parallel)
|
|
881
|
+
|
|
882
|
+
Each planner explores the codebase and generates a plan.md. They do NOT write code.
|
|
883
|
+
|
|
884
|
+
```
|
|
885
|
+
For each phase (in parallel, using Task tool):
|
|
886
|
+
Task(
|
|
887
|
+
team_name: "autopilot-plan-L{N}-{timestamp}",
|
|
888
|
+
name: "planner-{NN}",
|
|
889
|
+
subagent_type: "general-purpose",
|
|
890
|
+
prompt: """
|
|
891
|
+
You are a Luca phase planner. Create a plan.md for this phase.
|
|
892
|
+
|
|
893
|
+
**Phase:** {NN} - {goal}
|
|
894
|
+
**Phase directory:** .luca/phases/{phase_dir}/
|
|
895
|
+
**Project state:** {state.json content via `luca state read`}
|
|
896
|
+
**Working memory:** {session context from MuninnDB}
|
|
897
|
+
**CLAUDE.md conventions:** Read CLAUDE.md for project conventions.
|
|
898
|
+
|
|
899
|
+
**Instructions:**
|
|
900
|
+
1. Read the phase goal and any existing context in the phase directory
|
|
901
|
+
2. Explore the codebase to understand the scope of changes needed
|
|
902
|
+
3. Create {NN}-plan.md in the phase directory with:
|
|
903
|
+
- Goal-backward analysis
|
|
904
|
+
- Atomic tasks with verification criteria
|
|
905
|
+
- Wave grouping for any internal parallelism
|
|
906
|
+
- Target ~50% context budget
|
|
907
|
+
4. Mark your task completed via TaskUpdate
|
|
908
|
+
5. Send the plan summary to the lead via SendMessage
|
|
909
|
+
|
|
910
|
+
**Do NOT write implementation code.** Only produce the plan.md.
|
|
911
|
+
"""
|
|
912
|
+
)
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
### 4-swarm-d. Lead Reviews All Plans Together
|
|
916
|
+
|
|
917
|
+
After all planners complete and send their summaries, shutdown the planning team:
|
|
918
|
+
|
|
919
|
+
```
|
|
920
|
+
For each planner:
|
|
921
|
+
SendMessage(type: "shutdown_request", recipient: "planner-{NN}")
|
|
922
|
+
# After all acknowledge:
|
|
923
|
+
TeamDelete()
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
Then the lead reads all generated plan.md files and performs **cross-plan review**:
|
|
927
|
+
|
|
928
|
+
1. **Conflicting file modifications**: Check if two plans modify the same file
|
|
929
|
+
- If conflict found: either merge the plans into a single executor or demote the conflicting phase to serial (defer to next level)
|
|
930
|
+
2. **Shared utility opportunities**: Check if both plans need similar helpers
|
|
931
|
+
- If found: note in the execution instructions so the first executor creates it
|
|
932
|
+
3. **API contract alignment**: Check if one plan changes a schema another depends on
|
|
933
|
+
- If found: order the plans (schema change first) or demote to serial
|
|
934
|
+
|
|
935
|
+
**If all plans are clean**: approve all and proceed to Phase B.
|
|
936
|
+
**If conflicts cannot be resolved**: demote conflicting phases to serial, execute clean phases in parallel.
|
|
937
|
+
|
|
938
|
+
### Phase B: Parallel Execution
|
|
939
|
+
|
|
940
|
+
### 4-swarm-e. Create Execution Team
|
|
941
|
+
|
|
942
|
+
```
|
|
943
|
+
TeamCreate(
|
|
944
|
+
team_name: "autopilot-exec-L{N}-{timestamp}",
|
|
945
|
+
description: "Parallel execution of {count} reviewed plans"
|
|
946
|
+
)
|
|
947
|
+
```
|
|
948
|
+
|
|
949
|
+
### 4-swarm-f. Create Tasks and Spawn Execution Teammates (in parallel)
|
|
950
|
+
|
|
951
|
+
```
|
|
952
|
+
For each phase with an approved plan:
|
|
953
|
+
TaskCreate(
|
|
954
|
+
subject: "Execute Phase {NN}: {goal}",
|
|
955
|
+
description: "{plan.md content + execution instructions}",
|
|
956
|
+
activeForm: "Executing Phase {NN}"
|
|
957
|
+
)
|
|
958
|
+
|
|
959
|
+
Task(
|
|
960
|
+
team_name: "autopilot-exec-L{N}-{timestamp}",
|
|
961
|
+
name: "executor-{NN}",
|
|
962
|
+
subagent_type: "general-purpose",
|
|
963
|
+
isolation: "worktree",
|
|
964
|
+
prompt: """
|
|
965
|
+
You are an autopilot executor. Implement the approved plan for Phase {NN}.
|
|
966
|
+
|
|
967
|
+
**Your Phase:** {NN} - {goal}
|
|
968
|
+
**Approved Plan:** {plan.md content}
|
|
969
|
+
|
|
970
|
+
**Instructions:**
|
|
971
|
+
1. You are in an isolated git worktree — work freely
|
|
972
|
+
2. Read and follow CLAUDE.md conventions (use Bun, not Node)
|
|
973
|
+
3. Execute all plan tasks with atomic commits
|
|
974
|
+
4. Run `bun test` and `bunx --bun tsc --noEmit` before each commit
|
|
975
|
+
5. When done, mark your task completed: TaskUpdate(taskId: "{id}", status: "completed")
|
|
976
|
+
6. Send a summary to the lead: SendMessage(type: "message", recipient: "team-lead", content: "...", summary: "Phase {NN} execution complete")
|
|
977
|
+
|
|
978
|
+
**Do NOT modify:** roadmap.md, state.json, .luca/ metadata (lead handles these)
|
|
979
|
+
**Do NOT deviate from the approved plan** without messaging the lead first.
|
|
980
|
+
"""
|
|
981
|
+
)
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
### 4-swarm-g. Monitor Execution
|
|
985
|
+
|
|
986
|
+
- Teammate messages are auto-delivered (no polling needed)
|
|
987
|
+
- On each completion: log progress, update display
|
|
988
|
+
- On teammate error: log the error, mark phase as FAILED, continue monitoring others
|
|
989
|
+
- Timeout: if no progress from a teammate after 30 minutes, send a follow-up message:
|
|
990
|
+
`SendMessage(type: "message", recipient: "executor-{NN}", content: "Status check — are you blocked?", summary: "Checking executor progress")`
|
|
991
|
+
- If no response after another 10 minutes: mark phase as TIMED_OUT, continue with others
|
|
992
|
+
|
|
993
|
+
### 4-swarm-h. Merge and Verify
|
|
994
|
+
|
|
995
|
+
After all executors in this level complete (or are marked failed/timed out):
|
|
996
|
+
|
|
997
|
+
1. **Merge each worktree branch** sequentially into the feature branch:
|
|
998
|
+
```bash
|
|
999
|
+
git merge --no-ff {worktree-branch} -m "merge: Phase {NN} from parallel execution"
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
2. **Run post-merge harness** after each merge:
|
|
1003
|
+
```bash
|
|
1004
|
+
bun test && bunx --bun tsc --noEmit
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
3. **If harness fails** after a merge:
|
|
1008
|
+
- Identify which merge caused the failure
|
|
1009
|
+
- Attempt fix (max 2 iterations)
|
|
1010
|
+
- If still failing: revert that merge and park the phase
|
|
1011
|
+
|
|
1012
|
+
4. **After all successful merges**: run full harness one final time to confirm clean state
|
|
1013
|
+
|
|
1014
|
+
### 4-swarm-i. Cleanup Level
|
|
1015
|
+
|
|
1016
|
+
1. Shutdown execution teammates:
|
|
1017
|
+
```
|
|
1018
|
+
For each executor:
|
|
1019
|
+
SendMessage(type: "shutdown_request", recipient: "executor-{NN}")
|
|
1020
|
+
# After all acknowledge:
|
|
1021
|
+
TeamDelete()
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
2. Update roadmap.md: mark completed phase plans as `[x]`
|
|
1025
|
+
3. Add completed phases to COMPLETED_PHASES
|
|
1026
|
+
4. Add failed/timed-out phases to PARKED_PHASES with reasons
|
|
1027
|
+
5. Advance the pipeline step (the per-phase boundary moves through `checks → verify → review → learn` per the pipeline-transitions table):
|
|
1028
|
+
```bash
|
|
1029
|
+
luca state advance --to-step checks 2>/dev/null || true
|
|
1030
|
+
luca telemetry emit --kind=phase.complete --data='{"phase_id":{NN},"summary":"Phase {NN} completed (parallel)"}' 2>/dev/null || true
|
|
1031
|
+
```
|
|
1032
|
+
6. Log to MuninnDB session memory via muninn_remember
|
|
1033
|
+
|
|
1034
|
+
### 4-swarm-j. Level Progress Display
|
|
1035
|
+
|
|
1036
|
+
```
|
|
1037
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1038
|
+
Luca AUTOPILOT ► LEVEL {N} COMPLETE (PARALLEL)
|
|
1039
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1040
|
+
|
|
1041
|
+
| Phase | Status | Notes |
|
|
1042
|
+
|-------|--------|-------|
|
|
1043
|
+
| {NN} | Passed ✓ | merged successfully |
|
|
1044
|
+
| {NN} | Passed ✓ | merged successfully |
|
|
1045
|
+
| {NN} | Parked ⏸ | {reason} |
|
|
1046
|
+
|
|
1047
|
+
Completed: {COMPLETED_PHASES count}/{total}
|
|
1048
|
+
Parked: {PARKED_PHASES count}
|
|
1049
|
+
Remaining: {remaining levels}
|
|
1050
|
+
```
|
|
1051
|
+
|
|
1052
|
+
Continue to next level.
|
|
1053
|
+
</phase_loop>
|
|
1054
|
+
|
|
1055
|
+
<milestone_gate>
|
|
1056
|
+
## Step 5: Milestone Boundary
|
|
1057
|
+
|
|
1058
|
+
After all phases in the execution order have been attempted (completed or parked):
|
|
1059
|
+
|
|
1060
|
+
### 5a. Milestone Summary
|
|
1061
|
+
|
|
1062
|
+
```
|
|
1063
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1064
|
+
Luca AUTOPILOT ► MILESTONE SUMMARY
|
|
1065
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1066
|
+
|
|
1067
|
+
Milestone: {milestone name}
|
|
1068
|
+
|
|
1069
|
+
| Phase | Status | Notes |
|
|
1070
|
+
|-------|--------|-------|
|
|
1071
|
+
| {NN} | Passed ✓ | — |
|
|
1072
|
+
| {NN} | Parked ⏸ | {reason} |
|
|
1073
|
+
|
|
1074
|
+
Completed: {N}/{total}
|
|
1075
|
+
Parked: {N} phase(s)
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
### 5b. Milestone Completion Decision
|
|
1079
|
+
|
|
1080
|
+
**If ALL phases passed (no parked phases):**
|
|
1081
|
+
|
|
1082
|
+
- If OVERSIGHT == "full-auto":
|
|
1083
|
+
- Auto-invoke: `Skill(skill: "milestone-complete")`
|
|
1084
|
+
- If CROSS_MILESTONE == true: proceed to Step 6
|
|
1085
|
+
- If CROSS_MILESTONE == false: proceed to Step 7 (final summary)
|
|
1086
|
+
|
|
1087
|
+
- If OVERSIGHT == "flagged":
|
|
1088
|
+
- Auto-invoke: `Skill(skill: "milestone-complete")`
|
|
1089
|
+
- Proceed to Step 7
|
|
1090
|
+
|
|
1091
|
+
- If OVERSIGHT == "milestone" or "phase":
|
|
1092
|
+
|
|
1093
|
+
```
|
|
1094
|
+
Milestone complete! All {N} phases passed.
|
|
1095
|
+
|
|
1096
|
+
Options:
|
|
1097
|
+
1. Complete milestone — Archive and finalize
|
|
1098
|
+
2. Review — Inspect results before completing
|
|
1099
|
+
3. Stop — End session without completing milestone
|
|
1100
|
+
```
|
|
1101
|
+
|
|
1102
|
+
**If some phases were parked:**
|
|
1103
|
+
|
|
1104
|
+
- If OVERSIGHT == "full-auto":
|
|
1105
|
+
- Log parked phases as issues
|
|
1106
|
+
- Do NOT complete the milestone (incomplete)
|
|
1107
|
+
- Proceed to Step 7
|
|
1108
|
+
|
|
1109
|
+
- If OVERSIGHT == "flagged", "milestone", or "phase":
|
|
1110
|
+
|
|
1111
|
+
```
|
|
1112
|
+
Milestone incomplete: {N} phase(s) parked.
|
|
1113
|
+
|
|
1114
|
+
| Parked Phase | Reason |
|
|
1115
|
+
|-------------|--------|
|
|
1116
|
+
| {NN} | {reason} |
|
|
1117
|
+
|
|
1118
|
+
Options:
|
|
1119
|
+
1. Retry parked — Attempt parked phases again
|
|
1120
|
+
2. Complete partial — Mark milestone as done with known gaps
|
|
1121
|
+
3. Stop — End session, resume later
|
|
1122
|
+
```
|
|
1123
|
+
</milestone_gate>
|
|
1124
|
+
|
|
1125
|
+
<cross_milestone>
|
|
1126
|
+
## Step 6: Cross-Milestone Loop (Optional)
|
|
1127
|
+
|
|
1128
|
+
**Only runs if CROSS_MILESTONE == true AND OVERSIGHT allows it.**
|
|
1129
|
+
|
|
1130
|
+
After completing a milestone:
|
|
1131
|
+
|
|
1132
|
+
### 6a. Check for Next Milestone
|
|
1133
|
+
|
|
1134
|
+
1. Re-scan backlog: `luca todo list --status pending`
|
|
1135
|
+
2. If pending todos exist: there may be work for a new milestone
|
|
1136
|
+
3. If no pending todos and ROADMAP has no more milestones: done
|
|
1137
|
+
|
|
1138
|
+
### 6b. Start New Milestone
|
|
1139
|
+
|
|
1140
|
+
If there is work for a new milestone:
|
|
1141
|
+
|
|
1142
|
+
```
|
|
1143
|
+
Skill(skill: "milestone-new", args: "{auto-generated milestone description}")
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
After milestone-new creates the new roadmap, loop back to Step 1 (backlog scan).
|
|
1147
|
+
|
|
1148
|
+
### 6c. Safety Limit
|
|
1149
|
+
|
|
1150
|
+
Track total milestones completed in this session. If exceeds 3:
|
|
1151
|
+
- PAUSE regardless of oversight level
|
|
1152
|
+
- Display: "3 milestones completed. Continue autopilot?"
|
|
1153
|
+
- This prevents runaway execution.
|
|
1154
|
+
</cross_milestone>
|
|
1155
|
+
|
|
1156
|
+
<oversight_gates>
|
|
1157
|
+
## Oversight Gate Reference
|
|
1158
|
+
|
|
1159
|
+
### Gate Behavior Matrix
|
|
1160
|
+
|
|
1161
|
+
| Decision Point | full-auto | flagged | milestone | phase |
|
|
1162
|
+
|----------------|-----------|---------|-----------|-------|
|
|
1163
|
+
| Before each phase | continue | continue | continue | PAUSE: Continue/Skip/Stop |
|
|
1164
|
+
| Before parallel level | continue | continue | continue | PAUSE: show parallel plan |
|
|
1165
|
+
| Phase failure/gaps | park, continue | PAUSE: Retry/Skip/Stop | park, continue | PAUSE: Retry/Skip/Stop |
|
|
1166
|
+
| Teammate failure | skip phase, continue | PAUSE | skip phase | PAUSE |
|
|
1167
|
+
| Merge conflict | auto-resolve or skip | PAUSE | skip phase | PAUSE |
|
|
1168
|
+
| CRITICAL code review | PAUSE (safety) | PAUSE | PAUSE | PAUSE |
|
|
1169
|
+
| Milestone boundary | auto-complete | PAUSE if parked | PAUSE: summary + confirm | PAUSE: summary + confirm |
|
|
1170
|
+
| Roadmap revision | auto-approve | auto-approve | PAUSE: approve changes | PAUSE: approve changes |
|
|
1171
|
+
|
|
1172
|
+
### Oversight Descriptions
|
|
1173
|
+
|
|
1174
|
+
| Level | Description |
|
|
1175
|
+
|-------|-------------|
|
|
1176
|
+
| `full-auto` | No pauses except CRITICAL safety. Auto-plan, auto-execute, auto-complete. For overnight runs or trusted codebases. |
|
|
1177
|
+
| `flagged` | Runs autonomously but pauses when issues are detected (gaps, failures, critical reviews). Smart auto mode. |
|
|
1178
|
+
| `milestone` | Pauses between milestones. Autonomous within a milestone. Default and recommended starting point. |
|
|
1179
|
+
| `phase` | Pauses after each phase. Most cautious. Phase-by-phase approval. |
|
|
1180
|
+
|
|
1181
|
+
### Relationship to Existing Gates
|
|
1182
|
+
|
|
1183
|
+
The autopilot overlays its oversight logic on top of the existing `gates` config in `.luca/config.json`. The existing gates act as a floor:
|
|
1184
|
+
|
|
1185
|
+
- If a gate is explicitly `false` in config.json: it stays false regardless of oversight
|
|
1186
|
+
- If a gate is `true` in config.json: the autopilot may suppress the pause based on oversight level
|
|
1187
|
+
|
|
1188
|
+
For fully autonomous operation, set all gates to `false` in config.json AND use `--oversight=full-auto`.
|
|
1189
|
+
</oversight_gates>
|
|
1190
|
+
|
|
1191
|
+
<failure_handling>
|
|
1192
|
+
## Failure Handling: Park-and-Continue Strategy
|
|
1193
|
+
|
|
1194
|
+
### How Parking Works
|
|
1195
|
+
|
|
1196
|
+
When a phase cannot complete:
|
|
1197
|
+
|
|
1198
|
+
1. The phase is added to the PARKED_PHASES list with a reason
|
|
1199
|
+
2. All phases that depend on the parked phase are also automatically parked ("blocked by Phase {X}")
|
|
1200
|
+
3. Remaining independent phases (no dependency on parked phases) continue executing
|
|
1201
|
+
4. The milestone is marked incomplete if any phases are parked
|
|
1202
|
+
|
|
1203
|
+
### Reasons for Parking
|
|
1204
|
+
|
|
1205
|
+
| Reason | Trigger | Oversight Override |
|
|
1206
|
+
|--------|---------|-------------------|
|
|
1207
|
+
| Gaps after retries | Verification gaps persist after GAP_RETRIES | flagged/phase: user can retry |
|
|
1208
|
+
| Human verification needed | Verifier returns "human_needed" | phase: user reviews |
|
|
1209
|
+
| Blocked by parked phase | Dependency on a previously parked phase | N/A (cascading) |
|
|
1210
|
+
| No plans, auto-plan disabled | Phase has no plan.md and auto_plan=false | N/A |
|
|
1211
|
+
| CRITICAL code review | Unresolved CRITICAL issues | Always pauses |
|
|
1212
|
+
| Teammate timeout | Executor unresponsive for 40+ minutes | Park phase, merge others |
|
|
1213
|
+
| Teammate error | Executor encountered unrecoverable error | Park phase, continue others |
|
|
1214
|
+
| Merge conflict | Worktree branch conflicts with feature branch | Park phase, merge others |
|
|
1215
|
+
| Post-merge harness failure | Tests/types fail after merge (2 fix attempts) | Park all phases from this level |
|
|
1216
|
+
|
|
1217
|
+
### Swarm-Specific Failure Modes
|
|
1218
|
+
|
|
1219
|
+
| Failure Mode | Response |
|
|
1220
|
+
|-------------|----------|
|
|
1221
|
+
| Teammate timeout (40 min) | Mark phase TIMED_OUT, park it, merge other completed phases |
|
|
1222
|
+
| Teammate error | Mark phase FAILED, park it, continue monitoring other teammates |
|
|
1223
|
+
| Merge conflict | Log conflict, park that phase, merge remaining clean phases |
|
|
1224
|
+
| Post-merge harness failure | Attempt fix (2 iterations), then revert merge and park the phase |
|
|
1225
|
+
| All teammates fail | Fallback: re-attempt all phases serially on next `/autopilot` run |
|
|
1226
|
+
|
|
1227
|
+
### Recovery
|
|
1228
|
+
|
|
1229
|
+
Parked phases can be retried by:
|
|
1230
|
+
1. Running `/autopilot` again — parked phases will be re-attempted (serially if previously failed in swarm)
|
|
1231
|
+
2. Running `/phase-plan {N} --gaps` manually for specific phases
|
|
1232
|
+
3. Running `/phase-execute {N}` manually after fixing issues
|
|
1233
|
+
|
|
1234
|
+
### Cascade Prevention
|
|
1235
|
+
|
|
1236
|
+
The dependency check in Step 4a prevents attempting phases whose prerequisites are parked. This avoids wasting execution time on phases that cannot succeed.
|
|
1237
|
+
|
|
1238
|
+
For parallel levels, cascade prevention also applies: if a phase in a parallel group is parked due to a dependency, it is excluded from the team before spawning.
|
|
1239
|
+
</failure_handling>
|
|
1240
|
+
|
|
1241
|
+
<summary>
|
|
1242
|
+
## Step 7: Final Summary
|
|
1243
|
+
|
|
1244
|
+
After all phases attempted and milestone boundary handled:
|
|
1245
|
+
|
|
1246
|
+
```
|
|
1247
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1248
|
+
Luca AUTOPILOT ► SESSION COMPLETE
|
|
1249
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1250
|
+
|
|
1251
|
+
Oversight: {OVERSIGHT}
|
|
1252
|
+
Duration: {session duration}
|
|
1253
|
+
|
|
1254
|
+
## Results
|
|
1255
|
+
|
|
1256
|
+
| Metric | Count |
|
|
1257
|
+
|--------|-------|
|
|
1258
|
+
| Phases completed | {N} |
|
|
1259
|
+
| Phases parked | {N} |
|
|
1260
|
+
| Plans generated | {N} |
|
|
1261
|
+
| Plans executed | {N} |
|
|
1262
|
+
| Parallel levels | {N} |
|
|
1263
|
+
| Phases run in parallel | {N} |
|
|
1264
|
+
| Phases run serially | {N} |
|
|
1265
|
+
| Commits made | {N} |
|
|
1266
|
+
|
|
1267
|
+
## Completed Phases
|
|
1268
|
+
{list of completed phases with one-line summaries}
|
|
1269
|
+
|
|
1270
|
+
## Parked Phases
|
|
1271
|
+
{list of parked phases with reasons}
|
|
1272
|
+
|
|
1273
|
+
## Remaining Backlog
|
|
1274
|
+
{count of remaining pending todos}
|
|
1275
|
+
|
|
1276
|
+
## Recommended Next Steps
|
|
1277
|
+
{context-dependent recommendations:
|
|
1278
|
+
- If parked phases: "Review parked phases and fix issues, then run /autopilot again"
|
|
1279
|
+
- If milestone complete: "Run /milestone-audit to review"
|
|
1280
|
+
- If backlog remains: "Run /autopilot to continue with next milestone"
|
|
1281
|
+
- If all done: "All work complete. Consider adding new todos or starting a new milestone."}
|
|
1282
|
+
```
|
|
1283
|
+
|
|
1284
|
+
### Update State
|
|
1285
|
+
|
|
1286
|
+
1. Advance the pipeline step to `complete` once the autopilot session finishes:
|
|
1287
|
+
|
|
1288
|
+
```bash
|
|
1289
|
+
luca state advance --to-step complete 2>/dev/null || true
|
|
1290
|
+
```
|
|
1291
|
+
|
|
1292
|
+
2. Log final status to MuninnDB: `mcp__muninn__muninn_remember(vault: "<repo_vault>", concept: "session:findings", content: "Autopilot session complete")`
|
|
1293
|
+
4. Commit session metadata:
|
|
1294
|
+
|
|
1295
|
+
```bash
|
|
1296
|
+
git add .luca/state.json
|
|
1297
|
+
bun run commit --message="autopilot session complete" --type=docs --scope=autopilot --no-push --skip-checks
|
|
1298
|
+
```
|
|
1299
|
+
</summary>
|