qualia-framework 6.9.2 → 6.22.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 (64) hide show
  1. package/AGENTS.md +8 -5
  2. package/CHANGELOG.md +208 -0
  3. package/CLAUDE.md +3 -1
  4. package/agents/roadmapper.md +16 -14
  5. package/agents/verifier.md +1 -1
  6. package/bin/agent-status.js +264 -0
  7. package/bin/analyze-gate.js +318 -0
  8. package/bin/branch-hygiene.js +135 -0
  9. package/bin/command-surface.js +2 -0
  10. package/bin/compile-instructions.js +82 -0
  11. package/bin/eval-runner.js +218 -0
  12. package/bin/host-adapters.js +72 -12
  13. package/bin/install.js +27 -17
  14. package/bin/last-report.js +207 -0
  15. package/bin/project-sync.js +315 -0
  16. package/bin/report-payload.js +7 -0
  17. package/bin/runtime-manifest.js +8 -0
  18. package/bin/state.js +257 -12
  19. package/bin/verify-panel.js +294 -0
  20. package/bin/wave-plan.js +211 -0
  21. package/docs/EMPLOYEE-QUICKSTART.md +3 -3
  22. package/docs/erp-contract.md +168 -0
  23. package/docs/qualia-manual.html +5 -5
  24. package/hooks/branch-guard.js +133 -63
  25. package/hooks/pre-deploy-gate.js +38 -0
  26. package/hooks/task-write-guard.js +165 -0
  27. package/package.json +3 -2
  28. package/rules/codex-goal.md +28 -26
  29. package/rules/infrastructure.md +1 -1
  30. package/skills/qualia/SKILL.md +6 -0
  31. package/skills/qualia-build/SKILL.md +39 -7
  32. package/skills/qualia-eval/SKILL.md +83 -0
  33. package/skills/qualia-feature/SKILL.md +20 -4
  34. package/skills/qualia-fix/SKILL.md +13 -1
  35. package/skills/qualia-milestone/SKILL.md +12 -6
  36. package/skills/qualia-new/REFERENCE.md +6 -4
  37. package/skills/qualia-new/SKILL.md +27 -15
  38. package/skills/qualia-plan/SKILL.md +2 -2
  39. package/skills/qualia-report/SKILL.md +10 -0
  40. package/skills/qualia-scope/SKILL.md +3 -3
  41. package/skills/qualia-ship/SKILL.md +37 -4
  42. package/skills/qualia-update/SKILL.md +100 -0
  43. package/skills/qualia-verify/SKILL.md +51 -24
  44. package/templates/instructions.md +32 -0
  45. package/templates/journey.md +2 -2
  46. package/templates/project-discovery.md +30 -23
  47. package/templates/requirements.md +7 -7
  48. package/tests/agent-status.test.sh +153 -0
  49. package/tests/analyze-gate.test.sh +170 -0
  50. package/tests/bin.test.sh +5 -4
  51. package/tests/branch-hygiene.test.sh +93 -0
  52. package/tests/eval-runner.test.sh +147 -0
  53. package/tests/hooks.test.sh +218 -17
  54. package/tests/install-smoke.test.sh +4 -3
  55. package/tests/instructions.test.sh +109 -0
  56. package/tests/last-report.test.sh +156 -0
  57. package/tests/lib.test.sh +2 -2
  58. package/tests/project-sync.test.sh +175 -0
  59. package/tests/run-all.sh +9 -0
  60. package/tests/runner.js +3 -2
  61. package/tests/state.test.sh +187 -0
  62. package/tests/verify-panel.test.sh +162 -0
  63. package/tests/wave-plan.test.sh +153 -0
  64. package/skills/qualia-discuss/SKILL.md +0 -222
@@ -58,7 +58,7 @@ Use **AskUserQuestion** (interactive UI — never a plain-text prompt):
58
58
  - question: "What kind of project is this? Pick one — it drives everything else."
59
59
  - options:
60
60
  - "Demo" — one shippable milestone, real backend, no mocks. Built to win a client conversation, extensible via `/qualia-milestone` if they sign. 8-question discovery.
61
- - "Full project" — the multi-milestone arc to Handoff. 2-5 milestones planned upfront. 14-question discovery.
61
+ - "Full project" — the full multi-milestone arc to Handoff, sized to the agreed capability set (no fixed milestone cap — the arc spans to done). 15-question discovery.
62
62
  - "Quick prototype" — landing page, throwaway, ≤1 day. Skips research and journey. (Equivalent to `--quick` flag.)
63
63
 
64
64
  Store the answer as `PROJECT_TYPE=demo` | `PROJECT_TYPE=full` | `PROJECT_TYPE=quick`. It drives every downstream step.
@@ -94,7 +94,7 @@ The shape is locked, now capture the content in one sentence:
94
94
 
95
95
  > **"What are you building? One sentence — a stranger should understand it."**
96
96
 
97
- Accept whatever the user says, even if broad. **Do NOT start an ad-hoc clarification round here.** Depth comes from the structured discovery interview in Step 4, not from free-form questioning. If the answer is "a SaaS platform" — that's fine, write it down, move on. `/qualia-scope` will refine it through its 8 or 14 structured questions.
97
+ Accept whatever the user says, even if broad. **Do NOT start an ad-hoc clarification round here.** Depth comes from the structured discovery interview in Step 4, not from free-form questioning. If the answer is "a SaaS platform" — that's fine, write it down, move on. `/qualia-scope` will refine it through its 8 or 15 structured questions.
98
98
 
99
99
  This is the ONLY free-text question in the kickoff flow. Everything else is `AskUserQuestion`.
100
100
 
