qualia-framework-v2 2.1.2 → 2.3.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,50 +1,58 @@
1
1
  ---
2
2
  name: qualia
3
- description: "Router — reads STATE.md and tells you the exact next command. Use whenever you type /qualia, 'what next', 'next', or are lost."
3
+ description: "Smart router — reads project state, classifies your situation, tells you the exact next command. Use whenever you type /qualia, 'what next', 'next', 'idk', 'what now', 'what should I do', 'I'm stuck', 'help me decide', 'lost', 'confused', or are unsure about your next step."
4
4
  ---
5
5
 
6
6
  # /qualia — What's Next?
7
7
 
8
- Read project state. Tell the employee the exact next command. No analysis, no advice — just routing.
8
+ Read project state. Classify your situation. Tell you the exact next command.
9
9
 
10
10
  ## Process
11
11
 
12
- ### 1. Read State
12
+ ### 1. Get State
13
13
 
14
14
  ```bash
15
- echo "---STATE---"
16
- cat .planning/STATE.md 2>/dev/null || echo "NO_STATE"
17
- echo "---TRACKING---"
18
- cat .planning/tracking.json 2>/dev/null || echo "NO_TRACKING"
19
- echo "---PHASE_PLANS---"
15
+ node ~/.claude/bin/state.js check 2>/dev/null
16
+ ```
17
+
18
+ Also gather context:
19
+ ```bash
20
+ test -f .continue-here.md && echo "HANDOFF_EXISTS" && head -20 .continue-here.md || echo "NO_HANDOFF"
21
+ git status --short 2>/dev/null | head -10
22
+ git log --oneline -3 2>/dev/null
20
23
  ls .planning/phase-*-plan.md 2>/dev/null || echo "NO_PLANS"
21
- echo "---VERIFICATIONS---"
22
24
  ls .planning/phase-*-verification.md 2>/dev/null || echo "NO_VERIFICATIONS"
23
25
  ```
24
26
 
25
- ### Task Routing (size-based)
27
+ Read conversation context — what has the user been doing, what errors occurred.
26
28
 
27
- - Single file change, config tweak, typo fix, bug with known cause → `/qualia-quick`
28
- - One feature, 1-5 files, clear scope, under 2 hours → `/qualia-task`
29
- - Multi-feature, 5+ files, needs architecture decisions, or part of a roadmap phase → `/qualia-plan`
29
+ ### 2. Classify and Route
30
30
 
31
- ### 2. Route (state-based)
31
+ Use the state.js JSON output plus gathered context:
32
32
 
33
- | Condition | Command |
34
- |-----------|---------|
35
- | No `.planning/` | → `/qualia-new` |
36
- | Phase N has no plan | → `/qualia-plan {N}` |
37
- | Phase N has plan, not built | → `/qualia-build {N}` |
38
- | Phase N built, not verified | → `/qualia-verify {N}` |
39
- | Phase N verified with FAIL | → `/qualia-plan {N} --gaps` |
40
- | Phase N verified PASS, more phases | → `/qualia-plan {N+1}` |
41
- | All phases verified PASS | → `/qualia-polish` |
42
- | Polish done | → `/qualia-ship` |
43
- | Shipped | → `/qualia-handoff` |
44
- | Handed off | → Done. Run `/qualia-report` |
33
+ | Situation | Detection | Route |
34
+ |-----------|-----------|-------|
35
+ | `no-project` | state.js returns NO_PROJECT | → `/qualia-new` |
36
+ | `handoff` | `.continue-here.md` exists | → Read it, summarize, route to next step |
37
+ | `mid-work` | Uncommitted changes + phase in progress | → Continue or `/qualia-pause` |
38
+ | `ready-to-plan` | status == "setup" | → `/qualia-plan {N}` |
39
+ | `ready-to-build` | status == "planned" | → `/qualia-build {N}` |
40
+ | `ready-to-verify` | status == "built" | → `/qualia-verify {N}` |
41
+ | `gaps-found` | status == "verified", verification == "fail", gap_cycles < 2 | → `/qualia-plan {N} --gaps` |
42
+ | `gap-limit` | status == "verified", verification == "fail", gap_cycles >= 2 | → Escalate to Fawzi or re-plan from scratch |
43
+ | `phase-complete` | state.js auto-advanced (status == "setup", phase > 1) | → `/qualia-plan {N}` |
44
+ | `all-verified` | last phase verified pass, status == "verified" | → `/qualia-polish` |
45
+ | `polished` | status == "polished" | → `/qualia-ship` |
46
+ | `shipped` | status == "shipped" | → `/qualia-handoff` |
47
+ | `handed-off` | status == "handed_off" | → `/qualia-report` then done |
48
+ | `blocked` | STATE.md lists blockers or same error 3+ times | → Analyze, suggest `/qualia-debug` |
49
+ | `bug-loop` | Same files edited 3+ times, user frustrated | → Different approach, `/qualia-debug` |
50
+
51
+ **Employee escalation:** If role is EMPLOYEE and situation is `gap-limit` or `bug-loop`, suggest: "Want to flag this for Fawzi?"
45
52
 
