qualia-framework 6.2.10 → 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 (78) hide show
  1. package/AGENTS.md +8 -7
  2. package/CLAUDE.md +5 -4
  3. package/README.md +27 -56
  4. package/bin/cli.js +113 -18
  5. package/bin/command-surface.js +75 -0
  6. package/bin/harness-eval.js +296 -0
  7. package/bin/install.js +43 -31
  8. package/bin/knowledge-flush.js +21 -10
  9. package/bin/knowledge.js +1 -1
  10. package/bin/learning-candidates.js +217 -0
  11. package/bin/project-snapshot.js +20 -0
  12. package/bin/prune-deprecated.js +64 -0
  13. package/bin/report-payload.js +18 -0
  14. package/bin/runtime-manifest.js +7 -0
  15. package/bin/security-scan.js +409 -0
  16. package/bin/state.js +31 -0
  17. package/bin/status-snapshot.js +363 -0
  18. package/bin/trust-score.js +3 -11
  19. package/bin/work-packet.js +228 -0
  20. package/docs/erp-contract.md +81 -1
  21. package/docs/onboarding.html +0 -11
  22. package/guide.md +15 -38
  23. package/hooks/fawzi-approval-guard.js +143 -0
  24. package/hooks/pre-compact.js +232 -0
  25. package/hooks/pre-deploy-gate.js +74 -1
  26. package/hooks/session-start.js +29 -1
  27. package/package.json +1 -1
  28. package/qualia-design/frontend.md +2 -2
  29. package/rules/codex-goal.md +1 -1
  30. package/rules/one-opinion.md +2 -2
  31. package/rules/speed.md +0 -1
  32. package/skills/qualia/SKILL.md +4 -4
  33. package/skills/qualia-build/SKILL.md +1 -1
  34. package/skills/qualia-discuss/SKILL.md +1 -1
  35. package/skills/qualia-doctor/SKILL.md +1 -1
  36. package/skills/qualia-feature/SKILL.md +2 -2
  37. package/skills/qualia-fix/SKILL.md +4 -4
  38. package/skills/qualia-idk/SKILL.md +133 -54
  39. package/skills/qualia-learn/SKILL.md +2 -2
  40. package/skills/qualia-map/SKILL.md +1 -1
  41. package/skills/qualia-milestone/SKILL.md +1 -1
  42. package/skills/qualia-new/SKILL.md +1 -1
  43. package/skills/qualia-optimize/SKILL.md +1 -1
  44. package/skills/qualia-plan/SKILL.md +1 -1
  45. package/skills/qualia-polish/REFERENCE.md +1 -1
  46. package/skills/qualia-polish/SKILL.md +19 -4
  47. package/skills/{qualia-vibe/scripts/extract.mjs → qualia-polish/scripts/vibe-extract.mjs} +4 -4
  48. package/skills/{qualia-vibe/scripts/tokens.mjs → qualia-polish/scripts/vibe-tokens.mjs} +6 -6
  49. package/skills/qualia-postmortem/SKILL.md +1 -1
  50. package/skills/qualia-report/SKILL.md +1 -1
  51. package/skills/qualia-research/SKILL.md +1 -1
  52. package/skills/qualia-review/SKILL.md +1 -1
  53. package/skills/qualia-road/SKILL.md +15 -20
  54. package/skills/qualia-secure/SKILL.md +105 -0
  55. package/skills/qualia-ship/SKILL.md +12 -5
  56. package/skills/qualia-test/SKILL.md +1 -1
  57. package/skills/qualia-verify/SKILL.md +10 -2
  58. package/skills/zoho-workflow/SKILL.md +1 -1
  59. package/templates/help.html +1 -12
  60. package/tests/bin.test.sh +147 -75
  61. package/tests/hooks.test.sh +81 -1
  62. package/tests/install-smoke.test.sh +14 -4
  63. package/tests/lib.test.sh +145 -3
  64. package/tests/published-install-smoke.test.sh +5 -4
  65. package/tests/refs.test.sh +32 -20
  66. package/tests/runner.js +30 -29
  67. package/tests/state.test.sh +106 -7
  68. package/skills/qualia-debug/SKILL.md +0 -193
  69. package/skills/qualia-flush/SKILL.md +0 -198
  70. package/skills/qualia-help/SKILL.md +0 -74
  71. package/skills/qualia-hook-gen/SKILL.md +0 -206
  72. package/skills/qualia-issues/SKILL.md +0 -151
  73. package/skills/qualia-pause/SKILL.md +0 -68
  74. package/skills/qualia-resume/SKILL.md +0 -52
  75. package/skills/qualia-skill-new/SKILL.md +0 -173
  76. package/skills/qualia-triage/SKILL.md +0 -152
  77. package/skills/qualia-vibe/SKILL.md +0 -229
  78. package/skills/qualia-zoom/SKILL.md +0 -51
