qualia-framework 6.2.9 → 6.3.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 (93) hide show
  1. package/AGENTS.md +1 -0
  2. package/CLAUDE.md +1 -0
  3. package/README.md +26 -30
  4. package/agents/builder.md +7 -7
  5. package/agents/planner.md +39 -3
  6. package/agents/research-synthesizer.md +1 -1
  7. package/agents/researcher.md +3 -3
  8. package/agents/roadmapper.md +7 -7
  9. package/agents/verifier.md +18 -6
  10. package/agents/visual-evaluator.md +8 -7
  11. package/bin/cli.js +160 -16
  12. package/bin/command-surface.js +71 -0
  13. package/bin/contract-runner.js +219 -0
  14. package/bin/harness-eval.js +296 -0
  15. package/bin/host-adapters.js +66 -0
  16. package/bin/install.js +116 -172
  17. package/bin/knowledge-flush.js +21 -10
  18. package/bin/knowledge.js +1 -1
  19. package/bin/plan-contract.js +99 -2
  20. package/bin/planning-hygiene.js +262 -0
  21. package/bin/project-snapshot.js +20 -0
  22. package/bin/report-payload.js +18 -0
  23. package/bin/runtime-manifest.js +35 -0
  24. package/bin/state-ledger.js +184 -0
  25. package/bin/state.js +330 -20
  26. package/bin/trust-score.js +268 -0
  27. package/bin/work-packet.js +228 -0
  28. package/docs/erp-contract.md +81 -1
  29. package/docs/onboarding.html +4 -14
  30. package/guide.md +16 -16
  31. package/hooks/fawzi-approval-guard.js +143 -0
  32. package/hooks/pre-deploy-gate.js +74 -1
  33. package/hooks/session-start.js +29 -1
  34. package/package.json +1 -1
  35. package/qualia-design/design-rubric.md +17 -5
  36. package/qualia-design/frontend.md +6 -2
  37. package/qualia-design/graphics.md +47 -0
  38. package/rules/codex-goal.md +1 -1
  39. package/rules/command-output.md +35 -0
  40. package/rules/one-opinion.md +2 -2
  41. package/rules/speed.md +0 -1
  42. package/skills/qualia/SKILL.md +12 -12
  43. package/skills/qualia-build/SKILL.md +20 -14
  44. package/skills/qualia-discuss/SKILL.md +10 -10
  45. package/skills/qualia-doctor/SKILL.md +140 -0
  46. package/skills/qualia-feature/SKILL.md +24 -22
  47. package/skills/qualia-fix/SKILL.md +216 -0
  48. package/skills/qualia-handoff/SKILL.md +9 -9
  49. package/skills/qualia-learn/SKILL.md +11 -11
  50. package/skills/qualia-map/SKILL.md +2 -2
  51. package/skills/qualia-milestone/SKILL.md +15 -15
  52. package/skills/qualia-new/REFERENCE.md +9 -9
  53. package/skills/qualia-new/SKILL.md +14 -14
  54. package/skills/qualia-optimize/REFERENCE.md +1 -1
  55. package/skills/qualia-optimize/SKILL.md +23 -16
  56. package/skills/qualia-plan/SKILL.md +23 -13
  57. package/skills/qualia-polish/REFERENCE.md +15 -15
  58. package/skills/qualia-polish/SKILL.md +81 -21
  59. package/skills/qualia-polish/scripts/loop.mjs +3 -3
  60. package/skills/qualia-polish/scripts/score.mjs +9 -3
  61. package/skills/{qualia-vibe/scripts/extract.mjs → qualia-polish/scripts/vibe-extract.mjs} +5 -5
  62. package/skills/{qualia-vibe/scripts/tokens.mjs → qualia-polish/scripts/vibe-tokens.mjs} +6 -6
  63. package/skills/qualia-postmortem/SKILL.md +9 -9
  64. package/skills/qualia-report/SKILL.md +23 -23
  65. package/skills/qualia-research/SKILL.md +5 -5
  66. package/skills/qualia-review/SKILL.md +28 -12
  67. package/skills/qualia-road/SKILL.md +30 -22
  68. package/skills/qualia-ship/SKILL.md +31 -24
  69. package/skills/qualia-test/SKILL.md +5 -5
  70. package/skills/qualia-verify/SKILL.md +45 -23
  71. package/skills/zoho-workflow/SKILL.md +1 -1
  72. package/templates/help.html +11 -20
  73. package/tests/bin.test.sh +178 -76
  74. package/tests/hooks.test.sh +81 -1
  75. package/tests/install-smoke.test.sh +35 -5
  76. package/tests/lib.test.sh +432 -0
  77. package/tests/published-install-smoke.test.sh +4 -3
  78. package/tests/refs.test.sh +9 -4
  79. package/tests/runner.js +32 -28
  80. package/tests/skills.test.sh +4 -4
  81. package/tests/state.test.sh +133 -3
  82. package/skills/qualia-debug/SKILL.md +0 -185
  83. package/skills/qualia-flush/SKILL.md +0 -198
  84. package/skills/qualia-help/SKILL.md +0 -74
  85. package/skills/qualia-hook-gen/SKILL.md +0 -206
  86. package/skills/qualia-idk/SKILL.md +0 -166
  87. package/skills/qualia-issues/SKILL.md +0 -151
  88. package/skills/qualia-pause/SKILL.md +0 -68
  89. package/skills/qualia-resume/SKILL.md +0 -52
  90. package/skills/qualia-skill-new/SKILL.md +0 -173
  91. package/skills/qualia-triage/SKILL.md +0 -152
  92. package/skills/qualia-vibe/SKILL.md +0 -226
  93. package/skills/qualia-zoom/SKILL.md +0 -51