@@ -102,7 +102,7 @@ This is the ONLY free-text question in the kickoff flow. Everything else is `Ask
102
102
 
103
103
  **Hard rule:** This is the next tool call after Step 3. No ad-hoc clarification, no free-form follow-up, no "let me ask a few quick things first." If the one-line pitch was "a SaaS platform", you invoke `/qualia-scope` NOW — that skill's structured questions are how breadth gets refined into depth.
104
104
 
105
- Invoke `/qualia-scope` inline in PROJECT MODE — non-technical kickoff interview. 8 questions for demo, 14 for full project. Pass `PROJECT_TYPE` so the scope skill skips the type question.
105
+ Invoke `/qualia-scope` inline in PROJECT MODE — non-technical kickoff interview. 8 questions for demo, 15 for full project. Pass `PROJECT_TYPE` so the scope skill skips the type question.
106
106
 
107
107
  This step REPLACES the old free-form "deep questioning" loop. The scope skill captures answers verbatim into `.planning/project-discovery.md`, which seeds PROJECT.md, PRODUCT.md, CONTEXT.md, and (for full projects) JOURNEY.md milestone names.
108
108
 
@@ -331,13 +331,13 @@ Read `.planning/research/FEATURES.md` and present the feature landscape. Feature
331
331
  For each category, use AskUserQuestion:
332
332
 
333
333
  - header: "{Category name}"
334
- - question: "Which {category} features belong to v1 (Milestones 1..N-1 excluding Handoff)?"
334
+ - question: "Which {category} features are part of THIS project (the full agreed scope)? Anything selected must land in a milestone — the arc is sized to fit, no cap."
335
335
  - multiSelect: true
336
- - options: each feature from FEATURES.md + "None for v1"
336
+ - options: each feature from FEATURES.md + "None of these"
337
337
 
338
338
  Track selections:
339
- - Selected → v1 scope (roadmapper assigns to specific milestones based on dependency order)
340
- - Unselected table stakes Post-Handoff v2 (users expect these)
339
+ - Selected → in scope (roadmapper assigns each to a specific milestone by dependency order; the arc grows to cover all of them)
340
+ - Unselected only goes to Post-Handoff/Out-of-Scope if the user EXPLICITLY defers it (matches discovery §8). Don't silently drop a table-stakes feature into v2 to keep the arc short.
341
341
  - Unselected differentiators → Out of Scope
342
342
 
343
343
  Gather any additional requirements the user wants that research missed.
@@ -350,12 +350,24 @@ node ${QUALIA_BIN}/qualia-ui.js banner roadmap
350
350
 
351
351
  **Roadmapper output branches on `PROJECT_TYPE`:**
352
352
 
353
- - **Demo** (`PROJECT_TYPE=demo`): roadmapper produces a 1-milestone JOURNEY.md (the demo milestone, 2-4 phases) plus a matching REQUIREMENTS.md and a fully-detailed ROADMAP.md. No "Handoff" milestone is appended — the demo is its own complete artifact. The journey-tree at Step 14 shows a single rung; the "extend to full project" branch is handled later by `/qualia-milestone` if the client signs.
354
- - **Full project** (`PROJECT_TYPE=full`): roadmapper produces the standard 2-5 milestone arc ending in Handoff. Milestone 1 fully detailed, M2..M{N-1} sketched (unless `--full-detail`).
353
+ - **Demo** (`PROJECT_TYPE=demo`): roadmapper produces a 1-milestone JOURNEY.md (the demo milestone, 2-4 phases) plus a matching REQUIREMENTS.md and a fully-detailed ROADMAP.md. No "Handoff" milestone is appended — the demo is its own complete artifact. The journey-tree at Step 15 shows a single rung; the "extend to full project" branch is handled later by `/qualia-milestone` if the client signs.
354
+ - **Full project** (`PROJECT_TYPE=full`): roadmapper produces the full milestone arc ending in Handoff (client projects), sized to cover the entire capability inventory from discovery §9 — no fixed milestone count. Milestone 1 fully detailed, M2..M{N-1} sketched (unless `--full-detail`).
355
355
 
356
356
  Spawn the roadmapper with `<project_type>$PROJECT_TYPE</project_type>` in the prompt. If the user passed `--full-detail`, include `<full_detail>true</full_detail>` so the roadmapper writes complete phase detail for ALL milestones (full project only; demo always has full detail because there's only one milestone). See REFERENCE.md section "Roadmapper prompt" for the verbatim prompt template.
357
357
 
358
- ### Step 14. Present the Journey (single view)
358
+ ### Step 14. Coverage gate (before presenting — the genesis teeth)
359
+
360
+ Before showing the journey, verify the arc actually covers the whole agreed scope. This is what stops the framework from generating "milestones that don't finish the project."
361
+
362
+ 1. Read the capability inventory: `.planning/project-discovery.md` §9 (full projects).
363
+ 2. Read `.planning/REQUIREMENTS.md` traceability.
364
+ 3. Confirm **every §9 capability has a REQ-ID mapped to a milestone** (Unmapped = 0), and the only items in `Post-Handoff (v2)` / `Out of Scope` are the ones the client explicitly deferred in §8.
365
+
366
+ If any §9 capability is unmapped, or agreed work was pushed to v2 to shorten the arc → **do NOT present for approval.** Re-spawn the roadmapper with the gap list and instruction to extend the arc until coverage is complete. Only proceed to the ladder when coverage is 100%.
367
+
368
+ (Demo projects skip this — they're a single milestone with no §9 inventory.)
369
+
370
+ ### Step 15. Present the Journey (single view)
359
371
 
360
372
  Render the branded journey ladder:
361
373
 
@@ -367,7 +379,7 @@ This shows M1..M{N} as a vertical ladder: shipped milestones get a green dot, cu
367
379
 
368
380
  Also narrate the one-glance summary. See REFERENCE.md section "Journey ladder format" for the ASCII template.
369
381
 
370
- ### Step 15. Approval Gate (single — for the whole journey)
382
+ ### Step 16. Approval Gate (single — for the whole journey)
371
383
 
372
384
  - header: "Journey"
373
385
  - question: "Does this journey work for you?"
@@ -397,7 +409,7 @@ node ${QUALIA_BIN}/qualia-ui.js info "Full phase detail for each later milestone
397
409
 
398
410
  (Skip this block when `--full-detail` was used — all milestones are already fully planned in that case.)
399
411
 
400
- ### Step 16. Environment Setup
412
+ ### Step 17. Environment Setup
401
413
 
402
414
  Supabase project? `supabase link` or create. Vercel project? `vercel link`. Env vars? `.env.local` with placeholders from PROJECT.md stack.
403
415
 
@@ -408,7 +420,7 @@ git add .gitignore
408
420
  git commit -m "chore: environment setup" 2>/dev/null
409
421
  ```
