qualia-framework 5.3.0 → 5.4.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 (47) hide show
  1. package/README.md +50 -26
  2. package/agents/builder.md +8 -0
  3. package/agents/plan-checker.md +10 -1
  4. package/agents/planner.md +1 -1
  5. package/agents/qa-browser.md +10 -0
  6. package/agents/research-synthesizer.md +10 -0
  7. package/agents/researcher.md +38 -2
  8. package/agents/roadmapper.md +10 -0
  9. package/agents/verifier.md +15 -3
  10. package/agents/visual-evaluator.md +1 -1
  11. package/bin/install.js +42 -0
  12. package/bin/state.js +155 -133
  13. package/docs/archive/session-report-2026-04-18.md +199 -0
  14. package/docs/archive/v4.0.0-review.md +288 -0
  15. package/docs/instruction-budget-audit.md +113 -0
  16. package/guide.md +11 -4
  17. package/hooks/session-start.js +1 -1
  18. package/package.json +5 -2
  19. package/rules/architecture.md +125 -0
  20. package/rules/infrastructure.md +1 -2
  21. package/rules/speed.md +55 -0
  22. package/skills/qualia-help/SKILL.md +1 -1
  23. package/skills/qualia-map/SKILL.md +1 -1
  24. package/skills/qualia-milestone/SKILL.md +1 -1
  25. package/skills/qualia-new/SKILL.md +2 -2
  26. package/skills/qualia-optimize/REFERENCE.md +2 -2
  27. package/skills/qualia-optimize/SKILL.md +1 -1
  28. package/skills/qualia-polish/SKILL.md +3 -3
  29. package/skills/qualia-polish-loop/REFERENCE.md +1 -1
  30. package/skills/qualia-polish-loop/SKILL.md +3 -3
  31. package/skills/qualia-polish-loop/fixtures/broken.html +2 -2
  32. package/skills/qualia-polish-loop/scripts/score.mjs +1 -1
  33. package/skills/qualia-postmortem/SKILL.md +1 -1
  34. package/skills/qualia-quick/SKILL.md +1 -1
  35. package/skills/qualia-research/SKILL.md +5 -3
  36. package/skills/qualia-road/SKILL.md +15 -5
  37. package/skills/qualia-task/SKILL.md +1 -1
  38. package/templates/PRODUCT.md +1 -1
  39. package/tests/bin.test.sh +3 -3
  40. package/tests/skills.test.sh +143 -0
  41. package/tests/slop-detect.test.sh +160 -0
  42. /package/{rules → qualia-design}/design-brand.md +0 -0
  43. /package/{rules → qualia-design}/design-laws.md +0 -0
  44. /package/{rules → qualia-design}/design-product.md +0 -0
  45. /package/{rules → qualia-design}/design-reference.md +0 -0
  46. /package/{rules → qualia-design}/design-rubric.md +0 -0
  47. /package/{rules → qualia-design}/frontend.md +0 -0
