qualia-framework 4.3.0 → 4.5.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 (42) hide show
  1. package/CLAUDE.md +13 -1
  2. package/README.md +16 -13
  3. package/agents/builder.md +12 -20
  4. package/agents/plan-checker.md +18 -0
  5. package/agents/planner.md +9 -0
  6. package/agents/verifier.md +62 -0
  7. package/bin/agent-runs.js +233 -0
  8. package/bin/cli.js +225 -21
  9. package/bin/install.js +25 -5
  10. package/bin/plan-contract.js +220 -0
  11. package/bin/slop-detect.mjs +357 -0
  12. package/bin/state.js +199 -10
  13. package/docs/agent-runs.md +273 -0
  14. package/docs/erp-contract.md +5 -0
  15. package/docs/plan-contract.md +321 -0
  16. package/hooks/auto-update.js +3 -7
  17. package/hooks/pre-compact.js +22 -11
  18. package/hooks/pre-deploy-gate.js +16 -2
  19. package/hooks/pre-push.js +22 -2
  20. package/hooks/stop-session-log.js +1 -1
  21. package/package.json +8 -2
  22. package/rules/design-brand.md +110 -0
  23. package/rules/design-laws.md +144 -0
  24. package/rules/design-product.md +110 -0
  25. package/rules/design-rubric.md +153 -0
  26. package/skills/qualia-build/SKILL.md +5 -5
  27. package/skills/qualia-flush/SKILL.md +1 -1
  28. package/skills/qualia-new/SKILL.md +40 -3
  29. package/skills/qualia-polish/SKILL.md +180 -136
  30. package/skills/qualia-quick/SKILL.md +1 -1
  31. package/skills/qualia-report/SKILL.md +25 -5
  32. package/skills/qualia-ship/SKILL.md +12 -10
  33. package/skills/zoho-workflow/SKILL.md +64 -0
  34. package/templates/DESIGN.md +229 -435
  35. package/templates/PRODUCT.md +95 -0
  36. package/templates/help.html +13 -7
  37. package/tests/bin.test.sh +6 -3
  38. package/tests/hooks.test.sh +9 -20
  39. package/tests/lib.test.sh +217 -0
  40. package/tests/runner.js +96 -75
  41. package/tests/state.test.sh +4 -3
  42. package/skills/qualia-design/SKILL.md +0 -169
