qualia-framework 4.0.5 → 4.1.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.
@@ -1,93 +1,185 @@
1
1
  ---
2
2
  name: qualia-debug
3
- description: "Structured debugging — symptom gathering, diagnosis confirmation, root cause analysis. Trigger on 'debug', 'find bug', 'fix error', 'something is broken', 'not working', 'weird behavior', 'layout broken', 'CSS issue', 'slow page', 'performance'."
3
+ description: "Investigative debugging — parses symptom from arguments, runs diagnostic scans, identifies root cause, applies minimal fix, writes DEBUG report. Trigger on 'debug', 'find bug', 'fix error', 'something is broken', 'not working', 'weird behavior', 'layout broken', 'CSS issue', 'slow page', 'performance'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
7
+ - Edit
8
+ - Write
7
9
  - Grep
8
10
  - Glob
9
11
  - Agent
10
12
  ---
11
13
 
12
- # /qualia-debug — Structured Debugging
14
+ # /qualia-debug — Investigative Debugging (one-shot)
13
15
 
14
- Systematic debugging. Don't guess gather symptoms, confirm diagnosis, then fix.
16
+ Parse the symptom. Run diagnostics. Find root cause. Apply minimal fix. Write report. **One-shot — no mandatory user questions.**
15
17
 
16
18
  ## Usage
17
19
 
18
- - `/qualia-debug` — Interactive (gather symptoms, diagnose, fix)
19
- - `/qualia-debug --frontend` — CSS/layout/visual issues
20
- - `/qualia-debug --perf` — Performance issues
20
+ - `/qualia-debug {symptom}` — investigate a specific symptom
21
+ - `/qualia-debug` — no symptom given: investigate recently-changed files for obvious bugs
22
+ - `/qualia-debug --frontend {symptom}` — layout/z-index/overflow bias
23
+ - `/qualia-debug --perf {symptom}` — performance bias
21
24
 
22
- ## Interactive Mode (Default)
25
+ ## Tool Budget
26
+
27
+ Max 10 Read/Grep/Bash calls for investigation. If you haven't narrowed to root cause in 10, return `INSUFFICIENT EVIDENCE after 10 steps. Narrowed to: {files}. Recommend: {next diagnostic}.` Do not keep guessing.
28
+
29
+ ## Process
23
30
 
24
31
  ```bash
25
32
  node ~/.claude/bin/qualia-ui.js banner debug
26
33
  ```
27
34
 