package/rules/speed.md ADDED
@@ -0,0 +1,55 @@
1
+ ---
2
+ alwaysApply: true
3
+ ---
4
+
5
+ # Speed Rules (MANDATORY)
6
+
7
+ ## Direct tools over subagents
8
+
9
+ **NEVER use Task(Explore) or Task(general-purpose) for simple file lookups or code searches.** Use direct tools instead:
10
+ - **Glob** for finding files by name/pattern
11
+ - **Grep** for searching code content
12
+ - **Read** for reading specific files
13
+ - Only use Task(Explore) when you genuinely need 5+ rounds of deep codebase archaeology.
14
+
15
+ **NEVER spawn subagents when direct tools work.** Subagents are slow — a direct Glob or Grep returns in seconds, a fresh agent burns 5-10 seconds of spawn overhead plus its own context budget.
16
+
17
+ **Bias toward action, not exploration.** If the user asks you to fix something and you know the project structure, just do it.
18
+
19
+ ## CLI-first, MCP only when CLI can't
20
+
21
+ MCP servers impose a **token tax**: their tool definitions consume context-window space on every turn, even when unused. CLIs that the model already knows from training data (git, gh, supabase, vercel, railway, npx, curl) impose zero token tax — the model recalls them from weights, not from the prompt.
22
+
23
+ **Default to CLI.** Reach for MCP only when:
24
+ - The CLI doesn't exist or doesn't expose the operation you need.
25
+ - The CLI requires interactive auth that MCP has already brokered (e.g., Stripe Dashboard).
26
+ - The MCP returns structured JSON that would be expensive to parse from CLI text output.
27
+ - The MCP enforces governance (RLS-aware queries, scoped DB credentials) that the CLI doesn't.
28
+
29
+ If a `/skill-name` exists that wraps a CLI, prefer the skill — it's been hardened. Canonical example: `/supabase` skill replaces 32 supabase MCP tools with `supabase` CLI calls and saves substantial token budget.
30
+
31
+ ### MCP tier-list (when each is justified)
32
+
33
+ | Server | Always-on? | Justification |
34
+ |---|---|---|
35
+ | `claude-in-chrome` | On-demand | Browser automation has no CLI equivalent; use for QA flows only |
36
+ | `supabase` MCP | **Off** in favor of `/supabase` skill | CLI covers 95% of operations; MCP only if you need branch management interactively |
37
+ | `context7` | On-demand | Library docs at runtime — no CLI alternative for Context7 itself |
38
+ | `notebooklm-mcp` | On-demand | NotebookLM has no CLI; only loaded when researching against existing notebooks |
39
+ | `firecrawl-mcp` | On-demand | Web scraping; only loaded when feature requires it |
40
+ | `next-devtools` | Always-on (dev) | Next.js 16 runtime errors not visible elsewhere |
41
+ | `mux`, `stitch`, `higgsfield` | On-demand | Specialized API surfaces; load only on relevant client work |
42
+ | `ZohoMCP`, `qualia-erp` | On-demand | Business ops only, not engineering-path |
43
+
44
+ The pattern: **on-demand by default; always-on only when the data is irreducibly remote AND there's no CLI.**
45
+
46
+ ## Use shortcuts (Qualia commands)
47
+
48
+ When a Qualia command exists for the situation, use it — don't reinvent:
49
+ - `/qualia` — what's my next step?
50
+ - `/qualia-quick` — small inline fix, no plan, no spawn
51
+ - `/qualia-task` — single focused task, fresh builder spawn, atomic commit
52
+ - `/qualia-ship` — full deploy pipeline (quality gates → commit → deploy → verify)
53
+ - `/qualia-review` — production audit
54
+ - `/qualia-pause` — save context before clearing the conversation
55
+ - `/qualia-learn` — save a lesson from a mistake
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-help
3
- description: "Open the Qualia Framework reference guide in the browser. A beautiful themed HTML page with all commands, rules, services, and the road. Trigger on 'help', 'how does this work', 'show me the commands', 'qualia help', 'reference'."
3
+ description: "Open the BROWSER HTML reference for the Qualia Framework themed page with all commands, rules, services, and the road. The default when a browser is available. For terminal-only output (SSH, headless), use /qualia-road. Triggers: 'help', 'how does this work', 'show me the commands', 'qualia help', 'reference', 'open the docs'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-map
3
- description: "Map an existing codebase to infer architecture, stack, conventions, what's already built, AND adapt Qualia to the repo's existing tracker/labels/glossary conventions (onboarding). For brownfield projects — run BEFORE /qualia-new so Validated requirements get inferred from existing code and Qualia commands respect the repo's existing process."
3
+ description: "Map an existing codebase to infer architecture, stack, conventions, what's already built, AND adapt Qualia to the repo's existing tracker/labels/glossary conventions (onboarding). For brownfield projects — run BEFORE /qualia-new so Validated requirements get inferred from existing code and Qualia commands respect the repo's existing process. Triggers: 'map this codebase', 'onboard to existing project', 'brownfield setup', 'what's already built here', 'scan the repo', 'inherited a codebase', 'audit this project before planning'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-milestone
3
- description: "Close the current milestone and open the next one — loads the next milestone's scope from JOURNEY.md (no ad-hoc naming). Archives artifacts, marks requirements Complete, regenerates ROADMAP.md for the next milestone."
3
+ description: "Close the current milestone and open the next one — loads the next milestone's scope from JOURNEY.md (no ad-hoc naming). Archives artifacts, marks requirements Complete, regenerates ROADMAP.md for the next milestone. Triggers: 'close milestone', 'next milestone', 'milestone done', 'wrap up milestone', 'M1 done open M2', 'I want to advance to the next milestone', 'finish this milestone'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -183,7 +183,7 @@ git commit -m "docs: PRODUCT.md — register, users, voice, anti-references"
183
183
  If frontend work is involved, generate `.planning/DESIGN.md` from `templates/DESIGN.md`. The generation MUST commit to four things upfront (these go in §1 of DESIGN.md):
