qualia-framework 3.6.0 → 4.0.3

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 (56) hide show
  1. package/CLAUDE.md +23 -11
  2. package/README.md +96 -51
  3. package/agents/builder.md +25 -14
  4. package/agents/plan-checker.md +29 -16
  5. package/agents/planner.md +33 -24
  6. package/agents/research-synthesizer.md +25 -12
  7. package/agents/roadmapper.md +89 -84
  8. package/agents/verifier.md +11 -2
  9. package/bin/cli.js +18 -13
  10. package/bin/install.js +34 -45
  11. package/bin/qualia-ui.js +267 -1
  12. package/bin/state.js +164 -12
  13. package/bin/statusline.js +4 -1
  14. package/docs/erp-contract.md +12 -0
  15. package/guide.md +85 -22
  16. package/hooks/migration-guard.js +23 -9
  17. package/hooks/pre-compact.js +39 -11
  18. package/hooks/pre-deploy-gate.js +3 -4
  19. package/hooks/pre-push.js +6 -3
  20. package/hooks/session-start.js +8 -8
  21. package/package.json +1 -1
  22. package/rules/frontend.md +5 -13
  23. package/skills/qualia/SKILL.md +8 -1
  24. package/skills/qualia-build/SKILL.md +49 -4
  25. package/skills/qualia-debug/SKILL.md +6 -0
  26. package/skills/qualia-design/SKILL.md +9 -1
  27. package/skills/qualia-discuss/SKILL.md +6 -0
  28. package/skills/qualia-handoff/SKILL.md +92 -12
  29. package/skills/qualia-help/SKILL.md +18 -4
  30. package/skills/qualia-idk/SKILL.md +166 -0
  31. package/skills/qualia-learn/SKILL.md +6 -0
  32. package/skills/qualia-map/SKILL.md +7 -0
  33. package/skills/qualia-milestone/SKILL.md +128 -79
  34. package/skills/qualia-new/SKILL.md +163 -230
  35. package/skills/qualia-optimize/SKILL.md +8 -0
  36. package/skills/qualia-pause/SKILL.md +5 -0
  37. package/skills/qualia-plan/SKILL.md +25 -10
  38. package/skills/qualia-polish/SKILL.md +8 -0
  39. package/skills/qualia-quick/SKILL.md +7 -0
  40. package/skills/qualia-report/SKILL.md +17 -0
  41. package/skills/qualia-research/SKILL.md +7 -0
  42. package/skills/qualia-resume/SKILL.md +3 -0
  43. package/skills/qualia-review/SKILL.md +7 -0
  44. package/skills/qualia-ship/SKILL.md +5 -0
  45. package/skills/qualia-skill-new/SKILL.md +6 -0
  46. package/skills/qualia-task/SKILL.md +8 -1
  47. package/skills/qualia-test/SKILL.md +7 -0
  48. package/skills/qualia-verify/SKILL.md +65 -3
  49. package/templates/help.html +4 -4
  50. package/templates/journey.md +113 -0
  51. package/templates/plan.md +56 -11
  52. package/templates/requirements.md +82 -22
  53. package/templates/roadmap.md +41 -14
  54. package/templates/tracking.json +2 -0
  55. package/tests/hooks.test.sh +5 -5
  56. package/tests/runner.js +381 -7
@@ -1,11 +1,31 @@
1
1
  ---
2
2
  name: qualia-handoff
3
- description: "Client delivery — credentials, handover doc, final update. Use after shipping."
3
+ description: "Client delivery — produces the 4 mandatory Handoff deliverables (production URL, documentation, client assets archive, ERP finalization). Triggered at the end of the Handoff milestone."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
4
9
  ---
5
10
 
6
11
  # /qualia-handoff — Client Delivery
7
12
 
