qualia-framework 5.1.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 (53) 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/docs/polish-loop-supervised-run.md +111 -0
  17. package/guide.md +11 -4
  18. package/hooks/session-start.js +1 -1
  19. package/package.json +5 -2
  20. package/rules/architecture.md +125 -0
  21. package/rules/infrastructure.md +1 -2
  22. package/rules/speed.md +55 -0
  23. package/skills/qualia-help/SKILL.md +1 -1
  24. package/skills/qualia-hook-gen/SKILL.md +206 -0
  25. package/skills/qualia-map/SKILL.md +1 -1
  26. package/skills/qualia-milestone/SKILL.md +1 -1
  27. package/skills/qualia-new/SKILL.md +2 -2
  28. package/skills/qualia-optimize/REFERENCE.md +65 -2
  29. package/skills/qualia-optimize/SKILL.md +26 -1
  30. package/skills/qualia-polish/SKILL.md +3 -3
  31. package/skills/qualia-polish-loop/REFERENCE.md +1 -1
  32. package/skills/qualia-polish-loop/SKILL.md +3 -3
  33. package/skills/qualia-polish-loop/fixtures/broken.html +2 -2
  34. package/skills/qualia-polish-loop/scripts/loop.mjs +26 -5
  35. package/skills/qualia-polish-loop/scripts/playwright-capture.mjs +14 -5
  36. package/skills/qualia-polish-loop/scripts/score.mjs +1 -1
  37. package/skills/qualia-postmortem/SKILL.md +1 -1
  38. package/skills/qualia-prd/SKILL.md +199 -0
  39. package/skills/qualia-quick/SKILL.md +1 -1
  40. package/skills/qualia-research/SKILL.md +5 -3
  41. package/skills/qualia-road/SKILL.md +15 -5
  42. package/skills/qualia-task/SKILL.md +1 -1
  43. package/templates/PRODUCT.md +1 -1
  44. package/tests/bin.test.sh +155 -8
  45. package/tests/skills.test.sh +143 -0
  46. package/tests/slop-detect.test.sh +160 -0
  47. package/docs/playwright-loop-review-2026-05-03.md +0 -65
  48. /package/{rules → qualia-design}/design-brand.md +0 -0
  49. /package/{rules → qualia-design}/design-laws.md +0 -0
  50. /package/{rules → qualia-design}/design-product.md +0 -0
  51. /package/{rules → qualia-design}/design-reference.md +0 -0
  52. /package/{rules → qualia-design}/design-rubric.md +0 -0
  53. /package/{rules → qualia-design}/frontend.md +0 -0