184
184
 
185
185
  1. **Aesthetic direction** — pick ONE: `editorial · brutalist · luxury · maximalist · retro-futuristic · organic · terminal-native · sci-fi · pastoral · industrial · ...`. Don't hedge ("modern minimal" is hedging — pick one extreme).
186
- 2. **Color strategy** — pick ONE: `Restrained · Committed · Full palette · Drenched`. See `rules/design-laws.md` §2.
186
+ 2. **Color strategy** — pick ONE: `Restrained · Committed · Full palette · Drenched`. See `qualia-design/design-laws.md` §2.
187
187
  3. **Scene sentence** — one concrete sentence: who uses this, where, ambient light, mood. NOT "observability dashboard" — "SRE glancing at incident severity on a 27-inch monitor at 2am in a dim room." Run the sentence, not the category.
188
188
  4. **Differentiation** — one sentence: what someone remembers 24 hours later.
189
189
 
@@ -198,7 +198,7 @@ Then fill the rest of DESIGN.md:
198
198
  - §9 Responsive: mobile-first
199
199
  - §10 Anti-pattern checklist (the auto-runnable one)
200
200
 
201
- Cross-check the result against `rules/design-laws.md` §8 absolute bans BEFORE writing — the design must not propose any banned pattern.
201
+ Cross-check the result against `qualia-design/design-laws.md` §8 absolute bans BEFORE writing — the design must not propose any banned pattern.
202
202
 
203
203
  ```bash
204
204
  git add .planning/DESIGN.md .planning/config.json
@@ -15,7 +15,7 @@ Agent(
15
15
  </planning>
16
16
 
17
17
  <rules>
18
- {rules/frontend.md content}
18
+ {qualia-design/frontend.md content}
19
19
  </rules>
20
20
 
21
21
  <task>
@@ -30,7 +30,7 @@ Analyze frontend:
30
30
 
31
31
  2. **Design Alignment**
32
32
  - Components vs DESIGN.md (colors, typography, spacing)
33
- - rules/frontend.md compliance: distinctive fonts? sharp accents? transitions? No card grids / gradients?
33
+ - qualia-design/frontend.md compliance: distinctive fonts? sharp accents? transitions? No card grids / gradients?
34
34
  - Consistency across app (buttons, spacing, colors)
35
35
 
36
36
  3. **Frontend Perf**
@@ -73,7 +73,7 @@ ls .planning/decisions/ 2>/dev/null && cat .planning/decisions/*.md 2>/dev/null
73
73
 
74
74
  Also read rules:
75
75
  ```bash
76
- cat ~/.claude/rules/frontend.md 2>/dev/null
76
+ cat ~/.claude/qualia-design/frontend.md 2>/dev/null
77
77
  cat ~/.claude/rules/security.md 2>/dev/null
