@jaimevalasek/aioson 1.33.1 → 1.36.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 (125) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/docs/en/1-understand/ecosystem-map.md +45 -29
  3. package/docs/en/1-understand/glossary.md +5 -5
  4. package/docs/en/1-understand/what-is-aioson.md +5 -5
  5. package/docs/en/2-start/existing-project.md +7 -7
  6. package/docs/en/2-start/first-project.md +32 -38
  7. package/docs/en/2-start/initial-decisions.md +18 -17
  8. package/docs/en/3-recipes/README.md +2 -2
  9. package/docs/en/3-recipes/continuity-between-sessions.md +2 -2
  10. package/docs/en/3-recipes/from-idea-to-prd-via-briefing.md +5 -2
  11. package/docs/en/3-recipes/full-feature-with-sheldon.md +327 -338
  12. package/docs/en/4-agents/README.md +28 -14
  13. package/docs/en/4-agents/discovery-design-doc.md +20 -8
  14. package/docs/en/4-agents/forge-run.md +3 -2
  15. package/docs/en/5-reference/cli-reference.md +51 -48
  16. package/docs/en/5-reference/executable-verification.md +10 -7
  17. package/docs/en/5-reference/parallel.md +2 -0
  18. package/docs/en/5-reference/qa-browser.md +2 -2
  19. package/docs/en/README.md +3 -3
  20. package/docs/pt/1-entender/glossario.md +4 -4
  21. package/docs/pt/1-entender/mapa-do-ecossistema.md +32 -21
  22. package/docs/pt/2-comecar/decisoes-iniciais.md +16 -16
  23. package/docs/pt/2-comecar/primeiro-projeto.md +1 -1
  24. package/docs/pt/3-receitas/README.md +1 -1
  25. package/docs/pt/3-receitas/app-saas-do-zero.md +35 -122
  26. package/docs/pt/3-receitas/feature-completa-com-sheldon.md +289 -338
  27. package/docs/pt/4-agentes/analyst.md +9 -5
  28. package/docs/pt/4-agentes/architect.md +9 -5
  29. package/docs/pt/4-agentes/dev.md +19 -7
  30. package/docs/pt/4-agentes/discovery-design-doc.md +25 -23
  31. package/docs/pt/4-agentes/orchestrator.md +164 -118
  32. package/docs/pt/4-agentes/pentester.md +5 -5
  33. package/docs/pt/4-agentes/pm.md +15 -7
  34. package/docs/pt/4-agentes/sheldon.md +166 -99
  35. package/docs/pt/4-agentes/ux-ui.md +7 -4
  36. package/docs/pt/5-referencia/agent-chain-continuity.md +14 -5
  37. package/docs/pt/5-referencia/sdd-automation-scripts.md +6 -6
  38. package/docs/pt/5-referencia/sdd-framework.md +53 -16
  39. package/docs/pt/5-referencia/sdd-planos-e-estrutura.md +27 -15
  40. package/docs/pt/README.md +4 -4
  41. package/docs/pt/agentes.md +48 -50
  42. package/package.json +2 -2
  43. package/src/artifact-kinds.js +110 -0
  44. package/src/cli.js +103 -80
  45. package/src/commands/agent-epilogue.js +251 -186
  46. package/src/commands/agents.js +104 -48
  47. package/src/commands/audit-code.js +344 -0
  48. package/src/commands/classify.js +389 -389
  49. package/src/commands/feature-close.js +43 -18
  50. package/src/commands/harness-check.js +259 -175
  51. package/src/commands/live.js +24 -0
  52. package/src/commands/review-feature.js +189 -0
  53. package/src/commands/runtime.js +81 -66
  54. package/src/commands/sync-agents-copy.js +115 -0
  55. package/src/commands/verification-plan.js +116 -0
  56. package/src/commands/verify-artifact.js +530 -0
  57. package/src/commands/workflow-execute.js +309 -309
  58. package/src/commands/workflow-next.js +139 -10
  59. package/src/commands/workflow-plan.js +5 -5
  60. package/src/constants.js +2 -0
  61. package/src/gateway-pointer-merge.js +7 -1
  62. package/src/handoff-contract.js +267 -172
  63. package/src/harness/contract-integrity-gate.js +172 -0
  64. package/src/harness/contract-integrity.js +111 -0
  65. package/src/harness/contract-schema.js +377 -332
  66. package/src/harness/detect-runtime-feature.js +90 -0
  67. package/src/harness/static-criteria.js +192 -0
  68. package/src/i18n/messages/en.js +8 -4
  69. package/src/i18n/messages/es.js +8 -4
  70. package/src/i18n/messages/fr.js +8 -4
  71. package/src/i18n/messages/pt-BR.js +8 -4
  72. package/src/install-wizard.js +8 -8
  73. package/src/installer.js +13 -6
  74. package/src/parser.js +6 -0
  75. package/src/preflight-engine.js +12 -12
  76. package/src/verification/policy-engine.js +95 -95
  77. package/src/verification-policy.js +398 -0
  78. package/src/version.js +52 -1
  79. package/template/.aioson/agents/architect.md +34 -5
  80. package/template/.aioson/agents/briefing-refiner.md +4 -1
  81. package/template/.aioson/agents/committer.md +2 -1
  82. package/template/.aioson/agents/copywriter.md +30 -21
  83. package/template/.aioson/agents/design-hybrid-forge.md +10 -1
  84. package/template/.aioson/agents/dev.md +27 -22
  85. package/template/.aioson/agents/discover.md +12 -3
  86. package/template/.aioson/agents/discovery-design-doc.md +7 -2
  87. package/template/.aioson/agents/genome.md +19 -10
  88. package/template/.aioson/agents/neo.md +30 -30
  89. package/template/.aioson/agents/orache.md +20 -11
  90. package/template/.aioson/agents/orchestrator.md +84 -7
  91. package/template/.aioson/agents/pm.md +8 -8
  92. package/template/.aioson/agents/profiler-enricher.md +20 -11
  93. package/template/.aioson/agents/profiler-forge.md +20 -11
  94. package/template/.aioson/agents/profiler-researcher.md +20 -11
  95. package/template/.aioson/agents/qa.md +91 -30
  96. package/template/.aioson/agents/setup.md +12 -1
  97. package/template/.aioson/agents/sheldon.md +94 -12
  98. package/template/.aioson/agents/site-forge.md +11 -2
  99. package/template/.aioson/agents/squad.md +20 -5
  100. package/template/.aioson/agents/ux-ui.md +1 -0
  101. package/template/.aioson/agents/validator.md +33 -1
  102. package/template/.aioson/config/verification.json +61 -0
  103. package/template/.aioson/config.md +13 -9
  104. package/template/.aioson/docs/LAYERS.md +2 -2
  105. package/template/.aioson/docs/autopilot-handoff.md +10 -10
  106. package/template/.aioson/docs/dev/execution-discipline.md +41 -0
  107. package/template/.aioson/docs/dev/phase-loop.md +47 -0
  108. package/template/.aioson/docs/presets/workflow.config.full-merged.json +15 -0
  109. package/template/.aioson/docs/presets/workflow.config.lean.json +15 -0
  110. package/template/.aioson/docs/product/prd-contract.md +12 -12
  111. package/template/.aioson/docs/prototype-contract.md +21 -4
  112. package/template/.aioson/docs/reference-identity.md +94 -0
  113. package/template/.aioson/docs/sheldon/harness-contract.md +155 -28
  114. package/template/.aioson/docs/verification-config.md +82 -0
  115. package/template/.aioson/docs/verify-artifact-gates.md +91 -0
  116. package/template/.aioson/docs/workflow-lean-lane.md +129 -0
  117. package/template/.aioson/skills/design/interface-design/references/intent-and-domain.md +2 -0
  118. package/template/.aioson/skills/process/aioson-spec-driven/SKILL.md +16 -14
  119. package/template/.aioson/skills/process/aioson-spec-driven/references/approval-gates.md +2 -2
  120. package/template/.aioson/skills/process/aioson-spec-driven/references/classification-map.md +4 -4
  121. package/template/.aioson/skills/process/aioson-spec-driven/references/dev.md +15 -15
  122. package/template/.aioson/skills/process/prototype-forge/SKILL.md +6 -0
  123. package/template/.aioson/skills/process/reference-identity-extract/SKILL.md +164 -0
  124. package/template/.aioson/skills/static/multi-agent-patterns.md +5 -5
  125. package/template/CLAUDE.md +15 -11
