qualia-framework 3.6.0 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +23 -11
- package/README.md +96 -51
- package/agents/builder.md +25 -14
- package/agents/plan-checker.md +29 -16
- package/agents/planner.md +33 -24
- package/agents/research-synthesizer.md +25 -12
- package/agents/roadmapper.md +89 -84
- package/agents/verifier.md +11 -2
- package/bin/cli.js +18 -13
- package/bin/install.js +34 -45
- package/bin/qualia-ui.js +267 -1
- package/bin/state.js +164 -12
- package/bin/statusline.js +4 -1
- package/docs/erp-contract.md +12 -0
- package/guide.md +85 -22
- package/hooks/migration-guard.js +23 -9
- package/hooks/pre-compact.js +39 -11
- package/hooks/pre-deploy-gate.js +3 -4
- package/hooks/pre-push.js +6 -3
- package/hooks/session-start.js +8 -8
- package/package.json +1 -1
- package/rules/frontend.md +5 -13
- package/skills/qualia/SKILL.md +8 -1
- package/skills/qualia-build/SKILL.md +49 -4
- package/skills/qualia-debug/SKILL.md +6 -0
- package/skills/qualia-design/SKILL.md +9 -1
- package/skills/qualia-discuss/SKILL.md +6 -0
- package/skills/qualia-handoff/SKILL.md +92 -12
- package/skills/qualia-help/SKILL.md +18 -4
- package/skills/qualia-idk/SKILL.md +166 -0
- package/skills/qualia-learn/SKILL.md +6 -0
- package/skills/qualia-map/SKILL.md +7 -0
- package/skills/qualia-milestone/SKILL.md +128 -79
- package/skills/qualia-new/SKILL.md +163 -230
- package/skills/qualia-optimize/SKILL.md +8 -0
- package/skills/qualia-pause/SKILL.md +5 -0
- package/skills/qualia-plan/SKILL.md +25 -10
- package/skills/qualia-polish/SKILL.md +8 -0
- package/skills/qualia-quick/SKILL.md +7 -0
- package/skills/qualia-report/SKILL.md +17 -0
- package/skills/qualia-research/SKILL.md +7 -0
- package/skills/qualia-resume/SKILL.md +3 -0
- package/skills/qualia-review/SKILL.md +7 -0
- package/skills/qualia-ship/SKILL.md +5 -0
- package/skills/qualia-skill-new/SKILL.md +6 -0
- package/skills/qualia-task/SKILL.md +8 -1
- package/skills/qualia-test/SKILL.md +7 -0
- package/skills/qualia-verify/SKILL.md +65 -3
- package/templates/help.html +4 -4
- package/templates/journey.md +113 -0
- package/templates/plan.md +56 -11
- package/templates/requirements.md +82 -22
- package/templates/roadmap.md +41 -14
- package/templates/tracking.json +2 -0
- package/tests/hooks.test.sh +5 -5
- package/tests/runner.js +381 -7
package/guide.md
CHANGED
|
@@ -1,63 +1,126 @@
|
|
|
1
|
-
# Qualia Developer Guide
|
|
1
|
+
# Qualia Developer Guide (v4)
|
|
2
2
|
|
|
3
3
|
> Follow the road. Type the commands. The framework handles the rest.
|
|
4
|
+
> v4 adds a `--auto` flag that chains the whole road end-to-end with only two human checkpoints per project.
|
|
4
5
|
|
|
5
6
|
## The Road
|
|
6
7
|
|
|
7
8
|
```
|
|
8
|
-
/qualia-new
|
|
9
|
+
/qualia-new ← Set up project (once). Produces JOURNEY.md — all milestones to handoff.
|
|
9
10
|
↓
|
|
10
|
-
For each phase:
|
|
11
|
-
/qualia-plan
|
|
12
|
-
/qualia-build
|
|
13
|
-
/qualia-verify
|
|
11
|
+
For each phase of the current milestone:
|
|
12
|
+
/qualia-plan ← Plan it (planner + plan-checker, story-file format)
|
|
13
|
+
/qualia-build ← Build it (builder subagents with pre-inlined context)
|
|
14
|
+
/qualia-verify ← Check it actually works (goal-backward + per-task AC)
|
|
14
15
|
↓
|
|
15
|
-
/qualia-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/qualia-milestone ← Close milestone, open next from JOURNEY.md
|
|
17
|
+
↓
|
|
18
|
+
...repeat per milestone until the Handoff milestone...
|
|
19
|
+
↓
|
|
20
|
+
/qualia-polish ← Design pass (part of Handoff milestone)
|
|
21
|
+
/qualia-ship ← Deploy to production
|
|
22
|
+
/qualia-handoff ← Enforce the 4 handoff deliverables
|
|
18
23
|
↓
|
|
19
24
|
Done.
|
|
20
25
|
```
|
|
21
26
|
|
|
22
|
-
##
|
|
27
|
+
## Auto Mode (v4)
|
|
28
|
+
|
|
29
|
+
Append `--auto` to `/qualia-new` and the framework chains every step:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
/qualia-new --auto
|
|
33
|
+
→ research runs → JOURNEY.md written → approve the whole journey ONCE
|
|
34
|
+
→ auto: plan 1 → build 1 → verify 1 → plan 2 → build 2 → verify 2 → ...
|
|
35
|
+
→ pause at each milestone boundary: "Continue to M{N+1}?"
|
|
36
|
+
→ resume: plan 1 → build 1 → ... of new milestone
|
|
37
|
+
→ eventually reaches Handoff milestone's last phase → ship → handoff → report → done
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Human gates in auto mode (total: 2 per project):**
|
|
41
|
+
1. Journey approval after `/qualia-new` research
|
|
42
|
+
2. Each milestone boundary
|
|
43
|
+
|
|
44
|
+
**Plus one halt case:** if a phase fails verification beyond the gap-cycle limit (default 2), the chain stops and asks for human intervention.
|
|
45
|
+
|
|
46
|
+
## The Road Commands
|
|
23
47
|
|
|
24
48
|
| When | Command | What it does |
|
|
25
49
|
|------|---------|-------------|
|
|
26
|
-
| Starting | `/qualia-new` | Set up project
|
|
50
|
+
| Starting | `/qualia-new` | Set up project with full journey (all milestones → Handoff) |
|
|
51
|
+
| Starting (auto) | `/qualia-new --auto` | Same + chain through building automatically |
|
|
27
52
|
| Building | `/qualia-plan` | Plan the current phase |
|
|
28
53
|
| | `/qualia-build` | Build it (parallel tasks) |
|
|
29
54
|
| | `/qualia-verify` | Check it actually works |
|
|
55
|
+
| Milestone | `/qualia-milestone` | Close current, open next from JOURNEY.md |
|
|
30
56
|
| Quick fix | `/qualia-quick` | Skip planning, just do it |
|
|
31
57
|
| Finishing | `/qualia-polish` | Design and UX pass |
|
|
32
58
|
| | `/qualia-ship` | Deploy to production |
|
|
33
|
-
| | `/qualia-handoff` | Deliver to client |
|
|
34
|
-
| Reporting | `/qualia-report` | Log what you did (mandatory) |
|
|
35
|
-
|
|
|
59
|
+
| | `/qualia-handoff` | Deliver to client (4 mandatory deliverables) |
|
|
60
|
+
| Reporting | `/qualia-report` | Log what you did (mandatory before clock-out) |
|
|
61
|
+
| Lost? | `/qualia` | Mechanical next-command router |
|
|
62
|
+
| Confused? | `/qualia-idk` | Diagnostic — scans planning + code, explains what's going on |
|
|
63
|
+
|
|
64
|
+
## Full Journey Hierarchy (v4)
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
Project
|
|
68
|
+
└─ Journey (the whole arc — mapped upfront by /qualia-new, lives in .planning/JOURNEY.md)
|
|
69
|
+
└─ Milestone (a release — 2-5 total, Handoff is always last)
|
|
70
|
+
└─ Phase (a feature-sized deliverable, 2-5 tasks)
|
|
71
|
+
└─ Task (atomic unit, one commit, one verification contract)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Hard rules (enforced by `state.js` and the roadmapper):
|
|
75
|
+
- **Milestone count: 2 to 5.** Final milestone is always literally named "Handoff".
|
|
76
|
+
- **≥ 2 phases per non-Handoff milestone** (single-phase "milestones" are phases, not milestones).
|
|
77
|
+
- **Milestone numbering is contiguous** — no skipped numbers.
|
|
78
|
+
- **Handoff milestone has fixed 4 phases:** Polish, Content + SEO, Final QA, Handoff (credentials + walkthrough + archive + ERP report).
|
|
36
79
|
|
|
37
80
|
## Rules
|
|
38
81
|
|
|
39
82
|
1. **Feature branches only** — never push to main
|
|
40
83
|
2. **Read before write** — don't edit files you haven't read
|
|
41
84
|
3. **MVP first** — build what's asked, nothing extra
|
|
42
|
-
4.
|
|
85
|
+
4. **Every task has a `Why`** (story-file format) — if you can't explain why a task matters in one sentence, it probably shouldn't exist
|
|
86
|
+
5. **`/qualia` is your friend** — lost? type it
|
|
87
|
+
6. **`/qualia-idk` is your deeper friend** — not lost on "what command", but confused about the *situation*? Type `idk`.
|
|
43
88
|
|
|
44
89
|
## When You're Stuck
|
|
45
90
|
|
|
46
91
|
```
|
|
47
|
-
/qualia ← "what
|
|
92
|
+
/qualia ← "what command should I run next?" (state-driven, instant)
|
|
93
|
+
/qualia-idk ← "what's actually going on here?" (diagnostic, scans planning + code, ~30s)
|
|
48
94
|
```
|
|
49
95
|
|
|
50
|
-
If
|
|
96
|
+
If neither helps, paste the error and ask Claude directly. If Claude can't fix it, tell Fawzi.
|
|
51
97
|
|
|
52
98
|
## Session Start / End
|
|
53
99
|
|
|
54
|
-
**Start:** Claude loads your project context automatically.
|
|
55
|
-
**End:** Run `/qualia-report` — this is mandatory before clock-out.
|
|
100
|
+
**Start:** Claude loads your project context automatically. The router banner shows your journey position ("M2 of 4 · P2 of 3").
|
|
101
|
+
**End:** Run `/qualia-report` — this is mandatory before clock-out. The report is committed to git and (if ERP is enabled) uploaded to https://portal.qualiasolutions.net.
|
|
56
102
|
|
|
57
103
|
## How It Works (you don't need to know this, but if curious)
|
|
58
104
|
|
|
105
|
+
- **Journey-first planning:** `/qualia-new` produces JOURNEY.md listing every milestone from kickoff to Handoff with exit criteria and phase sketches. The whole team sees the path on day 1.
|
|
59
106
|
- **Context isolation:** Each task runs in a fresh AI brain. Task 50 gets the same quality as Task 1.
|
|
60
|
-
- **
|
|
61
|
-
- **
|
|
107
|
+
- **Pre-inlined context at dispatch:** The builder starts with PROJECT.md, DESIGN.md, and all Context @files already loaded — no wasted orientation reads.
|
|
108
|
+
- **Goal-backward verification:** The verifier doesn't trust "I built it." It greps the code to check if things actually work AND walks every task's Acceptance Criteria.
|
|
109
|
+
- **Story-file plans:** Every task has Why / Acceptance Criteria / Depends on / Validation inline — the plan IS the brief.
|
|
62
110
|
- **Wave execution:** Independent tasks run in parallel. Dependent tasks wait.
|
|
63
|
-
- **
|
|
111
|
+
- **Milestone-boundary pauses:** In `--auto` mode, the framework pauses only at real decision points. Everything else runs on rails.
|
|
112
|
+
- **tracking.json:** Updated on every push. The ERP reads it automatically. v4 adds `milestone_name` + `milestones[]` so the ERP renders a proper tree instead of a flat list.
|
|
113
|
+
|
|
114
|
+
## Quick Reference
|
|
115
|
+
|
|
116
|
+
| Situation | Run |
|
|
117
|
+
|---|---|
|
|
118
|
+
| Starting a new client project | `/qualia-new` (or `/qualia-new --auto` to roll end-to-end) |
|
|
119
|
+
| Starting a quick throwaway | `/qualia-new --quick` |
|
|
120
|
+
| Brownfield project | `/qualia-map` first, then `/qualia-new` |
|
|
121
|
+
| Stuck picking next command | `/qualia` |
|
|
122
|
+
| Confused about the situation | `/qualia-idk` |
|
|
123
|
+
| Finished the last phase of a milestone | `/qualia-milestone` |
|
|
124
|
+
| About to ship | `/qualia-ship` |
|
|
125
|
+
| Client is ready to take over | `/qualia-handoff` |
|
|
126
|
+
| End of workday | `/qualia-report` (mandatory) |
|
package/hooks/migration-guard.js
CHANGED
|
@@ -11,6 +11,10 @@ const _traceStart = Date.now();
|
|
|
11
11
|
// Read JSON tool input from stdin with a safety timeout.
|
|
12
12
|
// On Windows, fs.readFileSync(0) can hang if stdin isn't closed by the host.
|
|
13
13
|
// We loop fs.readSync with a 1s deadline; if no data arrives, treat as empty.
|
|
14
|
+
// Between EAGAIN retries we sleep via Atomics.wait to avoid CPU-burning spin.
|
|
15
|
+
function sleepSync(ms) {
|
|
16
|
+
try { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms); } catch {}
|
|
17
|
+
}
|
|
14
18
|
function readInput() {
|
|
15
19
|
const deadline = Date.now() + 1000;
|
|
16
20
|
const buf = Buffer.alloc(65536);
|
|
@@ -21,8 +25,8 @@ function readInput() {
|
|
|
21
25
|
try {
|
|
22
26
|
n = fs.readSync(0, buf, 0, buf.length, null);
|
|
23
27
|
} catch (e) {
|
|
24
|
-
// EAGAIN/EWOULDBLOCK: no data yet
|
|
25
|
-
if (e && (e.code === "EAGAIN" || e.code === "EWOULDBLOCK")) continue;
|
|
28
|
+
// EAGAIN/EWOULDBLOCK: no data yet. Sleep 1ms and retry until deadline.
|
|
29
|
+
if (e && (e.code === "EAGAIN" || e.code === "EWOULDBLOCK")) { sleepSync(1); continue; }
|
|
26
30
|
// Any other read error: bail
|
|
27
31
|
break;
|
|
28
32
|
}
|
|
@@ -108,14 +112,24 @@ if (/ALTER\s+TABLE\s+[^;]*\bDROP\s+COLUMN\b/i.test(scan)) {
|
|
|
108
112
|
errors.push("ALTER TABLE ... DROP COLUMN is destructive");
|
|
109
113
|
}
|
|
110
114
|
|
|
111
|
-
// DELETE without WHERE
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
// DELETE / UPDATE without WHERE — check per-statement, not file-global.
|
|
116
|
+
// Previously a file containing "DELETE FROM foo;" followed by any later
|
|
117
|
+
// "... WHERE ..." (in a SELECT, JOIN, etc.) would pass the check.
|
|
118
|
+
function splitStatements(src) {
|
|
119
|
+
return src.split(/;/g).map((s) => s.trim()).filter(Boolean);
|
|
114
120
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (
|
|
118
|
-
|
|
121
|
+
const statements = splitStatements(scan);
|
|
122
|
+
for (const stmt of statements) {
|
|
123
|
+
if (/^\s*DELETE\s+FROM\b/i.test(stmt) && !/\bWHERE\b/i.test(stmt)) {
|
|
124
|
+
errors.push("DELETE FROM without WHERE clause");
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
for (const stmt of statements) {
|
|
129
|
+
if (/^\s*UPDATE\s+\w+(?:\.\w+)?\s+SET\b/i.test(stmt) && !/\bWHERE\b/i.test(stmt)) {
|
|
130
|
+
errors.push("UPDATE without WHERE clause — affects every row");
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
119
133
|
}
|
|
120
134
|
|
|
121
135
|
// TRUNCATE (almost always wrong in migrations)
|
package/hooks/pre-compact.js
CHANGED
|
@@ -2,17 +2,44 @@
|
|
|
2
2
|
// ~/.claude/hooks/pre-compact.js — commit STATE.md before context compaction.
|
|
3
3
|
// PreCompact hook. Silent on failure — context compaction must never be blocked.
|
|
4
4
|
// Cross-platform (Windows/macOS/Linux).
|
|
5
|
+
//
|
|
6
|
+
// BY DEFAULT this commit uses --no-verify + --no-gpg-sign. The auto-save is a
|
|
7
|
+
// framework bot commit, and pre-commit hooks that run full test suites would
|
|
8
|
+
// routinely fail (context compaction happens at any moment) and lose the
|
|
9
|
+
// STATE.md snapshot. But compliance-sensitive projects can opt into strict
|
|
10
|
+
// mode via ~/.claude/.qualia-config.json:
|
|
11
|
+
//
|
|
12
|
+
// {
|
|
13
|
+
// "pre_compact": {
|
|
14
|
+
// "respect_user_hooks": true,
|
|
15
|
+
// "respect_gpg_signing": true
|
|
16
|
+
// }
|
|
17
|
+
// }
|
|
18
|
+
//
|
|
19
|
+
// When either is true, the corresponding --no-* flag is dropped.
|
|
5
20
|
|
|
6
21
|
const fs = require("fs");
|
|
7
22
|
const path = require("path");
|
|
23
|
+
const os = require("os");
|
|
8
24
|
const { spawnSync } = require("child_process");
|
|
9
25
|
|
|
10
26
|
const _traceStart = Date.now();
|
|
11
27
|
|
|
12
28
|
const STATE_FILE = path.join(".planning", "STATE.md");
|
|
29
|
+
const CONFIG_FILE = path.join(os.homedir(), ".claude", ".qualia-config.json");
|
|
30
|
+
|
|
31
|
+
function readCompactConfig() {
|
|
32
|
+
try {
|
|
33
|
+
const cfg = JSON.parse(fs.readFileSync(CONFIG_FILE, "utf8"));
|
|
34
|
+
return cfg.pre_compact || {};
|
|
35
|
+
} catch {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
13
39
|
|
|
14
40
|
let _commitStatus = null;
|
|
15
41
|
let _commitReason = "no-state-file";
|
|
42
|
+
let _commitFlags = null;
|
|
16
43
|
|
|
17
44
|
try {
|
|
18
45
|
if (fs.existsSync(STATE_FILE)) {
|
|
@@ -29,16 +56,17 @@ try {
|
|
|
29
56
|
timeout: 3000,
|
|
30
57
|
shell: process.platform === "win32",
|
|
31
58
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
59
|
+
const cfg = readCompactConfig();
|
|
60
|
+
const commitArgs = ["commit"];
|
|
61
|
+
if (!cfg.respect_user_hooks) commitArgs.push("--no-verify");
|
|
62
|
+
if (!cfg.respect_gpg_signing) commitArgs.push("--no-gpg-sign");
|
|
63
|
+
commitArgs.push("--author=Qualia Framework <bot@qualia.solutions>");
|
|
64
|
+
commitArgs.push("-m", "state: pre-compaction save");
|
|
65
|
+
_commitFlags = {
|
|
66
|
+
no_verify: !cfg.respect_user_hooks,
|
|
67
|
+
no_gpg_sign: !cfg.respect_gpg_signing,
|
|
68
|
+
};
|
|
69
|
+
const commitRes = spawnSync("git", commitArgs, {
|
|
42
70
|
timeout: 5000,
|
|
43
71
|
stdio: ["ignore", "ignore", "pipe"],
|
|
44
72
|
encoding: "utf8",
|
|
@@ -72,5 +100,5 @@ function _trace(hookName, result, extra) {
|
|
|
72
100
|
} catch {}
|
|
73
101
|
}
|
|
74
102
|
|
|
75
|
-
_trace("pre-compact", "allow", { commit_status: _commitStatus, commit_reason: _commitReason });
|
|
103
|
+
_trace("pre-compact", "allow", { commit_status: _commitStatus, commit_reason: _commitReason, commit_flags: _commitFlags });
|
|
76
104
|
process.exit(0);
|
package/hooks/pre-deploy-gate.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// ~/.claude/hooks/pre-deploy-gate.js — quality gates before production deploy.
|
|
3
3
|
// PreToolUse hook on `vercel --prod*` commands. Runs tsc, lint, tests, build,
|
|
4
4
|
// then scans for service_role leaks in client code.
|
|
5
|
-
// Exits
|
|
6
|
-
// protocol formally uses exit 2, but the framework's existing tests assert on 1).
|
|
5
|
+
// Exits 2 to BLOCK deploy (Claude Code PreToolUse hook contract).
|
|
7
6
|
// Exits 0 to allow.
|
|
8
7
|
// Cross-platform (Windows/macOS/Linux). No `grep` or `find` — pure Node.
|
|
9
8
|
|
|
@@ -43,7 +42,7 @@ function runGate(label, cmd, args, { required = true } = {}) {
|
|
|
43
42
|
if (required) {
|
|
44
43
|
console.error(`BLOCKED: ${label} errors. Fix before deploying.`);
|
|
45
44
|
_trace("pre-deploy-gate", "block", { gate: label });
|
|
46
|
-
process.exit(
|
|
45
|
+
process.exit(2);
|
|
47
46
|
}
|
|
48
47
|
return false;
|
|
49
48
|
}
|
|
@@ -180,7 +179,7 @@ if (leaks.length > 0) {
|
|
|
180
179
|
console.error(` ✗ ${f}`);
|
|
181
180
|
}
|
|
182
181
|
_trace("pre-deploy-gate", "block", { gate: "security", leaks: leaks.slice(0, 10) });
|
|
183
|
-
process.exit(
|
|
182
|
+
process.exit(2);
|
|
184
183
|
}
|
|
185
184
|
console.log(" ✓ Security");
|
|
186
185
|
console.log("⬢ All gates passed.");
|
package/hooks/pre-push.js
CHANGED
|
@@ -85,9 +85,12 @@ function commitStamp() {
|
|
|
85
85
|
"-m", `chore(track): ERP sync ${now}`,
|
|
86
86
|
]);
|
|
87
87
|
if (commit.status !== 0) {
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
88
|
+
// Commit failed (e.g., empty diff because git's auto-CRLF normalized the
|
|
89
|
+
// only change to nothing, or branch is in a detached/conflicted state).
|
|
90
|
+
// Unstage tracking.json and restore the working tree copy so the user's
|
|
91
|
+
// next manual commit isn't polluted by our aborted stamp.
|
|
92
|
+
try { git(["reset", "HEAD", "--", TRACKING]); } catch {}
|
|
93
|
+
try { if (raw != null) atomicWrite(TRACKING, raw); } catch {}
|
|
91
94
|
return { skipped: "git-commit-failed", error: (commit.stderr || commit.stdout || "").trim() };
|
|
92
95
|
}
|
|
93
96
|
return { committed: true, sha: lastCommit, ts: now };
|
package/hooks/session-start.js
CHANGED
|
@@ -52,6 +52,14 @@ function getNextCommand() {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
function readConfig() {
|
|
56
|
+
try {
|
|
57
|
+
return JSON.parse(fs.readFileSync(path.join(HOME, ".claude", ".qualia-config.json"), "utf8"));
|
|
58
|
+
} catch {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
55
63
|
function fallbackText() {
|
|
56
64
|
// If qualia-ui.js is missing, emit plain text. Keeps the session informative
|
|
57
65
|
// even on a broken install.
|
|
@@ -121,14 +129,6 @@ try {
|
|
|
121
129
|
// Deliberately silent — hook must never fail
|
|
122
130
|
}
|
|
123
131
|
|
|
124
|
-
function readConfig() {
|
|
125
|
-
try {
|
|
126
|
-
return JSON.parse(fs.readFileSync(path.join(HOME, ".claude", ".qualia-config.json"), "utf8"));
|
|
127
|
-
} catch {
|
|
128
|
-
return {};
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
132
|
function _trace(hookName, result, extra) {
|
|
133
133
|
try {
|
|
134
134
|
const traceDir = path.join(os.homedir(), ".claude", ".qualia-traces");
|
package/package.json
CHANGED
package/rules/frontend.md
CHANGED
|
@@ -109,18 +109,10 @@ These are Qualia brand standards — mandatory for every frontend component. Not
|
|
|
109
109
|
If `.planning/DESIGN.md` exists in the project, it takes precedence over these defaults.
|
|
110
110
|
Read it before any frontend work. It contains project-specific: palette, typography, spacing, component patterns.
|
|
111
111
|
|
|
112
|
-
##
|
|
113
|
-
- `/
|
|
114
|
-
- `/
|
|
115
|
-
- `/
|
|
116
|
-
- `/animate` — Add purposeful micro-interactions
|
|
117
|
-
- `/colorize` — Inject strategic color into monochrome UIs
|
|
118
|
-
- `/clarify` — Fix unclear UX copy, labels, error messages
|
|
119
|
-
- `/critique` — Design director-level review
|
|
120
|
-
- `/distill` — Strip unnecessary complexity
|
|
121
|
-
- `/delight` — Add memorable touches and personality
|
|
122
|
-
- `/harden` — Edge cases, overflow, i18n robustness
|
|
123
|
-
- `/responsive` — Cross-device responsive adaptation
|
|
112
|
+
## Qualia design commands
|
|
113
|
+
- `/qualia-design` — One-shot design transformation (critique + fix + polish + responsive + harden)
|
|
114
|
+
- `/qualia-polish` — Final detail pass before shipping (run after all phases verified)
|
|
115
|
+
- `/qualia-review` — Scored production audit
|
|
124
116
|
|
|
125
117
|
### Recommended workflow
|
|
126
|
-
1. Build feature → 2. `/
|
|
118
|
+
1. Build feature → 2. `/qualia-design` → 3. `/qualia-polish` → ship
|
package/skills/qualia/SKILL.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: qualia
|
|
3
|
-
description: "Smart router — reads project state, classifies
|
|
3
|
+
description: "Smart router — reads project state (state.js), classifies the situation mechanically, returns the exact next command. Use whenever you type /qualia, 'what next', 'next', 'what now', 'what should I do next', 'what command now'. For deeper 'I don't understand what's going on' / 'something feels off' situations, use /qualia-idk instead — that one actually scans the planning folder and codebase to diagnose the confusion."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash
|
|
6
|
+
- Read
|
|
7
|
+
- Grep
|
|
8
|
+
- Glob
|
|
4
9
|
---
|
|
5
10
|
|
|
6
11
|
# /qualia — What's Next?
|
|
@@ -56,6 +61,8 @@ Use the state.js JSON output plus gathered context:
|
|
|
56
61
|
**Clear next step** (use the UI helper — it reads state.js itself):
|
|
57
62
|
```bash
|
|
58
63
|
node ~/.claude/bin/qualia-ui.js banner router
|
|
64
|
+
# If a project is loaded, show the journey position first (one-glance orientation)
|
|
65
|
+
test -f .planning/JOURNEY.md && node ~/.claude/bin/qualia-ui.js journey-tree .planning/JOURNEY.md
|
|
59
66
|
node ~/.claude/bin/qualia-ui.js next "{next_command from state.js}"
|
|
60
67
|
```
|
|
61
68
|
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: qualia-build
|
|
3
3
|
description: "Execute the current phase — spawns builder subagents per task with wave-based parallelization. Fresh context per task."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- Agent
|
|
12
|
+
- TaskCreate
|
|
13
|
+
- TaskUpdate
|
|
4
14
|
---
|
|
5
15
|
|
|
6
16
|
# /qualia-build — Build a Phase
|
|
@@ -10,6 +20,7 @@ Execute the phase plan. Each task runs in a fresh subagent context. Independent
|
|
|
10
20
|
## Usage
|
|
11
21
|
`/qualia-build` — build the current planned phase
|
|
12
22
|
`/qualia-build {N}` — build specific phase
|
|
23
|
+
`/qualia-build {N} --auto` — build + chain into `/qualia-verify {N} --auto` when done (no human gate between build and verify)
|
|
13
24
|
|
|
14
25
|
## Process
|
|
15
26
|
|
|
@@ -57,22 +68,44 @@ node ~/.claude/bin/qualia-ui.js wave {W} {total_waves} {tasks_in_wave}
|
|
|
57
68
|
node ~/.claude/bin/qualia-ui.js task {task_num} "{task title}"
|
|
58
69
|
```
|
|
59
70
|
|
|
71
|
+
**Pre-inline context before spawning** (saves 3-5 Read calls inside each builder subagent — GSD-style dispatch):
|
|
72
|
+
|
|
73
|
+
1. Parse the task's `Context:` field to get `@file` references
|
|
74
|
+
2. Read PROJECT.md
|
|
75
|
+
3. Read DESIGN.md if any file in the task is `.tsx`, `.jsx`, `.css`, `.scss`
|
|
76
|
+
4. Read each `@file` referenced in Context
|
|
77
|
+
5. Inline all of the above into the agent prompt under `<pre-loaded-context>` so the builder starts with full context
|
|
78
|
+
|
|
60
79
|
Spawn a fresh builder subagent:
|
|
61
80
|
|
|
62
81
|
```
|
|
63
82
|
Agent(prompt="
|
|
64
83
|
Read your role: @~/.claude/agents/builder.md
|
|
65
84
|
|
|
66
|
-
|
|
67
|
-
|
|
85
|
+
<pre-loaded-context>
|
|
86
|
+
# PROJECT.md
|
|
87
|
+
{inlined contents of .planning/PROJECT.md}
|
|
88
|
+
|
|
89
|
+
# DESIGN.md (if frontend task)
|
|
90
|
+
{inlined contents of .planning/DESIGN.md}
|
|
91
|
+
|
|
92
|
+
# {each @file from task.Context}
|
|
93
|
+
{inlined contents}
|
|
94
|
+
</pre-loaded-context>
|
|
68
95
|
|
|
69
96
|
YOUR TASK:
|
|
70
|
-
{paste the single task block from the plan — title, files,
|
|
97
|
+
{paste the single task block from the plan — title, wave, persona, files, depends-on, why, acceptance-criteria, action, validation, context}
|
|
71
98
|
|
|
72
|
-
|
|
99
|
+
All files in <pre-loaded-context> are already in your working memory — do NOT
|
|
100
|
+
re-Read them. Only Read files NOT in the pre-loaded context (e.g. existing
|
|
101
|
+
project code you need to modify).
|
|
102
|
+
|
|
103
|
+
Execute the task. Commit when done.
|
|
73
104
|
", subagent_type="qualia-builder", description="Task {N}: {title}")
|
|
74
105
|
```
|
|
75
106
|
|
|
107
|
+
**Why pre-inline:** without it, the builder's first actions are 3-5 Read tool calls to orient itself (PROJECT.md, DESIGN.md, context files). With pre-inline, the builder starts already oriented and spends its context budget on the actual task.
|
|
108
|
+
|
|
76
109
|
**After each task completes:**
|
|
77
110
|
- Verify the commit exists: `git log --oneline -1`
|
|
78
111
|
- Show result:
|
|
@@ -110,6 +143,18 @@ node ~/.claude/bin/state.js transition --to built --phase {N} --tasks-done {done
|
|
|
110
143
|
If state.js returns an error, show it to the employee and stop.
|
|
111
144
|
Do NOT manually edit STATE.md or tracking.json — state.js handles both.
|
|
112
145
|
|
|
146
|
+
### 6. Route (auto-chain aware)
|
|
147
|
+
|
|
148
|
+
**If invoked with `--auto`:** immediately invoke `/qualia-verify {N} --auto` inline. No pause, no permission ask. Verify will either chain into the next phase (if PASS), into gap closure (if FAIL and gap cycles remain), or halt with clear escalation (if gap limit reached).
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
node ~/.claude/bin/qualia-ui.js info "Auto mode — chaining into /qualia-verify {N}"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Then invoke the `qualia-verify` skill inline with the same `--auto` flag.
|
|
155
|
+
|
|
156
|
+
**Otherwise (default guided mode):** stop and show the next step:
|
|
157
|
+
|
|
113
158
|
```bash
|
|
114
159
|
node ~/.claude/bin/qualia-ui.js end "PHASE {N} BUILT" "/qualia-verify {N}"
|
|
115
160
|
```
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: qualia-debug
|
|
3
3
|
description: "Structured debugging — symptom gathering, diagnosis confirmation, root cause analysis. Trigger on 'debug', 'find bug', 'fix error', 'something is broken', 'not working', 'weird behavior', 'layout broken', 'CSS issue', 'slow page', 'performance'."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash
|
|
6
|
+
- Read
|
|
7
|
+
- Grep
|
|
8
|
+
- Glob
|
|
9
|
+
- Agent
|
|
4
10
|
---
|
|
5
11
|
|
|
6
12
|
# /qualia-debug — Structured Debugging
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: qualia-design
|
|
3
3
|
description: "One-shot design transformation — critiques, fixes, polishes, hardens, makes responsive. No reports, no choices, just makes it professional. Trigger on 'fix the design', 'make it look better', 'redesign', 'design pass', 'make it modern', 'it looks ugly', 'fix the UI'."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- Agent
|
|
4
12
|
---
|
|
5
13
|
|
|
6
14
|
# /qualia-design — One-Shot Design Transformation
|
|
@@ -87,7 +95,7 @@ git commit -m "style: design transformation"
|
|
|
87
95
|
- {key change 2}
|
|
88
96
|
- {key change 3}
|
|
89
97
|
|
|
90
|
-
|
|
98
|
+
Next: /qualia-polish (final pass) · /qualia-review (scored audit)
|
|
91
99
|
```
|
|
92
100
|
|
|
93
101
|
## Rules
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: qualia-discuss
|
|
3
3
|
description: "Capture phase decisions, trade-offs, and constraints BEFORE planning. Use for complex phases with regulatory, compliance, or architectural stakes. Creates .planning/phase-{N}-context.md that planner honors as locked input."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- AskUserQuestion
|
|
4
10
|
---
|
|
5
11
|
|
|
6
12
|
# /qualia-discuss — Phase Context Capture
|