@@ -1,206 +0,0 @@
1
- ---
2
- name: qualia-hook-gen
3
- description: "Take a project's CLAUDE.md or rules/*.md instruction and convert it deterministically into a Claude Code pre-tool-use hook. Generates block-{cmd}.sh + the settings.json patch + activation steps. Lets users actually shrink their CLAUDE.md instead of just hearing the instruction-budget advice. Trigger on 'qualia-hook-gen', 'turn this rule into a hook', 'enforce this deterministically', 'block npm', 'force pnpm', 'convert claude.md to hooks', 'shrink my instruction budget'."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- - Write
8
- - Edit
9
- - Grep
10
- - Glob
11
- argument-hint: "[--rule \"text\"] [--from CLAUDE.md] [--name HOOK_NAME] [--scope global|project] [--dry-run]"
12
- ---
13
-
14
- # /qualia-hook-gen — Convert instructions → deterministic hooks
15
-
16
- LLMs have a realistic instruction budget of ~300-500 instructions before quality degrades (Matt Pocock). A line in CLAUDE.md like "use pnpm not npm" burns budget on EVERY request — even when the task has nothing to do with package management. Worse, it's non-deterministic: the model can still run `npm install` if it forgets.
17
-
18
- The fix: convert that instruction into a deterministic `pre-tool-use` hook. The hook blocks the wrong command (or rewrites it to the right one) at execution time, frees the instruction budget, and works regardless of context window state.
19
-
20
- ## When to use
21
-
22
- - Your CLAUDE.md has 50+ lines and you want to slim it
23
- - A specific instruction is enforceable as a CLI rule (use X not Y, never run Z, redirect A to B)
24
- - You want a hook for a specific failure mode (e.g., "always use --force-with-lease, never --force")
25
-
26
- ## What it does NOT do
27
-
28
- - Hooks for stylistic guidance (e.g., "prefer composition over inheritance") — that's not enforceable by command match. Stays in skills.
29
- - Hooks for non-deterministic checks (e.g., "validate the design feel"). Use `/qualia-polish` instead.
30
- - Hooks that need state across multiple commands. Use Qualia's existing state.js machinery.
31
-
32
- ## Process
33
-
34
- ### 1. Identify the rule
35
-
36
- Three input modes:
37
-
38
- | Mode | Source |
39
- |---|---|
40
- | `--rule "..."` | Direct argument (e.g. `--rule "use pnpm not npm"`) |
41
- | `--from CLAUDE.md` | Pull instructions from the file, list them, let user pick |
42
- | (no arg) | Read CLAUDE.md, scan for enforceable rules, propose top 3 candidates |
43
-
44
- ### 2. Classify enforceability
45
-
46
- For the chosen rule, classify into one of three patterns:
47
-
48
- | Pattern | Example | Hook shape |
49
- |---|---|---|
50
- | **Block** | "never use `git push --force` to main" | exit 2 with message if pattern matches |
51
- | **Rewrite** | "use pnpm not npm" | exit 2 with message guiding to alternative |
52
- | **Warn** | "prefer next/image over <img>" | exit 0 but print warning to stderr |
53
-
54
- If the rule isn't classifiable as any of these — i.e. it's stylistic or judgment-based — HALT with: "This rule isn't deterministically enforceable. Keep it in CLAUDE.md or move to a skill. Examples of enforceable rules: package-manager redirects, destructive-command blocks, file-path enforcement."
55
-
56
- ### 3. Generate the hook script
57
-
58
- Write to `hooks/block-{name}.js` (Node, cross-platform — same shape as existing hooks):
59
-
60
- ```javascript
61
- #!/usr/bin/env node
62
- // hooks/block-{name}.js — auto-generated by /qualia-hook-gen
63
- // Original instruction: "{rule text}"
64
- // Pattern: {block | rewrite | warn}
65
- // Generated: {ISO date}
66
-
67
- const { readFileSync } = require("fs");
68
- let payload;
69
- try { payload = JSON.parse(readFileSync(0, "utf8")); } catch { process.exit(0); }
70
- const cmd = (payload.tool_input && payload.tool_input.command) || "";
71
-
72
- // Match condition (regex from rule classification)
73
- if (!/{matcher}/i.test(cmd)) process.exit(0); // not our concern
74
-
75
- // Action
76
- console.error("⚠ Qualia hook ({name}): {message}");
77
- console.error(" Suggested: {suggested_alt}");
78
- process.exit(2); // 2 = BLOCK in Claude Code hook protocol
79
- ```
80
-
81
- The exact matcher + message + suggestion are filled by the synthesizer based on the rule classification.
82
-
83
- ### 4. Generate the settings.json patch
84
-
85
- ```json
86
- {
87
- "hooks": {
88
- "PreToolUse": [
89
- {
90
- "matcher": "Bash",
91
- "hooks": [
92
- {
93
- "type": "command",
94
- "if": "Bash({if-condition})",
95
- "command": "node \"${HOME}/.claude/hooks/block-{name}.js\"",
96
- "timeout": 5,
97
- "statusMessage": "⬢ Checking {what}..."
98
- }
99
- ]
100
- }
101
- ]
102
- }
103
- }
104
- ```
105
-
106
- The `if` condition narrows when the hook fires (e.g., `Bash(npm*)` to fire only on npm). Saves cycles by skipping the hook entirely on irrelevant commands.
107
-
108
- ### 5. Test the hook
109
-
110
- ```bash
111
- # Simulate a triggering command
112
- echo '{"tool_input":{"command":"{triggering_example}"}}' | \
113
- node hooks/block-{name}.js
114
- echo "Exit: $?" # should be 2
115
-
116
- # Simulate a non-triggering command
117
- echo '{"tool_input":{"command":"{safe_example}"}}' | \
118
- node hooks/block-{name}.js
119
- echo "Exit: $?" # should be 0
120
- ```
121
-
122
- If the test passes, proceed. If not, debug the matcher regex.
123
-
124
- ### 6. Activate
125
-
126
- Two scopes:
127
-
128
- | Scope | Action |
129
- |---|---|
130
- | `--scope project` (default for project rules) | Add the patch to `.claude/settings.json` in the project root |
131
- | `--scope global` | Add to `${QUALIA_HOME}/settings.json`. Use only if rule applies to ALL projects |
132
-
133
- Use the existing settings-merge logic from `bin/install.js:756-778` (preserves user fields, atomic write, backup-before-overwrite).
134
-
135
- ### 7. Suggest CLAUDE.md slim
136
-
137
- After activating, scan CLAUDE.md / `rules/*.md` for the original instruction. If found, suggest the user remove it (don't auto-remove — let the user verify the hook works first):
138
-
139
- ```
140
- ✓ Hook installed: hooks/block-{name}.js
141
- ✓ Settings patched: .claude/settings.json
142
- ℹ You can now remove this line from CLAUDE.md (the hook enforces it deterministically):
143
- > "{original instruction}"
144
- ℹ Test with: echo '{"tool_input":{"command":"{triggering_example}"}}' | node hooks/block-{name}.js
145
- ```
146
-
147
- ### 8. Commit
148
-
149
- ```bash
150
- git add hooks/block-{name}.js .claude/settings.json
151
- git -c user.name="Qualia Solutions" -c user.email="info@qualiasolutions.net" \
152
- commit -m "feat(hook): block-{name} — enforces \"{rule}\" deterministically"
153
- ```
154
-
155
- ## Examples
156
-
157
- **Block npm in favor of pnpm:**
158
- ```
159
- /qualia-hook-gen --rule "use pnpm not npm"
160
- → hooks/block-npm.js (matches /^\s*npm\s+(install|i|run|exec)/, exit 2)
161
- → .claude/settings.json (PreToolUse > Bash > if: Bash(npm*))
162
- → "npm install" now blocks with: "Use pnpm not npm. Run: pnpm install"
163
- ```
164
-
165
- **Block destructive git on main:**
166
- ```
167
- /qualia-hook-gen --rule "never push --force to main"
168
- → hooks/block-force-push-main.js (matches /git push.*--force.*main/)
169
- → Already covered by hooks/git-guardrails.js — surface this overlap and skip
170
- ```
171
-
172
- **Force /server/ for service_role usage:**
173
- ```
174
- /qualia-hook-gen --rule "service_role only in lib/server/*"
175
- → Not enforceable as a CLI hook (it's a code-level rule).
176
- → HALT with recommendation: ESLint rule or pre-deploy-gate.js entry instead.
177
- ```
178
-
179
- ## Token discipline
180
-
181
- This skill itself is short by design (~150 lines SKILL.md). REFERENCE.md (if added later) only carries verbatim hook templates. The whole point of `/qualia-hook-gen` is to REDUCE token cost across a project, not add to it.
182
-
183
- Per-invocation: ~3K tokens for the rule-classification + hook-template synthesis. Net savings: every subsequent request saves the ~50-200 tokens that the moved CLAUDE.md instruction was costing.
184
-
185
- ## Failure modes
186
-
187
- | Symptom | Cause | Action |
188
- |---|---|---|
189
- | Rule isn't a CLI command | Stylistic / judgment-based | HALT with recommendation: skill or ESLint rule |
190
- | Matcher would catch too much | Regex too greedy | Tighten with `--name` and explicit pattern; user-confirm before write |
191
- | Hook conflicts with existing | Same command already hooked | Surface the conflict; refuse to overwrite without `--force` |
192
- | Settings.json malformed | Pre-existing bad JSON | Refuse to patch; ask user to fix settings.json first |
193
- | `node` not on hook PATH | Cross-platform issue | Use `process.execPath` resolution; framework's existing hooks handle this |
194
-
195
- ## Rules
196
-
197
- 1. **Hook is determinism, skill is guidance.** Hooks can only block/rewrite/warn on CLI patterns. Stylistic rules stay in skills.
198
- 2. **Never overwrite an existing hook silently.** If `hooks/block-{name}.js` exists, surface and ask.
199
- 3. **Test before committing.** The hook must pass the trigger + non-trigger smoke tests before commit.
200
- 4. **Suggest CLAUDE.md cleanup.** After install, surface the now-redundant CLAUDE.md line. Don't auto-delete — user verifies the hook works first.
201
- 5. **Match Qualia's hook shape.** All hooks are pure Node, cross-platform, exit 0/2. No `.sh` scripts (Windows compat).
202
-
203
- ## Pairs with
204
-
205
- - `/qualia-optimize --deepen` — runs sometimes after a hook-gen pass when CLAUDE.md gets short enough that the codebase architecture becomes the next bottleneck
206
- - Existing hooks: `git-guardrails.js`, `pre-deploy-gate.js`, `vercel-account-guard.js`, `env-empty-guard.js`, `supabase-destructive-guard.js`. New hooks generated by this skill follow the same conventions.
@@ -1,151 +0,0 @@
1
- ---
2
- name: qualia-issues
3
- description: "Break a phase plan into independent vertical-slice GitHub issues with needs-triage label. Each issue is demoable end-to-end (schema → API → UI → tests). Dependency-ordered. Externalizes Qualia work to the open queue so other agents, sessions, or human contributors can pull from it. Use when user says 'create issues from this plan', 'externalize the phase', 'turn this into GitHub issues', 'qualia-issues', 'split into tickets', or after /qualia-plan when the work should be parallelizable. Hard dependency: requires tracker config — run /qualia-map first if .planning/agents/tracker.md is missing."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- - Write
8
- - Edit
9
- - Grep
10
- - Glob
11
- - AskUserQuestion
12
- ---
13
-
14
- # /qualia-issues — Phase Plan → Independent Vertical-Slice GH Issues
15
-
16
- Externalizes a phase plan to the GitHub issue queue. Each issue is a thin slice that delivers a complete demoable behavior end-to-end. Other Qualia sessions, autonomous agents, or human contributors can then pull from the queue.
17
-
18
- ## Why vertical slices
19
-
20
- ANTI-PATTERN: chop the plan horizontally (issue 1 = "all schema work", issue 2 = "all API work", issue 3 = "all UI"). This creates dependencies that block parallelism, and no single issue is demoable on its own.
21
-
22
- CORRECT: each issue traverses every layer (schema → API → UI → tests) for one narrow user-facing behavior. Many thin slices > few thick ones.
23
-
24
- ## Hard dependencies (per Matt Pocock's ADR-0001)
25
-
26
- This skill cannot work meaningfully without:
27
- - `.planning/agents/tracker.md` — tells it where to file issues (GH, GL, local)
28
- - `.planning/agents/labels.md` — tells it the canonical-role-to-existing-label mapping
29
- - `gh` CLI authenticated (if tracker is GitHub)
30
-
31
- **If any are missing, halt and tell the user:** "Run `/qualia-map` first — it scans your repo and writes the adapter config so Qualia honors your existing tracker conventions."
32
-
33
- ## Process
34
-
35
- ### 1. Determine phase
36
-
37
- Phase number from `$ARGUMENTS` if provided, else current from `node ${QUALIA_BIN}/state.js check`.
38
-
39
- ### 2. Load substrate
40
-
41
- ```bash
42
- cat .planning/agents/tracker.md
43
- cat .planning/agents/labels.md
44
- cat .planning/phase-{N}-plan.md
45
- cat .planning/CONTEXT.md 2>/dev/null
46
- cat .planning/PROJECT.md
47
- ```
48
-
49
- If `phase-{N}-plan.md` is missing, halt: "No plan exists for phase {N}. Run `/qualia-plan {N}` first."
50
-
51
- ### 3. Decompose into vertical slices
52
-
53
- Read the phase plan tasks. Group/split into slices where each slice:
54
- - Delivers ONE user-facing behavior end-to-end
55
- - Touches every relevant layer (schema, server, client, tests) needed for that behavior
56
- - Is independently demoable or verifiable
57
- - Has explicit blocking-dependencies on other slices (kept minimal)
58
-
59
- Use **CONTEXT.md domain language** in titles and descriptions. Don't say "user table" if the glossary says "AuthUser" or "Customer."
60
-
61
- ### 4. Show proposed slices to user
62
-
63
- ```
64
- Proposed slices for phase {N}:
65
-
66
- Slice 1: {title in domain language}
67
- Behavior: {one sentence}
68
- Touches: schema, server-action, page route, test
69
- Blocks: none
70
-
71
- Slice 2: ...
72
- Blocks: Slice 1 (needs the schema migration)
73
- ```
74
-
75
- Use `AskUserQuestion`:
76
- - header: "Approve slices?"
77
- - question: "File these {N} issues?"
78
- - options: "File them" / "Re-decompose" / "Cancel"
79
-
80
- ### 5. File issues in dependency order
81
-
82
- For each approved slice (in dependency order so blocking slices exist when blockees are filed):
83
-
84
- ```bash
85
- # Write the body to a temp file FIRST — never heredoc-interpolate user content into shell.
86
- # Plan content (titles, behaviors, criteria) is user-controlled; shell metacharacters or a
87
- # rogue 'EOF' line in the plan would break out of the heredoc. --body-file eliminates the risk.
88
- BODY_FILE=$(mktemp -t qualia-issue.XXXXXX.md)
89
- cat > "$BODY_FILE" <<EOF_TEMPLATE
90
- ## End-to-end behavior
91
- {one paragraph}
92
-
93
- ## Acceptance criteria
94
- - [ ] {criterion 1 — observable behavior, not implementation detail}
95
- - [ ] {criterion 2}
96
- - [ ] tests pass for the slice
97
-
98
- ## Blocks
99
- - {issue # of any blocking slice, or "none"}
100
-
101
- ## Domain terms touched
102
- {terms from CONTEXT.md this slice involves}
103
-
104
- ## Phase context
105
- Part of phase {N} ({phase name}). Plan: .planning/phase-{N}-plan.md.
106
- EOF_TEMPLATE
107
-
108
- gh issue create \
109
- --title "{title in domain language}" \
110
- --body-file "$BODY_FILE" \
111
- --label "needs-triage,enhancement"
112
-
113
- rm -f "$BODY_FILE"
114
- ```
115
-
116
- Capture the returned issue number for use in subsequent slices' "Blocks" fields.
117
-
118
- **Why temp file, not heredoc:** plan files (`.planning/phase-{N}-plan.md`) and CONTEXT.md are project repo content — anyone with commit access can write them. A crafted plan with shell metacharacters or a literal `EOF` line in the content could break out of an inline heredoc and execute arbitrary shell. `--body-file` reads the body as raw bytes, no shell expansion. The `EOF_TEMPLATE` token (vs the standard `EOF`) is also more resistant to accidental collisions.
119
-
120
- ### 6. Write summary
121
-
122
- `.planning/phase-{N}-issues.md`:
123
-
124
- ```markdown
125
- # Phase {N} — Issue Queue
126
-
127
- Filed {date}. Status: open queue.
128
-
129
- | # | Slice | Issue | Blocks |
130
- |---|---|---|---|
131
- | 1 | {title} | #123 | none |
132
- | 2 | {title} | #124 | #123 |
133
- ```
134
-
135
- ### 7. Commit and route
136
-
137
- ```bash
138
- git add .planning/phase-{N}-issues.md
139
- git commit -m "docs(phase-{N}): externalize {N_slices} slices to GH issue queue"
140
-
141
- node ${QUALIA_BIN}/qualia-ui.js end "QUEUE FILED" "/qualia-triage"
142
- ```
143
-
144
- ## Rules
145
-
146
- 1. **Each issue is demoable on its own.** If a "completed" issue can't be shown as working behavior, the slicing was wrong.
147
- 2. **CONTEXT.md language is mandatory.** Issue titles use domain terms, not implementation jargon.
148
- 3. **No file paths or line numbers in issue bodies.** Issues describe behavior. Implementation details live in the phase plan.
149
- 4. **Acceptance criteria are observable behaviors.** "Form validates email format" not "regex.test() returns true".
150
- 5. **Dependencies kept minimal.** If slice A blocks slice B blocks slice C blocks slice D, the slicing collapsed to horizontal — re-decompose.
151
- 6. **`needs-triage` is the default label.** `/qualia-triage` will route from there.
@@ -1,68 +0,0 @@
1
- ---
2
- name: qualia-pause
3
- description: "Save session context for seamless handoff. Creates .continue-here.md so the next session picks up exactly where you left off. Trigger on 'pause', 'stop for now', 'save progress', 'continue later', 'pick up tomorrow'."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- - Write
8
- - Edit
9
- ---
10
-
11
- # /qualia-pause — Session Handoff
12
-
13
- Save context so the next session picks up where you left off.
14
-
15
- ## Process
16
-
17
- ```bash
18
- node ${QUALIA_BIN}/qualia-ui.js banner pause
19
- ```
20
-
21
- ### 1. Read State
22
-
23
- ```bash
24
- cat .planning/STATE.md 2>/dev/null
25
- git status --short 2>/dev/null
26
- git log --oneline -5 2>/dev/null
27
- ```
28
-
29
- ### 2. Create `.continue-here.md`
30
-
31
- ```markdown
32
- # Continue Here
33
-
34
- ## Session Summary
35
- {What was accomplished — from conversation context + git log}
36
-
37
- ## Current Phase
38
- Phase {N}: {name} — {status}
39
-
40
- ## In Progress
41
- - {What's partially done}
42
- - {Where exactly work stopped}
43
-
44
- ## Next Steps
45
- 1. {Immediate next action}
46
- 2. {Following action}
47
-
48
- ## Decisions Made
49
- - {Decision and rationale}
50
-
51
- ## Blockers
52
- - {Any unresolved issues}
53
-
54
- ## Files Modified
55
- - {List from git status/diff}
56
- ```
57
-
58
- ### 3. Commit
59
-
60
- ```bash
61
- git add .continue-here.md {any uncommitted work files}
62
- git commit -m "WIP: {phase name} — session handoff"
63
- ```
64
-
65
- ```bash
66
- node ${QUALIA_BIN}/state.js transition --to note --notes "Session paused — see .continue-here.md"
67
- ```
68
- Do NOT manually edit STATE.md or tracking.json — state.js handles both.
@@ -1,52 +0,0 @@
1
- ---
2
- name: qualia-resume
3
- description: "Restore context from a previous session. Reads .continue-here.md or STATE.md, summarizes where you left off, routes to next action. Trigger on 'resume', 'continue', 'pick up where I left off', 'what was I doing'."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- ---
8
-
9
- # /qualia-resume — Resume Work
10
-
11
- Restore context and route to the right next action.
12
-
13
- ## Process
14
-
15
- ### 1. Find Context (priority order)
16
-
17
- 1. `.continue-here.md` — richest source, from `/qualia-pause`
18
- 2. `.planning/STATE.md` — project state
19
- 3. Git history — `git log --oneline -10` + `git diff --stat`
20
-
21
- ### 2. Restore
22
-
23
- **If `.continue-here.md` exists:** Read fully. Summarize: what was done, what's in progress, next steps, blockers.
24
-
25
- **If only STATE.md:** Read STATE.md + tracking.json. Show current phase and status.
26
-
27
- **If neither:** Reconstruct from git. Present findings, ask user to confirm.
28
-
29
- ### 3. Detect Incomplete Work
30
-
31
- - Phase has plan but no verification → execution may be incomplete
32
- - Uncommitted changes → `git status --short`
33
- - Phase marked in-progress in STATE.md
34
-
35
- ### 4. Present and Route
36
-
37
- ```bash
38
- node ${QUALIA_BIN}/qualia-ui.js banner resume
39
- node ${QUALIA_BIN}/qualia-ui.js info "Last session: {summary}"
40
- ```
41
-
42
- If uncommitted changes:
43
- ```bash
44
- node ${QUALIA_BIN}/qualia-ui.js warn "{N} uncommitted files"
45
- ```
46
-
47
- End with the next command:
48
- ```bash
49
- node ${QUALIA_BIN}/qualia-ui.js next "{next command}"
50
- ```
51
-
52
- Clean up `.continue-here.md` after restoration (or offer to keep it).
@@ -1,173 +0,0 @@
1
- ---
2
- name: qualia-skill-new
3
- description: "Author a new Qualia skill or agent. Use when the user says 'create a new skill', 'add a skill', 'I want to build a skill', 'make this a reusable command', 'turn this into a skill'. Generates the SKILL.md, registers it in the right location, and optionally ships to the framework repo."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- - Write
8
- - Edit
9
- - AskUserQuestion
10
- ---
11
-
12
- # /qualia-skill-new — Author a New Skill
13
-
14
- You are about to create a reusable slash command. Skills are the leverage of the Qualia framework — if the team does something twice, it probably belongs here.
15
-
16
- ## Process
17
-
18
- ```bash
19
- node ${QUALIA_BIN}/qualia-ui.js banner skill-new
20
- ```
21
-
22
- ### 1. Scope Decision
23
-
24
- Ask the user with AskUserQuestion:
25
-
26
- ```
27
- question: "Where should this skill live?"
28
- header: "Scope"
29
- options:
30
- - label: "Framework skill (ships to the team)"
31
- description: "Edit qualia-framework repo. Everyone gets it on next update."
32
- - label: "Local skill (just me)"
33
- description: "Lives only in ${QUALIA_SKILLS}/. Not shared."
34
- - label: "Agent instead of a skill"
35
- description: "This is a subagent role, not a slash command. Creates agents/{name}.md."
36
- ```
37
-
38
- ### 1a. Resolve framework directory
39
-
40
- If the user chose **Framework skill** or a framework-scoped **Agent**, resolve `${FRAMEWORK_DIR}` — the checkout path of this user's qualia-framework repo — BEFORE computing any target paths. Never hardcode `/home/<user>/...`; different teammates and operating systems have different paths.
41
-
42
- ```bash
43
- # Priority order: env var → git detection → ask user
44
- FRAMEWORK_DIR="${QUALIA_FRAMEWORK_DIR:-}"
45
- if [ -z "$FRAMEWORK_DIR" ] && git -C . rev-parse --show-toplevel >/dev/null 2>&1; then
46
- ORIGIN=$(git -C . config --get remote.origin.url 2>/dev/null)
47
- case "$ORIGIN" in
48
- *qualia-framework*) FRAMEWORK_DIR=$(git -C . rev-parse --show-toplevel) ;;
49
- esac
50
- fi
51
- echo "${FRAMEWORK_DIR:-UNRESOLVED}"
52
- ```
53
-
54
- If the command prints `UNRESOLVED`, ask the user: *"Where is your qualia-framework checkout? (absolute path, or type 'local' to save only to ${QUALIA_HOME}/)"*. If they type `local`, downgrade the scope to Local. Otherwise store the answer as `${FRAMEWORK_DIR}` for the rest of the session.
55
-
56
- **Framework** → target: `${FRAMEWORK_DIR}/skills/{name}/SKILL.md`
57
- **Local** → target: `${QUALIA_SKILLS}/{name}/SKILL.md`
58
- **Agent** → target: `${FRAMEWORK_DIR}/agents/{name}.md` (framework) or `${QUALIA_AGENTS}/{name}.md` (local)
59
-
60
- ### 2. Gather Requirements
61
-
62
- Ask the user — one question at a time, natural conversation:
63
-
64
- 1. **"What's the name?"** — kebab-case, prefix with `qualia-` for framework skills. E.g., `qualia-seed-db`.
65
- 2. **"What does it do?"** — one sentence, used as the description.
66
- 3. **"How does the user invoke it?"** — trigger phrases they'd naturally say. E.g., "seed the database", "load test data", "populate dev db".
67
- 4. **"Does it need planning / building / verification?"** — if yes, it probably should spawn an agent. If no, it's a direct-action skill.
68
- 5. **"What files does it read or write?"** — tells you what tools to restrict to.
69
-
70
- ### 3. Read Reference Skills
71
-
72
- Before writing, read two existing skills that are structurally similar:
73
-
74
- ```bash
75
- # Short direct-action skill reference:
76
- cat ${QUALIA_SKILLS}/qualia-learn/SKILL.md
77
-
78
- # Skill-that-spawns-an-agent reference:
79
- cat ${QUALIA_SKILLS}/qualia-plan/SKILL.md
80
-
81
- # Interactive wizard reference:
82
- cat ${QUALIA_SKILLS}/qualia-new/SKILL.md
83
- ```
84
-
85
- Pick the closest pattern and copy its structure.
86
-
87
- ### 4. Write the SKILL.md
88
-
89
- Every SKILL.md MUST have:
90
-
91
- ```markdown
92
- ---
93
- name: {kebab-case-name}
94
- description: "{one sentence}. {trigger phrases}"
95
- ---
96
-
97
- # /{name} — {Human Title}
98
-
99
- {one-paragraph explanation}
100
-
101
- ## Usage
102
-
103
- `/{name}` — {default behavior}
104
- `/{name} {arg}` — {with argument}
105
-
106
- ## Process
107
-
108
- ### 1. {First Step}
109
- {specifics}
110
-
111
- ### 2. {Second Step}
112
- {specifics}
113
-
114
- ### N. Update State (only if this skill changes project state)
115
-
116
- ```bash
117
- node ${QUALIA_BIN}/state.js transition --to {status} ...
118
- ```
119
- Do NOT manually edit STATE.md or tracking.json.
120
- ```
121
-
122
- **Description field rules:**
123
- - MUST include trigger phrases the user would naturally say
124
- - The Claude Code router matches user messages against descriptions — if you don't list triggers, the skill never fires
125
- - Bad: `"Manages database seeding."` (no triggers)
126
- - Good: `"Seed the database with test data. Trigger on 'seed db', 'load test data', 'populate dev'."`
127
-
128
- ### 5. Test the Skill
129
-
130
- Spawn a fresh subagent to simulate running the skill — does it make sense without the context you have right now?
131
-
132
- ```
133
- Agent(prompt="
134
- Read this skill: @${QUALIA_SKILLS}/{name}/SKILL.md
135
-
136
- Pretend the user just said '{one of the trigger phrases}'. Walk through what you would do, step by step. Flag anything ambiguous or missing.
137
- ", subagent_type="general-purpose", description="Test skill {name}")
138
- ```
139
-
140
- Fix any ambiguity the test agent found.
141
-
142
- ### 6. Install (if framework skill)
143
-
144
- ```bash
145
- # Framework skill — copy to local .claude for immediate testing
146
- mkdir -p ${QUALIA_SKILLS}/{name}
147
- cp "${FRAMEWORK_DIR}/skills/{name}/SKILL.md" ${QUALIA_SKILLS}/{name}/SKILL.md
148
-
149
- # Verify it parses
150
- node -e "const fs=require('fs');const os=require('os');const path=require('path');const c=fs.readFileSync(path.join(os.homedir(),'.claude/skills/{name}/SKILL.md'),'utf8');if(!c.includes('---'))throw new Error('missing frontmatter');if(!c.match(/^name:\s*\S/m))throw new Error('missing name');if(!c.match(/^description:\s*\S/m))throw new Error('missing description');console.log('OK')"
151
- ```
152
-
153
- ### 7. Commit (framework skills only)
154
-
155
- Do NOT commit unless the user explicitly says "commit" or "ship it".
156
-
157
- When they do:
158
- ```bash
159
- cd "${FRAMEWORK_DIR}"
160
- git add skills/{name}/
161
- git commit -m "feat: add /{name} skill"
162
- ```
163
-
164
- Remind the user to run `npx qualia-framework@latest update` on their other machines (always pin `@latest` — npx caches aggressively), or bump the version and `npm publish`.
165
-
166
- ## Anti-Patterns
167
-
168
- - ❌ **Description without triggers** — the skill won't fire
169
- - ❌ **Multiple commands in one skill** — split into two skills
170
- - ❌ **Direct file writes instead of state.js** — always use state.js for STATE.md/tracking.json
171
- - ❌ **Hardcoded project paths** — use `.planning/` relative or `${QUALIA_HOME}/` absolute, never `/home/specific-user/`
172
- - ❌ **Skills that spawn agents without passing PROJECT.md and STATE.md context** — agents are blind by default
173
- - ❌ **Skills longer than ~150 lines** — split or move logic to an agent