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
@@ -28,30 +28,44 @@ Spawn verifier to check phase goal. Does NOT trust build summaries; greps codeba
28
28
  ```bash
29
29
  echo "---PLAN---"
30
30
  cat .planning/phase-{N}-plan.md 2>/dev/null
31
+ echo "---CONTRACT---"
32
+ cat .planning/phase-{N}-contract.json 2>/dev/null || echo "NO_JSON_CONTRACT"
31
33
  echo "---PREVIOUS---"
32
34
  cat .planning/phase-{N}-verification.md 2>/dev/null || echo "NONE"
33
35
  ```
34
36
 
35
- ### 2. Spawn Verifier (Fresh Context)
37
+ ### 2. Run Machine Contract First
38
+
39
+ If `.planning/phase-{N}-contract.json` exists, run:
40
+
41
+ ```bash
42
+ node ${QUALIA_BIN}/contract-runner.js .planning/phase-{N}-contract.json
43
+ ```
44
+
45
+ If it fails, the phase cannot PASS. Still spawn the verifier to explain the failure and identify the smallest gap-closure tasks. If it passes, pass the evidence file into the verifier prompt.
46
+
47
+ ### 3. Spawn Verifier (Fresh Context)
36
48
 
37
49
  ```bash
38
- node ~/.claude/bin/qualia-ui.js banner verify {N} "{phase name}"
39
- node ~/.claude/bin/qualia-ui.js spawn verifier "Goal-backward check..."
50
+ node ${QUALIA_BIN}/qualia-ui.js banner verify {N} "{phase name}"
51
+ node ${QUALIA_BIN}/qualia-ui.js spawn verifier "Goal-backward check..."
40
52
  ```
41
53
 
42
54
  ```
43
55
  Agent(prompt="
44
- Role: @~/.claude/agents/verifier.md
56
+ Role: @${QUALIA_AGENTS}/verifier.md
45
57
 
46
58
  Project: @.planning/PROJECT.md
47
59
  Plan + AC + validation: @.planning/phase-{N}-plan.md
60
+ Machine contract: @.planning/phase-{N}-contract.json
61
+ Contract evidence: @.planning/evidence/phase-{N}-contract-run.json
48
62
  {Re-verify → previous gaps: @.planning/phase-{N}-verification.md}
49
63
 
50
64
  Verify phase. Every finding needs file:line evidence. Severity Rubric for all labels. Output: .planning/phase-{N}-verification.md
51
65
  ", subagent_type="qualia-verifier", description="Verify phase {N}")
52
66
  ```
53
67
 
54
- ### 2b. Browser QA (if phase touched frontend)
68
+ ### 3b. Browser QA (if phase touched frontend)
55
69
 
56
70
  If plan Files include `.tsx`/`.jsx`/`.css`/`.scss` or `app/`/`pages/`/`components/` paths, spawn browser QA parallel:
57
71
 
@@ -64,7 +78,7 @@ If frontend:
64
78
 
65
79
  ```
66
80
  Agent(prompt="
67
- Role: @~/.claude/agents/qa-browser.md
81
+ Role: @${QUALIA_AGENTS}/qa-browser.md
68
82
 
69
83
  Plan: @.planning/phase-{N}-plan.md
70
84
  Verification: @.planning/phase-{N}-verification.md
@@ -75,17 +89,17 @@ Drive dev server, test routes phase touched. Append '## Browser QA' to verificat
75
89
 
76
90
  Wait for both verifier + QA before step 3. Playwright MCP unavailable → QA returns BLOCKED (note, not phase failure).
77
91
 
78
- ### 2c. Adversarial Second Opinion (--adversarial flag, optional)
92
+ ### 3c. Adversarial Second Opinion (--adversarial flag, optional)
79
93
 
80
94
  `--adversarial` in args, OR milestone is `Handoff`, OR plan touches `auth|payment|migration|rls|service_role` → spawn SECOND verifier in fresh context. Mitigates self-grading bias (~70% fewer findings without adversarial pass).
81
95
 
82
96
  ```bash
83
- node ~/.claude/bin/qualia-ui.js spawn verifier "Adversarial pass — find what's wrong"
97
+ node ${QUALIA_BIN}/qualia-ui.js spawn verifier "Adversarial pass — find what's wrong"
84
98
  ```
85
99
 
86
100
  ```
