qualia-framework 3.2.0 → 3.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.
Files changed (58) hide show
  1. package/CLAUDE.md +3 -4
  2. package/README.md +59 -23
  3. package/agents/plan-checker.md +158 -0
  4. package/agents/planner.md +52 -0
  5. package/agents/research-synthesizer.md +86 -0
  6. package/agents/researcher.md +119 -0
  7. package/agents/roadmapper.md +157 -0
  8. package/agents/verifier.md +180 -32
  9. package/bin/cli.js +403 -9
  10. package/bin/install.js +219 -70
  11. package/bin/qualia-ui.js +11 -11
  12. package/bin/state.js +200 -6
  13. package/bin/statusline.js +4 -4
  14. package/docs/erp-contract.md +161 -0
  15. package/hooks/branch-guard.js +23 -2
  16. package/hooks/migration-guard.js +23 -0
  17. package/hooks/pre-compact.js +20 -0
  18. package/hooks/pre-deploy-gate.js +39 -0
  19. package/hooks/pre-push.js +20 -0
  20. package/hooks/session-start.js +16 -43
  21. package/package.json +6 -4
  22. package/references/questioning.md +123 -0
  23. package/rules/infrastructure.md +87 -0
  24. package/skills/qualia/SKILL.md +1 -0
  25. package/skills/qualia-build/SKILL.md +18 -0
  26. package/skills/qualia-design/SKILL.md +14 -8
  27. package/skills/qualia-discuss/SKILL.md +115 -0
  28. package/skills/qualia-help/SKILL.md +60 -0
  29. package/skills/qualia-learn/SKILL.md +27 -4
  30. package/skills/qualia-map/SKILL.md +145 -0
  31. package/skills/qualia-milestone/SKILL.md +148 -0
  32. package/skills/qualia-new/SKILL.md +374 -229
  33. package/skills/qualia-plan/SKILL.md +135 -30
  34. package/skills/qualia-polish/SKILL.md +167 -117
  35. package/skills/qualia-report/SKILL.md +17 -8
  36. package/skills/qualia-research/SKILL.md +124 -0
  37. package/skills/qualia-review/SKILL.md +126 -41
  38. package/skills/qualia-test/SKILL.md +134 -0
  39. package/skills/qualia-verify/SKILL.md +1 -1
  40. package/templates/DESIGN.md +440 -102
  41. package/templates/help.html +476 -0
  42. package/templates/phase-context.md +48 -0
  43. package/templates/plan.md +14 -0
  44. package/templates/projects/ai-agent.md +55 -0
  45. package/templates/projects/mobile-app.md +56 -0
  46. package/templates/projects/voice-agent.md +55 -0
  47. package/templates/projects/website.md +58 -0
  48. package/templates/requirements.md +69 -0
  49. package/templates/research-project/ARCHITECTURE.md +70 -0
  50. package/templates/research-project/FEATURES.md +60 -0
  51. package/templates/research-project/PITFALLS.md +73 -0
  52. package/templates/research-project/STACK.md +51 -0
  53. package/templates/research-project/SUMMARY.md +86 -0
  54. package/templates/roadmap.md +71 -0
  55. package/tests/bin.test.sh +20 -6
  56. package/tests/hooks.test.sh +76 -7
  57. package/tests/runner.js +1915 -0
  58. package/tests/state.test.sh +189 -11
@@ -18,6 +18,7 @@ const HOME = os.homedir();
18
18
  const UI = path.join(HOME, ".claude", "bin", "qualia-ui.js");
19
19
  const STATE_FILE = path.join(".planning", "STATE.md");
20
20
  const CONTINUE_HERE = ".continue-here.md";
21
+ const NOTIF_FILE = path.join(HOME, ".claude", ".qualia-update-available.json");
21
22
 
22
23
  function runUi(...args) {
23
24
  if (!fs.existsSync(UI)) return;
@@ -45,46 +46,6 @@ function getNextCommand() {
45
46
  }
46
47
  }
47
48
 
