qualia-framework 6.2.9 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/AGENTS.md +1 -0
  2. package/CLAUDE.md +1 -0
  3. package/README.md +26 -30
  4. package/agents/builder.md +7 -7
  5. package/agents/planner.md +39 -3
  6. package/agents/research-synthesizer.md +1 -1
  7. package/agents/researcher.md +3 -3
  8. package/agents/roadmapper.md +7 -7
  9. package/agents/verifier.md +18 -6
  10. package/agents/visual-evaluator.md +8 -7
  11. package/bin/cli.js +160 -16
  12. package/bin/command-surface.js +71 -0
  13. package/bin/contract-runner.js +219 -0
  14. package/bin/harness-eval.js +296 -0
  15. package/bin/host-adapters.js +66 -0
  16. package/bin/install.js +116 -172
  17. package/bin/knowledge-flush.js +21 -10
  18. package/bin/knowledge.js +1 -1
  19. package/bin/plan-contract.js +99 -2
  20. package/bin/planning-hygiene.js +262 -0
  21. package/bin/project-snapshot.js +20 -0
  22. package/bin/report-payload.js +18 -0
  23. package/bin/runtime-manifest.js +35 -0
  24. package/bin/state-ledger.js +184 -0
  25. package/bin/state.js +330 -20
  26. package/bin/trust-score.js +268 -0
  27. package/bin/work-packet.js +228 -0
  28. package/docs/erp-contract.md +81 -1
  29. package/docs/onboarding.html +4 -14
  30. package/guide.md +16 -16
  31. package/hooks/fawzi-approval-guard.js +143 -0
  32. package/hooks/pre-deploy-gate.js +74 -1
  33. package/hooks/session-start.js +29 -1
  34. package/package.json +1 -1
  35. package/qualia-design/design-rubric.md +17 -5
  36. package/qualia-design/frontend.md +6 -2
  37. package/qualia-design/graphics.md +47 -0
  38. package/rules/codex-goal.md +1 -1
  39. package/rules/command-output.md +35 -0
  40. package/rules/one-opinion.md +2 -2
  41. package/rules/speed.md +0 -1
  42. package/skills/qualia/SKILL.md +12 -12
  43. package/skills/qualia-build/SKILL.md +20 -14
  44. package/skills/qualia-discuss/SKILL.md +10 -10
  45. package/skills/qualia-doctor/SKILL.md +140 -0
  46. package/skills/qualia-feature/SKILL.md +24 -22
  47. package/skills/qualia-fix/SKILL.md +216 -0
  48. package/skills/qualia-handoff/SKILL.md +9 -9
  49. package/skills/qualia-learn/SKILL.md +11 -11
  50. package/skills/qualia-map/SKILL.md +2 -2
  51. package/skills/qualia-milestone/SKILL.md +15 -15
  52. package/skills/qualia-new/REFERENCE.md +9 -9
  53. package/skills/qualia-new/SKILL.md +14 -14
  54. package/skills/qualia-optimize/REFERENCE.md +1 -1
  55. package/skills/qualia-optimize/SKILL.md +23 -16
  56. package/skills/qualia-plan/SKILL.md +23 -13
  57. package/skills/qualia-polish/REFERENCE.md +15 -15
  58. package/skills/qualia-polish/SKILL.md +81 -21
  59. package/skills/qualia-polish/scripts/loop.mjs +3 -3
  60. package/skills/qualia-polish/scripts/score.mjs +9 -3
  61. package/skills/{qualia-vibe/scripts/extract.mjs → qualia-polish/scripts/vibe-extract.mjs} +5 -5
  62. package/skills/{qualia-vibe/scripts/tokens.mjs → qualia-polish/scripts/vibe-tokens.mjs} +6 -6
  63. package/skills/qualia-postmortem/SKILL.md +9 -9
  64. package/skills/qualia-report/SKILL.md +23 -23
  65. package/skills/qualia-research/SKILL.md +5 -5
  66. package/skills/qualia-review/SKILL.md +28 -12
  67. package/skills/qualia-road/SKILL.md +30 -22
  68. package/skills/qualia-ship/SKILL.md +31 -24
  69. package/skills/qualia-test/SKILL.md +5 -5
  70. package/skills/qualia-verify/SKILL.md +45 -23
  71. package/skills/zoho-workflow/SKILL.md +1 -1
  72. package/templates/help.html +11 -20
  73. package/tests/bin.test.sh +178 -76
  74. package/tests/hooks.test.sh +81 -1
  75. package/tests/install-smoke.test.sh +35 -5
  76. package/tests/lib.test.sh +432 -0
  77. package/tests/published-install-smoke.test.sh +4 -3
  78. package/tests/refs.test.sh +9 -4
  79. package/tests/runner.js +32 -28
  80. package/tests/skills.test.sh +4 -4
  81. package/tests/state.test.sh +133 -3
  82. package/skills/qualia-debug/SKILL.md +0 -185
  83. package/skills/qualia-flush/SKILL.md +0 -198
  84. package/skills/qualia-help/SKILL.md +0 -74
  85. package/skills/qualia-hook-gen/SKILL.md +0 -206
  86. package/skills/qualia-idk/SKILL.md +0 -166
  87. package/skills/qualia-issues/SKILL.md +0 -151
  88. package/skills/qualia-pause/SKILL.md +0 -68
  89. package/skills/qualia-resume/SKILL.md +0 -52
  90. package/skills/qualia-skill-new/SKILL.md +0 -173
  91. package/skills/qualia-triage/SKILL.md +0 -152
  92. package/skills/qualia-vibe/SKILL.md +0 -226
  93. package/skills/qualia-zoom/SKILL.md +0 -51