46
53
  ### 3. Display
47
54
 
55
+ **Clear next step:**
48
56
  ```
49
57
  ◆ QUALIA
50
58
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -54,7 +62,22 @@ ls .planning/phase-*-verification.md 2>/dev/null || echo "NO_VERIFICATIONS"
54
62
  Progress {bar} {percent}%
55
63
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
56
64
 
57
- → Run: /qualia-{next command}
65
+ → Run: {next_command from state.js}
66
+ ```
67
+
68
+ **Ambiguous situation (multiple options):**
69
+ ```
70
+ ## Where You Are
71
+ {1-2 sentences}
72
+
73
+ ## I Recommend
74
+ **{action}** — {why}
75
+ {command}
76
+
77
+ ## Other Options
78
+ 1. **{option}** — {what}
79
+ 2. **{option}** — {what}
80
+ 3. **{option}** — {what}
58
81
  ```
59
82
 
60
- That's it. One command. One answer.
83
+ User can respond with a number, "just do it", or natural language.
@@ -85,8 +85,11 @@ If a builder subagent returns a deviation or blocker:
85
85
 
86
86
  ### 5. Update State
87
87
 
88
- Update STATE.md: status → "built", tasks completed
89
- Update tracking.json: tasks_done, wave, status
88
+ ```bash
89
+ node ~/.claude/bin/state.js transition --to built --phase {N} --tasks-done {done} --tasks-total {total} --wave {wave}
90
+ ```
91
+ If state.js returns an error, show it to the employee and stop.
92
+ Do NOT manually edit STATE.md or tracking.json — state.js handles both.
90
93
 