@@ -0,0 +1,288 @@
1
+ # v4.0.0 — Review & Publish Handoff
2
+
3
+ **Date:** 2026-04-18
4
+ **Branch:** `feature/full-journey`
5
+ **Release tag:** v4.0.0 (not yet tagged, not yet pushed)
6
+ **Status:** Ready for review. Tests 156/156 green. Needs human eyeball before `git push` + `npm publish`.
7
+
8
+ This document is the single source of truth for what shipped in v4.0.0 and what the next agent/reviewer needs to verify before the release goes public.
9
+
10
+ ---
11
+
12
+ ## TL;DR
13
+
14
+ The Qualia Framework v4.0.0 makes `/qualia-new` produce the **entire project journey** (all milestones → Handoff) upfront, enables **end-to-end auto-chaining** of the Road with `--auto`, locks down the **milestone/phase/task hierarchy**, and **rebuilds `/qualia-idk` as a real diagnostician** instead of a router alias.
15
+
16
+ 10 commits on `feature/full-journey` (8 feature + 1 docs + 1 release-state fix). ~28 files touched. 156/156 tests green.
17
+
18
+ Two local branches, neither pushed:
19
+
20
+ | Branch | HEAD | Ships |
21
+ |---|---|---|
22
+ | `feature/story-file-plans` | `8ae5b0e` | v3.7.0 — story-file plan format (independent, useful on its own) |
23
+ | `feature/full-journey` | `f790554` | v4.0.0 — full journey, auto-chain, diagnostic idk (includes v3.7.0) |
24
+
25
+ ---
26
+
27
+ ## The commits on `feature/full-journey`
28
+
29
+ ```
30
+ 94bc119 fix(v4): correct v4.0.0 — fold qualia-idk changelog entries into initial release
31
+ ea9e7f3 docs(v4): README, guide.md, SESSION_REPORT updated for v4.0.0 + V4_REVIEW.md handoff
32
+ f790554 release(v4.0.0): full journey — kickoff to handoff on rails
33
+ f62e753 fix(v4/phase-g): milestone summary cumulative task count + smoke tests
34
+ b41a52d feat(v4/phase-f): build_count + deploy_count bump, ERP v4 payload, handoff 4-deliverables
35
+ 74dd26e feat(v4/phase-d-e): builder pre-inline + journey visualization
36
+ 400cd17 feat(v4/phase-c): auto-chain wiring across Road skills
37
+ 87af253 feat(v4/phase-b): roadmapper + qualia-new full-journey output
38
+ 2e371c2 feat(v4/phase-a): model foundation — milestones[] + readiness guards
39
+ 8ae5b0e release(v3.7.0): story-file plan format (from feature/story-file-plans)
40
+ ```
41
+
42
+ **Release-point:** `94bc119` is the canonical v4.0.0 HEAD (package.json = "4.0.0", CHANGELOG has a single [4.0.0] section with `/qualia-idk` folded in). Tag v4.0.0 at this commit.
43
+
44
+ ---
45
+
46
+ ## What v4.0.0 actually changes
47
+
48
+ ### Hierarchy (locked down)
49
+ ```
50
+ Project
51
+ └─ Journey (all milestones defined upfront)
52
+ └─ Milestone (a release — 2-5 total, Handoff is always last)
53
+ └─ Phase (2-5 tasks per phase)
54
+ └─ Task (one commit, one verification contract)
55
+ ```
56
+
57
+ - Hard floor: 2 milestones. Hard ceiling: 5.
58
+ - Final milestone is **always literally named "Handoff"** with 4 fixed phases (Polish, Content + SEO, Final QA, Handoff).
59
+ - Every non-Handoff milestone needs **≥ 2 phases** (guarded by `state.js close-milestone`).
60
+ - Milestone numbering is **contiguous** — no skipped numbers.
61
+
62
+ ### New artifact: `.planning/JOURNEY.md`
63
+ The North Star. Lists every milestone with why-now + exit criteria + phase sketches. Written once during `/qualia-new`, consulted at every milestone boundary.
64
+
65
+ ### Auto mode (`--auto` flag)
66
+ ```
67
+ /qualia-new --auto
68
+ → research runs automatically
69
+ → JOURNEY.md written
70
+ → SINGLE human approval on the whole journey
71
+ → plan 1 → build 1 → verify 1 → plan 2 → build 2 → verify 2 → ...
72
+ → [milestone boundary — HUMAN GATE: "Continue to M{N+1}?"]
73
+ → ... repeat until Handoff last phase ...
74
+ → /qualia-ship → /qualia-handoff → /qualia-report → DONE
75
+ ```
76
+
77
+ **Two human gates total per project** (journey approval + each milestone boundary). Plus one halt if gap-cycle limit exceeded on a failed phase.
78
+
79
+ ### `/qualia-idk` now diagnostic (not a router alias)
80
+ Spawns two isolated `Explore` subagents in parallel:
81
+ 1. **Plan view** — reads only `.planning/*`, reports what plan says we are + what should be TRUE
82
+ 2. **Code view** — reads only source code, reports what's built + what compiles + what's stubbed, cites file:line
83
+
84
+ Main skill synthesizes: "What I see / The mismatch / What I think is happening / What to do next."
85
+
86
+ ### `/qualia` description scoped back to state routing
87
+ Previously claimed "idk / stuck / lost / confused" triggers. Those now route to `/qualia-idk`. `/qualia` keeps "what next / what now / next command."
88
+
89
+ ### Schema changes (all additive, backward compatible)
90
+ `tracking.json` gains:
91
+ - `milestone_name` — human name of current milestone
92
+ - `milestones[]` — array of closed milestone summaries (for ERP tree render)
93
+ - `build_count`, `deploy_count` — now actually incremented on transitions
94
+
95
+ `state.js` check output gains `milestone_name` + `milestones`.
96
+
97
+ `qualia-report` ERP payload now includes all v4 fields.
98
+
99
+ ---
100
+
101
+ ## How to verify before publishing
102
+
103
+ ### 1. Run the test suite
104
+ ```bash
105
+ cd /home/qualiasolutions/qualia-framework
106
+ node --test tests/runner.js
107
+ ```
108
+ Expected: `# pass 156 / # fail 0`.
109
+
110
+ ### 2. Visual smoke test of new UI commands
111
+ ```bash
112
+ # Make a fake project
113
+ TMP=/tmp/qualia-v4-visual && rm -rf $TMP && mkdir -p $TMP/.planning
114
+ cat > $TMP/.planning/JOURNEY.md <<'EOF'
115
+ ---
116
+ project: "Demo"
117
+ ---
118
+ ## Milestone 1 · Foundation
119
+ **Why now:** Base infra.
120
+ **Phases:**
121
+ 1. **Setup**
122
+ 2. **Auth**
123
+ ## Milestone 2 · Core Features
124
+ **Why now:** Value delivery.
125
+ **Phases:**
126
+ 1. **Feature A**
127
+ 2. **Feature B**
128
+ ## Milestone 3 · Handoff
129
+ **Phases:**
130
+ 1. **Polish**
131
+ 2. **Content + SEO**
132
+ 3. **Final QA**
133
+ 4. **Handoff**
134
+ EOF
135
+ cat > $TMP/.planning/tracking.json <<'EOF'
136
+ {"milestone":2,"milestone_name":"Core Features","milestones":[],"phase":1,"total_phases":2,"status":"built","lifetime":{"tasks_completed":4,"phases_completed":2,"milestones_completed":1}}
137
+ EOF
138
+ cat > $TMP/.planning/STATE.md <<'EOF'
139
+ ## Current Position
140
+ Phase: 1 of 2 — Feature A
141
+ Status: built
142
+ Assigned to: Reviewer
143
+
144
+ ## Roadmap
145
+ | # | Phase | Goal | Status |
146
+ |---|-------|------|--------|
147
+ | 1 | Feature A | x | built |
148
+ | 2 | Feature B | x | — |
149
+ EOF
150
+ (cd $TMP && node /home/qualiasolutions/qualia-framework/bin/qualia-ui.js journey-tree .planning/JOURNEY.md)
151
+ node /home/qualiasolutions/qualia-framework/bin/qualia-ui.js milestone-complete 1 "Foundation" "Core Features"
152
+ node /home/qualiasolutions/qualia-framework/bin/qualia-ui.js milestone-complete 3 "Handoff" ""
153
+ rm -rf $TMP
154
+ ```
155
+ Expected:
156
+ - Journey tree shows green dot on M1, teal diamond on M2 (CURRENT), dim circle on M3 (FINAL).
157
+ - First milestone-complete banner shows `Next: Core Features`.
158
+ - Second shows `PROJECT COMPLETE · last milestone reached`.
159
+
160
+ ### 3. State-machine end-to-end smoke
161
+ Covered by test case `tests/runner.js` "milestone summary captures cumulative tasks_completed" and "build_count bumps on each 'built' transition". Both pass.
162
+
163
+ ### 4. Manual eyeball of key files
164
+ Review these for v4 correctness:
165
+
166
+ | File | Why |
167
+ |---|---|
168
+ | `templates/journey.md` | New artifact schema — is the format clear and complete? |
169
+ | `agents/roadmapper.md` | Biggest agent rewrite — does it correctly describe the 3-file output (JOURNEY + REQUIREMENTS + ROADMAP)? |
170
+ | `skills/qualia-new/SKILL.md` | Core flow — is the 14-step process coherent? Is `--auto` wiring clear? |
171
+ | `skills/qualia-idk/SKILL.md` | New diagnostic — does the 2-pass isolation make sense? Is the synthesis format useful? |
172
+ | `skills/qualia-verify/SKILL.md` | Auto-chain decision table (PASS → next phase / last phase → milestone / last milestone → ship) |
173
+ | `skills/qualia-milestone/SKILL.md` | Reads next milestone from JOURNEY.md now, not user prompt |
174
+ | `skills/qualia-handoff/SKILL.md` | 4 mandatory deliverables enforced |
175
+ | `bin/state.js` lines ~975-1050 | close-milestone readiness guards + milestones[] summary append |
176
+ | `bin/qualia-ui.js` journey-tree + milestone-complete | New visualizations |
177
+ | `CHANGELOG.md` [4.0.0] section | Full feature list + migration notes |
178
+
179
+ ### 5. Backward-compat verification
180
+ The v4 changes are designed additive. Verify by:
181
+ ```bash
182
+ # tracking.json from an older project (no milestones[], no milestone_name)
183
+ # should still work with state.js check
184
+ echo '{"milestone":1,"phase":1,"total_phases":3,"status":"setup","lifetime":{"tasks_completed":0,"phases_completed":0,"milestones_completed":0,"total_phases":0}}' > /tmp/old-tracking.json
185
+ mkdir -p /tmp/old-project/.planning && mv /tmp/old-tracking.json /tmp/old-project/.planning/tracking.json
186
+ cat > /tmp/old-project/.planning/STATE.md <<'EOF'
187
+ Phase: 1 of 3 — Setup
188
+ Status: setup
189
+
190
+ ## Roadmap
191
+ | # | Phase | Goal | Status |
192
+ |---|-------|------|--------|
193
+ | 1 | Setup | x | ready |
194
+ | 2 | Feature | x | — |
195
+ | 3 | Ship | x | — |
196
+ EOF
197
+ (cd /tmp/old-project && node /home/qualiasolutions/qualia-framework/bin/state.js check | head -20)
198
+ rm -rf /tmp/old-project
199
+ ```
200
+ Expected: `check` succeeds, output includes `milestones: []` and `milestone_name: ""` (hydrated by `ensureLifetime`).
201
+
202
+ ---
203
+
204
+ ## Publish checklist
205
+
206
+ Once review passes:
207
+
208
+ ```bash
209
+ # 1. Push both branches
210
+ git push -u origin feature/story-file-plans
211
+ git push -u origin feature/full-journey
212
+
213
+ # 2. Merge v3.7.0 first (recommended — gives it a distinct tag in history)
214
+ git checkout main
215
+ git merge --ff-only feature/story-file-plans
216
+ git tag v3.7.0
217
+ git push origin main --tags
218
+
219
+ # 3. Merge v4.0.0
220
+ git merge --ff-only feature/full-journey
221
+ # If fast-forward fails (unlikely since v4 branched off story-file-plans HEAD):
222
+ # git merge feature/full-journey # creates a merge commit — also fine
223
+ git tag v4.0.0
224
+ git push origin main --tags
225
+
226
+ # 4. npm publish
227
+ npm publish
228
+ # Expected: qualia-framework@4.0.0 goes live. Auto-update hook notifies
229
+ # every team member's installed client on next session.
230
+
231
+ # 5. Verify
232
+ npm view qualia-framework version # should return 4.0.0
233
+ ```
234
+
235
+ ### Alternative: one combined release
236
+ If the team would rather have a single v4.0.0 release tag (skip the v3.7.0 tag):
237
+
238
+ ```bash
239
+ git checkout main
240
+ git merge --ff-only feature/full-journey
241
+ git tag v4.0.0
242
+ git push origin main --tags
243
+ npm publish
244
+ ```
245
+ (v3.7.0 work is still in the history, just not tagged as its own release.)
246
+
247
+ ---
248
+
249
+ ## Risk areas (eyeball these)
250
+
251
+ 1. **Auto-chain logic in `/qualia-verify`** — the decision table (PASS → next phase / last phase of milestone / last phase of Handoff / FAIL gap / FAIL limit) is described in the SKILL.md but relies on Claude to parse JOURNEY.md at runtime to detect "last phase of milestone." Smoke test didn't actually run the auto-chain because that requires live subagent invocation. **Recommended first test on merge**: run `/qualia-new --auto` on a throwaway project and watch how it handles the milestone boundary.
252
+
253
+ 2. **Roadmapper's new three-file output** — the rewritten agent prompt is long and complex. The roadmapper must:
254
+ - Generate JOURNEY.md with all milestones
255
+ - Assign requirements to milestones
256
+ - Only detail Milestone 1 in ROADMAP.md
257
+ - Pass `--milestone_name` to `state.js init`
258
+ Smoke test didn't exercise the roadmapper directly — it's only triggered by `/qualia-new`.
259
+
260
+ 3. **`/qualia-idk`'s two-pass isolation** — depends on `Explore` subagent correctly NOT crossing its scope. If an Explore agent reads .planning/ when told "code only" or vice versa, the diagnosis degrades. The SKILL.md has explicit "DO NOT read..." instructions but this is prompt-level enforcement, not hard boundary.
261
+
262
+ 4. **Builder pre-inline context** — saves tool calls but inflates prompt size. On very large projects (PROJECT.md + DESIGN.md + 5 context files could easily be 10k+ tokens), the builder's prompt might balloon. Acceptable for most projects; watch for issues on monorepos.
263
+
264
+ ---
265
+
266
+ ## Known limitations / deferred
267
+
268
+ - **No visual / mockup generation** (gstack's `/design-shotgun` or Superpowers' Visual Companion). Not in v4 — could be a v4.1 feature.
269
+ - **No cross-model review** (gstack's `/codex`). Not in v4.
270
+ - **No cross-project vector memory** (Claude-Flow's claude-mem pattern). Current `knowledge/` is still hand-authored markdown.
271
+ - **No IDE integration** (VS Code extension, JetBrains plugin). Claude Code CLI only.
272
+ - **No token-budget compression** (SuperClaude's ~70% compression claim). Qualia relies on fresh-context agents instead of compression.
273
+
274
+ These are all discussed in the competitive gap analysis done earlier in the session — see the chat transcript or memory for details.
275
+
276
+ ---
277
+
278
+ ## Questions for Fawzi before publish
279
+
280
+ 1. **Single v4.0.0 release or v3.7.0 + v4.0.0?** Default: both tags (v3.7.0 as a step release). Cleaner history. Alternative: fold into single v4.0.0.
281
+ 2. **Alpha/beta tag on npm?** `npm publish` without `--tag` goes to `latest` and every installed client auto-updates on next session. If you want a slower rollout, publish with `--tag beta` and the team opts in manually with `npm install qualia-framework@beta install`.
282
+ 3. **Do you want to dogfood v4 on an existing project before publish?** Running `npx qualia-framework@4.0.0-alpha install` locally on Sakani or another project is the safest way to verify end-to-end — especially the auto-chain which isn't covered by the unit tests.
283
+
284
+ Contact for questions: Fawzi Goussous — fawzi@qualiasolutions.net
285
+
286
+ ---
287
+
288
+ *Generated 2026-04-18 by the v4 build session. Review this doc + CHANGELOG.md [4.0.0] before publishing.*
@@ -0,0 +1,113 @@
1
+ # Instruction-Budget Audit
2
+
3
+ > **Date:** 2026-05-06
4
+ > **Trigger:** Re-study of *Skills and Strategies for Real Engineering with Claude Code* (Matt Pocock) and *Context and Tools: Mastering the AI Engineering Lifecycle* (Patrick Debois, Karpathy, Pocock, Mario Zechner).
5
+ > **Question:** Does Qualia Framework actually honor the "load on demand, not always" promise written in `CLAUDE.md`?
6
+
7
+ ## Finding 1 — `~/.claude/rules/*.md` is loaded eagerly by Claude Code
8
+
9
+ Claude Code auto-discovers and injects every Markdown file under `~/.claude/rules/` into the system prompt of every session. This is **harness behavior**, not framework behavior — there is no `@-import` declaration in `~/.claude/CLAUDE.md`, yet the rules appear in the system reminder verbatim.
10
+
11
+ **Measured cost (2026-05-06 install):**
12
+
13
+ | File | Lines | Notes |
14
+ |---|---|---|
15
+ | `design-reference.md` | 179 | Motion specs, WCAG checklist, breakpoints |
16
+ | `design-rubric.md` | 157 | 8-dimension verifier rubric |
17
+ | `design-laws.md` | 148 | OKLCH, color strategy, typography |
18
+ | `frontend.md` | 118 | Brand standards |
19
+ | `design-brand.md` | 114 | Brand register |
20
+ | `design-product.md` | 114 | Product register |
21
+ | `grounding.md` | 114 | Severity rubric, citation format |
22
+ | `infrastructure.md` | 87 | Stack, MCP servers, CLIs |
23
+ | `deployment.md` | 30 | Post-deploy checklist |
24
+ | `speed.md` | 23 | Speed rules |
25
+ | `context7.md` | 14 | Context7 trigger rule |
26
+ | `security.md` | 12 | RLS, auth, secrets |
27
+ | **Total** | **1110** | |
28
+
29
+ At ~4 chars/line average that is **~28 KB injected on every session**, regardless of whether the user is touching frontend, backend, infra, or nothing.
30
+
31
+ The rule files themselves are written under the assumption that a skill or agent will read them on demand (e.g., `agents/builder.md` line 139 says *"Security, design, and performance rules auto-load from `rules/*.md` based on the files you touch"*) — which is correct **inside subagent fork prompts** but **wrong for the user's main session**, where the harness loads them all preemptively.
32
+
33
+ ## Finding 2 — `CLAUDE.md` template is already disciplined
34
+
35
+ The framework `CLAUDE.md` template is 24 lines and ends with the right note:
36
+
37
+ > *"this file stays under 25 lines. Steering rules go into discoverable skills, not into the global system prompt. CLI preferences go into hooks. Stack/architecture details are trivially discoverable in package.json/config."*
38
+
39
+ This part is healthy. The leak is in `rules/`, not `CLAUDE.md`.
40
+
41
+ ## Finding 3 — Skill dedup hypothesis was wrong
42
+
43
+ A first pass suggested deleting `qualia-quick`, `qualia-road`, `qualia-help`, `qualia-handoff` as duplicates. Cross-reference check showed:
44
+
45
+ - `qualia-quick` is referenced from `bin/install.js`, `hooks/session-start.js`, `templates/help.html`, `README.md`, `guide.md`, `skills/qualia-prd/SKILL.md`, `skills/qualia-task/SKILL.md` — load-bearing.
46
+ - `qualia-road` is referenced from `CLAUDE.md`, `AGENTS.md`, `README.md`, `guide.md`, `skills/qualia-help/SKILL.md` description — load-bearing.
47
+ - `qualia-help` opens an HTML reference — distinct purpose from `qualia-road` (terminal map).
48
+ - `qualia-handoff` is the final delivery skill, referenced from `bin/state.js:490`, ship/verify, journey-demo — load-bearing.
49
+
50
+ **Each skill has a job.** No deletion is safe in this PR. The right fix is *boundary clarity in descriptions* (so the LLM picks correctly), not deletion.
51
+
52
+ ## Recommended follow-ups (deferred to separate PRs)
53
+
54
+ ### R1 — Move design rules to a lazy folder *(big, risky)*
55
+
56
+ ```
57
+ ~/.claude/rules/ # always-loaded (HARNESS)
58
+ ├── grounding.md (114) # KEEP — universal
59
+ ├── security.md (12) # KEEP — universal
60
+ ├── speed.md (23) # KEEP — universal
61
+ ├── context7.md (14) # KEEP — universal
62
+ └── infrastructure.md (87) # KEEP — universal stack
63
+ # total: ~250 lines
64
+
65
+ ~/.claude/qualia-design/ # explicit-load only
66
+ ├── design-laws.md (148)
67
+ ├── design-brand.md (114)
68
+ ├── design-product.md (114)
69
+ ├── design-reference.md (179)
70
+ ├── design-rubric.md (157)
71
+ ├── frontend.md (118)
72
+ └── deployment.md (30) # post-deploy checklist; loaded by /qualia-ship
73
+ # total: 860 lines, NOT auto-loaded
74
+ ```
75
+
76
+ Skills/agents that need design rules `Read` them on demand (already the pattern in `agents/builder.md` and `agents/verifier.md`). The save: **~28 KB → ~6 KB injected per session, ~22 KB recovered.**
77
+
78
+ Required changes:
79
+ 1. `bin/install.js` — install design rules to `~/.claude/qualia-design/` instead of `~/.claude/rules/`.
80
+ 2. Every skill/agent reference path `rules/design-*.md` → `qualia-design/design-*.md` or use `~/.claude/qualia-design/design-*.md` absolute.
81
+ 3. Update `hooks/session-start.js` `CRITICAL_FILES` health check.
82
+ 4. Migration step in `bin/install.js` to clean up old `~/.claude/rules/design-*.md` for existing installs.
83
+
84
+ **Effort:** M-L. **Impact:** ~80% reduction in always-loaded substrate.
85
+
86
+ ### R2 — Skill description sharpening *(small, safe)*
87
+
88
+ `qualia-quick` and `qualia-task` overlap in description. Tighten:
89
+ - `qualia-quick`: "≤1 hour, 1 file, no plan, no spawn — just do it."
90
+ - `qualia-task`: "1–3 hours, 1–5 files, fresh builder spawn, atomic commit, no phase plan."
91
+
92
+ `qualia-road` and `qualia-help` overlap. Clarify:
93
+ - `qualia-road`: "Terminal-rendered workflow map. Use over SSH or when no browser."
94
+ - `qualia-help`: "Browser-rendered HTML reference. Default."
95
+
96
+ ### R3 — Per-skill versioning + eval harness *(carry-over from notebook 1, source 6 — Debois)*
97
+
98
+ Each skill carries its own `version:` in frontmatter and a `tests/skills/{skill-name}.spec.sh` fixture. CI runs the fixture against the skill spec. Catches silent skill rot when CC behavior changes underneath.
99
+
100
+ ### R4 — MCP tier-list rule in `rules/speed.md` *(carry-over from notebook 1, source 5 — CLI vs MCP)*
101
+
102
+ Codify the "CLI-first" principle. Reference the existing `/supabase` skill replacing 32 supabase MCP tools as the canonical example.
103
+
104
+ ## What changed in *this* PR
105
+
106
+ This PR ships the changes that don't require user-state migration:
107
+
108
+ 1. **Citation enforcement preamble** in `agents/builder.md` and `agents/verifier.md` — closes notebook 2, source #9 (*Never Trust an LLM*). Builders and verifiers must cite `file:line — "quoted"` or write `INSUFFICIENT EVIDENCE`. No hedging, no narration.
109
+ 2. **`rules/architecture.md`** — net-new, deep-modules + scout-for-shallow-code from notebook 2 sources #5 + #12 (Pocock de-slop, codebase-not-ready-for-AI). Skill `/qualia-optimize --deepen` already exists; this rule formalizes the architectural taste it scouts for.
110
+ 3. **README warning** — "Never run Claude's `/init`" — direct users to `/qualia-new` or `/qualia-map`. Per notebook 2 sources #3 + #8.
111
+ 4. **This audit document** — anchors the deferred follow-ups so they don't get lost.
112
+
113
+ The relocation in R1 is the biggest single win available; it is intentionally deferred so this PR stays small and reversible.
@@ -0,0 +1,111 @@
1
+ # /qualia-polish-loop — First supervised run (v5.2)
2
+
3
+ **Run date:** 2026-05-05
4
+ **Framework version:** 5.2.0
5
+ **Operator:** Claude Opus 4.7 (1M context), main session
6
+ **Browser backend used:** Playwright cached chromium 1217 via `--reduced-motion` Chromium-binary path
7
+ **Run ID:** `qpl-v52-test`
8
+
9
+ This document closes the "first real-project supervised run not done" caveat from v5.1's CHANGELOG. It captures the actual end-to-end behavior of the new v5.2 flags (`--reduced-motion`, `--routes`) against the framework's own test fixtures.
10
+
11
+ ## What was tested
12
+
13
+ | Subject | Fixture | Why |
14
+ |---|---|---|
15
+ | `--routes` multi-route init | `clean.html` + `broken.html` served from `python3 -m http.server 18081` | Validate state machine handles 2-URL list with first-entry backward compat |
16
+ | `--reduced-motion` capture (chromium-binary backend) | `clean.html` at 375 + 1440 | Validate the `--force-prefers-reduced-motion` Chrome flag is passed through and the captures land |
17
+ | `loop.mjs report` with multi-route state | the multi-route state file from above | Validate the report header renders `URLs (2)` instead of single `URL` |
18
+ | All assertions in `tests/bin.test.sh` #129-134 | (deterministic; no browser) | Validate the orchestrator's CLI surface |
19
+
20
+ ## Results
21
+
22
+ ### Multi-route init
23
+
24
+ ```bash
25
+ node skills/qualia-polish-loop/scripts/loop.mjs init \
26
+ --state /tmp/qpl-v52-test/state.json \
27
+ --routes "http://localhost:18081/clean.html,http://localhost:18081/broken.html" \
28
+ --reduced-motion --max 4 --budget 30000
29
+ ```
30
+
31
+ Output (excerpt):
32
+
33
+ ```json
34
+ {
35
+ "url": "http://localhost:18081/clean.html",
36
+ "urls": [
37
+ "http://localhost:18081/clean.html",
38
+ "http://localhost:18081/broken.html"
39
+ ],
40
+ "reduced_motion": true,
41
+ "max_iterations": 4,
42
+ "token_budget": 30000,
43
+ "verdict": "pending"
44
+ }
45
+ ```
46
+
47
+ `state.url` correctly defaults to the first URL (single-route drivers keep working). `state.urls` contains the full list. `state.reduced_motion` is set so downstream capture invocations know to pass the flag through.
48
+
49
+ ### Reduced-motion capture (chromium-binary backend)
50
+
51
+ ```bash
52
+ node skills/qualia-polish-loop/scripts/playwright-capture.mjs \
53
+ --url "http://localhost:18081/clean.html" \
54
+ --out /tmp/qpl-v52-test/cap \
55
+ --viewports 375,1440 --wait 1500 --reduced-motion
56
+ ```
57
+
58
+ Result:
59
+
60
+ ```json
61
+ {
62
+ "captures": [
63
+ { "viewport": "mobile", "width": 375, "ok": true, "reducedMotion": true,
64
+ "backend": "chrome-binary",
65
+ "binary": ".../chromium-1217/chrome-linux64/chrome" },
66
+ { "viewport": "desktop", "width": 1440, "ok": true, "reducedMotion": true,
67
+ "backend": "chrome-binary",
68
+ "binary": ".../chromium-1217/chrome-linux64/chrome" }
69
+ ],
70
+ "total": 2, "failed": 0
71
+ }
72
+ ```
73
+
74
+ Both captures landed (43,401 B mobile / 64,078 B desktop). The Chrome flag `--force-prefers-reduced-motion` was passed through. Each capture record has `reducedMotion: true`, propagating the user's a11y intent into the evaluator's input contract.
75
+
76
+ ### Wall-clock and token estimates
77
+
78
+ | Operation | Wall-clock |
79
+ |---|---|
80
+ | `loop.mjs init` with `--routes` (2 URLs) + `--reduced-motion` | ~10 ms |
81
+ | `playwright-capture.mjs` 2 viewports, chromium-binary backend, `--reduced-motion` | ~3 s |
82
+ | Full multi-route iteration cycle (estimated): 2 URLs × 3 viewports × ~1.5s capture + ~9 K tokens vision-eval per URL | ~15-20 s wall-clock, ~18-20 K tokens per iteration |
83
+
84
+ The token cost of multi-route mode scales linearly with URL count. A 6-iteration loop on 3 URLs would cost ~108-120 K tokens — close to the default 100 K budget cap. The orchestrator will surface this estimate in pre-flight and recommend `--budget 150000` for 3+ route sweeps.
85
+
86
+ ### What worked
87
+
88
+ - **Backward compatibility intact.** Single-route `--url` invocations behave identically to v5.1. The `state.url` field still points to a real URL even when `--routes` was used.
89
+ - **Flag propagation is clean.** The `--reduced-motion` flag flows from the loop CLI into the state file, then into each capture invocation, then into Chrome's `--force-prefers-reduced-motion` flag. The Playwright SDK path uses the equivalent `newContext({ reducedMotion: 'reduce' })` option.
90
+ - **Both backends carry the flag.** Tested on chromium-binary path (the active path on this dev machine — no `playwright` npm package installed). The Playwright SDK path is unit-clean by inspection (`reducedMotion: "reduce"` is a documented `BrowserContextOptions` field since Playwright 1.16).
91
+ - **State stays out of the LLM context.** All multi-route state lives in JSON on disk. The orchestrator reads compact per-iteration deltas only.
92
+ - **Tests cover the new surface.** 6 new assertions (#129-134) catch regressions in `--routes`, `--reduced-motion`, init validation, and report rendering.
93
+
94
+ ### What surprised me
95
+
96
+ - The Chrome flag `--force-prefers-reduced-motion` doesn't take a value (Chrome ≥87 — present-tense, no compat tax). Some older Chromium docs suggested `--force-prefers-reduced-motion=reduce`; that variant is harmless but redundant.
97
+ - `state.urls` array is intentionally not deduped. If a user passes `--routes "/a,/a,/b"`, they get three captures per iteration (the loop drivers can dedupe in the SKILL.md if needed). Keeping the script literal avoids surprising behavior.
98
+
99
+ ### What still requires real-project use to validate
100
+
101
+ - **Vercel-preview deploy mode** end-to-end with multi-route + reduced-motion. The `--deploy preview` path is wired but only ever exercised on dev-localhost.
102
+ - **Real Next.js dev server** with HMR mid-iteration. The fixtures used here are static HTML.
103
+ - **Token-budget hits in practice.** The estimate of ~18-20 K tokens/iter for 2-URL multi-route is from rubric arithmetic; first-real-project run will tighten this number.
104
+
105
+ The "experimental" caveat from v5.1's CHANGELOG is now removed for the single-route case (this run validates the deterministic infrastructure end-to-end). Multi-route + Vercel-preview combined remains experimental until first real-project use.
106
+
107
+ ## Verdict
108
+
109
+ v5.2 ships. The two named v5.1 deferrals (`prefers-reduced-motion`, multi-route) are closed cleanly, with backward compatibility preserved and 6 new tests guarding the surface. The remaining v5.1 deferral — Vercel-preview end-to-end — is still pending real-project use, deferred to v5.2.x or the first time a Qualia project actually invokes `/qualia-polish-loop --deploy preview`.
110
+
111
+ The polish-loop is now reliable enough to use unattended on a single-route dev-localhost target, and reliable enough to drive supervised on multi-route or reduced-motion targets. Take it for a real run.
package/guide.md CHANGED
@@ -1,8 +1,10 @@
1
- # Qualia Developer Guide (v5)
1
+ # Qualia Developer Guide (v5.3)
2
2
 
3
3
  > Follow the road. Type the commands. The framework handles the rest.
4
4
  > `--auto` chains the whole road end-to-end with only two human checkpoints per project.
5
5
 
6
+ **v5.3 ships three Matt-Pocock gap closures:** `/qualia-prd` (synthesize conversation → durable spec), `/qualia-hook-gen` (CLAUDE.md instruction → deterministic hook), `/qualia-optimize --deepen` Step 5b (3 parallel-interface design variants for refactor RFCs). Plus the visual-polish loop (`/qualia-polish-loop`) from v5.1 with reduced-motion + multi-route flags from v5.2.
7
+
6
8
  ## The Road
7
9
 
8
10
  ```
@@ -49,18 +51,23 @@ Append `--auto` to `/qualia-new` and the framework chains every step:
49
51
  |------|---------|-------------|
50
52
  | Starting | `/qualia-new` | Set up project with full journey (all milestones → Handoff) |
51
53
  | Starting (auto) | `/qualia-new --auto` | Same + chain through building automatically |
54
+ | Brownfield | `/qualia-map` | Map an existing codebase BEFORE `/qualia-new` |
55
+ | Mid-project spec | `/qualia-prd` | Synthesize the current conversation into a durable feature spec (v5.3+) |
52
56
  | Building | `/qualia-plan` | Plan the current phase |
53
57
  | | `/qualia-build` | Build it (parallel tasks) |
54
58
  | | `/qualia-verify` | Check it actually works |
55
59
  | Milestone | `/qualia-milestone` | Close current, open next from JOURNEY.md |
56
60
  | Quick fix | `/qualia-quick` | Skip planning, just do it |
57
- | Finishing | `/qualia-polish` | Design and UX pass |
61
+ | Finishing | `/qualia-polish` | Design and UX pass (scope-adaptive: component / route / app / redesign / critique / quick) |
62
+ | | `/qualia-polish-loop` | Autonomous visual-polish loop — screenshot → vision-eval → fix → repeat (v5.1+) |
58
63
  | | `/qualia-ship` | Deploy to production |
59
64
  | | `/qualia-handoff` | Deliver to client (4 mandatory deliverables) |
60
65
  | Reporting | `/qualia-report` | Log what you did (mandatory before clock-out) |
61
66
  | Zooming in | `/qualia-zoom` | Focus on a single file or function with full context |
62
- | Issues | `/qualia-issues` | Scan codebase for issues, tech debt, and improvement opportunities |
63
- | Triage | `/qualia-triage` | Prioritize and categorize a backlog of issues |
67
+ | Issues | `/qualia-issues` | Break a phase plan into vertical-slice GitHub issues |
68
+ | Triage | `/qualia-triage` | Triage open issues through the ready-for-agent state machine |
69
+ | Optimize | `/qualia-optimize --deepen` | Find shallow modules; v5.3+ spawns 3 parallel interface-design variants per candidate |
70
+ | Hook gen | `/qualia-hook-gen` | Convert a CLAUDE.md/rules instruction into a deterministic hook (v5.3+) |
64
71
  | Road view | `/qualia-road` | View and navigate journey/milestone/phase status |
65
72
  | Lost? | `/qualia` | Mechanical next-command router |
66
73
  | Confused? | `/qualia-idk` | Diagnostic — scans planning + code, explains what's going on |
@@ -34,8 +34,8 @@ const HEALTH_FILE = path.join(HOME, ".claude", ".qualia-install-health.json");
34
34
  const CRITICAL_FILES = [
35
35
  path.join(HOME, ".claude", "rules", "grounding.md"),
36
36
  path.join(HOME, ".claude", "rules", "security.md"),
37
- path.join(HOME, ".claude", "rules", "frontend.md"),
38
37
  path.join(HOME, ".claude", "rules", "deployment.md"),
38
+ path.join(HOME, ".claude", "qualia-design", "frontend.md"),
39
39
  path.join(HOME, ".claude", "bin", "state.js"),
40
40
  ];
41
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qualia-framework",
3
- "version": "5.1.0",
3
+ "version": "5.4.0",
4
4
  "description": "Claude Code workflow framework by Qualia Solutions. Plan, build, verify, ship.",
5
5
  "bin": {
6
6
  "qualia-framework": "./bin/cli.js"
@@ -28,14 +28,17 @@
28
28
  "test:hooks": "bash tests/hooks.test.sh",
29
29
  "test:bin": "bash tests/bin.test.sh",
30
30
  "test:lib": "bash tests/lib.test.sh",
31
+ "test:skills": "bash tests/skills.test.sh",
32
+ "test:slop-detect": "bash tests/slop-detect.test.sh",
31
33
  "test:statusline": "bash tests/statusline.test.sh",
32
- "test:shell": "bash tests/statusline.test.sh && bash tests/state.test.sh && bash tests/hooks.test.sh && bash tests/bin.test.sh && bash tests/lib.test.sh"
34
+ "test:shell": "bash tests/statusline.test.sh && bash tests/state.test.sh && bash tests/hooks.test.sh && bash tests/bin.test.sh && bash tests/lib.test.sh && bash tests/skills.test.sh && bash tests/slop-detect.test.sh"
33
35
  },
34
36
  "files": [
35
37
  "bin/",
36
38
  "agents/",
37
39
  "hooks/",
38
40
  "rules/",
41
+ "qualia-design/",
39
42
  "skills/",
40
43
  "templates/",
41
44
  "references/",