87
101
  Agent(prompt="
88
- Role: @~/.claude/agents/verifier.md
102
+ Role: @${QUALIA_AGENTS}/verifier.md
89
103
 
90
104
  ADVERSARIAL reviewer. Find what's WRONG. Assume cooperative verifier missed something. Same Severity Rubric + evidence-citation req. Bias toward edge cases:
91
105
  - Untested error paths?
@@ -104,14 +118,14 @@ Append '## Adversarial Findings' to verification file. Empty section fine if not
104
118
 
105
119
  Findings merge into main report. Union PASS/FAIL: either pass found CRITICAL/HIGH → phase FAIL.
106
120
 
107
- ### 2d. INSUFFICIENT EVIDENCE downgrade (mandatory)
121
+ ### 3d. INSUFFICIENT EVIDENCE downgrade (mandatory)
108
122
 
109
123
  The verifier marks criteria it could not check (budget exhaustion, missing context) as `INSUFFICIENT EVIDENCE`. The orchestrator must treat those as FAIL before declaring PASS. Grep the verification file and downgrade immediately:
110
124
 
111
125
  ```bash
112
126
  IE_COUNT=$(grep -c "INSUFFICIENT EVIDENCE" .planning/phase-{N}-verification.md 2>/dev/null || echo 0)
113
127
  if [ "$IE_COUNT" -gt 0 ]; then
114
- node ~/.claude/bin/qualia-ui.js warn "${IE_COUNT} criteria marked INSUFFICIENT EVIDENCE — downgrading verdict to FAIL"
128
+ node ${QUALIA_BIN}/qualia-ui.js warn "${IE_COUNT} criteria marked INSUFFICIENT EVIDENCE — downgrading verdict to FAIL"
115
129
  # Rewrite the verdict line in-place
116
130
  sed -i 's/^result: PASS$/result: FAIL/' .planning/phase-{N}-verification.md
117
131
  sed -i 's/^## Verdict$/## Verdict\n\n**Downgraded to FAIL:** '"${IE_COUNT}"' criteria left unchecked. Re-run with larger budget (`max(25, tasks*5)` already applied) or simplify the phase plan./' .planning/phase-{N}-verification.md
@@ -126,20 +140,20 @@ Read verification report. Present:
126
140
 
127
141
  **PASS:**
128
142
  ```bash
129
- node ~/.claude/bin/qualia-ui.js ok "All {count} criteria passed"
130
- node ~/.claude/bin/qualia-ui.js end "PHASE {N} VERIFIED" "/qualia-plan {N+1}"
143
+ node ${QUALIA_BIN}/qualia-ui.js ok "All {count} criteria passed"
144
+ node ${QUALIA_BIN}/qualia-ui.js end "PHASE {N} VERIFIED" "/qualia-plan {N+1}"
131
145
  ```
132
146
  (Last phase → `/qualia-polish` as next command.)
133
147
 
134
148
  **FAIL:**
135
149
  ```bash
136
- node ~/.claude/bin/qualia-ui.js ok "Passed: {pass_count}"
137
- node ~/.claude/bin/qualia-ui.js fail "Failed: {fail_count}"
150
+ node ${QUALIA_BIN}/qualia-ui.js ok "Passed: {pass_count}"
151
+ node ${QUALIA_BIN}/qualia-ui.js fail "Failed: {fail_count}"
138
152
  ```
139
153
 
140
154
  Per gap:
141
155
  ```bash
142
- node ~/.claude/bin/qualia-ui.js fail "{gap description}"
156
+ node ${QUALIA_BIN}/qualia-ui.js fail "{gap description}"
143
157
  ```
144
158
 
145
159
  **Self-healing:** before re-planning gaps, run postmortem so the framework learns from the miss. Writes `.planning/phase-{N}-postmortem.md`. Does NOT auto-apply deltas unless user runs `/qualia-postmortem --apply`.
@@ -150,13 +164,13 @@ node ~/.claude/bin/qualia-ui.js fail "{gap description}"
150
164
 
151
165
  End:
152
166
  ```bash
153
- node ~/.claude/bin/qualia-ui.js end "PHASE {N} GAPS FOUND" "/qualia-plan {N} --gaps"
167
+ node ${QUALIA_BIN}/qualia-ui.js end "PHASE {N} GAPS FOUND" "/qualia-plan {N} --gaps"
154
168
  ```
155
169
 
156
170
  ### 4. Update State
157
171
 
158
172
  ```bash
159
- node ~/.claude/bin/state.js transition --to verified --phase {N} --verification {pass|fail}
173
+ node ${QUALIA_BIN}/state.js transition --to verified --phase {N} --verification {pass|fail}
160
174
  ```
161
175
  PASS + more phases → state.js auto-advances.
162
176
  FAIL + gap_cycles >= limit → GAP_CYCLE_LIMIT, escalate.
@@ -166,7 +180,7 @@ Do NOT edit STATE.md or tracking.json manually; state.js handles both.
166
180
  Capture new state for auto-chain routing:
167
181
 
168
182
  ```bash
169
- NEW_STATE=$(node ~/.claude/bin/state.js check)
183
+ NEW_STATE=$(node ${QUALIA_BIN}/state.js check)
170
184
  # Parse: .phase, .total_phases, .status, .verification
171
185
  # Read .planning/JOURNEY.md to check if last phase of milestone
172
186
  ```
@@ -189,8 +203,8 @@ Handoff: milestone name == "Handoff" AND last phase.
189
203
  **Halt (gap cycle limit):**
190
204
 
191
205
  ```bash
192
- node ~/.claude/bin/qualia-ui.js fail "Phase {N} failed verification {cycles} times -- gap limit reached"
193
- node ~/.claude/bin/qualia-ui.js warn "Human intervention required. Options:"
206
+ node ${QUALIA_BIN}/qualia-ui.js fail "Phase {N} failed verification {cycles} times -- gap limit reached"
207
+ node ${QUALIA_BIN}/qualia-ui.js warn "Human intervention required. Options:"
194
208
  echo " 1. Re-plan from scratch: /qualia-plan {N}"
195
209
  echo " 2. Adjust roadmap (scope wrong)"
196
210
  echo " 3. Escalate to Fawzi (EMPLOYEE role)"
@@ -200,9 +214,9 @@ echo " 3. Escalate to Fawzi (EMPLOYEE role)"
200
214
 
201
215
  ```bash
202
216
  # PASS (or "/qualia-milestone" if last phase, "/qualia-polish" if overall last)
203
- node ~/.claude/bin/qualia-ui.js end "PHASE {N} VERIFIED" "/qualia-plan {N+1}"
217
+ node ${QUALIA_BIN}/qualia-ui.js end "PHASE {N} VERIFIED" "/qualia-plan {N+1}"
204
218
  # FAIL
205
- node ~/.claude/bin/qualia-ui.js end "PHASE {N} GAPS FOUND" "/qualia-plan {N} --gaps"
219
+ node ${QUALIA_BIN}/qualia-ui.js end "PHASE {N} GAPS FOUND" "/qualia-plan {N} --gaps"
206
220
  ```
207
221
 
208
222
  ### 5. Passive Knowledge Capture (on FAIL)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-vibe
3
- description: "Fast aesthetic pivot — swap the design vibe (tokens: color, typography, motion, depth) without touching component structure or layout. Default mode proposes ONE direction (per rules/one-opinion.md). Sub-modes: --variants for A/B/C menu (only when user explicitly asked), --extract URL to reverse-engineer DESIGN.md from a reference site, --sync to back-sync code → DESIGN.md when tokens drifted in code. Triggers: 'different vibe', 'change the look', 'swap the aesthetic', 'try something bolder', 'redesign the look', 'match this site', 'sync the design file'."
3
+ description: "Fast aesthetic-token pivot — swap the design vibe (color, typography, motion, depth) without touching component structure, layout, routes, or behavior. Default mode proposes ONE direction (per rules/one-opinion.md). Sub-modes: --variants for A/B/C menu, --extract URL to reverse-engineer DESIGN.md, --sync to back-sync code → DESIGN.md. Triggers: 'different vibe', 'change the look', 'swap the aesthetic', 'try something bolder', 'match this site', 'sync the design file'. Route structural redesign to /qualia-polish --redesign and broken UI behavior to /qualia-fix."
4
4
  disable-model-invocation: false
5
5
  allowed-tools:
6
6
  - Bash
@@ -26,7 +26,8 @@ Swap the **vibe** without redoing the **app**. Tokens only: color, typography, d
26
26
 
27
27
  ## When NOT to use
28
28
 
29
- - The complaint is "this component is broken" or "the spacing is wrong" → `/qualia-polish` (component or section scope).
29
+ - The complaint is "this component is broken" as behavior → `/qualia-fix`.
30
+ - The complaint is "the spacing is wrong" or "this looks rough" → `/qualia-polish` (component or section scope).
30
31
  - The site has no DESIGN.md yet → run `/qualia-new` first; vibe is a PIVOT, not a cold start.
31
32
  - You want a structural redesign (layout, navigation, information architecture) → `/qualia-polish --redesign` (~30 min ground-up).
32
33
 
@@ -72,7 +73,7 @@ Back-sync. Reads the codebase's actual CSS vars, Tailwind config, and font impor
72
73
  ### 0. Pre-flight gates
73
74
 
74
75
  ```bash
75
- node ~/.claude/bin/qualia-ui.js banner vibe 2>/dev/null
76
+ node ${QUALIA_BIN}/qualia-ui.js banner vibe 2>/dev/null
76
77
 
77
78
  # DESIGN.md must exist
78
79
  test -f .planning/DESIGN.md || {
@@ -127,12 +128,13 @@ Once user approves a direction:
127
128
  - CSS vars in `app/globals.css` or `src/styles/globals.css` (whichever exists)
128
129
  - `tailwind.config.{ts,js,mjs}` colors / fonts / spacing extensions
129
130
  - Font imports (`@import url(...)` in CSS, or `<link>` in `app/layout.tsx`, or `next/font/google` calls)
130
- 7. Run `node ~/.claude/bin/slop-detect.mjs` on changed files. Block on critical findings (no banned fonts in the new vibe).
131
+ 7. Run `node ${QUALIA_BIN}/slop-detect.mjs` on changed files. Block on critical findings (no banned fonts in the new vibe).
131
132
  8. Capture one screenshot at desktop (1440) for visual diff:
132
133
  ```bash
133
- node ~/.claude/skills/qualia-polish/scripts/playwright-capture.mjs \
134
+ mkdir -p .planning/assets/vibe
135
+ node ${QUALIA_SKILLS}/qualia-polish/scripts/playwright-capture.mjs \
134
136
  --url ${URL:-http://localhost:3000} \
135
- --out .planning/vibe-after.png \
137
+ --out .planning/assets/vibe/vibe-after.png \
136
138
  --width 1440
137
139
  ```
138
140
  9. Commit:
@@ -146,7 +148,7 @@ If the commit fails (no dev server, no slop-detect, network error), surface the
146
148
  ### 4. Variants flow
147
149
 
148
150
  ```bash
149
- node ~/.claude/skills/qualia-vibe/scripts/tokens.mjs propose-variants \
151
+ node ${QUALIA_SKILLS}/qualia-vibe/scripts/tokens.mjs propose-variants \
150
152
  --product .planning/PRODUCT.md \
151
153
  --design .planning/DESIGN.md \
152
154
  --count ${N:-3}
@@ -157,9 +159,10 @@ Output N briefs side-by-side. `AskUserQuestion` with N options (one per variant)
157
159
  ### 5. Extract flow
158
160
 
159
161
  ```bash
160
- node ~/.claude/skills/qualia-vibe/scripts/extract.mjs \
162
+ mkdir -p .planning/design
163
+ node ${QUALIA_SKILLS}/qualia-vibe/scripts/extract.mjs \
161
164
  --source ${URL_OR_IMAGE} \
162
- --out .planning/DESIGN-extracted.md
165
+ --out .planning/design/DESIGN-extracted.md
163
166
  ```
164
167
 
165
168
  The script:
@@ -173,7 +176,7 @@ Present the draft. Diff against current DESIGN.md. User can: `Apply as new vibe`
173
176
  ### 6. Sync flow
174
177
 
175
178
  ```bash
176
- node ~/.claude/skills/qualia-vibe/scripts/tokens.mjs sync \
179
+ node ${QUALIA_SKILLS}/qualia-vibe/scripts/tokens.mjs sync \
177
180
  --design .planning/DESIGN.md \
178
181
  ${WRITE:+--write}
179
182
  ```
@@ -35,7 +35,7 @@ function flag(name, fallback) {
35
35
  }
36
36
 
37
37
  const source = flag("--source");
38
- const outDraft = flag("--out", ".planning/DESIGN-extracted.md");
38
+ const outDraft = flag("--out", ".planning/design/DESIGN-extracted.md");
39
39
 
40
40
  if (!source) {
41
41
  console.error("--source required (URL or local image path)");
@@ -43,7 +43,7 @@ The full handoff runbook lives in the qualia-erp repo: `docs/finance-runbook.md`
43
43
  ## Email Formatting Rules (MANDATORY)
44
44
 
45
45
  - Always append Fawzi's signature at the bottom of every email
46
- - Read signature HTML from `~/.claude/knowledge/email-signature.html`
46
+ - Read signature HTML from `${QUALIA_KNOWLEDGE}/email-signature.html`
47
47
  - Never use dashes (---) or horizontal separators
48
48
  - Never use emojis
49
49
  - Professional, direct tone
@@ -297,7 +297,7 @@
297
297
  <div class="header-content">
298
298
  <h1><span>Qualia</span> Framework</h1>
299
299
  <p>Plan, build, verify, ship. The AI-powered workflow for Qualia Solutions.</p>
300
- <div class="version">{{VERSION}} &middot; 33 skills</div>
300
+ <div class="version">{{VERSION}} &middot; 35 skills</div>
301
301
  </div>
302
302
  </div>
303
303
 
@@ -328,7 +328,7 @@
328
328
 
329
329
  <!-- Skills -->
330
330
  <section>
331
- <h2>Skills (28)</h2>
331
+ <h2>Skills</h2>
332
332
 
333
333
  <!-- Road (core flow) -->
334
334
  <div class="cmd-group">
@@ -360,11 +360,13 @@
360
360
  <!-- Quality -->
361
361
  <div class="cmd-group">
362
362
  <h3>Quality</h3>
363
- <p class="cmd-group-note">Diagnose, audit, optimize, polish, test.</p>
363
+ <p class="cmd-group-note">Fix, diagnose, audit, optimize, polish, test.</p>
364
364
  <div class="commands">
365
- <div class="cmd"><span class="cmd-name">/qualia-debug</span><span class="cmd-desc">Structured debugging &mdash; symptom gathering, diagnosis confirmation, root cause analysis. Trigger on 'debug', 'find bug', 'fix error', 'something is broken'.</span></div>
366
- <div class="cmd"><span class="cmd-name">/qualia-review</span><span class="cmd-desc">Production audit with scored diagnostics. Runs real commands, scores findings by severity. Trigger on 'review', 'audit', 'code review', 'security check'.</span></div>
367
- <div class="cmd"><span class="cmd-name">/qualia-optimize</span><span class="cmd-desc">Deep optimization pass &mdash; reads .planning/ AND codebase to find performance, design, UI, backend, and frontend issues. Spawns parallel specialist agents. Supports --perf, --ui, --backend, --alignment, --fix flags.</span></div>
365
+ <div class="cmd"><span class="cmd-name">/qualia-doctor</span><span class="cmd-desc">Framework health check &mdash; install, state, contracts, memory, hooks, and ERP queue. Use when Qualia itself feels broken or Codex/Claude is not picking it up.</span></div>
366
+ <div class="cmd"><span class="cmd-name">/qualia-fix</span><span class="cmd-desc">Repair broken existing behavior &mdash; build a feedback loop, find root cause, patch minimally, verify, write a fix report. Trigger on 'fix this', 'bug', 'broken', 'failing test', 'regression'.</span></div>
367
+ <div class="cmd"><span class="cmd-name">/qualia-debug</span><span class="cmd-desc">Structured investigation &mdash; symptom gathering, diagnosis confirmation, root cause analysis. Use when the failure is unclear and you need evidence before repair.</span></div>
368
+ <div class="cmd"><span class="cmd-name">/qualia-review</span><span class="cmd-desc">Read-only production audit with scored diagnostics. Runs real commands, scores findings by severity, then routes repairs to /qualia-fix, /qualia-polish, or /qualia-optimize.</span></div>
369
+ <div class="cmd"><span class="cmd-name">/qualia-optimize</span><span class="cmd-desc">Deep improvement discovery &mdash; reads .planning/ AND codebase to find performance, design, UI, backend, alignment, and architecture opportunities. Writes OPTIMIZE.md/RFCs; specific repairs route through /qualia-fix.</span></div>
368
370
  <div class="cmd"><span class="cmd-name">/qualia-test</span><span class="cmd-desc">Generate or run tests for client projects. Trigger on 'write tests', 'add tests', 'test this', 'test coverage'.</span></div>
369
371
  <div class="cmd"><span class="cmd-name">/qualia-zoom</span><span class="cmd-desc">Focus on a single file or function with full context (glossary terms, depending callers, ADRs touched). Use when a fresh agent needs surgical context for a tricky area.</span></div>
370
372
  <div class="cmd"><span class="cmd-name">/qualia-issues</span><span class="cmd-desc">Break a phase plan into independent vertical-slice GitHub issues with needs-triage label. Externalizes work to the open queue so other sessions or contributors can pull from it.</span></div>
@@ -377,9 +379,9 @@
377
379
  <h3>Quick Paths</h3>
378
380
  <p class="cmd-group-note">Lightweight alternatives when the full road is overkill.</p>
379
381
  <div class="commands">
380
- <div class="cmd"><span class="cmd-name">/qualia-feature</span><span class="cmd-desc">Auto-scoped single-feature build. Inline for trivia (typo, config), fresh builder spawn for 1-5 file features. Refuses and routes to /qualia-plan for phase-sized work. Flags: --force-spawn, --force-inline.</span></div>
381
- <div class="cmd"><span class="cmd-name">/qualia-polish</span><span class="cmd-desc">Design pass, scope-adaptive &mdash; component, route, full app, redesign, critique, quick. Add --loop for the autonomous screenshot &rarr; score &rarr; fix loop.</span></div>
382
- <div class="cmd"><span class="cmd-name">/qualia-vibe</span><span class="cmd-desc">Fast aesthetic pivot (~3 min) &mdash; swap design tokens (color, type, depth, motion), keep layout untouched. Default proposes ONE direction. Modes: --variants for A/B/C, --extract URL to reverse-engineer DESIGN.md from a reference site, --sync for code &harr; DESIGN.md back-sync.</span></div>
382
+ <div class="cmd"><span class="cmd-name">/qualia-feature</span><span class="cmd-desc">Auto-scoped new-feature build. Inline for trivia (copy, config), fresh builder spawn for 1-5 file features. Broken existing behavior routes to /qualia-fix. Flags: --force-spawn, --force-inline.</span></div>
383
+ <div class="cmd"><span class="cmd-name">/qualia-polish</span><span class="cmd-desc">Visual quality pass, scope-adaptive &mdash; component, route, full app, redesign, critique, quick. It fixes style/layout/accessibility only; functional bugs route to /qualia-fix.</span></div>
384
+ <div class="cmd"><span class="cmd-name">/qualia-vibe</span><span class="cmd-desc">Fast aesthetic-token pivot (~3 min) &mdash; swap color, type, depth, and motion, keep layout untouched. Structural redesign routes to /qualia-polish --redesign.</span></div>
383
385
  </div>
384
386
  </div>
385
387
 
@@ -548,7 +550,7 @@
548
550
  <div class="footer">
549
551
  <strong>Welcome to the future with Qualia.</strong><br>
550
552
  Qualia Solutions &mdash; Nicosia, Cyprus
551
- <span class="footer-version">qualia-framework {{VERSION}} &middot; 33 skills</span>
553
+ <span class="footer-version">qualia-framework {{VERSION}} &middot; 35 skills</span>
552
554
  </div>
553
555
 
554
556
  </body>
package/tests/bin.test.sh CHANGED
@@ -452,9 +452,15 @@ if [ "$EXIT" -eq 0 ] \
452
452
  && [ -f "$TMP/.claude/skills/qualia/SKILL.md" ] \
453
453
  && [ -f "$TMP/.claude/hooks/session-start.js" ] \
454
454
  && [ -f "$TMP/.claude/bin/state.js" ] \
455
+ && [ -f "$TMP/.claude/bin/runtime-manifest.js" ] \
456
+ && [ -f "$TMP/.claude/bin/host-adapters.js" ] \
455
457
  && [ -f "$TMP/.claude/bin/qualia-ui.js" ] \
456
458
  && [ -f "$TMP/.claude/bin/statusline.js" ] \
459
+ && [ -f "$TMP/.claude/bin/state-ledger.js" ] \
460
+ && [ -f "$TMP/.claude/bin/contract-runner.js" ] \
461
+ && [ -f "$TMP/.claude/bin/trust-score.js" ] \
457
462
  && [ -f "$TMP/.claude/bin/project-snapshot.js" ] \
463
+ && [ -f "$TMP/.claude/bin/planning-hygiene.js" ] \
458
464
  && [ -f "$TMP/.claude/.qualia-config.json" ]; then
459
465
  pass "QS-FAWZI-01 → installs skills, hooks, bin/, config"
460
466
  else
@@ -689,6 +695,20 @@ else
689
695
  fail_case "rules copied" "count=$RULE_COUNT"
690
696
  fi
691
697
 
698
+ # 46b. Command output transparency rule installs
699
+ if [ -f "$TMP/.claude/rules/command-output.md" ] && grep -q "alwaysApply: true" "$TMP/.claude/rules/command-output.md"; then
700
+ pass "command-output rule installs"
701
+ else
702
+ fail_case "command-output rule missing or not always-on after install"
703
+ fi
704
+
705
+ # 46c. Complex graphics design substrate installs
706
+ if [ -f "$TMP/.claude/qualia-design/graphics.md" ]; then
707
+ pass "graphics design substrate installs"
708
+ else
709
+ fail_case "graphics.md missing after install"
710
+ fi
711
+
692
712
  # 47. Config version matches package.json version
693
713
  if grep -q "\"version\": \"$PKG_VERSION\"" "$TMP/.claude/.qualia-config.json"; then
694
714
  pass "config version matches package.json ($PKG_VERSION)"
@@ -1204,16 +1224,16 @@ else
1204
1224
  fi
1205
1225
 
1206
1226
  # 105. score.mjs computes pass correctly (all dims >= 3)
1207
- SCORE_OUT=$(echo '{"typography":3,"color":3,"spatial":3,"layout":3,"shadow":3,"motion":3,"microcopy":3,"container":3}' | $NODE "$FRAMEWORK_DIR/skills/qualia-polish/scripts/score.mjs" 2>&1)
1227
+ SCORE_OUT=$(echo '{"typography":3,"color":3,"spatial":3,"layout":3,"shadow":3,"motion":3,"microcopy":3,"container":3,"graphics":3}' | $NODE "$FRAMEWORK_DIR/skills/qualia-polish/scripts/score.mjs" 2>&1)
1208
1228
  EXIT=$?
1209
- if [ "$EXIT" -eq 0 ] && echo "$SCORE_OUT" | grep -q '"pass": true'; then
1229
+ if [ "$EXIT" -eq 0 ] && echo "$SCORE_OUT" | grep -q '"pass": true' && echo "$SCORE_OUT" | grep -q '"max": 45'; then
1210
1230
  pass "score.mjs pass on all-3 scores"
1211
1231
  else
1212
1232
  fail_case "score.mjs pass computation" "exit=$EXIT"
1213
1233
  fi
1214
1234
 
1215
1235
  # 106. score.mjs computes fail correctly (one dim < 3)
1216
- SCORE_OUT=$(echo '{"typography":2,"color":3,"spatial":3,"layout":3,"shadow":3,"motion":3,"microcopy":3,"container":3}' | $NODE "$FRAMEWORK_DIR/skills/qualia-polish/scripts/score.mjs" 2>&1)
1236
+ SCORE_OUT=$(echo '{"typography":2,"color":3,"spatial":3,"layout":3,"shadow":3,"motion":3,"microcopy":3,"container":3,"graphics":3}' | $NODE "$FRAMEWORK_DIR/skills/qualia-polish/scripts/score.mjs" 2>&1)
1217
1237
  EXIT=$?
1218
1238
  if [ "$EXIT" -eq 1 ] && echo "$SCORE_OUT" | grep -q '"pass": false'; then
1219
1239
  pass "score.mjs fail on dim < 3"
@@ -1305,7 +1325,7 @@ for ITER in 1 2 3; do
1305
1325
  "iteration": $ITER,
1306
1326
  "tokens_used": 100,
1307
1327
  "viewport_results": [],
1308
- "aggregate_scores": {"typography":1,"color":3,"spatial":3,"layout":3,"shadow":3,"motion":3,"microcopy":3,"container":3},
1328
+ "aggregate_scores": {"typography":1,"color":3,"spatial":3,"layout":3,"shadow":3,"motion":3,"microcopy":3,"container":3,"graphics":3},
1309
1329
  "top_issues": [{"dim":"typography","severity":"critical","description":"banned font Inter visible","likely_file":"src/styles.css","fix":"replace"}],
1310
1330
  "pass": false
1311
1331
  }
@@ -1352,14 +1372,23 @@ if [ "$EXIT" -eq 0 ] \
1352
1372
  && [ -f "$TMP/.codex/.qualia-config.json" ] \
1353
1373
  && [ -f "$TMP/.codex/config.toml" ] \
1354
1374
  && [ -f "$TMP/.codex/hooks.json" ] \
1375
+ && [ -f "$TMP/.codex/bin/runtime-manifest.js" ] \
1376
+ && [ -f "$TMP/.codex/bin/host-adapters.js" ] \
1355
1377
  && [ -f "$TMP/.codex/bin/statusline.js" ] \
1378
+ && [ -f "$TMP/.codex/bin/state-ledger.js" ] \
1379
+ && [ -f "$TMP/.codex/bin/contract-runner.js" ] \
1380
+ && [ -f "$TMP/.codex/bin/trust-score.js" ] \
1356
1381
  && [ -f "$TMP/.codex/bin/project-snapshot.js" ] \
1382
+ && [ -f "$TMP/.codex/bin/planning-hygiene.js" ] \
1357
1383
  && [ -f "$TMP/.codex/agents/planner.toml" ] \
1358
1384
  && [ -f "$TMP/.codex/skills/qualia-new/SKILL.md" ] \
1359
1385
  && [ -f "$TMP/.codex/qualia-references/questioning.md" ] \
1360
1386
  && [ ! -d "$TMP/.claude" ] \
1361
1387
  && grep -q "Role: OWNER" "$TMP/.codex/AGENTS.md" \
1362
1388
  && ! grep -q "{{ROLE}}" "$TMP/.codex/AGENTS.md" \
1389
+ && grep -q "status_line" "$TMP/.codex/config.toml" \
1390
+ && grep -q "model-with-reasoning" "$TMP/.codex/config.toml" \
1391
+ && grep -q "task-progress" "$TMP/.codex/config.toml" \
1363
1392
  && grep -q "pre-deploy-gate.js" "$TMP/.codex/hooks.json" \
1364
1393
  && grep -q "developer_instructions" "$TMP/.codex/agents/planner.toml" \
1365
1394
  && ! grep -R "\.claude/bin" "$TMP/.codex/skills" >/dev/null 2>&1; then
@@ -1371,6 +1400,7 @@ fi
1371
1400
  EXIT=0; HOME="$TMP" $NODE "$CLI_JS" doctor > "$TMP/doctor.log" 2>&1 || EXIT=$?
1372
1401
  if [ "$EXIT" -eq 0 ] \
1373
1402
  && grep -q "Codex hooks.json PreToolUse" "$TMP/doctor.log" \
1403
+ && grep -q "Codex config.toml TUI status_line" "$TMP/doctor.log" \
1374
1404
  && grep -q "All checks passed" "$TMP/doctor.log"; then
1375
1405
  pass "doctor passes for Codex-only install"
1376
1406
  else
@@ -61,8 +61,12 @@ fi
61
61
 
62
62
  tar -xzf "$TARBALL_PATH" -C "$TMP" 2>"$TMP/tar.err"
63
63
  if [ -f "$TMP/package/bin/install.js" ] \
64
+ && [ -f "$TMP/package/bin/runtime-manifest.js" ] \
65
+ && [ -f "$TMP/package/bin/host-adapters.js" ] \
64
66
  && [ -f "$TMP/package/bin/report-payload.js" ] \
65
67
  && [ -f "$TMP/package/bin/project-snapshot.js" ] \
68
+ && [ -f "$TMP/package/bin/planning-hygiene.js" ] \
69
+ && [ -f "$TMP/package/bin/state-ledger.js" ] \
66
70
  && [ -f "$TMP/package/AGENTS.md" ] \
67
71
  && [ -f "$TMP/package/CLAUDE.md" ]; then
68
72
  pass "tarball contains installer + Claude/Codex instruction roots"
@@ -89,14 +93,24 @@ fi
89
93
  if [ -f "$HOME_DIR/.codex/AGENTS.md" ] \
90
94
  && [ -f "$HOME_DIR/.codex/hooks.json" ] \
91
95
  && [ -f "$HOME_DIR/.codex/config.toml" ] \
96
+ && [ -f "$HOME_DIR/.codex/bin/runtime-manifest.js" ] \
97
+ && [ -f "$HOME_DIR/.codex/bin/host-adapters.js" ] \
92
98
  && [ -f "$HOME_DIR/.codex/bin/statusline.js" ] \
99
+ && [ -f "$HOME_DIR/.codex/bin/state-ledger.js" ] \
100
+ && [ -f "$HOME_DIR/.codex/bin/contract-runner.js" ] \
101
+ && [ -f "$HOME_DIR/.codex/bin/trust-score.js" ] \
93
102
  && [ -f "$HOME_DIR/.codex/bin/project-snapshot.js" ] \
103
+ && [ -f "$HOME_DIR/.codex/bin/planning-hygiene.js" ] \
94
104
  && [ -f "$HOME_DIR/.codex/agents/planner.toml" ] \
95
105
  && [ -f "$HOME_DIR/.codex/skills/qualia-new/SKILL.md" ] \
96
106
  && [ -f "$HOME_DIR/.codex/qualia-references/questioning.md" ] \
97
107
  && grep -q "Role: OWNER" "$HOME_DIR/.codex/AGENTS.md" \
98
108
  && ! grep -q "{{ROLE}}" "$HOME_DIR/.codex/AGENTS.md" \
109
+ && grep -q "status_line" "$HOME_DIR/.codex/config.toml" \
110
+ && grep -q "model-with-reasoning" "$HOME_DIR/.codex/config.toml" \
111
+ && grep -q "task-progress" "$HOME_DIR/.codex/config.toml" \
99
112
  && grep -q "pre-deploy-gate.js" "$HOME_DIR/.codex/hooks.json" \
113
+ && ! grep -R "\${QUALIA_BIN}" "$HOME_DIR/.codex/skills" >/dev/null 2>&1 \
100
114
  && ! grep -R "\.claude/bin" "$HOME_DIR/.codex/skills" >/dev/null 2>&1; then
101
115
  pass "Codex runtime installed with OWNER role"
102
116
  else
@@ -113,10 +127,16 @@ fi
113
127
 
114
128
  if [ -f "$HOME_DIR/.claude/bin/report-payload.js" ] \
115
129
  && [ -f "$HOME_DIR/.claude/bin/project-snapshot.js" ] \
130
+ && [ -f "$HOME_DIR/.claude/bin/runtime-manifest.js" ] \
131
+ && [ -f "$HOME_DIR/.claude/bin/host-adapters.js" ] \
132
+ && [ -f "$HOME_DIR/.claude/bin/state-ledger.js" ] \
133
+ && [ -f "$HOME_DIR/.claude/bin/contract-runner.js" ] \
134
+ && [ -f "$HOME_DIR/.claude/bin/trust-score.js" ] \
135
+ && [ -f "$HOME_DIR/.claude/bin/planning-hygiene.js" ] \
116
136
  && grep -q "report-payload.js" "$HOME_DIR/.claude/skills/qualia-report/SKILL.md"; then
117
- pass "packaged install includes ERP report/snapshot helpers"
137
+ pass "packaged install includes ERP report/snapshot + contract helpers"
118
138
  else
119
- fail_case "packaged install missing ERP report/snapshot helpers"
139
+ fail_case "packaged install missing ERP report/snapshot/contract helpers"
120
140
  fi
121
141
 
122
142
  PKG_VERSION=$("$NODE" -e "console.log(require(process.argv[1]).version)" "$TMP/package/package.json")