91
94
  ```
92
95
  → Run: /qualia-verify {N}
@@ -0,0 +1,73 @@
1
+ ---
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'."
4
+ ---
5
+
6
+ # /qualia-debug — Structured Debugging
7
+
8
+ Systematic debugging. Don't guess — gather symptoms, confirm diagnosis, then fix.
9
+
10
+ ## Usage
11
+
12
+ - `/qualia-debug` — Interactive (gather symptoms, diagnose, fix)
13
+ - `/qualia-debug --frontend` — CSS/layout/visual issues
14
+ - `/qualia-debug --perf` — Performance issues
15
+
16
+ ## Interactive Mode (Default)
17
+
18
+ ### 1. Gather Symptoms
19
+
20
+ Ask:
21
+ - What's happening? (exact error or behavior)
22
+ - What should happen instead?
23
+ - When did it start? (after what change?)
24
+ - What have you tried?
25
+
26
+ ### 2. Confirm Diagnosis
27
+
28
+ Before ANY code changes, present your diagnosis:
29
+
30
+ > "Based on the symptoms, I think: [diagnosis]. I'll investigate [specific area]. Does that match what you're seeing?"
31
+
32
+ Wait for confirmation. If user corrects → adjust. Never proceed on a wrong diagnosis.
33
+
34
+ ### 3. Investigate and Fix
35
+
36
+ 1. Reproduce the issue
37
+ 2. Isolate the cause (binary search: which file, which function, which line)
38
+ 3. Identify root cause (not symptoms)
39
+ 4. Implement minimal fix
40
+ 5. Verify fix works
41
+ 6. Check for related issues
42
+
43
+ ### 4. Commit
44
+
45
+ ```bash
46
+ git add {specific files}
47
+ git commit -m "fix: {what was broken and why}"
48
+ ```
49
+
50
+ ## Frontend Mode (`--frontend`)
51
+
52
+ For layout breaks, z-index issues, overflow, animation glitches.
53
+
54
+ **Quick diagnostics:**
55
+ - Z-index not working → element needs `position: relative/absolute/fixed`, check parent stacking contexts
56
+ - Horizontal scroll → use `width: 100%` not `100vw`, find overflowing element
57
+ - Flex overflow → add `min-width: 0`
58
+ - Grid blowout → use `minmax(0, 1fr)`
59
+ - Janky animations → only animate `transform` and `opacity`
60
+ - Safari → `-webkit-backdrop-filter`, `100dvh` not `100vh`
61
+
62
+ ## Performance Mode (`--perf`)
63
+
64
+ ### Investigate
65
+ 1. Profile the bottleneck (network, render, compute, database)
66
+ 2. Measure baseline
67
+ 3. Identify the hot path
68
+
69
+ ### Common fixes
70
+ - Slow queries → check indexes, `EXPLAIN ANALYZE`, optimize joins
71
+ - Large bundles → code split, lazy load, tree shake
72
+ - Slow renders → memoize, virtualize long lists
73
+ - API latency → cache, reduce payload, parallelize requests
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: qualia-design
3
+ description: "One-shot design transformation — critiques, fixes, polishes, hardens, makes responsive. No reports, no choices, just makes it professional. Trigger on 'fix the design', 'make it look better', 'redesign', 'design pass', 'make it modern', 'it looks ugly', 'fix the UI'."
4
+ ---
5
+
6
+ # /qualia-design — One-Shot Design Transformation
7
+
8
+ Read the code, understand what's wrong, fix everything, move on. No reports, no choices.
9
+
10
+ ## Usage
11
+
12
+ - `/qualia-design` — Full transformation on all frontend files
13
+ - `/qualia-design app/page.tsx` — Specific file(s)
14
+ - `/qualia-design --scope=dashboard` — Transform a section
15
+
16
+ ## Process
17
+
18
+ ### 1. Read Brand Context
19
+
20
+ ```bash
21
+ cat .planning/DESIGN.md 2>/dev/null || echo "NO_DESIGN"
22
+ ```
23
+
24
+ If DESIGN.md exists → use it. If not → use Qualia defaults: distinctive fonts, sharp accents, layered backgrounds, no card grids, no blue-purple gradients, full-width layouts.
25
+
26
+ ### 2. Find Target Files
27
+
28
+ - If specific files given: use those
29
+ - If `--scope`: grep for matching files in `app/` and `components/`
30
+ - If none: find all `page.tsx`, `layout.tsx`, and component files
31
+
32
+ Read EVERY target file before modifying.
33
+
34
+ ### 3. Critique (internal — don't output)
35
+
36
+ Evaluate each file on: AI slop detection, visual hierarchy, typography, color, states (loading/error/empty), motion, spacing, responsiveness, microcopy.
37
+
38
+ ### 4. Fix Everything
39
+
40
+ **Typography:** Replace generic fonts (Inter, Arial) with distinctive ones. Proper type scale, line-height 1.5-1.7 body.
41
+
42
+ **Color:** Cohesive palette from DESIGN.md or brand. Sharp accent for CTAs. WCAG AA contrast.
43
+
44
+ **Layout:** Full-width with fluid padding `clamp(1rem, 5vw, 4rem)`. NO hardcoded max-width caps. Prose gets `max-width: 65ch`.
45
+
46
+ **Spacing:** Consistent scale (8px grid). Generous whitespace between sections, tight within groups.
47
+
48
+ **Motion:** CSS transitions 200-300ms on hover/focus. Staggered entrance animations. `prefers-reduced-motion` respected.
49
+
50
+ **States:** Loading skeleton/spinner on async ops. Error states on data fetches. Empty states on lists. Hover/focus/active/disabled on interactive elements.
51
+
52
+ **Responsive:** Mobile-first. Touch targets 44x44px min. Stack on mobile, expand on desktop. No horizontal scroll.
53
+
54
+ **Kill:** Card grids → varied layouts. Generic heroes → distinctive. Blue-purple gradients → brand colors. Static pages → purposeful motion. Fixed widths → fluid.
55
+
56
+ ### 5. Verify
57
+
58
+ ```bash
59
+ npx tsc --noEmit 2>&1 | head -20
60
+ ```
61
+
62
+ Fix any TypeScript errors before committing.
63
+
64
+ ### 6. Commit
65
+
66
+ ```bash
67
+ git add {modified files}
68
+ git commit -m "style: design transformation"
69
+ ```
70
+
71
+ ```
72
+ ◆ Design Transformation Complete
73
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
74
+ Files: {N}
75
+ Changes:
76
+ - {key change 1}
77
+ - {key change 2}
78
+ - {key change 3}
79
+
80
+ Fine-tune: /bolder, /design-quieter, /colorize, /animate
81
+ ```
82
+
83
+ ## Rules
84
+
85
+ - Read before write — understand every file before changing it
86
+ - Don't ask — just fix
87
+ - Respect DESIGN.md decisions
88
+ - Don't break functionality — only change styling, never logic
89
+ - TypeScript must pass after changes
@@ -56,8 +56,10 @@ git push
56
56
 
57
57
  ### 3. Update State
58
58
 
59
- Update STATE.md: "handed off"
60
- Update tracking.json: status "handed_off"
59
+ ```bash
60
+ node ~/.claude/bin/state.js transition --to handed_off
61
+ ```
62
+ Do NOT manually edit STATE.md or tracking.json — state.js handles both.
61
63
 
62
64
  ```