8
- Prepare and deliver the finished project to the client.
13
+ Finishes a project by producing the 4 mandatory Handoff deliverables defined in `JOURNEY.md`'s Handoff milestone. Every Qualia client project ends with this skill.
14
+
15
+ ## When to Use
16
+
17
+ - After `/qualia-ship` on the final phase of the Handoff milestone
18
+ - Invoked automatically at the end of `/qualia-new --auto` chain
19
+ - Can also be run manually if the project deviated from auto mode
20
+
21
+ ## The 4 Deliverables
22
+
23
+ Every Handoff milestone must produce these. They are checked against in `REQUIREMENTS.md` as `HAND-10..HAND-15`.
24
+
25
+ 1. **Production URL verified** — HTTP 200, auth flow, latency under 500ms
26
+ 2. **Documentation** — README with architecture, setup, API docs
27
+ 3. **Client Assets** — `.planning/archive/` contains every milestone's verification reports + credentials doc + recorded walkthrough
28
+ 4. **ERP Finalization** — final `/qualia-report` with `lifetime.milestones_completed` incremented
9
29
 
10
30
  ## Process
11
31
 
@@ -13,7 +33,35 @@ Prepare and deliver the finished project to the client.
13
33
  node ~/.claude/bin/qualia-ui.js banner handoff
14
34
  ```
15
35
 
16
- ### 1. Generate Handover Doc
36
+ ### 1. Verify Production URL (Deliverable 1)
37
+
38
+ ```bash
39
+ URL=$(node -e "const t=JSON.parse(require('fs').readFileSync('.planning/tracking.json','utf8'));console.log(t.deployed_url||'')")
40
+ if [ -z "$URL" ]; then
41
+ node ~/.claude/bin/qualia-ui.js fail "No deployed_url — run /qualia-ship first"
42
+ exit 1
43
+ fi
44
+ HTTP=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
45
+ LATENCY=$(curl -s -o /dev/null -w "%{time_total}" "$URL")
46
+ AUTH=$(curl -s -o /dev/null -w "%{http_code}" "$URL/api/auth/callback" 2>/dev/null || echo "N/A")
47
+ node ~/.claude/bin/qualia-ui.js ok "URL: $URL (HTTP $HTTP, ${LATENCY}s, auth:$AUTH)"
48
+ ```
49
+
50
+ If HTTP is not 2xx or latency > 1.0s → halt; deliverable fails.
51
+
52
+ ### 2. Update Documentation (Deliverable 2)
53
+
54
+ Ensure the repo's `README.md` has:
55
+ - **Overview** — what the project does
56
+ - **Architecture** — stack summary, key services (Supabase / Vercel / third-party)
57
+ - **Setup** — how to run locally (clone, env, `npm install`, `npm run dev`)
58
+ - **Env vars** — list from `.env.local.example` (mask values)
59
+ - **Deploy** — "Production deploys via `vercel --prod`. GitHub auto-deploy is DISABLED."
60
+ - **Support** — contact: Fawzi Goussous, fawzi@qualiasolutions.net
61
+
62
+ If README is stale or missing sections, update it and commit.
63
+
64
+ ### 3. Generate Handover Doc + Archive (Deliverable 3)
17
65
 
18
66
  Create `.planning/HANDOFF.md`:
19
67
 
@@ -21,46 +69,78 @@ Create `.planning/HANDOFF.md`:
21
69
  # {Project Name} — Handover
22
70
 
23
71
  ## What Was Built
24
- {3-5 bullet summary of delivered features}
72
+ {3-5 bullet summary of delivered features, pulled from JOURNEY.md milestone exit criteria}
25
73
 
26
74
  ## Access
27
75
  - **URL:** {production URL}
28
- - **Admin login:** {credentials or where to find them}
76
+ - **Admin login:** {credentials doc location typically `.planning/credentials.md` (git-ignored)}
29
77
  - **Supabase:** {project ref}
30
78
  - **GitHub:** {repo URL}
31
79
  - **Vercel:** {project URL}
80
+ - **Walkthrough:** {Loom or video link — recorded demo of primary flows}
32
81
 
33
82
  ## How to Use
34
83
  {Brief walkthrough of the main user flows}
35
84
 
36
85
  ## Known Limitations
37
- {Anything not in scope or deferred}
86
+ {Anything not in scope or deferred, copied from REQUIREMENTS.md Out of Scope + Post-Handoff v2}
38
87
 
39
88
  ## Maintenance
40
- - Hosting: Vercel (auto-deploys from main branch)
89
+ - Hosting: Vercel (MANUAL deploys via `vercel --prod`)
41
90
  - Database: Supabase ({region})
42
91
  - Domain: {domain provider if applicable}
92
+ - Monitoring: UptimeRobot status page https://stats.uptimerobot.com/bKudHy1pLs
93
+
94
+ ## Milestones Shipped
95
+ {Summary pulled from tracking.json milestones[] — one line per closed milestone with date and phase count}
43
96
 
44
97
  ## Support
45
98
  Contact: Fawzi Goussous — fawzi@qualiasolutions.net
99
+ Standard support window: 30 days post-handoff.
100
+ ```
101
+
102
+ Also ensure `.planning/archive/` contains every milestone's phase verification reports (qualia-milestone moves them there on close — verify they're present).
103
+
104
+ ```bash
105
+ ls -la .planning/archive/ 2>/dev/null
46
106
  ```
