qualia-framework 5.3.0 → 5.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 (60) hide show
  1. package/README.md +54 -30
  2. package/agents/builder.md +33 -8
  3. package/agents/plan-checker.md +60 -3
  4. package/agents/planner.md +26 -2
  5. package/agents/qa-browser.md +10 -0
  6. package/agents/research-synthesizer.md +10 -0
  7. package/agents/researcher.md +38 -2
  8. package/agents/roadmapper.md +10 -0
  9. package/agents/verifier.md +15 -3
  10. package/agents/visual-evaluator.md +1 -1
  11. package/bin/install.js +44 -2
  12. package/bin/plan-contract.js +32 -1
  13. package/bin/state.js +155 -133
  14. package/docs/archive/v4.0.0-review.md +288 -0
  15. package/docs/erp-contract.md +11 -0
  16. package/guide.md +14 -7
  17. package/hooks/session-start.js +1 -1
  18. package/package.json +5 -2
  19. package/rules/architecture.md +125 -0
  20. package/rules/infrastructure.md +1 -2
  21. package/rules/speed.md +55 -0
  22. package/skills/qualia-discuss/SKILL.md +17 -3
  23. package/skills/qualia-help/SKILL.md +1 -1
  24. package/skills/qualia-map/SKILL.md +1 -1
  25. package/skills/qualia-milestone/SKILL.md +1 -1
  26. package/skills/qualia-new/SKILL.md +2 -2
  27. package/skills/qualia-optimize/REFERENCE.md +2 -2
  28. package/skills/qualia-optimize/SKILL.md +1 -1
  29. package/skills/qualia-polish/SKILL.md +3 -3
  30. package/skills/qualia-polish-loop/REFERENCE.md +1 -1
  31. package/skills/qualia-polish-loop/SKILL.md +3 -3
  32. package/skills/qualia-polish-loop/fixtures/broken.html +2 -2
  33. package/skills/qualia-polish-loop/scripts/score.mjs +1 -1
  34. package/skills/qualia-postmortem/SKILL.md +1 -1
  35. package/skills/qualia-quick/SKILL.md +1 -1
  36. package/skills/qualia-report/SKILL.md +8 -6
  37. package/skills/qualia-research/SKILL.md +5 -3
  38. package/skills/qualia-road/SKILL.md +15 -5
  39. package/skills/qualia-task/SKILL.md +1 -1
  40. package/templates/CONTEXT.md +3 -2
  41. package/templates/PRODUCT.md +1 -1
  42. package/templates/help.html +1 -1
  43. package/templates/phase-context.md +5 -4
  44. package/tests/bin.test.sh +33 -3
  45. package/tests/lib.test.sh +21 -0
  46. package/tests/skills.test.sh +143 -0
  47. package/tests/slop-detect.test.sh +160 -0
  48. package/docs/install-redesign-builder-prompt.md +0 -290
  49. package/docs/install-redesign-pilot.md +0 -234
  50. package/docs/journey-demo.html +0 -1008
  51. package/docs/playwright-loop-builder-prompt.md +0 -185
  52. package/docs/playwright-loop-design-notes.md +0 -108
  53. package/docs/playwright-loop-tester-prompt.md +0 -213
  54. package/docs/polish-loop-supervised-run.md +0 -111
  55. /package/{rules → qualia-design}/design-brand.md +0 -0
  56. /package/{rules → qualia-design}/design-laws.md +0 -0
  57. /package/{rules → qualia-design}/design-product.md +0 -0
  58. /package/{rules → qualia-design}/design-reference.md +0 -0
  59. /package/{rules → qualia-design}/design-rubric.md +0 -0
  60. /package/{rules → qualia-design}/frontend.md +0 -0
@@ -2,6 +2,17 @@
2
2
 
3
3
  The Qualia Framework optionally uploads session reports to the company ERP at `https://portal.qualiasolutions.net`. This document specifies the API shape.
4
4
 
5
+ ## Operating Model
6
+
7
+ The ERP treats `/qualia-report` as an employee shift submission, not proof that an assigned task was finished. Employees clock out after their fixed daily hours and submit what happened during the shift: shipped work, partial progress, blockers, investigation, meetings, or no-code work.
8
+
9
+ Primary ERP planning dates are:
10
+ - Project deadline
11
+ - Milestone deadline
12
+ - Employee submission date from the uploaded report
13
+
14
+ Phase and task counters remain framework telemetry. They help agents plan/build/verify, but they should not become the ERP's primary navigation, deadline model, or employee-performance label.
15
+
5
16
  ## Configuration
6
17
 
7
18
  Stored in `~/.claude/.qualia-config.json`:
package/guide.md CHANGED
@@ -1,8 +1,10 @@
1
- # Qualia Developer Guide (v5)
1
+ # Qualia Developer Guide (v5.3)
2
2
 
3
3
  > Follow the road. Type the commands. The framework handles the rest.
4
4
  > `--auto` chains the whole road end-to-end with only two human checkpoints per project.
5
5
 
6
+ **v5.3 ships three Matt-Pocock gap closures:** `/qualia-prd` (synthesize conversation → durable spec), `/qualia-hook-gen` (CLAUDE.md instruction → deterministic hook), `/qualia-optimize --deepen` Step 5b (3 parallel-interface design variants for refactor RFCs). Plus the visual-polish loop (`/qualia-polish-loop`) from v5.1 with reduced-motion + multi-route flags from v5.2.
7
+
6
8
  ## The Road
