qualia-framework 6.2.9 → 6.2.10

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 (72) hide show
  1. package/README.md +14 -11
  2. package/agents/builder.md +7 -7
  3. package/agents/planner.md +39 -3
  4. package/agents/research-synthesizer.md +1 -1
  5. package/agents/researcher.md +3 -3
  6. package/agents/roadmapper.md +7 -7
  7. package/agents/verifier.md +18 -6
  8. package/agents/visual-evaluator.md +8 -7
  9. package/bin/cli.js +111 -14
  10. package/bin/contract-runner.js +219 -0
  11. package/bin/host-adapters.js +66 -0
  12. package/bin/install.js +99 -152
  13. package/bin/plan-contract.js +99 -2
  14. package/bin/planning-hygiene.js +262 -0
  15. package/bin/runtime-manifest.js +32 -0
  16. package/bin/state-ledger.js +184 -0
  17. package/bin/state.js +299 -20
  18. package/bin/trust-score.js +276 -0
  19. package/docs/onboarding.html +5 -4
  20. package/guide.md +3 -2
  21. package/package.json +1 -1
  22. package/qualia-design/design-rubric.md +17 -5
  23. package/qualia-design/frontend.md +5 -1
  24. package/qualia-design/graphics.md +47 -0
  25. package/rules/command-output.md +35 -0
  26. package/skills/qualia/SKILL.md +10 -10
  27. package/skills/qualia-build/SKILL.md +20 -14
  28. package/skills/qualia-debug/SKILL.md +16 -8
  29. package/skills/qualia-discuss/SKILL.md +10 -10
  30. package/skills/qualia-doctor/SKILL.md +140 -0
  31. package/skills/qualia-feature/SKILL.md +23 -21
  32. package/skills/qualia-fix/SKILL.md +216 -0
  33. package/skills/qualia-flush/SKILL.md +9 -9
  34. package/skills/qualia-handoff/SKILL.md +9 -9
  35. package/skills/qualia-help/SKILL.md +3 -3
  36. package/skills/qualia-hook-gen/SKILL.md +1 -1
  37. package/skills/qualia-idk/SKILL.md +4 -4
  38. package/skills/qualia-issues/SKILL.md +2 -2
  39. package/skills/qualia-learn/SKILL.md +10 -10
  40. package/skills/qualia-map/SKILL.md +2 -2
  41. package/skills/qualia-milestone/SKILL.md +15 -15
  42. package/skills/qualia-new/REFERENCE.md +9 -9
  43. package/skills/qualia-new/SKILL.md +14 -14
  44. package/skills/qualia-optimize/REFERENCE.md +1 -1
  45. package/skills/qualia-optimize/SKILL.md +23 -16
  46. package/skills/qualia-pause/SKILL.md +2 -2
  47. package/skills/qualia-plan/SKILL.md +23 -13
  48. package/skills/qualia-polish/REFERENCE.md +14 -14
  49. package/skills/qualia-polish/SKILL.md +64 -19
  50. package/skills/qualia-polish/scripts/loop.mjs +3 -3
  51. package/skills/qualia-polish/scripts/score.mjs +9 -3
  52. package/skills/qualia-postmortem/SKILL.md +9 -9
  53. package/skills/qualia-report/SKILL.md +23 -23
  54. package/skills/qualia-research/SKILL.md +5 -5
  55. package/skills/qualia-resume/SKILL.md +4 -4
  56. package/skills/qualia-review/SKILL.md +28 -12
  57. package/skills/qualia-road/SKILL.md +18 -5
  58. package/skills/qualia-ship/SKILL.md +22 -22
  59. package/skills/qualia-skill-new/SKILL.md +13 -13
  60. package/skills/qualia-test/SKILL.md +5 -5
  61. package/skills/qualia-triage/SKILL.md +1 -1
  62. package/skills/qualia-verify/SKILL.md +37 -23
  63. package/skills/qualia-vibe/SKILL.md +13 -10
  64. package/skills/qualia-vibe/scripts/extract.mjs +1 -1
  65. package/skills/zoho-workflow/SKILL.md +1 -1
  66. package/templates/help.html +12 -10
  67. package/tests/bin.test.sh +34 -4
  68. package/tests/install-smoke.test.sh +22 -2
  69. package/tests/lib.test.sh +290 -0
  70. package/tests/runner.js +3 -0
  71. package/tests/skills.test.sh +4 -4
  72. package/tests/state.test.sh +65 -3
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-debug
3
- description: "Investigative debugging parses symptom from arguments, runs diagnostic scans, identifies root cause, applies minimal fix, writes DEBUG report. Trigger on 'debug', 'find bug', 'fix error', 'something is broken', 'not working', 'weird behavior', 'layout broken', 'CSS issue', 'slow page', 'performance'."
3
+ description: "Investigation lane for unclear bugs and weird behavior. Parses symptoms, runs diagnostic scans, identifies root cause, and either reports insufficient evidence or routes actionable repair work to /qualia-fix. Trigger on 'debug', 'find bug', 'why is this broken', 'something is weird', 'investigate', 'root cause', 'not sure what's failing', 'CSS issue', 'slow page', 'performance'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -13,7 +13,7 @@ allowed-tools:
13
13
 
