@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,60 @@
1
+ ---
2
+ name: milestone-gaps
3
+ description: Create phases to close gaps identified by a milestone audit.
4
+ ---
5
+
6
+ <main>
7
+ # Luca Plan Milestone Gaps
8
+
9
+ Create phases to close gaps identified by milestone audit.
10
+
11
+ ## Process
12
+
13
+ 1. **Load audit:**
14
+ - Read `.luca/milestones/v{version}-audit.md`
15
+ - Extract gaps section
16
+
17
+ 2. **Group gaps into phases:**
18
+ - Group related gaps together
19
+ - Prioritize by requirement priority (must/should/nice)
20
+ - Create coherent phase boundaries
21
+
22
+ 3. **Add phases to roadmap:**
23
+ - Use `/phase-add` pattern for each new phase
24
+ - Include gap references in phase description
25
+
26
+ 4. **Update audit status:**
27
+ - Mark gaps as "planned"
28
+ - Reference new phase numbers
29
+
30
+ 5. **Present plan:**
31
+
32
+ ```
33
+ ## Gap Closure Phases
34
+
35
+ | Phase | Gaps Addressed | Priority |
36
+ |-------|----------------|----------|
37
+ | {N} | {gap 1, gap 2} | Must |
38
+ | {N+1} | {gap 3} | Should |
39
+
40
+ ## ▶ Next Up
41
+
42
+ /phase-plan {N} — plan first gap closure phase
43
+ ```
44
+
45
+ ## Success Criteria
46
+
47
+ - [ ] Audit gaps loaded
48
+ - [ ] Gaps grouped into coherent phases
49
+ - [ ] Phases added to `.luca/roadmap.md`
50
+ - [ ] Audit file updated with planning status
51
+ - [ ] User knows next steps
52
+
53
+ ## Next Steps
54
+
55
+ **Primary:** `/phase-execute {gap-phase}` — Execute the gap closure plans
56
+
57
+ **Also available:**
58
+ - `/progress` — Review gap closure phases
59
+ - `/milestone-audit` — Re-audit after fixes
60
+ </main>
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: milestone-new
3
+ description: Start a new milestone cycle with requirements gathering and roadmap generation.
4
+ ---
5
+
6
+ <main>
7
+ # Luca New Milestone
8
+
9
+ Start a new milestone through unified flow: questioning → research (optional) → requirements → roadmap.
10
+
11
+ This is the brownfield equivalent of new-project. The project exists, the `brain:project-identity` MuninnDB tree has history. This command gathers "what's next", evolves `brain:project-identity`, then continues through the full requirements → roadmap cycle.
12
+
13
+ **Arguments:** `[milestone name, e.g., 'v1.1 Notifications']`
14
+
15
+ ## Creates/Updates
16
+
17
+ - MuninnDB `brain:project-identity` — updated with new milestone marker + goals
18
+ - MuninnDB `brain:project-requirements` — scoped requirements for this milestone (REQ-IDs continue from prior milestone)
19
+ - MuninnDB `research:milestone-<slug>:*` — domain research (optional, focuses on NEW features)
20
+ - `.luca/roadmap.md` — phase structure (continues numbering, written via `luca roadmap create` if resetting or hand-edited if extending)
21
+ - `.luca/state.json` — reset for new milestone via `luca workflow reset`
22
+
23
+ **After this command:** Run `/phase-plan [N]` to start execution.
24
+
25
+ ## Process
26
+
27
+ 1. **Load Context** — Read project identity from MuninnDB (`brain:project-identity`), prior milestone snapshots under `.luca/milestones/`, and the current workflow state:
28
+
29
+ ```bash
30
+ STATE_JSON=$(luca state read 2>/dev/null || echo '{"initialized":false}')
31
+ ```
32
+
33
+ 2. **Gather Milestone Goals** — Recall any per-milestone discussion context from MuninnDB (`milestone:<slug>`), or question user
34
+ 3. **Determine Milestone Version** — Parse last version from `.luca/milestones/` snapshots, suggest next
35
+ 4. **Update project identity in MuninnDB** — Store the current milestone marker:
36
+
37
+ ```
38
+ mcp__muninn__muninn_remember(vault: "<repo_vault>", concept: "milestone:v{version}", content: "<milestone goals + scope>", tags: ["milestone","active"])
39
+ ```
40
+
41
+ 5. **Reset workflow state for new milestone:**
42
+
43
+ ```bash
44
+ luca workflow reset 2>/dev/null || true
45
+ # The freshly reset state defaults to pipelineStep=triage. The milestone identifier is captured via MuninnDB (above), not as a state field.
46
+ ```
47
+
48
+ 6. **Research Decision** — Spawn researchers if selected (milestone-aware context)
49
+ 7. **Define Requirements** — Present features, scope each category
50
+ 8. **Create Roadmap** — Use `luca roadmap create` (continues phase numbering)
51
+ 9. **GitHub Issue & Branch Decision** — See below
52
+ 10. **Done** — Present completion with next steps
53
+
54
+ ## GitHub Issue & Branch Decision (Step 9)
55
+
56
+ After roadmap creation, present the user with tracking options:
57
+
58
+ ```
59
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
60
+ Luca ► MILESTONE TRACKING
61
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
62
+
63
+ How should this milestone be tracked on GitHub?
64
+
65
+ 1. **New issue & branch** — Create dedicated issue for this milestone
66
+ 2. **Continue on #{existing}** — Keep using existing issue/branch
67
+ 3. **No tracking** — Skip GitHub integration (not recommended)
68
+ ```
69
+
70
+ **If "New issue & branch" selected:**
71
+
72
+ 1. Generate issue body from MuninnDB recall (`brain:project-identity` current-milestone child + `brain:project-requirements` v-current scope)
73
+ 2. Create issue: `gh issue create --title "feat({scope}): {milestone-name}" --body "{body}"`
74
+ 3. Create branch: `git checkout -b {issue_number}--{milestone-slug}`
75
+ 4. Push branch: `git push -u origin {branch_name}`
76
+ 5. Record the issue/branch references in MuninnDB so the active session has durable context:
77
+
78
+ ```
79
+ mcp__muninn__muninn_remember(
80
+ vault: "<repo_vault>",
81
+ concept: "session:milestone-v{version}",
82
+ content: "GitHub issue #{issue_number} / branch {branch_name} — milestone v{version}",
83
+ tags: ["session","milestone","github"]
84
+ )
85
+ ```
86
+
87
+ **If "Continue on existing" selected:**
88
+
89
+ 1. Verify existing issue still open: `gh issue view {number} --json state`
90
+ 2. Add comment to existing issue noting new milestone started
91
+ 3. Keep existing issue/branch references in MuninnDB (no state update needed)
92
+
93
+ **If "No tracking" selected:**
94
+
95
+ 1. Warn user: commits won't reference issues, PR creation will require manual setup
96
+ 2. Note: GitHub Issue: None (user opted out) — no bridge update needed
97
+
98
+ ## Success Criteria
99
+
100
+ - [ ] MuninnDB `brain:project-identity` updated with current-milestone marker
101
+ - [ ] `.luca/state.json` reset for new milestone (via `luca workflow reset`)
102
+ - [ ] Prior milestone-context engrams consumed (recalled into the new milestone's planning)
103
+ - [ ] Research completed (if selected) — 4 parallel agents spawned, milestone-aware
104
+ - [ ] Requirements gathered (from research or conversation)
105
+ - [ ] User scoped each category
106
+ - [ ] MuninnDB `brain:project-requirements` updated with new milestone's REQ-IDs
107
+ - [ ] `.luca/roadmap.md` created with phases continuing from previous milestone
108
+ - [ ] GitHub tracking decision made (new issue, continue existing, or opt-out)
109
+ - [ ] Issue/branch tracking captured in MuninnDB `session:milestone-*` engram (when tracking opted in)
110
+
111
+ ## Next Steps
112
+
113
+ | Condition | Action | Command |
114
+ |-----------|--------|---------|
115
+ | Milestone created | Discuss first phase | `/phase-discuss {N}` |
116
+ | Want to skip discussion | Plan directly | `/phase-plan {N}` |
117
+ | Need codebase context | Map the codebase | `/codebase-map` |
118
+
119
+ **Primary:** `/phase-discuss {N}` — Gather context for first phase of milestone
120
+
121
+ **Also available:**
122
+
123
+ - `/phase-plan {N}` — Skip discussion, plan directly
124
+ - `/progress` — Check milestone setup
125
+ </main>
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: note
3
+ description: Add a new phase to the roadmap (default), or queue a developer note with --next/--whenever.
4
+ ---
5
+
6
+ <main>
7
+ # Luca Developer Note
8
+
9
+ Capture ideas as roadmap phases (default) or queue notes for agent pickup.
10
+
11
+ **Arguments:** `[--next|--whenever] <message>`
12
+
13
+ - **Default (phase):** Creates a new phase in the roadmap for the message
14
+ - `--next` flag: Queue an urgent note (picked up within 60 seconds via context-check hook)
15
+ - `--whenever` flag: Queue a deferred note (picked up at commit boundaries only)
16
+
17
+ ---
18
+
19
+ ## Default Mode — Add Phase
20
+
21
+ When no flag is provided, the message becomes a new phase in the current milestone.
22
+
23
+ ### Process
24
+
25
+ 1. **Parse arguments:**
26
+ - If first argument is `--next` or `--whenever`, use note mode (see below)
27
+ - Otherwise, all arguments become the phase description
28
+ - Error if no arguments provided
29
+
30
+ 2. **Load roadmap:**
31
+ - Read `.luca/roadmap.md` (or call `luca roadmap read` for a typed view)
32
+ - Error if not found
33
+
34
+ 3. **Find current milestone:**
35
+ - Locate "## Current Milestone:" heading
36
+ - Extract milestone name and version
37
+ - Identify all phases under this milestone
38
+
39
+ 4. **Calculate next phase:**
40
+ - Find highest integer phase number (ignore decimals)
41
+ - Add 1 to get next phase number
42
+ - Format as two-digit
43
+
44
+ 5. **Generate slug:**
45
+ - Convert description to kebab-case
46
+ - Example: "Add authentication" → `07-add-authentication`
47
+
48
+ 6. **Create phase directory:**
49
+
50
+ ```bash
51
+ mkdir -p ".luca/phases/${phase_num}-${slug}"
52
+ ```
53
+
54
+ 7. **Update roadmap:**
55
+ - Insert new phase entry after last phase in current milestone
56
+ - Include Goal, Depends on, Plans placeholders
57
+
58
+ 8. **Update roadmap:**
59
+
60
+ \`\`\`bash
61
+ # The roadmap is the durable view; the workflow state machine in .luca/state.json
62
+ # is updated separately by the pipeline when a phase becomes active.
63
+ luca roadmap create --file <payload.json> # if creating a fresh roadmap
64
+ # or edit .luca/roadmap.md directly for incremental additions, then read it back via
65
+ luca roadmap read 2>/dev/null || true
66
+ \`\`\`
67
+
68
+ 9. **Emit observer event:**
69
+
70
+ \`\`\`bash
71
+ luca telemetry emit --kind=phase.added --data='{"phase":"<N>","description":"<message>","directory":"<path>"}' 2>/dev/null || true
72
+ \`\`\`
73
+
74
+ 10. **Confirm:**
75
+
76
+ ```
77
+ Phase {N} added to current milestone:
78
+ - Description: {description}
79
+ - Directory: .luca/phases/{phase-num}-{slug}/
80
+
81
+ Next: /phase-plan {N}
82
+ ```
83
+
84
+ ### Anti-Patterns
85
+
86
+ See `/phase-add` for detailed anti-patterns. Key rules:
87
+ - Don't modify phases outside current milestone
88
+ - Don't renumber existing phases
89
+ - Don't use decimal numbering (that's `/phase-insert`)
90
+ - Don't create plans yet (that's `/phase-plan`)
91
+ - Don't commit changes (user decides when to commit)
92
+
93
+ ---
94
+
95
+ ## `--next` Mode — Urgent Note
96
+
97
+ Queue a note as a high-priority MuninnDB-backed todo. The context-check hook surfaces high-priority todos into the agent context.
98
+
99
+ ### Process
100
+
101
+ 1. **Parse arguments:**
102
+ - Strip `--next` flag
103
+ - Remaining text is the note body
104
+
105
+ 2. **Persist to the MuninnDB-backed backlog:**
106
+
107
+ \`\`\`bash
108
+ luca todo add --title "<first-line>" --area "note" --priority high --source note --body "<full message>"
109
+ \`\`\`
110
+
111
+ 3. **Emit observer event:**
112
+
113
+ \`\`\`bash
114
+ luca telemetry emit --kind=note.added --data='{"priority":"next","title":"<first-line>"}' 2>/dev/null || true
115
+ \`\`\`
116
+
117
+ 4. **Confirm:**
118
+
119
+ ```
120
+ Note queued: {message preview}
121
+
122
+ Priority: high (next)
123
+ Backlog: MuninnDB todo backlog (see `luca todo list`)
124
+ ```
125
+
126
+ ### Consumption
127
+
128
+ High-priority todos surface in the agent context via the context-refresher / context-check hooks and via `luca todo list`. There is no separate `.luca/notes/` filesystem layer — the canonical backlog is the MuninnDB todo store.
129
+
130
+ ---
131
+
132
+ ## `--whenever` Mode — Deferred Note
133
+
134
+ Queue a low-priority MuninnDB-backed todo picked up at commit / phase boundaries only.
135
+
136
+ ### Process
137
+
138
+ Same as `--next` mode except:
139
+ - `--priority low` (instead of `high`)
140
+ - The todo surfaces in `luca todo list` but is not pushed into the active agent context.
141
+
142
+ ### Consumption
143
+
144
+ Advisory backlog entry. Not auto-consumed — agent reads via `luca todo list` and acts on them manually.
145
+
146
+ ---
147
+
148
+ ## Summary
149
+
150
+ | Mode | Trigger | Output | Event |
151
+ |------|---------|--------|-------|
152
+ | Default (phase) | No flag | Roadmap phase + directory | `phase.added` |
153
+ | `--next` | `--next` flag | MuninnDB todo (priority high) | `note.added` |
154
+ | `--whenever` | `--whenever` flag | MuninnDB todo (priority low) | `note.added` |
155
+
156
+ ## Success Criteria
157
+
158
+ - [ ] Phase mode: directory created, roadmap updated, state updated
159
+ - [ ] Note modes: MuninnDB todo created via `luca todo add`
160
+ - [ ] Observer event emitted (fire-and-forget)
161
+ - [ ] User sees confirmation with appropriate next steps
162
+ </main>
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: phase-add
3
+ description: Append a new phase to the end of the current milestone roadmap.
4
+ ---
5
+
6
+ <main>
7
+ # Luca Add Phase
8
+
9
+ Add a new integer phase to the end of the current milestone in the roadmap.
10
+
11
+ **Arguments:** `<description>` (e.g., "Add authentication", "Fix critical performance issues")
12
+
13
+ **Purpose:** Add planned work discovered during execution that belongs at the end of current milestone.
14
+
15
+ ## Process
16
+
17
+ 1. **Parse arguments:**
18
+
19
+ - All arguments become the phase description
20
+ - Error if no arguments provided
21
+
22
+ 2. **Load roadmap:**
23
+
24
+ - Read `.luca/roadmap.md` (or call `luca roadmap read`)
25
+ - Error if not found
26
+
27
+ 3. **Find current milestone:**
28
+
29
+ - Locate "## Current Milestone:" heading
30
+ - Extract milestone name and version
31
+ - Identify all phases under this milestone
32
+
33
+ 4. **Calculate next phase:**
34
+
35
+ - Find highest integer phase number (ignore decimals)
36
+ - Add 1 to get next phase number
37
+ - Format as two-digit
38
+
39
+ 5. **Generate slug:**
40
+
41
+ - Convert description to kebab-case
42
+ - Example: "Add authentication" → `07-add-authentication`
43
+
44
+ 6. **Create phase directory:**
45
+
46
+ ```bash
47
+ mkdir -p ".luca/phases/${phase_num}-${slug}"
48
+ ```
49
+
50
+ 7. **Update roadmap:**
51
+
52
+ - Insert new phase entry after last phase in current milestone
53
+ - Include Goal, Depends on, Plans placeholders
54
+
55
+ 8. **Roadmap update:**
56
+
57
+ The roadmap edit is the durable change. Read it back via `luca roadmap read` to confirm the new phase appears. The workflow state machine in `.luca/state.json` updates separately when the pipeline transitions into that phase.
58
+
59
+ 9. **Present completion:**
60
+
61
+ ```
62
+ Phase {N} added to current milestone:
63
+ - Description: {description}
64
+ - Directory: .luca/phases/{phase-num}-{slug}/
65
+ ```
66
+
67
+ ## Next Steps
68
+
69
+ **Primary:** `/phase-plan {N}` — Create execution plans for the new phase
70
+
71
+ **Also available:**
72
+
73
+ - `/phase-discuss {N}` — Gather context before planning
74
+ - `/progress` — Check overall project status
75
+
76
+ ## Anti-Patterns
77
+
78
+ - Don't modify phases outside current milestone
79
+ - Don't renumber existing phases
80
+ - Don't use decimal numbering (that's `/phase-insert`)
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
88
+ - [ ] `.luca/state.json` reflects the new phase (read back via `luca state read` to confirm)
89
+ - [ ] New phase appears at end of current milestone
90
+ - [ ] Next phase number calculated correctly
91
+ </main>
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: phase-assumptions
3
+ description: Preview AI planning assumptions for a phase before committing to execution.
4
+ ---
5
+
6
+ <main>
7
+ # Luca List Phase Assumptions
8
+
9
+ See what AI is planning to do before it starts.
10
+
11
+ **Arguments:** `<phase number>`
12
+
13
+ Shows AI's intended approach for a phase so you can course-correct if needed.
14
+
15
+ **No files created** - conversational output only.
16
+
17
+ ## Process
18
+
19
+ 1. **Load phase context:**
20
+ - Read `.luca/roadmap.md` for phase goal
21
+ - Recall mapped requirements from MuninnDB (`brain:project-requirements`)
22
+ - Read `.luca/phases/<slug>/research.md` (if exists)
23
+ - Read `.luca/phases/<slug>/context.md` (if exists)
24
+
25
+ 2. **Generate assumptions:**
26
+ Based on phase goal and requirements, list:
27
+ - **Technical approach:** Libraries, patterns, architecture choices
28
+ - **Scope interpretation:** What's in, what's out
29
+ - **Dependencies:** What the phase assumes exists
30
+ - **Risks:** Potential challenges
31
+
32
+ 3. **Present assumptions:**
33
+
34
+ ```
35
+ ## Phase {N}: {Name} - AI Assumptions
36
+
37
+ ### Technical Approach
38
+ - Will use {X} for {purpose}
39
+ - Following pattern from {existing code}
40
+ - Targeting {specific outcome}
41
+
42
+ ### Scope
43
+ **In scope:**
44
+ - {item 1}
45
+ - {item 2}
46
+
47
+ **Out of scope:**
48
+ - {item 3}
49
+ - {item 4}
50
+
51
+ ### Dependencies
52
+ - Assumes {X} exists from Phase {Y}
53
+ - Requires {Z} to be configured
54
+
55
+ ### Potential Risks
56
+ - {risk 1}
57
+ - {risk 2}
58
+
59
+ ---
60
+
61
+ Does this match your expectations?
62
+
63
+ - **Yes** → /phase-plan {N}
64
+ - **Adjust** → /phase-discuss {N} to clarify
65
+ ```
66
+
67
+ 4. **No files created:**
68
+ - This is conversational output only
69
+ - Use `/phase-discuss` to capture corrections
70
+
71
+ ## Success Criteria
72
+
73
+ - [ ] Phase goal and requirements loaded
74
+ - [ ] Technical assumptions clearly stated
75
+ - [ ] Scope boundaries explicit
76
+ - [ ] Dependencies identified
77
+ - [ ] User can validate before planning
78
+
79
+ ## Next Steps
80
+
81
+ | Condition | Action | Command |
82
+ |-----------|--------|---------|
83
+ | Assumptions look good | Plan the phase | `/phase-plan {phase}` |
84
+ | Assumptions need clarification | Discuss the phase | `/phase-discuss {phase}` |
85
+ | Need more research | Research the domain | `/phase-research {phase}` |
86
+
87
+ **Primary:** `/phase-plan {phase}` — Proceed with planning
88
+
89
+ **Also available:**
90
+ - `/phase-discuss {phase}` — Clarify vision if assumptions seem off
91
+ - `/progress` — Check overall project status
92
+ </main>
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: phase-discuss
3
+ description: Gather phase context through adaptive questioning before creating execution plans.
4
+ ---
5
+
6
+ <main>
7
+ # Luca Discuss Phase
8
+
9
+ Extract implementation decisions that downstream agents need — researcher and planner will use context.md to know what to investigate and what choices are locked.
10
+
11
+ **Arguments:** `<phase> [--auto]`
12
+
13
+ ## How It Works
14
+
15
+ ### Interactive Mode (default)
16
+
17
+ 1. Analyze the phase to identify gray areas (UI, UX, behavior, etc.)
18
+ 2. Present gray areas — user selects which to discuss
19
+ 3. Deep-dive each selected area until satisfied
20
+ 4. Create context.md with decisions that guide research and planning
21
+
22
+ ### Auto Mode (`--auto` flag)
23
+
24
+ 1. Analyze the phase to identify gray areas (same as interactive)
25
+ 2. Auto-select ALL gray areas (no user prompt)
26
+ 3. Load project tech stack from MuninnDB
27
+ 4. Spawn `lu-discuss-researcher` agent per gray area question (web research)
28
+ 5. Present research summary with citations before writing
29
+ 6. Offer user override: accept all / override some / switch to interactive
30
+ 7. Create context.md with researched decisions (annotated with source provenance)
31
+
32
+ Auto mode is useful when running via `/autopilot` or when the user wants AI-researched decisions instead of manual discussion.
33
+
34
+ **Output:** `{phase}-context.md` — decisions clear enough that downstream agents can act without asking the user again
35
+
36
+ ## Process
37
+
38
+ ### Complexity-Aware Discussion
39
+
40
+ Read complexity from the canonical workflow state:
41
+
42
+ ```bash
43
+ COMPLEXITY=$(luca state read 2>/dev/null | jq -r '.complexity // "MODERATE"')
44
+ ```
45
+
46
+ **Always runs.** Discussion depth and model tier scale with complexity:
47
+
48
+ | Complexity | Discussion Depth | Model Tier (lu-discuss-researcher) |
49
+ |------------|-----------------|-------------------------------------|
50
+ | TRIVIAL | Light (2 questions per area) | fast |
51
+ | SIMPLE | Light (2 questions per area) | balanced |
52
+ | MODERATE | Standard (4 questions per area) | balanced |
53
+ | COMPLEX | Extended (4+ questions per area) | capable |
54
+ | CRITICAL | Thorough (6+ questions per area) | capable |
55
+
56
+ The lu-discuss-researcher model tier is resolved via `resolveModelForAgent("lu-discuss-researcher", complexity)` from the centralized routing table.
57
+
58
+ 1. **Validate phase number** (error if missing or not in roadmap)
59
+ 2. **Check if context.md exists** (offer update/view/skip if yes)
60
+ 3. **Detect mode** — If `--auto` flag is present, use auto mode (steps 4a-8a). Otherwise, use interactive mode (steps 4-7).
61
+
62
+ **Interactive Mode (default):**
63
+
64
+ 4. **Analyze phase** — Identify domain and generate phase-specific gray areas
65
+ 5. **Present gray areas** — Multi-select: which to discuss? (NO skip option)
66
+ 6. **Deep-dive each area** — 4 questions per area, then offer more/next
67
+ 7. **Write context.md** — Sections match areas discussed
68
+ 8. **Offer next steps** (research or plan)
69
+
70
+ **Auto Mode (`--auto`):**
71
+
72
+ 4a. **Analyze phase** — Same gray area identification as interactive mode
73
+ 5a. **Auto-select all gray areas** — No user prompt, select everything
74
+ 6a. **Load project identity from MuninnDB** — Extract project tech stack (languages, frameworks, conventions) via `muninn_recall_tree(vault: "default", id: "brain:project-identity")`
75
+ 7a. **Spawn lu-discuss-researcher per question** — For each gray area:
76
+ - Formulate a focused question from the gray area topic
77
+ - Spawn `lu-discuss-researcher` via Task() with: question, phase context, tech stack from MuninnDB
78
+ - Collect the `<research_result>` response with recommendation, confidence, and sources
79
+ - If `researchable: false`: flag for user input (even in auto mode)
80
+ 8a. **Present research summary** — Show consolidated results:
81
+ ```
82
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
83
+ Luca ► AUTO-DISCUSS RESULTS
84
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
85
+
86
+ | # | Gray Area | Recommendation | Confidence | Sources |
87
+ |---|-----------|---------------|------------|---------|
88
+ | 1 | {area} | {rec} | HIGH | 2 cited |
89
+ | 2 | {area} | {rec} | MEDIUM | 1 cited |
90
+ | 3 | {area} | Not researchable | N/A | — |
91
+ ```
92
+
93
+ **Non-researchable items:** {list questions that need user input}
94
+ 9a. **User override** — Even in auto mode, give user a chance to adjust:
95
+ - Accept all: Use all researched recommendations
96
+ - Override some: User provides answers for specific questions
97
+ - Discuss instead: Switch to interactive mode for remaining items
98
+ 10a. **Write context.md** — Include provenance annotations:
99
+ - `[researched]` — Decision from web research with cited sources
100
+ - `[user-override]` — User overrode the researched recommendation
101
+ - `[user-input]` — Non-researchable item answered by user
102
+ 11a. **Offer next steps** (research or plan)
103
+
104
+ ## Critical: Scope Guardrail
105
+
106
+ - Phase boundary from roadmap.md is FIXED
107
+ - Discussion clarifies HOW to implement, not WHETHER to add more
108
+ - If user suggests new capabilities: "That's its own phase. I'll note it for later."
109
+ - Capture deferred ideas — don't lose them, don't act on them
110
+
111
+ ## Domain-Aware Gray Areas
112
+
113
+ Gray areas depend on what's being built. Analyze the phase goal:
114
+
115
+ - Something users SEE → layout, density, interactions, states
116
+ - Something users CALL → responses, errors, auth, versioning
117
+ - Something users RUN → output format, flags, modes, error handling
118
+ - Something users READ → structure, tone, depth, flow
119
+ - Something being ORGANIZED → criteria, grouping, naming, exceptions
120
+
121
+ Generate 3-4 **phase-specific** gray areas, not generic categories.
122
+
123
+ ## Probing Depth
124
+
125
+ Scale probing depth by complexity:
126
+ - MODERATE: 4 questions per area (standard)
127
+ - COMPLEX: 4-6 questions per area (extended)
128
+ - CRITICAL: 6+ questions per area (thorough)
129
+
130
+ Default:
131
+ - Ask 4 questions per area before checking
132
+ - "More questions about [area], or move to next?"
133
+ - If more → ask 4 more, check again
134
+ - After all areas → "Ready to create context?"
135
+
136
+ ## Do NOT Ask About (AI handles these)
137
+
138
+ - Technical implementation
139
+ - Architecture choices
140
+ - Performance concerns
141
+ - Scope expansion
142
+
143
+ ## Success Criteria
144
+
145
+ - [ ] Gray areas identified through intelligent analysis
146
+ - [ ] User chose which areas to discuss
147
+ - [ ] Each selected area explored until satisfied
148
+ - [ ] Scope creep redirected to deferred ideas
149
+ - [ ] context.md captures decisions, not vague vision
150
+
151
+ ## Next Steps
152
+
153
+ | Condition | Action | Command |
154
+ | --------------------------------- | ------------------- | --------------------------------------- |
155
+ | Context gathered, niche domain | Research the domain | `/phase-research {phase}` |
156
+ | Context gathered, standard domain | Plan the phase | `/phase-plan {phase}` |
157
+ | Want to review assumptions | List assumptions | `/phase-assumptions {phase}` |
158
+
159
+ **Primary:** `/phase-plan {phase}` — Create execution plans using gathered context
160
+
161
+ **Also available:**
162
+
163
+ - `/phase-research {phase}` — Deep research for niche/complex domains
164
+ - `/progress` — Check overall project status
165
+ </main>