63
65
  ◆ QUALIA ► DELIVERED ✓
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: qualia-idk
3
+ description: "Alias for /qualia. The smart router handles all 'idk', 'what now', 'I'm stuck' situations."
4
+ ---
5
+
6
+ # /qualia-idk
7
+
8
+ This is an alias for `/qualia`. Run `/qualia` — it now handles all situation classification and routing.
@@ -223,9 +223,13 @@ Create Supabase project (via MCP or manual).
223
223
  **`.planning/PROJECT.md`** — use template, fill from answers:
224
224
  - Client, description, requirements (from features), out of scope, stack, design direction, decisions
225
225
 
226
- **`.planning/STATE.md`** use template from `templates/state.md`
226
+ ### Step 8b. Initialize State
227
227
 
228
- **`.planning/tracking.json`** — use template, fill in project/client/assigned_to
228
+ ```bash
229
+ node ~/.claude/bin/state.js init --project "{name}" --client "{client}" --type "{type}" --assigned-to "{employee}" --phases '[{phases JSON array from roadmap}]'
230
+ ```
231
+ This creates both STATE.md and tracking.json with consistent formatting.
232
+ Do NOT manually edit these files — state.js handles both.
229
233
 
230
234
  ### Step 9. Create Roadmap
231
235
 
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: qualia-pause
3
+ description: "Save session context for seamless handoff. Creates .continue-here.md so the next session picks up exactly where you left off. Trigger on 'pause', 'stop for now', 'save progress', 'continue later', 'pick up tomorrow'."
4
+ ---
5
+
6
+ # /qualia-pause — Session Handoff
7
+
8
+ Save context so the next session picks up where you left off.
9
+
10
+ ## Process
11
+
12
+ ### 1. Read State
13
+
14
+ ```bash
15
+ cat .planning/STATE.md 2>/dev/null
16
+ git status --short 2>/dev/null
17
+ git log --oneline -5 2>/dev/null
18
+ ```
19
+
20
+ ### 2. Create `.continue-here.md`
21
+
22
+ ```markdown
23
+ # Continue Here
24
+
25
+ ## Session Summary
26
+ {What was accomplished — from conversation context + git log}
27
+
28
+ ## Current Phase
29
+ Phase {N}: {name} — {status}
30
+
31
+ ## In Progress
32
+ - {What's partially done}
33
+ - {Where exactly work stopped}
34
+
35
+ ## Next Steps
36
+ 1. {Immediate next action}
37
+ 2. {Following action}
38
+
39
+ ## Decisions Made
40
+ - {Decision and rationale}
41
+
42
+ ## Blockers
43
+ - {Any unresolved issues}
44
+
45
+ ## Files Modified
46
+ - {List from git status/diff}
47
+ ```
48
+
49
+ ### 3. Commit
50
+
51
+ ```bash
52
+ git add .continue-here.md {any uncommitted work files}
53
+ git commit -m "WIP: {phase name} — session handoff"
54
+ ```
55
+
56
+ ```bash
57
+ node ~/.claude/bin/state.js transition --to note --notes "Session paused — see .continue-here.md"
58
+ ```
59
+ Do NOT manually edit STATE.md or tracking.json — state.js handles both.
@@ -76,8 +76,11 @@ If "adjust" — get feedback, re-spawn planner with revision context.
76
76
 
