qualia-framework 6.3.0 → 6.5.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 -8
  2. package/CLAUDE.md +6 -5
  3. package/README.md +17 -39
  4. package/bin/cli.js +64 -16
  5. package/bin/command-surface.js +6 -1
  6. package/bin/install.js +26 -11
  7. package/bin/learning-candidates.js +217 -0
  8. package/bin/prune-deprecated.js +64 -0
  9. package/bin/qualia-ui.js +1 -0
  10. package/bin/runtime-manifest.js +4 -0
  11. package/bin/security-scan.js +409 -0
  12. package/bin/state.js +106 -1
  13. package/bin/status-snapshot.js +363 -0
  14. package/guide.md +18 -33
  15. package/hooks/pre-compact.js +232 -0
  16. package/package.json +8 -2
  17. package/references/archetypes/ai-agent.md +89 -0
  18. package/references/archetypes/voice-agent.md +60 -0
  19. package/references/archetypes/web-app.md +67 -0
  20. package/references/archetypes/website.md +78 -0
  21. package/rules/constitution.md +42 -0
  22. package/skills/qualia/SKILL.md +3 -1
  23. package/skills/qualia-build/SKILL.md +1 -1
  24. package/skills/qualia-discuss/SKILL.md +1 -1
  25. package/skills/qualia-doctor/SKILL.md +1 -1
  26. package/skills/qualia-feature/SKILL.md +1 -1
  27. package/skills/qualia-fix/SKILL.md +1 -1
  28. package/skills/qualia-idk/SKILL.md +245 -0
  29. package/skills/qualia-learn/SKILL.md +1 -1
  30. package/skills/qualia-map/SKILL.md +1 -1
  31. package/skills/qualia-milestone/SKILL.md +1 -1
  32. package/skills/qualia-new/SKILL.md +1 -1
  33. package/skills/qualia-optimize/SKILL.md +1 -1
  34. package/skills/qualia-plan/SKILL.md +1 -1
  35. package/skills/qualia-polish/SKILL.md +1 -1
  36. package/skills/qualia-postmortem/SKILL.md +1 -1
  37. package/skills/qualia-report/SKILL.md +1 -1
  38. package/skills/qualia-research/SKILL.md +1 -1
  39. package/skills/qualia-review/SKILL.md +1 -1
  40. package/skills/qualia-road/SKILL.md +1 -1
  41. package/skills/qualia-scope/SKILL.md +123 -0
  42. package/skills/qualia-secure/SKILL.md +105 -0
  43. package/skills/qualia-test/SKILL.md +1 -1
  44. package/skills/qualia-verify/SKILL.md +1 -1
  45. package/skills/zoho-workflow/SKILL.md +1 -1
  46. package/tests/bin.test.sh +9 -9
  47. package/tests/install-smoke.test.sh +3 -3
  48. package/tests/lib.test.sh +17 -10
  49. package/tests/published-install-smoke.test.sh +3 -3
  50. package/tests/refs.test.sh +29 -22
  51. package/tests/runner.js +3 -3
  52. package/tests/state.test.sh +38 -7
  53. package/docs/archive/CHANGELOG-pre-v4.md +0 -855
  54. package/docs/archive/v4.0.0-review.md +0 -288
  55. package/docs/ecosystem-operating-model.md +0 -121
  56. package/docs/research/2026-04-21-command-quality-deep-research.md +0 -128
  57. package/docs/research/2026-04-21-industry-best-practices.md +0 -255
  58. package/docs/research/2026-05-11-deep-research.md +0 -189
  59. package/docs/reviews/matt-pocock-skills-analysis.md +0 -300
  60. package/docs/reviews/v4.1.0-audit.html +0 -1488
  61. package/docs/reviews/v4.1.0-audit.md +0 -263
  62. package/docs/reviews/v6.2.1-revival-audit.md +0 -53
  63. package/docs/reviews/v6.2.2-memory-erp-audit.md +0 -41
  64. package/docs/reviews/v6.2.3-erp-id-guard.md +0 -15