@@ -0,0 +1,153 @@
1
+ # Design Rubric
2
+
3
+ Anchored 1-5 scoring across 8 dimensions. Used by the verifier agent to score frontend phases. Used by `/qualia-polish --critique` for read-only audits.
4
+
5
+ ## How to score
6
+
7
+ Every dimension is scored 1-5 with EVIDENCE on the next line. Score without evidence is rejected.
8
+
9
+ Anchored definitions:
10
+ - **1** — Fails. Hard violation. WCAG fails, broken layout, absolute-ban hit.
11
+ - **2** — Below acceptable. Functions but signals "AI generated this."
12
+ - **3** — Acceptable. Ships. Not memorable, not embarrassing.
13
+ - **4** — Good. Specific choices visible. A designer would approve.
14
+ - **5** — Excellent. Distinctive. Worth screenshotting and sharing.
15
+
16
+ **Default to 3.** Only score above 3 if you can cite a specific design principle the work excels at. Only score below 3 if you can quote evidence of a violation.
17
+
18
+ If a vision model is critiquing screenshots, it must score against this rubric. Without anchoring, vision models say "looks great!" to everything.
19
+
20
+ ## Scope guard
21
+
22
+ Score only what is scope-relevant. A `/qualia-polish src/components/Button.tsx` review scores Typography, Color, States, Motion, Microcopy. Skip Layout Originality and Container Depth — they're component-internal concerns at most.
23
+
24
+ A whole-app `/qualia-polish` scores all 8 dimensions across multiple representative routes.
25
+
26
+ ## The 8 dimensions
27
+
28
+ ### 1. Typography
29
+
30
+ | Score | Criteria |
31
+ |---|---|
32
+ | 1 | Inter / Roboto / Arial / system-ui / Space Grotesk as primary. Or single weight throughout. |
33
+ | 2 | Project font loaded but only one weight, no scale, no letter-spacing variation. |
34
+ | 3 | Project font with 2-3 weights, basic scale (h1/h2/body), readable. |
35
+ | 4 | Distinctive display + refined body pair. Letter-spacing varied semantically (tight headlines, open labels). Tabular numerals on numeric data. |
36
+ | 5 | Variable font with axis-driven weight/optical-size. Hierarchy through weight + scale + letter-spacing combined. Line lengths capped at 65-75ch. |
37
+
38
+ Evidence format: `font-family: "<name>" used at line N, scale 14/16/24/40 visible, weights 400/500/700`
39
+
40
+ ### 2. Color cohesion
41
+
42
+ | Score | Criteria |
43
+ |---|---|
44
+ | 1 | Hex values scattered in JSX. No CSS variables. Pure `#000` or `#fff`. |
45
+ | 2 | CSS variables defined but unused (raw hex still appears). RGB used. |
46
+ | 3 | All colors as CSS variables. Tinted neutrals (no pure black/white). One color strategy implied. |
47
+ | 4 | OKLCH throughout. Strategy explicit (Restrained / Committed / Full / Drenched). WCAG AA verified. |
48
+ | 5 | OKLCH with documented strategy. Chroma reduced at extremes. Brand-tinted shadows. APCA contrast verified for dense text. |
49
+
50
+ Evidence: count of CSS custom properties for color, presence of OKLCH, evidence of strategy commitment
51
+
52
+ ### 3. Spatial rhythm
53
+
54
+ | Score | Criteria |
55
+ |---|---|
56
+ | 1 | Arbitrary px values everywhere. No system. |
57
+ | 2 | 8px grid roughly followed. Same padding everywhere. |
58
+ | 3 | 8px grid consistently. Tight within groups, generous between sections. |
59
+ | 4 | Fluid `clamp()` padding. Spacing varies by content type. Vertical rhythm identifiable. |
60
+ | 5 | Spatial system reads as composed — different spacing for different relationships. Generous negative space. Asymmetry where intentional. |
61
+
62
+ Evidence: presence of spacing tokens, padding values divisible by 4, `clamp()` usage
63
+
64
+ ### 4. Layout originality
65
+
66
+ | Score | Criteria |
67
+ |---|---|
68
+ | 1 | Three-column feature grid in section 2. Card grid of 3 identical items. Centered hero with gradient. |
69
+ | 2 | Standard hero + sections + footer. Symmetric throughout. |
70
+ | 3 | Some layout variation across sections. No card monotony. |
71
+ | 4 | Asymmetry, full-bleed, varied component sizes within a section. Negative space used. |
72
+ | 5 | Layout reads as composed by a designer. Diagonal flow, overlap, scale contrast. Each section a different shape. |
73
+
74
+ Evidence: file:line references showing layout choices
75
+
76
+ ### 5. Shadow & depth hierarchy
77
+
78
+ | Score | Criteria |
79
+ |---|---|
80
+ | 1 | Single shadow value applied to everything (or no shadows). Nested cards. |
81
+ | 2 | 2 shadow levels but applied inconsistently. |
82
+ | 3 | 3 elevation levels (subtle / medium / pronounced). Brand-tinted, not pure gray. |
83
+ | 4 | Shadows match elevation semantically. Different shadow for hover than rest. |
84
+ | 5 | Multi-layer shadows (offset + ambient + directional). Brand-hue tinted at chroma 0.02-0.04. Spatial logic clear. |
85
+
86
+ Evidence: count of distinct `box-shadow` values, OKLCH chroma in shadow color
87
+
88
+ ### 6. Motion intent
89
+
90
+ | Score | Criteria |
91
+ |---|---|
92
+ | 1 | No transitions. Or: bounce/elastic everywhere. Animates layout properties. |
93
+ | 2 | Default browser transitions on hover. No stagger. |
94
+ | 3 | Considered transitions on interactive elements. Respects `prefers-reduced-motion`. |
95
+ | 4 | One signature motion identified and executed. Stagger on entrance. Easing curves chosen (ease-out-quart or expo). |
96
+ | 5 | Orchestrated motion that communicates structure. Scroll-driven if appropriate. Restraint elsewhere. |
97
+
98
+ Evidence: easing curves used, presence of `prefers-reduced-motion`, file:line of signature motion
99
+
100
+ ### 7. Microcopy specificity
101
+
102
+ | Score | Criteria |
103
+ |---|---|
104
+ | 1 | "Get Started" / "Learn More" / "Welcome to <product>" / "Click here". Lorem ipsum. |
105
+ | 2 | Generic but functional ("Save", "Cancel", "Submit"). Empty states say "No results." |
106
+ | 3 | Action-named CTAs ("Download invoice"). Empty states with one-sentence context. |
107
+ | 4 | Voice consistent with brand. Errors specific and actionable ("This file is 12MB; max is 10MB. Compress and retry."). |
108
+ | 5 | Microcopy you'd quote. Voice unmistakable. Every word earned. |
109
+
110
+ Evidence: grep for banned phrases, sample of empty/error states
111
+
112
+ ### 8. Container depth & nesting
113
+
114
+ | Score | Criteria |
115
+ |---|---|
116
+ | 1 | Card → panel → pill → content (depth ≥ 4). Side-stripe borders. Gradient text. |
117
+ | 2 | Card-on-card pattern (depth 3). Most things wrapped in containers. |
118
+ | 3 | Container depth ≤ 2. No decorative side-stripes. |
119
+ | 4 | Containers used semantically only. Things that don't need a container don't have one. |
120
+ | 5 | Layout reads as elements arranged on a surface, not boxes inside boxes. |
121
+
122
+ Evidence: max DOM nesting depth on cards/panels, grep for `border-left` decorative usage
123
+
124
+ ## Aggregate score
125
+
126
+ ```
127
+ total = sum of dimension scores (max 40)
128
+ average = total / count_of_scored_dimensions
129
+ phase_pass = ALL scored dimensions ≥ 3
130
+ phase_fail = ANY scored dimension < 3
131
+ ```
132
+
133
+ A phase fails if any dimension is below 3. Same gate as functional verification.
134
+
135
+ ## Output format (verifier agent contract)
136
+
137
+ ```markdown
138
+ ## Design Rubric — Phase {N}
139
+
140
+ | Dim | Score | Evidence |
141
+ |---|---|---|
142
+ | Typography | 4 | `app/page.tsx:14` Fraunces + JetBrains Mono pair, weights 400/500/700, clamp() scale visible |
143
+ | Color cohesion | 3 | All CSS vars in `app/globals.css:8-22`. OKLCH used. Strategy: Restrained. WCAG AA verified |
144
+ | Spatial rhythm | 5 | Fluid clamp padding throughout, varied within section, generous between |
145
+ | Layout originality | 2 | `app/page.tsx:42-78` is a three-column feature grid in section 2 — first-order slop. Rework. |
146
+ | ... | ... | ... |
147
+
148
+ **Aggregate:** 28/40 (avg 3.5)
149
+ **Phase verdict:** FAIL — Layout Originality at 2 blocks the phase.
150
+ **Fix priority:** Rework section 2. Replace three-column grid with varied-height layout per `design-brand.md` §Layout.
151
+ ```
152
+
153
+ If the score < 3, the verifier writes the diagnosis. The fix is the next builder's task.
@@ -32,9 +32,9 @@ cat .planning/phase-{N}-plan.md
32
32
 