7
9
 
8
10
  ```
@@ -49,18 +51,23 @@ Append `--auto` to `/qualia-new` and the framework chains every step:
49
51
  |------|---------|-------------|
50
52
  | Starting | `/qualia-new` | Set up project with full journey (all milestones → Handoff) |
51
53
  | Starting (auto) | `/qualia-new --auto` | Same + chain through building automatically |
54
+ | Brownfield | `/qualia-map` | Map an existing codebase BEFORE `/qualia-new` |
55
+ | Mid-project spec | `/qualia-prd` | Synthesize the current conversation into a durable feature spec (v5.3+) |
52
56
  | Building | `/qualia-plan` | Plan the current phase |
53
57
  | | `/qualia-build` | Build it (parallel tasks) |
54
58
  | | `/qualia-verify` | Check it actually works |
55
59
  | Milestone | `/qualia-milestone` | Close current, open next from JOURNEY.md |
56
60
  | Quick fix | `/qualia-quick` | Skip planning, just do it |
57
- | Finishing | `/qualia-polish` | Design and UX pass |
61
+ | Finishing | `/qualia-polish` | Design and UX pass (scope-adaptive: component / route / app / redesign / critique / quick) |
62
+ | | `/qualia-polish-loop` | Autonomous visual-polish loop — screenshot → vision-eval → fix → repeat (v5.1+) |
58
63
  | | `/qualia-ship` | Deploy to production |
59
64
  | | `/qualia-handoff` | Deliver to client (4 mandatory deliverables) |
60
65
  | Reporting | `/qualia-report` | Log what you did (mandatory before clock-out) |
61
66
  | Zooming in | `/qualia-zoom` | Focus on a single file or function with full context |
62
- | Issues | `/qualia-issues` | Scan codebase for issues, tech debt, and improvement opportunities |
63
- | Triage | `/qualia-triage` | Prioritize and categorize a backlog of issues |
67
+ | Issues | `/qualia-issues` | Break a phase plan into vertical-slice GitHub issues |
68
+ | Triage | `/qualia-triage` | Triage open issues through the ready-for-agent state machine |
69
+ | Optimize | `/qualia-optimize --deepen` | Find shallow modules; v5.3+ spawns 3 parallel interface-design variants per candidate |
70
+ | Hook gen | `/qualia-hook-gen` | Convert a CLAUDE.md/rules instruction into a deterministic hook (v5.3+) |
64
71
  | Road view | `/qualia-road` | View and navigate journey/milestone/phase status |
65
72
  | Lost? | `/qualia` | Mechanical next-command router |
66
73
  | Confused? | `/qualia-idk` | Diagnostic — scans planning + code, explains what's going on |
@@ -102,7 +109,7 @@ If neither helps, paste the error and ask Claude directly. If Claude can't fix i
102
109
  ## Session Start / End
103
110
 
104
111
  **Start:** Claude loads your project context automatically. The router banner shows your journey position ("M2 of 4 · P2 of 3").
105
- **End:** Run `/qualia-report` — this is mandatory before clock-out. The report is committed to git and (if ERP is enabled) uploaded to https://portal.qualiasolutions.net.
112
+ **End:** Run `/qualia-report` — this is the mandatory clock-out submission. It reports what happened during the work shift, even if the work is unfinished. The report is committed to git and (if ERP is enabled) uploaded to https://portal.qualiasolutions.net.
106
113
 
107
114
  ## How It Works (you don't need to know this, but if curious)
108
115
 
@@ -113,7 +120,7 @@ If neither helps, paste the error and ask Claude directly. If Claude can't fix i
113
120
  - **Story-file plans:** Every task has Why / Acceptance Criteria / Depends on / Validation inline — the plan IS the brief.
114
121
  - **Wave execution:** Independent tasks run in parallel. Dependent tasks wait.
115
122
  - **Milestone-boundary pauses:** In `--auto` mode, the framework pauses only at real decision points. Everything else runs on rails.
116
- - **tracking.json:** Updated on every push. The ERP reads it automatically. Includes `milestone_name` + `milestones[]` so the ERP renders a proper tree instead of a flat list.
123
+ - **tracking.json:** Updated on every push. The ERP reads it automatically. Includes `milestone_name` + `milestones[]` so the ERP can show project and milestone progress without exposing framework tasks as the main employee workflow.
117
124
 
118
125
  ## Quick Reference
119
126
 
@@ -127,4 +134,4 @@ If neither helps, paste the error and ask Claude directly. If Claude can't fix i
127
134
  | Finished the last phase of a milestone | `/qualia-milestone` |
128
135
  | About to ship | `/qualia-ship` |
129
136
  | Client is ready to take over | `/qualia-handoff` |
130
- | End of workday | `/qualia-report` (mandatory) |
137
+ | End of workday / clock-out | `/qualia-report` (mandatory shift submission) |
@@ -34,8 +34,8 @@ const HEALTH_FILE = path.join(HOME, ".claude", ".qualia-install-health.json");
34
34
  const CRITICAL_FILES = [
35
35
  path.join(HOME, ".claude", "rules", "grounding.md"),
36
36
  path.join(HOME, ".claude", "rules", "security.md"),
37
- path.join(HOME, ".claude", "rules", "frontend.md"),
38
37
  path.join(HOME, ".claude", "rules", "deployment.md"),
38
+ path.join(HOME, ".claude", "qualia-design", "frontend.md"),
39
39
  path.join(HOME, ".claude", "bin", "state.js"),
40
40
  ];
41
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qualia-framework",
3
- "version": "5.3.0",
3
+ "version": "5.5.0",
4
4
  "description": "Claude Code workflow framework by Qualia Solutions. Plan, build, verify, ship.",
5
5
  "bin": {
6
6
  "qualia-framework": "./bin/cli.js"
@@ -28,14 +28,17 @@
28
28
  "test:hooks": "bash tests/hooks.test.sh",
29
29
  "test:bin": "bash tests/bin.test.sh",
30
30
  "test:lib": "bash tests/lib.test.sh",
31
+ "test:skills": "bash tests/skills.test.sh",
32
+ "test:slop-detect": "bash tests/slop-detect.test.sh",
31
33
  "test:statusline": "bash tests/statusline.test.sh",
32
- "test:shell": "bash tests/statusline.test.sh && bash tests/state.test.sh && bash tests/hooks.test.sh && bash tests/bin.test.sh && bash tests/lib.test.sh"
34
+ "test:shell": "bash tests/statusline.test.sh && bash tests/state.test.sh && bash tests/hooks.test.sh && bash tests/bin.test.sh && bash tests/lib.test.sh && bash tests/skills.test.sh && bash tests/slop-detect.test.sh"
33
35
  },
34
36
  "files": [
35
37
  "bin/",
36
38
  "agents/",
37
39
  "hooks/",
38
40
  "rules/",
41
+ "qualia-design/",
39
42
  "skills/",
40
43
  "templates/",
41
44
  "references/",
@@ -0,0 +1,125 @@
1
+ # Architecture Rules
2
+
3
+ How Qualia code stays navigable for future agents (human and AI). Read on architectural-judgment tasks: refactors, new module decisions, deep-module work, `/qualia-optimize --deepen`.
4
+
5
+ ## 1. Deep modules over shallow ones (Ousterhout)
6
+
7
+ A **deep module** hides significant complexity behind a small, stable interface. A **shallow module** exposes most of its internals — every caller has to know how it works to use it.
8
+
9
+ | | Deep | Shallow |
10
+ |---|---|---|
11
+ | Interface size (params, exports) | Small | Wide |
12
+ | Internal logic | Substantial | Trivial |
13
+ | Cost to change implementation | Low (callers don't notice) | High (every caller breaks) |
14
+ | Cost to read a caller | Low | High (must know module internals) |
15
+
16
+ Deep modules are the primary defense against AI-generated entropy. AI is excellent at generating implementation; humans (and AI under guidance) must defend the **interface**.
17
+
18
+ ### Smell — shallow code
19
+
20
+ If you spot any of these, the module is shallow and is a refactor candidate:
21
+
22
+ - A wrapper function that does only argument shuffling and a single inner call.
23
+ - A type-only file that re-exports types from elsewhere.
24
+ - A "service" that has 8 public methods and one private one.
25
+ - A util module where every export is used in exactly one place.
26
+ - A class whose every method is a one-liner pass-through.
27
+
28
+ `/qualia-optimize --deepen` is the skill that scouts for these and proposes interface consolidations.
29
+
30
+ ## 2. Locality over cleverness
31
+
32
+ Code that changes together should live together. The cost of a "DRY" abstraction is paid every time a future caller has to mentally fork to the abstraction's definition. Three similar lines beats a premature `extractCommon()` that everyone has to read twice.
33
+
34
+ Apply DRY only when:
35
+ - The duplication is exact (not just similar shape).
36
+ - The thing duplicated is unlikely to diverge.
37
+ - The caller doesn't need to know "the rule" to read the call site.
38
+
39
+ If any of those three is uncertain, leave the duplication. Pocock's rule of thumb: **three is the threshold, but only if all three would change in lock-step.**
40
+
41
+ ## 3. Adapters at seams
42
+
43
+ Wherever the system meets an external dependency (database, third-party API, AI provider, payment gateway), introduce an adapter. The adapter:
44
+
45
+ - Owns the dependency's specific shape (auth headers, response envelopes, error formats).
46
+ - Translates to a project-internal type that the rest of the code uses.
47
+ - Is the only file that needs to change when the dependency is swapped or upgraded.
48
+
49
+ This is the seam where tests inject fakes and where future migrations live. A codebase without adapters is a codebase that fights every dependency upgrade.
50
+
51
+ **Example seams** in a typical Qualia project:
52
+ - `lib/supabase/server.ts` — adapter over `@supabase/supabase-js`.
53
+ - `lib/openrouter/client.ts` — adapter over OpenRouter REST API.
54
+ - `lib/retell/agent.ts` — adapter over Retell AI SDK.
55
+ - `lib/zoho/contacts.ts` — adapter over Zoho Books API.
56
+
57
+ Direct calls to vendor SDKs from feature code are a smell. Move them through an adapter.
58
+
59
+ ## 4. Progressive disclosure of complexity
60
+
61
+ A reader entering the codebase from a fresh clone should be able to follow this path:
62
+
63
+ ```
64
+ README.md → app/ or src/index → one feature folder → one route → one component → one util
65
+ ```
66
+
67
+ At each step the depth increases. The top is breadth (what does this app do?), the bottom is depth (how does this specific util compute X?). Skipping levels is a smell:
68
+
69
+ - An entry point that imports 30 modules from across the tree → the tree is shallow.
70
+ - A route handler that calls a database directly → no service layer; logic and IO are entangled.
71
+ - A component that owns its own data fetching, mutation logic, error handling, and rendering → no hook abstraction; the component will be impossible to test or replace.
72
+
73
+ The pattern that tells a fresh reader where to go next is **layered service boundaries**:
74
+ 1. **Routes / pages** — wiring only. No business logic.
75
+ 2. **Features / use cases** — business logic. Calls services.
76
+ 3. **Services** — orchestration. Calls adapters.
77
+ 4. **Adapters** — IO. The only layer that talks to vendors.
78
+ 5. **Domain types** — pure. No imports of the above.
79
+
80
+ Inversions of this order (domain types importing adapters, services calling components) are bugs in shape.
81
+
82
+ ## 5. Interface stability beats internal elegance
83
+
84
+ Once an interface has callers, changing it is expensive. Internal refactors are cheap. **Optimize for the cost of change.**
85
+
86
+ When in doubt:
87
+ - A new public function: write it conservatively. Defaults are a liability — every default is a future migration.
88
+ - An internal function: write it expressively. Internal callers can be fixed in one sweep.
89
+
90
+ Pocock's heuristic from de-slop: *the interface is the thing the AI shouldn't change without you. The implementation is the thing the AI can rewrite at will.*
91
+
92
+ ## 6. Test the seam, not the function
93
+
94
+ Unit tests that pin internal function signatures rot fast — every refactor breaks them. Tests against the **adapter** or **service interface** survive refactors.
95
+
96
+ Order of test value (high → low):
97
+ 1. **End-to-end / user-flow** — tests at the route level. Survive everything except feature changes.
98
+ 2. **Service-level** — tests at the use-case boundary. Survive most refactors.
99
+ 3. **Adapter-level** — tests with the vendor mocked. Survive vendor swaps.
100
+ 4. **Unit / function-level** — tests against a single internal function. Last resort. Only for genuinely tricky algorithms.
101
+
102
+ The pyramid in older textbooks (lots of unit, few e2e) inverted in the AI era. AI generates internal functions cheaply; the seam tests are the ones that survive AI-driven refactors.
103
+
104
+ ## 7. The codebase IS the documentation
105
+
106
+ Per Pocock's *"Never run /init"*: static documentation rots within weeks. The agents and humans should be able to **explore** to discover, not **memorize** to recall.
107
+
108
+ Practical rules:
109
+ - README.md: orientation only — what is this app, how do I run it, where is the source of truth for the rest. Not API docs, not architecture diagrams that will lie within a sprint.
110
+ - `.planning/CONTEXT.md`: domain glossary, append-only as terms emerge. Discovered, not maintained.
111
+ - ADRs in `.planning/decisions/`: hard-to-reverse calls, dated, immutable. Future archaeology, not current spec.
112
+ - Anything else: it lives in code or it doesn't exist. If you need a diagram, generate it from the code at read-time.
113
+
114
+ A skill or agent that needs context should `Read` the relevant code, not a synopsis of it written six months ago.
115
+
116
+ ## 8. When to apply this rule file
117
+
118
+ Read this file (auto-load via skill or `@rules/architecture.md`) when:
119
+
120
+ - Planning a new module or feature with multiple components.
121
+ - The user requests `/qualia-optimize --deepen` or `--alignment`.
122
+ - A verifier is scoring "Container depth & nesting" (per `rules/design-rubric.md` dimension 8).
123
+ - An ADR is being drafted for an architectural fork.
124
+
125
+ Do **not** auto-load this on quick fixes, copy edits, single-component touch-ups — that wastes instruction budget. Use judgment.
@@ -8,8 +8,7 @@ Standard services across all Qualia projects. Use these unless the project expli
8
8
 
9
9
  ## Database: Supabase (every project)
10
10
  - Every project uses Supabase for auth, database, and storage
11
- - **CLI:** `npx supabase` migrations, type generation, local dev
12
- - **MCP:** Supabase MCP server is available in Claude Code for direct database operations
11
+ - **CLI-first** — prefer `npx supabase` (migrations, type generation, local dev, SQL) over the Supabase MCP server. The MCP imposes a token tax on every turn; the CLI hits the same API at zero token cost. Use the MCP only when you need a feature the CLI doesn't expose (e.g., interactive branch management).
13
12
  - Always enable RLS on every table (see `rules/security.md`)
14
13
  - Use `lib/supabase/server.ts` for server-side, `lib/supabase/client.ts` for client-side
15
14
  - Run `npx supabase gen types` after schema changes
package/rules/speed.md ADDED
@@ -0,0 +1,55 @@
1
+ ---
2
+ alwaysApply: true
3
+ ---
4
+
5
+ # Speed Rules (MANDATORY)
6
+
7
+ ## Direct tools over subagents
8
+
9
+ **NEVER use Task(Explore) or Task(general-purpose) for simple file lookups or code searches.** Use direct tools instead:
10
+ - **Glob** for finding files by name/pattern
11
+ - **Grep** for searching code content
12
+ - **Read** for reading specific files
13
+ - Only use Task(Explore) when you genuinely need 5+ rounds of deep codebase archaeology.
14
+
15
+ **NEVER spawn subagents when direct tools work.** Subagents are slow — a direct Glob or Grep returns in seconds, a fresh agent burns 5-10 seconds of spawn overhead plus its own context budget.
16
+
17
+ **Bias toward action, not exploration.** If the user asks you to fix something and you know the project structure, just do it.
18
+
19
+ ## CLI-first, MCP only when CLI can't
20
+
21
+ MCP servers impose a **token tax**: their tool definitions consume context-window space on every turn, even when unused. CLIs that the model already knows from training data (git, gh, supabase, vercel, railway, npx, curl) impose zero token tax — the model recalls them from weights, not from the prompt.
22
+
23
+ **Default to CLI.** Reach for MCP only when:
24
+ - The CLI doesn't exist or doesn't expose the operation you need.
25
+ - The CLI requires interactive auth that MCP has already brokered (e.g., Stripe Dashboard).
26
+ - The MCP returns structured JSON that would be expensive to parse from CLI text output.
27
+ - The MCP enforces governance (RLS-aware queries, scoped DB credentials) that the CLI doesn't.
28
+
29
+ If a `/skill-name` exists that wraps a CLI, prefer the skill — it's been hardened. Canonical example: `/supabase` skill replaces 32 supabase MCP tools with `supabase` CLI calls and saves substantial token budget.
30
+
31
+ ### MCP tier-list (when each is justified)
32
+
33
+ | Server | Always-on? | Justification |
34
+ |---|---|---|
35
+ | `claude-in-chrome` | On-demand | Browser automation has no CLI equivalent; use for QA flows only |
36
+ | `supabase` MCP | **Off** in favor of `/supabase` skill | CLI covers 95% of operations; MCP only if you need branch management interactively |
37
+ | `context7` | On-demand | Library docs at runtime — no CLI alternative for Context7 itself |
38
+ | `notebooklm-mcp` | On-demand | NotebookLM has no CLI; only loaded when researching against existing notebooks |
39
+ | `firecrawl-mcp` | On-demand | Web scraping; only loaded when feature requires it |
40
+ | `next-devtools` | Always-on (dev) | Next.js 16 runtime errors not visible elsewhere |
41
+ | `mux`, `stitch`, `higgsfield` | On-demand | Specialized API surfaces; load only on relevant client work |
42
+ | `ZohoMCP`, `qualia-erp` | On-demand | Business ops only, not engineering-path |
43
+
44
+ The pattern: **on-demand by default; always-on only when the data is irreducibly remote AND there's no CLI.**
45
+
46
+ ## Use shortcuts (Qualia commands)
47
+
48
+ When a Qualia command exists for the situation, use it — don't reinvent:
49
+ - `/qualia` — what's my next step?
50
+ - `/qualia-quick` — small inline fix, no plan, no spawn
51
+ - `/qualia-task` — single focused task, fresh builder spawn, atomic commit
52
+ - `/qualia-ship` — full deploy pipeline (quality gates → commit → deploy → verify)
53
+ - `/qualia-review` — production audit
54
+ - `/qualia-pause` — save context before clearing the conversation
55
+ - `/qualia-learn` — save a lesson from a mistake
@@ -67,10 +67,24 @@ Wait for response. Then:
67
67
  - Write an ADR in `.planning/decisions/ADR-{NNNN}-{slug}.md` ONLY when the decision is hard-to-reverse, surprising-without-context, AND involves real trade-offs (use the template — keep it scarce)
68
68
  - Drill deeper if the answer opens new branches
69
69
 
70
- ### 4. Build the locked-decisions list
70
+ ### 4. Build the locked-decisions list (with IDs — machine-parseable downstream)
71
71
 
72
- For each resolved decision, capture: choice (what) / rationale (why) / source (who/when).
73
- Also track: **Discretion items** (planner decides) / **Deferred ideas** (NOT this phase) / **Risk flags** (watch during build) / **Open questions** (still unresolved).
72
+ For each resolved decision, capture as a row with a stable ID `D-NN` (zero-padded, sequential within the phase). The planner's Decision Coverage Audit checks every `D-NN` is implemented; the plan-checker BLOCKS if any is missing.
73
+
74
+ **Locked Decision row format:**
75
+
76
+ | ID | Decision | Rationale | Source |
77
+ |----|----------|-----------|--------|
78
+ | D-01 | Use Supabase RLS for authorization, not middleware | Compliance requires database-level checks | discuss session 2026-05-09 |
79
+ | D-02 | Store session tokens server-side, not in JWT | OWASP guidance + revocation requirement | ADR-0007 |
80
+
81
+ Also track:
82
+ - **Discretion items** — planner decides based on best practice (no IDs needed).
83
+ - **Deferred ideas** — explicitly NOT this phase. The plan-checker will REVISE if any of these appears in a task.
84
+ - **Risk flags** — watch during build (no IDs).
85
+ - **Open questions** — still unresolved. Cannot lock until resolved.
86
+
87
+ When you reference a decision later (in commit messages, task Why fields, ADRs), use its ID — `D-03` is shorter than the full decision text and cross-checkable.
74
88
 
75
89
  ### 5. Decision gate
76
90
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-help
3
- description: "Open the Qualia Framework reference guide in the browser. A beautiful themed HTML page with all commands, rules, services, and the road. Trigger on 'help', 'how does this work', 'show me the commands', 'qualia help', 'reference'."
3
+ description: "Open the BROWSER HTML reference for the Qualia Framework themed page with all commands, rules, services, and the road. The default when a browser is available. For terminal-only output (SSH, headless), use /qualia-road. Triggers: 'help', 'how does this work', 'show me the commands', 'qualia help', 'reference', 'open the docs'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-map
3
- description: "Map an existing codebase to infer architecture, stack, conventions, what's already built, AND adapt Qualia to the repo's existing tracker/labels/glossary conventions (onboarding). For brownfield projects — run BEFORE /qualia-new so Validated requirements get inferred from existing code and Qualia commands respect the repo's existing process."
3
+ description: "Map an existing codebase to infer architecture, stack, conventions, what's already built, AND adapt Qualia to the repo's existing tracker/labels/glossary conventions (onboarding). For brownfield projects — run BEFORE /qualia-new so Validated requirements get inferred from existing code and Qualia commands respect the repo's existing process. Triggers: 'map this codebase', 'onboard to existing project', 'brownfield setup', 'what's already built here', 'scan the repo', 'inherited a codebase', 'audit this project before planning'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-milestone
3
- description: "Close the current milestone and open the next one — loads the next milestone's scope from JOURNEY.md (no ad-hoc naming). Archives artifacts, marks requirements Complete, regenerates ROADMAP.md for the next milestone."
3
+ description: "Close the current milestone and open the next one — loads the next milestone's scope from JOURNEY.md (no ad-hoc naming). Archives artifacts, marks requirements Complete, regenerates ROADMAP.md for the next milestone. Triggers: 'close milestone', 'next milestone', 'milestone done', 'wrap up milestone', 'M1 done open M2', 'I want to advance to the next milestone', 'finish this milestone'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -183,7 +183,7 @@ git commit -m "docs: PRODUCT.md — register, users, voice, anti-references"
183
183
  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):
184
184
 
185
185
  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).
186
- 2. **Color strategy** — pick ONE: `Restrained · Committed · Full palette · Drenched`. See `rules/design-laws.md` §2.
186
+ 2. **Color strategy** — pick ONE: `Restrained · Committed · Full palette · Drenched`. See `qualia-design/design-laws.md` §2.
187
187
  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.
188
188
  4. **Differentiation** — one sentence: what someone remembers 24 hours later.
189
189
 
@@ -198,7 +198,7 @@ Then fill the rest of DESIGN.md:
198
198
  - §9 Responsive: mobile-first
199
199
  - §10 Anti-pattern checklist (the auto-runnable one)
200
200
 
201
- Cross-check the result against `rules/design-laws.md` §8 absolute bans BEFORE writing — the design must not propose any banned pattern.
201
+ Cross-check the result against `qualia-design/design-laws.md` §8 absolute bans BEFORE writing — the design must not propose any banned pattern.
202
202
 
203
203
  ```bash