77
77
  ### 4. Update State
78
78
 
79
- Update STATE.md: status → "planned"
80
- Update tracking.json: status "planned"
79
+ ```bash
80
+ node ~/.claude/bin/state.js transition --to planned --phase {N}
81
+ ```
82
+ If state.js returns an error, show it to the employee and stop.
83
+ Do NOT manually edit STATE.md or tracking.json — state.js handles both.
81
84
 
82
85
  ```
83
86
  → Run: /qualia-build {N}
@@ -49,8 +49,10 @@ git add {changed files}
49
49
  git commit -m "polish: design and UX pass"
50
50
  ```
51
51
 
52
- Update STATE.md: "polish complete"
53
- Update tracking.json: status "polished"
52
+ ```bash
53
+ node ~/.claude/bin/state.js transition --to polished
54
+ ```
55
+ Do NOT manually edit STATE.md or tracking.json — state.js handles both.
54
56
 
55
57
  ```
56
58
  → Run: /qualia-ship
@@ -22,4 +22,7 @@ git commit -m "fix: {description}"
22
22
 
23
23
  No plan file. No subagents. Just build and ship.
24
24
 
25
- Update STATE.md last activity. Update tracking.json notes.
25
+ ```bash
26
+ node ~/.claude/bin/state.js transition --to note --notes "{brief description of what was done}"
27
+ ```
28
+ Do NOT manually edit STATE.md or tracking.json — state.js handles both.
@@ -1,19 +1,19 @@
1
1
  ---
2
2
  name: qualia-report
3
- description: "Generate session report as DOCX and auto-upload to ERP. Mandatory before clock-out."
3
+ description: "Generate session report and commit to repo. Mandatory before clock-out."
4
4
  ---
5
5
 
6
6
  # /qualia-report — Session Report
7
7
 
8
- Generate a concise DOCX report of what was done. Auto-uploads to the ERP.
8
+ Generate a concise report of what was done. Committed to git for the ERP to read.
9
9
 
10
10
  ## Process
11
11
 
12
12
  ### 1. Gather Data
13
13
 
14
14
  ```bash
15
- echo "---COMMITS---"
16
15
  SINCE="8 hours ago"
16
+ echo "---COMMITS---"
17
17
  git log --oneline --since="$SINCE" 2>/dev/null | head -20
18
18
  echo "---STATS---"
19
19
  echo "COUNT:$(git log --oneline --since="$SINCE" 2>/dev/null | wc -l)"
@@ -21,7 +21,7 @@ echo "---PROJECT---"
21
21
  echo "DIR:$(basename $(pwd))"
22
22
  echo "BRANCH:$(git branch --show-current 2>/dev/null)"
23
23
  echo "---STATE---"
