qualia-framework 4.4.0 → 5.1.0

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 (70) hide show
  1. package/AGENTS.md +24 -0
  2. package/CLAUDE.md +12 -63
  3. package/README.md +24 -18
  4. package/agents/builder.md +13 -33
  5. package/agents/plan-checker.md +18 -0
  6. package/agents/planner.md +17 -0
  7. package/agents/verifier.md +70 -0
  8. package/agents/visual-evaluator.md +132 -0
  9. package/bin/cli.js +64 -23
  10. package/bin/install.js +375 -29
  11. package/bin/qualia-ui.js +208 -1
  12. package/bin/slop-detect.mjs +362 -0
  13. package/bin/state.js +218 -2
  14. package/docs/erp-contract.md +5 -0
  15. package/docs/install-redesign-builder-prompt.md +290 -0
  16. package/docs/install-redesign-pilot.md +234 -0
  17. package/docs/playwright-loop-builder-prompt.md +185 -0
  18. package/docs/playwright-loop-design-notes.md +108 -0
  19. package/docs/playwright-loop-pilot-results.md +170 -0
  20. package/docs/playwright-loop-review-2026-05-03.md +65 -0
  21. package/docs/playwright-loop-tester-prompt.md +213 -0
  22. package/docs/reviews/matt-pocock-skills-analysis.md +300 -0
  23. package/guide.md +9 -5
  24. package/hooks/env-empty-guard.js +74 -0
  25. package/hooks/pre-compact.js +19 -9
  26. package/hooks/pre-deploy-gate.js +8 -2
  27. package/hooks/pre-push.js +26 -12
  28. package/hooks/supabase-destructive-guard.js +62 -0
  29. package/hooks/vercel-account-guard.js +91 -0
  30. package/package.json +2 -1
  31. package/rules/design-brand.md +114 -0
  32. package/rules/design-laws.md +148 -0
  33. package/rules/design-product.md +114 -0
  34. package/rules/design-rubric.md +157 -0
  35. package/rules/grounding.md +4 -0
  36. package/skills/qualia-build/SKILL.md +40 -46
  37. package/skills/qualia-discuss/SKILL.md +51 -68
  38. package/skills/qualia-handoff/SKILL.md +1 -0
  39. package/skills/qualia-issues/SKILL.md +151 -0
  40. package/skills/qualia-map/SKILL.md +78 -35
  41. package/skills/qualia-new/REFERENCE.md +139 -0
  42. package/skills/qualia-new/SKILL.md +85 -124
  43. package/skills/qualia-optimize/REFERENCE.md +202 -0
  44. package/skills/qualia-optimize/SKILL.md +72 -237
  45. package/skills/qualia-plan/SKILL.md +58 -65
  46. package/skills/qualia-polish/SKILL.md +180 -136
  47. package/skills/qualia-polish-loop/REFERENCE.md +265 -0
  48. package/skills/qualia-polish-loop/SKILL.md +201 -0
  49. package/skills/qualia-polish-loop/fixtures/broken.html +117 -0
  50. package/skills/qualia-polish-loop/fixtures/clean.html +196 -0
  51. package/skills/qualia-polish-loop/scripts/loop.mjs +302 -0
  52. package/skills/qualia-polish-loop/scripts/playwright-capture.mjs +197 -0
  53. package/skills/qualia-polish-loop/scripts/score.mjs +176 -0
  54. package/skills/qualia-report/SKILL.md +141 -180
  55. package/skills/qualia-research/SKILL.md +28 -33
  56. package/skills/qualia-road/SKILL.md +103 -0
  57. package/skills/qualia-ship/SKILL.md +1 -0
  58. package/skills/qualia-task/SKILL.md +1 -1
  59. package/skills/qualia-test/SKILL.md +50 -2
  60. package/skills/qualia-triage/SKILL.md +152 -0
  61. package/skills/qualia-verify/SKILL.md +63 -104
  62. package/skills/qualia-zoom/SKILL.md +51 -0
  63. package/skills/zoho-workflow/SKILL.md +64 -0
  64. package/templates/CONTEXT.md +36 -0
  65. package/templates/DESIGN.md +229 -435
  66. package/templates/PRODUCT.md +95 -0
  67. package/templates/decisions/ADR-template.md +30 -0
  68. package/tests/bin.test.sh +451 -7
  69. package/tests/state.test.sh +58 -0
  70. package/skills/qualia-design/SKILL.md +0 -169
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-build
3
- description: "Execute the current phase spawns builder subagents per task with wave-based parallelization. Fresh context per task."
3
+ description: "Executes a planned phase by spawning fresh builder subagents per task with wave-based parallelization. Each task gets isolated context, commits atomically, and runs its own validation. Use when the user says 'build this phase', 'execute the plan', 'start building', 'run the build', 'qualia-build', or after /qualia-plan approves a phase plan."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -15,12 +15,12 @@ allowed-tools:
15
15
 