204
204
  git add .planning/DESIGN.md .planning/config.json
@@ -15,7 +15,7 @@ Agent(
15
15
  </planning>
16
16
 
17
17
  <rules>
18
- {rules/frontend.md content}
18
+ {qualia-design/frontend.md content}
19
19
  </rules>
20
20
 
21
21
  <task>
@@ -30,7 +30,7 @@ Analyze frontend:
30
30
 
31
31
  2. **Design Alignment**
32
32
  - Components vs DESIGN.md (colors, typography, spacing)
33
- - rules/frontend.md compliance: distinctive fonts? sharp accents? transitions? No card grids / gradients?
33
+ - qualia-design/frontend.md compliance: distinctive fonts? sharp accents? transitions? No card grids / gradients?
34
34
  - Consistency across app (buttons, spacing, colors)
35
35
 
36
36
  3. **Frontend Perf**
@@ -73,7 +73,7 @@ ls .planning/decisions/ 2>/dev/null && cat .planning/decisions/*.md 2>/dev/null
73
73
 
74
74
  Also read rules:
75
75
  ```bash
76
- cat ~/.claude/rules/frontend.md 2>/dev/null
76
+ cat ~/.claude/qualia-design/frontend.md 2>/dev/null
77
77
  cat ~/.claude/rules/security.md 2>/dev/null
78
78
  ```
79
79
 
@@ -37,7 +37,7 @@ Before any work — design or otherwise — pass these gates. Skipping them prod
37
37
 
38
38
  | Gate | Required check | If fail |
39
39
  |---|---|---|
40
- | Substrate | `rules/design-laws.md`, `design-brand.md`, `design-product.md`, `design-rubric.md` exist and have been read | Read them. |
40
+ | Substrate | `qualia-design/design-laws.md`, `design-brand.md`, `design-product.md`, `design-rubric.md` exist and have been read | Read them. |
41
41
  | PRODUCT | `PRODUCT.md` exists at project root, has `register:` field, and is not placeholder (`[TODO]` markers, &lt; 200 chars) | Run setup: ask 5 questions and generate it. Never synthesize from prompt alone. |
42
42
  | DESIGN | `DESIGN.md` exists. If missing on App / Redesign scope, BLOCK and run setup. If missing on Component / Section / Critique / Quick scope, NUDGE and proceed. | Generate from PRODUCT.md + 3 questions. |
43
43
  | Slop-detect | `bin/slop-detect.mjs` is callable | Install or pull from framework. |
@@ -100,7 +100,7 @@ For App / Redesign / Section scope on multi-file work:
100
100
  - If the conversation already contains design-taste discussion (font/color/motion preferences threaded across multiple turns), prefer **forked subagents** (`--fork-session`) so they inherit the taste context. Otherwise, blank-context fan-out is fine for mechanical fixes.
101
101
 
102
102
  Each agent receives:
103
- - `rules/design-laws.md` + the matching register file
103
+ - `qualia-design/design-laws.md` + the matching register file
104
104
  - `PRODUCT.md` + `DESIGN.md` (inlined)
105
105
  - Its 5 files (paths + contents)
106
106
  - Instruction: apply the Design Quality Rubric per file. Fix every dimension scoring &lt; 3. Make literal edits. Do NOT change logic — only styling.
@@ -158,7 +158,7 @@ viewports: [
158
158
  For each iteration:
159
159
 
160
160
  1. Capture all 3 viewports
161
- 2. Pass to a vision-model agent with `rules/design-rubric.md` as the prompt anchor + DESIGN.md as the spec
161
+ 2. Pass to a vision-model agent with `qualia-design/design-rubric.md` as the prompt anchor + DESIGN.md as the spec
162
162
  3. The agent scores 8 dimensions, anchored 1-5, with evidence per dimension
163
163
  4. Apply fixes ONLY to dimensions scored 1 or 2 (don't nitpick 3s; prevents oscillation)
164
164
  5. STOP if: all dimensions ≥ 3 (success), OR any dimension regressed from previous iteration (regression-stop), OR 2 iterations reached (hard cap)
@@ -58,7 +58,7 @@ Agent({
58
58
  Role: @~/.claude/agents/visual-evaluator.md
59
59
 
60
60
  <rubric>
61
- {INLINE rules/design-rubric.md §"The 8 dimensions" through §"Aggregate score"}
61
+ {INLINE qualia-design/design-rubric.md §"The 8 dimensions" through §"Aggregate score"}
62
62
  </rubric>
63
63
 
64
64
  <brief>
@@ -18,7 +18,7 @@ See its own work. Fix its own work. Stop only when correct.
18
18
 
19
19
  ## What it does
20
20
 
21
- Takes a URL + design brief. Screenshots at 3 viewports (mobile / tablet / desktop). Spawns a vision evaluator that scores 8 dimensions of `rules/design-rubric.md` against the brief with cited evidence. Spawns up to 3 fix-builders in parallel for the top issues. Re-screenshots. Loops until all dimensions ≥ 3 or the kill-switch trips (regression, budget, or max iterations).
21
+ Takes a URL + design brief. Screenshots at 3 viewports (mobile / tablet / desktop). Spawns a vision evaluator that scores 8 dimensions of `qualia-design/design-rubric.md` against the brief with cited evidence. Spawns up to 3 fix-builders in parallel for the top issues. Re-screenshots. Loops until all dimensions ≥ 3 or the kill-switch trips (regression, budget, or max iterations).
22
22
 
23
23
  Different from `/qualia-polish`: that one is read+edit+slop-detect, single pass. This one is **see+edit+verify+repeat** with a real loop and real screenshots.
24
24
 
@@ -39,7 +39,7 @@ Run these in order. Halt on the first failure.
39
39
 
40
40
  | Gate | Check | If fail |
41
41
  |---|---|---|
42
- | Substrate | `rules/design-rubric.md`, `rules/design-laws.md` exist | Run `npx qualia install` |
42
+ | Substrate | `qualia-design/design-rubric.md`, `qualia-design/design-laws.md` exist | Run `npx qualia install` |
43
43
  | Brief | `--brief` PATH if provided, else `.planning/DESIGN.md`, else PRODUCT.md | If none, HALT: "No design brief found. Pass --brief or run /qualia-new." |
44
44
  | Browser | `node ~/.claude/skills/qualia-polish-loop/scripts/playwright-capture.mjs --url about:blank --out /tmp/qpl-preflight` exits 0 | HALT with the script's setup hint |
45
45
  | URL reachable | `curl -fsS -o /dev/null -w '%{http_code}' "$URL"` returns 2xx/3xx | HALT — start the dev server first |
@@ -91,7 +91,7 @@ node ~/.claude/skills/qualia-polish-loop/scripts/loop.mjs record \
91
91
 
92
92
  Exit codes: `0` = SUCCESS (all dims ≥ 3), `1` = CONTINUE (more iterations), `3` = KILLED (regression / budget / max).
93
93
 
94
- The orchestrator computes the verdict per `rules/design-rubric.md`:
94
+ The orchestrator computes the verdict per `qualia-design/design-rubric.md`:
95
95
 
96
96
  - **all aggregate scores ≥ 3 AND no critical issues remain** → SUCCESS, exit loop
97
97
  - **same issue fingerprint recurred 3 consecutive iterations** → KILL, `LOOP_REGRESSION_DETECTED`
@@ -1,8 +1,8 @@
1
1
  <!doctype html>
2
2
  <!--
3
3
  Deliberately broken page used by /qualia-polish-loop self-test Scenario 2.
4
- Hits multiple absolute-ban patterns from rules/design-laws.md and
5
- rules/design-brand.md so the vision evaluator has to identify them all.
4
+ Hits multiple absolute-ban patterns from qualia-design/design-laws.md and
5
+ qualia-design/design-brand.md so the vision evaluator has to identify them all.
6
6
  Banned font (Inter), pure white + pure black, blue-purple gradient,
7
7
  gradient text, identical 3-column card grid, "Get Started" / "Learn More"
8
8
  generic CTAs, side-stripe border-left:4px decorative, max-width:1280
@@ -3,7 +3,7 @@
3
3
  * score.mjs -- Qualia visual-polish loop scoring utility.
4
4
  *
5
5
  * Takes a JSON object with 8 dimension scores and computes pass/fail
6
- * per the design rubric formula from rules/design-rubric.md.
6
+ * per the design rubric formula from qualia-design/design-rubric.md.
7
7
  *
8
8
  * Usage:
9
9
  * echo '{"typography":3,"color":2,"spatial":3,"layout":3,"shadow":3,"motion":3,"microcopy":3,"container":3}' | node score.mjs
@@ -95,7 +95,7 @@ matches the failure. Use this lookup:
95
95
  | Wave 2 task ran before wave 1 committed | `agents/planner.md` (dependency graph) |
96
96
  | Build passed locally, broke in CI | `rules/deployment.md` or a missing pre-deploy-gate scan |
97
97
  | RLS missing on new table | `rules/security.md` + `agents/builder.md` (security persona handling) |
98
- | Design regression — fonts off, contrast fail | `rules/frontend.md` + `skills/qualia-design/SKILL.md` |
98
+ | Design regression — fonts off, contrast fail | `qualia-design/frontend.md` + `skills/qualia-design/SKILL.md` |
99
99
  | Migration unsafe (DROP without IF EXISTS, etc.) | `hooks/migration-guard.js` |
100
100
  | Verifier missed it | `agents/verifier.md` — most embarrassing case, address with extra care |
101
101
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-quick
3
- description: "Fast path for small tasksbug fixes, tweaks, hot fixes. Skips full phase planning. Trigger on 'quick fix', 'small change', 'tweak', 'hot fix', 'one-line fix', 'quick edit', 'small bug'."
3
+ description: "Fast inline path for trivial fixes≤1 hour, typically 1 file, no plan, NO subagent spawn. The current Claude does the work directly. For a 1-5 file change that justifies a fresh builder context, use /qualia-task instead. Trigger on 'quick fix', 'small change', 'tweak', 'hot fix', 'one-line fix', 'typo', 'config tweak'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -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)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-research
3
- description: "Deep-research a niche domain or library BEFORE planning a specific phase. Spawns the researcher agent with Context7/WebFetch access. Writes to .planning/phase-{N}-research.md."
3
+ description: "Deep-research a niche domain or library BEFORE planning a specific phase. Spawns the researcher agent with Context7/WebFetch access. Writes to .planning/phase-{N}-research.md. Triggers: 'research X library', 'research the domain before planning', 'study Stripe webhooks', 'how do others do RAG', 'best practices for X', 'compare libraries', 'I need depth before planning phase N'. Distinct from /qualia-recall (which queries the local Obsidian vault) and /qualia-discuss (which interviews the user)."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -75,7 +75,8 @@ Reqs: {REQ-IDs for this phase}
75
75
 
76
76
  <output_path>.planning/phase-{N}-research.md</output_path>
77
77
 
78
- Priority: Context7 → WebFetch → WebSearch.
78
+ Priority: NotebookLM (cross-notebook query) → local knowledge layer (knowledge.js search + qualia-recall) → Context7 → WebFetch → WebSearch.
79
+ Skip web round when local sources cover the question with confidence ≥ MEDIUM (per agents/researcher.md §1b).
79
80
  Include: recommendation, rationale, versions, code examples, alternatives, pitfalls, sources.
80
81
  ", subagent_type="qualia-researcher", description="Phase {N} research")
81
82
  ```
@@ -123,4 +124,5 @@ node ~/.claude/bin/qualia-ui.js end "PHASE {N} RESEARCH DONE" "/qualia-plan {N}"
123
124
  1. **One session per run.** Don't research phases 1-5 in one call.
124
125
  2. **Must produce a file.** Research in conversation only is worthless.
125
126
  3. **Honor locked decisions.** Don't research alternatives to locked choices.
126
- 4. **Context7 first.** Try Context7 MCP before WebFetch.
127
+ 4. **Local-first.** Drain NotebookLM and `~/qualia-memory` before any external call. The team has already researched most domains we touch — querying existing notebooks is near-zero token cost AND higher-quality than fresh WebSearch.
128
+ 5. **Context7 before WebFetch.** When you do go external, Context7 first for libraries; only WebFetch for non-library content (blog posts, case studies, post-mortems).