package/rules/speed.md CHANGED
@@ -50,5 +50,4 @@ When a Qualia command exists for the situation, use it — don't reinvent:
50
50
  - `/qualia-feature` — single feature, auto-scoped: inline for trivia, fresh builder spawn for 1-5 file features
51
51
  - `/qualia-ship` — full deploy pipeline (quality gates → commit → deploy → verify)
52
52
  - `/qualia-review` — production audit
53
- - `/qualia-pause` — save context before clearing the conversation
54
53
  - `/qualia-learn` — save a lesson from a mistake
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia
3
- description: "Smart router — reads project state (state.js), classifies the situation mechanically, returns the exact next command. Use whenever you type /qualia, 'what next', 'next', 'what now', 'what should I do next', 'what command now'. For deeper 'I don't understand what's going on' / 'something feels off' situations, use /qualia-idk instead — that one actually scans the planning folder and codebase to diagnose the confusion."
3
+ description: "Smart router — reads project state (state.js), classifies the situation mechanically, and either returns the exact next command or performs the lightweight diagnosis previously split across helper commands. Use whenever you type /qualia, 'what next', 'next', 'what now', 'what should I do next', 'what command now', 'resume', 'pause', or 'I don't know what is going on'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -17,7 +17,7 @@ Read project state. Classify your situation. Tell you the exact next command.
17
17
  ### 1. Get State
18
18
 
19
19
  ```bash
20
- node ~/.claude/bin/state.js check 2>/dev/null
20
+ node ${QUALIA_BIN}/state.js check 2>/dev/null
21
21
  ```
22
22
 
23
23
  Also gather context:
@@ -39,7 +39,7 @@ Use the state.js JSON output plus gathered context:
39
39
  |-----------|-----------|-------|
40
40
  | `no-project` | state.js returns NO_PROJECT | → `/qualia-new` |
41
41
  | `handoff` | `.continue-here.md` exists | → Read it, summarize, route to next step |
42
- | `mid-work` | Uncommitted changes + phase in progress | → Continue or `/qualia-pause` |
42
+ | `mid-work` | Uncommitted changes + phase in progress | → Continue, or write `.continue-here.md` if the user wants to pause |
43
43
  | `ready-to-plan` | status == "setup" | → `/qualia-plan {N}` |
44
44
  | `ready-to-build` | status == "planned" | → `/qualia-build {N}` |
45
45
  | `ready-to-verify` | status == "built" | → `/qualia-verify {N}` |
@@ -50,8 +50,8 @@ Use the state.js JSON output plus gathered context:
50
50
  | `polished` | status == "polished" | → `/qualia-ship` |
51
51
  | `shipped` | status == "shipped" | → `/qualia-handoff` |
52
52
  | `handed-off` | status == "handed_off" | → `/qualia-report` then done |
53
- | `blocked` | STATE.md lists blockers or same error 3+ times | → Analyze, suggest `/qualia-debug` |
54
- | `bug-loop` | Same files edited 3+ times, user frustrated | → Different approach, `/qualia-debug` |
53
+ | `blocked` | STATE.md lists blockers or same error 3+ times | → Diagnose the evidence; `/qualia-fix` if expected behavior is known, `/qualia-review` if broader audit is needed |
54
+ | `bug-loop` | Same files edited 3+ times, user frustrated | → Stop patching; summarize root cause evidence and route to `/qualia-fix` or `/qualia-review` |
55
55
  | `need-tests` | User mentions "tests", "coverage", "test this" | → `/qualia-test` |
56
56
 