48
- function maybeShowUpdateBanner() {
49
- // Sticky framework update notification for EMPLOYEEs. Populated by
50
- // auto-update.js when it detects a newer qualia-framework version on npm.
51
- // OWNER auto-updates silently, so this file is never created for Fawzi.
52
- try {
53
- const notifFile = path.join(HOME, ".claude", ".qualia-update-available.json");
54
- if (!fs.existsSync(notifFile)) return;
55
-
56
- const cfg = readConfig();
57
- // Belt-and-suspenders: even if a stale notification exists, OWNER never sees it.
58
- if (cfg.role === "OWNER") {
59
- try { fs.unlinkSync(notifFile); } catch {}
60
- return;
61
- }
62
-
63
- const notif = JSON.parse(fs.readFileSync(notifFile, "utf8"));
64
-
65
- // If the user has already updated (cfg.version >= notif.latest), clear the file.
66
- if (cfg.version && notif.latest) {
67
- const cmp = (a, b) => {
68
- const pa = String(a).split(".").map(Number);
69
- const pb = String(b).split(".").map(Number);
70
- for (let i = 0; i < 3; i++) {
71
- if ((pa[i] || 0) > (pb[i] || 0)) return 1;
72
- if ((pa[i] || 0) < (pb[i] || 0)) return -1;
73
- }
74
- return 0;
75
- };
76
- if (cmp(cfg.version, notif.latest) >= 0) {
77
- try { fs.unlinkSync(notifFile); } catch {}
78
- return;
79
- }
80
- }
81
-
82
- runUi("update", notif.current || cfg.version || "?", notif.latest || "?");
83
- } catch {
84
- // Never fail the session start.
85
- }
86
- }
87
-
88
49
  function fallbackText() {
89
50
  // If qualia-ui.js is missing, emit plain text. Keeps the session informative
90
51
  // even on a broken install.
@@ -105,10 +66,22 @@ function fallbackText() {
105
66
  }
106
67
  }
107
68
 