28
- ### 0. Check Known Fixes First
35
+ ### 1. Parse Symptom from $ARGUMENTS
36
+
37
+ - If arguments provided → that's the symptom. Extract: what's broken, where (file/page/feature), when (on click? on load? after change?).
38
+ - If arguments empty → run `git diff HEAD~3 --stat` to find recently-touched files. Treat those as the suspect set. Symptom = "something in recent changes".
39
+
40
+ ### 2. Check Known Fixes First (cheap)
41
+
42
+ ```bash
43
+ cat ~/.claude/knowledge/common-fixes.md 2>/dev/null | grep -i "{symptom_keywords}"
44
+ ```
45
+
46
+ If a known fix matches, apply it and jump to step 5 (verify). Known fixes are pre-verified patterns — no need to re-investigate.
47
+
48
+ ### 3. Diagnostic Scan
49
+
50
+ Run the scan matching the symptom type. All commands in a scan block run as parallel Bash calls in a single response turn.
51
+
52
+ **General mode (default):**
53
+ ```bash
54
+ # Compile errors
55
+ npx tsc --noEmit 2>&1 | grep "error TS" | head -20
56
+
57
+ # Empty catch / swallowed errors
58
+ grep -rn "catch\s*{}\|catch\s*(.*)\s*{\s*}" --include="*.ts" --include="*.tsx" app/ components/ src/ lib/ 2>/dev/null | head -10
59
+
60
+ # Recent console.error or thrown errors
61
+ grep -rn "console\.error\|throw new" --include="*.ts" --include="*.tsx" app/ components/ src/ lib/ 2>/dev/null | head -10
62
+
63
+ # Broken imports
64
+ npx tsc --noEmit 2>&1 | grep -i "Cannot find module\|has no exported"
65
+ ```
66
+
67
+ **Frontend mode (`--frontend`):**
68
+ ```bash
69
+ # Stacking context audit (z-index issues)
70
+ grep -rn "z-index\|z-\[" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null | head -20
71
+
72
+ # Overflow candidates (horizontal scroll, clipping)
73
+ grep -rn "100vw\|overflow.*hidden\|overflow-x\|position.*fixed" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null | head -15
74
+
75
+ # Fixed dimensions breaking mobile
76
+ grep -rn "width:.*[0-9]\+px\|height:.*[0-9]\+px\|w-\[[0-9]\+px\|h-\[[0-9]\+px" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null | grep -v "min-\|max-" | head -10
77
+
78
+ # Flex/grid blowout candidates
79
+ grep -rn "flex\|grid" --include="*.tsx" app/ components/ src/ 2>/dev/null | grep -v "min-w-0\|minmax(0" | wc -l
80
+ ```
81
+
82
+ **Perf mode (`--perf`):**
83
+ ```bash
84
+ # Sequential awaits that should be Promise.all
85
+ grep -rn "const.*=.*await" --include="*.tsx" --include="*.ts" app/ src/ 2>/dev/null | grep -v "Promise.all\|Promise.allSettled" | head -15
86
+
87
+ # Large files
88
+ find app/ components/ src/ -name "*.tsx" -o -name "*.ts" 2>/dev/null | xargs wc -l 2>/dev/null | sort -rn | head -10
89
+
90
+ # Missing next/image
91
+ grep -rn "<img " --include="*.tsx" --include="*.jsx" app/ components/ src/ 2>/dev/null | grep -v "next/image" | wc -l
92
+
93
+ # No dynamic imports (possible big bundles)
94
+ grep -rn "import(\|next/dynamic" --include="*.tsx" --include="*.ts" app/ src/ 2>/dev/null | wc -l
95
+
96
+ # Client-boundary usage
97
+ grep -rln "'use client'" --include="*.tsx" app/ components/ src/ 2>/dev/null | wc -l
98
+ ```
29
99
 
30
- Before gathering symptoms, check if we've seen this before:
100
+ ### 4. Form Hypothesis + Apply Minimal Fix
101
+
102
+ From the diagnostic output, state the root cause in one sentence with `file:line` citation. No hedging — either you have evidence or you write `INSUFFICIENT EVIDENCE` and return (step 6).
103
+
104
+ Apply the minimal fix:
105
+ - Only edit files whose contents caused the symptom
106
+ - One concept per commit — don't fold in cleanup
107
+ - Don't refactor adjacent code
108
+ - If the fix touches > 3 files, stop and ask the user first (major refactor disguised as a debug)
109
+
110
+ ### 5. Verify Fix
31
111
 
32
112
  ```bash
33
- cat ~/.claude/knowledge/common-fixes.md 2>/dev/null
113
+ # TypeScript still compiles?
114
+ npx tsc --noEmit 2>&1 | grep -c "error TS" # Expect 0
115
+
116
+ # Symptom reproduction — ideally a grep that would have matched the bug
117
+ # and now returns empty:
118
+ grep -rn "{pattern that represented the bug}" {scope} 2>/dev/null
34
119
  ```
35
120
 
36
- If the user's description matches a known fix, suggest it first: *"I've seen this before — check {fix title}. Want to try that before we dig deeper?"* Only proceed to full investigation if the known fix doesn't apply.
121
+ If the verification fails, revert and return to step 3 with narrower hypothesis.
37
122
 
38
- ### 1. Gather Symptoms
123
+ ### 6. Write DEBUG Report
39
124
 
40
- Ask:
41
- - What's happening? (exact error or behavior)
42
- - What should happen instead?
43
- - When did it start? (after what change?)
44
- - What have you tried?
125
+ Write to `.planning/DEBUG-{YYYY-MM-DD-HHMM}.md`:
45
126
 
