qualia-framework 6.2.10 → 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 (58) hide show
  1. package/AGENTS.md +1 -0
  2. package/CLAUDE.md +1 -0
  3. package/README.md +16 -23
  4. package/bin/cli.js +49 -2
  5. package/bin/command-surface.js +71 -0
  6. package/bin/harness-eval.js +296 -0
  7. package/bin/install.js +17 -20
  8. package/bin/knowledge-flush.js +21 -10
  9. package/bin/knowledge.js +1 -1
  10. package/bin/project-snapshot.js +20 -0
  11. package/bin/report-payload.js +18 -0
  12. package/bin/runtime-manifest.js +3 -0
  13. package/bin/state.js +31 -0
  14. package/bin/trust-score.js +3 -11
  15. package/bin/work-packet.js +228 -0
  16. package/docs/erp-contract.md +81 -1
  17. package/docs/onboarding.html +0 -11
  18. package/guide.md +14 -15
  19. package/hooks/fawzi-approval-guard.js +143 -0
  20. package/hooks/pre-deploy-gate.js +74 -1
  21. package/hooks/session-start.js +29 -1
  22. package/package.json +1 -1
  23. package/qualia-design/frontend.md +2 -2
  24. package/rules/codex-goal.md +1 -1
  25. package/rules/one-opinion.md +2 -2
  26. package/rules/speed.md +0 -1
  27. package/skills/qualia/SKILL.md +4 -4
  28. package/skills/qualia-feature/SKILL.md +1 -1
  29. package/skills/qualia-fix/SKILL.md +4 -4
  30. package/skills/qualia-learn/SKILL.md +1 -1
  31. package/skills/qualia-polish/REFERENCE.md +1 -1
  32. package/skills/qualia-polish/SKILL.md +19 -4
  33. package/skills/{qualia-vibe/scripts/extract.mjs → qualia-polish/scripts/vibe-extract.mjs} +4 -4
  34. package/skills/{qualia-vibe/scripts/tokens.mjs → qualia-polish/scripts/vibe-tokens.mjs} +6 -6
  35. package/skills/qualia-road/SKILL.md +15 -20
  36. package/skills/qualia-ship/SKILL.md +12 -5
  37. package/skills/qualia-verify/SKILL.md +9 -1
  38. package/templates/help.html +1 -12
  39. package/tests/bin.test.sh +144 -72
  40. package/tests/hooks.test.sh +81 -1
  41. package/tests/install-smoke.test.sh +13 -3
  42. package/tests/lib.test.sh +145 -3
  43. package/tests/published-install-smoke.test.sh +4 -3
  44. package/tests/refs.test.sh +9 -4
  45. package/tests/runner.js +29 -28
  46. package/tests/state.test.sh +68 -0
  47. package/skills/qualia-debug/SKILL.md +0 -193
  48. package/skills/qualia-flush/SKILL.md +0 -198
  49. package/skills/qualia-help/SKILL.md +0 -74
  50. package/skills/qualia-hook-gen/SKILL.md +0 -206
  51. package/skills/qualia-idk/SKILL.md +0 -166
  52. package/skills/qualia-issues/SKILL.md +0 -151
  53. package/skills/qualia-pause/SKILL.md +0 -68
  54. package/skills/qualia-resume/SKILL.md +0 -52
  55. package/skills/qualia-skill-new/SKILL.md +0 -173
  56. package/skills/qualia-triage/SKILL.md +0 -152
  57. package/skills/qualia-vibe/SKILL.md +0 -229
  58. package/skills/qualia-zoom/SKILL.md +0 -51
@@ -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
@@ -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; `/qualia-fix` if expected behavior is known, `/qualia-debug` if not |
54
- | `bug-loop` | Same files edited 3+ times, user frustrated | → Different approach, `/qualia-fix` if actionable, `/qualia-debug` if evidence is missing |
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?"
@@ -35,7 +35,7 @@ One command for adding a small new capability outside the planned Road. Auto-det
35
35
  - 5+ files or multiple subsystems touched → `/qualia-plan`
36
36
  - Part of a planned phase → `/qualia-build`
37
37
  - Broken existing behavior, regression, failing test, or hotfix → `/qualia-fix`
38
- - Investigating a symptom you can't name yet → `/qualia-debug`
38
+ - Investigating a symptom you can't name yet → `/qualia-review`
39
39
  - Optimization or polish pass → `/qualia-optimize` or `/qualia-polish`