410
422
 
411
- ### Step 17. Auto-Apply Gate (or stop here)
423
+ ### Step 18. Auto-Apply Gate (or stop here)
412
424
 
413
425
  If invoked with `--auto`, skip straight into building Milestone 1:
414
426
 
@@ -465,10 +477,10 @@ Do NOT use `--quick` for: client projects, anything with compliance stakes, anyt
465
477
  1a. **One stack question, then a real scaffold.** Step 5a asks exactly ONE stack-preset question (`landing-page` / `full-app` / `ai-agent` / `internal-tool`) and then instantiates it: copies `scaffold/` into the project (never clobbering existing files), copies `env.required.json` → `.planning/env.required.json`, and copies `phases.md` → `.planning/phases.md`. The project starts from a runnable skeleton, not an empty folder. Skip this step on `--quick`. Record the choice as `config.json.stack_id`.
466
478
  2. **AskUserQuestion for every discrete-choice question.** Project type, brownfield gate, design vibe, client type, approval gate, auto-chain — all use the interactive UI. The ONLY free-text question in the kickoff flow is the Step 3 one-line pitch. No plain-text prompts for anything that has a closed set of answers.
467
479
  3. **No ad-hoc clarification questioning.** After Step 3 (one-line pitch), the next tool call is `/qualia-scope`. No "let me ask a few quick things first", no "that's too broad, can you clarify". Depth is the scope skill's job — not yours.
468
- 4. **Discovery interview is mandatory.** Step 4 always invokes `/qualia-scope` in PROJECT MODE. No free-form questioning loop, no "I'll just sketch PROJECT.md from the user's first message." The interview is 8 questions for demo, 14 for full project.
480
+ 4. **Discovery interview is mandatory.** Step 4 always invokes `/qualia-scope` in PROJECT MODE. No free-form questioning loop, no "I'll just sketch PROJECT.md from the user's first message." The interview is 8 questions for demo, 15 for full project.
469
481
  5. **Research runs automatically.** No permission ask. Only `--quick` skips it. Demo path uses `<scope>quick</scope>` (3-call budget per researcher); full project uses standard 8-call budget.
470
482
  6. **Demo design philosophy is non-negotiable.** Real backend always (Supabase, real auth), DESIGN.md mandatory, slop-detect hard-block, 1 milestone, focus on real agent/platform functionality + design quality. No mock data, no lorem ipsum, no broken flows. Speed comes from skipping multi-milestone planning, never from skipping design quality, mocking the backend, or cutting corners on the core flow. A demo that uses mock data is not a Qualia demo.
471
- 7. **Demos are 1 milestone, full projects are 2-5.** Demo journeys have no "Handoff" — the demo IS the artifact. Full projects always end in Handoff (fixed 4 phases). The journey-tree adapts to both shapes.
483
+ 7. **Demos are 1 milestone; full projects are 2+ (as many as the agreed scope needs — no cap).** Demo journeys have no "Handoff" — the demo IS the artifact. Full client projects end in Handoff (fixed 4 phases); internal/ongoing products may end at their done-state milestone. The journey-tree adapts to any length. A full project's arc must cover every capability from discovery §9 — never trimmed to hit a milestone count.
472
484
  8. **The full-project journey includes Handoff.** Every full project's final milestone is literally named "Handoff" with 4 standard phases. The roadmapper enforces this.
473
485
  9. **Single approval gate.** One gate for the whole journey. Not per-milestone, not per-phase.
474
486
  10. **Milestone 1 is fully detailed (full projects).** M2..M{N-1} are sketched. Detail fills in when each milestone opens. Demos are always fully detailed because they're 1 milestone.