46
- ### 2. Confirm Diagnosis
127
+ ```markdown
128
+ # Debug Report — {YYYY-MM-DD HH:MM}
47
129
 
48
- Before ANY code changes, present your diagnosis:
130
+ **Symptom:** {user description or "recent changes" if no args}
131
+ **Mode:** general | frontend | perf
132
+ **Tool calls used:** {N}/10
49
133
 
50
- > "Based on the symptoms, I think: [diagnosis]. I'll investigate [specific area]. Does that match what you're seeing?"
134
+ ## Investigation
135
+ - Diagnostic scans run: {list}
136
+ - Files examined: {list}
137
+ - Patterns searched: {list}
51
138
 
52
- Wait for confirmation. If user corrects → adjust. Never proceed on a wrong diagnosis.
139
+ ## Root Cause
140
+ {file:line} — "{quoted problematic code}" — {explanation of why it caused the symptom}
53
141
 
54
- ### 3. Investigate and Fix
142
+ ## Fix Applied
143
+ - Files: {list}
144
+ - Diff summary: {one paragraph}
145
+ - Verification: {commands run + results}
55
146
 
56
- 1. Reproduce the issue
57
- 2. Isolate the cause (binary search: which file, which function, which line)
58
- 3. Identify root cause (not symptoms)
59
- 4. Implement minimal fix
60
- 5. Verify fix works
61
- 6. Check for related issues
147
+ ## Related Observations
148
+ - {any adjacent issues noticed but NOT fixed in this debug pass}
149
+ ```
62
150
 
63
- ### 4. Commit
151
+ ### 7. Commit
64
152
 
65
153
  ```bash
66
- git add {specific files}
154
+ git add {specific files you changed}
67
155
  git commit -m "fix: {what was broken and why}"
68
156
  ```
69
157
 
70
- ## Frontend Mode (`--frontend`)
158
+ ## INSUFFICIENT EVIDENCE Return
71
159
 
72
- For layout breaks, z-index issues, overflow, animation glitches.
160
+ If you exhaust the 10-call budget without a confident root cause:
73
161
 
74
- **Quick diagnostics:**
75
- - Z-index not working element needs `position: relative/absolute/fixed`, check parent stacking contexts
76
- - Horizontal scroll → use `width: 100%` not `100vw`, find overflowing element
77
- - Flex overflow → add `min-width: 0`
78
- - Grid blowout use `minmax(0, 1fr)`
79
- - Janky animations → only animate `transform` and `opacity`
80
- - Safari → `-webkit-backdrop-filter`, `100dvh` not `100vh`
162
+ ```markdown
163
+ # Debug Report {YYYY-MM-DD HH:MM}
164
+
165
+ **Symptom:** {description}
166
+ **Outcome:** INSUFFICIENT EVIDENCE after 10 inspection steps
167
+
168
+ ## Narrowed To
169
+ - Files examined: {list}
170
+ - Ruled out: {list}
171
+ - Remaining suspects: {list}
172
+
173
+ ## Recommended Next Diagnostic
174
+ - {specific next step for the user — e.g., "run `npm run dev` and watch browser console for the specific error", or "add console.log at file:line and reproduce"}
175
+ ```
81
176
 
82
- ## Performance Mode (`--perf`)
177
+ Do NOT apply a speculative fix. Return the report and stop.
83
178
 
84
- ### Investigate
85
- 1. Profile the bottleneck (network, render, compute, database)
86
- 2. Measure baseline
87
- 3. Identify the hot path
179
+ ## Rules
88
180
 