40
40
 
41
41
  ## Process
@@ -1,6 +1,6 @@
1
1
  ---
2
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'."
3
+ description: "Practical repair lane for broken existing behavior. Combines root-cause investigation with /qualia-feature execution discipline. 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
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -14,7 +14,7 @@ argument-hint: "[--quick|--frontend|--perf|--test|--no-commit] <symptom>"
14
14
 
15
15
  # /qualia-fix - Repair Broken Existing Behavior
16
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`.
17
+ Fix is the practical lane for "this used to work, or should work, and now it does not." It combines root-cause evidence gathering with the small-work execution path of `/qualia-feature`.
18
18
 
19
19
  ## Usage
20
20
 
@@ -38,9 +38,9 @@ Fix is the practical lane for "this used to work, or should work, and now it doe
38
38
  - Net-new capability -> `/qualia-feature`
39
39
  - Phase-sized work or 5+ likely files -> `/qualia-plan`
40
40
  - Read-only audit -> `/qualia-review`
41
- - No concrete symptom and no failing command -> `/qualia-debug`
41
+ - No concrete symptom and no failing command -> `/qualia-review`
42
42
  - Visual craft/design quality with no functional bug -> `/qualia-polish`
43
- - Whole-site aesthetic pivot -> `/qualia-vibe`
43
+ - Whole-site aesthetic pivot -> `/qualia-polish --vibe`
44
44
 
45
45
  ## Process
46
46
 
@@ -122,7 +122,7 @@ node ${QUALIA_BIN}/knowledge.js list
122
122
  node ${QUALIA_BIN}/knowledge.js search "RLS"
123
123
  ```
124
124
 
125
- The `/qualia-debug` skill should check `common-fixes.md` (`load fixes`) before
125
+ The `/qualia-fix` skill should check `common-fixes.md` (`load fixes`) before
126
126
  investigating. The `/qualia-new` skill should check `client-prefs.md`
127
127
  (`load client`) when setting up client projects. The `/qualia-plan` skill
128
128
  should check `learned-patterns.md` (`load patterns`) when planning phases.
@@ -262,6 +262,6 @@ This is intentional. Most visual regressions Fawzi has documented in `/insights`
262
262
  - Accessibility audits beyond what the rubric scores — use `/qualia-polish` Stage 3 (Lighthouse + axe) for that.
263
263
  - Performance regressions — use `/qualia-polish --loop` only after Lighthouse score passes.
264
264
  - Reference-image-only mode (compare to a target screenshot without a brief) — the brief is required; reference is supplemental.
265
- - Aesthetic pivots — if the issue is "the whole vibe is wrong", `/qualia-vibe` swaps the aesthetic in minutes instead of grinding the loop against a vibe that doesn't fit.
265
+ - Aesthetic pivots — if the issue is "the whole vibe is wrong", `/qualia-polish --vibe` swaps the aesthetic in minutes instead of grinding the loop against a vibe that doesn't fit.
266
266
 
267
267
  Implemented as of v5.2: `--routes a,b,c` for multi-route sweeps, `--reduced-motion` for `prefers-reduced-motion: reduce` capture.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-polish
3
- description: "Scope-adaptive visual quality pass. Works on a single component, a route, the whole app, a ground-up redesign, or an autonomous visual loop, but does not repair business logic or broken data flow. Trigger on 'polish', 'design pass', 'fix the design', 'redesign', 'critique', 'audit design', 'looks ugly', 'make it look better', 'polish loop', 'visual loop', 'fix what I see', 'iterate on the design until it's correct'. Route functional bugs to /qualia-fix and aesthetic token pivots to /qualia-vibe."
3
+ description: "Scope-adaptive visual quality pass. Works on a single component, a route, the whole app, a ground-up redesign, an aesthetic token pivot, or an autonomous visual loop, but does not repair business logic or broken data flow. Trigger on 'polish', 'design pass', 'fix the design', 'redesign', 'critique', 'audit design', 'looks ugly', 'make it look better', 'different vibe', 'polish loop', 'visual loop', 'fix what I see', 'iterate on the design until it's correct'. Route functional bugs to /qualia-fix."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -18,7 +18,7 @@ argument-hint: "[file|route|--redesign|--critique|--quick|--loop] [--register=br
18
18
 