78
78
  ```
79
79
 
@@ -37,7 +37,7 @@ Before any work — design or otherwise — pass these gates. Skipping them prod
37
37
 
38
38
  | Gate | Required check | If fail |
39
39
  |---|---|---|
40
- | Substrate | `rules/design-laws.md`, `design-brand.md`, `design-product.md`, `design-rubric.md` exist and have been read | Read them. |
40
+ | Substrate | `qualia-design/design-laws.md`, `design-brand.md`, `design-product.md`, `design-rubric.md` exist and have been read | Read them. |
41
41
  | PRODUCT | `PRODUCT.md` exists at project root, has `register:` field, and is not placeholder (`[TODO]` markers, &lt; 200 chars) | Run setup: ask 5 questions and generate it. Never synthesize from prompt alone. |
42
42
  | DESIGN | `DESIGN.md` exists. If missing on App / Redesign scope, BLOCK and run setup. If missing on Component / Section / Critique / Quick scope, NUDGE and proceed. | Generate from PRODUCT.md + 3 questions. |
43
43
  | Slop-detect | `bin/slop-detect.mjs` is callable | Install or pull from framework. |
@@ -100,7 +100,7 @@ For App / Redesign / Section scope on multi-file work:
100
100
  - If the conversation already contains design-taste discussion (font/color/motion preferences threaded across multiple turns), prefer **forked subagents** (`--fork-session`) so they inherit the taste context. Otherwise, blank-context fan-out is fine for mechanical fixes.
101
101
 
102
102
  Each agent receives:
103
- - `rules/design-laws.md` + the matching register file
103
+ - `qualia-design/design-laws.md` + the matching register file
104
104
  - `PRODUCT.md` + `DESIGN.md` (inlined)
105
105
  - Its 5 files (paths + contents)
106
106
  - Instruction: apply the Design Quality Rubric per file. Fix every dimension scoring &lt; 3. Make literal edits. Do NOT change logic — only styling.
@@ -158,7 +158,7 @@ viewports: [
158
158
  For each iteration:
159
159
 
160
160
  1. Capture all 3 viewports
161
- 2. Pass to a vision-model agent with `rules/design-rubric.md` as the prompt anchor + DESIGN.md as the spec
161
+ 2. Pass to a vision-model agent with `qualia-design/design-rubric.md` as the prompt anchor + DESIGN.md as the spec
162
162
  3. The agent scores 8 dimensions, anchored 1-5, with evidence per dimension
163
163
  4. Apply fixes ONLY to dimensions scored 1 or 2 (don't nitpick 3s; prevents oscillation)
164
164
  5. STOP if: all dimensions ≥ 3 (success), OR any dimension regressed from previous iteration (regression-stop), OR 2 iterations reached (hard cap)
@@ -58,7 +58,7 @@ Agent({
58
58
  Role: @~/.claude/agents/visual-evaluator.md
59
59
 
60
60
  <rubric>
61
- {INLINE rules/design-rubric.md §"The 8 dimensions" through §"Aggregate score"}
61
+ {INLINE qualia-design/design-rubric.md §"The 8 dimensions" through §"Aggregate score"}
62
62
  </rubric>
63
63
 
64
64
  <brief>
@@ -18,7 +18,7 @@ See its own work. Fix its own work. Stop only when correct.
18
18
 
19
19
  ## What it does
20
20
 
21
- Takes a URL + design brief. Screenshots at 3 viewports (mobile / tablet / desktop). Spawns a vision evaluator that scores 8 dimensions of `rules/design-rubric.md` against the brief with cited evidence. Spawns up to 3 fix-builders in parallel for the top issues. Re-screenshots. Loops until all dimensions ≥ 3 or the kill-switch trips (regression, budget, or max iterations).
21
+ Takes a URL + design brief. Screenshots at 3 viewports (mobile / tablet / desktop). Spawns a vision evaluator that scores 8 dimensions of `qualia-design/design-rubric.md` against the brief with cited evidence. Spawns up to 3 fix-builders in parallel for the top issues. Re-screenshots. Loops until all dimensions ≥ 3 or the kill-switch trips (regression, budget, or max iterations).
22
22
 
23
23
  Different from `/qualia-polish`: that one is read+edit+slop-detect, single pass. This one is **see+edit+verify+repeat** with a real loop and real screenshots.
24
24
 
@@ -39,7 +39,7 @@ Run these in order. Halt on the first failure.
39
39
 
40
40
  | Gate | Check | If fail |
41
41
  |---|---|---|
42
- | Substrate | `rules/design-rubric.md`, `rules/design-laws.md` exist | Run `npx qualia install` |
42
+ | Substrate | `qualia-design/design-rubric.md`, `qualia-design/design-laws.md` exist | Run `npx qualia install` |
43
43
  | Brief | `--brief` PATH if provided, else `.planning/DESIGN.md`, else PRODUCT.md | If none, HALT: "No design brief found. Pass --brief or run /qualia-new." |
44
44
  | Browser | `node ~/.claude/skills/qualia-polish-loop/scripts/playwright-capture.mjs --url about:blank --out /tmp/qpl-preflight` exits 0 | HALT with the script's setup hint |
45
45
  | URL reachable | `curl -fsS -o /dev/null -w '%{http_code}' "$URL"` returns 2xx/3xx | HALT — start the dev server first |
@@ -91,7 +91,7 @@ node ~/.claude/skills/qualia-polish-loop/scripts/loop.mjs record \
91
91
 
92
92
  Exit codes: `0` = SUCCESS (all dims ≥ 3), `1` = CONTINUE (more iterations), `3` = KILLED (regression / budget / max).
93
93
 
94
- The orchestrator computes the verdict per `rules/design-rubric.md`:
94
+ The orchestrator computes the verdict per `qualia-design/design-rubric.md`:
95
95
 
96
96
  - **all aggregate scores ≥ 3 AND no critical issues remain** → SUCCESS, exit loop
97
97
  - **same issue fingerprint recurred 3 consecutive iterations** → KILL, `LOOP_REGRESSION_DETECTED`
@@ -1,8 +1,8 @@
1
1
  <!doctype html>
2
2
  <!--
3
3
  Deliberately broken page used by /qualia-polish-loop self-test Scenario 2.
4
- Hits multiple absolute-ban patterns from rules/design-laws.md and
5
- rules/design-brand.md so the vision evaluator has to identify them all.
4
+ Hits multiple absolute-ban patterns from qualia-design/design-laws.md and
5
+ qualia-design/design-brand.md so the vision evaluator has to identify them all.
6
6
  Banned font (Inter), pure white + pure black, blue-purple gradient,
7
7
  gradient text, identical 3-column card grid, "Get Started" / "Learn More"
8
8
  generic CTAs, side-stripe border-left:4px decorative, max-width:1280
@@ -3,7 +3,7 @@
3
3
  * score.mjs -- Qualia visual-polish loop scoring utility.
4
4
  *
5
5
  * Takes a JSON object with 8 dimension scores and computes pass/fail
6
- * per the design rubric formula from rules/design-rubric.md.
6
+ * per the design rubric formula from qualia-design/design-rubric.md.
7
7
  *
8
8
  * Usage:
9
9
  * echo '{"typography":3,"color":2,"spatial":3,"layout":3,"shadow":3,"motion":3,"microcopy":3,"container":3}' | node score.mjs
@@ -95,7 +95,7 @@ matches the failure. Use this lookup:
95
95
  | Wave 2 task ran before wave 1 committed | `agents/planner.md` (dependency graph) |
96
96
  | Build passed locally, broke in CI | `rules/deployment.md` or a missing pre-deploy-gate scan |
97
97
  | RLS missing on new table | `rules/security.md` + `agents/builder.md` (security persona handling) |
98
- | Design regression — fonts off, contrast fail | `rules/frontend.md` + `skills/qualia-design/SKILL.md` |
98
+ | Design regression — fonts off, contrast fail | `qualia-design/frontend.md` + `skills/qualia-design/SKILL.md` |
99
99
  | Migration unsafe (DROP without IF EXISTS, etc.) | `hooks/migration-guard.js` |
100
100
  | Verifier missed it | `agents/verifier.md` — most embarrassing case, address with extra care |
101
101
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-quick
3
- description: "Fast path for small tasksbug fixes, tweaks, hot fixes. Skips full phase planning. Trigger on 'quick fix', 'small change', 'tweak', 'hot fix', 'one-line fix', 'quick edit', 'small bug'."
3
+ description: "Fast inline path for trivial fixes≤1 hour, typically 1 file, no plan, NO subagent spawn. The current Claude does the work directly. For a 1-5 file change that justifies a fresh builder context, use /qualia-task instead. Trigger on 'quick fix', 'small change', 'tweak', 'hot fix', 'one-line fix', 'typo', 'config tweak'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-research
3
- description: "Deep-research a niche domain or library BEFORE planning a specific phase. Spawns the researcher agent with Context7/WebFetch access. Writes to .planning/phase-{N}-research.md."
3
+ description: "Deep-research a niche domain or library BEFORE planning a specific phase. Spawns the researcher agent with Context7/WebFetch access. Writes to .planning/phase-{N}-research.md. Triggers: 'research X library', 'research the domain before planning', 'study Stripe webhooks', 'how do others do RAG', 'best practices for X', 'compare libraries', 'I need depth before planning phase N'. Distinct from /qualia-recall (which queries the local Obsidian vault) and /qualia-discuss (which interviews the user)."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -75,7 +75,8 @@ Reqs: {REQ-IDs for this phase}
75
75
 
76
76
  <output_path>.planning/phase-{N}-research.md</output_path>
77
77
 
78
- Priority: Context7 → WebFetch → WebSearch.
78
+ Priority: NotebookLM (cross-notebook query) → local knowledge layer (knowledge.js search + qualia-recall) → Context7 → WebFetch → WebSearch.
79
+ Skip web round when local sources cover the question with confidence ≥ MEDIUM (per agents/researcher.md §1b).
79
80
  Include: recommendation, rationale, versions, code examples, alternatives, pitfalls, sources.
80
81
  ", subagent_type="qualia-researcher", description="Phase {N} research")
81
82
  ```