24
- head -20 .planning/STATE.md 2>/dev/null || echo "no-state"
24
+ node ~/.claude/bin/state.js check 2>/dev/null
25
25
  ```
26
26
 
27
27
  ### 2. Synthesize
@@ -31,44 +31,50 @@ Build a concise summary:
31
31
  - **Blockers:** Only if something is actually blocked.
32
32
  - **Next:** 1-3 clear next actions.
33
33
 
34
- ### 3. Generate DOCX
34
+ ### 3. Generate Report
35
35
 
36
- ```bash
37
- mkdir -p .planning/reports
36
+ Write to `.planning/reports/report-{YYYY-MM-DD}.md`:
37
+
38
+ ```markdown
39
+ # Session Report — {YYYY-MM-DD}
40
+
41
+ **Project:** {name}
42
+ **Employee:** {git user.name}
43
+ **Branch:** {branch}
44
+ **Phase:** {N} — {name} ({status})
45
+ **Date:** {YYYY-MM-DD}
38
46
 
39
- cat <<'REPORT_JSON' | python3 ~/.claude/qualia-framework/bin/generate-report-docx.py ".planning/reports/report-$(date +%Y-%m-%d-%H%M).docx"
40
- {
41
- "project": "{project-name}",
42
- "user": "{git user.name}",
43
- "date": "{YYYY-MM-DD}",
44
- "time": "{HH:MM}",
45
- "branch": "{branch}",
46
- "phase": "{Phase N — name}",
47
- "done": ["{accomplishment 1}", "{accomplishment 2}"],
48
- "blockers": [],
49
- "next": ["{next action 1}"]
50
- }
51
- REPORT_JSON
47
+ ## What Was Done
48
+ - {accomplishment 1}
49
+ - {accomplishment 2}
50
+ - {accomplishment 3}
51
+
52
+ ## Blockers
53
+ None. / - {blocker}
54
+
55
+ ## Next Steps
56
+ 1. {next action}
57
+ 2. {next action}
58
+
59
+ ## Commits
60
+ {list from git log}
52
61
  ```
53
62
 
54
- ### 4. Commit & Upload
63
+ ### 4. Commit and Push
55
64
 
56
65
  ```bash
57
- REPORT_FILE=$(ls -t .planning/reports/report-*.docx 2>/dev/null | head -1)
58
- git add "$REPORT_FILE"
59
- git commit -m "report: session $(date +%Y-%m-%d)"
66
+ mkdir -p .planning/reports
67
+ git add .planning/reports/report-{date}.md
68
+ git commit -m "report: session {YYYY-MM-DD}"
60
69
  git push
61
70
  ```
62
71
 
63
- Auto-upload to ERP:
72
+ ### 5. Update State
73
+
64
74
  ```bash
65
- curl -s -X POST "https://portal.qualiasolutions.net/api/claude/report-upload" \
66
- -H "x-api-key: $CLAUDE_API_KEY" \
67
- -F "file=@$REPORT_FILE" \
68
- -F "employee_email=$(git config user.email)" \
69
- -F "project_name=$(basename $(pwd))"
75
+ node ~/.claude/bin/state.js transition --to activity --notes "Session report generated"
70
76
  ```
71
77
 
72
- Employee cannot skip this. Report goes directly to the ERP.
78
+ Do NOT manually edit STATE.md or tracking.json state.js handles both.
73
79
 