19
19
  One command. Seven scopes. Use it whenever you need design work, from a 30-second component touch-up to a ground-up redesign with current design research, complex visuals, and a fully transparent see-fix-verify loop.
20
20
 
21
- Polish fixes visual quality only. Broken behavior, failing tests, API bugs, state bugs, and config errors go to `/qualia-fix`. Whole-site aesthetic token pivots go to `/qualia-vibe`.
21
+ Polish fixes visual quality only. Broken behavior, failing tests, API bugs, state bugs, and config errors go to `/qualia-fix`. Whole-site aesthetic token pivots stay inside `/qualia-polish --vibe` so the design surface is one command.
22
22
 
23
23
  ## Scopes
24
24
 
@@ -32,9 +32,10 @@ The first argument selects the scope. Stage selection follows from scope.
32
32
  | `/qualia-polish --redesign` | **Redesign** | ~30m | all + Stage 1 mandatory + 2 vision iterations |
33
33
  | `/qualia-polish --critique` | **Critique** | read-only | 0, 4, 5 (no edits) |
34
34
  | `/qualia-polish --quick` | **Quick** | ~1m | 0, 2, 7 (gates only, no vision loop) |
35
+ | `/qualia-polish --vibe` | **Aesthetic pivot** | ~3m | token-only direction swap |
35
36
  | `/qualia-polish --loop {url}` | **Loop** | ~5-15m | autonomous see/fix/verify, max 8 iterations |
36
37
 
37
- Other flags: `--register=brand|product` overrides register inference. Loop-specific flags: `--brief PATH`, `--max N`, `--viewports 375,768,1440`, `--ref PATH`, `--budget 100000`.
38
+ Other flags: `--register=brand|product` overrides register inference. Vibe-specific flags: `--variants N`, `--extract URL|image`, `--sync`, `--write`. Loop-specific flags: `--brief PATH`, `--max N`, `--viewports 375,768,1440`, `--ref PATH`, `--budget 100000`.
38
39
 
39
40
  ## Transparent Command Output
40
41
 