14
14
  # /qualia-debug — Investigative Debugging (one-shot)
15
15
 
16
- Parse the symptom. Run diagnostics. Find root cause. Apply minimal fix. Write report. **One-shot — no mandatory user questions.**
16
+ Parse the symptom. Run diagnostics. Find root cause. Write report, or route to `/qualia-fix` when the repair is actionable. **One-shot — no mandatory user questions.**
17
17
 
18
18
  ## Usage
19
19
 
@@ -22,6 +22,8 @@ Parse the symptom. Run diagnostics. Find root cause. Apply minimal fix. Write re
22
22
  - `/qualia-debug --frontend {symptom}` — layout/z-index/overflow bias
23
23
  - `/qualia-debug --perf {symptom}` — performance bias
24
24
 
25
+ If the user says "fix it" and the expected behavior is known, prefer `/qualia-fix`. Debug is for uncertainty; fix is for repair.
26
+
25
27
  ## Tool Budget
26
28
 
27
29
  Max 10 Read/Grep/Bash calls for investigation. If you haven't narrowed to root cause in 10, return `INSUFFICIENT EVIDENCE after 10 steps. Narrowed to: {files}. Recommend: {next diagnostic}.` Do not keep guessing.
@@ -29,7 +31,7 @@ Max 10 Read/Grep/Bash calls for investigation. If you haven't narrowed to root c
29
31
  ## Process
30
32
 
31
33
  ```bash
32
- node ~/.claude/bin/qualia-ui.js banner debug
34
+ node ${QUALIA_BIN}/qualia-ui.js banner debug
33
35
  ```
34
36
 
35
37
  ### 1. Parse Symptom from $ARGUMENTS
@@ -40,7 +42,7 @@ node ~/.claude/bin/qualia-ui.js banner debug
40
42
  ### 2. Check Known Fixes First (cheap)
41
43
 
42
44
  ```bash
43
- node ~/.claude/bin/knowledge.js search "{symptom_keywords}"
45
+ node ${QUALIA_BIN}/knowledge.js search "{symptom_keywords}"
44
46
  ```
45
47
 
46
48
  If a known fix matches, apply it and jump to step 5 (verify). Known fixes are pre-verified patterns — no need to re-investigate.
@@ -97,10 +99,12 @@ grep -rn "import(\|next/dynamic" --include="*.tsx" --include="*.ts" app/ src/ 2>
97
99
  grep -rln "'use client'" --include="*.tsx" app/ components/ src/ 2>/dev/null | wc -l
98
100
  ```
99
101
 
100
- ### 4. Form Hypothesis + Apply Minimal Fix
102
+ ### 4. Form Hypothesis + Route or Apply Minimal Fix
101
103
 
102
104
  From the diagnostic output, state the root cause in one sentence with `file:line` citation. No hedging — either you have evidence or you write `INSUFFICIENT EVIDENCE` and return (step 6).
103
105
 
106
+ If the user explicitly asked for repair and the fix is <= 3 files, route to `/qualia-fix {symptom}` with the root cause summary. If this debug invocation is already mid-repair, apply the minimal fix here for backward compatibility.
107
+
104
108
  Apply the minimal fix:
105
109
  - Only edit files whose contents caused the symptom
106
110
  - One concept per commit — don't fold in cleanup
@@ -122,7 +126,11 @@ If the verification fails, revert and return to step 3 with narrower hypothesis.
122
126
 
123
127
  ### 6. Write DEBUG Report
124
128
 
125
- Write to `.planning/DEBUG-{YYYY-MM-DD-HHMM}.md`:
129
+ Create the report directory and write to `.planning/reports/debug/DEBUG-{YYYY-MM-DD-HHMM}.md`:
130
+
131
+ ```bash
132
+ mkdir -p .planning/reports/debug
133
+ ```
126
134
 
127
135
  ```markdown
128
136
  # Debug Report — {YYYY-MM-DD HH:MM}
@@ -180,6 +188,6 @@ Do NOT apply a speculative fix. Return the report and stop.
180
188
 