33
33
  Parse: tasks, waves, file references.
34
34
 
35
- ### 1b. Create Recovery Point
35
+ ### 1b. Create Recovery Reference
36
36
 
37
- Before executing any tasks, tag current HEAD for rollback:
37
+ Before executing any tasks, record current HEAD for diagnosis. This is a reference, not an automatic rollback instruction.
38
38
 
39
39
  ```bash
40
40
  git tag -f "pre-build-phase-{N}" HEAD 2>/dev/null
@@ -44,10 +44,10 @@ git tag -f "pre-build-phase-{N}" HEAD 2>/dev/null
44
44
  node ~/.claude/bin/qualia-ui.js info "Recovery point: pre-build-phase-{N}"
45
45
  ```
46
46
 
47
- If a wave fails and the user needs to roll back:
47
+ If a wave fails, stop and inspect `git status` plus the failed task output. Do not run destructive rollback commands automatically. Preserve user work, then either fix forward or ask before reverting specific files.
48
48
  ```bash
49
- git reset --hard pre-build-phase-{N}
50
- node ~/.claude/bin/state.js transition --to planned --force
49
+ git status --short
50
+ git diff --stat
51
51
  ```
52
52
 
53
53
  ### 2. Execute Waves
@@ -30,7 +30,7 @@ the same — manually-triggered, internal-data only, no vector DB.
30
30
  - **Manually:** `/qualia-flush` whenever the daily-log feels rich. Once a week
31
31
  is the recommended cadence. More than once a day is wasteful — the
