qualia-framework 4.4.0 → 5.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.
Files changed (70) hide show
  1. package/AGENTS.md +24 -0
  2. package/CLAUDE.md +12 -63
  3. package/README.md +24 -18
  4. package/agents/builder.md +13 -33
  5. package/agents/plan-checker.md +18 -0
  6. package/agents/planner.md +17 -0
  7. package/agents/verifier.md +70 -0
  8. package/agents/visual-evaluator.md +132 -0
  9. package/bin/cli.js +64 -23
  10. package/bin/install.js +375 -29
  11. package/bin/qualia-ui.js +208 -1
  12. package/bin/slop-detect.mjs +362 -0
  13. package/bin/state.js +218 -2
  14. package/docs/erp-contract.md +5 -0
  15. package/docs/install-redesign-builder-prompt.md +290 -0
  16. package/docs/install-redesign-pilot.md +234 -0
  17. package/docs/playwright-loop-builder-prompt.md +185 -0
  18. package/docs/playwright-loop-design-notes.md +108 -0
  19. package/docs/playwright-loop-pilot-results.md +170 -0
  20. package/docs/playwright-loop-review-2026-05-03.md +65 -0
  21. package/docs/playwright-loop-tester-prompt.md +213 -0
  22. package/docs/reviews/matt-pocock-skills-analysis.md +300 -0
  23. package/guide.md +9 -5
  24. package/hooks/env-empty-guard.js +74 -0
  25. package/hooks/pre-compact.js +19 -9
  26. package/hooks/pre-deploy-gate.js +8 -2
  27. package/hooks/pre-push.js +26 -12
  28. package/hooks/supabase-destructive-guard.js +62 -0
  29. package/hooks/vercel-account-guard.js +91 -0
  30. package/package.json +2 -1
  31. package/rules/design-brand.md +114 -0
  32. package/rules/design-laws.md +148 -0
  33. package/rules/design-product.md +114 -0
  34. package/rules/design-rubric.md +157 -0
  35. package/rules/grounding.md +4 -0
  36. package/skills/qualia-build/SKILL.md +40 -46
  37. package/skills/qualia-discuss/SKILL.md +51 -68
  38. package/skills/qualia-handoff/SKILL.md +1 -0
  39. package/skills/qualia-issues/SKILL.md +151 -0
  40. package/skills/qualia-map/SKILL.md +78 -35
  41. package/skills/qualia-new/REFERENCE.md +139 -0
  42. package/skills/qualia-new/SKILL.md +85 -124
  43. package/skills/qualia-optimize/REFERENCE.md +202 -0
  44. package/skills/qualia-optimize/SKILL.md +72 -237
  45. package/skills/qualia-plan/SKILL.md +58 -65
  46. package/skills/qualia-polish/SKILL.md +180 -136
  47. package/skills/qualia-polish-loop/REFERENCE.md +265 -0
  48. package/skills/qualia-polish-loop/SKILL.md +201 -0
  49. package/skills/qualia-polish-loop/fixtures/broken.html +117 -0
  50. package/skills/qualia-polish-loop/fixtures/clean.html +196 -0
  51. package/skills/qualia-polish-loop/scripts/loop.mjs +302 -0
  52. package/skills/qualia-polish-loop/scripts/playwright-capture.mjs +197 -0
  53. package/skills/qualia-polish-loop/scripts/score.mjs +176 -0
  54. package/skills/qualia-report/SKILL.md +141 -180
  55. package/skills/qualia-research/SKILL.md +28 -33
  56. package/skills/qualia-road/SKILL.md +103 -0
  57. package/skills/qualia-ship/SKILL.md +1 -0
  58. package/skills/qualia-task/SKILL.md +1 -1
  59. package/skills/qualia-test/SKILL.md +50 -2
  60. package/skills/qualia-triage/SKILL.md +152 -0
  61. package/skills/qualia-verify/SKILL.md +63 -104
  62. package/skills/qualia-zoom/SKILL.md +51 -0
  63. package/skills/zoho-workflow/SKILL.md +64 -0
  64. package/templates/CONTEXT.md +36 -0
  65. package/templates/DESIGN.md +229 -435
  66. package/templates/PRODUCT.md +95 -0
  67. package/templates/decisions/ADR-template.md +30 -0
  68. package/tests/bin.test.sh +451 -7
  69. package/tests/state.test.sh +58 -0
  70. package/skills/qualia-design/SKILL.md +0 -169