16
16
  # /qualia-build — Build a Phase
17
17
 
18
- Execute the phase plan. Each task runs in a fresh subagent context. Independent tasks run in parallel.
18
+ Execute phase plan. Each task = fresh subagent. Independent tasks run parallel.
19
19
 
20
20
  ## Usage
21
- `/qualia-build` — build the current planned phase
21
+ `/qualia-build` — build current planned phase
22
22
  `/qualia-build {N}` — build specific phase
23
- `/qualia-build {N} --auto` — build + chain into `/qualia-verify {N} --auto` when done (no human gate between build and verify)
23
+ `/qualia-build {N} --auto` — build + chain into `/qualia-verify {N} --auto` (no human gate)
24
24
 
25
25
  ## Process
26
26
 
@@ -30,11 +30,11 @@ Execute the phase plan. Each task runs in a fresh subagent context. Independent
30
30
  cat .planning/phase-{N}-plan.md
31
31
  ```
32
32
 
33
- Parse: tasks, waves, file references.
33
+ Parse tasks, waves, file refs.
34
34
 
35
- ### 1b. Create Recovery Reference
35
+ ### 1b. Recovery Reference
36
36
 
37
- Before executing any tasks, record current HEAD for diagnosis. This is a reference, not an automatic rollback instruction.
37
+ Tag HEAD before executing. Reference only, no auto-rollback.
38
38
 
39
39
  ```bash
40
40
  git tag -f "pre-build-phase-{N}" HEAD 2>/dev/null
@@ -44,7 +44,7 @@ git tag -f "pre-build-phase-{N}" HEAD 2>/dev/null
44
44
  node ~/.claude/bin/qualia-ui.js info "Recovery point: pre-build-phase-{N}"
45
45
  ```
46
46
 
47
- If a wave fails, stop and inspect `git status` plus the failed task output. Do not run destructive rollback commands automatically. Preserve user work, then either fix forward or ask before reverting specific files.
47
+ Wave fail stop, inspect status + output. Preserve work; fix forward or ask before reverting.
48
48
  ```bash
49
49
  git status --short
50
50
  git diff --stat
@@ -62,33 +62,32 @@ node ~/.claude/bin/qualia-ui.js banner build {N} "{phase name}"
62
62
  node ~/.claude/bin/qualia-ui.js wave {W} {total_waves} {tasks_in_wave}
63
63
  ```
64
64
 
65
- **For each task in the wave spawn ALL tasks in this wave as separate `Agent()` calls in the SAME response turn so the harness executes them concurrently. Do NOT await one task before spawning the next. Sequential spawning defeats wave parallelism.**
65
+ **Per task in wave: spawn ALL as separate `Agent()` calls in SAME turn (concurrent). Do NOT await one before spawning next.**
66
66
 
67
67
  ```bash
68
68
  node ~/.claude/bin/qualia-ui.js task {task_num} "{task title}"