32
32
  signal-to-noise ratio is too low at single-day windows.
33
- - **Automatically:** not yet wired. v4.3.0 will add a cron-friendly
33
+ - **CLI runner:** `qualia-framework flush` wraps the cron-friendly
34
34
  `bin/knowledge-flush.js` non-interactive runner.
35
35
 
36
36
  ## Inputs
@@ -107,6 +107,25 @@ git add .planning/PROJECT.md
107
107
  git commit -m "docs: initialize project"
108
108
  ```
109
109
 
110
+ ### Step 5b. Write PRODUCT.md (v4.5.0 — REQUIRED)
111
+
112
+ `PRODUCT.md` is the "who and why" every road agent reads before designing or building. It is **required** — the planner, builder, and verifier all load it as substrate.
113
+
114
+ Ask the user 5 short questions (one at a time, each with a sensible default they can `[Enter]` past):
115
+
116
+ 1. **Register** — "Is this design IS the product (marketing/landing/portfolio → `brand`) or design SERVES the product (app/admin/dashboard → `product`)?" Default: infer from project type.
117
+ 2. **Three users** — "Name 3 specific humans who will use this. Not personas — real names + their workflow scenario." Default: project type defaults.
118
+ 3. **Brand voice** — "Three adjectives, then one paragraph showing the voice in motion (an error message, a confirmation, an empty state)." Default: derive from PROJECT.md.
119
+ 4. **Anti-references** — "Three sites this should NOT look like, with why." Required, no defaults — anti-references are more useful than positive references.
120
+ 5. **One-sentence differentiation** — "What does someone remember 24 hours after first using this?" Required.
121
+
122
+ Write `.planning/PRODUCT.md` from `templates/PRODUCT.md`, filling the user's answers.
123
+
124
+ ```bash
125
+ git add .planning/PRODUCT.md
126
+ git commit -m "docs: PRODUCT.md — register, users, voice, anti-references"
127
+ ```
128
+
110
129
  ### Step 6. Create config.json
111
130
 
112
131
  ```json
@@ -124,13 +143,31 @@ git commit -m "docs: initialize project"
124
143
 
125
144
  **Note:** `workflow.research` is ALWAYS `true` for v4. It exists for telemetry but is no longer read as a gate.
126
145
 
127
- ### Step 7. Create DESIGN.md (frontend projects)
146
+ ### Step 7. Create DESIGN.md (frontend projects — v4.5.0 OKLCH-first)
147
+
148
+ 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):
149
+
150
+ 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).
151
+ 2. **Color strategy** — pick ONE: `Restrained · Committed · Full palette · Drenched`. See `rules/design-laws.md` §2.
152
+ 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.
153
+ 4. **Differentiation** — one sentence: what someone remembers 24 hours later.
154
+
155
+ Then fill the rest of DESIGN.md:
156
+ - §2 Color: OKLCH only, no `#000`/`#fff`, neutrals tinted toward brand hue (chroma 0.005-0.015), accent within the chosen strategy
157
+ - §3 Typography: distinctive display + refined body pair. **NEVER** Inter, Roboto, Arial, Helvetica, system-ui, Space Grotesk
158
+ - §4 Spacing: 8px grid + fluid `clamp()` for page padding
159
+ - §5 Components: token-driven button/input/card/table specs
160
+ - §6 Depth: 3-level shadow elevation, OKLCH-tinted (not gray)
161
+ - §7 Motion: easing tokens (ease-out-quart/expo), no bounce, `prefers-reduced-motion` respected
162
+ - §8 Iconography: ONE family
163
+ - §9 Responsive: mobile-first
164
+ - §10 Anti-pattern checklist (the auto-runnable one)
128
165
 
129
- If frontend work is involved, generate `.planning/DESIGN.md` from the template with concrete palette, distinctive typography (NEVER Inter/Roboto/system-ui), 8px spacing grid, motion approach, component patterns.
166
+ Cross-check the result against `rules/design-laws.md` §8 absolute bans BEFORE writing the design must not propose any banned pattern.
130
167
 
131
168
  ```bash
132
169
  git add .planning/DESIGN.md .planning/config.json
133
- git commit -m "docs: design direction + config"
170
+ git commit -m "docs: DESIGN.md direction commit + OKLCH palette + tokens"
134
171
  ```
135
172
 
136
173
  ### Step 8. Run Research (ALWAYS, no permission ask)