qualia-framework 6.3.0 → 6.4.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 (44) hide show
  1. package/AGENTS.md +8 -8
  2. package/CLAUDE.md +5 -5
  3. package/README.md +17 -39
  4. package/bin/cli.js +64 -16
  5. package/bin/command-surface.js +5 -1
  6. package/bin/install.js +26 -11
  7. package/bin/learning-candidates.js +217 -0
  8. package/bin/prune-deprecated.js +64 -0
  9. package/bin/runtime-manifest.js +4 -0
  10. package/bin/security-scan.js +409 -0
  11. package/bin/status-snapshot.js +363 -0
  12. package/guide.md +11 -33
  13. package/hooks/pre-compact.js +232 -0
  14. package/package.json +1 -1
  15. package/skills/qualia/SKILL.md +1 -1
  16. package/skills/qualia-build/SKILL.md +1 -1
  17. package/skills/qualia-discuss/SKILL.md +1 -1
  18. package/skills/qualia-doctor/SKILL.md +1 -1
  19. package/skills/qualia-feature/SKILL.md +1 -1
  20. package/skills/qualia-fix/SKILL.md +1 -1
  21. package/skills/qualia-idk/SKILL.md +245 -0
  22. package/skills/qualia-learn/SKILL.md +1 -1
  23. package/skills/qualia-map/SKILL.md +1 -1
  24. package/skills/qualia-milestone/SKILL.md +1 -1
  25. package/skills/qualia-new/SKILL.md +1 -1
  26. package/skills/qualia-optimize/SKILL.md +1 -1
  27. package/skills/qualia-plan/SKILL.md +1 -1
  28. package/skills/qualia-polish/SKILL.md +1 -1
  29. package/skills/qualia-postmortem/SKILL.md +1 -1
  30. package/skills/qualia-report/SKILL.md +1 -1
  31. package/skills/qualia-research/SKILL.md +1 -1
  32. package/skills/qualia-review/SKILL.md +1 -1
  33. package/skills/qualia-road/SKILL.md +1 -1
  34. package/skills/qualia-secure/SKILL.md +105 -0
  35. package/skills/qualia-test/SKILL.md +1 -1
  36. package/skills/qualia-verify/SKILL.md +1 -1
  37. package/skills/zoho-workflow/SKILL.md +1 -1
  38. package/tests/bin.test.sh +9 -9
  39. package/tests/install-smoke.test.sh +3 -3
  40. package/tests/lib.test.sh +6 -6
  41. package/tests/published-install-smoke.test.sh +3 -3
  42. package/tests/refs.test.sh +29 -22
  43. package/tests/runner.js +3 -3
  44. package/tests/state.test.sh +38 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qualia-framework",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "Claude Code and Codex workflow framework by Qualia Solutions. Plan, build, verify, ship.",