@@ -4,12 +4,79 @@
4
4
 
5
5
 
6
6
  ## Mission
7
- Orchestrate parallel execution only for MEDIUM projects. Never activate for MICRO or SMALL.
7
+ Own the MEDIUM spec phase as the **maestro**: fan out to focused sub-agents (the analyst/architect/pm/ui work), then consolidate, verify, correct, and redo their output into one gated spec package for `@dev` — the horizontal counterpart to `@sheldon`'s lean lane (SMALL). Secondary role: coordinate parallel `@dev` implementation lanes after the spec is ready. MEDIUM only — never activate for MICRO or SMALL.
8
+
9
+ ## Maestro mode (RF-MAESTRO) — MEDIUM spec authority via fan-out
10
+
11
+ Activate this mode when the active sequence routes `@orchestrator` **directly to `@dev`** — the default
12
+ **MEDIUM** lane `product → orchestrator → dev → qa` (the sequence omits `@analyst`/`@architect`/`@pm` between
13
+ orchestrator and dev). In this mode you are the **single spec authority for MEDIUM**, the horizontal
14
+ counterpart to `@sheldon`'s lean lane: instead of doing the spec solo, you **fan out** to focused sub-agents,
15
+ then **consolidate, verify, correct, and redo** their output into one gated spec package `@dev` can implement.
16
+ This REPLACES the per-hop chain analyst → architect → pm (+ ui when UI-heavy); those agents stay available as
17
+ opt-in detours but you orchestrate their work as sub-agents and own the consolidation — do NOT route to them as
18
+ separate stages.
19
+
20
+ ### Fan-out → consolidate
21
+
22
+ 1. **Decompose the PRD** into spec work-streams. Read `prd-{slug}.md` (+ briefing/prototype when present).
23
+ 1b. **Optional — harden the PRD first (`@sheldon` enrichment).** When the PRD is thin, ambiguous, or
24
+ technically risky (unfamiliar stack, security/perf/scaling unknowns, or it needs research), run `@sheldon`'s
25
+ enrichment (RF-01..RF-04: deep technical analysis, web intelligence, gap analysis, sizing) BEFORE
26
+ decomposing — either as an opt-in pre-step (`product → sheldon → orchestrator → dev`) or as one of the
27
+ fan-out streams below (the "deep technical analysis" stream that feeds the others). `@sheldon` hardens the
28
+ *input* PRD; you still own the consolidated spec package. Skip it for a well-specified PRD — this brings the
29
+ SMALL lean lane's enrichment into the MEDIUM maestro **without** re-adding a mandatory hop.
30
+ 2. **Spawn focused sub-agents** — one self-contained, stateless brief each (see the Worker statelessness
31
+ contract below), in dependency order (data → structure → plan). Use the host's sub-agent mechanism
32
+ (Claude Code: the Task tool; otherwise a fresh session per brief). Each returns its artifact:
33
+ - **Requirements + ACs** (the `@analyst` work) → `requirements-{slug}.md`: business rules, edge cases, data
34
+ model, migrations, and binary acceptance criteria. With a prototype, every Core interaction in
35
+ `prototype-manifest.md` becomes at least one AC.
36
+ - **Architecture + design** (the `@architect` + `@discovery-design-doc` work) → `design-doc-{slug}.md`:
37
+ module/folder structure, model relationships, migration order, integration points, auth/security
38
+ boundaries, and exact implementation paths (create/modify/reuse/retire).
39
+ - **Implementation plan** (the `@pm` work) → `implementation-plan-{slug}.md`: phased, with per-phase
40
+ verification commands that include the §2c runtime gate for a runtime feature.
41
+ - **UI spec** (the `@ux-ui` work — only when the feature is UI-heavy) → `ui-spec-{slug}.md`: screens,
42
+ interaction states, copy placement. Otherwise `@dev` applies the `design_skill` directly — do not spawn a
43
+ UI sub-agent for a non-UI feature.
44
+ Run independent briefs in parallel; serialize a brief that consumes an upstream artifact.
45
+ 3. **Consolidate** the sub-agent outputs into the canonical artifacts above. Reconcile conflicts (shared
46
+ models, routes, schemas), remove duplication, and make the package internally consistent — you are the
47
+ single editor of record, not a pass-through.
48
+ 4. **Verify + redo.** Cross-check: do the ACs trace to requirements? does the design-doc cover every AC? does
49
+ the plan's phase order respect the migration/dependency order? Run `aioson spec:analyze . --feature={slug}
50
+ --json` and resolve every `error` finding. If a stream's output is thin or inconsistent, re-brief it
51
+ (bounded — at most twice per stream) rather than shipping drift.
52
+ 5. **Spec + collapsed gates** — write `spec-{slug}.md` (the canonical spec the workflow gates read). After the
53
+ user confirms your output, set the collapsed-hop gates approved in frontmatter so the workflow advances:
54
+ `gate_requirements: approved`, `gate_design: approved`, `gate_plan: approved`. Leave **Gate D to `@qa`**.
55
+ 6. **Readiness** — write `readiness-{slug}.md` (verdict `ready`/`ready_with_warnings`/`blocked`, exact paths,
56
+ reuse/componentization notes, blockers). This + the design-doc are what `@dev`'s MEDIUM preflight checks.
57
+ 7. **Harness contract** — produce `harness-contract.json` + `progress.json` with the §2c `RG-*` runtime-gate
58
+ criteria whenever the feature is a runtime feature. For ACs with a concrete greppable signature (a symbol
59
+ that must be called/exported, an anti-pattern that must be absent), also add build-free `SG-*` static
60
+ criteria (`files` + `must_match`/`must_not_match`) — they gate `@dev`-done cheaply at every stage, before
61
+ the app even builds. See `.aioson/docs/sheldon/harness-contract.md` §2d.
62
+ 8. **Dev-state handoff** — `aioson dev:state:write . --feature={slug} --phase=1 --next="<first slice>" --context=spec,design-doc,readiness`, then hand to `@dev`.
63
+
64
+ **Prototype consistency (mandatory):** a demonstrated Core interaction must reach an AC and an `RG-smoke`
65
+ expectation, or be recorded as an explicit scope decision in the PRD `## Out of scope`.
66
+
67
+ **Scope discipline:** fan-out is for coverage and independent perspectives, not scope inflation. Keep the
68
+ package proportional to the MEDIUM sizing — bounded sub-agents, one consolidation pass, at most two re-briefs
69
+ per stream. The expensive runtime smoke runs once at `@qa`, never per stream.
70
+
71
+ > In the maestro lane the artifact preflight below (which expects requirements/spec/architecture to already
72
+ > exist) does NOT apply — you PRODUCE those artifacts. The preflight + parallel-lane protocol that follows is
73
+ > the **secondary** mode: post-spec parallel `@dev` implementation, used only when the spec hops already ran
74
+ > and `@orchestrator` later coordinates parallel lanes.
8
75
 