@@ -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 2), optionally runs discuss/research first. Use when ready to plan a phase."
3
+ description: "Plans the current phase by spawning a planner agent to break it into executable tasks with waves, then validates via a plan-checker revision loop (max 2 cycles). Supports gap-closure mode for verification failures. Use when the user says 'plan this phase', 'break this into tasks', 'create the plan', 'qualia-plan', 'plan phase 2', or after /qualia-new sets up the journey."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -15,15 +15,15 @@ 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 2 revision cycles) before routing to build.
18
+ Spawn planner to break phase into tasks, validate with checker (max 2 revision cycles), route to build.
19
19
 
20
20
  ## Usage
21
21
 
22
- `/qualia-plan` — plan the next unplanned phase
22
+ `/qualia-plan` — plan next unplanned phase
23
23
  `/qualia-plan {N}` — plan specific phase N
24
24
  `/qualia-plan {N} --gaps` — plan fixes for verification failures
25
- `/qualia-plan {N} --skip-check` — skip the plan-checker validation loop (not recommended)
26
- `/qualia-plan {N} --auto` — plan + auto-chain into `/qualia-build {N} --auto` when done (no human approval between plan and build)
25
+ `/qualia-plan {N} --skip-check` — skip plan-checker loop (not recommended)
26
+ `/qualia-plan {N} --auto` — plan + chain into `/qualia-build {N} --auto` (no human gate)
27
27
 
28
28
  ## Process
29
29
 
@@ -38,9 +38,9 @@ node ~/.claude/bin/knowledge.js load patterns
38
38
  node ~/.claude/bin/knowledge.js load client
39
39
  ```
40
40
 
41
- If no phase number given, use the current phase from STATE.md.
41
+ No phase number current phase from STATE.md.
42
42
 
43
- **Read phase-specific context if it exists:**
43
+ **Phase-specific context (if exists):**
44
44
  ```bash
45
45
  cat .planning/phase-{N}-context.md 2>/dev/null # from /qualia-discuss
46
46
  cat .planning/phase-{N}-research.md 2>/dev/null # from /qualia-research
@@ -48,19 +48,17 @@ cat .planning/phase-{N}-research.md 2>/dev/null # from /qualia-research
48
48
 
49
49
  ### 2. Optional: Suggest Deeper Prep
50
50
 
51
- **If ROADMAP.md marked this phase as a "research flag" AND no phase-{N}-research.md exists:**
51
+ **If ROADMAP.md flagged phase for research AND no phase-{N}-research.md:**
52
52
 
53
53
  - header: "Research first?"
54
- - question: "This phase was flagged for deeper research. Run /qualia-research {N} first?"
54
+ - question: "Phase flagged for research. Run /qualia-research {N} first?"
55
55
  - options:
56
- - "Yes, research first" — Run /qualia-research {N} inline, then continue
57
- - "Skip, plan directly" — I know enough
56
+ - "Yes, research first"
57
+ - "Skip, plan directly"
58
58
 
59
- **If phase involves compliance/regulatory/architectural stakes AND no phase-{N}-context.md exists:**
59
+ **If phase has compliance/regulatory/architectural stakes AND no phase-{N}-context.md:**
60
60
 
61
- Briefly suggest: *"Want to run /qualia-discuss {N} first to lock decisions? Optional."*
62
-
63
- Don't force it. Some phases don't need it.
61
+ Suggest: *"Run /qualia-discuss {N} first to lock decisions? Optional."*
64
62
 
65
63
  ### 3. Spawn Planner (Fresh Context)
66
64
 
@@ -69,12 +67,9 @@ node ~/.claude/bin/qualia-ui.js banner plan {N} "{phase name from ROADMAP.md}"
69
67
  node ~/.claude/bin/qualia-ui.js spawn planner "Breaking phase into tasks..."
70
68
  ```
71
69
 
72
- Spawn the planner:
73
-
74
70
  ```