47
107
 
48
- ### 2. Commit
108
+ If `.planning/archive/` is empty, something went wrong — milestones should have been archived on close. Investigate and recover from git history if needed.
109
+
110
+ ### 4. Commit + Push
49
111
 
50
112
  ```bash
51
- git add .planning/HANDOFF.md
52
- git commit -m "docs: client handoff document"
113
+ git add .planning/HANDOFF.md README.md
114
+ git commit -m "docs: client handoff — {project name}"
53
115
  git push
54
116
  ```
55
117
 
56
- ### 3. Update State
118
+ ### 5. Update State
57
119
 
58
120
  ```bash
59
121
  node ~/.claude/bin/state.js transition --to handed_off
60
122
  ```
123
+
61
124
  Do NOT manually edit STATE.md or tracking.json — state.js handles both.
62
125
 
126
+ ### 6. ERP Finalization (Deliverable 4)
127
+
128
+ Trigger the final `/qualia-report`. This uploads the closing state to the ERP with `lifetime.milestones_completed` incremented by the Handoff close that just happened.
129
+
130
+ In `--auto` mode, inline-invoke `/qualia-report` now. In guided mode, show the next step:
131
+
63
132
  ```bash
64
- node ~/.claude/bin/qualia-ui.js ok "{Project Name} handed off to {client}"
133
+ node ~/.claude/bin/qualia-ui.js ok "Production URL verified"
134
+ node ~/.claude/bin/qualia-ui.js ok "Documentation updated"
135
+ node ~/.claude/bin/qualia-ui.js ok "Client assets archived + handoff doc written"
136
+ node ~/.claude/bin/qualia-ui.js ok "Ready for final ERP report"
65
137
  node ~/.claude/bin/qualia-ui.js end "DELIVERED" "/qualia-report"
66
138
  ```
139
+
140
+ ## Rules
141
+
142
+ 1. **No handoff without verified production URL.** Step 1 halts if URL is down or latency > 1s.
143
+ 2. **Archive is mandatory.** `.planning/archive/` must contain every closed milestone's phase artifacts. If empty, the project was handled outside the framework — recover from git history.
144
+ 3. **README is the public face.** If it's stale, fix it before handoff. Client reads it first.
145
+ 4. **Credentials never in the repo.** `.planning/credentials.md` is git-ignored. Deliver credentials via secure channel (1Password shared vault, encrypted email).
146
+ 5. **Support clause is 30 days by default.** If the client contract says otherwise, override it in HANDOFF.md.
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: qualia-help
3
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
+ allowed-tools:
5
+ - Bash
6
+ - Read
4
7
  ---