@@ -27,9 +27,9 @@ Spawn planner to break phase into tasks, validate with checker (max 2 revision c
27
27
 
28
28
  ## Process
29
29
 
30
- ### 0. Codex goal (Codex runtime only)
30
+ ### 0. Set the work-unit goal
31
31
 
32
- Per `rules/codex-goal.md` — set the thread goal at plan start with scope `phase`. The objective covers both planning and the subsequent build, so a single goal-set at this stage is enough.
32
+ Per `rules/codex-goal.md` — set the work-unit goal at plan start with scope `phase` (Codex `/goal`; on Claude Code, a tracked task + budget). The objective covers both planning and the subsequent build, so a single goal-set at this stage is enough.
33
33
 
34
34
  ### 1. Determine Phase & Load Context
35
35
 
@@ -123,6 +123,16 @@ if [ "$DRY_RUN" != "true" ] && [ -d .git ]; then
123
123
  fi
124
124
  ```
125
125
 
126
+ ### Step 5b — Branch hygiene sweep (clock-out safety net)
127
+
128
+ Ship integrates every deploy into `main`, but work that was built and never shipped strands on a branch, and review PRs can linger. Surface both before the employee leaves — informational, never blocks:
129
+
130
+ ```bash
131
+ node ${QUALIA_BIN}/branch-hygiene.js
132
+ ```
133
+
134
+ Exit 1 → it lists branches with unshipped commits ahead of `main` (run `/qualia-ship` or merge them, or delete if abandoned) and any stale open PRs. Exit 0 → nothing stranded. Include the summary in the closing message so the OWNER sees it in the report.
135
+
126
136
  ### Step 6 — Upload to ERP
127
137
 
128
138
  The full payload-builder + 3-attempt-retry logic lives unchanged from v4 — see the **ERP Upload** section below for the canonical implementation. Behavior summary:
@@ -45,7 +45,7 @@ The non-technical conversation at the start of `/qualia-new`, BEFORE roadmapping
45
45
 
46
46
  ### P1. Project type (or accept it from `/qualia-new`)
47
47
 
48
- If `/qualia-new` already asked the Demo vs Full gate (its literal first question), it passes `PROJECT_TYPE=demo` | `PROJECT_TYPE=full` via env/arg — **skip the gate, do not re-ask.** Only ask it when invoked standalone, via **AskUserQuestion** (header "Project shape"): "Demo (single shippable milestone, sales conversation)" vs "Full project (multi-milestone arc to Handoff)". Demo runs §1–§8 of the discovery template; Full runs all 14.
48
+ If `/qualia-new` already asked the Demo vs Full gate (its literal first question), it passes `PROJECT_TYPE=demo` | `PROJECT_TYPE=full` via env/arg — **skip the gate, do not re-ask.** Only ask it when invoked standalone, via **AskUserQuestion** (header "Project shape"): "Demo (single shippable milestone, sales conversation)" vs "Full project (multi-milestone arc to Handoff)". Demo runs §1–§8 of the discovery template; Full runs §1–§15 (adds the capability-completeness pass + delivery questions).
49
49
 
50
50
  ### P2. Open
51
51
 
@@ -53,11 +53,11 @@ If `/qualia-new` already asked the Demo vs Full gate (its literal first question
53
53
  node ${QUALIA_BIN}/qualia-ui.js banner scope 2>/dev/null || true
54
54
  ```
55
55
 
56
- Say **"Eight quick questions for the demo path"** or **"Fourteen questions to shape the full project — we'll move fast."**
56
+ Say **"Eight quick questions for the demo path"** or **"Fifteen questions to shape the full project — we'll move fast. The middle ones map out everything the project needs to be DONE."**
57
57
 
58
58
  ### P3. One question at a time, from `templates/project-discovery.md`
59
59
 
60
- For each §1..§8 (demo) or §1..§14 (full), ask in plain language:
60
+ For each §1..§8 (demo) or §1..§15 (full), ask in plain language:
61
61
 
62
62
  ```
63
63
  **Question {N}/{total}:** {question text from the template}
@@ -65,8 +65,11 @@ npx tsc --noEmit # TypeScript — must pass
65
65
  if node -e "const p=require('./package.json');process.exit(p.scripts&&p.scripts.lint?0:1)"; then npm run lint; fi
66
66
  if node -e "const p=require('./package.json');process.exit(p.scripts&&p.scripts.test?0:1)"; then npm test; fi
67
67
  npm run build # Build — must succeed
68
+ node ${QUALIA_BIN}/slop-detect.mjs --severity=critical # Anti-slop — CRITICAL design tells block ship
68
69
  ```
69
70
 
71
+ The `pre-deploy-gate.js` hook re-runs the anti-slop scan at `vercel --prod` time as the hard, non-bypassable gate (OWNER-only `QUALIA_SKIP_SLOP=1` escape). This step surfaces failures early so they're fixed before the deploy command.
72
+
70
73
  On failure:
71
74
  1. Summarize what failed in plain language
72
75
  2. Auto-fix
@@ -118,17 +121,37 @@ if [ $SEC_FAIL -ne 0 ]; then
118
121
  fi
119
122
  ```
120
123
 
121
- ### 3. Git
124
+ ### 3. Integrate to main (ship IS the merge point)
125
+
126
+ Ship is the one place feature work lands on `main`, so `main` is always exactly what's in production and no branch lingers. Commit, then fast-forward-integrate into `main` and push. `branch-guard` records the main push (accountability, not a block — see `rules/infrastructure.md`).
122
127
 
123
128
  ```bash
124
129
  git add {specific changed files}
125
130
  git commit -m "ship: {project name} production deploy"
126
- git push
131
+
132
+ BR=$(git branch --show-current)
133
+ if [ "$BR" != "main" ] && [ "$BR" != "master" ]; then
134
+ git checkout main
135
+ git pull --ff-only origin main 2>/dev/null || true # sync with remote first
136
+ if git merge --ff-only "$BR"; then
137
+ : # clean fast-forward
138
+ else
139
+ # main moved since the branch started — rebase the feature, then ff.
140
+ git checkout "$BR" && git rebase main || {
141
+ node ${QUALIA_BIN}/qualia-ui.js fail "Rebase conflict integrating $BR → main. Resolve, then re-run /qualia-ship."
142
+ exit 1
143
+ }
144
+ git checkout main && git merge --ff-only "$BR"
145
+ fi
146
+ fi
147
+ git push origin HEAD
127
148
  ```
128
149
 
129
- Employee stays on feature branch. Never push to main.
150
+ If anything in this block fails (conflict, push rejected), STOP and surface it — do not deploy a half-integrated tree.
151
+
152
+ ### 4. Deploy (from main)
130
153
 
131
- ### 4. Deploy
154
+ Deploy runs on `main` HEAD — what you just integrated — so the deployed artifact and `main` are byte-identical.
132
155
 
133
156
  ```bash
134
157
  vercel --prod # Website/AI agent
@@ -138,6 +161,16 @@ supabase functions deploy # Edge functions
138
161
  wrangler deploy # Cloudflare Workers
139
162
  ```
140
163
 
164
+ ### 4b. Close the branch
165
+
166
+ On a verified successful deploy, delete the integrated feature branch so nothing lingers (skip if you shipped directly from `main`):
167
+
168
+ ```bash
169
+ if [ -n "$BR" ] && [ "$BR" != "main" ] && [ "$BR" != "master" ]; then
170
+ git branch -d "$BR" 2>/dev/null && git push origin --delete "$BR" 2>/dev/null || true
171
+ fi
172
+ ```
173
+
141
174
  ### 5. Post-Deploy Verification
142
175
 
143
176
  Read the deployed URL from `tracking.json.deployed_url` or from an explicit user-provided URL. Do NOT use a `{domain}` placeholder — that expects the LLM to hallucinate the URL, which is exactly the kind of silent fail the state guard above prevents.
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: qualia-update
3
+ description: "Ship one update to a LAUNCHED project (operate lifecycle). The post-launch counterpart to /qualia-milestone — a lean plan → build → verify → ship loop with no milestone-journey or forced-handoff machinery. Triggers: 'ship an update', 'make a change to the live site', 'the project is live, I need to add X', 'operate mode', 'post-launch change', 'patch the launched product'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
12
+ ---
13
+
14
+ # /qualia-update — ship one update to a launched project
15
+
16
+ The operate-lifecycle counterpart to `/qualia-milestone`. Once a project has
17
+ **launched** (`state.js launch` flips `lifecycle` from `build` to `operate`), it
18
+ is an **update stream**, not a milestone journey: there is no forced
19
+ polish → ship → **handoff** terminal. `/qualia-update` runs one lean change
20
+ cycle and loops. Each completed update bumps `lifetime.updates_completed`.
21
+
22
+ ## Output contract
23
+
24
+ ```
25
+ Command: /qualia-update {change}
26
+ Scope: {files/routes touched}
27
+ Intent: build
28
+ Mutation: planned → active
29
+ Evidence: state.js check, contract-runner output
30
+ Output: shipped update + deployed URL
31
+ Next: /qualia-update (next change) or done
32
+ ```
33
+
34
+ ## Process
35
+
36
+ ### 1. Confirm the project is launched
37
+
38
+ ```bash
39
+ node ${QUALIA_BIN}/state.js check
40
+ ```
41
+
42
+ - `lifecycle: "operate"` → proceed.
43
+ - `lifecycle: "build"` and the product is actually live → launch it first:
44
+ ```bash
45
+ node ${QUALIA_BIN}/state.js launch --deployed-url {url} --source manual
46
+ ```
47
+ (The ERP can also drive this automatically when it detects the project is live.)
48
+ - Still mid-build (never launched, not live) → this is `/qualia-feature` or a
49
+ normal phase, not an update. Route there instead.
50
+
51
+ ### 2. Scope the change (one update = one coherent change)
52
+
53
+ Keep it small and shippable. A bug fix, a copy change, a new section, a single
54
+ feature. If it's larger than ~5 files or needs its own milestone arc, it's a new
55
+ `build`-mode milestone — use `/qualia-milestone`, not an update.
56
+
57
+ ### 2b. Set the work-unit goal
58
+
59
+ Per `rules/codex-goal.md` — set the work-unit goal with scope `feature` (Codex `/goal`; on Claude Code, a tracked task + budget). An update runs its own lean loop without `/qualia-plan`, so set the objective + budget here so the change stays one coherent, bounded unit.
60
+
61
+ ### 3. Run the lean loop
62
+
63
+ Reuse the real lifecycle skills, scoped to this one change:
64
+
65
+ ```
66
+ /qualia-plan {N} # compile the change into a phase + machine contract
67
+ /qualia-build {N} # builders execute, atomic commits
68
+ /qualia-verify {N} # contract-runner evidence + goal-backward check (must PASS)
69
+ ```
70
+
71
+ Verification evidence is mandatory exactly as in build mode — a contract runs and
72
+ its evidence must be clean before PASS. On the final phase, a `verified(pass)`
73
+ in operate routes here again (`next_command: /qualia-update`) and increments
74
+ `lifetime.updates_completed`.
75
+
76
+ ### 4. Ship
77
+
78
+ ```bash
79
+ /qualia-ship # quality gates → commit → deploy → verify live
80
+ ```
81
+
82
+ No handoff. No "final milestone." The deploy is just this update going live. Then
83
+ `/qualia-report` as usual — the report carries `lifecycle: operate` and the
84
+ updated `updates_completed` so the ERP counts updates, not milestones.
85
+
86
+ ### 5. Loop or stop
87
+
88
+ ```bash
89
+ node ${QUALIA_BIN}/qualia-ui.js end "UPDATE SHIPPED" "/qualia-update"
90
+ ```
91
+
92
+ Run `/qualia-update` again for the next change, or stop — an operate project has
93
+ no terminal state to reach.
94
+
95
+ ## Why this exists
96
+
97
+ Hard-coding "every project ends in Handoff" forced launched products and
98
+ retainers into a state machine that fought them. `/qualia-update` + the `operate`
99
+ lifecycle make "this project is live and keeps shipping" explicit state instead
100
+ of a milestone the team is forced to mislabel. See `templates/journey.md` rule 3.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-verify
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'."
3
+ description: "Goal-backward verification of a built phase — a parallel verifier PANEL (one lens each) greps code against acceptance criteria, per-finding adversarial skeptics vote majority-survives, and verify-panel.js aggregates a deterministic verdict. Triggers: 'verify this phase', 'check if it works', 'run verification', 'did the build pass'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -19,7 +19,7 @@ Spawn verifier to check phase goal. Does NOT trust build summaries; greps codeba
19
19
  `/qualia-verify` — verify current built phase
20
20
  `/qualia-verify {N}` — verify specific phase
21
21
  `/qualia-verify {N} --auto` — verify + auto-chain: PASS → next phase/milestone; FAIL → gap closure; gap limit → halt
22
- `/qualia-verify {N} --adversarial` — second verifier in fresh context with adversarial prompt. Union findings. Recommended for high-stakes phases (Handoff, payment/auth/migration).
22
+ `/qualia-verify {N} --adversarial` — deepen the panel: 5 skeptics per finding instead of 3. Recommended for high-stakes phases (Handoff, payment/auth/migration).
23
23
 
24
24
  ## Process
25
25
 
@@ -44,25 +44,39 @@ node ${QUALIA_BIN}/contract-runner.js .planning/phase-{N}-contract.json
44
44
 
45
45
  If it fails, the phase cannot PASS. Still spawn the verifier to explain the failure and identify the smallest gap-closure tasks. If it passes, pass the evidence file into the verifier prompt.
46
46
 
47
- ### 3. Spawn Verifier (Fresh Context)
47
+ ### 3. Spawn Verifier Panel (parallel lenses, fresh context each)
48
+
49
+ A single LLM judge is adversarially fragile (a lone stray token flips ~35% of verdicts). Replace single-pass review with a **panel**: one verifier per *relevant* lens, spawned in parallel (separate `Agent()` calls in the SAME turn), each scoped to one concern and anchored on the SAME machine evidence (contract-run + harness-eval) as shared ground truth.
48
50
 
49
51
  ```bash
50
52
  node ${QUALIA_BIN}/qualia-ui.js banner verify {N} "{phase name}"
51
- node ${QUALIA_BIN}/qualia-ui.js spawn verifier "Goal-backward check..."
52
53
  ```
53
54
 
55
+ Pick lenses by what the phase touches (scale cost to risk — don't run all four on a one-file change):
56
+ - **correctness** — always.
57
+ - **security** — if the plan touches `auth|payment|rls|service_role|migration|secret|upload`.
58
+ - **performance** — if it touches data fetching, network-in-loop, large lists, or `--perf` is set.
59
+ - **design** — if it touches `.tsx/.jsx/.css/.scss` or `app/|components/|pages/`.
60
+
61
+ For each chosen lens `L`, spawn (all in one turn, then wait for all):
62
+
54
63
  ```
55
64
  Agent(prompt="
56
65
  Role: @${QUALIA_AGENTS}/verifier.md
57
66
 
67
+ LENS: {L}. Review ONLY through the {L} lens — concerns owned by other lenses have their own reviewer; do not duplicate them.
68
+
58
69
  Project: @.planning/PROJECT.md
59
70
  Plan + AC + validation: @.planning/phase-{N}-plan.md
60
71
  Machine contract: @.planning/phase-{N}-contract.json
61
- Contract evidence: @.planning/evidence/phase-{N}-contract-run.json
72
+ Contract evidence (shared ground truth — do not re-derive): @.planning/evidence/phase-{N}-contract-run.json
62
73
  {Re-verify → previous gaps: @.planning/phase-{N}-verification.md}
63
74
 
64
- Verify phase. Every finding needs file:line evidence. Severity Rubric for all labels. Output: .planning/phase-{N}-verification.md
65
- ", subagent_type="qualia-verifier", description="Verify phase {N}")
75
+ Verify the {L} concerns of this phase. Every finding needs file:line evidence and a Severity Rubric label.
76
+ Write your findings as a JSON array to .planning/phase-{N}-panel-{L}.json:
77
+ [{\"file\":\"path\",\"line\":N,\"severity\":\"CRITICAL|HIGH|MEDIUM|LOW\",\"title\":\"one-line claim\"}]
78
+ Empty array [] if the {L} lens is clean. Also append a human '## {L} lens' section to .planning/phase-{N}-verification.md.
79
+ ", subagent_type="qualia-verifier", description="Verify phase {N} — {L} lens")
66
80
  ```
67
81
 
68
82
  ### 3b. Browser QA (if phase touched frontend)
@@ -89,34 +103,41 @@ Drive dev server, test routes phase touched. Append '## Browser QA' to verificat
89
103
 
90
104
  Wait for both verifier + QA before step 3. Playwright MCP unavailable → QA returns BLOCKED (note, not phase failure).
91
105
 
92
- ### 3c. Adversarial Second Opinion (--adversarial flag, optional)
106
+ ### 3c. Skeptic Pass + Deterministic Aggregation
107
+
108
+ The panel FINDS; skeptics decide what's REAL; `verify-panel.js` decides the verdict — math, not a vibe.
93
109
 
94
- `--adversarial` in args, OR milestone is `Handoff`, OR plan touches `auth|payment|migration|rls|service_role` → spawn SECOND verifier in fresh context. Mitigates self-grading bias (~70% fewer findings without adversarial pass).
110
+ **1. Assemble** the per-lens finding files into one panel skeleton (votes zeroed):
95
111
 
96
112
  ```bash
97
- node ${QUALIA_BIN}/qualia-ui.js spawn verifier "Adversarial pass — find what's wrong"
113
+ node ${QUALIA_BIN}/verify-panel.js assemble {N} # .planning/phase-{N}-panel.json
98
114
  ```
99
115
 
116
+ **2. Skeptic vote** on each CRITICAL/HIGH finding (MEDIUM/LOW auto-survive — they don't flip the C/H verdict; skipping skeptics on them is the documented cost bound, not a silent cap). For each such finding spawn **3 skeptics** (5 if `--adversarial`, Handoff milestone, or the finding's lens is `security`), each in fresh context, each prompted to REFUTE:
117
+
100
118
  ```
101
119
  Agent(prompt="
102
120
  Role: @${QUALIA_AGENTS}/verifier.md
103
121
 
104
- ADVERSARIAL reviewer. Find what's WRONG. Assume cooperative verifier missed something. Same Severity Rubric + evidence-citation req. Bias toward edge cases:
105
- - Untested error paths?
106
- - Crash-inducing input?
107
- - Unhandled concurrent access?
108
- - Downstream breaks if contract changes?
109
- - Security assumption (auth, RLS, secrets) implicit not enforced?
122
+ SKEPTIC. A panel verifier claims this finding. Try to REFUTE it: is it actually reachable on a real path, or already handled elsewhere, or a false positive? Default to refuted ONLY with evidence uncertainty is NOT refutation.
110
123
 
111
- Project: @.planning/PROJECT.md
112
- Plan: @.planning/phase-{N}-plan.md
113
- Cooperative report (find what they MISSED): @.planning/phase-{N}-verification.md
124
+ Finding: {severity} — {title}
125
+ Location: {file}:{line}
126
+ Evidence to re-check yourself: @{file}
114
127
 
115
- Append '## Adversarial Findings' to verification file. Empty section fine if nothing found.
116
- ", subagent_type="qualia-verifier", description="Adversarial verify phase {N}")
128
+ Return exactly one line: REAL {file:line reason} OR NOT_REAL {file:line reason}
129
+ ", subagent_type="qualia-verifier", description="Skeptic {i}/3 {title}")
117
130
  ```
118
131
 
119
- Findings merge into main report. Union PASS/FAIL: either pass found CRITICAL/HIGH → phase FAIL.
132
+ Tally each finding's votes into `.planning/phase-{N}-panel.json` (`votes.real` / `votes.notReal`).
133
+
134
+ **3. Aggregate** deterministically:
135
+
136
+ ```bash
137
+ node ${QUALIA_BIN}/verify-panel.js .planning/phase-{N}-panel.json --write
138
+ ```
139
+
140
+ `verify-panel.js` dedupes findings across lenses, applies **majority-survives** (a finding is killed only when skeptics are a strict majority calling it not-real; ties and unvoted findings survive), computes category scores via the `rules/grounding.md` formula, and exits **0 = PASS / 1 = FAIL** (any surviving CRITICAL/HIGH → FAIL). That exit code IS the panel verdict — carry it into step 4. Artifacts: `.planning/phase-{N}-verification-panel.{json,md}`.
120
141
 
121
142
  ### 3d. INSUFFICIENT EVIDENCE downgrade (mandatory)
122
143
 
@@ -132,7 +153,7 @@ if [ "$IE_COUNT" -gt 0 ]; then
132
153
  fi
133
154
  ```
134
155
 
135
- The same check runs after the adversarial pass if it executed.
156
+ The same check runs across every lens section the panel wrote.
136
157
 
137
158
  ### 3. Present Results
138
159
 
@@ -175,7 +196,13 @@ Write the deterministic eval artifact before changing state:
175
196
  node ${QUALIA_BIN}/harness-eval.js --phase {N} --run --write
176
197
  ```
177
198
 
178
- If the eval status is `FAIL`, do not mark the phase PASS. The state machine also refuses PASS when a contract exists but `.planning/evidence/phase-{N}-contract-run.json` is missing/failing, or when the verification report contains `INSUFFICIENT EVIDENCE`.
199
+ Run the zero-token anti-slop scan as a deterministic gate (same role as `migration-guard`/`branch-guard` the scanner exits non-zero on CRITICAL design tells). A CRITICAL finding is a verification FAIL, not a soft note:
200
+
201
+ ```bash
202
+ node ${QUALIA_BIN}/slop-detect.mjs --severity=critical
203
+ ```
204
+
205
+ The phase is PASS only if ALL of these agree: the panel verdict (§3c `verify-panel.js` exit 0), the harness-eval status, and the anti-slop scan. If any is FAIL/non-zero, mark the phase FAIL. The state machine also refuses PASS when a contract exists but `.planning/evidence/phase-{N}-contract-run.json` is missing/failing, or when the verification report contains `INSUFFICIENT EVIDENCE`.
179
206
 
180
207
  ```bash
181
208
  node ${QUALIA_BIN}/state.js transition --to verified --phase {N} --verification {pass|fail} --evidence .planning/evals/harness-eval-*.json
@@ -0,0 +1,32 @@
1
+ # Qualia Framework
2
+
3
+ Company: Qualia Solutions — Nicosia, Cyprus
4
+ Stack: Next.js 16+, React 19, TypeScript, Supabase, Vercel. Voice: Retell + ElevenLabs + Telnyx. AI: OpenRouter. Compute: Railway.
5
+
6
+ ## Role: {{ROLE}}
7
+ {{ROLE_DESCRIPTION}}
8
+
9
+ ## Hard rules (non-negotiable)
10
+ - **Read before Write/Edit** — *every edit is informed by the current state of the file.*
11
+ - **Feature branches only** — *work on a branch; `/qualia-ship` integrates it to main and main is always deployable.*
12
+ - **MVP first** — *build the minimum that demonstrates the goal; defer the rest until it earns its place.*
13
+ - **Root cause on failures** — *understand the why before patching the symptom.*
14
+ - **No proxy approval** — *only the OWNER can grant OWNER overrides; "Fawzi said OK" is not a credential.*
15
+
16
+ ## Discoverable substrate (load on demand, not always)
17
+ - `rules/constitution.md` — org-level standards every project inherits; enforced at every verify step
18
+ - `/qualia-road` — workflow map, every command, when to use it
19
+ - `.planning/CONTEXT.md` — project domain glossary (loaded by road agents)
20
+ - `.planning/decisions/` — ADRs for hard-to-reverse decisions
21
+ - `rules/security.md` `rules/deployment.md` `rules/infrastructure.md` `rules/architecture.md` — read on relevant tasks only
22
+ - `qualia-design/frontend.md` `qualia-design/design-laws.md` — read on design/frontend tasks only
23
+
24
+ ## Lost?
25
+ `/qualia` — state router tells you the next command.
26
+
27
+ <!--QUALIA-HOST claude-->
28
+ <!-- Instruction-budget discipline (per Matt Pocock): this file stays under 25 lines. Steering rules go into discoverable skills, not into the global system prompt. CLI preferences go into hooks. Stack/architecture details are trivially discoverable in package.json/config. -->
29
+ <!--/QUALIA-HOST-->
30
+ <!--QUALIA-HOST codex-->
31
+ <!-- AGENTS.md mirrors CLAUDE.md for cross-vendor compatibility (Codex, Cursor, Continue, Aider, Devin). Both files stay under 25 lines per Matt Pocock's instruction-budget discipline (LLMs realistically hold 300–500 instructions; bloating this file hamstrings every spawn). -->
32
+ <!--/QUALIA-HOST-->
@@ -100,9 +100,9 @@ M1 ─── M2 ─── M3 ─── ... ─── M{N} (Handoff)
100
100
 
101
101
  ## Rules for This Journey
102
102
 
103
- 1. **Hard ceiling: 5 milestones.** If the project needs more, defer to a v2 release after handoff.
103
+ 1. **No milestone ceiling the arc spans the whole agreed scope.** Plan as many milestones as the capability inventory (discovery §9) needs to reach the §10 done-state. Do NOT compress real work to hit a number, and do NOT defer agreed work to a "v2" the only deferrals are what the client explicitly marked Out of Scope (discovery §8). An arc that stops short of the agreed scope is the root cause of teams improvising off-plan later.
104
104
  2. **Hard floor: 2 milestones.** Anything smaller should use `/qualia-new --quick` instead.
105
- 3. **The final milestone is always Handoff.** Same 4 phases every project. Never negotiable.
105
+ 3. **In BUILD mode, the final milestone is Handoff.** This is the convention for a one-shot client build that ends with a handoff. It is **not** a universal law: once a project launches and enters the `operate` lifecycle (`state.js launch`), it becomes an *update stream* with no forced Handoff — it ships updates indefinitely. Don't author a Handoff milestone for a product/retainer that will keep shipping; launch it instead.
106
106
  4. **Milestones ≥ 2 phases OR are a shipped release gate.** A 1-phase milestone is a phase, not a milestone.
107
107
  5. **Numbering is contiguous.** No skipped milestone numbers.
108
108
  6. **Progressive detail is OK.** M1 is fully detailed (ready for `/qualia-plan`). M2..M{N-1} have phase names + one-line goals. Full phase detail gets written by roadmapper when the milestone opens.
@@ -6,9 +6,9 @@ discovery_mode: project
6
6
 
7
7
  # Project Discovery, {Project Name}
8
8
 
9
- The non-technical kickoff interview output. `/qualia-scope` writes this in PROJECT MODE before `/qualia-new` generates JOURNEY.md. Captures intent, audience, brand, and constraints in the user's own words.
9
+ The non-technical kickoff interview output. `/qualia-scope` writes this in PROJECT MODE before `/qualia-new` generates JOURNEY.md. Captures intent, audience, brand, constraints — and, for full projects, the **complete capability set that defines the project as DONE** so the roadmap can span the whole arc, not a v1 slice.
10
10
 
11
- Demo path: 8 questions. Full-project path: 14 questions.
11
+ Demo path: §1–§8 (8 questions). Full-project path: §1–§15 (adds the completeness pass + delivery questions).
12
12
 
13
13
  ## 1. The one-line pitch
14
14
 
@@ -36,48 +36,55 @@ Demo path: 8 questions. Full-project path: 14 questions.
36
36
 
37
37
  ## 7. Hard constraints
38
38
 
39
- > {Anything that is non-negotiable: stack, deadline, compliance, integrations, budget.}
39
+ > {Anything non-negotiable: stack, deadline, compliance, integrations, budget.}
40
40
 
41
- ## 8. Out of scope
41
+ ## 8. Out of scope (explicitly deferred)
42
42
 
43
- > {What is intentionally NOT in this project, even if it would be obvious to add.}
43
+ > {What is intentionally NOT in this project — work the client has consciously deferred, even if obvious to add. This is the ONLY place work leaves the arc; anything not listed here is in-scope and must land in a milestone.}
44
44
 
45
45
  ---
46
46
 
47
- The remaining six questions only run for `project_type: full`. Demo mode stops here.
47
+ The remaining questions only run for `project_type: full`. Demo mode stops here.
48
48
 
49
- ## 9. Milestone arc, in the client's words
49
+ ## 9. Capability inventory the WHOLE project
50
50
 
51
- > {After the demo, what's the next chapter? After that, what's the chapter after? Stop at three to five chapters total. The last chapter is always Handoff.}
51
+ > {List EVERY capability this project must have to be considered finished — not a v1 slice, the whole thing. One bullet per capability, plain language. Push for completeness: "what else does it need before you'd call it done?" Keep asking until the client says "that's everything." This list becomes the REQ-IDs and milestones anything missing here is what the team is later forced to improvise, so it is the most important answer in the interview.}
52
52
 
53
- ## 10. Compliance and legal
53
+ ## 10. Definition of done — for the entire project
54
+
55
+ > {Describe the end state where there is no more agreed work. What is true when the project is finished and the team stops? This anchors the final milestone (Handoff for client projects) and tells the roadmapper how far the arc must reach.}
56
+
57
+ ## 11. Shipping order
58
+
59
+ > {Roughly what order should the capabilities in §9 ship in? Group them into chapters if natural. We shape milestones from this — as many as the scope needs, no artificial cap. For client projects the last chapter is Handoff; for an internal or ongoing product it may have no Handoff.}
60
+
61
+ ## 12. Compliance and legal
54
62
 
55
63
  > {Anything regulated: payments, medical, legal, finance, accessibility commitments, data residency.}
56
64
 
57
- ## 11. Integrations
65
+ ## 13. Integrations
58
66
 
59
67
  > {Third-party systems this must talk to, in priority order.}
60
68
 
61
- ## 12. Content and copy
69
+ ## 14. Content and copy
62
70
 
63
71
  > {Who writes the copy and where does it live, today and after handoff?}
64
72
 
65
- ## 13. Team and roles after handoff
73
+ ## 15. Ownership, team, and delivery shape
66
74
 
67
- > {Who maintains this after we ship? What can they do, what can't they do?}
68
-
69
- ## 14. Budget and timeline shape
70
-
71
- > {Fixed deadline, fixed scope, or fixed budget? Pick one — the other two flex.}
75
+ > {Who maintains this after we ship what can they do, what can't they? And: fixed deadline, fixed scope, or fixed budget? Pick one — the other two flex.}
72
76
 
73
77
  ---
74
78
 
75
79
  ## How this feeds `/qualia-new`
76
80
 
77
- - §15 seed PROJECT.md (one-line pitch, what we're building) and PRODUCT.md (users, register, voice, anti-references).
81
+ - §1–§5 seed PROJECT.md (one-line pitch, what we're building) and PRODUCT.md (users, register, voice, anti-references).
78
82
  - §6 becomes the first row of the success-criteria table in ROADMAP.md.
79
- - §7-§8 populate PROJECT.md's "Out of Scope" and the constraints section.
80
- - §9 (full only) seeds JOURNEY.md milestone names + "why now" lines.
81
- - §10-§14 (full only) feed research scoping and the Handoff milestone checklist.
82
-
83
- Demo projects skip §9-§14 because they ARE one milestone the journey is just that milestone plus an implicit "client signs, we extend" branch handled by `/qualia-milestone`.
83
+ - §7 populates PROJECT.md's constraints section.
84
+ - §8 populates PROJECT.md's "Out of Scope" the explicit, client-agreed deferrals (the roadmapper must NOT defer anything else here).
85
+ - **§9 (full only) is the capability inventory every item becomes a REQ-ID in REQUIREMENTS.md, assigned to exactly one milestone. The roadmapper must cover ALL of §9 across the arc — no overflow into an unplanned "v2".**
86
+ - **§10 (full only) defines the arc's endpoint → the roadmapper builds milestones until the whole capability set reaches this done-state.**
87
+ - §11 (full only) seeds JOURNEY.md milestone order + "why now" lines (no milestone cap the arc is as long as §9 requires).
88
+ - §12–§15 (full only) feed research scoping, integrations, and the Handoff milestone checklist.
89
+
90
+ Demo projects skip §9–§15 because they ARE one milestone — the journey is just that milestone plus an implicit "client signs, we extend" branch handled by `/qualia-milestone`.