@@ -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 ~/.claude/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 ~/.claude/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 ~/.claude/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 ~/.claude/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 ~/.claude/bin/qualia-ui.js banner resume
39
- node ~/.claude/bin/qualia-ui.js info "Last session: {summary}"
40
- ```
41
-
42
- If uncommitted changes:
43
- ```bash
44
- node ~/.claude/bin/qualia-ui.js warn "{N} uncommitted files"
45
- ```
46
-
47
- End with the next command:
48
- ```bash
49
- node ~/.claude/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 ~/.claude/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 ~/.claude/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 ~/.claude/)"*. 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: `~/.claude/skills/{name}/SKILL.md`
58
- **Agent** → target: `${FRAMEWORK_DIR}/agents/{name}.md` (framework) or `~/.claude/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 ~/.claude/skills/qualia-learn/SKILL.md
77
-
78
- # Skill-that-spawns-an-agent reference:
79
- cat ~/.claude/skills/qualia-plan/SKILL.md
80
-
81
- # Interactive wizard reference:
82
- cat ~/.claude/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 ~/.claude/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: @~/.claude/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 ~/.claude/skills/{name}
147
- cp "${FRAMEWORK_DIR}/skills/{name}/SKILL.md" ~/.claude/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 `~/.claude/` 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
@@ -1,152 +0,0 @@
1
- ---
2
- name: qualia-triage
3
- description: "State machine over open GH issues — labels each as needs-triage, needs-info, ready-for-agent, ready-for-human, or wontfix. Optionally routes ready-for-agent issues into an autonomous /qualia-build run. Pairs with /qualia-issues to enable the autonomous Ralph-Wiggum loop where agents pull work from the queue without human-in-loop. Use when user says 'triage', 'qualia-triage', 'route the queue', 'pull next from backlog', 'what's ready for the agent'. Hard dependency: requires .planning/agents/labels.md — run /qualia-map first if missing."
4
- allowed-tools:
5
- - Bash
6
- - Read
7
- - Write
8
- - Edit
9
- - Grep
10
- - Glob
11
- - AskUserQuestion
12
- ---
13
-
14
- # /qualia-triage — Issue Queue State Machine
15
-
16
- Walks the open issue queue, applies state labels, optionally routes `ready-for-agent` issues into autonomous build runs.
17
-
18
- ## The state machine
19
-
20
- Every issue carries exactly one **category** label and exactly one **state** label.
21
-
22
- **Category labels** (mutually exclusive):
23
- - `bug` — something is broken
24
- - `enhancement` — new feature or improvement
25
-
26
- **State labels** (exactly one per issue):
27
- - `needs-triage` — initial state, awaiting maintainer evaluation
28
- - `needs-info` — clarification needed from reporter
29
- - `ready-for-agent` — fully specified, autonomous build can pull this
30
- - `ready-for-human` — requires human implementation (judgment, sensitive area, scope unclear)
31
- - `wontfix` — rejected
32
-
33
- **Flow:**
34
-
35
- ```
36
- unlabeled → needs-triage → ┬→ needs-info → (response) → needs-triage
37
- ├→ ready-for-agent → (autonomous build) → closed
38
- ├→ ready-for-human → (human picks up) → closed
39
- └→ wontfix → closed
40
- ```
41
-
42
- ## Hard dependencies
43
-
44
- This skill cannot work meaningfully without:
45
- - `.planning/agents/labels.md` — canonical-role-to-existing-label mapping
46
- - `.planning/agents/tracker.md` — tells it where the queue lives
47
- - `gh` CLI authenticated (if tracker is GitHub)
48
-
49
- If missing, halt: "Run `/qualia-map` first to scan your repo and write the adapter config."
50
-
51
- ## Process
52
-
53
- ### 1. Load substrate
54
-
55
- ```bash
56
- cat .planning/agents/labels.md
57
- cat .planning/agents/tracker.md
58
- cat .planning/CONTEXT.md 2>/dev/null
59
- ```
60
-
61
- If labels are missing in the tracker, create them per the canonical mapping.
62
-
63
- ### 2. List the queue
64
-
65
- ```bash
66
- gh issue list --state open --limit 50 --json number,title,body,labels --jq '.'
67
- ```
68
-
69
- ### 3. Classify each unlabeled / needs-triage issue
70
-
71
- For each issue:
72
-
73
- **Read the body. Then assign one state per these criteria:**
74
-
75
- | State | Criteria |
76
- |---|---|
77
- | `ready-for-agent` | Acceptance criteria are explicit + observable. Touches files Qualia knows. No business-judgment calls. No security-sensitive areas without explicit ADR backing. |
78
- | `ready-for-human` | Requires judgment Qualia shouldn't make. Touches security/auth/payments without ADR. Scope is fuzzy. Risk is high. |
79
- | `needs-info` | Reporter left out reproduction steps, expected behavior, or scope is too vague to act on. |
80
- | `wontfix` | Out of project scope per PROJECT.md. Already implemented. Duplicate of #N. Conflicts with locked ADR. |
81
-
82
- For each issue, also assign category (`bug` if behavior is broken vs spec, `enhancement` otherwise).
83
-
84
- ### 4. Apply labels
85
-
86
- ```bash
87
- gh issue edit {N} --add-label "{state},{category}" --remove-label "needs-triage"
88
- ```
89
-
90
- For `needs-info`, also post a comment with the specific questions. Use `--body-file` (never heredoc-interpolate) — issue text is user-controlled and could contain shell metacharacters or a rogue `EOF`:
91
-
92
- ```bash
93
- COMMENT_FILE=$(mktemp -t qualia-triage.XXXXXX.md)
94
- cat > "$COMMENT_FILE" <<EOF_TEMPLATE
95
- Need a few more details to triage this:
96
-
97
- 1. {specific question 1}
98
- 2. {specific question 2}
99
-
100
- Once these are answered I'll re-triage.
101
- EOF_TEMPLATE
102
-
103
- gh issue comment {N} --body-file "$COMMENT_FILE"
104
- rm -f "$COMMENT_FILE"
105
- ```
106
-
107
- ### 5. Show the queue snapshot
108
-
109
- ```
110
- Triaged {N} issues:
111
-
112
- ready-for-agent: {count} ─ #123, #124, #126
113
- ready-for-human: {count} ─ #125, #127
114
- needs-info: {count} ─ #128
115
- wontfix: {count} ─ #129
116
- ```
117
-
118
- ### 6. Optional autonomous loop
119
-
120
- ```
121
- {N} issues ready-for-agent. Pull the next one into autonomous build?
122
- ```
123
-
124
- `AskUserQuestion`:
125
- - header: "Auto-pull?"
126
- - question: "Pull #{first ready-for-agent} into autonomous /qualia-build?"
127
- - options:
128
- - "Pull it" — feed the issue into a fresh /qualia-build run, then re-triage when done
129
- - "Pause" — stop here, user picks up manually
130
-
131
- If "Pull it":
132
- 1. Read the issue body fully
133
- 2. Spawn `/qualia-build` with the issue body as task input
134
- 3. After build completes and verifies green, comment the closing PR/commit on the issue and `gh issue close {N}`
135
- 4. Loop back to step 6 (next ready-for-agent issue)
136
-
137
- The loop continues until the queue empties or the user pauses.
138
-
139
- ### 7. Final report
140
-
141
- ```bash
142
- node ~/.claude/bin/qualia-ui.js end "QUEUE TRIAGED" "/qualia or /qualia-build {next}"
143
- ```
144
-
145
- ## Rules
146
-
147
- 1. **One category, one state — always.** No issue without both labels (after triage). No issue with two of either.
148
- 2. **`ready-for-agent` is conservative.** When in doubt, `ready-for-human`. Wrong agent-pull is more expensive than a human picking it up.
149
- 3. **`needs-info` posts a comment.** Don't just label and walk away — the reporter must know what's blocking.
150
- 4. **`wontfix` cites a reason.** Body or comment must say WHY (out of scope per PROJECT.md, conflicts with ADR-NNNN, duplicate of #N).
151
- 5. **Autonomous loop is opt-in per session.** Don't auto-loop without the user pressing "Pull it" each cycle (until they explicitly ask for a continuous run).
152
- 6. **Re-triage on response.** When `needs-info` issues get a reply, they return to `needs-triage` for re-evaluation.