57
57
  **Employee escalation:** If role is EMPLOYEE and situation is `gap-limit` or `bug-loop`, suggest: "Want to flag this for Fawzi?"
@@ -60,16 +60,16 @@ Use the state.js JSON output plus gathered context:
60
60
 
61
61
  **Clear next step** (use the UI helper — it reads state.js itself):
62
62
  ```bash
63
- node ~/.claude/bin/qualia-ui.js banner router
63
+ node ${QUALIA_BIN}/qualia-ui.js banner router
64
64
  # If a project is loaded, show the journey position first (one-glance orientation)
65
- test -f .planning/JOURNEY.md && node ~/.claude/bin/qualia-ui.js journey-tree .planning/JOURNEY.md
66
- node ~/.claude/bin/qualia-ui.js next "{next_command from state.js}"
65
+ test -f .planning/JOURNEY.md && node ${QUALIA_BIN}/qualia-ui.js journey-tree .planning/JOURNEY.md
66
+ node ${QUALIA_BIN}/qualia-ui.js next "{next_command from state.js}"
67
67
  ```
68
68
 
69
69
  **Ambiguous situation (multiple options):**
70
70
  Print the banner first, then use plain markdown for the options:
71
71
  ```bash
72
- node ~/.claude/bin/qualia-ui.js banner router
72
+ node ${QUALIA_BIN}/qualia-ui.js banner router
73
73
  ```
74
74
  ```
75
75
  ## Where You Are
@@ -87,9 +87,9 @@ node ~/.claude/bin/qualia-ui.js banner router
87
87
 
88
88
  **Blocker detected** (gap-limit, bug-loop, employee escalation):
89
89
  ```bash
90
- node ~/.claude/bin/qualia-ui.js banner router
91
- node ~/.claude/bin/qualia-ui.js fail "{blocker description}"
92
- node ~/.claude/bin/qualia-ui.js warn "Escalate to Fawzi or re-plan from scratch"
90
+ node ${QUALIA_BIN}/qualia-ui.js banner router
91
+ node ${QUALIA_BIN}/qualia-ui.js fail "{blocker description}"
92
+ node ${QUALIA_BIN}/qualia-ui.js warn "Escalate to Fawzi or re-plan from scratch"
93
93
  ```
94
94
 
95
95
  User can respond with a number, "just do it", or natural language.
@@ -32,9 +32,11 @@ Per `rules/codex-goal.md` — set the thread goal at phase start with scope `pha
32
32
 
33
33
  ```bash
34
34
  cat .planning/phase-{N}-plan.md
35
+ cat .planning/phase-{N}-contract.json
36
+ node ${QUALIA_BIN}/plan-contract.js validate .planning/phase-{N}-contract.json
35
37
  ```
36
38
 
37
- Parse tasks, waves, file refs.
39
+ Parse tasks, waves, file refs. Prefer the JSON contract for task ids, dependencies, file lists, and verification checks; use the Markdown plan as the human-readable context.
38
40
 
39
41
  ### 1b. Recovery Reference
40
42
 
@@ -45,7 +47,7 @@ git tag -f "pre-build-phase-{N}" HEAD 2>/dev/null
45
47
  ```
46
48
 
47
49
  ```bash
48
- node ~/.claude/bin/qualia-ui.js info "Recovery point: pre-build-phase-{N}"
50
+ node ${QUALIA_BIN}/qualia-ui.js info "Recovery point: pre-build-phase-{N}"
49
51
  ```
50
52
 
51
53
  Wave fail → stop, inspect status + output. Preserve work; fix forward or ask before reverting.
@@ -57,19 +59,19 @@ git diff --stat
57
59
  ### 2. Execute Waves
58
60
 
59
61
  ```bash
60
- node ~/.claude/bin/qualia-ui.js banner build {N} "{phase name}"
62
+ node ${QUALIA_BIN}/qualia-ui.js banner build {N} "{phase name}"
61
63
  ```
62
64
 
63
65
  **For each wave (sequential):**
64
66
 
65
67
  ```bash
66
- node ~/.claude/bin/qualia-ui.js wave {W} {total_waves} {tasks_in_wave}
68
+ node ${QUALIA_BIN}/qualia-ui.js wave {W} {total_waves} {tasks_in_wave}
67
69
  ```
68
70
 
69
71
  **Per task in wave: spawn ALL as separate `Agent()` calls in SAME turn (concurrent). Do NOT await one before spawning next.**
70
72
 
71
73
  ```bash