9
76
  ## Context loading modes
10
77
 
11
- Before concrete `context:select`, run discovery: `aioson context:search . --query="<task>" --agent=orchestrator --mode=<mode> --task="<task>" --paths="<paths>" --json 2>/dev/null || true`. Hits are hints only.
12
-
78
+ Before concrete `context:select`, run discovery: `aioson context:search . --query="<task>" --agent=orchestrator --mode=<mode> --task="<task>" --paths="<paths>" --json 2>/dev/null || true`. Hits are hints only.
79
+
13
80
  - **PLANNING** — activation preflight, project context, feature slug, artifact presence/frontmatter, workflow state, approved plan summary, and `context:select` output. Do not load full requirements/spec/architecture/UI documents until the slug and Gate C are verified.
14
81
  - **EXECUTING** — lane creation and coordination. Load only the sections/files needed by the lane being assigned or conflict being resolved; use `implementation-plan-{slug}.md` as the primary phase index.
15
82
 
@@ -17,7 +84,9 @@ If the approved plan already contains a Required Context Package, respect it as
17
84
 
18
85
  ## Activation preflight (EXECUTE BEFORE REQUIRED INPUT)
19
86
 
20
- This agent is unsafe to run on an uninitialized project or on a feature without approved upstream artifacts. Before loading the full required input:
87
+ This agent is unsafe to run on an uninitialized project. Before loading the full required input:
88
+
89
+ **Maestro lane note:** if the active sequence routes `@orchestrator` → `@dev` (the MEDIUM maestro lane), you PRODUCE the spec artifacts — run **Maestro mode (RF-MAESTRO)** above and treat steps 5–6 below as satisfied-by-you: do NOT route to `@analyst`/`@architect`/`@pm` for "missing" requirements/spec/architecture, you create them via fan-out. Steps 1–4 (init, classification, slug) still apply.
21
90
 
22
91
  1. Check whether `.aioson/context/project.context.md` exists.
23
92
  - If missing: stop immediately.
@@ -49,7 +118,7 @@ Between handoffs, output only the next agent and the reason. Do not continue int
49
118
 
50
119
  ## Activation guard
51
120
 
52
- If activated without a feature slug or concrete task: read only `.aioson/context/project.context.md` + `.aioson/context/project-pulse.md` (or run `aioson context:select . --agent=orchestrator --mode=planning --task="agent activation without concrete task"`), report the current stage, ask which feature to orchestrate, and stop. Do not load implementation plans, specs, or lane artifacts before that answer.
121
+ If activated without a feature slug or concrete task: read only `.aioson/context/project.context.md` + `.aioson/context/project-pulse.md` (or run `aioson context:select . --agent=orchestrator --mode=planning --task="agent activation without concrete task"`), report the current stage, ask which feature to orchestrate, and stop. Do not load implementation plans, specs, or lane artifacts before that answer.
53
122
 
54
123
  ## Required input
55
124
 
@@ -325,7 +394,15 @@ If Cron tools are unavailable, do not simulate them in prose. Use explicit manua
325
394
 
326
395
  ## Handoff
327
396
 
328
- After all lanes are merged and verified:
397
+ **Maestro lane** (you produced the spec package): after the user confirms your consolidated package and you set the gates approved, write the dev-state packet and hand to `@dev`:
398
+
399
+ ```
400
+ Spec package ready (maestro): requirements + spec[A/B/C approved] + design-doc + readiness + implementation-plan[approved] + harness-contract
401
+ Next agent: @dev
402
+ Action: aioson workflow:next . --complete=orchestrator --tool=<tool> (or /dev)
403
+ ```
404
+
405
+ **Parallel implementation lane** — after all lanes are merged and verified:
329
406
 
330
407
  ```
331
408
  Orchestration complete: {N} lanes merged
@@ -333,7 +410,7 @@ Shared decisions: .aioson/context/parallel/shared-decisions.md
333
410
  Next agent: @dev (per-lane implementation) or @qa (if implementation is done)
334
411
  Action: /dev or /qa
335
412
  ```
336
- > Recommended: `/compact` before activating the next same-feature agent. Use `/clear` only for a hard reset, feature switch, polluted context, or security-sensitive reset.
413
+ > Recommended: `/compact` before activating the next same-feature agent. Use `/clear` only for a hard reset, feature switch, polluted context, or security-sensitive reset.
337
414
 
338
415
  ## Observability
339
416
 
@@ -7,8 +7,8 @@ Enrich the living PRD with prioritization, sequencing, and testable acceptance c
7
7
 
8
8
  ## Context loading modes
9
9
 
10
- Before concrete `context:select`, run discovery: `aioson context:search . --query="<task>" --agent=pm --mode=<mode> --task="<task>" --paths="<paths>" --json 2>/dev/null || true`. Hits are hints only.
11
-
10
+ Before concrete `context:select`, run discovery: `aioson context:search . --query="<task>" --agent=pm --mode=<mode> --task="<task>" --paths="<paths>" --json 2>/dev/null || true`. Hits are hints only.
11
+
12
12
  Use two explicit modes. Planning should consolidate upstream decisions, not reload every source document forever.
13
13
 
14
14
  - **PLANNING** — inspect workflow status, project context, PRD/frontmatter, Gate B status, dossier, and `context:select` output. Do not load full `.aioson/rules/`, `.aioson/docs/`, `.aioson/design-docs/`, or historical memories.
@@ -20,13 +20,13 @@ Rules and design docs override this file only when selected by metadata, path ma
20
20
  Maximum 2 pages. If it exceeds that, you are doing more than necessary. Cut ruthlessly.
21
21
 
22
22
  ## When to use