5
5
  "bin": {
6
6
  "qualia-framework": "./bin/cli.js"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia
3
- description: "Smart router — reads project state (state.js), classifies the situation mechanically, and either returns the exact next command or performs the lightweight diagnosis previously split across helper commands. Use whenever you type /qualia, 'what next', 'next', 'what now', 'what should I do next', 'what command now', 'resume', 'pause', or 'I don't know what is going on'."
3
+ description: "Mechanical state-driven router — reads state.js, returns the exact next command. Cheap and instant. Triggers: '/qualia', 'what next', 'what now'. For deeper situational confusion use /qualia-idk."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-build
3
- description: "Executes a planned phase by spawning fresh builder subagents per task with wave-based parallelization. Each task gets isolated context, commits atomically, and runs its own validation. Use when the user says 'build this phase', 'execute the plan', 'start building', 'run the build', 'qualia-build', or after /qualia-plan approves a phase plan."
3
+ description: "Execute a planned phase fresh builder subagents per task, wave-based parallelization, atomic commits, per-task validation. Triggers: 'build this phase', 'execute the plan', 'start building', 'qualia-build'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-discuss
3
- description: "Alignment interview. Two modes. PROJECT MODE (default, no args) is the non-technical kickoff before /qualia-new — 8 questions for demo projects, 14 for full projects, output is .planning/project-discovery.md. PHASE MODE (with N arg, e.g. /qualia-discuss 2) is the technical aggressive grilling before /qualia-plan N — one question at a time with recommended answer, output is .planning/phase-{N}-context.md. Trigger phrases: 'discuss', 'kickoff interview', 'grill me', 'stress test this plan', 'wait let's think about this one', 'I'm not sure how to approach this'."
3
+ description: "Alignment interview PROJECT MODE before /qualia-new, PHASE MODE before /qualia-plan N. Triggers: 'discuss', 'kickoff interview', 'grill me', 'stress test this plan', 'I'm not sure how to approach this'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-doctor
3
- description: "Employee-facing framework health check. Wraps `qualia-framework doctor`, checks install targets, project state, contract coverage, planning-folder hygiene, hooks, memory, ERP queue health, and gives safe repair commands. Trigger on 'doctor', 'health check', 'framework broken', 'is Qualia installed correctly', 'Codex not picking up Qualia', 'hooks not running', 'memory broken', 'ERP queue stuck', '.planning messy'."
3
+ description: "Framework health check install, project state, contracts, hooks, memory, ERP queue. Suggests safe repair commands. Triggers: 'doctor', 'health check', 'framework broken', 'hooks not running', 'ERP queue stuck'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-feature
3
- description: "Auto-scoped single feature build for adding net-new capability. Picks inline (≤1 trivial file, no spawn) or fresh builder spawn (1-5 logic files, atomic commit). Refuses and routes to /qualia-plan for phase-sized work, and routes broken existing behavior to /qualia-fix. Trigger phrases: 'build this one thing', 'add a component', 'implement this feature', 'small change', 'tweak', 'one-line copy change', 'config tweak', 'qualia-feature'."
3
+ description: "Auto-scoped single-feature build (inline for trivia, fresh spawn for 1-5 files). Routes phase-sized work to /qualia-plan, broken behavior to /qualia-fix. Triggers: 'build this one thing', 'add a component', 'implement this feature', 'small change', 'tweak'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-fix
3
- description: "Practical repair lane for broken existing behavior. Combines root-cause investigation with /qualia-feature execution discipline. Use when the user says 'fix this', 'bug', 'broken', 'error', 'failing test', 'regression', 'hotfix', 'not working', 'layout broken', 'slow page', or 'config is wrong'."
3
+ description: "Practical repair lane for broken behavior root-cause investigation + /qualia-feature execution. Triggers: 'fix this', 'bug', 'broken', 'error', 'failing test', 'regression', 'hotfix', 'layout broken', 'slow page'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -0,0 +1,245 @@
1
+ ---
2
+ name: qualia-idk
3
+ description: "Deep diagnostic for 'I don't know what's going on.' Reads conversation context + the planning folder + the codebase in three isolated scans, cross-references against the user's confusion, then returns plain-language guidance PLUS a paste-ready Qualia command sequence to unstick them. 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', 'where am I', 'lost'."
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 single command — they're stuck on **understanding the situation**. Returns guidance + a Qualia command sequence the user can paste.
15
+
16
+ ## How This Differs from `/qualia`
17
+
18
+ | `/qualia` | `/qualia-idk` |
19
+ |---|---|
20
+ | Mechanical: reads state.js, returns one `/qualia-X` | Interpretive: reads conversation + planning + code |
21
+ | "What's my next command?" | "What is happening, and what sequence gets me unstuck?" |
22
+ | Always returns a skill name | Returns plain-language guidance + a multi-command sequence |
23
+ | Cheap, instant (~2s) | Three parallel scans, ~30–45s |
24
+
25
+ Run `/qualia` when the user knows what they're trying to do. Run `/qualia-idk` when the user's confusion is about **the situation itself** — scope, drift, or where to even begin.
26
+
27
+ ## Process
28
+
29
+ ### Step 0. Banner
30
+
31
+ ```bash
32
+ node ${QUALIA_BIN}/qualia-ui.js banner router
33
+ node ${QUALIA_BIN}/qualia-ui.js spawn "diagnostic" "Reading conversation, planning, and codebase in isolation..."
34
+ ```
35
+
36
+ Say: **"Let me take a proper look."**
37
+
38
+ ### Step 1. Capture the User's Confusion
39
+
40
+ Look at the recent conversation. 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
+ - Sentiment cues: "lost", "stuck", "weird", "broken", "where am I" — record verbatim.
45
+
46
+ If conversation context is thin, ask:
47
+ - header: "What's unclear?"
48
+ - question: "Where are you stuck? (one sentence is fine)"
49
+ - Free text.
50
+
51
+ Store as `<user_confusion>`.
52
+
53
+ ### Step 2. Capture Session Context (local, fast)
54
+
55
+ Before spawning scans, gather cheap session signals:
56
+
57
+ ```bash
58
+ # Where is the user right now?
59
+ test -f .continue-here.md && head -30 .continue-here.md
60
+ test -f .planning/STATE.md && head -20 .planning/STATE.md
61
+ git log --oneline -5 2>/dev/null
62
+ git status --short 2>/dev/null | head -10
63
+
64
+ # Recent planning artifacts (mtime tells us what was last touched)
65
+ ls -lt .planning/phase-*-*.md 2>/dev/null | head -8
66
+ ls -lt .planning/decisions/*.md 2>/dev/null | head -5
67
+
68
+ # Is there a halt / FAIL we should know about?
69
+ grep -l "FAIL\|INSUFFICIENT EVIDENCE\|HALT" .planning/phase-*-verification.md 2>/dev/null
70
+ ```
71
+
72
+ Store as `<session_context>`.
73
+
74
+ ### Step 3. Spawn Three Isolated Scans (Parallel)
75
+
76
+ Three fresh subagents. Each sees ONLY its scope — no cross-contamination. They run in parallel; wait for all three.
77
+
78
+ **Agent A — Planning View** (broader than v1: now reads CONTEXT, REQUIREMENTS, decisions/, all phase artifacts, not just the latest):
79
+
80
+ ```
81
+ Agent(prompt="
82
+ You are a read-only diagnostic scanner for the .planning/ folder only.
83
+
84
+ Read ALL of the following if present:
85
+ - .planning/PROJECT.md
86
+ - .planning/CONTEXT.md (domain glossary)
87
+ - .planning/JOURNEY.md
88
+ - .planning/REQUIREMENTS.md
89
+ - .planning/ROADMAP.md
90
+ - .planning/STATE.md
91
+ - .planning/tracking.json
92
+ - .planning/phase-*-plan.md (ALL, not just latest)
93
+ - .planning/phase-*-verification.md (ALL — flag any FAILs)
94
+ - .planning/phase-*-context.md (from /qualia-discuss PHASE MODE, if any)
95
+ - .planning/phase-*-research.md (if any)
96
+ - .planning/DESIGN.md (skim)
97
+ - .planning/decisions/*.md (ADRs — short read)
98
+ - .continue-here.md (if present)
99
+
100
+ DO NOT read any source code — no src/, app/, components/, lib/, etc.
101
+ DO NOT run any build tools.
102
+
103
+ Produce a 'Plan View' report answering:
104
+ 1. What is this project? (one sentence from PROJECT.md)
105
+ 2. Where does the plan say we ARE? (current milestone N of M + phase P of Q + status)
106
+ 3. What SHOULD be true right now? (current phase's acceptance criteria)
107
+ 4. What's UNFINISHED? (upcoming phases / unresolved gaps from latest verification)
108
+ 5. Plan-level inconsistencies? (tracking.json vs STATE.md mismatch, JOURNEY.md missing, roadmap drift)
109
+ 6. Has any verification FAILED recently? Quote the FAIL summary if so.
110
+ 7. Are there hard decisions (ADRs in decisions/) that constrain the next step?
111
+
112
+ Keep it under 350 words. Be specific. No filler. Quote file:line for anything you assert.
113
+ ", subagent_type="Explore", description="Plan-view scan")
114
+ ```
115
+
116
+ **Agent B — Code View** (unchanged from v1):
117
+
118
+ ```
119
+ Agent(prompt="
120
+ You are a read-only diagnostic scanner for the source code only.
121
+
122
+ DO NOT read anything in .planning/ — skip it entirely.
123
+
124
+ Scan the repo:
125
+ - Package/framework detection (package.json, requirements.txt, etc.)
126
+ - Entry points (app/, src/, pages/, index.*)
127
+ - Key files referenced in recent commits (git log --oneline -5, then inspect)
128
+ - Quick static checks: 'npx tsc --noEmit' output, lint errors, test status
129
+ - Stubs: grep for TODO, FIXME, 'not implemented', empty catch blocks, unused exports
130
+ - Dev server / deploy markers (vercel link, .env.local, supabase project ref)
131
+
132
+ Produce a 'Code View' report answering:
133
+ 1. What does the code LOOK LIKE it's building? (inferred from structure + imports)
134
+ 2. What ACTUALLY WORKS right now? (compile status, recent commits, smoke signals)
135
+ 3. What's STUBBED / INCOMPLETE? (concrete file:line citations)
136
+ 4. What's RUNNING locally or deployed?
137
+ 5. Code-level inconsistencies? (imports that don't resolve, routes referenced but not defined)
138
+
139
+ Under 300 words. Cite file:line. No filler.
140
+ ", subagent_type="Explore", description="Code-view scan")
141
+ ```
142
+
143
+ **Agent C — Conversation & Memory View** (new in v2):
144
+
145
+ ```
146
+ Agent(prompt="
147
+ You are a read-only diagnostic scanner for the user's recent activity. Do NOT read .planning/ or source code.
148
+
149
+ Read:
150
+ - ${QUALIA_HOME}/knowledge/daily-log/<latest 1-2 dates>.md (recent session entries)
151
+ - ${QUALIA_HOME}/knowledge/concepts/<files referenced by the user's confusion>
152
+ - .continue-here.md (if present)
153
+ - git log --since='3 days ago' --oneline
154
+ - git diff main...HEAD --stat (work in flight)
155
+
156
+ Cross-reference against the user's stated confusion: ${user_confusion}
157
+
158
+ Produce a 'Session View' report answering:
159
+ 1. What has the user been doing recently? (1-3 bullets from daily log + git)
160
+ 2. Is the user's CURRENT confusion consistent with their recent activity, or is there a discontinuity? (e.g. they were in M2-P3 yesterday but today they're asking about M3 setup)
161
+ 3. Are there saved learnings or ADRs that directly answer the user's confusion?
162
+ 4. Was there a recent halt, FAIL, or pause we should foreground?
163
+
164
+ Under 250 words. Quote daily-log line numbers or commit SHAs.
165
+ ", subagent_type="Explore", description="Session-view scan")
166
+ ```
167
+
168
+ ### Step 4. Synthesize — Diagnosis + Command Sequence
169
+
170
+ With all three reports + `<user_confusion>` + `<session_context>` in hand, produce **exactly this shape**:
171
+
172
+ ```markdown
173
+ ## What I see
174
+
175
+ **The plan says:** {1-2 sentences — current milestone/phase/status, what should be true}
176
+
177
+ **The code says:** {1-2 sentences — what actually exists, what works, what's stubbed}
178
+
179
+ **Your recent activity:** {1-2 sentences — last 2-3 days of work in flight, last commit, last skill run}
180
+
181
+ **The mismatch (if any):** {1-2 sentences — where plan / code / activity disagree. If consistent, say "all three views align".}
182
+
183
+ ## What I think is happening
184
+
185
+ {3-5 sentences, plain language. Tie the user's confusion to what you found. No 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 phase-2-plan.md says it should be. Someone wrote the helper but forgot to wire it up — that's why verification went FAIL yesterday."}
186
+
187
+ ## What to do next — paste-ready command sequence
188
+
189
+ ```
190
+ {command 1} # {one-line reason}
191
+ {command 2} # {one-line reason}
192
+ {command 3} # {one-line reason}
193
+ ```
194
+
195
+ {One sentence on what this sequence accomplishes end-to-end.}
196
+
197
+ ## Or, if you'd rather hand-pick:
198
+
199
+ 1. **{action}** — {why}
200
+ 2. **{action}** — {why}
201
+ 3. **{optional}** — {why}
202
+ ```
203
+
204
+ **Command-sequence picking rules** — choose from these established patterns:
205
+
206
+ | Situation found | Sequence |
207
+ |---|---|
208
+ | Plan says built but code has stubs | `/qualia-plan {N} --gaps` → `/qualia-build` → `/qualia-verify` |
209
+ | Verify FAILed and no postmortem ran | `/qualia-postmortem` → `/qualia-plan {N} --gaps` → `/qualia-build` |
210
+ | Stale `.continue-here.md`, ongoing context | `/qualia-resume` → `/qualia` |
211
+ | Brownfield drift (plan and code diverged hard) | `/qualia-map` → `/qualia-plan {N} --gaps` |
212
+ | Phase context missing (no `/qualia-discuss` ran) | `/qualia-discuss {N}` → `/qualia-plan {N}` |
213
+ | Specific error, scope clear | `/qualia-fix '<symptom>'` |
214
+ | Performance feels off, no profile | `/qualia-fix --perf '<route>'` or `/qualia-optimize --perf` |
215
+ | Design feels off | `/qualia-polish --critique` then `/qualia-polish` |
216
+ | User is overwhelmed | `/qualia-pause` (save handoff), come back later |
217
+ | Truly nothing actionable found | Ask one specific question; don't invent a sequence |
218
+
219
+ Pick the sequence that fits the actual evidence. Substitute real `{N}` from the Plan-view scan.
220
+
221
+ ### Step 5. Close
222
+
223
+ ```bash
224
+ node ${QUALIA_BIN}/qualia-ui.js divider
225
+ node ${QUALIA_BIN}/qualia-ui.js end "DIAGNOSED" "{first command in the sequence, if any}"
226
+ ```
227
+
228
+ ## Rules
229
+
230
+ 1. **Three isolated scans, always.** Plan view never peeks at code or session. Code view never peeks at planning. Session view never peeks at code. This is what keeps the diagnosis honest — each agent sees one slice, the synthesis catches the delta.
231
+ 2. **Plain language over jargon.** If you can't explain it to a non-dev, rewrite it.
232
+ 3. **No fake certainty.** If the scans come back thin (brand-new repo, no planning artifacts yet), say so explicitly: "I don't have enough signal yet — here's what I'd do to gather more."
233
+ 4. **Never invent facts.** If a scan didn't find something, don't claim it. Cite files.
234
+ 5. **Command sequence > single recommendation.** The user came here because one command isn't enough. Give them a chain.
235
+ 6. **The sequence must be paste-ready.** Real `{N}` values, real route names, no `<placeholder>` text outside the optional "if you'd rather hand-pick" section.
236
+ 7. **Don't re-run if `/qualia` already knows.** If the user's confusion is purely "what's my next command", `/qualia` handles it cheaper — gently suggest it and stop.
237
+
238
+ ## When NOT to Use
239
+
240
+ - User knows what they're doing and just wants the next command → `/qualia`
241
+ - User has a specific error message they want fixed → `/qualia-fix '<symptom>'`
242
+ - User wants to review code quality → `/qualia-review`
243
+ - User wants to pause and come back → `/qualia-pause`
244
+
245
+ `/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,6 @@
1
1
  ---
2
2
  name: qualia-learn
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'."
3
+ description: "Save a learning, pattern, fix, or client preference to the knowledge base. Persists across projects + sessions. Triggers: 'remember this', 'save this pattern', 'learned something', 'client prefers'."
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Write
@@ -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. 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'."
3
+ description: "Map an existing codebase (architecture, stack, conventions, capabilities) and adapt Qualia to its tracker/labels/glossary. Run BEFORE /qualia-new on brownfield projects. Triggers: 'map this codebase', 'onboard to existing project', 'brownfield setup', 'scan the repo', 'inherited a codebase'."
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. 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'."
3
+ description: "Close current milestone and open next — loads scope from JOURNEY.md (no ad-hoc naming), archives, regenerates ROADMAP.md. Triggers: 'close milestone', 'next milestone', 'milestone done', 'M1 done open M2'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-new
3
- description: "Set up a new project from scratch deep questioning, ALWAYS-AUTO research, CONTEXT.md domain glossary seed, decisions/ ADR folder initialized, JOURNEY.md with all milestones to handoff, single approval gate, optional auto-chain into building. Use when starting any new client project."
3
+ description: "Set up a new project — kickoff interview, research, CONTEXT.md glossary, decisions/ ADRs, JOURNEY.md, single approval gate, optional `--auto`. Triggers: 'new project', 'start a project', 'qualia-new', 'set up'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-optimize
3
- description: "Deep improvement discovery pass — reads .planning/ AND codebase to find performance, design, UI, backend, frontend, alignment, and architecture-deepening opportunities. Spawns parallel specialist agents and writes OPTIMIZE.md/RFCs; practical repair work routes to /qualia-fix or /qualia-polish. Use when the user says 'optimize', 'optimization pass', 'find issues', 'deep improve', 'performance audit', 'design alignment check', 'speed up', 'bundle size', 'refactor architecture', 'shallow modules', 'simplify', or wants a comprehensive quality sweep. Supports --perf, --ui, --backend, --alignment, --deepen, --fix flags."
3
+ description: "Deep improvement discovery pass — spawns parallel specialist agents and writes OPTIMIZE.md/RFCs. Triggers: 'optimize', 'find issues', 'performance audit', 'design alignment check', 'speed up', 'bundle size', 'shallow modules', 'simplify'. Flags: --perf, --ui, --backend, --alignment, --deepen, --fix. Routes practical repair to /qualia-fix or /qualia-polish."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-plan
3
- description: "Plans the current phase by spawning a planner agent to break it into executable tasks with waves, then validates via a plan-checker revision loop (max 2 cycles). Supports gap-closure mode for verification failures. Use when the user says 'plan this phase', 'break this into tasks', 'create the plan', 'qualia-plan', 'plan phase 2', or after /qualia-new sets up the journey."
3
+ description: "Plan the current phase planner agent breaks it into wave-grouped tasks, plan-checker validates (max 2 cycles). Supports `--gaps` for verification-failure closure. Triggers: 'plan this phase', 'break this into tasks', 'plan phase 2'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-polish
3
- description: "Scope-adaptive visual quality pass. Works on a single component, a route, the whole app, a ground-up redesign, an aesthetic token pivot, or an autonomous visual loop, but does not repair business logic or broken data flow. Trigger on 'polish', 'design pass', 'fix the design', 'redesign', 'critique', 'audit design', 'looks ugly', 'make it look better', 'different vibe', 'polish loop', 'visual loop', 'fix what I see', 'iterate on the design until it's correct'. Route functional bugs to /qualia-fix."
3
+ description: "Scope-adaptive visual quality pass component, route, whole app, redesign, vibe pivot, or autonomous loop. Triggers: 'polish', 'design pass', 'redesign', 'critique', 'looks ugly', 'different vibe', 'visual loop'. Route functional bugs to /qualia-fix."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-postmortem
3
- description: "Self-healing AI layer when /qualia-verify returns FAIL, identify which agent/rule/skill should have caught the failure and propose a delta to that file so the same class of bug never recurs. Trigger on 'postmortem', 'why did the framework miss this', 'self-heal', 'qualia-postmortem', or auto-invoked by /qualia-verify on FAIL with --auto."
3
+ description: "Self-healing passon /qualia-verify FAIL, identify which rule/agent/skill should have caught it and propose a delta. Triggers: 'postmortem', 'why did the framework miss this', 'self-heal'. Auto-invoked by /qualia-verify on FAIL with `--auto`."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-report
3
- description: "Generate session report, commit to git, push, and upload to the Qualia ERP the mandatory clock-out flow. Use when the user says 'qualia-report', 'clock out', 'end of day', 'wrap up', 'session report', 'submit report', 'I'm done for today', or before stopping work. Handles empty days (no commits), missing API key, ERP outages, and dry-run preview gracefully."
3
+ description: "Mandatory clock-out flow — generate session report, commit, push, upload to ERP. Handles empty days, missing API key, ERP outages, dry-run. Triggers: 'qualia-report', 'clock out', 'end of day', 'session report', 'I'm done for today'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -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. 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)."
3
+ description: "Deep-research a domain or library BEFORE planning a phase. Spawns researcher with Context7/WebFetch. Writes .planning/phase-{N}-research.md. Triggers: 'research X library', 'study Stripe webhooks', 'best practices for X', 'compare libraries'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-review
3
- description: "Read-only production audit with scored diagnostics. Runs real commands, scores findings by severity, writes REVIEW.md, and routes repair work to /qualia-fix, /qualia-polish, or /qualia-optimize. Trigger on 'review', 'audit', 'code review', 'security check', 'production check'."
3
+ description: "Read-only production audit real commands, severity-scored REVIEW.md, routes repair to /qualia-fix, /qualia-polish, or /qualia-optimize. Triggers: 'review', 'audit', 'code review', 'security check', 'production check'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-road
3
- description: "TERMINAL workflow map — Project → Journey → Milestones → Phases → Tasks. Use this in headless/SSH/no-browser sessions or when the user asks for the road in chat. Triggers: 'how does Qualia work', 'what's the workflow', 'show me the road', 'what command does X', 'how do projects flow', 'in terminal please', SSH context."
3
+ description: "Terminal workflow map — Project → Journey → Milestones → Phases → Tasks. For headless/SSH/no-browser sessions. Triggers: 'show me the road', 'what's the workflow', 'how does Qualia work', SSH context."
4
4
  disable-model-invocation: true
5
5
  allowed-tools:
6
6
  - Read
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: qualia-secure
3
+ description: "Security scan of agent config — CLAUDE.md / settings.json / hooks / MCP — for prompt injection, leaked secrets, unscoped permissions, config drift. Static pass + optional Opus red/blue/auditor pipeline. Triggers: 'security scan', 'security audit', 'check my config', 'before going live'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Grep
8
+ - Agent
9
+ ---
10
+
11
+ # /qualia-secure — Security audit of the agent's own configuration
12
+
13
+ Not application code security. **Agent configuration security.** This skill audits the surfaces that Claude/Codex itself reads — CLAUDE.md, settings.json, hooks, MCP servers — for the class of risks that a normal linter cannot catch: prompt-injection vectors, secrets baked into instructions, unscoped tool permissions, drifted policy enforcement.
14
+
15
+ This is Qualia's vertical equivalent of ECC's AgentShield, kept local to your stack.
16
+
17
+ ## When to run
18
+
19
+ - **Before going live** with a new agent harness on a sensitive project.
20
+ - **After installing new MCP servers** — each MCP description consumes context AND can introduce permission scope risks.
21
+ - **As a release gate** — wire into CI via `qualia-framework secure --exit-code`.
22
+ - **After editing CLAUDE.md / settings.json by hand** to catch accidental secret leaks or permission widening.
23
+
24
+ ## Process
25
+
26
+ ### Step 0. Banner
27
+
28
+ ```bash
29
+ node ${QUALIA_BIN}/qualia-ui.js banner secure
30
+ ```
31
+
32
+ Say: **"Running security scan."**
33
+
34
+ ### Step 1. Fast static pass
35
+
36
+ ```bash
37
+ node ${QUALIA_BIN}/security-scan.js --write
38
+ ```
39
+
40
+ This writes `.planning/security-scan.md` with severity-ranked findings:
41
+
42
+ - **Secret patterns** — Anthropic / OpenAI / GitHub / AWS / Supabase JWT / Vercel keys baked into CLAUDE.md or settings.json (CRITICAL/HIGH).
43
+ - **Permission smells** — unscoped `Bash` tool, `service_role` imports leaking into client code (CRITICAL/HIGH).
44
+ - **Hook hygiene** — `child_process.exec` with `shell: true` from user input, hooks missing timeouts (MEDIUM/LOW).
45
+
46
+ Read the report. If CRITICAL findings exist, **stop here** and rotate / fix before continuing — the deep pass is moot until the obvious holes are closed.
47
+
48
+ ### Step 2. Opus 4.7 adversarial deep-analysis (optional, longer)
49
+
50
+ If the static pass is clean (or you want adversarial reasoning over the rules + instructions text regardless), run:
51
+
52
+ ```bash
53
+ node ${QUALIA_BIN}/security-scan.js --deep
54
+ ```
55
+
56
+ This writes:
57
+ - `.planning/security-scan.md` (the static findings, same as Step 1)
58
+ - `.planning/security-deep-prompt.md` (a prompt pack with the static findings as seeds, plus the three agent prompts ready to dispatch)
59
+
60
+ Read `.planning/security-deep-prompt.md`. It contains three sections — RED TEAM, BLUE TEAM, AUDITOR — each is a self-contained prompt for one `Agent()` spawn. Dispatch the first two in parallel, then the auditor after they return:
61
+
62
+ ```
63
+ Agent(prompt=<contents of "## Agent A — RED TEAM" section>, subagent_type="general-purpose", description="Red-team attacks")
64
+ Agent(prompt=<contents of "## Agent B — BLUE TEAM" section>, subagent_type="general-purpose", description="Blue-team guardrail audit")
65
+ ```
66
+
67
+ Wait for both. Pass their reports into the auditor:
68
+
69
+ ```
70
+ Agent(prompt=<"## Agent C — AUDITOR" section> + "\n\n## Red-team output\n\n" + <A's report> + "\n\n## Blue-team output\n\n" + <B's report>, subagent_type="general-purpose", description="Auditor synthesis")
71
+ ```
72
+
73
+ The auditor writes `.planning/security-audit.md` — that's the deliverable.
74
+
75
+ ### Step 3. Synthesize + route
76
+
77
+ Combine `.planning/security-scan.md` (static) + `.planning/security-audit.md` (Opus) into a single executive summary. Surface the top 3 actions ranked by severity:
78
+
79
+ - **CRITICAL** → fix immediately, before any further work.
80
+ - **HIGH** → ticket for this sprint; route to `/qualia-hook-gen` if the fix is "make this instructional rule deterministic via a hook."
81
+ - **MEDIUM/LOW** → backlog.
82
+
83
+ ### Step 4. Close
84
+
85
+ ```bash
86
+ node ${QUALIA_BIN}/qualia-ui.js end "SECURED" "/qualia-hook-gen"
87
+ ```
88
+
89
+ (Or omit the next-command if all findings are LOW.)
90
+
91
+ ## Rules
92
+
93
+ 1. **Static pass is non-negotiable.** It's fast and deterministic — always runs.
94
+ 2. **Opus pass is opt-in.** It costs tokens and time. Default to skipping unless the user explicitly asks for "deep audit" or the static pass triggers HIGH+ findings.
95
+ 3. **No fake severity.** Per `rules/grounding.md`, every finding cites `file:line` and matches a category in the Severity Rubric. No hedging.
96
+ 4. **Recommend deterministic fixes when possible.** A rule in CLAUDE.md is suggestive; a hook is enforced. The skill's bias is toward `/qualia-hook-gen` over "tell the agent to do X."
97
+ 5. **Never auto-rotate secrets.** Flag and instruct. The user rotates manually with confirmation — secrets in CI variables are the user's domain.
98
+
99
+ ## When NOT to use
100
+
101
+ - Application-level security review (use `/security-review` for OWASP-style code audit).
102
+ - Production deployment health (use `/qualia-doctor` / `/qualia-status`).
103
+ - Specific bug investigation (use `/qualia-debug` → `/qualia-fix`).
104
+
105
+ `/qualia-secure` is specifically for **the agent's configuration**. The hooks, the rules, the tool scopes, the MCP servers — the surfaces Claude reads to decide what to do.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-test
3
- description: "Generate tests for existing code, run tests, OR drive a feature test-first via --tdd vertical-slice loop (red→green→refactor, one test→one impl→repeat). Trigger on 'write tests', 'add tests', 'test this', 'run tests', 'test coverage', 'need tests for', 'tdd this', 'test-driven', 'red green refactor'."
3
+ description: "Generate tests, run tests, or drive a feature test-first via `--tdd` vertical-slice loop. Triggers: 'write tests', 'add tests', 'run tests', 'test coverage', 'tdd this', 'test-driven', 'red green refactor'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-verify
3
- description: "Goal-backward verification of a built phase. Spawns a fresh verifier agent that greps the actual codebase against acceptance criteria, scores the design rubric, and optionally runs an adversarial second pass. Use when the user says 'verify this phase', 'check if it works', 'run verification', 'did the build pass', 'qualia-verify', or after /qualia-build completes."
3
+ description: "Goal-backward verification of a built phase fresh verifier agent greps code against acceptance criteria, scores design rubric, optional adversarial second pass. Triggers: 'verify this phase', 'check if it works', 'run verification', 'did the build pass'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: zoho-workflow
3
- description: "Zoho Invoice and Mail operations via ERP-first routing. Creates invoices from templates, sends cover emails, manages contacts, reads inbox, and handles payment reminders. Use when the user says 'invoice this client', 'send an email', 'check inbox', 'create a Zoho contact', 'send payment reminder', or mentions invoicing, billing, or Zoho."
3
+ description: "Zoho Invoice + Mail ops via ERP-first routing. Invoices from templates, cover emails, contacts, inbox, payment reminders. Triggers: 'invoice this client', 'send an email', 'check inbox', 'create a Zoho contact', 'payment reminder'."
4
4
  tags: [zoho, invoice, email, billing, crm]
5
5
  ---
6
6
 
package/tests/bin.test.sh CHANGED
@@ -487,13 +487,14 @@ else
487
487
  fail_case "CLAUDE.md role substitution"
488
488
  fi
489
489
 
490
- # 31. All 12 hooks installed (block-env-edit removed in v3.2.0;
490
+ # 31. All 13 hooks installed (block-env-edit removed in v3.2.0;
491
491
  # git-guardrails + stop-session-log added in v4.2.0;
492
492
  # vercel-account-guard + env-empty-guard + supabase-destructive-guard added in v5.0.0;
493
- # pre-compact removed in v6.2.0; fawzi-approval-guard added in v6.2.11)
493
+ # fawzi-approval-guard added in v6.2.11; pre-compact removed in v6.2.0 and
494
+ # REINTRODUCED in v6.3.2 with sidecar-snapshot mechanism)
494
495
  HOOK_COUNT=$(ls "$TMP/.claude/hooks/"*.js 2>/dev/null | wc -l)
495
- if [ "$HOOK_COUNT" -eq 12 ]; then
496
- pass "12 hooks installed in hooks/"
496
+ if [ "$HOOK_COUNT" -eq 13 ]; then
497
+ pass "13 hooks installed in hooks/ (incl. pre-compact v6.3.2)"
497
498
  else
498
499
  fail_case "hook count" "got $HOOK_COUNT"
499
500
  fi
@@ -509,8 +510,7 @@ else
509
510
  fail_case "settings.json contents"
510
511
  fi
511
512
 
512
- # 33. settings.json contains all 12 hooks wired correctly
513
- # pre-compact.js was removed in v6.2.0 — verify it's NOT in settings.json.
513
+ # 33. settings.json contains all 13 hooks wired correctly (v6.3.2 reintroduces pre-compact).
514
514
  if grep -q 'branch-guard.js' "$TMP/.claude/settings.json" \
515
515
  && grep -q 'migration-guard.js' "$TMP/.claude/settings.json" \
516
516
  && grep -q 'pre-push.js' "$TMP/.claude/settings.json" \
@@ -523,10 +523,10 @@ if grep -q 'branch-guard.js' "$TMP/.claude/settings.json" \
523
523
  && grep -q 'fawzi-approval-guard.js' "$TMP/.claude/settings.json" \
524
524
  && grep -q 'env-empty-guard.js' "$TMP/.claude/settings.json" \
525
525
  && grep -q 'supabase-destructive-guard.js' "$TMP/.claude/settings.json" \
526
- && ! grep -q 'pre-compact.js' "$TMP/.claude/settings.json"; then
527
- pass "settings.json has all 12 hooks wired (no pre-compact)"
526
+ && grep -q 'pre-compact.js' "$TMP/.claude/settings.json"; then
527
+ pass "settings.json has all 13 hooks wired (incl. pre-compact)"
528
528
  else
529
- fail_case "settings.json hooks misconfigured (check for stale pre-compact entry)"
529
+ fail_case "settings.json hooks misconfigured"
530
530
  fi
531
531
 
532
532
  # 34. Lowercase code works (resolveTeamCode normalizes)
@@ -124,10 +124,10 @@ else
124
124
  fi
125
125
 
126
126
  if [ -d "$HOME_DIR/.claude/hooks" ] \
127
- && [ "$(find "$HOME_DIR/.claude/hooks" -maxdepth 1 -name '*.js' | wc -l | tr -d ' ')" = "12" ] \
127
+ && [ "$(find "$HOME_DIR/.claude/hooks" -maxdepth 1 -name '*.js' | wc -l | tr -d ' ')" = "13" ] \
128
128
  && [ -f "$HOME_DIR/.claude/hooks/fawzi-approval-guard.js" ] \
129
- && [ ! -f "$HOME_DIR/.claude/hooks/pre-compact.js" ]; then
130
- pass "packaged install has 12 hooks and no pre-compact"
129
+ && [ -f "$HOME_DIR/.claude/hooks/pre-compact.js" ]; then
130
+ pass "packaged install has 13 hooks including pre-compact (v6.3.2 sidecar snapshot)"
131
131
  else
132
132
  fail_case "packaged hook set mismatch"
133
133
  fi