qualia-framework 5.4.0 → 5.8.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 (50) hide show
  1. package/README.md +21 -17
  2. package/agents/builder.md +25 -8
  3. package/agents/plan-checker.md +50 -2
  4. package/agents/planner.md +25 -1
  5. package/agents/research-synthesizer.md +4 -1
  6. package/agents/researcher.md +6 -1
  7. package/agents/visual-evaluator.md +1 -1
  8. package/bin/install.js +8 -8
  9. package/bin/plan-contract.js +32 -1
  10. package/bin/slop-detect.mjs +1 -1
  11. package/docs/erp-contract.md +11 -0
  12. package/docs/onboarding.html +623 -0
  13. package/guide.md +8 -9
  14. package/hooks/session-start.js +1 -1
  15. package/package.json +1 -1
  16. package/skills/qualia-discuss/SKILL.md +123 -9
  17. package/skills/qualia-feature/SKILL.md +216 -0
  18. package/skills/qualia-milestone/SKILL.md +73 -1
  19. package/skills/qualia-new/SKILL.md +52 -25
  20. package/skills/qualia-optimize/SKILL.md +1 -1
  21. package/skills/{qualia-polish-loop → qualia-polish}/REFERENCE.md +5 -5
  22. package/skills/qualia-polish/SKILL.md +13 -4
  23. package/skills/{qualia-polish-loop → qualia-polish}/scripts/loop.mjs +2 -2
  24. package/skills/{qualia-polish-loop → qualia-polish}/scripts/playwright-capture.mjs +1 -1
  25. package/skills/qualia-report/SKILL.md +8 -6
  26. package/skills/qualia-road/SKILL.md +10 -11
  27. package/templates/CONTEXT.md +3 -2
  28. package/templates/help.html +1 -1
  29. package/templates/phase-context.md +5 -4
  30. package/templates/project-discovery.md +83 -0
  31. package/templates/project.md +7 -0
  32. package/tests/bin.test.sh +104 -62
  33. package/tests/lib.test.sh +21 -0
  34. package/tests/slop-detect.test.sh +2 -2
  35. package/docs/archive/session-report-2026-04-18.md +0 -199
  36. package/docs/install-redesign-builder-prompt.md +0 -290
  37. package/docs/install-redesign-pilot.md +0 -234
  38. package/docs/instruction-budget-audit.md +0 -113
  39. package/docs/journey-demo.html +0 -1008
  40. package/docs/playwright-loop-builder-prompt.md +0 -185
  41. package/docs/playwright-loop-design-notes.md +0 -108
  42. package/docs/playwright-loop-tester-prompt.md +0 -213
  43. package/docs/polish-loop-supervised-run.md +0 -111
  44. package/skills/qualia-polish-loop/SKILL.md +0 -201
  45. package/skills/qualia-prd/SKILL.md +0 -199
  46. package/skills/qualia-quick/SKILL.md +0 -44
  47. package/skills/qualia-task/SKILL.md +0 -98
  48. /package/skills/{qualia-polish-loop → qualia-polish}/fixtures/broken.html +0 -0
  49. /package/skills/{qualia-polish-loop → qualia-polish}/fixtures/clean.html +0 -0
  50. /package/skills/{qualia-polish-loop → qualia-polish}/scripts/score.mjs +0 -0
@@ -1,4 +1,4 @@
1
- # REFERENCE — /qualia-polish-loop
1
+ # REFERENCE — /qualia-polish --loop
2
2
 
3
3
  Verbatim agent prompts and operational details. Loaded on demand by SKILL.md, not carried in the system prompt. Per progressive-disclosure discipline (Matt Pocock): the agent reads SKILL.md first, then this file when it needs the spawn templates.
4
4
 