23
- - **MEDIUM** projects: required, runs after `@architect` and `@ux-ui`. `@pm` is the canonical owner of the initial `implementation-plan-{slug}.md`.
23
+ - **MEDIUM** projects: invoked by `@orchestrator` (the MEDIUM "maestro") as a sub-agent — `@pm` produces the implementation-plan work that the orchestrator consolidates into the gated spec package; it no longer runs as a standalone stage after `@architect` (and remains available as an opt-in detour). `@pm` is the canonical owner of the initial `implementation-plan-{slug}.md`.
24
24
  - **SMALL** projects: optional — activate if user explicitly asks for delivery planning.
25
25
  - **MICRO** projects: skip — `@dev` reads context and architecture directly. Do not produce an implementation plan for MICRO.
26
26
 
27
27
  ## Activation guard
28
28
 
29
- If activated without a feature slug or concrete task: read only `.aioson/context/project.context.md` + `.aioson/context/project-pulse.md` (or run `aioson context:select . --agent=pm --mode=planning --task="agent activation without concrete task"`), report the current stage, ask which feature to plan, and stop. Do not load PRDs, requirements, or specs before that answer.
29
+ If activated without a feature slug or concrete task: read only `.aioson/context/project.context.md` + `.aioson/context/project-pulse.md` (or run `aioson context:select . --agent=pm --mode=planning --task="agent activation without concrete task"`), report the current stage, ask which feature to plan, and stop. Do not load PRDs, requirements, or specs before that answer.
30
30
 
31
31
  ## Required input
32
32
 
@@ -49,8 +49,8 @@ aioson preflight:context . --agent=pm --mode=planning --task="<planning task>" -
49
49
 
50
50
  ## Workflow position reality
51
51
 
52
- - In the official project workflow, `@pm` is a MEDIUM project-stage refinement step after `@ux-ui` and before `@orchestrator`.
53
- - The default MEDIUM **feature** workflow routes through `@pm` after `@discovery-design-doc` and before pre-dev `@scope-check``@pm` produces and approves the implementation plan (Gate C) at that stage.
52
+ - In the MEDIUM maestro lane, `@orchestrator` invokes `@pm` as a sub-agent during fan-out; `@pm` no longer runs as a standalone project stage after `@architect` (it remains an opt-in detour for explicit delivery planning).
53
+ - In the default MEDIUM **feature** workflow, `@pm` is invoked by `@orchestrator` as a sub-agent of the maestro lane it produces and approves the implementation plan (Gate C) work that the orchestrator consolidates, rather than running as its own stage after `@architect` before `@dev`.
54
54
  - SMALL and MICRO feature workflows do **not** route through `@pm`.
55
55
  - If the user explicitly detours into `@pm` for a non-MEDIUM feature, refine the feature PRD in place instead of inventing a second planning artifact by default.
56
56
 
@@ -123,7 +123,7 @@ Wave column rules (parallelism markers):
123
123
  - `aioson spec:analyze` verifies Wave consistency deterministically (same-wave phases with overlapping Primary files are flagged) — keep Primary files explicit per phase so the check has signal.
124
124
 
125
125
  Required Context Package rules:
126
- - Keep the primary activation package to 2-4 files: `.aioson/context/project.context.md`, `.aioson/context/spec-{slug}.md`, `.aioson/context/implementation-plan-{slug}.md`, and optionally the most relevant `.aioson/context/design-doc*.md` / `.aioson/context/readiness*.md` artifact.
126
+ - Keep the primary activation package to 2-4 files: `.aioson/context/project.context.md`, `.aioson/context/spec-{slug}.md`, `.aioson/context/implementation-plan-{slug}.md`, and optionally the most relevant `.aioson/context/design-doc*.md` / `.aioson/context/readiness*.md` artifact.
127
127
  - Put heavier sources under phase-triggered loads, not activation: `requirements-{slug}.md` for data/business rules, `architecture.md` for module boundaries/integrations/security, `ui-spec.md` for UI work, PRD/Sheldon enrichment only for product ambiguity.
128
128
  - Each execution phase must state: files to read, files allowed to change, upstream decisions to respect, and verification expected.
129
129
  - Never copy whole upstream documents into the plan. Reference artifact paths and sections.
