@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,545 @@
1
+ ---
2
+ name: milestone-audit
3
+ description: Audit milestone completion against original requirements and acceptance criteria.
4
+ ---
5
+
6
+ <main>
7
+ # Luca Audit Milestone
8
+
9
+ Audit milestone completion against original intent with cross-phase code review.
10
+
11
+ **Arguments:** `[version]` (optional - uses current milestone if not provided)
12
+
13
+ ## Sub-agent Delegation Requirements
14
+
15
+ This skill is an **orchestrator**. YOU MUST delegate work to sub-agents using the Task tool.
16
+
17
+ **Required sub-agents for this skill:**
18
+
19
+ - `lu-integration-checker` - Verifies cross-phase integration
20
+ - `dx-advocate` - Code quality review (milestone-wide)
21
+ - `code-simplifier` - DRY and complexity review
22
+ - `code-architect` - Architecture coherence review
23
+ - `ui` - Tailwind/styling review
24
+ - `security-auditor` - Security review (milestone-wide)
25
+
26
+ **DO NOT** attempt to check integration or review code yourself. Spawn the appropriate subagents via the `Task` tool.
27
+
28
+ ## Model Profile
29
+
30
+ ```bash
31
+ MODEL_PROFILE=$(cat .luca/config.json 2>/dev/null | grep -o '"model_profile"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "balanced")
32
+ ```
33
+
34
+ **Model lookup table:**
35
+
36
+ | Agent | quality | balanced | budget |
37
+ | ------------------------- | ------- | -------- | ------ |
38
+ | lu-integration-checker | sonnet | sonnet | haiku |
39
+ | dx-advocate | opus | sonnet | haiku |
40
+ | code-simplifier | opus | sonnet | haiku |
41
+ | code-architect | opus | sonnet | haiku |
42
+ | tailwind-auditor | opus | sonnet | haiku |
43
+ | security-auditor | opus | sonnet | haiku |
44
+
45
+ > **Current Limitation:** Cursor's Task tool only supports `model="fast"` or inheriting from parent. This table is preserved for future compatibility.
46
+
47
+ **Current model variable values:**
48
+
49
+ ```
50
+ # All audit agents require reasoning → omit (inherit from parent)
51
+ integration_checker_model = (omit)
52
+ reviewer_model = (omit) # dx-advocate, code-simplifier, etc.
53
+ ```
54
+
55
+ ## Process
56
+
57
+ ### 1. Load Context
58
+
59
+ - Read all phase `verify.json` files for the milestone
60
+ - Recall requirements from MuninnDB (`brain:project-requirements`)
61
+ - Recall the project identity from MuninnDB (`brain:project-identity`) for original intent
62
+
63
+ ### 2. Check Requirements Coverage
64
+
65
+ - Compare completed requirements to original v1 list
66
+ - Identify any gaps or partial implementations
67
+
68
+ ### 3. Spawn Integration Checker
69
+
70
+ **MANDATORY**: You MUST spawn the integration-checker (run as a `reviewer` subagent with perspective=integration). Do NOT verify integration yourself.
71
+
72
+ First, read the phase context:
73
+
74
+ ```bash
75
+ VERIFICATION_FILES=$(find .luca/phases -name "verify.json" -exec cat {} \;)
76
+ ROADMAP_CONTENT=$(cat .luca/roadmap.md)
77
+ # Recall requirements from MuninnDB:
78
+ # mcp__muninn__muninn_recall_tree(vault: "<repo_vault>", id: "brain:project-requirements")
79
+ ```
80
+
81
+ Then spawn the integration checker:
82
+
83
+ ````python
84
+ Task(
85
+ prompt="""
86
+ <integration_context>
87
+
88
+ **Milestone:** v{version}
89
+
90
+ **Phase Verifications:**
91
+ {verification_files}
92
+
93
+ **Requirements:**
94
+ {requirements_content}
95
+
96
+ **Roadmap:**
97
+ {roadmap_content}
98
+
99
+ </integration_context>
100
+
101
+ <verification_targets>
102
+ 1. Cross-phase wiring: Do components from different phases connect properly?
103
+ 2. End-to-end flows: Do user journeys work across phase boundaries?
104
+ 3. Data flow: Is data passed correctly between phases?
105
+ 4. API contracts: Do interfaces match expectations?
106
+ </verification_targets>
107
+
108
+ <output_requirements>
109
+ Return status and any integration gaps found:
110
+ ```yaml
111
+ status: passed | gaps_found
112
+ integration_score: N/M
113
+ gaps:
114
+ - description: "Gap description"
115
+ phases_affected: ["01", "03"]
116
+ severity: critical | high | medium
117
+ ````
118
+
119
+ </output_requirements>
120
+
121
+ Verify cross-phase integration for this milestone.
122
+ """,
123
+ subagent_type="lu-integration-checker",
124
+ model="{checker_model}",
125
+ description="Integration check: v{version}"
126
+ )
127
+
128
+ ````
129
+
130
+ **Do NOT proceed until the Task returns.**
131
+
132
+ ### 4. Milestone-wide Code Quality Review
133
+
134
+ **Get all files changed in this milestone:**
135
+
136
+ ```bash
137
+ # Find milestone start commit (first commit on this branch or tag)
138
+ MILESTONE_START=$(git merge-base main HEAD 2>/dev/null || git rev-list --max-parents=0 HEAD)
139
+
140
+ # Get all TypeScript/TSX files changed since milestone start
141
+ CHANGED_FILES=$(git diff --name-only $MILESTONE_START HEAD -- '*.ts' '*.tsx' 2>/dev/null | head -100)
142
+ FILE_COUNT=$(echo "$CHANGED_FILES" | grep -c '.' || echo "0")
143
+ ````
144
+
145
+ **If files changed:** Display:
146
+
147
+ ```
148
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
149
+ Luca ► MILESTONE CODE REVIEW
150
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
151
+
152
+ ◆ Reviewing {FILE_COUNT} files changed across all phases...
153
+ ```
154
+
155
+ **MANDATORY**: Spawn ALL reviewers in PARALLEL. Do NOT review code yourself.
156
+
157
+ First, read project standards:
158
+
159
+ ```bash
160
+ CLAUDE_CONTENT=$(cat CLAUDE.md 2>/dev/null || echo "No CLAUDE.md")
161
+ ```
162
+
163
+ Then spawn ALL reviewers in PARALLEL (same message, multiple Task calls):
164
+
165
+ ````python
166
+ # DX Advocate - conventions across phases
167
+ Task(
168
+ prompt="""
169
+ Review files changed across this milestone for code quality issues.
170
+
171
+ **Changed files (all phases):**
172
+ {changed_files}
173
+
174
+ **Project standards:**
175
+ {claude_content}
176
+
177
+ **Your focus:** Conventions consistency across phases, snake_case keys, Lodash usage patterns
178
+
179
+ **Milestone-level concerns:**
180
+ - Cross-phase patterns and consistency
181
+ - DRY violations across phases
182
+ - Accumulated tech debt
183
+
184
+ **Return format:**
185
+ ```yaml
186
+ issues:
187
+ - severity: CRITICAL|HIGH|MEDIUM|LOW
188
+ file: path/to/file.ts
189
+ line: 42
190
+ issue: Brief description
191
+ suggestion: How to fix
192
+ cross_phase: true|false
193
+ ````
194
+
195
+ If no issues: `issues: []`
196
+ """,
197
+ subagent_type="dx-advocate",
198
+ model="{reviewer_model}",
199
+ description="Milestone DX review"
200
+ )
201
+
202
+ # Code Simplifier - DRY across phases
203
+
204
+ Task(
205
+ prompt="""
206
+ Review files changed across this milestone for complexity and duplication.
207
+
208
+ **Changed files (all phases):**
209
+ {changed_files}
210
+
211
+ **Your focus:** DRY violations across phases, duplicated utilities, refactoring opportunities
212
+
213
+ **Return format:**
214
+
215
+ ```yaml
216
+ issues:
217
+ - severity: CRITICAL|HIGH|MEDIUM|LOW
218
+ file: path/to/file.ts
219
+ line: 42
220
+ issue: Brief description
221
+ suggestion: How to fix
222
+ cross_phase: true|false
223
+ ```
224
+
225
+ """,
226
+ subagent_type="code-simplifier",
227
+ model="{reviewer_model}",
228
+ description="Milestone simplification review"
229
+ )
230
+
231
+ # Code Architect - architecture coherence
232
+
233
+ Task(
234
+ prompt="""
235
+ Review files changed across this milestone for architecture issues.
236
+
237
+ **Changed files (all phases):**
238
+ {changed_files}
239
+
240
+ **Your focus:** Architecture consistency, module boundaries, file organization, pattern coherence across phases
241
+
242
+ **Return format:**
243
+
244
+ ```yaml
245
+ issues:
246
+ - severity: CRITICAL|HIGH|MEDIUM|LOW
247
+ file: path/to/file.ts
248
+ line: 42
249
+ issue: Brief description
250
+ suggestion: How to fix
251
+ cross_phase: true|false
252
+ ```
253
+
254
+ """,
255
+ subagent_type="code-architect",
256
+ model="{reviewer_model}",
257
+ description="Milestone architecture review"
258
+ )
259
+
260
+ # Tailwind Auditor - styling consistency
261
+
262
+ Task(
263
+ prompt="""
264
+ Review files changed across this milestone for Tailwind/styling issues.
265
+
266
+ **Changed files (all phases):**
267
+ {changed_files}
268
+
269
+ **Your focus:** Dynamic color system usage, shadcn anti-patterns, Tailwind consistency
270
+
271
+ **Return format:**
272
+
273
+ ```yaml
274
+ issues:
275
+ - severity: CRITICAL|HIGH|MEDIUM|LOW
276
+ file: path/to/file.ts
277
+ line: 42
278
+ issue: Brief description
279
+ suggestion: How to fix
280
+ cross_phase: true|false
281
+ ```
282
+
283
+ """,
284
+ subagent_type="ui",
285
+ model="{reviewer_model}",
286
+ description="Milestone Tailwind review"
287
+ )
288
+
289
+ # Security Auditor - security across milestone
290
+
291
+ Task(
292
+ prompt="""
293
+ Review files changed across this milestone for security issues.
294
+
295
+ **Changed files (all phases):**
296
+ {changed_files}
297
+
298
+ **Your focus:** Auth patterns consistency, API security across all endpoints, data flow
299
+
300
+ **Return format:**
301
+
302
+ ```yaml
303
+ issues:
304
+ - severity: CRITICAL|HIGH|MEDIUM|LOW
305
+ file: path/to/file.ts
306
+ line: 42
307
+ issue: Brief description
308
+ suggestion: How to fix
309
+ cross_phase: true|false
310
+ ```
311
+
312
+ """,
313
+ subagent_type="security-auditor",
314
+ model="{reviewer_model}",
315
+ description="Milestone security review"
316
+ )
317
+
318
+ ```
319
+
320
+ **Do NOT proceed until ALL Tasks return.**
321
+
322
+ **Agent-specific focus:**
323
+
324
+ - **dx-advocate**: "Conventions consistency across phases, snake_case keys, Lodash usage patterns"
325
+ - **code-simplifier**: "DRY violations across phases, duplicated utilities, refactoring opportunities"
326
+ - **code-architect**: "Architecture consistency, module boundaries, file organization, pattern coherence across phases"
327
+ - **tailwind-auditor**: "Dynamic color system usage, shadcn anti-patterns (text-muted-foreground, bg-primary), Tailwind consistency"
328
+ - **security-auditor**: "Auth patterns consistency, API security across all endpoints, data flow"
329
+
330
+ **Merge findings:** Combine all issues, categorize by severity and cross-phase flag. Store each reviewer's raw output keyed by agent name for potential debate analysis.
331
+
332
+ ### 4.5 Adversarial Debate Round (Conditional)
333
+
334
+ **Gate check:**
335
+
336
+ \`\`\`bash
337
+ # Read debate config
338
+ DEBATE_ENABLED=$(cat .luca/config.json 2>/dev/null | grep -o '"milestone_debate_enabled"[[:space:]]*:[[:space:]]*[a-z]*' | grep -o '[a-z]*$' || echo "true")
339
+ COMPLEXITY=$(luca state read 2>/dev/null | jq -r '.complexity // "MODERATE"')
340
+ \`\`\`
341
+
342
+ **Skip if:** \`DEBATE_ENABLED\` is "false" OR complexity is below COMPLEX, OR no disagreements detected among reviewer outputs from Step 4.
343
+
344
+ **If all gates pass, proceed with debate:**
345
+
346
+ #### 4.5.1 Normalize and Detect
347
+
348
+ Collect all 5 code reviewer outputs (excluding integration checker) from Step 4.
349
+
350
+ - Normalize findings using tribunal detector
351
+ - Detect disagreements by file:line grouping
352
+ - Check severity gate (CRITICAL/HIGH required)
353
+
354
+ **Display tribunal start banner if disagreements found:**
355
+
356
+ \`\`\`
357
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
358
+ Luca >>> MILESTONE DEBATE ROUND
359
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
360
+
361
+ {N} disagreements detected across {M} reviewers.
362
+ Running adversarial rebuttal round...
363
+ \`\`\`
364
+
365
+ #### 4.5.2 Rebuttal Round
366
+
367
+ For each disagreement, spawn challenger and defender in PARALLEL:
368
+
369
+ \`\`\`\`python
370
+ # For each disagreement: spawn challenger and defender
371
+ # Use the SAME reviewer agent type as the original finding
372
+
373
+ Task(
374
+ prompt="""
375
+ {challenger_prompt from buildRebuttalPrompts, augmented with milestone context}
376
+ """,
377
+ subagent_type="{challenger_agent_type}",
378
+ description="Challenge: {finding_summary}"
379
+ )
380
+
381
+ Task(
382
+ prompt="""
383
+ {defender_prompt from buildRebuttalPrompts, augmented with milestone context}
384
+ """,
385
+ subagent_type="{defender_agent_type}",
386
+ description="Defend: {finding_summary}"
387
+ )
388
+ \`\`\`\`
389
+
390
+ **Do NOT proceed until ALL rebuttal Tasks return.**
391
+
392
+ #### 4.5.3 Resolve and Unify
393
+
394
+ Parse rebuttal responses. For each:
395
+ - Determine resolution: upheld, withdrawn, or modified
396
+ - Calculate confidence scores
397
+ - Build unified recommendations
398
+
399
+ #### 4.5.4 Display Debate Results
400
+
401
+ \`\`\`
402
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
403
+ Luca >>> DEBATE COMPLETE
404
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
405
+
406
+ | Metric | Value |
407
+ |-----------------------|-------|
408
+ | Disagreements found | {N} |
409
+ | Rebuttals conducted | {N} |
410
+ | Findings withdrawn | {N} |
411
+ | Findings modified | {N} |
412
+ | Consensus confidence | {avg} |
413
+ | Estimated token cost | {N} |
414
+ \`\`\`
415
+
416
+ #### 4.5.5 Replace Merged Findings
417
+
418
+ Replace the raw merged findings from Step 4 with unified recommendations from the debate. The unified recommendations carry confidence scores and debate history, which are used in Step 5 for the audit report.
419
+
420
+ ### 5. Create Audit Report
421
+
422
+ Location: `.luca/milestones/v{version}-audit.md` (per LUCA_DIR_CONTRACT)
423
+
424
+ Include:
425
+ - Requirements status
426
+ - Integration status
427
+ - Code quality findings (from step 4, or unified recommendations if debate ran)
428
+ - Gaps identified
429
+ - Tech debt (populated from code review findings)
430
+
431
+ **If debate ran (Step 4.5),** add a Debate Analysis section after code quality findings:
432
+
433
+ \`\`\`markdown
434
+ ### Debate Analysis
435
+
436
+ **Disagreements Resolved:** {N}
437
+ **Findings Withdrawn after Challenge:** {N}
438
+ **Findings Modified after Challenge:** {N}
439
+
440
+ #### High-Confidence Findings (>0.8)
441
+
442
+ | Finding | Severity | File | Confidence | Debate Status |
443
+ |---------|----------|------|------------|---------------|
444
+ | {issue} | {sev} | {f} | {conf} | upheld/unchallenged |
445
+
446
+ #### Contested Findings (0.5-0.8)
447
+
448
+ | Finding | Severity | File | Confidence | Challenge Summary |
449
+ |---------|----------|------|------------|-------------------|
450
+ | {issue} | {sev} | {f} | {conf} | {summary} |
451
+
452
+ #### Withdrawn Findings
453
+
454
+ | Original Finding | Original Severity | Withdrawn By | Reason |
455
+ |------------------|-------------------|--------------|--------|
456
+ | {issue} | {sev} | {agent} | {why} |
457
+ \`\`\`
458
+
459
+ **If debate did NOT run,** omit the Debate Analysis section entirely. The report should be identical to the pre-debate format.
460
+
461
+ ### 6. Present Results
462
+
463
+ **Route A: Clean audit**
464
+
465
+ ```
466
+
467
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
468
+ Luca ► MILESTONE v{version} AUDIT COMPLETE ✓
469
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
470
+
471
+ Requirements: {X}/{Y} complete ✓
472
+ Integration: passed ✓
473
+ Code quality: passed ✓
474
+
475
+ ## ▶ Next Up
476
+
477
+ /milestone-complete — archive and celebrate
478
+
479
+ ```
480
+
481
+ **Route B: Issues found**
482
+
483
+ ```
484
+
485
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
486
+ Luca ► MILESTONE v{version} AUDIT ⚠
487
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
488
+
489
+ Requirements: {X}/{Y} complete
490
+ Integration: {status}
491
+ Code quality: {N} issues found
492
+ Debate: {ran/skipped} {if ran: {N} disagreements resolved, {N} withdrawn, {N} modified}
493
+
494
+ ### Gaps Found
495
+
496
+ - {gap 1}
497
+ - {gap 2}
498
+
499
+ ### Tech Debt
500
+
501
+ - {item 1}
502
+ - {item 2}
503
+
504
+ ### Cross-Phase Issues
505
+
506
+ | File | Issue | Phases Affected |
507
+ | ------ | ------- | --------------- |
508
+ | {file} | {issue} | {phases} |
509
+
510
+ ## ▶ Next Up
511
+
512
+ /milestone-gaps — create phases to close gaps
513
+ /milestone-complete — proceed anyway (tech debt noted)
514
+
515
+ ```
516
+
517
+ ## Success Criteria
518
+
519
+ - [ ] All phase VERIFICATION.md files read
520
+ - [ ] Requirements coverage calculated
521
+ - [ ] Integration checker spawned
522
+ - [ ] Code review subagents spawned (dx-advocate, code-simplifier, code-architect, tailwind-auditor, security-auditor)
523
+ - [ ] Cross-phase patterns identified
524
+ - [ ] Tech debt populated from code review findings
525
+ - [ ] `.luca/milestones/v<version>-audit.md` created
526
+ - [ ] Gaps clearly identified
527
+ - [ ] Debate round evaluated (gate check performed; debate ran if gates passed)
528
+ - [ ] If debate ran: unified recommendations replace raw merged findings
529
+ - [ ] If debate ran: audit report includes Debate Analysis section
530
+ - [ ] If debate skipped: behavior identical to pre-debate milestone-audit
531
+
532
+ ## Next Steps
533
+
534
+ | Condition | Action | Command |
535
+ |-----------|--------|---------|
536
+ | Audit passed | Complete milestone | `/milestone-complete` |
537
+ | Gaps found | Plan gap closure | `/milestone-gaps` |
538
+ | Want to review | Check progress | `/progress` |
539
+
540
+ **Primary:** `/milestone-complete` — Archive and prepare for next (if audit passed)
541
+
542
+ **Also available:**
543
+ - `/milestone-gaps` — Create phases to close gaps
544
+ - `/progress` — Review audit results
545
+ </main>
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: milestone-complete
3
+ description: Archive a completed milestone, extract learnings, and prepare for the next version.
4
+ ---
5
+
6
+ <main>
7
+ # Luca Complete Milestone
8
+
9
+ Mark milestone complete, archive snapshots to `.luca/milestones/`, and reset the workflow state + roadmap for the next cycle.
10
+
11
+ **Arguments:** `<version>` (e.g., "1.0", "1.1", "2.0")
12
+
13
+ **Purpose:** Create historical record of shipped version, archive milestone artifacts (roadmap + requirements), and prepare for next milestone.
14
+
15
+ **Output:** Milestone archived (roadmap snapshot + backlog snapshot + audit), `brain:project-identity` MuninnDB tree evolved, learnings consolidated, git tagged.
16
+
17
+ ## Learning Consolidation (NEW)
18
+
19
+ At milestone completion, consolidate all learnings:
20
+
21
+ ### Step 0: Final Learning Extraction
22
+
23
+ Before archiving, ensure all session learnings are captured:
24
+
25
+ 1. **Check for unextracted session learnings** in MuninnDB:
26
+
27
+ ```
28
+ mcp__muninn__muninn_recall(vault: "default", context: "current session context and unextracted findings")
29
+ ```
30
+
31
+ 2. **Invoke lu-learner** if candidate learnings exist
32
+
33
+ 3. **Review milestone-specific insights** in MuninnDB:
34
+ - Patterns that were validated multiple times -> bump to High confidence via `mcp__muninn__muninn_evolve`
35
+ - Decisions that held throughout milestone -> mark as Established
36
+ - Pitfalls that were successfully avoided -> note as Validated
37
+
38
+ ### Step 1: Archive Milestone Memory
39
+
40
+ Create milestone-specific memory snapshot in MuninnDB:
41
+
42
+ ```
43
+ # Export milestone memory graph for archival
44
+ mcp__muninn__muninn_export_graph(vault: "default")
45
+ ```
46
+
47
+ Store the export as `.luca/milestones/v{version}-backlog-snapshot.json` (per LUCA_DIR_CONTRACT).
48
+
49
+ Include in archive:
50
+
51
+ - All patterns validated during this milestone
52
+ - Key decisions and their outcomes
53
+ - Pitfalls discovered and avoided
54
+
55
+ ### Step 2: Clean Session State
56
+
57
+ After archiving, clear session context:
58
+
59
+ ```
60
+ mcp__muninn__muninn_forget(vault: "default", id: "session:*")
61
+ ```
62
+
63
+ Long-term learnings persist in MuninnDB across milestones.
64
+
65
+ ## State Machine Integration
66
+
67
+ When updating state during milestone completion, use the `luca` CLI write surface:
68
+
69
+ ```bash
70
+ # Read current workflow state
71
+ STATE_JSON=$(luca state read 2>/dev/null || echo '{"initialized":false}')
72
+ ```
73
+
74
+ After archiving the milestone, reset workflow state for the next milestone:
75
+
76
+ ```bash
77
+ luca workflow reset 2>/dev/null || true
78
+ ```
79
+
80
+ Milestone identity (`milestone:v<version>`) is stored as an atomic engram in MuninnDB — there is no separate `current_milestone` state field on `.luca/state.json`. After completion, store the completed-milestone marker:
81
+
82
+ ```
83
+ mcp__muninn__muninn_remember(vault: "<repo_vault>", concept: "milestone:v{version}-complete", content: "<summary + outcomes>", tags: ["milestone","complete"])
84
+ ```
85
+
86
+ The durable milestone snapshot files (`.luca/milestones/v<SEMVER>-{roadmap,audit,backlog-snapshot}.md`) carry the human-readable archive.
87
+
88
+ ## Process
89
+
90
+ 0. **Check for audit:**
91
+
92
+ - Look for `.luca/milestones/v{version}-audit.md`
93
+ - If missing or stale: recommend `/milestone-audit` first
94
+ - If audit status is `gaps_found`: recommend `/milestone-gaps` first
95
+ - If audit status is `passed`: proceed
96
+
97
+ 1. **Verify readiness:**
98
+
99
+ - Check all phases have completed plans (SUMMARY.md exists)
100
+ - Present milestone scope and stats
101
+ - Wait for confirmation
102
+
103
+ 2. **Gather stats:**
104
+
105
+ - Count phases, plans, tasks
106
+ - Calculate git range, file changes, LOC
107
+ - Extract timeline from git log
108
+
109
+ 3. **Extract accomplishments:**
110
+
111
+ - Read all phase SUMMARY.md files
112
+ - Extract 4-6 key accomplishments
113
+ - Present for approval
114
+
115
+ 4. **Archive milestone snapshot:**
116
+
117
+ - Create `.luca/milestones/v{version}-roadmap.md` (snapshot of the closing roadmap)
118
+ - Create `.luca/milestones/v{version}-audit.md` (milestone audit summary)
119
+ - Create `.luca/milestones/v{version}-backlog-snapshot.{json,md}` (per LUCA_DIR_CONTRACT — captured in Step 2 above)
120
+ - Reset the active roadmap via `luca roadmap create --file <next-milestone.json>` when a new milestone is ready; or leave the active roadmap empty until `/milestone-new`.
121
+
122
+ 5. **Evolve requirements traceability in MuninnDB:**
123
+
124
+ - Mark all v1 requirements as complete in `brain:project-requirements` (vault: repo vault)
125
+ - The legacy hand-authored `REQUIREMENTS.md` has no canonical home; this step is a MuninnDB tree mutation only.
126
+
127
+ 6. **Update project identity in MuninnDB:**
128
+
129
+ - Update `brain:project-identity` to reflect the shipped version (add a `current-version` child, advance the milestone marker)
130
+ - Set the next-milestone goals as an engram for the upcoming `/milestone-new` to pick up
131
+
132
+ 7. **Commit and tag:**
133
+
134
+ ```bash
135
+ git add .
136
+ bun run commit --message="archive v{version} milestone" --type=chore --scope=milestone --no-push --skip-checks
137
+ git tag -a v{version} -m "[milestone summary]"
138
+ ```
139
+
140
+ - Ask about pushing tag
141
+
142
+ 8. **Offer next steps:**
143
+ - `/milestone-new` — start next milestone
144
+
145
+ ## Success Criteria
146
+
147
+ - [ ] Milestone snapshot archived to `.luca/milestones/v{version}-roadmap.md` + `v{version}-audit.md` + `v{version}-backlog-snapshot.{json,md}`
148
+ - [ ] Requirements traceability evolved in MuninnDB (`brain:project-requirements` v1 items marked complete)
149
+ - [ ] Active `.luca/roadmap.md` reset (or left empty until next milestone opens)
150
+ - [ ] `brain:project-identity` MuninnDB tree updated with current shipped version
151
+ - [ ] Git tag v{version} created
152
+ - [ ] Commit successful
153
+
154
+ ## Next Steps
155
+
156
+ | Condition | Action | Command |
157
+ |-----------|--------|---------|
158
+ | Ready for next milestone | Start new milestone | `/milestone-new` |
159
+ | Want to review completion | Check progress | `/progress` |
160
+ | Need to create PR | Create pull request | Run `gh pr create` |
161
+
162
+ **Primary:** `/milestone-new` — Start the next milestone cycle
163
+
164
+ **Also available:**
165
+
166
+ - `/progress` — Review completed work
167
+ - `/help` — See all available commands
168
+ </main>