@@ -1,288 +0,0 @@
1
- # v4.0.0 — Review & Publish Handoff
2
-
3
- **Date:** 2026-04-18
4
- **Branch:** `feature/full-journey`
5
- **Release tag:** v4.0.0 (not yet tagged, not yet pushed)
6
- **Status:** Ready for review. Tests 156/156 green. Needs human eyeball before `git push` + `npm publish`.
7
-
8
- This document is the single source of truth for what shipped in v4.0.0 and what the next agent/reviewer needs to verify before the release goes public.
9
-
10
- ---
11
-
12
- ## TL;DR
13
-
14
- The Qualia Framework v4.0.0 makes `/qualia-new` produce the **entire project journey** (all milestones → Handoff) upfront, enables **end-to-end auto-chaining** of the Road with `--auto`, locks down the **milestone/phase/task hierarchy**, and **rebuilds `/qualia-idk` as a real diagnostician** instead of a router alias.
15
-
16
- 10 commits on `feature/full-journey` (8 feature + 1 docs + 1 release-state fix). ~28 files touched. 156/156 tests green.
17
-
18
- Two local branches, neither pushed:
19
-
20
- | Branch | HEAD | Ships |
21
- |---|---|---|
22
- | `feature/story-file-plans` | `8ae5b0e` | v3.7.0 — story-file plan format (independent, useful on its own) |
23
- | `feature/full-journey` | `f790554` | v4.0.0 — full journey, auto-chain, diagnostic idk (includes v3.7.0) |
24
-
25
- ---
26
-
27
- ## The commits on `feature/full-journey`
28
-
29
- ```
30
- 94bc119 fix(v4): correct v4.0.0 — fold qualia-idk changelog entries into initial release
31
- ea9e7f3 docs(v4): README, guide.md, SESSION_REPORT updated for v4.0.0 + V4_REVIEW.md handoff
32
- f790554 release(v4.0.0): full journey — kickoff to handoff on rails
33
- f62e753 fix(v4/phase-g): milestone summary cumulative task count + smoke tests
34
- b41a52d feat(v4/phase-f): build_count + deploy_count bump, ERP v4 payload, handoff 4-deliverables
35
- 74dd26e feat(v4/phase-d-e): builder pre-inline + journey visualization
36
- 400cd17 feat(v4/phase-c): auto-chain wiring across Road skills
37
- 87af253 feat(v4/phase-b): roadmapper + qualia-new full-journey output
38
- 2e371c2 feat(v4/phase-a): model foundation — milestones[] + readiness guards
39
- 8ae5b0e release(v3.7.0): story-file plan format (from feature/story-file-plans)
40
- ```
41
-
42
- **Release-point:** `94bc119` is the canonical v4.0.0 HEAD (package.json = "4.0.0", CHANGELOG has a single [4.0.0] section with `/qualia-idk` folded in). Tag v4.0.0 at this commit.
43
-
44
- ---
45
-
46
- ## What v4.0.0 actually changes
47
-
48
- ### Hierarchy (locked down)
49
- ```
50
- Project
51
- └─ Journey (all milestones defined upfront)
52
- └─ Milestone (a release — 2-5 total, Handoff is always last)
53
- └─ Phase (2-5 tasks per phase)
54
- └─ Task (one commit, one verification contract)
55
- ```
56
-
57
- - Hard floor: 2 milestones. Hard ceiling: 5.
58
- - Final milestone is **always literally named "Handoff"** with 4 fixed phases (Polish, Content + SEO, Final QA, Handoff).
59
- - Every non-Handoff milestone needs **≥ 2 phases** (guarded by `state.js close-milestone`).
60
- - Milestone numbering is **contiguous** — no skipped numbers.
61
-
62
- ### New artifact: `.planning/JOURNEY.md`
63
- The North Star. Lists every milestone with why-now + exit criteria + phase sketches. Written once during `/qualia-new`, consulted at every milestone boundary.
64
-
65
- ### Auto mode (`--auto` flag)
66
- ```
67
- /qualia-new --auto
68
- → research runs automatically
69
- → JOURNEY.md written
70
- → SINGLE human approval on the whole journey
71
- → plan 1 → build 1 → verify 1 → plan 2 → build 2 → verify 2 → ...
72
- → [milestone boundary — HUMAN GATE: "Continue to M{N+1}?"]
73
- → ... repeat until Handoff last phase ...
74
- → /qualia-ship → /qualia-handoff → /qualia-report → DONE
75
- ```
76
-
77
- **Two human gates total per project** (journey approval + each milestone boundary). Plus one halt if gap-cycle limit exceeded on a failed phase.
78
-
79
- ### `/qualia-idk` now diagnostic (not a router alias)
80
- Spawns two isolated `Explore` subagents in parallel:
81
- 1. **Plan view** — reads only `.planning/*`, reports what plan says we are + what should be TRUE
82
- 2. **Code view** — reads only source code, reports what's built + what compiles + what's stubbed, cites file:line
83
-
84
- Main skill synthesizes: "What I see / The mismatch / What I think is happening / What to do next."
85
-
86
- ### `/qualia` description scoped back to state routing
87
- Previously claimed "idk / stuck / lost / confused" triggers. Those now route to `/qualia-idk`. `/qualia` keeps "what next / what now / next command."
88
-
89
- ### Schema changes (all additive, backward compatible)
90
- `tracking.json` gains:
91
- - `milestone_name` — human name of current milestone
92
- - `milestones[]` — array of closed milestone summaries (for ERP tree render)
93
- - `build_count`, `deploy_count` — now actually incremented on transitions
94
-
95
- `state.js` check output gains `milestone_name` + `milestones`.
96
-
97
- `qualia-report` ERP payload now includes all v4 fields.
98
-
99
- ---
100
-
101
- ## How to verify before publishing
102
-
103
- ### 1. Run the test suite
104
- ```bash
105
- cd /home/qualiasolutions/qualia-framework
106
- node --test tests/runner.js
107
- ```
108
- Expected: `# pass 156 / # fail 0`.
109
-
110
- ### 2. Visual smoke test of new UI commands
111
- ```bash
112
- # Make a fake project
113
- TMP=/tmp/qualia-v4-visual && rm -rf $TMP && mkdir -p $TMP/.planning
114
- cat > $TMP/.planning/JOURNEY.md <<'EOF'
115
- ---
116
- project: "Demo"
117
- ---
118
- ## Milestone 1 · Foundation
119
- **Why now:** Base infra.
120
- **Phases:**
121
- 1. **Setup**
122
- 2. **Auth**
123
- ## Milestone 2 · Core Features
124
- **Why now:** Value delivery.
125
- **Phases:**
126
- 1. **Feature A**
127
- 2. **Feature B**
128
- ## Milestone 3 · Handoff
129
- **Phases:**
130
- 1. **Polish**
131
- 2. **Content + SEO**
132
- 3. **Final QA**
133
- 4. **Handoff**
134
- EOF
135
- cat > $TMP/.planning/tracking.json <<'EOF'
136
- {"milestone":2,"milestone_name":"Core Features","milestones":[],"phase":1,"total_phases":2,"status":"built","lifetime":{"tasks_completed":4,"phases_completed":2,"milestones_completed":1}}
137
- EOF
138
- cat > $TMP/.planning/STATE.md <<'EOF'
139
- ## Current Position
140
- Phase: 1 of 2 — Feature A
141
- Status: built
142
- Assigned to: Reviewer
143
-
144
- ## Roadmap
145
- | # | Phase | Goal | Status |
146
- |---|-------|------|--------|
147
- | 1 | Feature A | x | built |
148
- | 2 | Feature B | x | — |
149
- EOF
150
- (cd $TMP && node /home/qualiasolutions/qualia-framework/bin/qualia-ui.js journey-tree .planning/JOURNEY.md)
151
- node /home/qualiasolutions/qualia-framework/bin/qualia-ui.js milestone-complete 1 "Foundation" "Core Features"
152
- node /home/qualiasolutions/qualia-framework/bin/qualia-ui.js milestone-complete 3 "Handoff" ""
153
- rm -rf $TMP
154
- ```
155
- Expected:
156
- - Journey tree shows green dot on M1, teal diamond on M2 (CURRENT), dim circle on M3 (FINAL).
157
- - First milestone-complete banner shows `Next: Core Features`.
158
- - Second shows `PROJECT COMPLETE · last milestone reached`.
159
-
160
- ### 3. State-machine end-to-end smoke
161
- Covered by test case `tests/runner.js` "milestone summary captures cumulative tasks_completed" and "build_count bumps on each 'built' transition". Both pass.
162
-
163
- ### 4. Manual eyeball of key files
164
- Review these for v4 correctness:
165
-
166
- | File | Why |
167
- |---|---|
168
- | `templates/journey.md` | New artifact schema — is the format clear and complete? |
169
- | `agents/roadmapper.md` | Biggest agent rewrite — does it correctly describe the 3-file output (JOURNEY + REQUIREMENTS + ROADMAP)? |
170
- | `skills/qualia-new/SKILL.md` | Core flow — is the 14-step process coherent? Is `--auto` wiring clear? |
171
- | `skills/qualia-idk/SKILL.md` | New diagnostic — does the 2-pass isolation make sense? Is the synthesis format useful? |
172
- | `skills/qualia-verify/SKILL.md` | Auto-chain decision table (PASS → next phase / last phase → milestone / last milestone → ship) |
173
- | `skills/qualia-milestone/SKILL.md` | Reads next milestone from JOURNEY.md now, not user prompt |
174
- | `skills/qualia-handoff/SKILL.md` | 4 mandatory deliverables enforced |
175
- | `bin/state.js` lines ~975-1050 | close-milestone readiness guards + milestones[] summary append |
176
- | `bin/qualia-ui.js` journey-tree + milestone-complete | New visualizations |
177
- | `CHANGELOG.md` [4.0.0] section | Full feature list + migration notes |
178
-
179
- ### 5. Backward-compat verification
180
- The v4 changes are designed additive. Verify by:
181
- ```bash
182
- # tracking.json from an older project (no milestones[], no milestone_name)
183
- # should still work with state.js check
184
- echo '{"milestone":1,"phase":1,"total_phases":3,"status":"setup","lifetime":{"tasks_completed":0,"phases_completed":0,"milestones_completed":0,"total_phases":0}}' > /tmp/old-tracking.json
185
- mkdir -p /tmp/old-project/.planning && mv /tmp/old-tracking.json /tmp/old-project/.planning/tracking.json
186
- cat > /tmp/old-project/.planning/STATE.md <<'EOF'
187
- Phase: 1 of 3 — Setup
188
- Status: setup
189
-
190
- ## Roadmap
191
- | # | Phase | Goal | Status |
192
- |---|-------|------|--------|
193
- | 1 | Setup | x | ready |
194
- | 2 | Feature | x | — |
195
- | 3 | Ship | x | — |
196
- EOF
197
- (cd /tmp/old-project && node /home/qualiasolutions/qualia-framework/bin/state.js check | head -20)
198
- rm -rf /tmp/old-project
199
- ```
200
- Expected: `check` succeeds, output includes `milestones: []` and `milestone_name: ""` (hydrated by `ensureLifetime`).
201
-
202
- ---
203
-
204
- ## Publish checklist
205
-
206
- Once review passes:
207
-
208
- ```bash
209
- # 1. Push both branches
210
- git push -u origin feature/story-file-plans
211
- git push -u origin feature/full-journey
212
-
213
- # 2. Merge v3.7.0 first (recommended — gives it a distinct tag in history)
214
- git checkout main
215
- git merge --ff-only feature/story-file-plans
216
- git tag v3.7.0
217
- git push origin main --tags
218
-
219
- # 3. Merge v4.0.0
220
- git merge --ff-only feature/full-journey
221
- # If fast-forward fails (unlikely since v4 branched off story-file-plans HEAD):
222
- # git merge feature/full-journey # creates a merge commit — also fine
223
- git tag v4.0.0
224
- git push origin main --tags
225
-
226
- # 4. npm publish
227
- npm publish
228
- # Expected: qualia-framework@4.0.0 goes live. Auto-update hook notifies
229
- # every team member's installed client on next session.
230
-
231
- # 5. Verify
232
- npm view qualia-framework version # should return 4.0.0
233
- ```
234
-
235
- ### Alternative: one combined release
236
- If the team would rather have a single v4.0.0 release tag (skip the v3.7.0 tag):
237
-
238
- ```bash
239
- git checkout main
240
- git merge --ff-only feature/full-journey
241
- git tag v4.0.0
242
- git push origin main --tags
243
- npm publish
244
- ```
245
- (v3.7.0 work is still in the history, just not tagged as its own release.)
246
-
247
- ---
248
-
249
- ## Risk areas (eyeball these)
250
-
251
- 1. **Auto-chain logic in `/qualia-verify`** — the decision table (PASS → next phase / last phase of milestone / last phase of Handoff / FAIL gap / FAIL limit) is described in the SKILL.md but relies on Claude to parse JOURNEY.md at runtime to detect "last phase of milestone." Smoke test didn't actually run the auto-chain because that requires live subagent invocation. **Recommended first test on merge**: run `/qualia-new --auto` on a throwaway project and watch how it handles the milestone boundary.
252
-
253
- 2. **Roadmapper's new three-file output** — the rewritten agent prompt is long and complex. The roadmapper must:
254
- - Generate JOURNEY.md with all milestones
255
- - Assign requirements to milestones
256
- - Only detail Milestone 1 in ROADMAP.md
257
- - Pass `--milestone_name` to `state.js init`
258
- Smoke test didn't exercise the roadmapper directly — it's only triggered by `/qualia-new`.
259
-
260
- 3. **`/qualia-idk`'s two-pass isolation** — depends on `Explore` subagent correctly NOT crossing its scope. If an Explore agent reads .planning/ when told "code only" or vice versa, the diagnosis degrades. The SKILL.md has explicit "DO NOT read..." instructions but this is prompt-level enforcement, not hard boundary.
261
-
262
- 4. **Builder pre-inline context** — saves tool calls but inflates prompt size. On very large projects (PROJECT.md + DESIGN.md + 5 context files could easily be 10k+ tokens), the builder's prompt might balloon. Acceptable for most projects; watch for issues on monorepos.
263
-
264
- ---
265
-
266
- ## Known limitations / deferred
267
-
268
- - **No visual / mockup generation** (gstack's `/design-shotgun` or Superpowers' Visual Companion). Not in v4 — could be a v4.1 feature.
269
- - **No cross-model review** (gstack's `/codex`). Not in v4.
270
- - **No cross-project vector memory** (Claude-Flow's claude-mem pattern). Current `knowledge/` is still hand-authored markdown.
271
- - **No IDE integration** (VS Code extension, JetBrains plugin). Claude Code CLI only.
272
- - **No token-budget compression** (SuperClaude's ~70% compression claim). Qualia relies on fresh-context agents instead of compression.
273
-
274
- These are all discussed in the competitive gap analysis done earlier in the session — see the chat transcript or memory for details.
275
-
276
- ---
277
-
278
- ## Questions for Fawzi before publish
279
-
280
- 1. **Single v4.0.0 release or v3.7.0 + v4.0.0?** Default: both tags (v3.7.0 as a step release). Cleaner history. Alternative: fold into single v4.0.0.
281
- 2. **Alpha/beta tag on npm?** `npm publish` without `--tag` goes to `latest` and every installed client auto-updates on next session. If you want a slower rollout, publish with `--tag beta` and the team opts in manually with `npm install qualia-framework@beta install`.
282
- 3. **Do you want to dogfood v4 on an existing project before publish?** Running `npx qualia-framework@4.0.0-alpha install` locally on Sakani or another project is the safest way to verify end-to-end — especially the auto-chain which isn't covered by the unit tests.
283
-
284
- Contact for questions: Fawzi Goussous — fawzi@qualiasolutions.net
285
-
286
- ---
287
-
288
- *Generated 2026-04-18 by the v4 build session. Review this doc + CHANGELOG.md [4.0.0] before publishing.*
@@ -1,121 +0,0 @@
1
- # Qualia Ecosystem Operating Model
2
-
3
- The three systems have different jobs:
4
-
5
- | Layer | System | Owns |
6
- |---|---|---|
7
- | Execution | Qualia Framework | Planning, building, verifying, shipping, handoff, and reporting inside a project repo. |
8
- | Knowledge | Qualia Memory | Lessons, client preferences, recurring mistakes, durable research, and reusable patterns. |
9
- | Operations | Qualia ERP | Live clients, projects, assignments, milestones, reports, invoices, payments, schedules, dashboards, and client portal state. |
10
-
11
- Short version: **Framework builds. Memory remembers. ERP operates.**
12
-
13
- ## Boundaries
14
-
15
- - Framework `.planning/` is execution state for agents and local reporting.
16
- - ERP is the operational source of truth for admin and employee visibility.
17
- - Memory stores durable knowledge, not live operational status.
18
- - Read.ai and meeting tools are inputs, not a fourth source of truth.
19
-
20
- ## Safe Flows
21
-
22
- ### ERP to Framework
23
-
24
- ERP can provide a work packet before a session starts:
25
-
26
- ```text
27
- ERP project context
28
- -> templates/work-packet.md
29
- -> Claude/Codex session
30
- -> Framework command
31
- -> plan/build/verify/report
32
- ```
33
-
34
- The work packet should include project/client IDs, current milestone, open blockers, latest report, assigned employee, approved work, and guardrails. It should not silently change Framework state; the agent still uses `state.js` and `.planning/` for execution.
35
-
36
- ### Framework to ERP
37
-
38
- Framework reports through `/qualia-report`:
39
-
40
- ```text
41
- Framework session
42
- -> .planning/reports/report-YYYY-MM-DD.md
43
- -> POST /api/v1/reports
44
- -> ERP session report and admin dashboard
45
- ```
46
-
47
- This is the primary sync. It is explicit, idempotent, and employee-visible.
48
-
49
- Framework can also export a project-level snapshot for admin visibility:
50
-
51
- ```text
52
- qualia-framework project-snapshot --write
53
- -> .planning/snapshots/project-snapshot-*.json
54
- -> ERP imports current 0-to-100 progress as a draft/project telemetry record
55
- ```
56
-
57
- Or, when ERP credentials are configured:
58
-
59
- ```text
60
- qualia-framework project-snapshot --upload
61
- -> POST /api/v1/project-snapshots
62
- -> ERP updates the canonical project's latest Framework progress metadata
63
- ```
64
-
65
- The snapshot is not a replacement for `/qualia-report`; it is the project-level rollup. It carries shared IDs, current milestone/phase, closed milestones, lifetime counters, deployment counters, and a progress percentage so ERP/admin views can show where a project stands without guessing from names or scraping local files.
66
-
67
- ### Framework Planning Snapshots to ERP
68
-
69
- If ERP wants `.planning/JOURNEY.md`, `ROADMAP.md`, `STATE.md`, or `tracking.json`, use an explicit import/snapshot workflow. Do not depend on passive git scraping or hook-created bot commits.
70
-
71
- Acceptable future contract:
72
-
73
- ```text
74
- Framework creates a planning snapshot
75
- -> .planning/snapshots/project-snapshot-*.json
76
- -> or POST /api/v1/project-snapshots
77
- -> GitHub or API upload
78
- -> ERP imports phases/items as draft operational records
79
- -> human or approved automation confirms client-visible changes
80
- ```
81
-
82
- Framework tasks remain internal execution units. ERP assignments, deadlines, and client-visible statuses remain ERP-owned.
83
-
84
- ### Framework to Memory
85
-
86
- Framework promotes durable lessons through `/qualia-learn`, `/qualia-postmortem`, or the knowledge flush:
87
-
88
- ```text
89
- session report / postmortem / lesson
90
- -> Memory raw note
91
- -> wiki concept, client preference, or project lesson
92
- -> future recall before planning
93
- ```
94
-
95
- ### Memory to Framework and ERP
96
-
97
- Memory can provide context and draft suggestions. It must not directly override ERP operational state.
98
-
99
- ```text
100
- Memory context
101
- -> draft or planning context
102
- -> human/approved automation confirms
103
- -> ERP update or Framework execution
104
- ```
105
-
106
- ## Shared Identifiers
107
-
108
- Use these wherever available:
109
-
110
- | Identifier | Meaning |
111
- |---|---|
112
- | `project_id` | Stable Framework/project key, safe across folder renames. |
113
- | `erp_project_id` | ERP canonical project UUID. |
114
- | `client_id` | ERP/client canonical UUID. |
115
- | `team_id` | Qualia/team identity. |
116
- | `workspace_id` | Tenant/workspace UUID. |
117
- | `git_remote` | Repository correlation key. |
118
- | `framework_version` | Framework version that produced a report. |
119
- | `client_report_id` | Per-project report sequence such as `QS-REPORT-03`. |
120
-
121
- The less these systems guess from names, the cleaner admin tracking becomes.
@@ -1,128 +0,0 @@
1
- # Qualia Framework — Command Quality & Build Workflow Deep Research
2
- **Date:** 2026-04-21
3
- **Scope:** design, debug, optimize, review + plan/build/verify workflow + 8 subagent prompts
4
- **Method:** 4 parallel Opus agents, each auditing one dimension, synthesized by framework owner
5
-
6
- ## Executive Summary
7
-
8
- The framework's biggest accuracy leak is **evidence-free claims**: 3 of 4 diagnostic commands (design, debug, review) do not require file:line citations for findings, so the model hallucinates specifics under pressure. The biggest speed leak is **serial work that should be parallel**: qualia-design and qualia-review list `Agent` in allowed-tools but never spawn, so large codebases get processed in a single context window; the plan-checker revision loop serially re-spawns the planner for issues (frontmatter, wave assignment) that can be fixed mechanically.
9
-
10
- The single highest-leverage change is a shared **Grounding Protocol** + **Rubric Library** referenced from every skill and agent — it eliminates ~60% of the determinism defects at once.
11
-
12
- ---
13
-
14
- ## Top 15 Improvements — Ranked by Impact × Ease
15
-
16
- | # | Change | Impact | Effort | Where |
17
- |---|--------|--------|--------|-------|
18
- | 1 | Add shared Grounding Protocol (cite-or-say-INSUFFICIENT-EVIDENCE) to all agents | 🔥 Accuracy | 30 min | `rules/grounding.md` + import into 8 agent files |
19
- | 2 | Add deterministic severity formula (CRITICAL=8/HIGH=4/MED=2/LOW=1; score = max(1, 5−⌊Σ/8⌋)) to qualia-review | 🔥 Accuracy | 45 min | `skills/qualia-review/SKILL.md:124` |
20
- | 3 | Pre-inline PROJECT.md into verifier prompt (currently missing) | 🔥 Accuracy | 10 min | `skills/qualia-verify/SKILL.md:42` |
21
- | 4 | Make qualia-build spawn wave tasks in parallel explicitly ("all Agent() calls in SAME response") | ⚡ Speed | 30 min | `skills/qualia-build/SKILL.md:65` |
22
- | 5 | Convert qualia-debug from interactive (4 questions) to investigative (parse $ARGUMENTS, run diagnostic greps) | 🔥 Accuracy | 2 hrs | `skills/qualia-debug/SKILL.md:39-44` |
23
- | 6 | Add structured Output Contract (DONE/BLOCKED/PARTIAL prefix) to builder.md | ⚡ Speed + 🔥 Accuracy | 20 min | `agents/builder.md:14` |
24
- | 7 | Mechanical-fix bypass in plan-checker (skip planner re-spawn for frontmatter/wave issues) | ⚡ Speed | 4 hrs | `skills/qualia-plan/SKILL.md:129-153` |
25
- | 8 | Make wave assignment deterministic: file-based dependency graph, topological sort (not "tasks with no dependencies") | 🔥 Accuracy | 3 hrs | `agents/planner.md:33` |
26
- | 9 | Add Rule 8 to plan-checker: "Validation must test behavior, not file-existence only" (stops stubs passing) | 🔥 Accuracy | 30 min | `agents/plan-checker.md` after Rule 7 |
27
- | 10 | Split qualia-design/review into parallel agent fan-out for large file sets (5+ files) | ⚡ Speed | 3 hrs | `skills/qualia-design/SKILL.md`, `skills/qualia-review/SKILL.md` |
28
- | 11 | Add wave-context summary (adjacent task titles + files) to builder prompt — stops semantic drift across parallel tasks | 🔥 Accuracy | 1 hr | `skills/qualia-build/SKILL.md:82` |
29
- | 12 | Fix `grep -qL` bug in qualia-review API auth check (backwards logic) | 🔥 Accuracy | 15 min | `skills/qualia-review/SKILL.md:59-61` |
30
- | 13 | Add tool budgets: researcher (8 external calls), verifier (25 bash calls), debug (10 reads) | ⚡ Speed | 45 min | `agents/researcher.md`, `agents/verifier.md`, `skills/qualia-debug` |
31
- | 14 | Standardize input contracts across 8 agents with `<variable>` typed blocks (only plan-checker does this today) | 🔥 Accuracy | 2 hrs | All 8 agent files |
32
- | 15 | Drop full `next build` from qualia-review; read existing `.next/` or skip with warning | ⚡ Speed | 20 min | `skills/qualia-review/SKILL.md:98` |
33
-
34
- **Total effort for #1–#15:** ~20 hours of focused work → framework-wide accuracy and speed step-change.
35
-
36
- ---
37
-
38
- ## Per-Command Scores (before changes)
39
-
40
- | Command | Score | Weakest Dimension |
41
- |---------|-------|-------------------|
42
- | qualia-debug | 4/10 | Interactive-by-default (4 mandatory questions), no output file, cheat sheets instead of diagnostic commands |
43
- | qualia-design | 6/10 | No critique output contract, `Agent` listed but never spawned, tsc-only verification |
44
- | qualia-review | 7/10 | Serial bash scans, latent `grep -qL` bug, no parallelism |
45
- | qualia-optimize | 8/10 | Strongest — uses agent fan-out, severity labels, OPTIMIZE.md output. Loses points on inline `find`/`grep` in Step 6 + no `--fix` dry-run |
46
-
47
- ## Per-Agent Scores (before changes)
48
-
49
- | Agent | Overall | Biggest Gap |
50
- |-------|---------|-------------|
51
- | plan-checker | 9.5/10 | No tool budget |
52
- | verifier | 9.0/10 | No frontend gate on design verification (runs 40 greps on backend phases) |
53
- | planner | 8.5/10 | Prose input contract, no failure-mode handling |
54
- | builder | 8.5/10 | No structured output contract |
55
- | researcher | 8.5/10 | Unbounded WebSearch loops |
56
- | qa-browser | 8.5/10 | Probes for dev server URL instead of receiving it; no fallback when Playwright unavailable |
57
- | roadmapper | 8.5/10 | `full_detail` is a ghost parameter — referenced but not declared |
58
- | research-synthesizer | 8.0/10 | No evidence requirement on milestone suggestions |
59
-
60
- ---
61
-
62
- ## Rubrics to Ship as `rules/rubrics.md`
63
-
64
- **Severity (with deterministic category score):**
65
- ```
66
- CRITICAL = 8 | HIGH = 4 | MEDIUM = 2 | LOW = 1
67
- weighted_sum = Σ(count_i × weight_i)
68
- category_score = max(1, 5 − ⌊weighted_sum / 8⌋)
69
- ```
70
-
71
- **Design Quality (1–5 per dimension, any <3 = mandatory fix):**
72
- Typography / Color / Spacing / States / Responsiveness / Accessibility — each with objective criteria (see `skills/qualia-design` comment thread for full matrix).
73
-
74
- **Task-Done:**
75
- - Compiles (`tsc --noEmit` = 0)
76
- - No stubs (`grep -c "TODO|FIXME|placeholder" touched_files` = 0)
77
- - Wired (every export imported somewhere)
78
- - Each acceptance criterion has a passing validation command
79
- - Committed (git log matches task title)
80
-
81
- **Evidence Citation Format:**
82
- ```
83
- file:line — "quoted code" — {assessment}
84
- ```
85
- Claims missing this format are rejected. If evidence cannot be found: `INSUFFICIENT EVIDENCE: searched {files} with {commands}`.
86
-
87
- ---
88
-
89
- ## Grounding Protocol (paste into every agent)
90
-
91
- ```markdown
92
- ## Grounding Protocol (MANDATORY)
93
- 1. Every factual claim requires `file:line — "quoted code"`. No exception.
94
- 2. No hedging: "seems / probably / might" → verified or INSUFFICIENT EVIDENCE.
95
- 3. Findings without file:line are discarded.
96
- 4. Scores without evidence on the next line = 0.
97
- 5. Severity requires quoting the matching Severity Rubric criterion.
98
- 6. Output shape is a contract — missing sections = protocol violation.
99
- 7. Stop at tool budget. Return what you found, not what you wish.
100
- 8. Precondition: verify every @file exists before work; HALT if missing.
101
- ```
102
-
103
- ---
104
-
105
- ## 3 Architectural Changes (bigger, keep for later)
106
-
107
- 1. **Pre-Build Context Packet** — assemble one JSON with PROJECT.md + DESIGN.md + plan + wave-context before spawning builders. Eliminates per-builder file reads.
108
- 2. **Intra-Wave Verification** — run each task's Validation contracts immediately after its builder completes, before next wave starts. Catches failure at task granularity, not phase.
109
- 3. **Plan Cache** — cache parsed project identity in `.planning/.project-cache.json`; invalidate on PROJECT.md change. Saves ~30% planner context on multi-phase `--auto` runs.
110
-
111
- ---
112
-
113
- ## Missing Agents Worth Adding (ranked)
114
-
115
- 1. **`migrator.md`** — generates + validates Supabase migrations. Current gap: builder writes raw SQL ad-hoc, migration guard catches only obvious patterns.
116
- 2. **`dependency-auditor.md`** — pre-build peer-dependency / vulnerability check. Current gap: builder hits `npm install` conflicts mid-phase and wastes context debugging.
117
- 3. **`rollback.md`** — on verify FAIL, bisect to last-good commit instead of always patching forward. Current gap: gap-closure plans build on broken code.
118
-
119
- ---
120
-
121
- ## Anti-Patterns to Kill
122
-
123
- - `find` inside skills (use Glob) — qualia-optimize:302, qualia-review multiple places
124
- - `Agent` in allowed-tools but never spawned — qualia-design, qualia-debug, qualia-review
125
- - Interactive question gates in one-shot commands — qualia-debug
126
- - Full `next build` as part of a "scan" — qualia-review:98
127
- - Vague "investigate the codebase" with no tool budget — qualia-debug, researcher
128
- - "seems / probably / might" language anywhere in agent output