@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.
Files changed (128) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +47 -0
  3. package/bin/luca.js +3 -0
  4. package/dist/chunks/branch.mjs +47 -0
  5. package/dist/chunks/bun-runtime.mjs +46 -0
  6. package/dist/chunks/checks.mjs +53 -0
  7. package/dist/chunks/claim-verify.mjs +465 -0
  8. package/dist/chunks/classify.mjs +105 -0
  9. package/dist/chunks/confidence.mjs +199 -0
  10. package/dist/chunks/doctor.mjs +158 -0
  11. package/dist/chunks/hook.mjs +696 -0
  12. package/dist/chunks/init.mjs +715 -0
  13. package/dist/chunks/muninndb-health.mjs +66 -0
  14. package/dist/chunks/phase.mjs +38 -0
  15. package/dist/chunks/pr-review.mjs +122 -0
  16. package/dist/chunks/preferences.mjs +61 -0
  17. package/dist/chunks/repair.mjs +111 -0
  18. package/dist/chunks/repo.mjs +58 -0
  19. package/dist/chunks/retro.mjs +86 -0
  20. package/dist/chunks/roadmap.mjs +58 -0
  21. package/dist/chunks/rules.mjs +527 -0
  22. package/dist/chunks/stale-mcp-server.mjs +90 -0
  23. package/dist/chunks/state.mjs +57 -0
  24. package/dist/chunks/stray-local-install.mjs +200 -0
  25. package/dist/chunks/telemetry.mjs +165 -0
  26. package/dist/chunks/todo.mjs +151 -0
  27. package/dist/chunks/vault-init.mjs +300 -0
  28. package/dist/chunks/verification.mjs +95 -0
  29. package/dist/chunks/version.mjs +70 -0
  30. package/dist/chunks/workflow.mjs +47 -0
  31. package/dist/claude/.claude/agents/architect.md +410 -0
  32. package/dist/claude/.claude/agents/build.md +111 -0
  33. package/dist/claude/.claude/agents/discuss.md +93 -0
  34. package/dist/claude/.claude/agents/discussion.md +149 -0
  35. package/dist/claude/.claude/agents/execute.md +416 -0
  36. package/dist/claude/.claude/agents/executor.md +161 -0
  37. package/dist/claude/.claude/agents/fast.md +84 -0
  38. package/dist/claude/.claude/agents/finalize.md +484 -0
  39. package/dist/claude/.claude/agents/learner.md +160 -0
  40. package/dist/claude/.claude/agents/plan-reviewer.md +129 -0
  41. package/dist/claude/.claude/agents/plan.md +96 -0
  42. package/dist/claude/.claude/agents/research.md +327 -0
  43. package/dist/claude/.claude/agents/researcher.md +78 -0
  44. package/dist/claude/.claude/agents/review.md +283 -0
  45. package/dist/claude/.claude/agents/reviewer.md +163 -0
  46. package/dist/claude/.claude/agents/shadow-scanner.md +257 -0
  47. package/dist/claude/.claude/agents/triage.md +230 -0
  48. package/dist/claude/.claude/agents/verifier.md +131 -0
  49. package/dist/claude/.claude/commands/bug-diagnose.md +12 -0
  50. package/dist/claude/.claude/commands/gh-issue-triage.md +14 -0
  51. package/dist/claude/.claude/commands/gh-pr-address.md +235 -0
  52. package/dist/claude/.claude/commands/gh-prepare.md +12 -0
  53. package/dist/claude/.claude/commands/grill-me.md +12 -0
  54. package/dist/claude/.claude/commands/lu-review.md +51 -0
  55. package/dist/claude/.claude/commands/lu.md +75 -0
  56. package/dist/claude/.claude/commands/luca-init.md +14 -0
  57. package/dist/claude/.claude/commands/luca-telemetry-report.md +12 -0
  58. package/dist/claude/.claude/commands/memory-audit.md +12 -0
  59. package/dist/claude/.claude/commands/milestone-new.md +122 -0
  60. package/dist/claude/.claude/commands/phase-discuss.md +45 -0
  61. package/dist/claude/.claude/commands/phase-execute.md +39 -0
  62. package/dist/claude/.claude/commands/phase-plan.md +53 -0
  63. package/dist/claude/.claude/commands/repo-cleanup.md +80 -0
  64. package/dist/claude/.claude/commands/todo-add.md +28 -0
  65. package/dist/claude/.claude/commands/todo-check.md +36 -0
  66. package/dist/claude/.claude/hooks/context-refresher.ts +285 -0
  67. package/dist/claude/.claude/hooks/continuation-messages.ts +215 -0
  68. package/dist/claude/.claude/hooks/pipeline-guard.ts +182 -0
  69. package/dist/claude/.claude/settings.json +41 -0
  70. package/dist/claude/skills/arch-audit/SKILL.md +161 -0
  71. package/dist/claude/skills/autopilot/SKILL.md +1299 -0
  72. package/dist/claude/skills/bug-diagnose/SKILL.md +102 -0
  73. package/dist/claude/skills/choose/SKILL.md +124 -0
  74. package/dist/claude/skills/gh-issue-triage/SKILL.md +97 -0
  75. package/dist/claude/skills/gh-pr-address/SKILL.md +235 -0
  76. package/dist/claude/skills/gh-prepare/SKILL.md +209 -0
  77. package/dist/claude/skills/grill-me/SKILL.md +46 -0
  78. package/dist/claude/skills/lu/SKILL.md +112 -0
  79. package/dist/claude/skills/lu-review/SKILL.md +51 -0
  80. package/dist/claude/skills/luca-init/SKILL.md +91 -0
  81. package/dist/claude/skills/luca-telemetry-report/SKILL.md +145 -0
  82. package/dist/claude/skills/luca-write-surface/SKILL.md +213 -0
  83. package/dist/claude/skills/memory-audit/SKILL.md +217 -0
  84. package/dist/claude/skills/milestone-audit/SKILL.md +545 -0
  85. package/dist/claude/skills/milestone-complete/SKILL.md +168 -0
  86. package/dist/claude/skills/milestone-gaps/SKILL.md +60 -0
  87. package/dist/claude/skills/milestone-new/SKILL.md +125 -0
  88. package/dist/claude/skills/note/SKILL.md +162 -0
  89. package/dist/claude/skills/phase-add/SKILL.md +91 -0
  90. package/dist/claude/skills/phase-assumptions/SKILL.md +92 -0
  91. package/dist/claude/skills/phase-discuss/SKILL.md +165 -0
  92. package/dist/claude/skills/phase-execute/SKILL.md +1786 -0
  93. package/dist/claude/skills/phase-insert/SKILL.md +100 -0
  94. package/dist/claude/skills/phase-plan/SKILL.md +461 -0
  95. package/dist/claude/skills/phase-remove/SKILL.md +113 -0
  96. package/dist/claude/skills/phase-research/SKILL.md +80 -0
  97. package/dist/claude/skills/post-init-tour/SKILL.md +58 -0
  98. package/dist/claude/skills/progress/SKILL.md +271 -0
  99. package/dist/claude/skills/project-new/SKILL.md +609 -0
  100. package/dist/claude/skills/quick/SKILL.md +256 -0
  101. package/dist/claude/skills/rename-audit/SKILL.md +52 -0
  102. package/dist/claude/skills/repo-audit/SKILL.md +88 -0
  103. package/dist/claude/skills/repo-cleanup/SKILL.md +80 -0
  104. package/dist/claude/skills/seed-memory/SKILL.md +235 -0
  105. package/dist/claude/skills/session-pause/SKILL.md +126 -0
  106. package/dist/claude/skills/session-plan/SKILL.md +112 -0
  107. package/dist/claude/skills/session-resume/SKILL.md +75 -0
  108. package/dist/claude/skills/todo-add/SKILL.md +85 -0
  109. package/dist/claude/skills/todo-check/SKILL.md +77 -0
  110. package/dist/claude/skills/workflow-save/SKILL.md +277 -0
  111. package/dist/index.d.mts +33 -0
  112. package/dist/index.d.ts +33 -0
  113. package/dist/index.mjs +69 -0
  114. package/dist/shared/luca.B3Mimc0P.mjs +52 -0
  115. package/dist/shared/luca.B3saVjJm.mjs +163 -0
  116. package/dist/shared/luca.BYdjkfnz.mjs +217 -0
  117. package/dist/shared/luca.BmhNkYe2.mjs +56 -0
  118. package/dist/shared/luca.C4gMUoBd.mjs +358 -0
  119. package/dist/shared/luca.CQ3g1xrD.mjs +19 -0
  120. package/dist/shared/luca.CRmaAfXR.mjs +713 -0
  121. package/dist/shared/luca.CrXzXueR.mjs +57 -0
  122. package/dist/shared/luca.DTomPq7I.mjs +91 -0
  123. package/dist/shared/luca.DjDTeDCi.mjs +1904 -0
  124. package/dist/shared/luca.HZxBTBgD.mjs +201 -0
  125. package/dist/shared/luca.TSMg1t7I.mjs +10 -0
  126. package/dist/shared/luca.dM-MKlNE.mjs +25 -0
  127. package/dist/shared/luca.naWEcQ4B.mjs +7 -0
  128. package/package.json +76 -0
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: phase-insert
3
+ description: Insert urgent work as a decimal phase between existing phases mid-milestone.
4
+ ---
5
+
6
+ <main>
7
+ # Luca Insert Phase
8
+
9
+ Insert a decimal phase for urgent work discovered mid-milestone that must be completed between existing integer phases.
10
+
11
+ **Arguments:** `<after> <description>` (e.g., `7 Fix critical auth bug`)
12
+
13
+ **Purpose:** Handle urgent work discovered during execution without renumbering entire roadmap.
14
+
15
+ Uses decimal numbering (7.1, 7.2, etc.) to preserve the logical sequence of planned phases.
16
+
17
+ ## Process
18
+
19
+ 1. **Parse arguments:**
20
+
21
+ - First argument: integer phase number to insert after
22
+ - Remaining arguments: phase description
23
+ - Error if less than 2 arguments provided
24
+
25
+ 2. **Load roadmap:**
26
+
27
+ - Read `.luca/roadmap.md` (or call `luca roadmap read`)
28
+ - Error if not found
29
+
30
+ 3. **Verify target phase:**
31
+
32
+ - Confirm Phase {after} exists in roadmap
33
+ - Verify phase is in current milestone
34
+
35
+ 4. **Find existing decimals:**
36
+
37
+ - Search for existing decimal phases (e.g., 7.1, 7.2)
38
+ - Calculate next decimal: max + 1
39
+ - Examples:
40
+ - Phase 7 with no decimals → next is 7.1
41
+ - Phase 7 with 7.1 → next is 7.2
42
+
43
+ 5. **Generate slug:**
44
+
45
+ - Convert description to kebab-case
46
+ - Example: `06.1-fix-critical-auth-bug`
47
+
48
+ 6. **Create phase directory:**
49
+
50
+ ```bash
51
+ mkdir -p ".luca/phases/${decimal_phase}-${slug}"
52
+ ```
53
+
54
+ 7. **Update roadmap:**
55
+
56
+ - Insert new phase entry after target phase
57
+ - Include "(INSERTED)" marker
58
+ - Add Goal, Depends on, Plans placeholders
59
+
60
+ 8. **Roadmap update:**
61
+
62
+ The roadmap edit is the durable change. Confirm via `luca roadmap read`. The workflow state in `.luca/state.json` updates separately when the pipeline transitions into the inserted phase.
63
+
64
+ 9. **Present completion:**
65
+
66
+ ```
67
+ Phase {decimal_phase} inserted after Phase {after}:
68
+ - Description: {description}
69
+ - Marker: (INSERTED) - indicates urgent work
70
+
71
+ ## ▶ Next Up
72
+
73
+ `/phase-plan {decimal_phase}`
74
+ ```
75
+
76
+ ## Anti-Patterns
77
+
78
+ - Don't use for planned work at end of milestone (use `/phase-add`)
79
+ - Don't insert before Phase 1
80
+ - Don't renumber existing phases
81
+ - Don't create plans yet (that's `/phase-plan`)
82
+ - Don't commit changes (user decides when to commit)
83
+
84
+ ## Success Criteria
85
+
86
+ - [ ] Phase directory created
87
+ - [ ] Roadmap updated with new phase entry (includes "(INSERTED)" marker)
88
+ - [ ] Phase inserted in correct position
89
+ - [ ] `.luca/state.json` reflects the new phase (read back via `luca state read` to confirm)
90
+ - [ ] Decimal number calculated correctly
91
+
92
+ ## Next Steps
93
+
94
+ **Primary:** `/phase-plan {N.1}` — Create execution plans for the inserted phase
95
+
96
+ **Also available:**
97
+
98
+ - `/phase-discuss {N.1}` — Gather context before planning
99
+ - `/progress` — Check overall project status
100
+ </main>
@@ -0,0 +1,461 @@
1
+ ---
2
+ name: phase-plan
3
+ description: Create detailed plan.md execution plans for a specific phase with tasks, waves, and verification.
4
+ ---
5
+
6
+ <main>
7
+ # Luca Plan Phase
8
+
9
+ Create executable phase prompts (plan.md files) for a roadmap phase with integrated research and verification.
10
+
11
+ **Default flow:** Cognitive Pre-Flight → Research (if needed) → Plan → Verify → Done
12
+
13
+ **Arguments:** `[phase] [--research] [--skip-research] [--gaps] [--skip-verify] [--skip-memory]`
14
+
15
+ ## Sub-agent Delegation Requirements
16
+
17
+ This skill is an **orchestrator**. YOU MUST delegate work to sub-agents using the Task tool.
18
+
19
+ **Required sub-agents for this skill:**
20
+
21
+ - `researcher` - Researches implementation approaches before planning (5-dimension parallel batch)
22
+ - The `architect` mode-agent performs the planning work in v13 (the v12-era `lu-planner` subagent was dropped per plan §5.6)
23
+ - `plan-reviewer` - Validates plans before execution
24
+
25
+ **DO NOT** attempt to research, plan, or verify plans yourself. Spawn the appropriate subagents via the `Task` tool, or invoke the architect mode-agent.
26
+
27
+ ## Cognitive Pre-Flight (NEW)
28
+
29
+ Before planning begins, run cognitive pre-flight:
30
+
31
+ ### Step 0: Load Cognitive Context
32
+
33
+ **Unless `--skip-memory` is passed:**
34
+
35
+ 1. **Load project identity** from MuninnDB:
36
+
37
+ ```
38
+ mcp__muninn__muninn_recall_tree(vault: "default", id: "brain:project-identity")
39
+ ```
40
+
41
+ Extract: architecture patterns, code conventions, development preferences
42
+
43
+ 2. **Selective recall of learnings** from MuninnDB based on phase keywords:
44
+
45
+ ```
46
+ mcp__muninn__muninn_recall(vault: "default", context: "patterns, decisions, and pitfalls relevant to phase {PHASE}")
47
+ ```
48
+
49
+ Look for: relevant patterns, past decisions, known pitfalls
50
+
51
+ 2.5. **Recall relevant procedures** from MuninnDB:
52
+
53
+ ```
54
+ mcp__muninn__muninn_recall(vault: "default", context: "reusable procedures and workflows for {phase_description}")
55
+ ```
56
+
57
+ Procedures are step-sequence templates from past successful executions.
58
+ The planner should consider them as starting points for task breakdown.
59
+
60
+ 3. **Initialize session** in MuninnDB for this planning session:
61
+
62
+ ```
63
+ mcp__muninn__muninn_remember(vault: "default", concept: "session:info", content: "workflow=phase-plan, phase=[phase number], started=[timestamp]")
64
+ ```
65
+
66
+ Store recalled context:
67
+ - **Patterns**: [relevant patterns from MuninnDB]
68
+ - **Decisions**: [relevant decisions]
69
+ - **Pitfalls**: [flagged pitfalls]
70
+ - **Procedures**: [relevant procedures from MuninnDB]
71
+
72
+ 4. **Generate intuition flags**:
73
+ - RISK: If past planning failed in similar areas
74
+ - CAUTION: If complexity or integration issues noted
75
+ - OPPORTUNITY: If strong patterns exist to follow
76
+
77
+ **Use cognitive context in planning:**
78
+
79
+ - Inform task breakdown based on past patterns
80
+ - Identify areas needing extra verification
81
+ - Apply successful planning approaches
82
+
83
+ ## Process
84
+
85
+ ### 1. Validate Environment and Resolve Model Profile
86
+
87
+ ```bash
88
+ ls .luca/ 2>/dev/null
89
+ ```
90
+
91
+ If not found: Error - user should run `/project-new` first.
92
+
93
+ Models are resolved at runtime via `resolveModelForAgent(agentName, complexity)` from the centralized routing table (`src/complexity/__helpers/model-routing.ts`) — the orchestrator does not pick model strings. The `researcher`, `architect` (mode-agent), and `plan-reviewer` subagents all inherit the appropriate tier based on the active complexity level.
94
+
95
+ ### 2. Parse and Normalize Arguments
96
+
97
+ Extract from arguments:
98
+
99
+ - Phase number (integer or decimal like `2.1`)
100
+ - `--research` flag to force re-research
101
+ - `--skip-research` flag to skip research
102
+ - `--gaps` flag for gap closure mode
103
+ - `--skip-verify` flag to bypass verification loop
104
+
105
+ **If no phase number:** Detect next unplanned phase from roadmap.
106
+
107
+ **Normalize phase to zero-padded format:**
108
+
109
+ ```bash
110
+ if [[ "$PHASE" =~ ^[0-9]+$ ]]; then
111
+ PHASE=$(printf "%02d" "$PHASE")
112
+ elif [[ "$PHASE" =~ ^([0-9]+).([0-9]+)$ ]]; then
113
+ PHASE=$(printf "%02d.%s" "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}")
114
+ fi
115
+ ```
116
+
117
+ ### 3. Validate Phase
118
+
119
+ ```bash
120
+ grep -A5 "Phase ${PHASE}:" .luca/roadmap.md 2>/dev/null
121
+ ```
122
+
123
+ If not found: Error with available phases. If found: Extract phase number, name, description.
124
+
125
+ ### 4. Ensure Phase Directory Exists
126
+
127
+ ```bash
128
+ PHASE_DIR=$(ls -d .luca/phases/${PHASE}-* 2>/dev/null | head -1)
129
+ if [ -z "$PHASE_DIR" ]; then
130
+ PHASE_NAME=$(grep "Phase ${PHASE}:" .luca/roadmap.md | sed 's/.*Phase [0-9]*: //' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
131
+ mkdir -p ".luca/phases/${PHASE}-${PHASE_NAME}"
132
+ PHASE_DIR=".luca/phases/${PHASE}-${PHASE_NAME}"
133
+ fi
134
+ ```
135
+
136
+ ### 5. Handle Research
137
+
138
+ **If `--gaps` flag:** Skip research (gap closure uses VERIFICATION.md instead).
139
+
140
+ **If `--skip-research` flag:** Skip to step 6.
141
+
142
+ **Always runs** (model tier for lu-phase-researcher resolved from routing table per complexity). The `--skip-research` flag still allows skipping entirely.
143
+
144
+ | Complexity | Research | Model Tier (from routing table) |
145
+ |------------|----------|---------------------------------|
146
+ | TRIVIAL | Run | fast |
147
+ | SIMPLE | Run | balanced |
148
+ | MODERATE | Run | balanced |
149
+ | COMPLEX | Run | capable |
150
+ | CRITICAL | Run | capable |
151
+
152
+ Read complexity from the canonical workflow state:
153
+
154
+ ```bash
155
+ COMPLEXITY=$(luca state read 2>/dev/null | jq -r '.complexity // "MODERATE"')
156
+ ```
157
+
158
+ The researcher model tier is resolved via `resolveModelForAgent("lu-phase-researcher", complexity)`.
159
+
160
+ **Check config for research setting:**
161
+
162
+ ```bash
163
+ WORKFLOW_RESEARCH=$(cat .luca/config.json 2>/dev/null | grep -o '"research"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true|false' || echo "true")
164
+ ```
165
+
166
+ **MANDATORY**: If research is needed, you MUST spawn a lu-phase-researcher sub-agent. Do NOT attempt to research yourself.
167
+
168
+ First, read the required context:
169
+
170
+ ```bash
171
+ ROADMAP_CONTENT=$(cat .luca/roadmap.md)
172
+ # Read workflow state from .luca/state.json via the luca CLI
173
+ STATE_JSON=$(luca state read 2>/dev/null || echo '{"initialized":false}')
174
+ # Phase-scoped context (research, plan, decisions) lives under .luca/phases/<currentPhaseSlug>/
175
+ CONTEXT_CONTENT=$(find .luca/phases -name context.md -newer .luca/state.json 2>/dev/null | head -1 | xargs cat 2>/dev/null || echo "No context file")
176
+ ```
177
+
178
+ Then spawn the researcher:
179
+
180
+ ```python
181
+ Task(
182
+ prompt="""
183
+ <research_context>
184
+
185
+ **Phase:** {phase_number}
186
+ **Phase Name:** {phase_name}
187
+ **Phase Goal:** {phase_goal from roadmap}
188
+
189
+ **Roadmap:**
190
+ {roadmap_content}
191
+
192
+ **Project State:**
193
+ {state_content}
194
+
195
+ **Requirements:**
196
+ {requirements_content}
197
+
198
+ **Domain Context:**
199
+ {context_content}
200
+
201
+ </research_context>
202
+
203
+ <research_focus>
204
+ 1. How should this phase be implemented?
205
+ 2. What existing patterns in the codebase should be followed?
206
+ 3. What dependencies or integrations are needed?
207
+ 4. What risks or challenges should be anticipated?
208
+ </research_focus>
209
+
210
+ <output_requirements>
211
+ - Create research.md in phase directory
212
+ - Return summary of key findings and recommendations
213
+ </output_requirements>
214
+
215
+ Research how to implement this phase. Analyze the codebase, identify patterns, and document findings.
216
+ """,
217
+ subagent_type="lu-phase-researcher",
218
+ model="{researcher_model}",
219
+ description="Research Phase {phase_number}"
220
+ )
221
+ ```
222
+
223
+ **Do NOT proceed until the Task returns.**
224
+
225
+ ### 6. Check Existing Plans
226
+
227
+ ```bash
228
+ ls "${PHASE_DIR}"/*-plan.md 2>/dev/null
229
+ ```
230
+
231
+ If exists: Offer to continue planning, view existing, or replan from scratch.
232
+
233
+ ### 7. Read Context Files
234
+
235
+ Read and store context file contents for the planning step:
236
+
237
+ - Workflow state via `luca state read`, roadmap.md
238
+ - MuninnDB `brain:project-requirements` (recall), active phase's context.md + research.md (if exist)
239
+ - Active phase's verify.json (if --gaps mode)
240
+
241
+ ### 8. Invoke the Architect Mode-Agent (Planning)
242
+
243
+ Display stage banner:
244
+
245
+ ```
246
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
247
+ Luca ► PLANNING PHASE {X}
248
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
249
+
250
+ ◆ Invoking architect mode-agent for planning...
251
+ ```
252
+
253
+ **MANDATORY**: The architect mode-agent performs planning in v13 (the v12-era `lu-planner` subagent was dropped per plan §5.6). Invoke it via the standard mode-transition flow — do NOT attempt to create plans yourself.
254
+
255
+ First, read all context files (already done in step 7):
256
+
257
+ ```bash
258
+ # Read workflow state from .luca/state.json via the luca CLI
259
+ STATE_JSON=$(luca state read 2>/dev/null || echo '{"initialized":false}')
260
+ ROADMAP_CONTENT=$(cat .luca/roadmap.md)
261
+ RESEARCH_CONTENT=$(cat "${PHASE_DIR}/research.md" 2>/dev/null || echo "No research file")
262
+ VERIFICATION_CONTENT=$(cat "${PHASE_DIR}/verify.json" 2>/dev/null || echo "") # For gaps mode
263
+ # Recall session context from MuninnDB:
264
+ # mcp__muninn__muninn_recall(vault: "default", context: "current session context for planning")
265
+ WORKING_CONTENT="[recalled from MuninnDB session context]"
266
+ ```
267
+
268
+ Then invoke the architect mode-agent (typically by transitioning into the architect mode-agent's plan flow):
269
+
270
+ ```python
271
+ # The architect mode-agent is invoked via the standard mode-transition flow rather than spawned as a subagent.
272
+ # When orchestrating from this skill body, build the planning brief and pass it to the architect mode-agent's
273
+ # plan step. The brief includes:
274
+ #
275
+ # <planning_context>
276
+ # Phase: {phase_number}
277
+ # Phase Name: {phase_name}
278
+ # Mode: {standard | gap_closure}
279
+ # Phase Directory: {phase_dir}
280
+ # Project State: {state_content}
281
+ # Roadmap: {roadmap_content}
282
+ # Research (if available): {research_content}
283
+ # Verification Issues (for gap mode): {verification_content}
284
+ # Working Memory: {working_content}
285
+ # </planning_context>
286
+ #
287
+ # <downstream_consumer>
288
+ # Output consumed by /phase-execute.
289
+ # Plans must be executable prompts with: YAML frontmatter (id, title, wave, tasks), clear task descriptions with goals,
290
+ # verification criteria for each task, dependencies between tasks.
291
+ # </downstream_consumer>
292
+ #
293
+ # <output_requirements>
294
+ # - Write the canonical plan.md to .luca/phases/<slug>/plan.md
295
+ # - Organize tasks into waves for parallel execution
296
+ # - Each plan should be focused and completable in one session
297
+ # - Return summary of plan created
298
+ # </output_requirements>
299
+ Task(
300
+ prompt="...",
301
+ subagent_type="architect", # mode-agent name
302
+ description="Plan Phase {phase_number}"
303
+ )
304
+ ```
305
+
306
+ **Do NOT proceed until the Task returns.**
307
+
308
+ ### 9. Handle Planner Return
309
+
310
+ - **PLANNING COMPLETE:** Proceed to verification (unless --skip-verify)
311
+ - **CHECKPOINT REACHED:** Present to user, get response
312
+ - **PLANNING INCONCLUSIVE:** Offer options to add context, retry, or manual
313
+
314
+ ### 10. Spawn lu-plan-checker Agent
315
+
316
+ Display:
317
+
318
+ ```
319
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
320
+ Luca ► VERIFYING PLANS
321
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
322
+ ```
323
+
324
+ **Always runs** (iteration count scales with complexity, model tier for lu-plan-checker resolved from routing table).
325
+
326
+ | Complexity | Plan Verification Iterations | Model Tier (from routing table) |
327
+ |------------|-----------------------------|---------------------------------|
328
+ | TRIVIAL | 1 iteration | fast |
329
+ | SIMPLE | 1 iteration | balanced |
330
+ | MODERATE | 1 iteration | balanced |
331
+ | COMPLEX | 2 iterations | capable |
332
+ | CRITICAL | 3 iterations | capable |
333
+
334
+ The plan-checker model tier is resolved via `resolveModelForAgent("lu-plan-checker", complexity)`.
335
+
336
+ **MANDATORY**: You MUST spawn the `plan-reviewer` subagent. Do NOT attempt to verify plans yourself.
337
+
338
+ First, read the created plan (canonical: one `plan.md` per phase per LUCA_DIR_CONTRACT):
339
+
340
+ ```bash
341
+ PLAN_CONTENT=$(cat "${PHASE_DIR}/plan.md" 2>/dev/null)
342
+ ROADMAP_CONTENT=$(cat .luca/roadmap.md)
343
+ # Recall requirements from MuninnDB:
344
+ # mcp__muninn__muninn_recall_tree(vault: "<repo_vault>", id: "brain:project-requirements")
345
+ ```
346
+
347
+ Then spawn the plan checker:
348
+
349
+ ```python
350
+ Task(
351
+ prompt="""
352
+ <verification_context>
353
+
354
+ **Phase:** {phase_number}
355
+ **Phase Goal:** {phase_goal from roadmap}
356
+
357
+ **Plans to Verify:**
358
+ {plans_content}
359
+
360
+ **Roadmap:**
361
+ {roadmap_content}
362
+
363
+ **Requirements:**
364
+ {requirements_content}
365
+
366
+ </verification_context>
367
+
368
+ <verification_criteria>
369
+ 1. **Completeness**: Do plans cover all phase requirements?
370
+ 2. **Executability**: Are tasks clear and actionable?
371
+ 3. **Dependencies**: Are wave assignments and dependencies correct?
372
+ 4. **Verification**: Does each task have verification criteria?
373
+ 5. **Goal Alignment**: Will executing these plans achieve the phase goal?
374
+ </verification_criteria>
375
+
376
+ <output_requirements>
377
+ - Return status: PASSED | ISSUES_FOUND
378
+ - If issues found, list specific problems with plan references
379
+ - Suggest fixes for each issue
380
+ </output_requirements>
381
+
382
+ Verify these plans will achieve the phase goal when executed.
383
+ """,
384
+ subagent_type="lu-plan-checker",
385
+ model="{checker_model}",
386
+ description="Verify Phase {phase_number} plans"
387
+ )
388
+ ```
389
+
390
+ **Do NOT proceed until the Task returns.**
391
+
392
+ ### 11. Handle Checker Return
393
+
394
+ - **VERIFICATION PASSED:** Plans verified, ready for execution
395
+ - **ISSUES FOUND:** Send back to planner for revision
396
+
397
+ ### 12. Revision Loop (Complexity-Scaled Iterations)
398
+
399
+ Check the current complexity level's gating matrix for `planVerificationIterations`:
400
+
401
+ ```bash
402
+ luca state read 2>/dev/null | jq -r '.complexity // "MODERATE"'
403
+ # Then parse planVerificationIterations from .luca/config.json complexity matrix for that level
404
+ ```
405
+
406
+ The complexity matrix lives in `.luca/config.json` under `complexity.matrix.<LEVEL>.planVerificationIterations`.
407
+
408
+ If issues found and iteration_count < planVerificationIterations:
409
+
410
+ - Re-invoke the architect mode-agent with revision context
411
+ - Re-verify with the plan-reviewer subagent
412
+ - Repeat until passed or max iterations
413
+
414
+ ### 13. Present Final Status
415
+
416
+ ```
417
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
418
+ Luca ► PHASE {X} PLANNED ✓
419
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
420
+
421
+ **Phase {X}: {Name}** — {N} plan(s) in {M} wave(s)
422
+
423
+ | Wave | Plans | What it builds |
424
+ |------|-------|----------------|
425
+ | 1 | 01, 02 | [objectives] |
426
+ | 2 | 03 | [objective] |
427
+
428
+ ## ▶ Next Up
429
+
430
+ **Execute Phase {X}** — run all {N} plans
431
+
432
+ /phase-execute {X}
433
+ ```
434
+
435
+ ## Success Criteria
436
+
437
+ - [ ] .luca/ directory validated
438
+ - [ ] Phase validated against roadmap
439
+ - [ ] Phase directory created if needed
440
+ - [ ] Research completed (unless --skip-research or --gaps or exists)
441
+ - [ ] architect mode-agent invoked with planning context (researcher + plan-reviewer subagents spawned as required)
442
+ - [ ] Plans created
443
+ - [ ] lu-plan-checker spawned (unless --skip-verify)
444
+ - [ ] Verification passed OR user override
445
+ - [ ] User knows next steps (execute or review)
446
+
447
+ ## Next Steps
448
+
449
+ | Condition | Action | Command |
450
+ | -------------------------- | ----------------- | ------------------------------ |
451
+ | Plans created successfully | Execute the phase | `/phase-execute {phase}` |
452
+ | Want to review plans first | Check progress | `/progress` |
453
+ | Need more context | Discuss the phase | `/phase-discuss {phase}` |
454
+
455
+ **Primary:** `/phase-execute {phase}` — Run all plans in the phase
456
+
457
+ **Also available:**
458
+
459
+ - `/progress` — See plan details before executing
460
+ - `/phase-discuss {phase}` — Gather more context if plans seem off
461
+ </main>
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: phase-remove
3
+ description: Remove a future phase from the roadmap and renumber subsequent phases.
4
+ ---
5
+
6
+ <main>
7
+ # Luca Remove Phase
8
+
9
+ Remove an unstarted future phase from the roadmap and renumber all subsequent phases to maintain a clean, linear sequence.
10
+
11
+ **Arguments:** `<phase-number>` (integer or decimal)
12
+
13
+ **Purpose:** Clean removal of work you've decided not to do, without polluting context with cancelled/deferred markers.
14
+
15
+ **Output:** Phase deleted, all subsequent phases renumbered, git commit as historical record.
16
+
17
+ ## Process
18
+
19
+ 1. **Parse arguments:**
20
+
21
+ - Argument is the phase number to remove
22
+ - Error if not provided
23
+
24
+ 2. **Load state:**
25
+
26
+ \`\`\`bash
27
+ STATE_JSON=$(luca state read 2>/dev/null || echo '{"initialized":false}')
28
+ \`\`\`
29
+
30
+ - Read `.luca/roadmap.md` (or call `luca roadmap read`)
31
+ - Parse current phase number from the workflow state JSON
32
+
33
+ 3. **Validate phase exists:**
34
+
35
+ - Search for `### Phase {target}:` heading
36
+ - Error with available phases if not found
37
+
38
+ 4. **Validate future phase:**
39
+
40
+ - Target must be > current phase number
41
+ - Check for SUMMARY.md files (can't remove completed work)
42
+
43
+ 5. **Gather phase info:**
44
+
45
+ - Extract phase name
46
+ - Find phase directory
47
+ - Find all subsequent phases that need renumbering
48
+
49
+ 6. **Confirm removal:**
50
+
51
+ - Present what will be deleted/renumbered
52
+ - Wait for confirmation
53
+
54
+ 7. **Delete phase directory:**
55
+
56
+ - Remove `.luca/phases/{target}-{slug}/`
57
+
58
+ 8. **Renumber directories:**
59
+
60
+ - Process in descending order to avoid conflicts
61
+ - Rename integer and decimal phase directories
62
+
63
+ 9. **Rename files in directories:**
64
+
65
+ - Rename plan files inside renumbered directories
66
+
67
+ 10. **Update `.luca/roadmap.md`:**
68
+
69
+ - Remove phase section entirely
70
+ - Renumber all subsequent phases
71
+ - Update dependency references
72
+
73
+ 11. **Roadmap update:**
74
+
75
+ The roadmap edit is the durable change. Confirm via `luca roadmap read`. The workflow state in `.luca/state.json` reads phase counts from the roadmap on demand — no separate state snapshot step is needed.
76
+
77
+ 12. **Commit:**
78
+ - `chore: remove phase {target} ({original-phase-name})`
79
+
80
+ ## Anti-Patterns
81
+
82
+ - Don't remove completed phases (have SUMMARY.md files)
83
+ - Don't remove current or past phases
84
+ - Don't leave gaps in numbering - always renumber
85
+ - Don't add "removed phase" notes to `.luca/state.json` — the git commit is the record
86
+
87
+ ## Edge Cases
88
+
89
+ - **Removing decimal phase:** Only affects other decimals in same series
90
+ - **No subsequent phases:** Just delete and update `.luca/roadmap.md`
91
+ - **Phase directory doesn't exist:** Skip deletion, proceed with updates
92
+ - **Decimal phases under removed integer:** Renumber to previous integer
93
+
94
+ ## Success Criteria
95
+
96
+ - [ ] Target phase validated as future/unstarted
97
+ - [ ] Phase directory deleted (if existed)
98
+ - [ ] All subsequent phase directories renumbered
99
+ - [ ] Files inside directories renamed
100
+ - [ ] `.luca/roadmap.md` updated (section removed, all references renumbered)
101
+ - [ ] `.luca/state.json` reflects the new phase numbering (read back via `luca state read` to confirm)
102
+ - [ ] Changes committed with descriptive message
103
+ - [ ] No gaps in phase numbering
104
+
105
+ ## Next Steps
106
+
107
+ **Primary:** `/progress` — Check updated project status
108
+
109
+ **Also available:**
110
+
111
+ - `/phase-plan {next}` — Plan the next phase
112
+ - `/phase-execute {current}` — Continue current execution
113
+ </main>