72
- node ~/.claude/bin/qualia-ui.js task {task_num} "{task title}"
74
+ node ${QUALIA_BIN}/qualia-ui.js task {task_num} "{task title}"
73
75
  ```
74
76
 
75
77
  **Pre-inline context** (saves 3-5 Read calls per builder):
@@ -84,7 +86,7 @@ Spawn builder:
84
86
 
85
87
  ```
86
88
  Agent(prompt="
87
- Role: @~/.claude/agents/builder.md
89
+ Role: @${QUALIA_AGENTS}/builder.md
88
90
 
89
91
  <phase_context>
90
92
  # PROJECT.md
@@ -110,6 +112,10 @@ Parallel tasks Wave {W} (do NOT touch their files):
110
112
  {task block from plan: title, wave, persona, files, depends-on, why, AC, action, validation, context}
111
113
  </task>
112
114
 
115
+ <task_contract>
116
+ {matching task object from .planning/phase-{N}-contract.json}
117
+ </task_contract>
118
+
113
119
  Context tags already loaded. Only Read project code you modify.
114
120
  Execute. Commit. Return DONE/BLOCKED/PARTIAL.
115
121
  ", subagent_type="qualia-builder", description="Task {N}: {title}")
@@ -121,7 +127,7 @@ Execute. Commit. Return DONE/BLOCKED/PARTIAL.
121
127
  - Verify commit: `git log --oneline -1`
122
128
  - Show:
123
129
  ```bash
124
- node ~/.claude/bin/qualia-ui.js done {task_num} "{title}" {commit_hash}
130
+ node ${QUALIA_BIN}/qualia-ui.js done {task_num} "{title}" {commit_hash}
125
131
  ```
126
132
 
127
133
  **After each wave:** move to next, show summary.
@@ -131,10 +137,10 @@ node ~/.claude/bin/qualia-ui.js done {task_num} "{title}" {commit_hash}
131
137
  All waves done:
132
138
 
133
139
  ```bash
134
- node ~/.claude/bin/qualia-ui.js divider
135
- node ~/.claude/bin/qualia-ui.js ok "Tasks: {done}/{total}"
136
- node ~/.claude/bin/qualia-ui.js ok "Commits: {count}"
137
- node ~/.claude/bin/qualia-ui.js ok "Waves: {count}"
140
+ node ${QUALIA_BIN}/qualia-ui.js divider
141
+ node ${QUALIA_BIN}/qualia-ui.js ok "Tasks: {done}/{total}"
142
+ node ${QUALIA_BIN}/qualia-ui.js ok "Commits: {count}"
143
+ node ${QUALIA_BIN}/qualia-ui.js ok "Waves: {count}"
138
144
  ```
139
145
 
140
146
  ### 4. Handle Failures
@@ -147,7 +153,7 @@ Builder returns deviation/blocker:
147
153
  ### 5. Update State
148
154
 
149
155
  ```bash
150
- node ~/.claude/bin/state.js transition --to built --phase {N} --tasks-done {done} --tasks-total {total} --wave {wave}
156
+ node ${QUALIA_BIN}/state.js transition --to built --phase {N} --tasks-done {done} --tasks-total {total} --wave {wave}
151
157
  ```
152
158
  Error → show, stop.
153
159
  Do NOT edit STATE.md or tracking.json manually; state.js handles both.
@@ -157,7 +163,7 @@ Do NOT edit STATE.md or tracking.json manually; state.js handles both.
157
163
  **`--auto`:** invoke `/qualia-verify {N} --auto` inline. No pause.
158
164
 
159
165
  ```bash
160
- node ~/.claude/bin/qualia-ui.js info "Auto mode — chaining into /qualia-verify {N}"
166
+ node ${QUALIA_BIN}/qualia-ui.js info "Auto mode — chaining into /qualia-verify {N}"
161
167
  ```
162
168
 
163
169
  Then invoke `qualia-verify` inline with `--auto`.
@@ -165,5 +171,5 @@ Then invoke `qualia-verify` inline with `--auto`.
165
171
  **Guided mode:** stop, show next step:
166
172
 
167
173
  ```bash
168
- node ~/.claude/bin/qualia-ui.js end "PHASE {N} BUILT" "/qualia-verify {N}"
174
+ node ${QUALIA_BIN}/qualia-ui.js end "PHASE {N} BUILT" "/qualia-verify {N}"
169
175
  ```
@@ -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,7 +34,8 @@ 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
- - Investigating a symptom you can't name yet → `/qualia-debug`
37
+ - Broken existing behavior, regression, failing test, or hotfix → `/qualia-fix`
38
+ - Investigating a symptom you can't name yet → `/qualia-review`
38
39
  - Optimization or polish pass → `/qualia-optimize` or `/qualia-polish`
39
40
 
40
41
  ## Process
@@ -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`.