75
71
  Agent(prompt="
76
- Read your role: @~/.claude/agents/planner.md
77
- Grounding + rubrics: @~/.claude/rules/grounding.md
72
+ Role: @~/.claude/agents/planner.md
78
73
 
79
74
  <project_context>
80
75
  @.planning/PROJECT.md
@@ -89,86 +84,84 @@ Phase {N} from ROADMAP.md:
89
84
  @.planning/ROADMAP.md
90
85
 
91
86
  Goal: {goal from ROADMAP.md}
92
- Requirements: {REQ-IDs from ROADMAP.md}
87
+ Reqs: {REQ-IDs from ROADMAP.md}
93
88
  Success criteria: {success criteria from ROADMAP.md}
94
89
  </phase_details>
95
90
 
96
91
  <locked_decisions>
97
- {if phase-{N}-context.md exists, inline its Locked Decisions section; else 'none'}
92
+ {phase-{N}-context.md Locked Decisions if exists, else 'none'}
98
93
  </locked_decisions>
99
94
 
100
95
  <research_findings>
101
- {if phase-{N}-research.md exists, inline its recommendation; else 'none'}
96
+ {phase-{N}-research.md recommendation if exists, else 'none'}
102
97
  </research_findings>
103
98
 
104
- {If --gaps: Also read @.planning/phase-{N}-verification.md for failures to fix. Create gap-closure plan.}
99
+ {--gaps read @.planning/phase-{N}-verification.md failures. Create gap-closure plan.}
105
100
 
106
101
  <relevant_learnings>
107
- {inline any applicable patterns from knowledge/learned-patterns.md}
102
+ {applicable patterns from knowledge/learned-patterns.md}
108
103
  </relevant_learnings>
109
104
 
110
- Create the plan at .planning/phase-{N}-plan.md (or .planning/phase-{N}-gaps-plan.md for --gaps).
105
+ Output: .planning/phase-{N}-plan.md (or phase-{N}-gaps-plan.md for --gaps).
111
106
  ", subagent_type="qualia-planner", description="Plan phase {N}")
112
107
  ```
113
108
 
114
- ### 4. Validate the Plan (unless --skip-check)
109
+ ### 4. Validate Plan (unless --skip-check)
115
110
 
116
- Read the generated plan. Spawn the plan-checker:
111
+ Read generated plan. Spawn checker:
117
112
 
118
113
  ```
119
114
  Agent(prompt="
120
- Read your role: @~/.claude/agents/plan-checker.md
121
- Grounding + rubrics: @~/.claude/rules/grounding.md
115
+ Role: @~/.claude/agents/plan-checker.md
122
116
 
123
117
  <plan_path>.planning/phase-{N}-plan.md</plan_path>
124
118
  <phase_goal>{goal from ROADMAP.md}</phase_goal>
125
119
  <success_criteria>{criteria from ROADMAP.md}</success_criteria>
126
120
  <project_context>@.planning/PROJECT.md</project_context>
127
121
 
128
- Validate against the 7 rules. Return PASS or REVISE with structured issues.
122
+ Validate against 7 rules. Return PASS or REVISE with structured issues.
129
123
  ", subagent_type="qualia-plan-checker", description="Check plan phase {N}")
130
124
  ```
131
125
 
132
- **Revision loop (max 2 iterations):**
126
+ **Revision loop (max 2):**
133
127
 
134
- - Iteration 1: Check → if REVISE, re-spawn planner with checker issues
135
- - Iteration 2: Re-check → if REVISE or BLOCKED, escalate to user
128
+ - Iter 1: Check → REVISE re-spawn planner with checker issues
129
+ - Iter 2: Re-check → REVISE/BLOCKED escalate to user
136
130
 
137
- 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).
131
+ (74→86% after 1 round, 88% after 3. Iter 3 adds only 2pp; not worth extra spawn.)
138
132
 
139
- For each revision:
133
+ Per revision:
140
134
 
141
135
  ```
142
136
  Agent(prompt="
143
- Read your role: @~/.claude/agents/planner.md
137
+ Role: @~/.claude/agents/planner.md
144
138
 
145
139
  <revision_mode>true</revision_mode>
146
140
  <current_plan>@.planning/phase-{N}-plan.md</current_plan>
147
141
  <checker_feedback>
148
- {inline REVISE output from plan-checker}
142
+ {REVISE output from plan-checker}
149
143
  </checker_feedback>
150
144
 
151
- Revise the plan in place. Address every issue. Do NOT add new tasks or change scope
152
- — only fix what the checker flagged.
145
+ Revise in place. Address every issue. Do NOT add tasks or change scope; fix only what checker flagged.
153
146
  ", subagent_type="qualia-planner", description="Revise plan phase {N}")
154
147
  ```
155
148
 
156
- After revision, spawn the checker again. Max 2 total revision cycles.
149
+ After revision, re-spawn checker. Max 2 total cycles.
157
150
 
158
- **If checker returns BLOCKED after 2 cycles:**
151
+ **BLOCKED after 2 cycles:**
159
152
 
160
153
  ```bash
161
154
  node ~/.claude/bin/qualia-ui.js fail "Plan failed validation after 2 revisions"
162
155
  ```
163
156
 
164
- Show the remaining issues. Ask:
165
- - "Skip validation and proceed anyway" (use `--skip-check`)
166
- - "Adjust the roadmap" (phase scope may be wrong)
167
- - "Adjust the phase goal" (success criteria may be under-specified)
157
+ Show remaining issues. Options:
158
+ - "Skip validation" (`--skip-check`)
159
+ - "Adjust roadmap" (scope wrong)
160
+ - "Adjust phase goal" (criteria under-specified)
168
161
 
169
162
  ### 5. Present Final Plan
170
163
 
171
- Render the story-file dashboard — this is a single command that parses the plan and shows the phase goal, waves, tasks, personas, dependencies, acceptance-criteria counts, and validation counts:
164
+ Render story-file dashboard:
172
165
 
173
166
  ```bash
174
167
  node ~/.claude/bin/qualia-ui.js plan-summary .planning/phase-{N}-plan.md
@@ -184,19 +177,19 @@ If "adjust" — get feedback, re-spawn planner with revision context, re-validat
184
177
  node ~/.claude/bin/state.js transition --to planned --phase {N}
185
178
  ```
186
179
 
187
- If state.js returns an error, show it and stop. Do NOT manually edit STATE.md or tracking.json.
180
+ Error show, stop. Do NOT edit STATE.md or tracking.json manually.
188
181
 
189
182
  ### 7. Route (auto-chain aware)
190
183
 
191
- **If invoked with `--auto`:** immediately invoke `/qualia-build {N} --auto` inline. The user already approved the whole journey at `/qualia-new` time — no additional approval needed per phase plan.
184
+ **`--auto`:** invoke `/qualia-build {N} --auto` inline. User approved at `/qualia-new`; no per-phase gate.
192
185
 
193
186
  ```bash
194
187
  node ~/.claude/bin/qualia-ui.js info "Auto mode — chaining into /qualia-build {N}"
195
188
  ```
196
189
 
197
- Then invoke the `qualia-build` skill inline with `--auto`.
190
+ Then invoke `qualia-build` inline with `--auto`.
198
191
 
199
- **Otherwise (guided mode):** stop and show the next step:
192
+ **Guided mode:** stop, show next step:
200
193
 
201
194
  ```bash
202
195
  node ~/.claude/bin/qualia-ui.js end "PHASE {N} PLANNED" "/qualia-build {N}"
@@ -204,22 +197,22 @@ node ~/.claude/bin/qualia-ui.js end "PHASE {N} PLANNED" "/qualia-build {N}"
204
197
 
205
198
  ## Gap Closure Mode (`--gaps`)
206
199
 
207
- When invoked as `/qualia-plan {N} --gaps`, the planner is in gap-closure mode:
200
+ With `--gaps`, planner enters gap-closure mode:
208
201
 
209
- 1. Read `.planning/phase-{N}-verification.md` extract ONLY the FAIL items
210
- 2. For each FAIL item, create a targeted fix task:
211
- - **Files:** specific files that failed verification
212
- - **Action:** specific fix (not "fix auth" "add session persistence check in src/lib/auth.ts signIn function")
213
- - **Acceptance Criteria:** the exact verification criterion that previously failed, restated as an observable behavior
214
- 3. Do NOT re-plan passing items. Do NOT add new features. Gap plans are surgical.
215
- 4. Write to `.planning/phase-{N}-gaps-plan.md` (separate from original plan)
216
- 5. All gap tasks are Wave 1 (parallel) unless they share files
217
- 6. Plan-checker still validates the gap plan — same 7 rules apply
202
+ 1. Read `.planning/phase-{N}-verification.md` extract ONLY FAIL items
203
+ 2. Per FAIL, create targeted fix task:
204
+ - **Files:** specific files that failed
205
+ - **Action:** specific fix (not "fix auth"; "add session persistence check in src/lib/auth.ts signIn fn")
206
+ - **AC:** failed criterion restated as observable behavior
207
+ 3. Do NOT re-plan passing items. No new features. Surgical only.
208
+ 4. Output: `.planning/phase-{N}-gaps-plan.md`
209
+ 5. All gap tasks Wave 1 (parallel) unless they share files
210
+ 6. Plan-checker still validates; same 7 rules
218
211
 
219
212
  ## Rules
220
213
 
221
- 1. **Plan-checker is mandatory by default.** Only skip with `--skip-check`, and only if you know what you're doing.
222
- 2. **Max 3 revision cycles.** After 3 failed checks, escalate — the phase scope is probably wrong.
223
- 3. **Honor locked decisions.** If phase-{N}-context.md exists, its locked decisions are non-negotiable.
224
- 4. **One plan file per phase.** Don't create phase-1-plan.md AND phase-1-plan-v2.md. Edit in place.
225
- 5. **Revision is surgical.** When revising, only fix what the checker flagged no scope creep.
214
+ 1. **Plan-checker mandatory by default.** Skip only with `--skip-check`.
215
+ 2. **Max 3 revision cycles.** 3 fails escalate; scope probably wrong.
216
+ 3. **Honor locked decisions.** phase-{N}-context.md locked decisions non-negotiable.
217
+ 4. **One plan file per phase.** No phase-1-plan-v2.md. Edit in place.
218
+ 5. **Revision is surgical.** Fix only what checker flagged; no scope creep.