@@ -58,6 +59,20 @@ Scripts ship at `skills/qualia-polish/scripts/{loop,playwright-capture,score}.mj
58
59
 
59
60
  When `--loop` is detected on entry, route to the loop process documented in `REFERENCE.md` and stop executing the standard stages below. The two paths share Stage 0 substrate gates and the rubric, but diverge from Stage 1 onward.
60
61
 
62
+ ## --vibe mode (aesthetic token pivot)
63
+
64
+ When `--vibe` is detected, do not restructure JSX, routes, data flow, navigation, or layout grids. Change only aesthetic tokens and matching DESIGN.md sections: color, typography, depth, motion, brand accents, and short visual-direction copy.
65
+
66
+ Supporting scripts ship inside this skill:
67
+
68
+ ```bash
69
+ node ${QUALIA_SKILLS}/qualia-polish/scripts/vibe-tokens.mjs sync --design .planning/DESIGN.md
70
+ node ${QUALIA_SKILLS}/qualia-polish/scripts/vibe-tokens.mjs propose-variants --product .planning/PRODUCT.md --design .planning/DESIGN.md --count 3
71
+ node ${QUALIA_SKILLS}/qualia-polish/scripts/vibe-extract.mjs --source https://example.com
72
+ ```
73
+
74
+ Default flow proposes one opinionated direction per `rules/one-opinion.md`. `--variants` is opt-in only. `--extract` stages a reference screenshot for the visual evaluator to reverse-engineer into DESIGN.md tokens; the user must review low-confidence extracted values before application. `--sync --write` patches DESIGN.md to reflect tokens already present in code.
75
+
61
76
  ## Setup gates (non-optional, every scope)
62
77
 
63
78
  Before any work — design or otherwise — pass these gates. Skipping them produces generic output that ignores the project.
@@ -109,7 +124,7 @@ For Redesign scope, run a short online best-practices check before the brief unl
109
124
 
110
125
  Use the sources as constraints, not as a style to copy. Cite links in the report/summary when they shaped the redesign.
111
126
 
112
- If the user pushes back on the proposed direction, that is a `/qualia-vibe` triggerswitch surfaces, do not start enumerating alternatives in the brief.
127
+ If the user pushes back on the proposed direction, switch to `/qualia-polish --vibe` mode — do not start enumerating alternatives in the brief.
113
128
 
114
129
  For Component / Section / Quick scope, the brief is implicit (loaded from DESIGN.md). Skip the ultrathink step but cite the relevant DESIGN.md tokens you'll touch.
115
130
 
@@ -6,11 +6,11 @@
6
6
  * 1. If source is a URL → capture screenshot at 1440 via playwright-capture.mjs.
7
7
  * If source is a local image path → use it directly.
8
8
  * 2. Emit a JSON scaffold the LLM uses to generate the extracted token bundle.
9
- * 3. The skill (qualia-vibe) reads the scaffold, runs the vision evaluator in
9
+ * 3. The skill (qualia-polish --vibe) reads the scaffold, runs the vision evaluator in
10
10
  * extract mode, gets the bundle back, renders it as a DESIGN.md draft.
11
11
  *
12
12
  * This script does NOT call any LLM directly — it stages the inputs and emits
13
- * a deterministic JSON contract. The /qualia-vibe skill orchestrates the LLM
13
+ * a deterministic JSON contract. The /qualia-polish --vibe skill orchestrates the LLM
14
14
  * call.
15
15
  *
16
16
  * Usage:
@@ -49,7 +49,7 @@ let screenshotPath;
49
49
  const isUrl = /^https?:\/\//i.test(source);
50
50
  if (isUrl) {
51
51
  const stamp = Date.now().toString(36);
52
- const outDir = join(tmpdir(), `qualia-vibe-extract-${stamp}`);
52
+ const outDir = join(tmpdir(), `qualia-polish-vibe-extract-${stamp}`);
53
53
  mkdirSync(outDir, { recursive: true });
54
54
  screenshotPath = join(outDir, "ref-1440.png");
55
55
 
@@ -132,7 +132,7 @@ const scaffold = {
132
132
  rules: [
133
133
  "Banned fonts: Inter, Roboto, Arial, Helvetica, system-ui, Space Grotesk, Montserrat, Poppins, Lato, Open Sans. If you see one of these, name it AND flag it so the user can decide whether to ban or accept.",
134
134
  "Banned patterns: purple-blue gradient, gradient text, bounce/elastic easing. Flag the same way.",
135
- "Confidence < high → user must review before /qualia-vibe applies.",
135
+ "Confidence < high → user must review before /qualia-polish --vibe applies.",
136
136
  ],
137
137
  next_step: `After producing the bundle, write a DESIGN.md draft to ${outDraft} using the bundle to populate sections 1 (Direction), 2 (Color), 3 (Typography), 4 (Spacing), 6 (Depth), 7 (Motion). Leave sections that depend on PRODUCT.md or anti-references empty — the user will fill them.`,
138
138
  };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * tokens.mjs — read/write design tokens for /qualia-vibe.
3
+ * tokens.mjs — read/write design tokens for /qualia-polish --vibe.
4
4
  *
5
5
  * Commands:
6
6
  * tokens.mjs sync --design .planning/DESIGN.md [--write]
@@ -36,13 +36,13 @@ function hasFlag(name) {
36
36
  const CMD = argv[2];
37
37
 
38
38
  if (!CMD || CMD === "--help" || CMD === "-h") {
39
- console.log(`tokens.mjs — design-token utility for /qualia-vibe
39
+ console.log(`tokens.mjs — design-token utility for /qualia-polish --vibe
40
40
 
41
41
  Usage:
42
42
  tokens.mjs sync --design <path> [--write]
43
43
  tokens.mjs propose-variants --product <path> --design <path> --count <N>
44
44
 
45
- See skills/qualia-vibe/SKILL.md.
45
+ See skills/qualia-polish/SKILL.md.
46
46
  `);
47
47
  exit(0);
48
48
  }