69
+ function maybeRenderUpdateBanner() {
70
+ // EMPLOYEE-only sticky banner. auto-update.js writes NOTIF_FILE when a new
71
+ // version is detected; we render it every session until the user actually
72
+ // runs `npx qualia-framework@latest install`. The file is cleared by
73
+ // auto-update.js once the install completes or the version catches up.
74
+ if (!fs.existsSync(NOTIF_FILE) || !fs.existsSync(UI)) return;
75
+ try {
76
+ const notif = JSON.parse(fs.readFileSync(NOTIF_FILE, "utf8"));
77
+ if (notif && notif.current && notif.latest) {
78
+ runUi("update", notif.current, notif.latest);
79
+ }
80
+ } catch {}
81
+ }
82
+
108
83
  try {
109
- // Sticky update notification — shown before anything else every session
110
- // until the employee runs `npx qualia-framework@latest install`.
111
- maybeShowUpdateBanner();
84
+ maybeRenderUpdateBanner();
112
85
 
113
86
  if (!fs.existsSync(UI)) {
114
87
  fallbackText();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qualia-framework",
3
- "version": "3.2.0",
3
+ "version": "3.3.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"
@@ -19,11 +19,11 @@
19
19
  "license": "MIT",
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "git+https://github.com/QualiasolutionsCY/qualia-framework.git"
22
+ "url": "git+https://github.com/Qualiasolutions/qualia-framework.git"
23
23
  },
24
- "homepage": "https://github.com/QualiasolutionsCY/qualia-framework#readme",
24
+ "homepage": "https://github.com/Qualiasolutions/qualia-framework#readme",
25
25
  "scripts": {
26
- "test": "bash tests/hooks.test.sh && bash tests/state.test.sh && bash tests/bin.test.sh && bash tests/statusline.test.sh"
26
+ "test": "node --test tests/runner.js"
27
27
  },
28
28
  "files": [
29
29
  "bin/",
@@ -32,7 +32,9 @@
32
32
  "rules/",
33
33
  "skills/",
34
34
  "templates/",
35
+ "references/",
35
36
  "tests/",
37
+ "docs/",
36
38
  "CLAUDE.md",
37
39
  "guide.md"
38
40
  ],
@@ -0,0 +1,123 @@
1
+ # Questioning Guide
2
+
3
+ Project initialization is dream extraction, not requirements gathering. Help the user discover and articulate what they want. Collaborate, don't interrogate.
4
+
5
+ ## Philosophy
6
+
7
+ **You are a thinking partner.**
8
+
9
+ The user often has a fuzzy idea. Your job is to help them sharpen it. Ask questions that make them think "oh, I hadn't considered that" or "yes, that's exactly what I mean."
10
+
11
+ Don't follow a script. Follow the thread.
12
+
13
+ ## The Goal
14
+
15
+ By the end of questioning, you need enough clarity to write a PROJECT.md that downstream phases can act on:
16
+
17
+ - **Research** needs: what domain, what the user already knows, what unknowns exist
18
+ - **Requirements** needs: clear vision to scope v1 features
19
+ - **Roadmap** needs: clear vision to decompose into phases, what "done" looks like
20
+ - **Plan-phase** needs: specific requirements to break into tasks
21
+ - **Execute-phase** needs: success criteria to verify against
22
+
23
+ A vague PROJECT.md forces every downstream phase to guess. The cost compounds.
24
+
25
+ ## How to Question
26
+
27
+ **Start open.** Let them dump their mental model. Don't interrupt with structure.
28
+
29
+ **Follow energy.** Whatever they emphasized, dig into that. What excited them? What problem sparked this?
30
+
31
+ **Challenge vagueness.** Never accept fuzzy answers. "Good" means what? "Users" means who? "Simple" means how?
32
+
33
+ **Make the abstract concrete.** "Walk me through using this." "What does that actually look like?"
34
+
35
+ **Clarify ambiguity.** "When you say Z, do you mean A or B?"
36
+
37
+ **Know when to stop.** When you understand what they want, why they want it, who it's for, and what done looks like — offer to proceed.
38
+
39
+ ## Question Types
40
+
41
+ Use as inspiration, not a checklist. Pick what's relevant to the thread.
42
+
43
+ ### Motivation — why this exists
44
+
45
+ - "What prompted this?"
46
+ - "What are you doing today that this replaces?"
47
+ - "What would you do if this existed?"
48
+
49
+ ### Concreteness — what it actually is
50
+
51
+ - "Walk me through using this"
52
+ - "You said X — what does that actually look like?"
53
+ - "Give me an example"
54
+
55
+ ### Clarification — what they mean
56
+
57
+ - "When you say Z, do you mean A or B?"
58
+ - "You mentioned X — tell me more about that"
59
+
60
+ ### Success — how you'll know it's working
61
+
62
+ - "How will you know this is working?"
63
+ - "What does done look like?"
64
+
65
+ ## Using AskUserQuestion
66
+
67
+ Present concrete options the user can react to.
68
+
69
+ **Good options:**
70
+ - Interpretations of what they might mean
71
+ - Specific examples to confirm or deny
72
+ - Concrete choices that reveal priorities
73
+
74
+ **Bad options:**
75
+ - Generic categories ("Technical", "Business", "Other")
76
+ - Leading options that presume an answer
77
+ - Too many options (2-4 is ideal)
78
+
79
+ **Example — vague answer "it should be fast":**
80
+
81
+ - header: "Fast"
82
+ - question: "Fast how?"
83
+ - options: ["Sub-second response", "Handles large datasets", "Quick to build", "Let me explain"]
84
+
85
+ **Example — following a thread "frustrated with current tools":**
86
+
87
+ - header: "Frustration"
88
+ - question: "What specifically frustrates you?"
89
+ - options: ["Too many clicks", "Missing features", "Unreliable", "Let me explain"]
90
+
91
+ ## Context Checklist
92
+
93
+ Mental checklist, not conversation structure. Check as you go; weave questions naturally.
94
+
95
+ - [ ] What they're building (concrete enough to explain to a stranger)
96
+ - [ ] Why it needs to exist (the problem or desire driving it)
97
+ - [ ] Who it's for (even if just themselves)
98
+ - [ ] What "done" looks like (observable outcomes)
99
+
100
+ Four things. If they volunteer more, capture it.
101
+
102
+ ## Decision Gate
103
+
104
+ When you could write a clear PROJECT.md:
105
+
106
+ - header: "Ready?"
107
+ - question: "I think I understand what you're after. Ready to create PROJECT.md?"
108
+ - options:
109
+ - "Create PROJECT.md" — Let's move forward
110
+ - "Keep exploring" — I want to share more / ask me more
111
+
112
+ If "Keep exploring" — ask what they want to add, or identify gaps and probe naturally. Loop until approved.
113
+
114
+ ## Anti-Patterns
115
+
116
+ - **Checklist walking** — Going through domains regardless of what they said
117
+ - **Canned questions** — "What's your core value?" regardless of context
118
+ - **Corporate speak** — "What are your success criteria?" "Who are your stakeholders?"
119
+ - **Interrogation** — Firing questions without building on answers
120
+ - **Rushing** — Minimizing questions to get to "the work"
121
+ - **Shallow acceptance** — Taking vague answers without probing
122
+ - **Premature constraints** — Asking about tech stack before understanding the idea
123
+ - **User skills** — NEVER ask about user's technical experience. Claude builds.
@@ -0,0 +1,87 @@
1
+ ---
2
+ globs: ["*.env*", "vercel.json", "next.config.*", "supabase/**", "railway.*"]
3
+ ---
4
+
5
+ # Infrastructure & Services
6
+
7
+ Standard services across all Qualia projects. Use these unless the project explicitly specifies otherwise.
8
+
9
+ ## Database: Supabase (every project)
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
13
+ - Always enable RLS on every table (see `rules/security.md`)
14
+ - Use `lib/supabase/server.ts` for server-side, `lib/supabase/client.ts` for client-side
15
+ - Run `npx supabase gen types` after schema changes
16
+ - Migrations go in `supabase/migrations/` — never edit production directly
17
+
18
+ ## AI Models: OpenRouter (every project)
19
+ - Use OpenRouter API for all LLM calls — it routes to the best-suited model per task
20
+ - API key env var: `OPENROUTER_API_KEY`
21
+ - Don't have a key? Ask Fawzi for one
22
+ - Never hardcode a specific model provider (OpenAI, Anthropic, etc.) directly — always go through OpenRouter
23
+ - Exception: if a client specifically requires a direct provider integration
24
+
25
+ ## Voice AI: Retell AI + ElevenLabs
26
+ - **Retell AI** — primary voice agent platform. API key: `RETELL_API_KEY`
27
+ - **ElevenLabs** — voice synthesis, cloning, streaming. API key: `ELEVENLABS_API_KEY`
28
+ - **Telnyx** — telephony/SIP for voice agent phone numbers. API key: `TELNYX_API_KEY`
29
+ - For new voice projects, default to Retell AI + ElevenLabs unless client specifies otherwise
30
+
31
+ ## Compute: Vercel + Railway
32
+ - **Vercel** — primary hosting for all Next.js projects. Deploy via CLI only (see below)
33
+ - **Railway** — secondary compute for long-running agents, background jobs, and agentic workloads that exceed Vercel's function timeout
34
+ - **Railway CLI:** `railway` — deploy, logs, env management
35
+ - **Railway MCP:** Railway MCP server is available in Claude Code for project management
36
+ - Railway projects use Nixpacks (auto-detected) — check for `railway.json` or `railway.toml`
37
+
38
+ ## MCP Servers (available in Claude Code)
39
+ - **Supabase MCP** — database queries, table management, migrations from within Claude Code
40
+ - **Railway MCP** — project deployment, logs, environment variables from within Claude Code
41
+ - **next-devtools MCP** — runtime error visibility for Next.js 16+ dev servers (optional, added by framework install)
42
+
43
+ ## CLIs (must be installed)
44
+ - `npx supabase` — Supabase CLI (database, migrations, types)
45
+ - `railway` — Railway CLI (deploy, logs, env)
46
+ - `vercel` — Vercel CLI (deploy, env, link)
47
+ - `gh` — GitHub CLI (PRs, issues, repos)
48
+
49
+ ## GitHub Organizations
50
+ - **QualiasolutionsCY** — primary org for all Qualia Solutions projects
51
+ - **SakaniQualia** — org for Sakani-related projects (real estate platform)
52
+ - All repos are private by default
53
+ - Branch protection: main/master require PR reviews (enforced by framework guards)
54
+
55
+ ## Vercel Teams (admin knowledge)
56
+ - Qualia operates across **3 Vercel teams** — projects are distributed across them
57
+ - Check which team a project belongs to before deploying: `vercel whoami` and `vercel link`
58
+ - If a project isn't linked, link it first: `vercel link`
59
+
60
+ ## Deployment Rules
61
+ - **NO auto-deploys from GitHub pushes** — all Vercel projects have GitHub integration auto-deploy DISABLED
62
+ - Deploys happen ONLY via `vercel --prod` through the CLI (or `/qualia-ship`)
63
+ - This is intentional — we control when things go live, not git push triggers
64
+ - If you find a project with auto-deploy enabled, disable it: Vercel Dashboard → Project Settings → Git → Disable "Automatic Deployments"
65
+
66
+ ## Required Environment Variables (typical project)
67
+
68
+ ```bash
69
+ # Supabase (every project)
70
+ NEXT_PUBLIC_SUPABASE_URL=
71
+ NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=
72
+ SUPABASE_SERVICE_ROLE_KEY= # NEVER in client code
73
+
74
+ # AI (if applicable)
75
+ OPENROUTER_API_KEY= # ask Fawzi if you don't have one
76
+
77
+ # Voice (if applicable)
78
+ RETELL_API_KEY=
79
+ ELEVENLABS_API_KEY=
80
+ TELNYX_API_KEY=
81
+
82
+ # Deployment
83
+ VERCEL_ORG_ID= # from vercel link
84
+ VERCEL_PROJECT_ID= # from vercel link
85
+ ```
86
+
87
+ Always use `vercel env pull` to sync env vars locally. Never create `.env` manually from scratch.
@@ -47,6 +47,7 @@ Use the state.js JSON output plus gathered context:
47
47
  | `handed-off` | status == "handed_off" | → `/qualia-report` then done |
48
48
  | `blocked` | STATE.md lists blockers or same error 3+ times | → Analyze, suggest `/qualia-debug` |
49
49
  | `bug-loop` | Same files edited 3+ times, user frustrated | → Different approach, `/qualia-debug` |
50
+ | `need-tests` | User mentions "tests", "coverage", "test this" | → `/qualia-test` |
50
51
 
51
52
  **Employee escalation:** If role is EMPLOYEE and situation is `gap-limit` or `bug-loop`, suggest: "Want to flag this for Fawzi?"
52
53
 
@@ -21,6 +21,24 @@ cat .planning/phase-{N}-plan.md
21
21
 
22
22
  Parse: tasks, waves, file references.
23
23
 
24
+ ### 1b. Create Recovery Point
25
+
26
+ Before executing any tasks, tag current HEAD for rollback:
27
+
28
+ ```bash
29
+ git tag -f "pre-build-phase-{N}" HEAD 2>/dev/null
30
+ ```
31
+
32
+ ```bash
33
+ node ~/.claude/bin/qualia-ui.js info "Recovery point: pre-build-phase-{N}"
34
+ ```
35
+
36
+ If a wave fails and the user needs to roll back:
37
+ ```bash
38
+ git reset --hard pre-build-phase-{N}
39
+ node ~/.claude/bin/state.js transition --to planned --force
40
+ ```
41
+
24
42
  ### 2. Execute Waves
25
43
 
26
44
  ```bash
@@ -25,7 +25,7 @@ node ~/.claude/bin/qualia-ui.js banner design
25
25
  cat .planning/DESIGN.md 2>/dev/null || echo "NO_DESIGN"
26
26
  ```
27
27
 
28
- 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.
28
+ If DESIGN.md exists → it is law. Use exact values from sections 1-9 (Visual Theme, Color Palette, Typography, Components, Layout, Depth, Do's/Don'ts, Responsive, Agent Prompt Guide). If not → use Qualia defaults from `rules/frontend.md`: distinctive fonts, sharp accents, layered backgrounds, no card grids, no blue-purple gradients, full-width layouts.
29
29
 
30
30
  ### 2. Find Target Files
31
31
 
@@ -41,19 +41,25 @@ Evaluate each file on: AI slop detection, visual hierarchy, typography, color, s
41
41
 
42
42
  ### 4. Fix Everything
43
43
 
44
- **Typography:** Replace generic fonts (Inter, Arial) with distinctive ones. Proper type scale, line-height 1.5-1.7 body.
44
+ Use exact values from DESIGN.md when available. Sections map to fixes:
45
45
 
46
- **Color:** Cohesive palette from DESIGN.md or brand. Sharp accent for CTAs. WCAG AA contrast.
46
+ **Typography (§3):** Apply fonts from hierarchy table. Replace any generic fonts (Inter, Arial) with project fonts. Use exact weights, sizes, letter-spacing from the table. Body line-height 1.5-1.7.
47
47
 
48
- **Layout:** Full-width with fluid padding `clamp(1rem, 5vw, 4rem)`. NO hardcoded max-width caps. Prose gets `max-width: 65ch`.
48
+ **Color (§2):** Apply palette from CSS variables. Replace scattered hex values with `var(--color-*)`. Verify contrast ratios listed in DESIGN.md.
49
49
 
50
- **Spacing:** Consistent scale (8px grid). Generous whitespace between sections, tight within groups.
50
+ **Components (§4):** Match button, card, input, badge specs exactly — padding, radius, shadow, hover states.
51
51
 
52
- **Motion:** CSS transitions 200-300ms on hover/focus. Staggered entrance animations. `prefers-reduced-motion` respected.
52
+ **Layout (§5):** Full-width with fluid padding `clamp(1rem, 5vw, 4rem)`. Apply spacing scale. NO hardcoded max-width caps. Prose gets `max-width: 65ch`.
53
53
 
54
- **States:** Loading skeleton/spinner on async ops. Error states on data fetches. Empty states on lists. Hover/focus/active/disabled on interactive elements.
54
+ **Depth (§6):** Apply shadow levels from elevation table. Use brand-tinted shadows, not neutral gray.
55
55
 
56
- **Responsive:** Mobile-first. Touch targets 44x44px min. Stack on mobile, expand on desktop. No horizontal scroll.
56
+ **Motion (§Motion):** CSS transitions 200-300ms on hover/focus. Staggered entrance animations. `prefers-reduced-motion` respected.
57
+
58
+ **States:** Loading skeleton/spinner on async ops. Error states on data fetches. Empty states on lists. Hover/focus/active/disabled on every interactive element.
59
+
60
+ **Responsive (§8):** Apply collapsing strategy from table. Mobile-first. Touch targets 44x44px min. No horizontal scroll.
61
+
62
+ **Anti-Slop (§12):** Run grep patterns from the detection table. Every match = mandatory fix.
57
63
 
58
64
  **Kill:** Card grids → varied layouts. Generic heroes → distinctive. Blue-purple gradients → brand colors. Static pages → purposeful motion. Fixed widths → fluid.
59
65
 
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: qualia-discuss
3
+ description: "Capture phase decisions, trade-offs, and constraints BEFORE planning. Use for complex phases with regulatory, compliance, or architectural stakes. Creates .planning/phase-{N}-context.md that planner honors as locked input."
4
+ ---
5
+
6
+ # /qualia-discuss — Phase Context Capture
7
+
8
+ Before a complex phase gets planned, surface the decisions and trade-offs that must inform planning. Output: `.planning/phase-{N}-context.md` that the planner reads as locked input.
9
+
10
+ ## When to Use
11
+
12
+ - Regulated domains (legal, medical, financial) where wrong choices have legal cost
13
+ - Phases with architectural forks (e.g., "auth via middleware or RLS?")
14
+ - Phases with external dependencies you want to lock first
15
+ - Anytime the user says "wait, let's think about this one"
16
+
17
+ ## Process
18
+
19
+ ### 1. Determine Phase
20
+
21
+ ```bash
22
+ node ~/.claude/bin/state.js check 2>/dev/null
23
+ ```
24
+
25
+ If a phase number was passed as argument, use it. Otherwise use the current phase from STATE.md.
26
+
27
+ ### 2. Load Context
28
+
29
+ ```bash
30
+ cat .planning/PROJECT.md 2>/dev/null
31
+ cat .planning/ROADMAP.md 2>/dev/null
32
+ cat .planning/research/SUMMARY.md 2>/dev/null
33
+ ```
34
+
35
+ Identify:
36
+ - Phase goal from ROADMAP.md
37
+ - Requirements covered by this phase
38
+ - Research flags for this phase (from SUMMARY.md)
39
+
40
+ ### 3. Open the Conversation
41
+
42
+ Print the banner:
43
+ ```bash
44
+ node ~/.claude/bin/qualia-ui.js banner discuss {N} "{phase name from ROADMAP.md}"
45
+ ```
46
+
47
+ Ask inline (free text, not AskUserQuestion):
48
+
49
+ **"We're about to plan {phase name}. The goal is: {goal from ROADMAP.md}. Before I hand this to the planner, what decisions, trade-offs, or constraints should be locked in?"**
50
+
51
+ Wait for their response.
52
+
53
+ ### 4. Follow the Thread
54
+
55
+ Based on their answer, dig into specifics:
56
+
57
+ - If they mention a technology → "Why that one specifically?"
58
+ - If they mention a constraint → "What happens if we don't honor this?"
59
+ - If they mention a trade-off → "Which side do you want to land on, and why?"
60
+ - If they mention a concern → "What's the worst case?"
61
+
62
+ Use `AskUserQuestion` when there are clear interpretation forks. Free text otherwise.
63
+
64
+ ### 5. Capture Locked Decisions
65
+
66
+ Build up a list of **locked decisions** — things the planner MUST honor. Each decision has:
67
+ - The choice (what)
68
+ - The rationale (why)
69
+ - The source (who/when)
70
+
71
+ Also capture:
72
+ - **Discretion items** — things the planner can decide freely
73
+ - **Deferred ideas** — good ideas that are NOT in this phase
74
+ - **Risk flags** — things to watch during building
75
+ - **Open questions** — things that still need resolution
76
+
77
+ ### 6. Decision Gate
78
+
79
+ When you have enough context:
80
+
81
+ - header: "Ready to lock?"
82
+ - question: "Ready to lock these decisions and move to /qualia-plan {N}?"
83
+ - options:
84
+ - "Lock it in" — Write phase-{N}-context.md and done
85
+ - "Keep exploring" — I have more to say
86
+
87
+ Loop until "Lock it in".
88
+
89
+ ### 7. Write phase-{N}-context.md
90
+
91
+ Use the template at `~/.claude/qualia-templates/phase-context.md`. Fill every section with concrete content.
92
+
93
+ ```bash
94
+ # Write the file to .planning/phase-{N}-context.md
95
+ ```
96
+
97
+ ### 8. Commit
98
+
99
+ ```bash
100
+ git add .planning/phase-{N}-context.md
101
+ git commit -m "docs(phase-{N}): capture phase context before planning"
102
+ ```
103
+
104
+ ### 9. Route to Next
105
+
106
+ ```bash
107
+ node ~/.claude/bin/qualia-ui.js end "PHASE {N} CONTEXT LOCKED" "/qualia-plan {N}"
108
+ ```
109
+
110
+ ## Rules
111
+
112
+ 1. **One session, one phase.** Don't try to discuss phases 1 and 2 in the same invocation.
113
+ 2. **Locked decisions are NON-NEGOTIABLE.** The planner will honor them exactly. If you lock something you're not sure about, that's a mistake.
114
+ 3. **Don't redo research.** If the user asks a research question you don't know, suggest `/qualia-research {N}` instead.
115
+ 4. **Short context files are fine.** If the phase is simple, a 30-line context.md is better than a forced 200-line one.
@@ -0,0 +1,60 @@
1
+ ---
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'."
4
+ ---
5
+
6
+ # /qualia-help — Framework Reference
7
+
8
+ Opens a Qualia-themed HTML reference guide in your default browser.
9
+
10
+ ## Process
11
+
12
+ ### 1. Generate the HTML
13
+
14
+ ```bash
15
+ # Read the template and inject the current version
16
+ VERSION=$(node -e "console.log(require(require('os').homedir() + '/.claude/.qualia-config.json').version || 'v3')" 2>/dev/null || echo "v3")
17
+ TEMPLATE="$HOME/.claude/qualia-templates/help.html"
18
+ OUTPUT="/tmp/qualia-help.html"
19
+
20
+ # If template doesn't exist, check the framework install
21
+ if [ ! -f "$TEMPLATE" ]; then
22
+ TEMPLATE="$(dirname "$(dirname "$(which qualia-framework 2>/dev/null || echo '')")")/templates/help.html"
23
+ fi
24
+ ```
25
+
26
+ ### 2. Inject version and open
27
+
28
+ ```bash
29
+ # Replace {{VERSION}} placeholder with actual version
30
+ sed "s/{{VERSION}}/$VERSION/g" "$TEMPLATE" > "$OUTPUT"
31
+
32
+ # Open in default browser (cross-platform)
33
+ if command -v xdg-open &>/dev/null; then
34
+ xdg-open "$OUTPUT" # Linux
35
+ elif command -v open &>/dev/null; then
36
+ open "$OUTPUT" # macOS
37
+ elif command -v start &>/dev/null; then
38
+ start "$OUTPUT" # Windows (Git Bash)
39
+ else
40
+ echo "Open this file in your browser: $OUTPUT"
41
+ fi
42
+ ```
43
+
44
+ ### 3. Confirm
45
+
46
+ ```bash
47
+ node ~/.claude/bin/qualia-ui.js banner router
48
+ node ~/.claude/bin/qualia-ui.js ok "Reference guide opened in browser"
49
+ node ~/.claude/bin/qualia-ui.js info "File: /tmp/qualia-help.html"
50
+ ```
51
+
52
+ If the browser does not open automatically, tell the user the file path so they can open it manually.
53
+
54
+ ## Notes
55
+
56
+ - The HTML file is self-contained — no external dependencies except Google Fonts
57
+ - Works offline after first load (fonts cache)
58
+ - Qualia-themed: dark background, teal accents, Outfit + Inter fonts
59
+ - Shows: The Road, all commands grouped, verification scoring, rules, stack, GitHub orgs
60
+ - Version is injected dynamically from .qualia-config.json
@@ -46,17 +46,40 @@ What did you learn?
46
46
  3. Client preference — client-specific requirement
47
47
  ```
48
48
 
49
- ### 2. Format Entry
49
+ ### 2. Check for Duplicates
50
+
51
+ Before saving, check if a similar entry already exists:
52
+
53
+ ```bash
54
+ # Search for the title (case-insensitive substring match)
55
+ grep -i "{title keywords}" ~/.claude/knowledge/{type}.md 2>/dev/null
56
+ ```
57
+
58
+ If a near-match exists (title is similar to an existing entry):
59
+ - Show the existing entry to the user
60
+ - Ask: "A similar entry exists. Update it, create a new one, or skip?"
61
+ - If update: replace the existing entry. If new: append. If skip: done.
62
+
63
+ ### 3. Format Entry
64
+
65
+ Each entry gets a unique ID and ISO timestamp for dedup and ordering:
50
66
 
51
67
  ```markdown
52
- ### {Title} ({date})
68
+
69
+ ---
70
+
71
+ ### {Title}
72
+ **ID:** {random 8-char hex, e.g. a3f7c1e9}
73
+ **Date:** {ISO 8601, e.g. 2026-04-11}
53
74
  **Project:** {current project name or "general"}
54
75
  **Context:** {brief context — what you were building when you learned this}
55
76
 
56
77
  {The learning — be specific enough that future-you understands without context}
57
78
  ```
58
79
 
59
- ### 3. Append to Knowledge File
80
+ ### 4. Append to Knowledge File
81
+
82
+ Append-only — never overwrite the file, always add at the end:
60
83
 
61
84
  ```bash
62
85
  # Append to the right file
@@ -67,7 +90,7 @@ echo "{formatted entry}" >> ~/.claude/knowledge/{type}.md
67
90
  - Fix → `~/.claude/knowledge/common-fixes.md`
68
91
  - Client pref → `~/.claude/knowledge/client-prefs.md`
69
92
 
70
- ### 4. Confirm
93
+ ### 5. Confirm
71
94
 
72
95
  ```
73
96
  ⬢ Saved to {file}