5
8
 
6
9
  # /qualia-help — Framework Reference
@@ -12,14 +15,25 @@ Opens a Qualia-themed HTML reference guide in your default browser.
12
15
  ### 1. Generate the HTML
13
16
 
14
17
  ```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")
18
+ # Read the template and inject the current version.
19
+ # Prefer .qualia-config.json; fall back to the framework package.json; last resort is the
20
+ # literal string "latest" so the UI never lies about a specific version.
21
+ VERSION=$(node -e "
22
+ const fs = require('fs'), path = require('path'), os = require('os');
23
+ const cfg = path.join(os.homedir(), '.claude', '.qualia-config.json');
24
+ const pkg = path.join(os.homedir(), '.claude', 'qualia-framework', 'package.json');
25
+ try { const v = JSON.parse(fs.readFileSync(cfg,'utf8')).version; if (v) { console.log(v); process.exit(0); } } catch {}
26
+ try { const v = JSON.parse(fs.readFileSync(pkg,'utf8')).version; if (v) { console.log('v'+v); process.exit(0); } } catch {}
27
+ console.log('latest');
28
+ " 2>/dev/null || echo "latest")
17
29
  TEMPLATE="$HOME/.claude/qualia-templates/help.html"
18
30
  OUTPUT="/tmp/qualia-help.html"
19
31
 
20
- # If template doesn't exist, check the framework install
32
+ # If template doesn't exist in the user home, check the installed framework copy.
21
33
  if [ ! -f "$TEMPLATE" ]; then
22
- TEMPLATE="$(dirname "$(dirname "$(which qualia-framework 2>/dev/null || echo '')")")/templates/help.html"
34
+ for CANDIDATE in "$HOME/.claude/qualia-framework/templates/help.html"; do
35
+ if [ -f "$CANDIDATE" ]; then TEMPLATE="$CANDIDATE"; break; fi
36
+ done
23
37
  fi
24
38
  ```