181
189
  - **No mandatory questions.** This is one-shot. If symptom args are missing, investigate recent changes.
182
190
  - **Root cause or INSUFFICIENT EVIDENCE** — no "probably" fixes.
183
- - **Minimal fix only.** One concept, one commit. No refactors dressed as debug.
191
+ - **Minimal fix only.** One concept, one commit. No refactors dressed as debug. Prefer `/qualia-fix` for explicit repair requests.
184
192
  - **Tool budget is hard.** 10 calls, then stop.
185
- - **Every fix gets a DEBUG report in .planning/** — creates a searchable record.
193
+ - **Every investigation gets a DEBUG report in `.planning/reports/debug/`** — creates a searchable record without cluttering the root.
@@ -64,7 +64,7 @@ This is the only fork. Demo runs §1-§8 of the discovery template. Full project
64
64
  ### P2. Banner and open
65
65
 
66
66
  ```bash
67
- node ~/.claude/bin/qualia-ui.js banner discuss-project
67
+ node ${QUALIA_BIN}/qualia-ui.js banner discuss-project
68
68
  ```
69
69
 
70
70
  Say: **"Eight quick questions for the demo path"** or **"Fourteen questions to shape the full project — we'll move fast"** depending on type.
@@ -85,20 +85,20 @@ Allowed `[Enter]` defaults exist on §2, §3, §5 only (inferred from project ty
85
85
 
86
86
  ### P4. Write `.planning/project-discovery.md`
87
87
 
88
- Fill the template at `~/.claude/qualia-templates/project-discovery.md` with the user's verbatim answers. Set frontmatter `project_type` and `discovered_at`.
88
+ Fill the template at `${QUALIA_TEMPLATES}/project-discovery.md` with the user's verbatim answers. Set frontmatter `project_type` and `discovered_at`.
89
89
 
90
90
  ### P5. Hand back to `/qualia-new`
91
91
 
92
92
  ```bash
93
93
  git add .planning/project-discovery.md
94
94
  git commit -m "docs: project discovery interview ($PROJECT_TYPE)"
95
- node ~/.claude/bin/qualia-ui.js ok "Discovery captured — back to /qualia-new"
95
+ node ${QUALIA_BIN}/qualia-ui.js ok "Discovery captured — back to /qualia-new"
96
96
  ```
97
97
 
98
98
  If invoked standalone (not from `/qualia-new`), end with:
99
99
 
100
100
  ```bash
101
- node ~/.claude/bin/qualia-ui.js end "DISCOVERY CAPTURED" "/qualia-new"
101
+ node ${QUALIA_BIN}/qualia-ui.js end "DISCOVERY CAPTURED" "/qualia-new"
102
102
  ```
103
103
 
104
104
  If invoked inline by `/qualia-new`, return control silently — `/qualia-new` continues from Step 2.
@@ -135,19 +135,19 @@ Surface and lock the decisions, trade-offs, and constraints that must inform a p
135
135
  ### 1. Load substrate
136
136
 
137
137
  ```bash
138
- node ~/.claude/bin/state.js check 2>/dev/null
138
+ node ${QUALIA_BIN}/state.js check 2>/dev/null
139
139
  cat .planning/PROJECT.md .planning/ROADMAP.md .planning/CONTEXT.md 2>/dev/null
140
140
  ls .planning/decisions/ 2>/dev/null
141
141
  cat .planning/research/SUMMARY.md 2>/dev/null
142
142
  ```
143
143
 
144
- If `.planning/CONTEXT.md` is missing, copy `~/.claude/qualia-templates/CONTEXT.md` to `.planning/CONTEXT.md` first.
145
- If `.planning/decisions/` is missing, create it. Copy `~/.claude/qualia-templates/decisions/ADR-template.md` next to it for reference.
144
+ If `.planning/CONTEXT.md` is missing, copy `${QUALIA_TEMPLATES}/CONTEXT.md` to `.planning/CONTEXT.md` first.
145
+ If `.planning/decisions/` is missing, create it. Copy `${QUALIA_TEMPLATES}/decisions/ADR-template.md` next to it for reference.
146
146
 
147
147
  ### 2. Open the conversation
148
148
 
149
149
  ```bash
150
- node ~/.claude/bin/qualia-ui.js banner discuss {N} "{phase name from ROADMAP.md}"
150
+ node ${QUALIA_BIN}/qualia-ui.js banner discuss {N} "{phase name from ROADMAP.md}"
151
151
  ```
152
152
 
153
153
  Then state the goal in one sentence and the open questions you found in priority order (highest-stakes / hardest-to-reverse first).
@@ -200,14 +200,14 @@ Loop until "Lock it in".
200
200
 
201
201
  ### 6. Write phase-{N}-context.md
202
202
 
203
- Fill `~/.claude/qualia-templates/phase-context.md` with concrete content. Reference any ADRs written, any CONTEXT.md terms added.
203
+ Fill `${QUALIA_TEMPLATES}/phase-context.md` with concrete content. Reference any ADRs written, any CONTEXT.md terms added.
204
204
 
205
205
  ### 7. Commit and route
206
206
 
207
207
  ```bash
208
208
  git add .planning/phase-{N}-context.md .planning/CONTEXT.md .planning/decisions/
209
209
  git commit -m "docs(phase-{N}): lock context, glossary terms, ADRs"
210
- node ~/.claude/bin/qualia-ui.js end "PHASE {N} CONTEXT LOCKED" "/qualia-plan {N}"
210
+ node ${QUALIA_BIN}/qualia-ui.js end "PHASE {N} CONTEXT LOCKED" "/qualia-plan {N}"
211
211
  ```
212
212
 
213
213
  ## Rules — PHASE MODE
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: qualia-doctor
3
+ description: "Employee-facing framework health check. Wraps `qualia-framework doctor`, checks install targets, project state, contract coverage, planning-folder hygiene, hooks, memory, ERP queue health, and gives safe repair commands. Trigger on 'doctor', 'health check', 'framework broken', 'is Qualia installed correctly', 'Codex not picking up Qualia', 'hooks not running', 'memory broken', 'ERP queue stuck', '.planning messy'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Grep
8
+ ---
9
+
10
+ # /qualia-doctor
11
+
12
+ Diagnose whether the framework harness itself is healthy before blaming the project or the model.
13
+
14
+ ## 1. Install Health
15
+
16
+ Run:
17
+
18
+ ```bash
19
+ qualia-framework doctor
20
+ qualia-framework trust
21
+ ```
22
+
23
+ If it fails, report the failed checks first. Use safe repair commands only:
24
+
25
+ ```bash
26
+ npx qualia-framework@latest install
27
+ ```
28
+
29
+ Do not delete user files, configs, knowledge, or hooks manually.
30
+
31
+ ## 2. Project State Health
32
+
33
+ Run from the project root:
34
+
35
+ ```bash
36
+ node ${QUALIA_BIN}/state.js check
37
+ ```
38
+
39
+ If installed under Codex only, use:
40
+
41
+ ```bash
42
+ node ~/.codex/bin/state.js check
43
+ ```
44
+
45
+ Classify:
46
+ - `NO_PROJECT` -> project has not been initialized; next command is `/qualia-new` or `/qualia-map` for brownfield.
47
+ - `schema_errors` -> recommend `node ${QUALIA_BIN}/state.js fix` or Codex equivalent.
48
+ - `gap_cycles` at limit -> recommend replanning or escalation.
49
+
50
+ ## 3. Contract Health
51
+
52
+ For the current phase, check whether a machine-readable contract exists:
53
+
54
+ ```bash
55
+ node ${QUALIA_BIN}/state.js validate-plan --phase {N}
56
+ ```
57
+
58
+ If `contract_status` is `missing`, `invalid`, or `drifted`, the harness is not at full-trust mode yet.
59
+
60
+ When a contract exists, run:
61
+
62
+ ```bash
63
+ node ${QUALIA_BIN}/contract-runner.js .planning/phase-{N}-contract.json
64
+ ```
65
+
66
+ Use the Codex path on Codex-only installs.
67
+
68
+ ## 4. Planning Folder Hygiene
69
+
70
+ Run:
71
+
72
+ ```bash
73
+ qualia-framework planning-hygiene scan
74
+ ```
75
+
76
+ If it reports loose files, show the dry-run result first. Only organize when the user approves:
77
+
78
+ ```bash
79
+ qualia-framework planning-hygiene organize --write
80
+ ```
81
+
82
+ Do not move files by hand; the script keeps phase-critical root files in place and moves loose reports/assets into `.planning/reports/`, `.planning/assets/`, `.planning/design/`, or `.planning/archive/loose/`.
83
+
84
+ ## 5. Memory Health
85
+
86
+ Run:
87
+
88
+ ```bash
89
+ node ${QUALIA_BIN}/knowledge.js
90
+ node ${QUALIA_BIN}/knowledge.js list
91
+ ```
92
+
93
+ Healthy memory has at least `index.md`, `agents.md`, and a writable `daily-log/` directory. Missing curated memory is not fatal, but missing installed memory files means reinstall.
94
+
95
+ ## 6. ERP Queue Health
96
+
97
+ Run:
98
+
99
+ ```bash
100
+ qualia-framework erp-flush show
101
+ ```
102
+
103
+ If the queue has entries, run:
104
+
105
+ ```bash
106
+ qualia-framework erp-flush drain
107
+ ```
108
+
109
+ If the queue fails with `401`, the ERP API key is invalid. Use:
110
+
111
+ ```bash
112
+ printf '%s' "$QUALIA_ERP_KEY" | qualia-framework set-erp-key
113
+ ```
114
+
115
+ ## Output
116
+
117
+ End with:
118
+
119
+ ```text
120
+ Harness health: PASS | DEGRADED | FAIL
121
+ Trust score: {N}/100
122
+ Install: ...
123
+ State: ...
124
+ State ledger: ...
125
+ Contracts: ...
126
+ Planning hygiene: ...
127
+ Memory: ...
128
+ Design/UI: ...
129
+ Employee experience: ...
130
+ ERP: ...
131
+ Next: ...
132
+ ```
133
+
134
+ ## Rules
135
+
136
+ 1. Read diagnostics before repair.
137
+ 2. Never remove user-owned files.
138
+ 3. Treat missing contracts as degraded trust, not a project failure.
139
+ 4. Prefer reinstall for missing framework files.
140
+ 5. Prefer `state.js fix` only for malformed generated state.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-feature
3
- description: "Auto-scoped single feature build. Picks inline (≤1 trivial file, no spawn) or fresh builder spawn (1-5 logic files, atomic commit) automatically from the task description. Refuses and routes to /qualia-plan for 5+ files or full phases. Flags: --force-spawn forces a builder, --force-inline forces inline. Trigger phrases: 'build this one thing', 'add a component', 'implement this feature', 'quick fix', 'small change', 'tweak', 'hot fix', 'one-line fix', 'typo', 'config tweak', 'qualia-feature'."
3
+ description: "Auto-scoped single feature build for adding net-new capability. Picks inline (≤1 trivial file, no spawn) or fresh builder spawn (1-5 logic files, atomic commit). Refuses and routes to /qualia-plan for phase-sized work, and routes broken existing behavior to /qualia-fix. Trigger phrases: 'build this one thing', 'add a component', 'implement this feature', 'small change', 'tweak', 'one-line copy change', 'config tweak', 'qualia-feature'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -14,7 +14,7 @@ allowed-tools:
14
14
 
15
15
  # /qualia-feature — Auto-scoped Single Feature
16
16
 
17
- One command for everything between a typo and a phase. Auto-detects scope from the task description and picks the right execution path.
17
+ One command for adding a small new capability outside the planned Road. Auto-detects scope from the task description and picks the right execution path.
18
18
 
19
19
  ## Usage
20
20
 
@@ -26,7 +26,7 @@ One command for everything between a typo and a phase. Auto-detects scope from t
26
26
  ## When to use
27
27
 
28
28
  - One feature outside a planned phase
29
- - A bug fix, typo, config tweak, or one-line change
29
+ - A copy tweak, config tweak, or one-line non-repair change
30
30
  - A 1-5 file feature, component, API route, or integration
31
31
  - A refactor of a single module
32
32
 
@@ -34,6 +34,7 @@ One command for everything between a typo and a phase. Auto-detects scope from t
34
34
 
35
35
  - 5+ files or multiple subsystems touched → `/qualia-plan`
36
36
  - Part of a planned phase → `/qualia-build`
37
+ - Broken existing behavior, regression, failing test, or hotfix → `/qualia-fix`
37
38
  - Investigating a symptom you can't name yet → `/qualia-debug`
38
39
  - Optimization or polish pass → `/qualia-optimize` or `/qualia-polish`
39
40
 
@@ -68,6 +69,7 @@ Classify the description into one of three buckets:
68
69
  - "add a", "implement", "build", "create" + a single noun (component, route, page, table, form, modal, hook, util, migration)
69
70
  - Description names a single feature with multiple touch points (e.g. "add a feedback form" → migration + API + UI = 3-4 files, but still one cohesive thing)
70
71
  - The work needs a fresh context to avoid contaminating the current conversation
72
+ - The work repairs a non-trivial bug only if invoked explicitly with `/qualia-feature --force-spawn`; otherwise use `/qualia-fix`
71
73
 
72
74
  **Refuse signals** (any one is sufficient):
73
75
  - "build the X system", "implement the entire Y", "add complete Z support"
@@ -79,9 +81,9 @@ Classify the description into one of three buckets:
79
81
  Show the user what was detected. Always offer the escape hatch:
80
82
 
81
83
  ```bash
82
- node ~/.claude/bin/qualia-ui.js banner feature
83
- node ~/.claude/bin/qualia-ui.js info "Detected scope: {inline|spawn|refuse}"
84
- node ~/.claude/bin/qualia-ui.js info "Reason: {one-line rationale}"
84
+ node ${QUALIA_BIN}/qualia-ui.js banner feature
85
+ node ${QUALIA_BIN}/qualia-ui.js info "Detected scope: {inline|spawn|refuse}"
86
+ node ${QUALIA_BIN}/qualia-ui.js info "Reason: {one-line rationale}"
85
87
  ```
86
88
 
87
89
  Then:
@@ -114,13 +116,13 @@ git commit -m "fix: {description}"
114
116
  5. Record in state:
115
117
 
116
118
  ```bash
117
- node ~/.claude/bin/state.js transition --to note --notes "{brief description}" --tasks-done 1
119
+ node ${QUALIA_BIN}/state.js transition --to note --notes "{brief description}" --tasks-done 1
118
120
  ```
119
121
 
120
122
  6. End with:
121
123
 
122
124
  ```bash
123
- node ~/.claude/bin/qualia-ui.js end "FEATURE SHIPPED (inline)"
125
+ node ${QUALIA_BIN}/qualia-ui.js end "FEATURE SHIPPED (inline)"
124
126
  ```
125
127
 
126
128
  ### 5. Execute the spawn path
@@ -130,9 +132,9 @@ For spawn scope:
130
132
  1. Build a quick task spec (don't write to a file, just confirm with user):
131
133
 
132
134
  ```bash
133
- node ~/.claude/bin/qualia-ui.js info "What: {what to build}"
134
- node ~/.claude/bin/qualia-ui.js info "Files: {files to create/modify, comma list}"
135
- node ~/.claude/bin/qualia-ui.js info "Done: {observable acceptance criteria, 1-3 bullets}"
135
+ node ${QUALIA_BIN}/qualia-ui.js info "What: {what to build}"
136
+ node ${QUALIA_BIN}/qualia-ui.js info "Files: {files to create/modify, comma list}"
137
+ node ${QUALIA_BIN}/qualia-ui.js info "Done: {observable acceptance criteria, 1-3 bullets}"
136
138
  ```
137
139
 
138
140
  Ask: **"Good to build?"** Wait for confirmation.
@@ -142,7 +144,7 @@ Ask: **"Good to build?"** Wait for confirmation.
142
144
  ```
143
145
  Agent(subagent_type="qualia-builder", description="Feature: {short title}")
144
146
  prompt: |
145
- Read your role: @~/.claude/agents/builder.md
147
+ Read your role: @${QUALIA_AGENTS}/builder.md
146
148
 
147
149
  <task>
148
150
  {task description verbatim from user}
@@ -172,17 +174,17 @@ Agent(subagent_type="qualia-builder", description="Feature: {short title}")
172
174
  4. Report:
173
175
 
174
176
  ```bash
175
- node ~/.claude/bin/qualia-ui.js divider
176
- node ~/.claude/bin/qualia-ui.js ok "Feature: {description}"
177
- node ~/.claude/bin/qualia-ui.js ok "Files: {files changed}"
178
- node ~/.claude/bin/qualia-ui.js ok "Commit: {commit hash}"
179
- node ~/.claude/bin/qualia-ui.js end "FEATURE SHIPPED (spawn)"
177
+ node ${QUALIA_BIN}/qualia-ui.js divider
178
+ node ${QUALIA_BIN}/qualia-ui.js ok "Feature: {description}"
179
+ node ${QUALIA_BIN}/qualia-ui.js ok "Files: {files changed}"
180
+ node ${QUALIA_BIN}/qualia-ui.js ok "Commit: {commit hash}"
181
+ node ${QUALIA_BIN}/qualia-ui.js end "FEATURE SHIPPED (spawn)"
180
182
  ```
181
183
 
182
184
  5. Record in state:
183
185
 
184
186
  ```bash
185
- node ~/.claude/bin/state.js transition --to note --notes "{description}" --tasks-done 1
187
+ node ${QUALIA_BIN}/state.js transition --to note --notes "{description}" --tasks-done 1
186
188
  ```
187
189
 
188
190
  ### 6. Execute the refuse path
@@ -190,9 +192,9 @@ node ~/.claude/bin/state.js transition --to note --notes "{description}" --tasks
190
192
  For refuse scope, do NOT build. Explain why and route:
191
193
 
192
194
  ```bash
193
- node ~/.claude/bin/qualia-ui.js warn "This is too big for /qualia-feature (5+ files or multi-step workflow)."
194
- node ~/.claude/bin/qualia-ui.js info "Reason: {one-line — e.g. 'description names the entire auth system, not a slice'}"
195
- node ~/.claude/bin/qualia-ui.js end "ROUTED" "/qualia-plan"
195
+ node ${QUALIA_BIN}/qualia-ui.js warn "This is too big for /qualia-feature (5+ files or multi-step workflow)."
196
+ node ${QUALIA_BIN}/qualia-ui.js info "Reason: {one-line — e.g. 'description names the entire auth system, not a slice'}"
197
+ node ${QUALIA_BIN}/qualia-ui.js end "ROUTED" "/qualia-plan"
196
198
  ```
197
199
 
198
200
  If the user is sure it's small and the classifier got it wrong, they can re-invoke with `--force-spawn`.
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: qualia-fix
3
+ description: "Practical repair lane for broken existing behavior. Blends /qualia-debug root-cause discipline with /qualia-feature execution. Use when the user says 'fix this', 'bug', 'broken', 'error', 'failing test', 'regression', 'hotfix', 'not working', 'layout broken', 'slow page', or 'config is wrong'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
12
+ argument-hint: "[--quick|--frontend|--perf|--test|--no-commit] <symptom>"
13
+ ---
14
+
15
+ # /qualia-fix - Repair Broken Existing Behavior
16
+
17
+ Fix is the practical lane for "this used to work, or should work, and now it does not." It combines the evidence discipline of `/qualia-debug` with the small-work execution path of `/qualia-feature`.
18
+
19
+ ## Usage
20
+
21
+ - `/qualia-fix {symptom}` - diagnose and repair a named problem
22
+ - `/qualia-fix --quick {symptom}` - micro-fix, max 1 file, direct edit
23
+ - `/qualia-fix --frontend {symptom}` - bias diagnostics toward layout, CSS, hydration, responsive, and visual bugs
24
+ - `/qualia-fix --perf {symptom}` - bias diagnostics toward slow pages, wasteful renders, bundles, queries, and sequential awaits
25
+ - `/qualia-fix --test {failing command}` - start from a failing test/build command
26
+ - `/qualia-fix --no-commit {symptom}` - patch and verify, but leave changes uncommitted
27
+
28
+ ## When To Use
29
+
30
+ - A failing test, build, typecheck, lint, deploy, or runtime path
31
+ - A broken existing UI, route, form, API, config, or integration
32
+ - A regression after recent work
33
+ - A small bug report with enough detail to reproduce or inspect
34
+ - A hotfix where the expected behavior is already known
35
+
36
+ ## When Not To Use
37
+
38
+ - Net-new capability -> `/qualia-feature`
39
+ - Phase-sized work or 5+ likely files -> `/qualia-plan`
40
+ - Read-only audit -> `/qualia-review`
41
+ - No concrete symptom and no failing command -> `/qualia-debug`
42
+ - Visual craft/design quality with no functional bug -> `/qualia-polish`
43
+ - Whole-site aesthetic pivot -> `/qualia-vibe`
44
+
45
+ ## Process
46
+
47
+ ```bash
48
+ node ${QUALIA_BIN}/qualia-ui.js banner fix
49
+ ```
50
+
51
+ ### 1. Classify The Request
52
+
53
+ Parse `$ARGUMENTS` into:
54
+
55
+ - symptom
56
+ - mode: quick | frontend | perf | test | general
57
+ - expected behavior
58
+ - observed behavior
59
+ - named files/routes/tests if provided
60
+
61
+ If the request is actually a new feature, stop and route:
62
+
63
+ ```bash
64
+ node ${QUALIA_BIN}/qualia-ui.js end "ROUTED" "/qualia-feature"
65
+ ```
66
+
67
+ If the request is phase-sized, stop and route:
68
+
69
+ ```bash
70
+ node ${QUALIA_BIN}/qualia-ui.js end "ROUTED" "/qualia-plan"
71
+ ```
72
+
73
+ ### 2. Build The Feedback Loop
74
+
75
+ Use the cheapest check that can prove the bug is real and later prove it is fixed.
76
+
77
+ Prefer, in order:
78
+
79
+ 1. User-provided failing command
80
+ 2. Targeted test
81
+ 3. Typecheck or lint error
82
+ 4. Reproduction grep or route/component inspection
83
+ 5. Recent diff inspection
84
+
85
+ Useful starting commands:
86
+
87
+ ```bash
88
+ git status --short
89
+ git diff --stat
90
+ npm test -- --runInBand 2>/dev/null || npm test 2>/dev/null || true
91
+ npx tsc --noEmit 2>&1 | head -40
92
+ ```
93
+
94
+ For `--test`, run the exact command first and preserve the failing output.
95
+
96
+ ### 3. Find Root Cause
97
+
98
+ Use a hard inspection budget of 12 Read/Grep/Bash calls before returning insufficient evidence.
99
+
100
+ Root cause must include:
101
+
102
+ - `file:line`
103
+ - the specific bad assumption or broken contract
104
+ - why the symptom follows from it
105
+
106
+ No root cause, no patch. If evidence is insufficient, write the report and stop.
107
+
108
+ ### 4. Patch Minimally
109
+
110
+ Patch rules:
111
+
112
+ - Touch only files required by the root cause.
113
+ - Default max: 3 files.
114
+ - `--quick` max: 1 file.
115
+ - If more than 3 files are required, stop and route to `/qualia-plan` or ask for permission to widen.
116
+ - Do not include cleanup, refactors, formatting churn, or adjacent improvements.
117
+ - Preserve unrelated user changes.
118
+
119
+ ### 5. Verify
120
+
121
+ Re-run the feedback loop from Step 2. Then run the smallest broad safety check that matches the stack.
122
+
123
+ Common verification:
124
+
125
+ ```bash
126
+ npx tsc --noEmit
127
+ npm test -- --runInBand 2>/dev/null || npm test 2>/dev/null || true
128
+ ```
129
+
130
+ If verification fails, do not commit. Either repair the verification failure if it is the same root cause, or write the report with the remaining failure.
131
+
132
+ ### 6. Write FIX Report
133
+
134
+ Create the report directory and write `.planning/reports/fix/FIX-{YYYY-MM-DD-HHMM}.md`:
135
+
136
+ ```bash
137
+ mkdir -p .planning/reports/fix
138
+ ```
139
+
140
+ ```markdown
141
+ # Fix Report - {YYYY-MM-DD HH:MM}
142
+
143
+ **Symptom:** {user symptom}
144
+ **Mode:** general | quick | frontend | perf | test
145
+ **Outcome:** fixed | insufficient-evidence | partial
146
+
147
+ ## Feedback Loop
148
+ - Initial failing check: `{command or inspection}`
149
+ - Final passing check: `{command or inspection}`
150
+
151
+ ## Root Cause
152
+ `{file}:{line}` - {one sentence}
153
+
154
+ ## Patch
155
+ - Files changed: {list}
156
+ - Change summary: {brief summary}
157
+
158
+ ## Verification
159
+ - `{command}` - PASS|FAIL
160
+ - `{command}` - PASS|FAIL
161
+
162
+ ## Remaining Notes
163
+ - {adjacent issue not fixed, or "None"}
164
+ ```
165
+
166
+ ### 7. Commit
167
+
168
+ Unless `--no-commit` was passed:
169
+
170
+ ```bash
171
+ git add {specific changed files} .planning/reports/fix/FIX-{timestamp}.md
172
+ git commit -m "fix: {short symptom/root-cause summary}"
173
+ ```
174
+
175
+ Record state:
176
+
177
+ ```bash
178
+ node ${QUALIA_BIN}/state.js transition --to note --notes "{short fix summary}" --tasks-done 1
179
+ ```
180
+
181
+ ### 8. Output
182
+
183
+ ```bash
184
+ node ${QUALIA_BIN}/qualia-ui.js divider
185
+ node ${QUALIA_BIN}/qualia-ui.js ok "Root cause: {file:line}"
186
+ node ${QUALIA_BIN}/qualia-ui.js ok "Files: {changed files}"
187
+ node ${QUALIA_BIN}/qualia-ui.js ok "Verification: {commands}"
188
+ node ${QUALIA_BIN}/qualia-ui.js end "FIXED" "{next command if any}"
189
+ ```
190
+
191
+ ## Insufficient Evidence Return
192
+
193
+ If no confident root cause after 12 inspection calls, write the same FIX report with:
194
+
195
+ ```markdown
196
+ **Outcome:** insufficient-evidence
197
+
198
+ ## Narrowed To
199
+ - Files examined: {list}
200
+ - Ruled out: {list}
201
+ - Remaining suspects: {list}
202
+
203
+ ## Recommended Next Diagnostic
204
+ - {specific command or reproduction step}
205
+ ```
206
+
207
+ Do not patch and do not commit speculative work.
208
+
209
+ ## Rules
210
+
211
+ 1. **Repair existing behavior only.** New work belongs in `/qualia-feature`.
212
+ 2. **Feedback loop first.** Know how the bug will be proven fixed before editing.
213
+ 3. **Root cause or stop.** No plausible patches.
214
+ 4. **Small patch.** Default max 3 files; quick max 1 file.
215
+ 5. **Report every run.** The FIX report becomes searchable repair memory.
216
+ 6. **Commit only after verification.** `--no-commit` is the only exception.