89
- ### Common fixes
90
- - Slow queries check indexes, `EXPLAIN ANALYZE`, optimize joins
91
- - Large bundles code split, lazy load, tree shake
92
- - Slow renders memoize, virtualize long lists
93
- - API latency cache, reduce payload, parallelize requests
181
+ - **No mandatory questions.** This is one-shot. If symptom args are missing, investigate recent changes.
182
+ - **Root cause or INSUFFICIENT EVIDENCE** no "probably" fixes.
183
+ - **Minimal fix only.** One concept, one commit. No refactors dressed as debug.
184
+ - **Tool budget is hard.** 10 calls, then stop.
185
+ - **Every fix gets a DEBUG report in .planning/** — creates a searchable record.
@@ -41,13 +41,49 @@ If DESIGN.md exists → it is law. Use exact values from sections 1-9 (Visual Th
41
41
  - If `--scope`: grep for matching files in `app/` and `components/`
42
42
  - If none: find all `page.tsx`, `layout.tsx`, and component files
43
43
 
44
- Read EVERY target file before modifying.
44
+ Count them. If 5, process in main context (step 3a). If > 5, fan out to parallel agents (step 3b).
45
45
 
46
- ### 3. Critique (internaldon't output)
46
+ ### 3a. Small File Set ( 5 files) main context
47
47
 
48
- Evaluate each file on: AI slop detection, visual hierarchy, typography, color, states (loading/error/empty), motion, spacing, responsiveness, microcopy.
48
+ Read EVERY target file before modifying. Critique internally using the structured rubric below, then fix everything (step 4).
49
49
 
50
- ### 4. Fix Everything
50
+ **Critique rubric (required — produces the findings you then fix):**
51
+
52
+ | File | Dimension | Issue | Line | Severity |
53
+ |------|-----------|-------|------|----------|
54
+ | {path} | Typography/Color/Spacing/States/Responsive/A11y/Motion/Microcopy | {specific problem with quote} | {N} | CRITICAL/HIGH/MEDIUM/LOW |
55
+
56
+ Apply fixes to every HIGH and CRITICAL item. MEDIUM items fixed if cheap (same file, same category).
57
+
58
+ ### 3b. Large File Set (> 5 files) — parallel fan-out
59
+
60
+ Split target files into batches of 5. Spawn one Agent per batch IN THE SAME RESPONSE TURN (parallel execution). Each agent receives DESIGN.md inlined + its 5 files + the Design Quality Rubric from `rules/grounding.md`. Agents return their batch's critique table + the actual edits applied. The skill orchestrator fans in the results and runs the final verification (step 5).
61
+
62
+ ```
63
+ Agent(prompt="
64
+ Read your role: builder for design transformation.
65
+ Grounding + rubrics: @~/.claude/rules/grounding.md
66
+
67
+ <design_system>
68
+ {inlined DESIGN.md}
69
+ </design_system>
70
+
71
+ <target_files>
72
+ {5 file paths + their contents}
73
+ </target_files>
74
+
75
+ Apply the Design Quality Rubric to each file. Fix every dimension scoring below 4. Make the literal edits with the Edit tool. Do NOT change logic — only styling.
76
+
77
+ Return:
78
+ - Critique table (File | Dimension | Issue | Line | Before-score | After-score)
79
+ - List of files modified
80
+ - Any anti-pattern greps that remain (report, don't fix beyond scope)
81
+ ", subagent_type="general-purpose", description="Design batch {N}")
82
+ ```
83
+
84
+ Do not process files serially in main context — that's what wastes a context window.
85
+
86
+ ### 4. Fix Everything (applies to step 3a OR to each agent in 3b)
51
87
 
52
88
  Use exact values from DESIGN.md when available. Sections map to fixes:
53
89
 
@@ -73,11 +109,21 @@ Use exact values from DESIGN.md when available. Sections map to fixes:
73
109
 
74
110
  ### 5. Verify
75
111
 
112
+ Parallel batch — run these in a single response turn:
113
+
76
114
  ```bash
115
+ # TypeScript still compiles?
77
116
  npx tsc --noEmit 2>&1 | head -20
117
+
118
+ # Reverted anti-patterns (any match = regression)
119
+ grep -rn "outline.*none\|outline-none" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null | grep -v "focus-visible\|focus:"
120
+ grep -rn "font-family.*Inter\|font-family.*Arial\|font-family.*system-ui\|Space Grotesk" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null
121
+ grep -rn "max-w-\[1200\|max-w-\[1280\|max-width.*1200\|max-w-7xl" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null
122
+ grep -rn "<img " --include="*.tsx" app/ components/ src/ 2>/dev/null | grep -v "alt="
123
+ grep -rn "from-blue.*to-purple\|from-purple.*to-blue" --include="*.tsx" --include="*.css" app/ components/ src/ 2>/dev/null
78
124
  ```
79
125
 
80
- Fix any TypeScript errors before committing.
126
+ Fix any TypeScript errors before committing. If any anti-pattern grep returned matches, re-fix those files — the transformation is not complete until these greps return empty.
81
127
 
82
128
  ### 6. Commit
83
129
 
@@ -105,3 +151,4 @@ git commit -m "style: design transformation"
105
151
  - Respect DESIGN.md decisions
106
152
  - Don't break functionality — only change styling, never logic
107
153
  - TypeScript must pass after changes
154
+ - All anti-pattern greps in step 5 must return empty before commit
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-plan
3
- description: "Plan the current phase — spawns planner, validates with plan-checker in a revision loop (max 3), optionally runs discuss/research first. Use when ready to plan a phase."
3
+ description: "Plan the current phase — spawns planner, validates with plan-checker in a revision loop (max 2), optionally runs discuss/research first. Use when ready to plan a phase."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -15,7 +15,7 @@ allowed-tools:
15
15
 
16
16
  # /qualia-plan — Plan a Phase
17
17
 
18
- Spawn a planner agent to break the current phase into executable tasks, then validate the plan with a checker (up to 3 revision cycles) before routing to build.
18
+ Spawn a planner agent to break the current phase into executable tasks, then validate the plan with a checker (up to 2 revision cycles) before routing to build.
19
19
 
20
20
  ## Usage
21
21
 
@@ -73,6 +73,7 @@ Spawn the planner:
73
73
  ```
74
74
  Agent(prompt="
75
75
  Read your role: @~/.claude/agents/planner.md
76
+ Grounding + rubrics: @~/.claude/rules/grounding.md
76
77
 
77
78
  <project_context>
78
79
  @.planning/PROJECT.md
@@ -116,6 +117,7 @@ Read the generated plan. Spawn the plan-checker:
116
117
  ```
117
118
  Agent(prompt="
118
119
  Read your role: @~/.claude/agents/plan-checker.md
120
+ Grounding + rubrics: @~/.claude/rules/grounding.md
119
121
 
120
122
  <plan_path>.planning/phase-{N}-plan.md</plan_path>
121
123
  <phase_goal>{goal from ROADMAP.md}</phase_goal>
@@ -126,11 +128,12 @@ Validate against the 7 rules. Return PASS or REVISE with structured issues.
126
128
  ", subagent_type="qualia-plan-checker", description="Check plan phase {N}")
127
129
  ```
128
130
 
129
- **Revision loop (max 3 iterations):**
131
+ **Revision loop (max 2 iterations):**
130
132
 
131
133
  - Iteration 1: Check → if REVISE, re-spawn planner with checker issues
132
- - Iteration 2: Re-check → if REVISE, re-spawn planner with new issues
133
- - Iteration 3: Final check → if REVISE or BLOCKED, escalate to user
134
+ - Iteration 2: Re-check → if REVISE or BLOCKED, escalate to user
135
+
136
+ Rationale: Amazon/NeurIPS 2025 measured reflection gains at 74→86% for 1 round, 88% for 3 rounds. Iteration 3 only added 2pp over iteration 1 — not worth the extra planner spawn (serial cost ~30-60s).
134
137
 
135
138
  For each revision:
136
139
 
@@ -149,12 +152,12 @@ Revise the plan in place. Address every issue. Do NOT add new tasks or change sc
149
152
  ", subagent_type="qualia-planner", description="Revise plan phase {N}")
150
153
  ```
151
154
 
152
- After revision, spawn the checker again. Max 3 total revision cycles.
155
+ After revision, spawn the checker again. Max 2 total revision cycles.
153
156
 
154
- **If checker returns BLOCKED after 3 cycles:**
157
+ **If checker returns BLOCKED after 2 cycles:**
155
158
 
156
159
  ```bash
157
- node ~/.claude/bin/qualia-ui.js fail "Plan failed validation after 3 revisions"
160
+ node ~/.claude/bin/qualia-ui.js fail "Plan failed validation after 2 revisions"
158
161
  ```
159
162
 
160
163
  Show the remaining issues. Ask:
@@ -40,9 +40,11 @@ ls package.json next.config.* tsconfig.json supabase/ app/ src/ 2>/dev/null
40
40
 
41
41
  ### 1. Security Scan
42
42
 
43
- Run every command. Record each finding with severity.
43
+ **Run the independent greps as parallel Bash calls in a single response** (they don't depend on each other serial execution wastes 15-30s on large codebases). Only the `find … | for` loops are sequential.
44
44
 
45
45
  ```bash
46
+ # PARALLEL BATCH (issue these in one response turn):
47
+
46
48
  # CRITICAL: service_role in client code
47
49
  grep -rn "service_role" --include="*.ts" --include="*.tsx" --include="*.js" app/ components/ src/ lib/ 2>/dev/null | grep -v node_modules | grep -v "\.server\.\|[\\/]server[\\/]\|[\\/]app[\\/]api[\\/]\|route\.\|middleware\."
48
50
 
@@ -55,21 +57,26 @@ grep -rn "dangerouslySetInnerHTML\|eval(" --include="*.ts" --include="*.tsx" --i
55
57
  # CRITICAL: .env files tracked in git
56
58
  git ls-files | grep -i "\.env" | grep -v "\.example\|\.template\|\.sample"
57
59
 
60
+ # HIGH: client-side database mutations
61
+ grep -rn "\.insert\|\.update\|\.delete\|\.upsert" --include="*.tsx" --include="*.jsx" app/ components/ 2>/dev/null | grep -v "use server" | grep -v "\.server\."
62
+
63
+ # MEDIUM: npm vulnerabilities
64
+ npm audit --json 2>/dev/null | node -e "try{const d=JSON.parse(require('fs').readFileSync(0,'utf8'));const v=d.metadata?.vulnerabilities||{};console.log('critical:',v.critical||0,'high:',v.high||0,'moderate:',v.moderate||0)}catch{console.log('audit unavailable')}"
65
+
66
+ # END PARALLEL BATCH
67
+
68
+ # SEQUENTIAL (depends on find):
58
69
  # HIGH: API routes without auth
59
70
  for f in $(find app/api -name "route.ts" -o -name "route.js" 2>/dev/null); do
60
- grep -qL "getUser\|getSession\|auth()\|createClient" "$f" && echo "UNPROTECTED: $f"
71
+ if ! grep -q "getUser\|getSession\|auth()\|createClient" "$f" 2>/dev/null; then
72
+ echo "UNPROTECTED: $f"
73
+ fi
61
74
  done
62
75
 
63
76
  # HIGH: API routes without input validation
64
77
  for f in $(find app/api -name "route.ts" -o -name "route.js" 2>/dev/null); do
65
78
  grep -L "z\.\|zod\|Zod\|parse\|safeParse" "$f" 2>/dev/null
66
79
  done
67
-
68
- # HIGH: client-side database mutations
69
- grep -rn "\.insert\|\.update\|\.delete\|\.upsert" --include="*.tsx" --include="*.jsx" app/ components/ 2>/dev/null | grep -v "use server" | grep -v "\.server\."
70
-
71
- # MEDIUM: npm vulnerabilities
72
- npm audit --json 2>/dev/null | node -e "try{const d=JSON.parse(require('fs').readFileSync(0,'utf8'));const v=d.metadata?.vulnerabilities||{};console.log('critical:',v.critical||0,'high:',v.high||0,'moderate:',v.moderate||0)}catch{console.log('audit unavailable')}"
73
80
  ```
74
81
 
75
82
  ### 2. Code Quality Scan
@@ -94,8 +101,14 @@ grep -rn "console\.log" --include="*.ts" --include="*.tsx" app/ components/ src/
94
101
  ### 3. Performance Scan
95
102
 
96
103
  ```bash
97
- # Build output — route sizes and first load JS
98
- npx next build 2>&1 | grep -E "Route|First Load|shared by all|○|●|ƒ|λ" | tail -25
104
+ # Build output — read existing build artifacts (don't trigger a fresh build during a scan)
105
+ if [ -d ".next" ]; then
106
+ du -sh .next/static/chunks/*.js 2>/dev/null | sort -rh | head -10
107
+ echo "---"
108
+ find .next -name "*.js" -size +200k 2>/dev/null | head -5
109
+ else
110
+ echo "No .next/ build output — run 'npx next build' separately for bundle analysis (review skill does NOT trigger builds — it's a scan)"
111
+ fi
99
112
 
100
113
  # Heavy files (>300 lines often means split needed)
101
114
  find app/ components/ src/ -name "*.tsx" -o -name "*.ts" 2>/dev/null | xargs wc -l 2>/dev/null | sort -rn | head -10
@@ -144,12 +157,19 @@ Write to `.planning/REVIEW.md`:
144
157
  {PASS: no critical/high | FAIL: N blockers — fix before /qualia-ship}
145
158
  ```
146
159
 
147
- **Scoring:**
148
- - 5 = zero high/critical, fewer than 3 medium
149
- - 4 = zero critical, 1 high or fewer than 5 medium
150
- - 3 = zero critical, 2-3 high
151
- - 2 = 1 critical or 4+ high
152
- - 1 = multiple critical
160
+ **Scoring (deterministic — see `rules/grounding.md` for full rubric):**
161
+ ```
162
+ weighted_sum = (critical × 8) + (high × 4) + (medium × 2) + (low × 1)
163
+ category_score = max(1, 5 − floor(weighted_sum / 8))
164
+ ```
165
+ Same inputs always produce the same score. No subjective thresholds.
166
+
167
+ Quick reference (computed from the formula — verified):
168
+ - 0 findings, or only LOW/MEDIUM, or 1 HIGH → 5
169
+ - 2–3 HIGH, or 1 CRITICAL → 4
170
+ - 2 CRITICAL, or 1 CRITICAL + 2–3 HIGH → 3
171
+ - 3 CRITICAL, or 2 CRITICAL + 2+ HIGH → 2
172
+ - 4+ CRITICAL → 1
153
173
 
154
174
  ```bash
155
175
  node ~/.claude/bin/qualia-ui.js divider
@@ -161,7 +161,7 @@ git add skills/{name}/
161
161
  git commit -m "feat: add /{name} skill"
162
162
  ```
163
163
 
164
- Remind the user to run `npx qualia-framework update` on their other machines, or bump the version and `npm publish`.
164
+ Remind the user to run `npx qualia-framework@latest update` on their other machines (always pin `@latest` — npx caches aggressively), or bump the version and `npm publish`.
165
165
 
166
166
  ## Anti-Patterns
167
167
 
@@ -41,6 +41,10 @@ node ~/.claude/bin/qualia-ui.js spawn verifier "Goal-backward check..."
41
41
  ```
42
42
  Agent(prompt="
43
43
  Read your role: @~/.claude/agents/verifier.md
44
+ Grounding + rubrics: @~/.claude/rules/grounding.md
45
+
46
+ Project conventions (MUST consult before scoring Quality):
47
+ @.planning/PROJECT.md
44
48
 
45
49
  Phase plan with success criteria AND verification contracts:
46
50
  @.planning/phase-{N}-plan.md
@@ -48,7 +52,7 @@ Phase plan with success criteria AND verification contracts:
48
52
  {If re-verification: Previous verification with gaps:}
49
53
  {@.planning/phase-{N}-verification.md}
50
54
 
51
- Verify this phase. Write report to .planning/phase-{N}-verification.md
55
+ Verify this phase. Apply the Grounding Protocol — every finding needs file:line evidence. Use the Severity Rubric for all severity labels. Write report to .planning/phase-{N}-verification.md
52
56
  ", subagent_type="qualia-verifier", description="Verify phase {N}")
53
57
  ```
54
58