@@ -123,4 +124,5 @@ node ~/.claude/bin/qualia-ui.js end "PHASE {N} RESEARCH DONE" "/qualia-plan {N}"
123
124
  1. **One session per run.** Don't research phases 1-5 in one call.
124
125
  2. **Must produce a file.** Research in conversation only is worthless.
125
126
  3. **Honor locked decisions.** Don't research alternatives to locked choices.
126
- 4. **Context7 first.** Try Context7 MCP before WebFetch.
127
+ 4. **Local-first.** Drain NotebookLM and `~/qualia-memory` before any external call. The team has already researched most domains we touch — querying existing notebooks is near-zero token cost AND higher-quality than fresh WebSearch.
128
+ 5. **Context7 before WebFetch.** When you do go external, Context7 first for libraries; only WebFetch for non-library content (blog posts, case studies, post-mortems).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-road
3
- description: "Show the Qualia workflow map in the terminal — Project → Journey → Milestones → Phases → Tasks. Lists every command, when to use it, and how phases chain. Use when user asks 'how does Qualia work', 'what's the workflow', 'show me the road', 'what command does X', 'how do projects flow', or is new to the framework. (For an interactive HTML reference instead, use /qualia-help.)"
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."
4
4
  disable-model-invocation: true
5
5
  allowed-tools:
6
6
  - Read
@@ -45,14 +45,24 @@ 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
- ## /qualia-polish-loop -- autonomous visual QA (v5.1+)
48
+ ## /qualia-polish-loop -- autonomous visual QA (v5.1+, hardened in v5.2)
49
49
  ```
50
- /qualia-polish-loop http://localhost:3000 screenshot + eval + fix loop
51
- /qualia-polish-loop {url} --max 4 cap iterations
52
- /qualia-polish-loop {url} --ref design.png anchor to reference image
50
+ /qualia-polish-loop http://localhost:3000 screenshot + eval + fix loop
51
+ /qualia-polish-loop {url} --max 4 cap iterations
52
+ /qualia-polish-loop {url} --ref design.png anchor to reference image
53
+ /qualia-polish-loop {url} --reduced-motion force prefers-reduced-motion (v5.2+)
54
+ /qualia-polish-loop --routes /a,/b,/c multi-route sweep (v5.2+)
53
55
  ```
54
56
  Screenshots at 3 viewports (375/768/1440), scores 8 design dimensions using vision, fixes issues, re-screenshots, loops until all dims >= 3 or kill-switch triggers. Per-iteration git commits for clean revert.
55
57
 
58
+ ## v5.3+ skills (Matt Pocock gaps closed)
59
+ ```
60
+ /qualia-prd synthesize current conversation → .planning/PRD-{slug}.md (durable feature spec)
61
+ /qualia-hook-gen convert a CLAUDE.md/rules instruction into a deterministic pre-tool-use hook
62
+ /qualia-optimize --deepen now spawns 3 parallel interface-design variants per candidate (Step 5b)
63
+ ```
64
+ `/qualia-prd` pairs with `/qualia-issues` to form the PRD → vertical-slice → execute loop. `/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.
65
+
56
66
  ## Alignment substrate (v5.0+)
57
67
  Before high-stakes phases, run alignment skills against `.planning/CONTEXT.md` (domain glossary) and `.planning/decisions/` (ADRs):
58
68
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-task
3
- description: "Builds a single focused task in a fresh builder context with atomic commit and validation. More structured than /qualia-quick, lighter than /qualia-build (no phase plan needed). Use when the user says 'build this one thing', 'add a component', 'implement this feature', 'qualia-task', or for any 1-5 file change outside a full phase."
3
+ description: "Single focused task with a FRESH builder subagent spawn — 1-3 hours, 1-5 files, atomic commit, validation contract. Heavier than /qualia-quick (which runs inline with no spawn) but lighter than /qualia-build (which needs a phase plan). Use when the user says 'build this one thing', 'add a component', 'implement this feature', 'qualia-task', or for any 1-5 file feature outside a full phase."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -49,7 +49,7 @@ Sites the project should NOT look like. Anti-references pin down what the design
49
49
  - {URL or descriptor} — ...
50
50
  ```
51
51
 
52
- For Brand register, these are usually saturated aesthetic lanes (see `rules/design-brand.md`).
52
+ For Brand register, these are usually saturated aesthetic lanes (see `qualia-design/design-brand.md`).
53
53
  For Product register, these are usually patterns we don't want to inherit (e.g., "Salesforce Lightning — too dense, too many panels").
54
54
 
55
55
  ## Positive references (optional, ≤3)
package/tests/bin.test.sh CHANGED
@@ -1201,7 +1201,7 @@ else
1201
1201
  fi
1202
1202
 
1203
1203
  # 108. package.json version is 5.x (5.1+ accepted; v5.1 / v5.2 share the v5 line)