@@ -104,7 +104,7 @@ Agent({
104
104
  Role: @~/.claude/agents/builder.md
105
105
 
106
106
  <phase_context>
107
- You are inside /qualia-polish-loop iteration {N}. The vision evaluator scored
107
+ You are inside /qualia-polish --loop iteration {N}. The vision evaluator scored
108
108
  the {dim} dimension at {score}. Your single task: fix that one dimension.
109
109
 
110
110
  <design>
@@ -133,7 +133,7 @@ the {dim} dimension at {score}. Your single task: fix that one dimension.
133
133
  2. Make the MINIMUM edit to fix this one dimension. Do not refactor. Do not change logic. Do not touch state management. Do not change copy unless this is a microcopy issue.
134
134
  3. Use design tokens from DESIGN.md. Do not invent new color values, font names, or spacing.
135
135
  4. After the edit, commit via the orchestrator (slop-detect-gated):
136
- node ~/.claude/skills/qualia-polish-loop/scripts/loop.mjs commit-fix --state {STATE} --file {file} --slug {dim}-{short-keyword}
136
+ node ~/.claude/skills/qualia-polish/scripts/loop.mjs commit-fix --state {STATE} --file {file} --slug {dim}-{short-keyword}
137
137
  If slop-detect blocks (exit 2), READ the slop output and re-edit. If you cannot fix without violating slop-detect, return BLOCKED with the conflict.
138
138
  5. Return DONE with: file modified, lines changed, slop-detect: pass, commit: {sha}.
139
139
  </task>
@@ -260,6 +260,6 @@ This is intentional. Most visual regressions Fawzi has documented in `/insights`
260
260
 
261
261
  - Cross-browser rendering checks (Firefox / WebKit) — Chromium-only, per `qualia-polish` Stage 4 precedent
262
262
  - Accessibility audits beyond what the rubric scores — use `/qualia-polish` Stage 3 (Lighthouse + axe) for that
263
- - Performance regressions — use `/qualia-polish-loop` only after Lighthouse score passes
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) — currently the brief is required; reference is supplemental
265
- - Multi-page sweeps — one URL per invocation; chain `/qualia-polish-loop` per route for site-wide passes
265
+ - Multi-page sweeps — one URL per invocation; chain `/qualia-polish --loop` per route for site-wide passes
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-polish
3
- description: "Scope-adaptive design pass works on a single component, a route, the whole app, or a ground-up redesign. Trigger on 'polish', 'design pass', 'fix the design', 'redesign', 'critique', 'audit design', 'looks ugly', 'make it look better'. Replaces both /qualia-polish and /qualia-design from earlier versions."
3
+ description: "Scope-adaptive design pass. Works on a single component, a route, the whole app, a ground-up redesign, or an autonomous visual loop. 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'. Replaces /qualia-polish-loop (now /qualia-polish --loop) and /qualia-design from earlier versions."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -9,12 +9,12 @@ allowed-tools:
9
9
  - Grep
10
10
  - Glob
11
11
  - Agent
12
- argument-hint: "[file|route|--redesign|--critique|--quick] [--register=brand|product]"
12
+ argument-hint: "[file|route|--redesign|--critique|--quick|--loop] [--register=brand|product] [--brief PATH] [--max 8] [--viewports 375,768,1440]"
13
13
  ---
14
14
 
15
15
  # /qualia-polish — Scope-Adaptive Design Pass
16
16
 
17
- One command. Six scopes. Use it whenever you need design work from a 30-second component touch-up to a 30-minute ground-up redesign.
17
+ One command. Seven scopes. Use it whenever you need design work, from a 30-second component touch-up to a 30-minute ground-up redesign to a fully autonomous see-fix-verify loop.
18
18
 
19
19
  ## Scopes
20
20
 
@@ -28,8 +28,17 @@ The first argument selects the scope. Stage selection follows from scope.
28
28
  | `/qualia-polish --redesign` | **Redesign** | ~30m | all + Stage 1 mandatory + 2 vision iterations |
29
29
  | `/qualia-polish --critique` | **Critique** | read-only | 0, 4, 5 (no edits) |
30
30
  | `/qualia-polish --quick` | **Quick** | ~1m | 0, 2, 7 (gates only, no vision loop) |
31
+ | `/qualia-polish --loop {url}` | **Loop** | ~5-15m | autonomous see/fix/verify, max 8 iterations |
31
32
 
32
- Other flags: `--register=brand|product` to override register inference.
33
+ Other flags: `--register=brand|product` overrides register inference. Loop-specific flags: `--brief PATH`, `--max N`, `--viewports 375,768,1440`, `--ref PATH`, `--budget 100000`.
34
+
35
+ ## --loop mode (autonomous visual loop)
36
+
37
+ When `--loop` is the first flag, the polish run is fully autonomous: screenshot a live URL at three viewports, score 8 design dimensions of `qualia-design/design-rubric.md` against the brief using vision, fix top issues in the codebase, re-screenshot, repeat until every dimension scores ≥ 3 or the kill-switch fires (regression, budget cap, max iterations).
38
+
39
+ This is the surface formerly known as `/qualia-polish-loop` (consolidated into a flag in v5.8.0). The scripts ship at `skills/qualia-polish/scripts/{loop,playwright-capture,score}.mjs`; vision evaluator is `agents/visual-evaluator.md`; full loop spec lives in this skill's `REFERENCE.md`.
40
+
41
+ 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.
33
42
 
34
43
  ## Setup gates (non-optional, every scope)
35
44
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * loop.mjs — orchestrator state-machine for /qualia-polish-loop.
3
+ * loop.mjs — orchestrator state-machine for /qualia-polish --loop.
4
4
  *
5
5
  * Claude (the parent session) drives the loop by issuing CLI commands. This
6
6
  * script keeps the deterministic state — iteration counter, regression
@@ -294,7 +294,7 @@ switch (cmd) {
294
294
  case "--help":
295
295
  case "-h":
296
296
  case undefined:
297
- console.log(`loop.mjs — orchestrator for /qualia-polish-loop
297
+ console.log(`loop.mjs — orchestrator for /qualia-polish --loop
298
298
 
299
299
  Commands:
300
300
  init --state PATH (--url URL | --routes URL1,URL2,...) [--brief PATH] [--ref PATH] [--max 8] [--budget 100000] [--reduced-motion]
@@ -36,7 +36,7 @@ function parseArgs() {
36
36
  } else if (a === "--wait" && argv[i + 1]) args.wait = parseInt(argv[++i], 10);
37
37
  else if (a === "--reduced-motion") args.reducedMotion = true;
38
38
  else if (a === "--help" || a === "-h") {
39
- console.log(`playwright-capture.mjs — Screenshot capture for /qualia-polish-loop
39
+ console.log(`playwright-capture.mjs — Screenshot capture for /qualia-polish --loop
40
40
 
41
41
  Usage:
42
42
  node playwright-capture.mjs --url <url> --out <dir> [--viewports 375,768,1440] [--wait 1500] [--reduced-motion]
@@ -9,9 +9,11 @@ allowed-tools:
9
9
  - AskUserQuestion
10
10
  ---
11
11
 
12
- # /qualia-report — Daily Clock-Out Report
12
+ # /qualia-report — Daily Shift Report
13
13
 
14
- The end-of-day flow. Generates a report, commits it, pushes, uploads to the ERP, and tells the employee they can stop. Designed so Hasan and Moayad never get stuck on it.
14
+ The end-of-day clock-out flow. Generates a shift report, commits it, pushes, uploads to the ERP, and tells the employee they can stop. Designed so Hasan and Moayad never get stuck on it.
15
+
16
+ This is not a task-completion ceremony. The report records what happened during the employee's fixed work shift: shipped work, partial progress, blockers, investigation, meetings, or no-code work. A valid report can say "not finished yet" as long as it clearly explains the shift outcome and next step.
15
17
 
16
18
  ## Flags
17
19
  - `/qualia-report` — normal flow (generate, commit, push, upload to ERP)
@@ -60,18 +62,18 @@ None. ← or list 1–N actual blockers (NOT "had to read docs" — that's nor
60
62
  2. ...
61
63
  ```
62
64
 
63
- **If `COUNT == 0`** — ask the employee gracefully (don't force a fake report):
65
+ **If `COUNT == 0`** — ask the employee gracefully (don't force a fake report or fake completed task):
64
66
 
65
67
  Use `AskUserQuestion`:
66
68
  - header: "Empty day?"
67
- - question: "No commits in the last 8 hours. What did you do today?"
69
+ - question: "No commits in the last 8 hours. What happened during your shift?"
68
70
  - options:
69
71
  - "Investigation / research only"
70
72
  - "Meetings / calls (no code)"
71
73
  - "Blocked — tell me on what"
72
74
  - "Time off / partial day"
73
75
 
74
- Capture the answer as the report body. Empty days are still valid clock-outs — the ERP needs to see them.
76
+ Capture the answer as the report body. Empty days and unfinished work are still valid clock-outs — the ERP needs a truthful employee submission date and shift summary.
75
77
 
76
78
  ### Step 3 — Write report file
77
79
 
@@ -139,7 +141,7 @@ fi
139
141
 
140
142
  node ~/.claude/bin/qualia-ui.js divider
141
143
  node ~/.claude/bin/qualia-ui.js ok "Report $CLIENT_REPORT_ID complete."
142
- node ~/.claude/bin/qualia-ui.js info "You can clock out now. See you tomorrow."
144
+ node ~/.claude/bin/qualia-ui.js info "Shift report submitted. You can clock out now."
143
145
  ```
144
146
 
145
147
  ## Common errors (read this when something goes wrong)
@@ -45,23 +45,22 @@ 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+, hardened in v5.2)
48
+ ## /qualia-polish --loop -- autonomous visual QA (v5.1+, consolidated into /qualia-polish in v5.8)
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
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+)
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
54
+ /qualia-polish --loop --routes /a,/b,/c multi-route sweep
55
55
  ```
56
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.
57
57
 
58
- ## v5.3+ skills (Matt Pocock gaps closed)
58
+ ## v5.3+ skills
59
59
  ```
60
- /qualia-prd synthesize current conversation → .planning/PRD-{slug}.md (durable feature spec)
61
60
  /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)
61
+ /qualia-optimize --deepen spawns 3 parallel interface-design variants per candidate (Step 5b)
63
62
  ```
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.
63
+ `/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
64
 
66
65
  ## Alignment substrate (v5.0+)
67
66
  Before high-stakes phases, run alignment skills against `.planning/CONTEXT.md` (domain glossary) and `.planning/decisions/` (ADRs):
@@ -80,7 +79,7 @@ Before high-stakes phases, run alignment skills against `.planning/CONTEXT.md` (
80
79
  ```
81
80
  Lost? → /qualia (state router — tells you the next command)
82
81
  Stuck/weird? → /qualia-idk (diagnostic — spawns plan-view + code-view agents in parallel)
83
- Quick fix? → /qualia-quick (skip planning for small tasks)
82
+ Single feature? → /qualia-feature (auto-scoped: inline for trivia, fresh spawn for 1-5 files)
84
83
  Paused? → /qualia-resume (restore from .continue-here.md or STATE.md)
85
84
  End of day? → /qualia-report (mandatory before clock-out; writes ERP payload)
86
85
  Debug bug? → /qualia-debug (feedback-loop-first investigation)
@@ -18,14 +18,15 @@ A unit of work inside a milestone. 2–5 tasks. Ends in a verification gate.
18
18
  **Avoid:** epic, story, ticket, sprint.
19
19
 
20
20
  ### Task
21
- A single commit-sized unit with one verification contract.
22
- **Avoid:** subtask, chore, todo.
21
+ A framework-internal execution unit: one commit-sized work item with one verification contract.
22
+ **Avoid:** using "task" as an ERP assignment or employee performance label unless the product domain explicitly needs it.
23
23
 
24
24
  ## Relationships
25
25
  - Project holds many Milestones
26
26
  - Milestone holds many Phases
27
27
  - Phase holds many Tasks
28
28
  - Task carries one Verification Contract
29
+ - ERP tracks project deadlines, milestone deadlines, and employee shift submissions; framework tasks stay internal.
29
30
  - {{add domain-specific relationships, e.g. "Customer holds many Orders"}}
30
31
 
31
32
  ## Flagged ambiguities
@@ -479,7 +479,7 @@
479
479
  <li><span class="rule-icon">1</span> Feature branches by default &mdash; OWNER overrides must be explicit</li>
480
480
  <li><span class="rule-icon">2</span> Read before write &mdash; understand files before editing</li>
481
481
  <li><span class="rule-icon">3</span> MVP first &mdash; build what's asked, nothing extra</li>
482
- <li><span class="rule-icon">4</span> /qualia-report before clock-out &mdash; mandatory, enforced by ERP</li>
482
+ <li><span class="rule-icon">4</span> /qualia-report before clock-out &mdash; mandatory shift submission in ERP</li>
483
483
  <li><span class="rule-icon">5</span> Secrets through approved flows &mdash; use set-erp-key or ask Fawzi</li>
484
484
  <li><span class="rule-icon">6</span> Stuck 30+ minutes? Ask Fawzi</li>
485
485
  </ul>
@@ -13,11 +13,12 @@ Captured during `/qualia-discuss {N}` — decisions, trade-offs, and constraints
13
13
 
14
14
  ## Locked Decisions
15
15
 
16
- Non-negotiable choices. Planner must honor these exactly.
16
+ Non-negotiable choices. Planner must honor these exactly. Every row has a stable ID (`D-NN`) — the planner's Decision Coverage Audit checks each is implemented; the plan-checker BLOCKS if any is missing.
17
17
 
18
- | Decision | Rationale | Source |
19
- |----------|-----------|--------|
20
- | {e.g., "Use Supabase RLS for authorization, not middleware"} | {e.g., "Client compliance requires database-level checks"} | {who/when} |
18
+ | ID | Decision | Rationale | Source |
19
+ |----|----------|-----------|--------|
20
+ | D-01 | {e.g., "Use Supabase RLS for authorization, not middleware"} | {e.g., "Client compliance requires database-level checks"} | {who/when} |
21
+ | D-02 | {next decision} | {rationale} | {source} |
21
22
 
22
23
  ## Discretion (Planner Chooses)
23
24
 
@@ -0,0 +1,83 @@
1
+ ---
2
+ project_type: {demo or full}
3
+ discovered_at: {YYYY-MM-DD}
4
+ discovery_mode: project
5
+ ---
6
+
7
+ # Project Discovery, {Project Name}
8
+
9
+ The non-technical kickoff interview output. `/qualia-discuss` writes this in PROJECT MODE before `/qualia-new` generates JOURNEY.md. Captures intent, audience, brand, and constraints in the user's own words.
10
+
11
+ Demo path: 8 questions. Full-project path: 14 questions.
12
+
13
+ ## 1. The one-line pitch
14
+
15
+ > {What is this thing, in one sentence a stranger would understand?}
16
+
17
+ ## 2. Who is it for
18
+
19
+ > {Name three real humans who will use this. Not personas, real names plus their scenario.}
20
+
21
+ ## 3. The "remember 24 hours later" sentence
22
+
23
+ > {What does someone remember 24 hours after first using this?}
24
+
25
+ ## 4. Three anti-references
26
+
27
+ > {Three sites or apps this should NOT look like, with one-line reasons each.}
28
+
29
+ ## 5. Brand voice
30
+
31
+ > {Three adjectives, then one paragraph of voice in motion — an error message, a confirmation, an empty state.}
32
+
33
+ ## 6. Success criterion
34
+
35
+ > {How does the client know this worked? One observable outcome.}
36
+
37
+ ## 7. Hard constraints
38
+
39
+ > {Anything that is non-negotiable: stack, deadline, compliance, integrations, budget.}
40
+
41
+ ## 8. Out of scope
42
+
43
+ > {What is intentionally NOT in this project, even if it would be obvious to add.}
44
+
45
+ ---
46
+
47
+ The remaining six questions only run for `project_type: full`. Demo mode stops here.
48
+
49
+ ## 9. Milestone arc, in the client's words
50
+
51
+ > {After the demo, what's the next chapter? After that, what's the chapter after? Stop at three to five chapters total. The last chapter is always Handoff.}
52
+
53
+ ## 10. Compliance and legal
54
+
55
+ > {Anything regulated: payments, medical, legal, finance, accessibility commitments, data residency.}
56
+
57
+ ## 11. Integrations
58
+
59
+ > {Third-party systems this must talk to, in priority order.}
60
+
61
+ ## 12. Content and copy
62
+
63
+ > {Who writes the copy and where does it live, today and after handoff?}
64
+
65
+ ## 13. Team and roles after handoff
66
+
67
+ > {Who maintains this after we ship? What can they do, what can't they do?}
68
+
69
+ ## 14. Budget and timeline shape
70
+
71
+ > {Fixed deadline, fixed scope, or fixed budget? Pick one — the other two flex.}
72
+
73
+ ---
74
+
75
+ ## How this feeds `/qualia-new`
76
+
77
+ - §1-§5 seed PROJECT.md (one-line pitch, what we're building) and PRODUCT.md (users, register, voice, anti-references).
78
+ - §6 becomes the first row of the success-criteria table in ROADMAP.md.
79
+ - §7-§8 populate PROJECT.md's "Out of Scope" and the constraints section.
80
+ - §9 (full only) seeds JOURNEY.md milestone names + "why now" lines.
81
+ - §10-§14 (full only) feed research scoping and the Handoff milestone checklist.
82
+
83
+ Demo projects skip §9-§14 because they ARE one milestone — the journey is just that milestone plus an implicit "client signs, we extend" branch handled by `/qualia-milestone`.
@@ -1,8 +1,15 @@
1
+ ---
2
+ project_type: full
3
+ ---
4
+
1
5
  # {Project Name}
2
6
 
3
7
  ## Client
4
8
  {client name}
5
9
 
10
+ ## Project Type
11
+ {demo or full — demo is a single shippable milestone for a sales conversation; full is the multi-milestone arc to Handoff}
12
+
6
13
  ## What We're Building
7
14
  {description}
8
15