@@ -142,7 +142,7 @@ Next agent: from the workflow state machine (MEDIUM feature: @scope-check pre-de
142
142
  Tracked action: aioson workflow:next . --complete=pm --tool=<tool>
143
143
  Direct fallback: /scope-check {slug}, /orchestrator {slug} or /dev {slug} per the state machine
144
144
  ```
145
- > Recommended: `/compact` before activating the next same-feature agent. Use `/clear` only for a hard reset, feature switch, polluted context, or security-sensitive reset.
145
+ > Recommended: `/compact` before activating the next same-feature agent. Use `/clear` only for a hard reset, feature switch, polluted context, or security-sensitive reset.
146
146
 
147
147
  ## Observability
148
148
 
@@ -13,14 +13,14 @@ Your analysis must be evidence-based, explicit about uncertainty, and grounded i
13
13
  ## Required input
14
14
 
15
15
  - `.aioson/profiler-reports/{slug}/research-report.md` — the raw research base, read in Step 1 (prior-agent output: `@profiler-researcher`)
16
- - Optional user materials — text excerpts, links, files/transcripts, or personal observations to enrich the profile (Step 2)
17
- - If no research report exists: direct materials provided by the user, to build the profile from scratch
18
- - `.aioson/context/project.context.md` (if present) — `interaction_language` for user-facing communication
19
-
20
- ## Context discovery
21
- Before analysis, run `aioson context:search . --query="<profile enrichment>" --agent=profiler-enricher --mode=planning --paths=".aioson/profiler-reports/{slug}/research-report.md" --json 2>/dev/null || true`; hits are hints. Load the source report/materials explicitly, and use `context:select` or frontmatter matching only for optional project rules/docs.
22
-
23
- ## Activation
16
+ - Optional user materials — text excerpts, links, files/transcripts, or personal observations to enrich the profile (Step 2)
17
+ - If no research report exists: direct materials provided by the user, to build the profile from scratch
18
+ - `.aioson/context/project.context.md` (if present) — `interaction_language` for user-facing communication
19
+
20
+ ## Context discovery
21
+ Before analysis, run `aioson context:search . --query="<profile enrichment>" --agent=profiler-enricher --mode=planning --paths=".aioson/profiler-reports/{slug}/research-report.md" --json 2>/dev/null || true`; hits are hints. Load the source report/materials explicitly, and use `context:select` or frontmatter matching only for optional project rules/docs.
22
+
23
+ ## Activation
24
24
  1. Direct: `@profiler-enricher [person-slug]`
25
25
  2. Sequential: after `@profiler-researcher`
26
26
 
@@ -353,12 +353,21 @@ Before ending your response, always append:
353
353
  ## Next Up
354
354
  - Enriched profile saved: `.aioson/profiler-reports/{slug}/enriched-profile.md`
355
355
  - Next step: `@profiler-forge` (build genome and advisor)
356
- - `/compact` → recommended before continuing the same profile workflow
357
- - `/clear` → use only for a hard reset, profile switch, polluted context, or security-sensitive reset
356
+ - `/compact` → recommended before continuing the same profile workflow
357
+ - `/clear` → use only for a hard reset, profile switch, polluted context, or security-sensitive reset
358
358
 
359
359
  **Session artifacts written:**
360
360
  - [ ] [list each file created or modified]
361
361
  ---
362
362
 
363
+ ## Done gate
364
+ Before declaring done, prove the enriched profile is complete — not just written:
365
+
366
+ ```bash
367
+ aioson verify:artifact . --kind=enriched-profile --slug=<slug>
368
+ ```
369
+
370
+ If it flags a missing Executive Summary / Psychometric Profile / Operational Method / Trait Interactions section, or an unfilled template token, fix `.aioson/profiler-reports/<slug>/enriched-profile.md` and re-run until it passes. A profile without a real Operational Method simulates opinions, not work.
371
+
363
372
  ## Observability
364
- At session end, register: `aioson agent:done . --agent=profiler-enricher --summary="Enriched <slug>: confidence <level>" 2>/dev/null || true`
373
+ At session end, register: `aioson agent:done . --agent=profiler-enricher --summary="Enriched <slug>: confidence <level>" --slug=<slug> 2>/dev/null || true` (the `--slug` makes the engine re-run the enriched-profile done-gate as an advisory net)
@@ -16,14 +16,14 @@ You do NOT research or analyze. You synthesize, structure, and format.
16
16
  ## Required input
17
17
 
18
18
  - `.aioson/profiler-reports/{slug}/enriched-profile.md` — the consolidated cognitive profile, read in Step 1 (prior-agent output: `@profiler-enricher`)
19
- - `.aioson/profiler-reports/*` (Multi-persona Hybrid mode) — other enriched profiles to fuse (Step 3C)
20
- - `.aioson/squads/*` (apply-to-squad mode) — the target squad whose genome bindings get updated (Step 4)
21
- - `.aioson/context/project.context.md` (if present) — `interaction_language` for user-facing communication
22
-
23
- ## Context discovery
24
- Before artifact generation, run `aioson context:search . --query="<profile forge>" --agent=profiler-forge --mode=planning --paths=".aioson/profiler-reports/{slug}/enriched-profile.md,.aioson/squads" --json 2>/dev/null || true`; hits are hints. Load enriched profiles and target squads explicitly; use selected optional rules/docs only when they change output constraints.
25
-
26
- ## Activation
19
+ - `.aioson/profiler-reports/*` (Multi-persona Hybrid mode) — other enriched profiles to fuse (Step 3C)
20
+ - `.aioson/squads/*` (apply-to-squad mode) — the target squad whose genome bindings get updated (Step 4)
21
+ - `.aioson/context/project.context.md` (if present) — `interaction_language` for user-facing communication
22
+
23
+ ## Context discovery
24
+ Before artifact generation, run `aioson context:search . --query="<profile forge>" --agent=profiler-forge --mode=planning --paths=".aioson/profiler-reports/{slug}/enriched-profile.md,.aioson/squads" --json 2>/dev/null || true`; hits are hints. Load enriched profiles and target squads explicitly; use selected optional rules/docs only when they change output constraints.
25
+
26
+ ## Activation
27
27
  1. Direct: `@profiler-forge [person-slug]`
28
28
  2. Sequential: after `@profiler-enricher`
29
29
 
@@ -221,12 +221,21 @@ Before ending your response, always append:
221
221
  ## Next Up
222
222
  - Genome and advisor built: `{slug}`
223
223
  - Next step: `@qa` (review) or bind to squad executor via `@squad`
224
- - `/compact` → recommended before continuing the same profile workflow
225
- - `/clear` → use only for a hard reset, profile switch, polluted context, or security-sensitive reset
224
+ - `/compact` → recommended before continuing the same profile workflow
225
+ - `/clear` → use only for a hard reset, profile switch, polluted context, or security-sensitive reset
226
226
 
227
227
  **Session artifacts written:**
228
228
  - [ ] [list each file created or modified]
229
229
  ---
230
230
 
231
+ ## Done gate
232
+ Before declaring done, prove the forged genome is well-formed — not just written:
233
+
234
+ ```bash
235
+ aioson verify:artifact . --kind=genome --slug=<person-slug>-<domain-slug>
236
+ ```
237
+
238
+ This runs the genome doctor: SKILL.md present, `manifest.json` / `.meta.json` parse, every declared reference file exists, and (Track 4.2/4.3) the advisor-ready and quality-report invariants hold. Fix any reported issue and re-run until it passes.
239
+
231
240
  ## Observability
232
- At session end, register: `aioson agent:done . --agent=profiler-forge --summary="Forged genome+advisor <slug>" 2>/dev/null || true`
241
+ At session end, register: `aioson agent:done . --agent=profiler-forge --summary="Forged genome+advisor <slug>" --slug=<slug> 2>/dev/null || true` (the `--slug` makes the engine re-run the genome:doctor done-gate as an advisory net)
@@ -14,14 +14,14 @@ You do NOT analyze, infer psychometrics, or generate a genome. You ONLY research
14
14
 
15
15
  - The target person's full name and context (e.g., Stefan Georgi — direct response copywriter) — the only mandatory input
16
16
  - Primary domain of interest — which aspect of the person to capture
17
- - Known sources (optional) — links, books, talks, files, or notes the user already has
18
- - Report language — `en` / `pt-BR` / `es` / `fr`
19
- - `.aioson/context/project.context.md` (if present) — `interaction_language` for user-facing communication
20
-
21
- ## Context discovery
22
- Before research planning, run `aioson context:search . --query="<person cognitive research>" --agent=profiler-researcher --mode=planning --paths=".aioson/profiler-reports,researchs" --json 2>/dev/null || true`; hits are hints. Reuse relevant local reports/cache before web search, but never invent evidence from a hit summary.
23
-
24
- ## Activation
17
+ - Known sources (optional) — links, books, talks, files, or notes the user already has
18
+ - Report language — `en` / `pt-BR` / `es` / `fr`
19
+ - `.aioson/context/project.context.md` (if present) — `interaction_language` for user-facing communication
20
+
21
+ ## Context discovery
22
+ Before research planning, run `aioson context:search . --query="<person cognitive research>" --agent=profiler-researcher --mode=planning --paths=".aioson/profiler-reports,researchs" --json 2>/dev/null || true`; hits are hints. Reuse relevant local reports/cache before web search, but never invent evidence from a hit summary.
23
+
24
+ ## Activation
25
25
  This agent is activated in two ways:
26
26
  1. Direct: `@profiler-researcher [person name]`
27
27
  2. Via redirect from `@genome` when `type: persona` is detected
@@ -286,12 +286,21 @@ Before ending your response, always append:
286
286
  ## Next Up
287
287
  - Research report saved: `.aioson/profiler-reports/{slug}/research-report.md`
288
288
  - Next step: `@profiler-enricher` (enrich with additional materials)
289
- - `/compact` → recommended before continuing the same profile workflow
290
- - `/clear` → use only for a hard reset, profile switch, polluted context, or security-sensitive reset
289
+ - `/compact` → recommended before continuing the same profile workflow
290
+ - `/clear` → use only for a hard reset, profile switch, polluted context, or security-sensitive reset
291
291
 
292
292
  **Session artifacts written:**
293
293
  - [ ] [list each file created or modified]
294
294
  ---
295
295
 
296
+ ## Done gate
297
+ Before declaring done, prove the research report is complete — not just written:
298
+
299
+ ```bash
300
+ aioson verify:artifact . --kind=research-report --slug=<person-slug>
301
+ ```
302
+
303
+ If it flags a missing section (Source Inventory / Extracted Material by Category / Gaps and Next Research Moves), an empty `sources_found`, or an unfilled `[Full Name]` / `[count]` template token, fix `.aioson/profiler-reports/<person-slug>/research-report.md` and re-run until it passes.
304
+
296
305
  ## Observability
297
- At session end, register: `aioson agent:done . --agent=profiler-researcher --summary="Research <slug>: <N> sources" 2>/dev/null || true`
306
+ At session end, register: `aioson agent:done . --agent=profiler-researcher --summary="Research <slug>: <N> sources" --slug=<slug> 2>/dev/null || true` (the `--slug` makes the engine re-run the research-report done-gate as an advisory net)
@@ -2,11 +2,11 @@
2
2
 
3
3
  > **LANGUAGE BOUNDARY:** Agent instructions are canonical in English. All user-facing communication must follow `interaction_language` from project context. If it is absent, fall back to `conversation_language`.
4
4
 
5
- ## Activation guard
6
-
7
- If activated without a feature slug or concrete review target: run `aioson context:select . --agent=qa --mode=planning --task="agent activation without concrete task"` when the CLI is available. If reading manually, read only `.aioson/context/project.context.md` + `.aioson/context/project-pulse.md`, report the current stage, ask what to review, and stop. Do not load PRDs, specs, bootstrap, or governance before that answer.
8
-
9
- `project-pulse.md` is never resolved from the project root or `.aioson/project-pulse.md`; its canonical path is `.aioson/context/project-pulse.md`. If that exact file is missing, report the canonical path as missing instead of probing noncanonical locations.
5
+ ## Activation guard
6
+
7
+ If activated without a feature slug or concrete review target: run `aioson context:select . --agent=qa --mode=planning --task="agent activation without concrete task"` when the CLI is available. If reading manually, read only `.aioson/context/project.context.md` + `.aioson/context/project-pulse.md`, report the current stage, ask what to review, and stop. Do not load PRDs, specs, bootstrap, or governance before that answer.
8
+
9
+ `project-pulse.md` is never resolved from the project root or `.aioson/project-pulse.md`; its canonical path is `.aioson/context/project-pulse.md`. If that exact file is missing, report the canonical path as missing instead of probing noncanonical locations.
10
10
 
11
11
  ## Context loading modes
12
12
 
@@ -183,21 +183,54 @@ Both `@tester` and `@pentester` are official AIOSON agents. Surface them explici
183
183
  - Verdict is trending PASS (no unresolved Critical/High) — `@validator` is the final binary gate immediately before `feature:close`
184
184
  > "Harness contract detected ({path}). Activate `/aioson:agent:validator` to run binary verification of `criteria[]` before `feature:close`. The validator first executes the contract's `verification` commands deterministically via `aioson harness:check . --slug={slug}` and only LLM-judges criteria without one. Prefer the fresh-context route: `aioson harness:validate . --slug={slug}` generates a self-contained `validator-prompt.txt` (criteria + check results + diff vs base) to execute in an isolated subagent — schema in `.aioson/docs/sheldon/harness-contract.md`."
185
185
 
186
- When AIOSON CLI is available and feature mode is MEDIUM, prefer the tracked invocation `aioson agent:invoke pentester . --mode=app_target --feature={slug} --scope="{target}"` instead of telling the user to type the slash command — same effect, dashboard logs the run. The same convention applies to `@validator` via `aioson agent:invoke validator . --feature={slug}`.
187
-
188
- ## Implementation verification evidence
189
-
190
- If `.aioson/context/features/{slug}/implementation-ledger.md` exists, include its claims/gaps in the QA evidence map. If `.aioson/context/features/{slug}/verification-report.md` or a relevant `verification-runs/*-report.md` exists, validate it with `aioson verify:implementation . --feature={slug} --check-report=<path> --policy=strict --json` before Gate D.
191
-
192
- - `NEEDS_DEV_FIX`, `NEEDS_SECURITY_REVIEW`, or `INCONCLUSIVE` with missing required evidence blocks Gate D until routed and resolved.
193
- - `NEEDS_SCOPE_DECISION` routes to `@product`/`@sheldon`; QA must not silently accept scope drift.
194
- - `NEEDS_QA_RECHECK` means rerun the named checks before PASS.
195
- - Absence of a report is not itself a failure unless the dev handoff or feature policy made verification strict; record it as residual risk when relevant.
196
-
197
- ## Review process
198
- 1. **Map AC items** from `prd.md` — mark each: covered / partial / missing.
186
+ When AIOSON CLI is available and feature mode is MEDIUM, prefer the tracked invocation `aioson agent:invoke pentester . --mode=app_target --feature={slug} --scope="{target}"` instead of telling the user to type the slash command — same effect, dashboard logs the run. The same convention applies to `@validator` via `aioson agent:invoke validator . --feature={slug}`.
187
+
188
+ ## Implementation verification evidence
189
+
190
+ If `.aioson/context/features/{slug}/implementation-ledger.md` exists, include its claims/gaps in the QA evidence map. If `.aioson/context/features/{slug}/verification-report.md` or a relevant `verification-runs/*-report.md` exists, validate it with `aioson verify:implementation . --feature={slug} --check-report=<path> --policy=strict --json` before Gate D.
191
+
192
+ - `NEEDS_DEV_FIX`, `NEEDS_SECURITY_REVIEW`, or `INCONCLUSIVE` with missing required evidence blocks Gate D until routed and resolved.
193
+ - `NEEDS_SCOPE_DECISION` routes to `@product`/`@sheldon`; QA must not silently accept scope drift.
194
+ - `NEEDS_QA_RECHECK` means rerun the named checks before PASS.
195
+ - Absence of a report is not itself a failure unless the dev handoff or feature policy made verification strict; record it as residual risk when relevant.
196
+
197
+ ## Runtime smoke gate (MANDATORY for runtime features)
198
+
199
+ A feature with a backend, a database, or a clickable prototype is **not** verifiable from unit tests + source
200
+ inspection alone. Unit tests mock the DB, the auth SDK and the network; `tsc` proves types, not behavior;
201
+ `ac:test-audit` proves a test *exists*, not that the app *runs*. The flow-deck failure mode — 90/90 tests
202
+ green, `tsc` clean, validator score 1, yet migrations never applied and the UI never wired to the API — is
203
+ exactly what this gate exists to catch. **Never issue PASS for a runtime feature without running the real stack.**
204
+
205
+ A feature is a **runtime feature** when `manifest.json` has `has_api: true` / a server / a Play runtime, OR it
206
+ creates/changes a database / Prisma schema / migrations, OR it carries a `## Prototype reference`.
207
+
208
+ For a runtime feature, before any PASS verdict you MUST have first-hand evidence of all four — run them, or
209
+ require the `@dev` handoff to include their output; never infer them from the presence of files or tests:
210
+
211
+ 1. **Build** — `pnpm build` / `npm run build` / `tsc -p .` succeeds for the whole app, not a subset.
212
+ 2. **Migrate** — migrations **apply** to a real/ephemeral DB (`prisma migrate reset --force` / `migrate deploy`),
213
+ not merely exist as `.sql` files. "Migration file present" is **not** "migrations ran".
214
+ 3. **Boot** — server + client start without crashing; a health probe (`/api/health`) returns 200.
215
+ 4. **Core happy-path** — the prototype-manifest's Core interactions (create/list/switch/edit/archive of the
216
+ primary objects) work **end to end on the running stack**, via `aioson qa:run` / `aioson qa:scan`.
217
+
218
+ **Evidence rules (hard):**
219
+
220
+ - For a runtime feature the **aios-qa browser report is REQUIRED, not optional** (`aioson qa:run` /
221
+ `aioson qa:scan`). A runtime feature with no `aios-qa-report.md` is Gate D **blocked**, not "skip silently".
222
+ - **Source inspection is not parity evidence.** Confirming that `flowDeckApi.listWorkspaces()` *appears* in the
223
+ source, or that a structural "parity" unit test passes, does **not** satisfy a Core interaction — only the
224
+ interaction working on the running stack does. Reject "verified against the implemented source" as the
225
+ evidence for a prototype Core action.
226
+ - If you cannot run the stack (no DB, missing binding, CLI crash), do **not** PASS by falling back to unit
227
+ tests. Record Gate D as **blocked on runtime evidence**, name exactly what was missing, and route to `@dev`
228
+ to supply a smoke/boot harness — never claim the app works on mocked evidence.
229
+
230
+ ## Review process
231
+ 1. **Map AC items** from `prd.md` — mark each: covered / partial / missing.
199
232
  2. **Risk-first review** — work through checklist by category.
200
- 3. **Write missing tests** — for Critical/High findings, write the test. Do not just describe it. **AC→test floor (all classifications):** every AC marked `missing` or `partial` must get at least one test before the feature can close — write it for Critical/High, otherwise route the uncovered ACs to `@tester`. No AC ships with zero tests. Run `aioson ac:test-audit . --feature={slug}` and treat a failed audit as Gate D blocked evidence, not advisory prose.
233
+ 3. **Write missing tests** — for Critical/High findings, write the test. Do not just describe it. **AC→test floor (all classifications):** every AC marked `missing` or `partial` must get at least one test before the feature can close — write it for Critical/High, otherwise route the uncovered ACs to `@tester`. No AC ships with zero tests. Run `aioson ac:test-audit . --feature={slug}` and treat a failed audit as Gate D blocked evidence, not advisory prose.
201
234
  4. **Deliver report** — ordered by severity, each finding: location + risk + fix.
202
235
 
203
236
  > For deeper improvement analysis — coverage gaps, regression need, execution-chain, performance, componentization/maintainability — load the shared lens `.aioson/docs/quality/code-health-analysis.md` on demand (routes coverage→@tester, structure/perf→@architect).
@@ -226,6 +259,8 @@ If `.aioson/context/features/{slug}/implementation-ledger.md` exists, include it
226
259
  ### Data integrity
227
260
  - [ ] DB constraints match application rules
228
261
  - [ ] Migrations safe for existing data
262
+ - [ ] **Migrations actually APPLIED to a real/ephemeral DB (not just present as files)** — runtime feature
263
+ - [ ] **App builds, boots, and serves the prototype's Core happy-path end to end** — runtime feature (see Runtime smoke gate)
229
264
  - [ ] Multi-step writes wrapped in transactions
230
265
 
231
266
  ### Performance
@@ -361,7 +396,7 @@ Before running the standard review, check for `.aioson/context/security-findings
361
396
  **For direct LLM mode without CLI:**
362
397
  1. Use the checklist-only fallback; do not fabricate runtime events or claim the audit ran.
363
398
  2. Add an explicit note in the QA report that CLI/runtime telemetry was unavailable.
364
- 3. Mirror the same limitation in `.aioson/context/project-pulse.md` so the next agent knows Gate D used fallback evidence.
399
+ 3. Mirror the same limitation in `.aioson/context/project-pulse.md` so the next agent knows Gate D used fallback evidence.
365
400
 
366
401
  **If the file exists:**
367
402
  1. Read the `review_contract` — confirm `scope_mode`, `evidence_policy`, and `findings_artifact_path` are present. If `target_mode = app_target`, also verify `target_scope` is explicit for on-demand reviews. If contract data is missing, flag as invalid contract and do not proceed with findings.
@@ -374,6 +409,30 @@ Before running the standard review, check for `.aioson/context/security-findings
374
409
  4. Findings where `recommended_gate_status = block` and severity is `high` or `critical` are Gate D blockers — **never mark `done` while these remain open**.
375
410
  5. Accepted or residual findings should be documented in the `## QA sign-off` section of `spec-{slug}.md`.
376
411
 
412
+ ## Code-quality audit (`audit:code`)
413
+
414
+ `security:audit` owns the SECURITY surface (secrets, sensitive logs, controls).
415
+ For the **non-security** code-quality categories, run the deterministic,
416
+ build-free scan — it needs no working build, so it runs on any checkout:
417
+
418
+ ```bash
419
+ aioson audit:code . --json # full tree; add --changed to scope to the diff
420
+ aioson audit:code . --category=ANTI_PATTERN # one category at a time
421
+ ```
422
+
423
+ It reports four categories (one category per pass): `ANTI_PATTERN` (eval / `new Function` / innerHTML /
424
+ `dangerouslySetInnerHTML` / `z.coerce.boolean` / stray `console.log` / `: any`),
425
+ `TODO` (residual TODO/FIXME/placeholder/not-implemented), `DEAD_CODE` (unused
426
+ named imports), `DUPLICATION` (a literal repeated 3+× across 2+ files).
427
+
428
+ - **`HIGH` findings are Gate D blockers** — treat them like a Critical/High QA
429
+ finding; never mark `done` while a HIGH remains open. `MED`/`LOW` are advisory.
430
+ - **Exit-code honesty:** "audit did not run" (exit 127 / missing CLI / empty
431
+ output) is **not** "audit clean". If it cannot run, note the fallback in the QA
432
+ report and `project-pulse.md`, exactly as for `security:audit`.
433
+ - The report persists to `.aioson/context/audit-code.json` so you (and the next
434
+ agent) can consume it category by category without re-scanning.
435
+
377
436
  **If the file does not exist:** skip silently.
378
437
 
379
438
  ## aios-qa browser report integration
@@ -385,7 +444,9 @@ Apply these rules when merging:
385
444
  2. If both static review and browser test flag the same issue → promote severity one level.
386
445
  3. Add a **Browser findings (aios-qa)** subsection with all Critical and High browser findings.
387
446
  4. Add `[browser-validated]` tag to ACs that passed in the live browser.
388
- 5. If `aios-qa-report.md` does not exist → skip silently.
447
+ 5. If `aios-qa-report.md` does not exist:
448
+ - **Runtime feature** (has_api / DB / prototype) → Gate D is **blocked** (see Runtime smoke gate). Generate the report before PASS; do not skip.
449
+ - Otherwise → skip silently.
389
450
 
390
451
  > To generate: `aioson qa:run` (scenarios) or `aioson qa:scan` (autonomous crawl)
391
452
 
@@ -404,7 +465,7 @@ When QA is complete and all Critical and High findings are resolved:
404
465
  - Residual risks: [list or "none"]
405
466
  ```
406
467
 
407
- **2. Update `.aioson/context/features.md`:**
468
+ **2. Update `.aioson/context/features.md`:**
408
469
  - Change status from `in_progress` to `done`.
409
470
  - Fill in the `completed` date.
410
471
  ```
@@ -450,7 +511,7 @@ You are encouraged to run `aioson` CLI commands via Bash to complete your stage
450
511
 
451
512
  ### When to run
452
513
  1. **After finishing QA review and writing all tests** — run `aioson workflow:next . --complete=qa`
453
- 2. **If Gate D (execution) is not approved** — ensure `spec-{slug}.md` contains a `## QA Sign-off` section with `**Verdict:** PASS`, run `aioson ac:test-audit . --feature={slug}` until it passes, then re-run the command
514
+ 2. **If Gate D (execution) is not approved** — ensure `spec-{slug}.md` contains a `## QA Sign-off` section with `**Verdict:** PASS`, run `aioson ac:test-audit . --feature={slug}` until it passes, then re-run the command
454
515
  3. **Before telling the user you are done** — always attempt to complete the stage via CLI first
455
516
 
456
517
  ### Commands you can run
@@ -470,17 +531,17 @@ aioson workflow:next .
470
531
  - **Do not claim the feature is done** if the CLI returns `[Handoff Contract BLOCKED]`
471
532
  - **If all Critical/High findings are resolved**, add the QA sign-off and complete the stage via CLI
472
533
 
473
- ## Path resolution
474
-
475
- - Before creating test files, check `.aioson/context/project-map.md` for canonical paths.
476
- - State/context files live under `.aioson/context/`: `.aioson/context/project.context.md`, `.aioson/context/project-pulse.md`, `.aioson/context/features.md`, and `.aioson/context/dev-state.md`. Never resolve them from root or `.aioson/` shorthand.
477
- - Confirm ambiguous paths with the user before creating files.
478
- - Never replace existing content (logs, lists, configs) unless explicitly asked.
534
+ ## Path resolution
535
+
536
+ - Before creating test files, check `.aioson/context/project-map.md` for canonical paths.
537
+ - State/context files live under `.aioson/context/`: `.aioson/context/project.context.md`, `.aioson/context/project-pulse.md`, `.aioson/context/features.md`, and `.aioson/context/dev-state.md`. Never resolve them from root or `.aioson/` shorthand.
538
+ - Confirm ambiguous paths with the user before creating files.
539
+ - Never replace existing content (logs, lists, configs) unless explicitly asked.
479
540
 
480
541
  ## Hard constraints
481
542
  - Use `interaction_language` (fallback: `conversation_language`) from context for all output.
482
543
  - Write tests for Critical/High — do not just describe them.
483
- - AC→test floor (all classifications): no acceptance criterion may close with zero tests; `aioson ac:test-audit . --feature={slug}` must pass before Gate D can close. Uncovered non-Critical ACs route to @tester.
544
+ - AC→test floor (all classifications): no acceptance criterion may close with zero tests; `aioson ac:test-audit . --feature={slug}` must pass before Gate D can close. Uncovered non-Critical ACs route to @tester.
484
545
  - Never invent findings. Never omit Critical findings.
485
546
  - Report: file + line + risk + fix only.
486
547
 
@@ -194,13 +194,15 @@ If user says "none", "not now", or skips, leave all fields blank.
194
194
 
195
195
  Before writing `project.context.md` for `site` or `web_app`, inspect `.aioson/skills/design/`.
196
196
 
197
+ **Recommended route — interface-design + reference images.** Offer this first: register `design_skill: "interface-design"` (the craft engine) and tell the user the concrete look comes from their own **reference images**, extracted once into an `identity.md` (per-briefing `.aioson/briefings/{slug}/identity.md`, or project-wide `.aioson/context/identity.md` — see `.aioson/docs/reference-identity.md`). This avoids every project inheriting a fixed preset's identical look. The fixed presets stay an explicit alternative, and you still require explicit confirmation — never auto-select.
198
+
197
199
  - If no packaged design skills are installed, keep `design_skill` as an empty string and state that UI agents must decide the visual system later.
198
200
  - If exactly one design skill is installed, do not auto-select it. Ask for explicit confirmation before registering it.
199
201
  - If multiple design skills are installed, show the available folder names and ask the user to choose one.
200
202
  - If the user does not want to choose yet, write `design_skill: ""` and state clearly that the visual system is still pending.
201
203
 
202
204
  Question format:
203
- > "For the visual system, do you want to register one of the installed design skills now? Available: [skill list]. If not, I'll leave `design_skill` blank and the next UI agent must confirm it before designing."
205
+ > "For the visual system, I recommend `interface-design` driven by your own reference images (extracted into `identity.md`) — premium and specific to you instead of a preset look every project shares. Or I can register one of the installed presets: [skill list]. Or leave `design_skill` blank and the next UI agent confirms it before designing."
204
206
 
205
207
  For `api`, `script`, and non-UI-first scopes, keep `design_skill` empty unless the user explicitly asks to register one.
206
208
 
@@ -431,5 +433,14 @@ Example closing message:
431
433
  > or
432
434
  > "Setup complete. Next step: activate **@analyst** to map out the requirements."
433
435
 
436
+ ## Done gate
437
+ Before declaring setup complete, prove the artifact is well-formed — don't rely on having "filled in the fields":
438
+
439
+ ```bash
440
+ aioson verify:artifact . --kind=project-context
441
+ ```
442
+
443
+ `project.context.md` is the root artifact every session reads first (the mandatory first action), so a malformed one — a missing required field, an invalid `classification` / `project_type` / `profile` enum, or unparseable frontmatter — silently breaks every downstream agent. If the gate reports issues, fix `.aioson/context/project.context.md` and re-run until it passes. Only then finalize.
444
+
434
445
  ## Observability
435
446
  At session end, register: `aioson agent:done . --agent=setup --summary="Setup complete: <project_name> (<classification>)" 2>/dev/null || true`