1204
- if grep -qE '"5\.[123]\.' "$FRAMEWORK_DIR/package.json"; then
1204
+ if grep -qE '"5\.[1234]\.' "$FRAMEWORK_DIR/package.json"; then
1205
1205
  pass "package.json version is 5.x"
1206
1206
  else
1207
1207
  fail_case "package.json version not 5.x"
@@ -1430,7 +1430,7 @@ fi
1430
1430
 
1431
1431
  # 128. package.json bumped to 5.x (5.1+ accepted; 5.2 is the v5.2 release)
1432
1432
  PKG_V=$($NODE -e 'console.log(require("'"$FRAMEWORK_DIR"'/package.json").version)')
1433
- if echo "$PKG_V" | grep -qE "^5\.[123]\."; then
1433
+ if echo "$PKG_V" | grep -qE "^5\.[1234]\."; then
1434
1434
  pass "package.json version bumped to 5.x ($PKG_V)"
1435
1435
  else
1436
1436
  fail_case "package.json version not 5.x" "got=$PKG_V"
@@ -1577,7 +1577,7 @@ fi
1577
1577
 
1578
1578
  # 143. package.json version is 5.x (5.1+ accepted; v5.3 is the v5.3 release)
1579
1579
  PKG_V=$($NODE -e 'console.log(require("'"$FRAMEWORK_DIR"'/package.json").version)')
1580
- if echo "$PKG_V" | grep -qE "^5\.[123]\."; then
1580
+ if echo "$PKG_V" | grep -qE "^5\.[1234]\."; then
1581
1581
  pass "package.json version is 5.x ($PKG_V) — v5.3 accepted"
1582
1582
  else
1583
1583
  fail_case "package.json version not 5.x" "got=$PKG_V"