74
- Update STATE.md last activity.
80
+ Employee cannot skip this. Run `/qualia-report` before clock-out.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: qualia-resume
3
+ description: "Restore context from a previous session. Reads .continue-here.md or STATE.md, summarizes where you left off, routes to next action. Trigger on 'resume', 'continue', 'pick up where I left off', 'what was I doing'."
4
+ ---
5
+
6
+ # /qualia-resume — Resume Work
7
+
8
+ Restore context and route to the right next action.
9
+
10
+ ## Process
11
+
12
+ ### 1. Find Context (priority order)
13
+
14
+ 1. `.continue-here.md` — richest source, from `/qualia-pause`
15
+ 2. `.planning/STATE.md` — project state
16
+ 3. Git history — `git log --oneline -10` + `git diff --stat`
17
+
18
+ ### 2. Restore
19
+
20
+ **If `.continue-here.md` exists:** Read fully. Summarize: what was done, what's in progress, next steps, blockers.
21
+
22
+ **If only STATE.md:** Read STATE.md + tracking.json. Show current phase and status.
23
+
24
+ **If neither:** Reconstruct from git. Present findings, ask user to confirm.
25
+
26
+ ### 3. Detect Incomplete Work
27
+
28
+ - Phase has plan but no verification → execution may be incomplete
29
+ - Uncommitted changes → `git status --short`
30
+ - Phase marked in-progress in STATE.md
31
+
32
+ ### 4. Present and Route
33
+
34
+ ```
35
+ ◆ QUALIA ► RESUMING
36
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
37
+ Last session: {summary}
38
+ Phase: {N} — {status}
39
+ {Uncommitted changes if any}
40
+
41
+ → {next command}
42
+ ```
43
+
44
+ Clean up `.continue-here.md` after restoration (or offer to keep it).
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: qualia-review
3
+ description: "Production audit and code review. General review, --web for web app audit, --ai for AI/voice agent audit. Trigger on 'review', 'audit', 'code review', 'security check', 'production check'."
4
+ ---
5
+
6
+ # /qualia-review — Production Audit
7
+
8
+ Deep review with severity-scored findings. Different from `/qualia-verify` (which checks phase goals). This checks production readiness.
9
+
10
+ ## Usage
11
+
12
+ - `/qualia-review` — General code review
13
+ - `/qualia-review --web` — Web app production audit
14
+ - `/qualia-review --ai` — AI/voice agent audit
15
+
16
+ ## General Review (default)
17
+
18
+ Spawn parallel agents analyzing:
19
+
20
+ 1. **Code Quality** — Clean code, TypeScript strictness, naming, readability
21
+ 2. **Security** — OWASP top 10, auth server-side, RLS policies, secrets scan
22
+ 3. **Architecture** — Component boundaries, coupling, API contracts
23
+ 4. **Performance** — N+1 queries, bundle size, caching, render performance
24
+ 5. **Test Coverage** — Gaps, edge cases, test quality
25
+
26
+ ## --web (Web App Audit)
27
+
28
+ Full production readiness for Next.js + Supabase + Vercel:
29
+
30
+ **Security:** No secrets in code, HTTPS, CORS restricted, CSP headers, rate limiting, npm audit clean.
31
+
32
+ **Performance:** Core Web Vitals (LCP < 2.5s, CLS < 0.1), image optimization, bundle analysis, query performance.
33
+
34
+ **Reliability:** Error boundaries, API error handling, graceful degradation, health check endpoint.
35
+
36
+ **Observability:** Error tracking (Sentry), structured logging, uptime monitoring, analytics.
37
+
38
+ ## --ai (AI/Voice Agent Audit)
39
+
40
+ Auto-detect stack (VAPI, ElevenLabs, Retell, OpenAI, Anthropic, pgvector).
41
+
42
+ **Prompt Safety:** System prompts not exposed, injection defenses, no eval() on AI output, token limits.
43
+
44
+ **Conversation Flow:** Off-topic handling, context window management, error recovery, human handoff.
45
+
46
+ **Voice (if detected):** Latency < 500ms, interruption handling, silence timeout, webhook security.
47
+
48
+ **RAG (if detected):** Embedding consistency, chunk size, retrieval relevance, index refresh.
49
+
50
+ **Resilience:** Provider failover, timeout handling, cost monitoring, streaming error recovery.
51
+
52
+ ## Output
53
+
54
+ Every finding:
55
+ - **What** — description
56
+ - **Where** — `file:line`
57
+ - **Fix** — concrete suggestion
58
+ - **Severity** — CRITICAL / HIGH / MEDIUM / LOW
59
+
60
+ Write to `.planning/REVIEW.md`. CRITICAL or HIGH findings are deploy blockers — `/qualia-ship` checks for them.
61
+
62
+ ```
63
+ ◆ Review Complete
64
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
65
+ Critical: {N}
66
+ High: {N}
67
+ Medium: {N}
68
+ Low: {N}
69
+
70
+ {If blockers: Fix CRITICAL/HIGH before /qualia-ship}
71
+ {If clean: Ready to ship}
72
+ ```
@@ -83,8 +83,10 @@ curl -s -o /dev/null -w "%{http_code}" {domain}/api/auth/callback
83
83
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
84
84
  ```
85
85
 
86
- Update STATE.md: "shipped"
87
- Update tracking.json: status "shipped", deployed_url
86
+ ```bash
87
+ node ~/.claude/bin/state.js transition --to shipped --deployed-url {production url}
88
+ ```
89
+ Do NOT manually edit STATE.md or tracking.json — state.js handles both.
88
90
 
89
91
  ```
90
92
  → Run: /qualia-handoff