@@ -268,7 +268,7 @@ function cmdSync() {
268
268
  ``,
269
269
  `## §sync — auto-synced from code (${stamp})`,
270
270
  ``,
271
- `<!-- Generated by /qualia-vibe --sync --write. Reflects values actually present in code at sync time. -->`,
271
+ `<!-- Generated by /qualia-polish --vibe --sync --write. Reflects values actually present in code at sync time. -->`,
272
272
  ``,
273
273
  "```css",
274
274
  `:root {`,
@@ -307,7 +307,7 @@ function cmdProposeVariants() {
307
307
 
308
308
  // Emit a structured scaffold the LLM uses to generate variants.
309
309
  const scaffold = {
310
- instruction: `Generate exactly ${count} aesthetic-direction variants for /qualia-vibe --variants. Each variant must be opinionated and concrete — no "modern minimal" hedging. Variants must be meaningfully different from each other AND from the current direction.`,
310
+ instruction: `Generate exactly ${count} aesthetic-direction variants for /qualia-polish --vibe --variants. Each variant must be opinionated and concrete — no "modern minimal" hedging. Variants must be meaningfully different from each other AND from the current direction.`,
311
311
  context: {
312
312
  product_md: product.slice(0, 4000),
313
313
  current_direction_lines: design
@@ -323,7 +323,7 @@ function cmdProposeVariants() {
323
323
  "No purple-blue gradients.",
324
324
  "No bounce/elastic easing.",
325
325
  `Respect anti-references from PRODUCT.md if present.`,
326
- "Each variant should be commit-able as-is — concrete enough that /qualia-vibe can apply it without further questions.",
326
+ "Each variant should be commit-able as-is — concrete enough that /qualia-polish --vibe can apply it without further questions.",
327
327
  ],
328
328
  };
329
329
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-road
3
- description: "TERMINAL workflow map — Project → Journey → Milestones → Phases → Tasks. Use this in headless/SSH/no-browser sessions or when the user asks for the road in chat. For the HTML reference (default when a browser is available), use /qualia-help. Triggers: 'how does Qualia work', 'what's the workflow', 'show me the road', 'what command does X', 'how do projects flow', 'in terminal please', SSH context."
3
+ description: "TERMINAL workflow map — Project → Journey → Milestones → Phases → Tasks. Use this in headless/SSH/no-browser sessions or when the user asks for the road in chat. Triggers: 'how does Qualia work', 'what's the workflow', 'show me the road', 'what command does X', 'how do projects flow', 'in terminal please', SSH context."
4
4
  disable-model-invocation: true
5
5
  allowed-tools:
6
6
  - Read
@@ -45,17 +45,17 @@ Every road agent loads `PRODUCT.md + DESIGN.md + design-laws.md` substrate. Buil
45
45
  /qualia-polish --quick ~1m gates only
46
46
  ```
47
47
 
48
- ## Design pivots — /qualia-vibe (v6.1+)
48
+ ## Design pivots — /qualia-polish --vibe
49
49
  ```
50
- /qualia-vibe fast aesthetic pivot: ONE proposed direction, swap tokens, keep layout (~3 min)
51
- /qualia-vibe brutalist explicit pivot to named direction
52
- /qualia-vibe --variants 3 opt-in menu (uses AskUserQuestion; default flow is one-opinion)
53
- /qualia-vibe --extract https://stripe.com reverse-engineer DESIGN.md from a reference URL
54
- /qualia-vibe --extract ./inspo.png same, from a local screenshot
55
- /qualia-vibe --sync show drift between code (CSS vars, Tailwind config) and DESIGN.md
56
- /qualia-vibe --sync --write patch DESIGN.md to match code, commit
50
+ /qualia-polish --vibe fast aesthetic pivot: ONE proposed direction, swap tokens, keep layout (~3 min)
51
+ /qualia-polish --vibe brutalist explicit pivot to named direction
52
+ /qualia-polish --vibe --variants 3 opt-in menu (rare; default flow is one-opinion)
53
+ /qualia-polish --vibe --extract https://stripe.com reverse-engineer DESIGN.md from a reference URL
54
+ /qualia-polish --vibe --extract ./inspo.png same, from a local screenshot
55
+ /qualia-polish --vibe --sync show drift between code (CSS vars, Tailwind config) and DESIGN.md
56
+ /qualia-polish --vibe --sync --write patch DESIGN.md to match code, commit
57
57
  ```
58
- `/qualia-vibe` is for the WHOLE-SITE aesthetic. For surgical component-level fixes use `/qualia-polish` (component or section scope). For ground-up structural redesign use `/qualia-polish --redesign`.
58
+ `/qualia-polish --vibe` is for the WHOLE-SITE aesthetic. For surgical component-level fixes use `/qualia-polish` (component or section scope). For ground-up structural redesign use `/qualia-polish --redesign`.
59
59
 
60
60
  ## /qualia-polish --loop — autonomous visual QA
61
61
  ```
@@ -69,21 +69,17 @@ Screenshots at 3 viewports (375/768/1440), scores 9 design dimensions using visi
69
69
 
70
70
  ## Deterministic-enforcement skills
71
71
  ```
72
- /qualia-hook-gen convert a CLAUDE.md/rules instruction into a deterministic pre-tool-use hook
73
72
  /qualia-optimize --deepen spawns 3 parallel interface-design variants per candidate (Step 5b)
74
73
  ```
75
- `/qualia-hook-gen` reduces lifetime token cost (each migrated rule frees ~50-200 tokens per request). `/qualia-optimize --deepen` produces dramatically better refactor RFCs because 3 radically-different interfaces are surfaced and the human picks/hybridizes.
74
+ `/qualia-optimize --deepen` produces dramatically better refactor RFCs because 3 radically-different interfaces are surfaced and the human picks/hybridizes.
76
75
 
77
76
  ## Alignment substrate
78
77
  Before high-stakes phases, run alignment skills against `.planning/CONTEXT.md` (domain glossary) and `.planning/decisions/` (ADRs):
79
78
 
80
79
  ```
81
80
  /qualia-discuss → relentless one-question interview, updates CONTEXT.md inline
82
- /qualia-zoom → map an unfamiliar code area using glossary terms
83
81
  /qualia-optimize --deepen → find shallow modules, propose Ousterhout-style refactors
84
82
  /qualia-test --tdd → vertical-slice red→green→refactor for one feature
85
- /qualia-issues → break a phase plan into independent GH issues
86
- /qualia-triage → label + route open issues (ready-for-agent vs human)
87
83
  /qualia-map → adapt Qualia to an existing brownfield repo's conventions (5th onboarding agent)
88
84
  ```
89
85
 
@@ -91,23 +87,22 @@ Before high-stakes phases, run alignment skills against `.planning/CONTEXT.md` (
91
87
  ```
92
88
  Lost? → /qualia (state router — tells you the next command)
93
89
  Health? → /qualia-doctor (install, state, contracts, memory, ERP queue)
94
- Stuck/weird? → /qualia-idk (diagnostic — spawns plan-view + code-view agents in parallel)
90
+ Stuck/weird? → /qualia (diagnostic branch scans planning + code when state alone is insufficient)
95
91
  Broken thing? → /qualia-fix (root cause, minimal patch, verify, report)
96
92
  Single feature? → /qualia-feature (new capability: inline for trivia, fresh spawn for 1-5 files)
97
- Paused? → /qualia-resume (restore from .continue-here.md or STATE.md)
93
+ Paused? → /qualia (restore from .continue-here.md or STATE.md)
98
94
  End of day? → /qualia-report (mandatory before clock-out; writes ERP payload)
99
- Debug why? → /qualia-debug (feedback-loop-first investigation when evidence is unclear)
100
95
  Unsure plan? → /qualia-discuss (capture decisions before planning)
101
96
  ```
102
97
 
103
98
  ## Outside-road command boundaries
104
99
  ```
105
100
  Need a repair? → /qualia-fix (mutates code, proves fix)
106
- Need an investigation? → /qualia-debug (evidence first, no guessing)
101
+ Need an investigation? → /qualia-review (read-only audit) or /qualia-fix (known broken behavior)
107
102
  Need an audit? → /qualia-review (detect-only, scored findings)
108
103
  Need improvement map? → /qualia-optimize (report/RFC, broad opportunities)
109
104
  Need visual quality? → /qualia-polish (style/layout/accessibility)
110
- Need new aesthetic? → /qualia-vibe (tokens only, layout preserved)
105
+ Need new aesthetic? → /qualia-polish --vibe (tokens only, layout preserved)
111
106
  Need new capability? → /qualia-feature (small net-new work)
112
107
  ```
113
108
 
@@ -32,6 +32,14 @@ fi
32
32
 
33
33
  STATUS=$(echo "$STATE" | node -e "try{const d=JSON.parse(require('fs').readFileSync(0,'utf8'));process.stdout.write(d.status||'')}catch{}")
34
34
  VERIFICATION=$(echo "$STATE" | node -e "try{const d=JSON.parse(require('fs').readFileSync(0,'utf8'));process.stdout.write(d.verification||'')}catch{}")
35
+ NEXT_COMMAND=$(echo "$STATE" | node -e "try{const d=JSON.parse(require('fs').readFileSync(0,'utf8'));process.stdout.write(d.next_command||'/qualia')}catch{process.stdout.write('/qualia')}")
36
+ ROLE=$(node -e "try{const fs=require('fs'),path=require('path'),os=require('os');const h=process.env.QUALIA_HOME||path.dirname(process.env.QUALIA_BIN||path.join(os.homedir(),'.claude','bin'));const c=JSON.parse(fs.readFileSync(path.join(h,'.qualia-config.json'),'utf8'));process.stdout.write((c.role||'').toUpperCase())}catch{}")
37
+
38
+ if [ "${QUALIA_SHIP_FORCE:-0}" = "1" ] && [ "$ROLE" != "OWNER" ]; then
39
+ node ${QUALIA_BIN}/qualia-ui.js fail "Owner override is OWNER-only."
40
+ node ${QUALIA_BIN}/qualia-ui.js info "Run $NEXT_COMMAND."
41
+ exit 1
42
+ fi
35
43
 
36
44
  # Valid ship-from states:
37
45
  # polished — /qualia-polish ran cleanly; ready for deploy
@@ -41,10 +49,9 @@ if [ "$STATUS" != "polished" ] && ! { [ "$STATUS" = "verified" ] && [ "$VERIFICA
41
49
  if [ "${QUALIA_SHIP_FORCE:-0}" = "1" ]; then
42
50
  node ${QUALIA_BIN}/qualia-ui.js warn "Forced ship from state '$STATUS' (verification: ${VERIFICATION:-none}). Record the reason in the final report."
43
51
  else
44
- node ${QUALIA_BIN}/qualia-ui.js fail "Cannot ship from state '$STATUS' (verification: ${VERIFICATION:-none})."
45
- node ${QUALIA_BIN}/qualia-ui.js info "Run /qualia-polish first, or /qualia-verify {phase} if verification is still pending."
46
- node ${QUALIA_BIN}/qualia-ui.js info "Hotfix override: set QUALIA_SHIP_FORCE=1 only when the user explicitly approved it."
47
- exit 1
52
+ node ${QUALIA_BIN}/qualia-ui.js fail "Ship refused from state '$STATUS' (verification: ${VERIFICATION:-none})."
53
+ node ${QUALIA_BIN}/qualia-ui.js info "Run $NEXT_COMMAND."
54
+ exit 1
48
55
  fi
49
56
  fi
50
57
  ```
@@ -64,7 +71,7 @@ On failure:
64
71
  1. Summarize what failed in plain language
65
72
  2. Auto-fix
66
73
  3. Re-run the gate
67
- 4. If still failing after 2 attempts: tell the employee, suggest `/qualia-debug`
74
+ 4. If still failing after 2 attempts: tell the employee, suggest `/qualia-fix`
68
75
 
69
76
  ### 2. Security Check — full depth
70
77
 
@@ -169,8 +169,16 @@ node ${QUALIA_BIN}/qualia-ui.js end "PHASE {N} GAPS FOUND" "/qualia-plan {N} --g
169
169
 
170
170
  ### 4. Update State
171
171
 
172
+ Write the deterministic eval artifact before changing state:
173
+
174
+ ```bash
175
+ node ${QUALIA_BIN}/harness-eval.js --phase {N} --run --write
176
+ ```
177
+
178
+ If the eval status is `FAIL`, do not mark the phase PASS. The state machine also refuses PASS when a contract exists but `.planning/evidence/phase-{N}-contract-run.json` is missing/failing, or when the verification report contains `INSUFFICIENT EVIDENCE`.
179
+
172
180
  ```bash
173
- node ${QUALIA_BIN}/state.js transition --to verified --phase {N} --verification {pass|fail}
181
+ node ${QUALIA_BIN}/state.js transition --to verified --phase {N} --verification {pass|fail} --evidence .planning/evals/harness-eval-*.json
174
182
  ```
175
183
  PASS + more phases → state.js auto-advances.
176
184
  FAIL + gap_cycles >= limit → GAP_CYCLE_LIMIT, escalate.
@@ -364,13 +364,9 @@
364
364
  <div class="commands">
365
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
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
367
  <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
368
  <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>
370
369
  <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>
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>
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>
373
- <div class="cmd"><span class="cmd-name">/qualia-triage</span><span class="cmd-desc">State machine over open GH issues — labels each as needs-triage, needs-info, ready-for-agent, ready-for-human, or wontfix. Pairs with /qualia-issues for the autonomous queue.</span></div>
374
370
  </div>
375
371
  </div>
376
372
 
@@ -381,7 +377,7 @@
381
377
  <div class="commands">
382
378
  <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
379
  <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>
380
+ <div class="cmd"><span class="cmd-name">/qualia-polish --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>
385
381
  </div>
386
382
  </div>
387
383
 
@@ -391,7 +387,6 @@
391
387
  <p class="cmd-group-note">Persist learnings and log work.</p>
392
388
  <div class="commands">
393
389
  <div class="cmd"><span class="cmd-name">/qualia-learn</span><span class="cmd-desc">Save a learning, pattern, fix, or client preference to the knowledge base. Persists across projects and sessions.</span></div>
394
- <div class="cmd"><span class="cmd-name">/qualia-flush</span><span class="cmd-desc">Promote raw daily logs into curated knowledge concepts. Use weekly or when session logs contain durable lessons.</span></div>
395
390
  <div class="cmd"><span class="cmd-name">/qualia-report</span><span class="cmd-desc">Generate session report and commit to repo. Mandatory before clock-out.</span></div>
396
391
  </div>
397
392
  </div>
@@ -401,8 +396,6 @@
401
396
  <h3>Session</h3>
402
397
  <p class="cmd-group-note">Hand off and resume context cleanly.</p>
403
398
  <div class="commands">
404
- <div class="cmd"><span class="cmd-name">/qualia-pause</span><span class="cmd-desc">Save session context for seamless handoff. Creates .continue-here.md so the next session picks up exactly where you left off.</span></div>
405
- <div class="cmd"><span class="cmd-name">/qualia-resume</span><span class="cmd-desc">Restore context from a previous session. Reads .continue-here.md or STATE.md, summarizes where you left off, routes to next action.</span></div>
406
399
  </div>
407
400
  </div>
408
401
 
@@ -412,8 +405,6 @@
412
405
  <p class="cmd-group-note">When you don't know what to do next.</p>
413
406
  <div class="commands">
414
407
  <div class="cmd"><span class="cmd-name">/qualia</span><span class="cmd-desc">Smart router &mdash; reads project state, classifies your situation, tells you the exact next command. Use whenever you're unsure about your next step.</span></div>
415
- <div class="cmd"><span class="cmd-name">/qualia-idk</span><span class="cmd-desc">Diagnostic intelligence &mdash; spawns two isolated scans (planning + codebase) in parallel, cross-references against your confusion, explains the situation in plain language with a concrete next step. Use when something feels off or you need to understand what's going on.</span></div>
416
- <div class="cmd"><span class="cmd-name">/qualia-help</span><span class="cmd-desc">Open the Qualia Framework reference guide in the browser. A beautiful themed HTML page with all commands, rules, services, and the road.</span></div>
417
408
  <div class="cmd"><span class="cmd-name">/qualia-road</span><span class="cmd-desc">Terminal workflow map — Project → Journey → Milestones → Phases → Tasks. Use in headless/SSH sessions or when you want the road in chat instead of the browser.</span></div>
418
409
  </div>
419
410
  </div>
@@ -423,9 +414,7 @@
423
414
  <h3>Meta</h3>
424
415
  <p class="cmd-group-note">Extend the framework itself.</p>
425
416
  <div class="commands">
426
- <div class="cmd"><span class="cmd-name">/qualia-skill-new</span><span class="cmd-desc">Author a new Qualia skill or agent. Generates the SKILL.md, registers it in the right location, and optionally ships to the framework repo.</span></div>
427
417
  <div class="cmd"><span class="cmd-name">/qualia-postmortem</span><span class="cmd-desc">Analyze a verification failure and turn the lesson into a framework improvement.</span></div>
428
- <div class="cmd"><span class="cmd-name">/qualia-hook-gen</span><span class="cmd-desc">Convert a CLAUDE.md or rules instruction into a deterministic Claude Code pre-tool-use hook. Lets you shrink your instruction budget instead of just hearing the advice.</span></div>
429
418
  <div class="cmd"><span class="cmd-name">/zoho-workflow</span><span class="cmd-desc">Internal Qualia Solutions ops — Zoho Invoice and Mail integration via ERP-first routing.</span></div>
430
419
  </div>
431
420
  </div>