69
69
  ```
70
70
 
71
- **Pre-inline context before spawning** (saves 3-5 Read calls inside each builder subagent — GSD-style dispatch):
71
+ **Pre-inline context** (saves 3-5 Read calls per builder):
72
72
 
73
- 1. Parse the task's `Context:` field to get `@file` references
73
+ 1. Parse task `Context:` `@file` refs
74
74
  2. Read PROJECT.md
75
- 3. Read DESIGN.md if any file in the task is `.tsx`, `.jsx`, `.css`, `.scss`
76
- 4. Read each `@file` referenced in Context
77
- 5. Inline all of the above into the agent prompt under `<pre-loaded-context>` so the builder starts with full context
75
+ 3. Read DESIGN.md if task touches `.tsx`/`.jsx`/`.css`/`.scss`
76
+ 4. Read each `@file` from Context
77
+ 5. Inline all into prompt under `<pre-loaded-context>`
78
78
 
79
- Spawn a fresh builder subagent:
79
+ Spawn builder:
80
80
 
81
81
  ```
82
82
  Agent(prompt="
83
- Read your role: @~/.claude/agents/builder.md
84
- Grounding + rubrics: @~/.claude/rules/grounding.md
83
+ Role: @~/.claude/agents/builder.md
85
84
 
86
85
  <phase_context>
87
86
  # PROJECT.md
88
- {inlined contents of .planning/PROJECT.md}
87
+ {inlined .planning/PROJECT.md}
89
88
 
90
89
  # DESIGN.md (if frontend task)
91
- {inlined contents of .planning/DESIGN.md}
90
+ {inlined .planning/DESIGN.md}
92
91
  </phase_context>
93
92
 
94
93
  <task_context>
@@ -97,40 +96,35 @@ Grounding + rubrics: @~/.claude/rules/grounding.md
97
96
  </task_context>
98
97
 
99
98
  <wave_context>
100
- Other tasks in Wave {W} (running in parallel, do NOT touch their files):
101
- - Task {N}: "{title}" files: {comma-separated Files list}
102
- - Task {M}: "{title}" files: {comma-separated Files list}
103
- (If you are the only task in this wave, omit this block.)
99
+ Parallel tasks Wave {W} (do NOT touch their files):
100
+ - Task {N}: {title} -- files: {files}
101
+ - Task {M}: {title} -- files: {files}
102
+ (Omit if sole task in wave.)
104
103
  </wave_context>
105
104
 
106
105
  <task>
107
- {paste the single task block from the plan title, wave, persona, files, depends-on, why, acceptance-criteria, action, validation, context}
106
+ {task block from plan: title, wave, persona, files, depends-on, why, AC, action, validation, context}
108
107
  </task>
109
108
 
110
- All files in <phase_context> and <task_context> are already in your working memory — do NOT re-Read them. Only Read files NOT inlined (project code you need to modify).
111
-
112
- Execute the task. Commit when done. Return DONE/BLOCKED/PARTIAL per your Output Contract.
109
+ Context tags already loaded. Only Read project code you modify.
110
+ Execute. Commit. Return DONE/BLOCKED/PARTIAL.
113
111
  ", subagent_type="qualia-builder", description="Task {N}: {title}")
114
112
  ```
115
113
 
116
- **Why this ordering (cache-aware):** The role + grounding.md (session-stable) comes FIRST, phase_context (stable across every task in the phase) comes SECOND, task_context (varies per task) comes LAST. This preserves prefix-cache hits across tasks in the same wave — Anthropic prompt caching matches byte-identical prefixes, and a stable prefix of ~2-5k tokens hits at 92% rate (Claude Code benchmark). Sequential pre-inline without this split breaks cache on every task.
117
-
118
- **Why pre-inline at all:** without it, the builder's first actions are 3-5 Read tool calls to orient itself. With pre-inline, the builder starts already oriented and spends its context budget on the actual task.
114
+ **Cache ordering:** Role + grounding FIRST, phase_context SECOND, task_context LAST. Stable prefix ~2-5k tokens 92% cache hit. Pre-inline eliminates 3-5 Read calls per builder.
119
115
 
120
- **After each task completes:**
121
- - Verify the commit exists: `git log --oneline -1`
122
- - Show result:
116
+ **After each task:**
117
+ - Verify commit: `git log --oneline -1`
118
+ - Show:
123
119
  ```bash
124
120
  node ~/.claude/bin/qualia-ui.js done {task_num} "{title}" {commit_hash}
125
121
  ```
126
122
 
127
- **After each wave completes:**
128
- - Move to next wave
129
- - Show wave summary
123
+ **After each wave:** move to next, show summary.
130
124
 
131
125
  ### 3. Wave Completion
132
126
 
133
- After all waves complete:
127
+ All waves done:
134
128
 
135
129
  ```bash
136
130
  node ~/.claude/bin/qualia-ui.js divider
@@ -141,30 +135,30 @@ node ~/.claude/bin/qualia-ui.js ok "Waves: {count}"
141
135
 
142
136
  ### 4. Handle Failures
143
137
 
144
- If a builder subagent returns a deviation or blocker:
145
- - **Minor deviation:** Log it, continue
146
- - **Major deviation:** Show to employee, ask how to proceed
147
- - **Blocker:** Show the blocker, suggest fix or escalation
138
+ Builder returns deviation/blocker:
139
+ - **Minor:** Log, continue
140
+ - **Major:** Show to employee, ask how to proceed
141
+ - **Blocker:** Show, suggest fix or escalation
148
142
 
149
143
  ### 5. Update State
150
144
 
151
145
  ```bash
152
146
  node ~/.claude/bin/state.js transition --to built --phase {N} --tasks-done {done} --tasks-total {total} --wave {wave}
153
147
  ```
154
- If state.js returns an error, show it to the employee and stop.
155
- Do NOT manually edit STATE.md or tracking.json state.js handles both.
148
+ Error show, stop.
149
+ Do NOT edit STATE.md or tracking.json manually; state.js handles both.
156
150
 
157
151
  ### 6. Route (auto-chain aware)
158
152
 
159
- **If invoked with `--auto`:** immediately invoke `/qualia-verify {N} --auto` inline. No pause, no permission ask. Verify will either chain into the next phase (if PASS), into gap closure (if FAIL and gap cycles remain), or halt with clear escalation (if gap limit reached).
153
+ **`--auto`:** invoke `/qualia-verify {N} --auto` inline. No pause.
160
154
 
161
155
  ```bash
162
156
  node ~/.claude/bin/qualia-ui.js info "Auto mode — chaining into /qualia-verify {N}"
163
157
  ```
164
158
 
165
- Then invoke the `qualia-verify` skill inline with the same `--auto` flag.
159
+ Then invoke `qualia-verify` inline with `--auto`.
166
160
 
167
- **Otherwise (default guided mode):** stop and show the next step:
161
+ **Guided mode:** stop, show next step:
168
162
 
169
163
  ```bash
170
164
  node ~/.claude/bin/qualia-ui.js end "PHASE {N} BUILT" "/qualia-verify {N}"
@@ -1,121 +1,104 @@
1
1
  ---
2
2
  name: qualia-discuss
3
- description: "Capture phase decisions, trade-offs, and constraints BEFORE planning. Use for complex phases with regulatory, compliance, or architectural stakes. Creates .planning/phase-{N}-context.md that planner honors as locked input."
3
+ description: "Aggressive alignment interview before planning a phase — asks ONE question at a time, proposes a recommended answer with each, walks every branch of the decision tree until resolved. Updates .planning/CONTEXT.md inline as terms crystallize and writes ADRs for hard-to-reverse decisions. Output: .planning/phase-{N}-context.md (locked input the planner honors). Use BEFORE /qualia-plan for high-stakes phases (regulatory, auth, payments, multi-tenant, architectural forks), or when the user says 'discuss', 'grill me', 'stress test this plan', 'wait let's think about this one', 'I'm not sure how to approach this'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
7
7
  - Write
8
8
  - Edit
9
+ - Grep
10
+ - Glob
9
11
  - AskUserQuestion
10
12
  ---
11
13
 
12
- # /qualia-discuss — Phase Context Capture
14
+ # /qualia-discuss — Alignment Interview Before Planning
13
15
 
14
- Before a complex phase gets planned, surface the decisions and trade-offs that must inform planning. Output: `.planning/phase-{N}-context.md` that the planner reads as locked input.
15
-
16
- ## When to Use
16
+ Surface and lock the decisions, trade-offs, and constraints that must inform a phase plan. Output: `.planning/phase-{N}-context.md` (locked input). Side effects: `.planning/CONTEXT.md` gains new terms; `.planning/decisions/` may gain ADRs.
17
17
 
18
+ ## When to use
18
19
  - Regulated domains (legal, medical, financial) where wrong choices have legal cost
19
- - Phases with architectural forks (e.g., "auth via middleware or RLS?")
20
+ - Phases with architectural forks ("auth via middleware or RLS?")
20
21
  - Phases with external dependencies you want to lock first
21
- - Anytime the user says "wait, let's think about this one"
22
+ - User says "wait, let's think about this one"
22
23
 
23
- ## Process
24
+ ## The four grilling rules
24
25
 
25
- ### 1. Determine Phase
26
+ 1. **One question at a time.** Wait for the answer before asking the next. Never batch.
27
+ 2. **Propose your recommended answer first.** Format every question as `Question / Recommendation / Trade-offs`. The user accepts, edits, or rejects — way faster than open interview.
28
+ 3. **If the codebase can answer, explore instead of asking.** Don't make the user say what `git grep` could tell you.
29
+ 4. **Walk every branch.** When the user picks A over B, the next question is the one that A makes load-bearing. Resolve dependencies one-by-one until the tree is fully traversed.
26
30
 
27
- ```bash
28
- node ~/.claude/bin/state.js check 2>/dev/null
29
- ```
30
-
31
- If a phase number was passed as argument, use it. Otherwise use the current phase from STATE.md.
31
+ ## Process
32
32
 
33
- ### 2. Load Context
33
+ ### 1. Load substrate
34
34
 
35
35
  ```bash
36
- cat .planning/PROJECT.md 2>/dev/null
37
- cat .planning/ROADMAP.md 2>/dev/null
36
+ node ~/.claude/bin/state.js check 2>/dev/null
37
+ cat .planning/PROJECT.md .planning/ROADMAP.md .planning/CONTEXT.md 2>/dev/null
38
+ ls .planning/decisions/ 2>/dev/null
38
39
  cat .planning/research/SUMMARY.md 2>/dev/null
39
40
  ```
40
41
 
41
- Identify:
42
- - Phase goal from ROADMAP.md
43
- - Requirements covered by this phase
44
- - Research flags for this phase (from SUMMARY.md)
42
+ If `.planning/CONTEXT.md` is missing, copy `~/.claude/qualia-templates/CONTEXT.md` to `.planning/CONTEXT.md` first.
43
+ If `.planning/decisions/` is missing, create it. Copy `~/.claude/qualia-templates/decisions/ADR-template.md` next to it for reference.
45
44
 
46
- ### 3. Open the Conversation
45
+ ### 2. Open the conversation
47
46
 
48
- Print the banner:
49
47
  ```bash
50
48
  node ~/.claude/bin/qualia-ui.js banner discuss {N} "{phase name from ROADMAP.md}"
51
49
  ```
52
50
 
53
- Ask inline (free text, not AskUserQuestion):
54
-
55
- **"We're about to plan {phase name}. The goal is: {goal from ROADMAP.md}. Before I hand this to the planner, what decisions, trade-offs, or constraints should be locked in?"**
51
+ Then state the goal in one sentence and the open questions you found in priority order (highest-stakes / hardest-to-reverse first).
56
52
 
57
- Wait for their response.
53
+ ### 3. Grill, one question at a time
58
54
 
59
- ### 4. Follow the Thread
55
+ Format:
60
56
 
61
- Based on their answer, dig into specifics:
57
+ ```
58
+ **Question {N}/{total}:** {the question}
62
59
 
63
- - If they mention a technology "Why that one specifically?"
64
- - If they mention a constraint → "What happens if we don't honor this?"
65
- - If they mention a trade-off → "Which side do you want to land on, and why?"
66
- - If they mention a concern → "What's the worst case?"
60
+ **My recommendation:** {your proposed answer + 1-sentence why}
67
61
 
68
- Use `AskUserQuestion` when there are clear interpretation forks. Free text otherwise.
62
+ **Trade-offs:** {what gets harder if we go this way}
63
+ ```
69
64
 
70
- ### 5. Capture Locked Decisions
65
+ Wait for response. Then:
66
+ - Update `.planning/CONTEXT.md` inline if a term crystallized (add definition + `Avoid:` line for rejected synonyms)
67
+ - Write an ADR in `.planning/decisions/ADR-{NNNN}-{slug}.md` ONLY when the decision is hard-to-reverse, surprising-without-context, AND involves real trade-offs (use the template — keep it scarce)
68
+ - Drill deeper if the answer opens new branches
71
69
 
72
- Build up a list of **locked decisions** — things the planner MUST honor. Each decision has:
73
- - The choice (what)
74
- - The rationale (why)
75
- - The source (who/when)
70
+ ### 4. Build the locked-decisions list
76
71
 
77
- Also capture:
78
- - **Discretion items** things the planner can decide freely
79
- - **Deferred ideas** — good ideas that are NOT in this phase
80
- - **Risk flags** — things to watch during building
81
- - **Open questions** — things that still need resolution
72
+ For each resolved decision, capture: choice (what) / rationale (why) / source (who/when).
73
+ Also track: **Discretion items** (planner decides) / **Deferred ideas** (NOT this phase) / **Risk flags** (watch during build) / **Open questions** (still unresolved).
82
74
 
83
- ### 6. Decision Gate
75
+ ### 5. Decision gate
84
76
 
85
- When you have enough context:
77
+ When the tree is fully traversed:
86
78
 
87
79
  - header: "Ready to lock?"
88
- - question: "Ready to lock these decisions and move to /qualia-plan {N}?"
89
- - options:
90
- - "Lock it in" — Write phase-{N}-context.md and done
91
- - "Keep exploring" — I have more to say
80
+ - question: "Lock these decisions and move to /qualia-plan {N}?"
81
+ - options: "Lock it in" / "Keep exploring"
92
82
 
93
83
  Loop until "Lock it in".
94
84
 
95
- ### 7. Write phase-{N}-context.md
96
-
97
- Use the template at `~/.claude/qualia-templates/phase-context.md`. Fill every section with concrete content.
85
+ ### 6. Write phase-{N}-context.md
98
86
 
99
- ```bash
100
- # Write the file to .planning/phase-{N}-context.md
101
- ```
102
-
103
- ### 8. Commit
104
-
105
- ```bash
106
- git add .planning/phase-{N}-context.md
107
- git commit -m "docs(phase-{N}): capture phase context before planning"
108
- ```
87
+ Fill `~/.claude/qualia-templates/phase-context.md` with concrete content. Reference any ADRs written, any CONTEXT.md terms added.
109
88
 
110
- ### 9. Route to Next
89
+ ### 7. Commit and route
111
90
 
112
91
  ```bash
92
+ git add .planning/phase-{N}-context.md .planning/CONTEXT.md .planning/decisions/
93
+ git commit -m "docs(phase-{N}): lock context, glossary terms, ADRs"
113
94
  node ~/.claude/bin/qualia-ui.js end "PHASE {N} CONTEXT LOCKED" "/qualia-plan {N}"
114
95
  ```
115
96
 
116
97
  ## Rules
117
98
 
118
- 1. **One session, one phase.** Don't try to discuss phases 1 and 2 in the same invocation.
119
- 2. **Locked decisions are NON-NEGOTIABLE.** The planner will honor them exactly. If you lock something you're not sure about, that's a mistake.
120
- 3. **Don't redo research.** If the user asks a research question you don't know, suggest `/qualia-research {N}` instead.
121
- 4. **Short context files are fine.** If the phase is simple, a 30-line context.md is better than a forced 200-line one.
99
+ 1. **One session, one phase.** Don't discuss phases 1 and 2 in the same invocation.
100
+ 2. **Locked decisions are NON-NEGOTIABLE.** The planner honors them exactly. Don't lock what you're unsure of defer it instead.
101
+ 3. **Don't redo research.** If a question requires research you don't have, suggest `/qualia-research {N}` and pause.
102
+ 4. **CONTEXT.md is precious keep entries terse.** One sentence each. It's loaded into every spawn; bloat costs tokens.
103
+ 5. **ADRs are scarce on purpose.** Three criteria all required. If any is missing, put it in CONTEXT.md or the phase-context.md instead.
104
+ 6. **Short context files are fine.** A 30-line context for a simple phase beats a forced 200-line one.
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  name: qualia-handoff
3
+ disable-model-invocation: true
3
4
  description: "Client delivery — produces the 4 mandatory Handoff deliverables (production URL, documentation, client assets archive, ERP finalization). Triggered at the end of the Handoff milestone."
4
5
  allowed-tools:
5
6
  - Bash
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: qualia-issues
3
+ description: "Break a phase plan into independent vertical-slice GitHub issues with needs-triage label. Each issue is demoable end-to-end (schema → API → UI → tests). Dependency-ordered. Externalizes Qualia work to the open queue so other agents, sessions, or human contributors can pull from it. Use when user says 'create issues from this plan', 'externalize the phase', 'turn this into GitHub issues', 'qualia-issues', 'split into tickets', or after /qualia-plan when the work should be parallelizable. Hard dependency: requires tracker config — run /qualia-map first if .planning/agents/tracker.md is missing."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - AskUserQuestion
12
+ ---
13
+
14
+ # /qualia-issues — Phase Plan → Independent Vertical-Slice GH Issues
15
+
16
+ Externalizes a phase plan to the GitHub issue queue. Each issue is a thin slice that delivers a complete demoable behavior end-to-end. Other Qualia sessions, autonomous agents, or human contributors can then pull from the queue.
17
+
18
+ ## Why vertical slices
19
+
20
+ ANTI-PATTERN: chop the plan horizontally (issue 1 = "all schema work", issue 2 = "all API work", issue 3 = "all UI"). This creates dependencies that block parallelism, and no single issue is demoable on its own.
21
+
22
+ CORRECT: each issue traverses every layer (schema → API → UI → tests) for one narrow user-facing behavior. Many thin slices > few thick ones.
23
+
24
+ ## Hard dependencies (per Matt Pocock's ADR-0001)
25
+
26
+ This skill cannot work meaningfully without:
27
+ - `.planning/agents/tracker.md` — tells it where to file issues (GH, GL, local)
28
+ - `.planning/agents/labels.md` — tells it the canonical-role-to-existing-label mapping
29
+ - `gh` CLI authenticated (if tracker is GitHub)
30
+
31
+ **If any are missing, halt and tell the user:** "Run `/qualia-map` first — it scans your repo and writes the adapter config so Qualia honors your existing tracker conventions."
32
+
33
+ ## Process
34
+
35
+ ### 1. Determine phase
36
+
37
+ Phase number from `$ARGUMENTS` if provided, else current from `node ~/.claude/bin/state.js check`.
38
+
39
+ ### 2. Load substrate
40
+
41
+ ```bash
42
+ cat .planning/agents/tracker.md
43
+ cat .planning/agents/labels.md
44
+ cat .planning/phase-{N}-plan.md
45
+ cat .planning/CONTEXT.md 2>/dev/null
46
+ cat .planning/PROJECT.md
47
+ ```
48
+
49
+ If `phase-{N}-plan.md` is missing, halt: "No plan exists for phase {N}. Run `/qualia-plan {N}` first."
50
+
51
+ ### 3. Decompose into vertical slices
52
+
53
+ Read the phase plan tasks. Group/split into slices where each slice:
54
+ - Delivers ONE user-facing behavior end-to-end
55
+ - Touches every relevant layer (schema, server, client, tests) needed for that behavior
56
+ - Is independently demoable or verifiable
57
+ - Has explicit blocking-dependencies on other slices (kept minimal)
58
+
59
+ Use **CONTEXT.md domain language** in titles and descriptions. Don't say "user table" if the glossary says "AuthUser" or "Customer."
60
+
61
+ ### 4. Show proposed slices to user
62
+
63
+ ```
64
+ Proposed slices for phase {N}:
65
+
66
+ Slice 1: {title in domain language}
67
+ Behavior: {one sentence}
68
+ Touches: schema, server-action, page route, test
69
+ Blocks: none
70
+
71
+ Slice 2: ...
72
+ Blocks: Slice 1 (needs the schema migration)
73
+ ```
74
+
75
+ Use `AskUserQuestion`:
76
+ - header: "Approve slices?"
77
+ - question: "File these {N} issues?"
78
+ - options: "File them" / "Re-decompose" / "Cancel"
79
+
80
+ ### 5. File issues in dependency order
81
+
82
+ For each approved slice (in dependency order so blocking slices exist when blockees are filed):
83
+
84
+ ```bash
85
+ # Write the body to a temp file FIRST — never heredoc-interpolate user content into shell.
86
+ # Plan content (titles, behaviors, criteria) is user-controlled; shell metacharacters or a
87
+ # rogue 'EOF' line in the plan would break out of the heredoc. --body-file eliminates the risk.
88
+ BODY_FILE=$(mktemp -t qualia-issue.XXXXXX.md)
89
+ cat > "$BODY_FILE" <<EOF_TEMPLATE
90
+ ## End-to-end behavior
91
+ {one paragraph}
92
+
93
+ ## Acceptance criteria
94
+ - [ ] {criterion 1 — observable behavior, not implementation detail}
95
+ - [ ] {criterion 2}
96
+ - [ ] tests pass for the slice
97
+
98
+ ## Blocks
99
+ - {issue # of any blocking slice, or "none"}
100
+
101
+ ## Domain terms touched
102
+ {terms from CONTEXT.md this slice involves}
103
+
104
+ ## Phase context
105
+ Part of phase {N} ({phase name}). Plan: .planning/phase-{N}-plan.md.
106
+ EOF_TEMPLATE
107
+
108
+ gh issue create \
109
+ --title "{title in domain language}" \
110
+ --body-file "$BODY_FILE" \
111
+ --label "needs-triage,enhancement"
112
+
113
+ rm -f "$BODY_FILE"
114
+ ```
115
+
116
+ Capture the returned issue number for use in subsequent slices' "Blocks" fields.
117
+
118
+ **Why temp file, not heredoc:** plan files (`.planning/phase-{N}-plan.md`) and CONTEXT.md are project repo content — anyone with commit access can write them. A crafted plan with shell metacharacters or a literal `EOF` line in the content could break out of an inline heredoc and execute arbitrary shell. `--body-file` reads the body as raw bytes, no shell expansion. The `EOF_TEMPLATE` token (vs the standard `EOF`) is also more resistant to accidental collisions.
119
+
120
+ ### 6. Write summary
121
+
122
+ `.planning/phase-{N}-issues.md`:
123
+
124
+ ```markdown
125
+ # Phase {N} — Issue Queue
126
+
127
+ Filed {date}. Status: open queue.
128
+
129
+ | # | Slice | Issue | Blocks |
130
+ |---|---|---|---|
131
+ | 1 | {title} | #123 | none |
132
+ | 2 | {title} | #124 | #123 |
133
+ ```
134
+
135
+ ### 7. Commit and route
136
+
137
+ ```bash
138
+ git add .planning/phase-{N}-issues.md
139
+ git commit -m "docs(phase-{N}): externalize {N_slices} slices to GH issue queue"
140
+
141
+ node ~/.claude/bin/qualia-ui.js end "QUEUE FILED" "/qualia-triage"
142
+ ```
143
+
144
+ ## Rules
145
+
146
+ 1. **Each issue is demoable on its own.** If a "completed" issue can't be shown as working behavior, the slicing was wrong.
147
+ 2. **CONTEXT.md language is mandatory.** Issue titles use domain terms, not implementation jargon.
148
+ 3. **No file paths or line numbers in issue bodies.** Issues describe behavior. Implementation details live in the phase plan.
149
+ 4. **Acceptance criteria are observable behaviors.** "Form validates email format" not "regex.test() returns true".
150
+ 5. **Dependencies kept minimal.** If slice A blocks slice B blocks slice C blocks slice D, the slicing collapsed to horizontal — re-decompose.
151
+ 6. **`needs-triage` is the default label.** `/qualia-triage` will route from there.