@@ -0,0 +1,143 @@
1
+ #!/bin/bash
2
+ # Qualia Framework — skill smoke tests
3
+ # Verifies every skills/*/SKILL.md is well-formed:
4
+ # - YAML frontmatter present and parseable
5
+ # - name field matches folder name
6
+ # - description present and substantive
7
+ # - description has trigger phrases (or skill is disable-model-invocation)
8
+ # - body has at least one h1 heading and 2+ sections
9
+ #
10
+ # Run: bash tests/skills.test.sh
11
+
12
+ PASS=0
13
+ FAIL=0
14
+ SKILLS_DIR="$(cd "$(dirname "$0")/../skills" && pwd)"
15
+
16
+ # Skills allowed to ship without trigger phrases — disable-model-invocation
17
+ # skills only fire on explicit slash command, so triggers are optional.
18
+ SKIP_TRIGGER_CHECK=("qualia-road" "qualia-handoff")
19
+
20
+ pass() {
21
+ echo " ✓ $1"
22
+ PASS=$((PASS + 1))
23
+ }
24
+
25
+ fail_case() {
26
+ echo " ✗ $1"
27
+ echo " $2"
28
+ FAIL=$((FAIL + 1))
29
+ }
30
+
31
+ is_in_skip_list() {
32
+ local needle="$1"
33
+ for x in "${SKIP_TRIGGER_CHECK[@]}"; do
34
+ [ "$x" = "$needle" ] && return 0
35
+ done
36
+ return 1
37
+ }
38
+
39
+ echo "skills.test.sh — smoke tests for every skills/*/SKILL.md"
40
+ echo ""
41
+
42
+ for skill_dir in "$SKILLS_DIR"/*/; do
43
+ name=$(basename "$skill_dir")
44
+ skill_md="$skill_dir/SKILL.md"
45
+
46
+ # Existence
47
+ if [ ! -f "$skill_md" ]; then
48
+ fail_case "$name" "SKILL.md not found at $skill_md"
49
+ continue
50
+ fi
51
+
52
+ # Frontmatter present
53
+ if ! head -1 "$skill_md" | grep -q "^---$"; then
54
+ fail_case "$name: frontmatter" "first line is not '---'"
55
+ continue
56
+ fi
57
+ if ! sed -n '2,30p' "$skill_md" | grep -q "^---$"; then
58
+ fail_case "$name: frontmatter" "no closing --- within first 30 lines"
59
+ continue
60
+ fi
61
+
62
+ # name field matches folder
63
+ fm_name=$(grep "^name:" "$skill_md" | head -1 | sed 's/^name:[[:space:]]*//' | tr -d '"')
64
+ if [ "$fm_name" != "$name" ]; then
65
+ fail_case "$name: name field" "frontmatter says name=\"$fm_name\", folder is \"$name\""
66
+ continue
67
+ fi
68
+ pass "$name: frontmatter name matches folder"
69
+
70
+ # description field present + substantive
71
+ fm_desc=$(grep "^description:" "$skill_md" | head -1 | sed 's/^description:[[:space:]]*//')
72
+ desc_len=${#fm_desc}
73
+ if [ "$desc_len" -lt 50 ]; then
74
+ fail_case "$name: description" "description is $desc_len chars, expected >= 50"
75
+ continue
76
+ fi
77
+ pass "$name: description present (${desc_len} chars)"
78
+
79
+ # Trigger phrases (unless disable-model-invocation or in transitional skip list)
80
+ if ! is_in_skip_list "$name"; then
81
+ has_disable=$(grep -c "disable-model-invocation:[[:space:]]*true" "$skill_md")
82
+ if [ "$has_disable" = "0" ]; then
83
+ if echo "$fm_desc" | grep -qiE "trigger|when user|use when|invoke|says|use this|fire on|user types"; then
84
+ pass "$name: description has trigger guidance"
85
+ else
86
+ fail_case "$name: triggers" "description lacks trigger phrases (Trigger:/Use when:/'says'/etc.) and skill is not disable-model-invocation"
87
+ fi
88
+ fi
89
+ fi
90
+
91
+ # Body has an h1 heading
92
+ h1_count=$(grep -cE "^# " "$skill_md")
93
+ if [ "$h1_count" -ge 1 ]; then
94
+ pass "$name: body has h1 heading"
95
+ else
96
+ fail_case "$name: body" "no h1 heading (^# ) in body"
97
+ fi
98
+
99
+ # Body has at least one section (any ## heading)
100
+ h2_count=$(grep -cE "^## " "$skill_md")
101
+ if [ "$h2_count" -ge 1 ]; then
102
+ pass "$name: body has section heading (${h2_count} found)"
103
+ else
104
+ fail_case "$name: body" "no '## ' section heading; every skill needs at least one"
105
+ fi
106
+
107
+ # Cache-aware spawn audit (per rules/grounding.md):
108
+ # Every spawn to a CUSTOM (qualia-*) agent must anchor the prompt with
109
+ # `@~/.claude/agents/{name}.md` (either `Role: @...` or `Read your role:
110
+ # @...` — both forms accepted). The role file is session-stable; placing
111
+ # it first lets Anthropic's prompt cache reuse the prefix across spawns
112
+ # (documented 81-90% cost reduction). If task-specific content lands
113
+ # before the role anchor, the entire prefix recomputes on every spawn.
114
+ #
115
+ # Built-in subagent types (Explore, general-purpose, Plan, etc.) have
116
+ # stable system-prompt baselines on Anthropic's side; no Role anchor
117
+ # required. We count only `subagent_type="qualia-*"` spawns.
118
+ #
119
+ # Some skills follow progressive-disclosure discipline (e.g.
120
+ # qualia-polish-loop) and put the literal spawn template in REFERENCE.md
121
+ # while SKILL.md mentions the spawn in prose. We scan both.
122
+ custom_spawn_count=$(grep -c 'subagent_type="qualia-' "$skill_md")
123
+ ref_md="$skill_dir/REFERENCE.md"
124
+ if [ -f "$ref_md" ]; then
125
+ custom_spawn_count=$((custom_spawn_count + $(grep -c 'subagent_type="qualia-' "$ref_md")))
126
+ fi
127
+ if [ "${custom_spawn_count:-0}" -gt 0 ]; then
128
+ role_count=$(grep -cE '@~/\.claude/agents/' "$skill_md")
129
+ if [ -f "$ref_md" ]; then
130
+ role_count=$((role_count + $(grep -cE '@~/\.claude/agents/' "$ref_md")))
131
+ fi
132
+ if [ "${role_count:-0}" -ge "$custom_spawn_count" ]; then
133
+ pass "$name: spawn audit ($custom_spawn_count custom spawn(s), all role-anchored for cache)"
134
+ else
135
+ fail_case "$name: spawn audit" "$custom_spawn_count custom spawn(s) but only ${role_count:-0} '@~/.claude/agents/' anchors — prompt cache will miss"
136
+ fi
137
+ fi
138
+ done
139
+
140
+ echo ""
141
+ echo "=== Results: $PASS passed, $FAIL failed ==="
142
+
143
+ [ "$FAIL" = "0" ]