25
39
 
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: qualia-idk
3
+ description: "Diagnostic intelligence for 'I don't know what's going on.' Runs two isolated scans (.planning/ vs codebase), cross-references against the user's confusion, then explains the situation in plain language with a concrete recommended next step. Use whenever the user says 'I don't know', 'something feels off', 'not sure what to do', 'am I doing this right', 'what's happening', 'help me understand'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Grep
8
+ - Glob
9
+ - Agent
10
+ ---
11
+
12
+ # /qualia-idk — "I Don't Know What's Going On"
13
+
14
+ Not a router. A **diagnostician**. Use when the user isn't stuck on a command — they're stuck on *understanding*.
15
+
16
+ ## How This Differs from `/qualia`
17
+
18
+ | `/qualia` | `/qualia-idk` |
19
+ |---|---|
20
+ | Mechanical: reads state.js, returns `/qualia-X` | Interpretive: reads the project + the code + the confusion |
21
+ | "What command do I run next?" | "What is actually going on here?" |
22
+ | Always returns a skill name | Returns an explanation + a recommendation |
23
+ | Cheap, instant | Spawns 2 isolated agents, ~30s |
24
+
25
+ Run `/qualia` first when the user knows what they're trying to do. Run `/qualia-idk` when the user's confusion is about the *situation itself*.
26
+
27
+ ## Process
28
+
29
+ ### Step 0. Banner
30
+
31
+ ```bash
32
+ node ~/.claude/bin/qualia-ui.js banner router
33
+ node ~/.claude/bin/qualia-ui.js spawn "diagnostic" "Reading planning and codebase in isolation..."
34
+ ```
35
+
36
+ Say: **"Let me take a proper look."**
37
+
38
+ ### Step 1. Gather the User's Confusion
39
+
40
+ Look at the conversation context (if any). Note:
41
+ - What did the user just say or ask?
42
+ - Any recent errors, failed commands, surprising output?
43
+ - Any mismatch between what they expected and what happened?
44
+
45
+ If there's nothing in conversation context yet, ask:
46
+ - header: "What's unclear?"
47
+ - question: "Where are you stuck? (one sentence is fine)"
48
+ - Free text.
49
+
50
+ Store this as `<user_confusion>`.
51
+
52
+ ### Step 2. Spawn Two Isolated Scans (Parallel)
53
+
54
+ Two fresh subagents. Each sees ONLY its respective scope — no cross-contamination.
55
+
56
+ ```
57
+ Agent(prompt="
58
+ You are a read-only diagnostic scanner for the .planning/ folder only.
59
+
60
+ Read ALL of the following if present:
61
+ - .planning/PROJECT.md
62
+ - .planning/JOURNEY.md
63
+ - .planning/REQUIREMENTS.md
64
+ - .planning/ROADMAP.md
65
+ - .planning/STATE.md
66
+ - .planning/tracking.json
67
+ - .planning/phase-*-plan.md (latest 1-2)
68
+ - .planning/phase-*-verification.md (latest 1-2)
69
+ - .planning/DESIGN.md (skim)
70
+ - .continue-here.md (if present)
71
+
72
+ DO NOT read any source code — no src/, app/, components/, lib/, etc.
73
+ DO NOT run any build tools.
74
+
75
+ Produce a 'Plan View' report answering:
76
+ 1. What is this project? (one sentence from PROJECT.md)
77
+ 2. Where does the plan say we ARE? (current milestone + phase + status)
78
+ 3. What does the plan say should be TRUE right now? (current phase's acceptance criteria / success criteria)
79
+ 4. What does the plan say is UNFINISHED? (upcoming phases or unresolved gaps from latest verification)
80
+ 5. Any plan-level inconsistencies? (e.g. tracking.json says phase 3 but STATE.md says phase 2, JOURNEY.md missing, roadmap out of sync)
81
+
82
+ Keep it under 250 words. Be specific. No filler.
83
+ ", subagent_type="Explore", description="Plan-view scan")
84
+
85
+ Agent(prompt="
86
+ You are a read-only diagnostic scanner for the source code only.
87
+
88
+ DO NOT read anything in .planning/ — skip it entirely.
89
+
90
+ Scan the repo:
91
+ - Package/framework detection (package.json, requirements.txt, etc.)
92
+ - Entry points (app/, src/, pages/, index.*)
93
+ - Key files referenced in recent commits (git log --oneline -5, then inspect)
94
+ - Run quick static checks if applicable: 'npx tsc --noEmit' output, lint errors, test status
95
+ - Look for stubs: grep for TODO, FIXME, 'not implemented', empty catch blocks, unused exports
96
+
97
+ Produce a 'Code View' report answering:
98
+ 1. What does the code look like it's BUILDING? (inferred from structure + imports, not from docs)
99
+ 2. What ACTUALLY WORKS right now? (compile status, recent commit messages, any obvious smoke signals)
100
+ 3. What's STUBBED or INCOMPLETE? (concrete file:line citations)
101
+ 4. What's RUNNING locally or deployed? (if there's a dev server log, vercel link, supabase project — flag it)
102
+ 5. Any code-level inconsistencies? (imports that don't resolve, routes referenced but not defined, schema mismatches)
103
+
104
+ Keep it under 250 words. Cite specific files/lines. No filler.
105
+ ", subagent_type="Explore", description="Code-view scan")
106
+ ```
107
+
108
+ Wait for both. Don't proceed to synthesis until you have both reports.
109
+
110
+ ### Step 3. Synthesize
111
+
112
+ With both reports + the user's confusion in hand, cross-reference:
113
+
114
+ **Produce a structured diagnosis** (use this exact shape):
115
+
116
+ ```
117
+ ## What I see
118
+
119
+ **The plan says:** {1-2 sentences — current milestone/phase/status, what should be true}
120
+
121
+ **The code says:** {1-2 sentences — what actually exists, what works, what's stubbed}
122
+
123
+ **The mismatch (if any):** {1-2 sentences — where plan and code disagree. If no mismatch, say "plan and code are consistent".}
124
+
125
+ ## What I think is happening
126
+
127
+ {3-5 sentences, plain language. Tie the user's confusion to what you found. Avoid jargon. If the user said "the login is broken", don't say "the auth middleware has a type inference issue" — say "you're seeing the login fail because the signin function isn't actually imported into the login page, even though the plan says it should be. Someone wrote the helper but forgot to wire it up."}
128
+
129
+ ## What to do next
130
+
131
+ 1. **{concrete action}** — {one sentence why}
132
+ 2. **{concrete action}** — {one sentence why}
133
+ 3. **{optional third}** — {one sentence why}
134
+
135
+ If one of these maps to an existing Qualia command, use it:
136
+ - `/qualia-plan {N} --gaps` if the mismatch is "plan says X but code has stubs"
137
+ - `/qualia-verify {N}` if the mismatch is "code says built but no verification exists"
138
+ - `/qualia-debug` if a specific error is the block
139
+ - `/qualia-map` if the plan and code have drifted far apart
140
+ - `/qualia-pause` if the user is overwhelmed and should step away
141
+ ```
142
+
143
+ ### Step 4. Close
144
+
145
+ ```bash
146
+ node ~/.claude/bin/qualia-ui.js divider
147
+ node ~/.claude/bin/qualia-ui.js end "DIAGNOSED" "{top-recommended action if it's a command, else leave blank}"
148
+ ```
149
+
150
+ ## Rules
151
+
152
+ 1. **Two isolated scans, always.** Plan view never peeks at code, code view never peeks at planning. This is what keeps the diagnosis honest — each agent sees one side of the story, and the synthesis catches the delta.
153
+ 2. **Plain language over jargon.** If you can't explain it to a non-dev, rewrite it.
154
+ 3. **No fake certainty.** If the scans come back thin (e.g., brand new repo), say "I don't have enough signal yet — here's what I'd do to gather more."
155
+ 4. **Never invent facts.** If the code-view scan didn't find something, don't say it exists. Cite files.
156
+ 5. **One recommendation primary, two backups.** Decision fatigue is the problem — give the user a lead option.
157
+ 6. **Don't re-run if state.js already knows.** If the user's confusion is purely "what's my next command", `/qualia` already handles that — gently suggest it instead of spawning agents.
158
+
159
+ ## When NOT to Use
160
+
161
+ - User knows what they're doing and just wants the next command → `/qualia`
162
+ - User has a specific error message → `/qualia-debug`
163
+ - User wants to review code quality → `/qualia-review`
164
+ - User wants to pause and come back → `/qualia-pause`
165
+
166
+ `/qualia-idk` is specifically for **"I'm not sure what I'm even looking at"** situations. Route to sharper tools when the question is sharper.
@@ -1,6 +1,12 @@
1
1
  ---
2
2
  name: qualia-learn
3
3
  description: "Save a learning, pattern, fix, or client preference to the knowledge base. Persists across projects and sessions. Trigger on 'remember this', 'save this pattern', 'learned something', 'note for future', 'client prefers', 'qualia-learn'."
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Glob
9
+ - Grep
4
10
  ---
5
11
 
6
12
  # /qualia-learn — Save Knowledge
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-map
3
3
  description: "Map an existing codebase to infer architecture, stack, conventions, and what's already built. For brownfield projects — run BEFORE /qualia-new so Validated requirements get inferred from existing code."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Grep
9
+ - Glob
10
+ - Agent
4
11
  ---
5
12
 
6
13
  # /qualia-map — Codebase Mapping (Brownfield)