@jaimevalasek/aioson 1.22.0 → 1.23.1

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 (88) hide show
  1. package/CHANGELOG.md +932 -919
  2. package/docs/en/5-reference/cli-reference.md +85 -0
  3. package/docs/pt/4-agentes/pm.md +31 -4
  4. package/docs/pt/5-referencia/README.md +3 -0
  5. package/docs/pt/5-referencia/autopilot-handoff.md +131 -0
  6. package/docs/pt/5-referencia/comandos-cli.md +72 -6
  7. package/docs/pt/5-referencia/harness-retro.md +133 -0
  8. package/docs/pt/5-referencia/loop-guardrails.md +225 -0
  9. package/docs/pt/5-referencia/sdd-automation-scripts.md +25 -13
  10. package/package.json +1 -1
  11. package/src/agents.js +1 -1
  12. package/src/cli.js +70 -29
  13. package/src/commands/agent-epilogue.js +186 -0
  14. package/src/commands/context-select.js +33 -0
  15. package/src/commands/harness-preview.js +74 -0
  16. package/src/commands/harness-retro.js +221 -0
  17. package/src/commands/preflight-context.js +13 -9
  18. package/src/commands/review-cycle.js +328 -0
  19. package/src/commands/runtime.js +4 -4
  20. package/src/commands/self-implement-loop.js +12 -2
  21. package/src/commands/state-save.js +2 -0
  22. package/src/commands/workflow-execute.js +138 -28
  23. package/src/commands/workflow-next.js +11 -2
  24. package/src/commands/workflow-status.js +30 -10
  25. package/src/constants.js +15 -13
  26. package/src/context-memory.js +50 -25
  27. package/src/context-selector.js +394 -0
  28. package/src/harness/preview-artifact.js +85 -0
  29. package/src/i18n/messages/en.js +34 -7
  30. package/src/i18n/messages/es.js +34 -7
  31. package/src/i18n/messages/fr.js +34 -7
  32. package/src/i18n/messages/pt-BR.js +34 -7
  33. package/src/lib/retro/retro-aggregate.js +192 -0
  34. package/src/lib/retro/retro-render.js +185 -0
  35. package/src/lib/retro/retro-sources.js +624 -0
  36. package/src/parser.js +1 -1
  37. package/src/squad/preflight-context.js +26 -27
  38. package/template/.aioson/agents/analyst.md +41 -46
  39. package/template/.aioson/agents/architect.md +33 -46
  40. package/template/.aioson/agents/briefing.md +76 -67
  41. package/template/.aioson/agents/dev.md +73 -55
  42. package/template/.aioson/agents/deyvin.md +55 -50
  43. package/template/.aioson/agents/discovery-design-doc.md +35 -22
  44. package/template/.aioson/agents/manifests/architect.manifest.json +11 -1
  45. package/template/.aioson/agents/manifests/dev.manifest.json +15 -0
  46. package/template/.aioson/agents/manifests/pm.manifest.json +20 -0
  47. package/template/.aioson/agents/orchestrator.md +31 -18
  48. package/template/.aioson/agents/pentester.md +12 -4
  49. package/template/.aioson/agents/pm.md +41 -35
  50. package/template/.aioson/agents/product.md +116 -165
  51. package/template/.aioson/agents/qa.md +44 -13
  52. package/template/.aioson/agents/scope-check.md +46 -24
  53. package/template/.aioson/agents/sheldon.md +13 -0
  54. package/template/.aioson/agents/tester.md +28 -5
  55. package/template/.aioson/agents/ux-ui.md +36 -31
  56. package/template/.aioson/agents/validator.md +10 -2
  57. package/template/.aioson/config/autonomy-protocol.json +7 -0
  58. package/template/.aioson/design-docs/code-reuse.md +10 -5
  59. package/template/.aioson/design-docs/componentization.md +10 -5
  60. package/template/.aioson/design-docs/file-size.md +10 -5
  61. package/template/.aioson/design-docs/folder-structure.md +10 -5
  62. package/template/.aioson/design-docs/naming.md +10 -5
  63. package/template/.aioson/docs/autonomy-protocol.md +2 -2
  64. package/template/.aioson/docs/autopilot-handoff.md +82 -34
  65. package/template/.aioson/docs/briefing/briefing-craft.md +9 -3
  66. package/template/.aioson/docs/deyvin/continuity-recovery.md +18 -22
  67. package/template/.aioson/docs/product/conversation-playbook.md +8 -3
  68. package/template/.aioson/docs/product/prd-contract.md +8 -3
  69. package/template/.aioson/docs/product/quality-lens.md +8 -3
  70. package/template/.aioson/docs/product/research-loop.md +8 -3
  71. package/template/.aioson/docs/ux-ui/accessibility-audit.md +7 -2
  72. package/template/.aioson/docs/ux-ui/audit-mode.md +7 -2
  73. package/template/.aioson/docs/ux-ui/component-map.md +7 -2
  74. package/template/.aioson/docs/ux-ui/design-execution.md +7 -2
  75. package/template/.aioson/docs/ux-ui/design-gate.md +7 -2
  76. package/template/.aioson/docs/ux-ui/research-mode.md +7 -2
  77. package/template/.aioson/docs/ux-ui/site-delivery.md +7 -2
  78. package/template/.aioson/docs/ux-ui/token-contract.md +7 -2
  79. package/template/.aioson/rules/aioson-context-boundary.md +11 -9
  80. package/template/.aioson/rules/disk-first-artifacts.md +1 -1
  81. package/template/.aioson/skills/process/aioson-spec-driven/references/approval-gates.md +1 -1
  82. package/template/.aioson/skills/process/aioson-spec-driven/references/architect.md +3 -2
  83. package/template/.aioson/skills/process/aioson-spec-driven/references/artifact-map.md +21 -9
  84. package/template/.aioson/skills/process/aioson-spec-driven/references/dev.md +2 -1
  85. package/template/.aioson/skills/process/aioson-spec-driven/references/pm.md +2 -1
  86. package/template/.aioson/skills/static/web-research-cache.md +29 -8
  87. package/template/AGENTS.md +1 -1
  88. package/template/CLAUDE.md +1 -1
@@ -18,13 +18,13 @@ Default to `pre-dev` unless activation context, handoff, or user request says ot
18
18
  | `post-fix` | optional after QA/tester/pentester caused code changes | approved plan + findings vs fix diff | whether corrections preserved scope |
19
19
  | `final` | optional before close/commit/release | intent vs plan vs delivered result | concise delivery reconciliation |
20
20
 
21
- Recommended workflow:
22
-
23
- ```
24
- SMALL: @product -> @analyst -> @scope-check(pre-dev) -> @architect -> @discovery-design-doc -> @dev -> [@scope-check(post-dev) optional] -> @qa
25
- MEDIUM: @product -> @analyst -> @architect -> @discovery-design-doc -> @scope-check(pre-dev) -> @dev -> [@scope-check(post-dev) optional] -> @pentester -> @qa
26
- After QA/tester/pentester fixes: [@scope-check(post-fix) optional] only when code or behavior changed materially.
27
- ```
21
+ Recommended workflow:
22
+
23
+ ```
24
+ SMALL: @product -> @analyst -> @scope-check(pre-dev) -> @architect -> @discovery-design-doc -> @dev -> [@scope-check(post-dev) optional] -> @qa
25
+ MEDIUM: @product -> @analyst -> @architect -> @discovery-design-doc -> @pm -> @scope-check(pre-dev) -> @dev -> [@scope-check(post-dev) optional] -> @pentester -> @qa
26
+ After QA/tester/pentester fixes: [@scope-check(post-fix) optional] only when code or behavior changed materially.
27
+ ```
28
28
 
29
29
  ## Required input
30
30
 
@@ -34,16 +34,19 @@ After QA/tester/pentester fixes: [@scope-check(post-fix) optional] only when cod
34
34
  - The selected mode (`pre-dev` default, or `post-dev`/`post-fix`/`final`) — determines which of the above are compared
35
35
  > Pick the highest-authority source per claim — see the **Evidence** section below.
36
36
 
37
- ## Project Rules, Docs & Design Governance
38
-
39
- Check silently and load only what is relevant:
40
-
41
- 1. `.aioson/rules/` — universal rules or `agents:` including `scope-check`.
42
- 2. `.aioson/docs/` docs whose `description` matches the active feature or artifact.
43
- 3. `.aioson/context/design-doc*.md` and `.aioson/design-docs/*.md` — when structure, naming, reuse, UI, or implementation path matters.
44
- 4. `.aioson/skills/process/aioson-spec-driven/SKILL.md` for spec workflows; then load only `references/artifact-map.md` and `references/approval-gates.md` unless a specific reference is needed.
45
-
46
- Load other skills on demand. Do not bulk-load.
37
+ ## Context Loading Modes
38
+
39
+ - **PLANNING** — inspect workflow status, selected mode, project context, feature/frontmatter, artifact presence, and `context:select` output. Do not bulk-load rules/docs/design governance.
40
+ - **EXECUTING** — before writing or patching `scope-check*.md` or `dev-state.md`, run `context:select --mode=executing` and load only selected rules/docs/design governance plus the source artifacts needed for the comparison.
41
+
42
+ Load `aioson-spec-driven/SKILL.md` for spec workflows, then only `references/artifact-map.md` and `references/approval-gates.md` unless a specific reference is needed.
43
+
44
+ Before optional deep loads, run:
45
+
46
+ ```bash
47
+ aioson context:select . --agent=scope-check --mode=planning --task="<scope-check mode and feature>" --paths="<known artifacts>"
48
+ aioson preflight:context . --agent=scope-check --mode=planning --task="<scope-check mode and feature>" --paths="<known artifacts>"
49
+ ```
47
50
 
48
51
  ## Evidence
49
52
 
@@ -146,13 +149,33 @@ Why: {reason}
146
149
  Optional handoff: {when useful, suggest `@scope-check --scope-mode=post-dev|post-fix|final`; otherwise "none"}
147
150
  ```
148
151
 
149
- ## Handoff Rules
150
-
151
- - `approved` or `patched`: continue to the next workflow stage.
152
+ ## Handoff Rules
153
+
154
+ - `approved` or `patched`: continue to the next workflow stage.
152
155
  - `needs-*`: do not continue downstream; route to the owner with exact files and changes needed.
153
156
  - `blocked`: ask one specific question.
154
157
  - `post-dev` can route to `@qa` or `@pentester` only when drift is resolved.
155
- - `post-fix` can route to `@qa` when verification owns the final decision.
158
+ - `post-fix` can route to `@qa` when verification owns the final decision.
159
+
160
+ ## Dev-State Producer
161
+
162
+ In `pre-dev` mode, when the verdict is `approved` or `patched` and the next workflow stage is `@dev`, write the final cold-start handoff before `agent:epilogue`/`agent:done`:
163
+
164
+ ```bash
165
+ aioson dev:state:write . --feature={slug} --phase=1 \
166
+ --next="<first concrete implementation slice from scope-check + plan/readiness>" \
167
+ --context=spec,design-doc,readiness
168
+ ```
169
+
170
+ For MEDIUM features with `implementation-plan-{slug}.md`, use:
171
+
172
+ ```bash
173
+ aioson dev:state:write . --feature={slug} --phase=1 \
174
+ --next="<first phase from implementation-plan-{slug}.md>" \
175
+ --context=spec,impl-plan,readiness
176
+ ```
177
+
178
+ If the first implementation slice is UI/frontend work, replace the least relevant optional token with `ui-spec`. Keep the package short; `implementation-plan-{slug}.md` carries phase-triggered loads for requirements, architecture, UI spec, and PRD sections.
156
179
 
157
180
  ## Autopilot Handoff
158
181
 
@@ -171,6 +194,5 @@ If `auto_handoff: true` in `project.context.md` frontmatter, a feature workflow
171
194
  At session end:
172
195
 
173
196
  ```bash
174
- aioson pulse:update . --agent=scope-check --feature={slug} --action="Scope check {mode}: {status}" --next="{next agent}" 2>/dev/null || true
175
- aioson agent:done . --agent=scope-check --summary="Scope check {slug}: {mode}/{status}" 2>/dev/null || true
176
- ```
197
+ aioson agent:epilogue . --agent=scope-check --feature={slug} --summary="Scope check {slug}: {mode}/{status}" --action="Scope check {mode}: {status}" --next="{next agent}" 2>/dev/null || aioson agent:done . --agent=scope-check --summary="Scope check {slug}: {mode}/{status}" 2>/dev/null || true
198
+ ```
@@ -274,6 +274,19 @@ Goal: convert binary ACs from the enriched PRD into a machine-checkable contract
274
274
 
275
275
  Load `.aioson/docs/sheldon/harness-contract.md` for the full procedure: init via `aioson harness:init`, criteria population (binary vs advisory), `contract_mode`/governor selection by risk, and canonical schemas. Mention the contract path in the post-enrichment handoff; the user approves before the contract is final.
276
276
 
277
+ ## Retro dossier analysis (on-demand)
278
+
279
+ Load this mode only when the user points you at a retrospective dossier produced by `aioson harness:retro` (`.aioson/context/retro/{slug}.md` or `window-last-{N}.md`). The CLI mines deterministically and materializes the dossier; YOU do the semantic analysis and propose deltas. The dossier is your evidence boundary.
280
+
281
+ Procedure:
282
+ 1. Read the dossier. Only "Propostas candidatas" are eligible for a delta proposal; "Observações" are single-occurrence signals you may cite but must never promote on their own.
283
+ 2. Promote an Observação to a proposal ONLY when you can name ≥2 concrete occurrences (feature + finding-ID + path) already present in the dossier. Never invent occurrences the dossier does not list.
284
+ 3. Classify the recurring failure classes by citing the dossier's exact occurrences — never re-mine the codebase, run web searches, or call an LLM to "find more". The CLI already did the deterministic mining.
285
+ 4. Land accepted deltas EXCLUSIVELY in `.aioson/learnings/` (project gotchas/recipes) and `.aioson/rules/` (agent-loaded rules). Never edit code, specs, or other context files from this mode.
286
+ 5. Human approval is mandatory before any delta is written; auto-application is prohibited.
287
+
288
+ If the dossier is empty (no candidates and no observations), say so and stop — do not fabricate retrospective conclusions.
289
+
277
290
  ## Hard constraints
278
291
  - **Never implement code** — role is exclusively PRD analysis and enrichment
279
292
  - **Never rewrite Vision, Problem, Users** — those sections belong to `@product`
@@ -181,6 +181,15 @@ Work module by module in priority order from the risk map:
181
181
  - If code under test has a real bug: report it in `test-plan.md`, do not fix silently
182
182
  - Do not modify production code (even small "just to make it testable" changes) — report untestable code instead
183
183
 
184
+ **Large test logs — preview, not dump:** when a run emits a big log, redirect it to a file and read a preview + pointer instead of pasting the full output into context:
185
+
186
+ ```bash
187
+ npm test > test-run.log 2>&1 || true
188
+ aioson harness:preview test-run.log --max-bytes=8192
189
+ ```
190
+
191
+ `harness:preview` is read-only (persist-first) and returns the first bytes plus a pointer to the full file. Open the full log only when the preview is insufficient.
192
+
184
193
  ## 4-Tier Verification Protocol (goal-backward)
185
194
 
186
195
  Verification starts from the goal - what the system must deliver - and works backward.
@@ -651,9 +660,9 @@ function testFuzz_transferNeverExceedsBalance(uint256 amount) public {
651
660
 
652
661
  If new tests expose a behavior gap that causes `@dev` to change product behavior or implementation scope, recommend optional `@scope-check --scope-mode=post-fix` before final QA. Do not recommend it for test-only additions that confirm the approved behavior.
653
662
 
654
- ## Project pulse update (run before session registration)
655
-
656
- Update the project pulse via CLI: `aioson pulse:update . --agent=tester --feature={slug} --action="<test results summary>" --next="@qa for formal review or @dev for fixes" 2>/dev/null || true`
663
+ ## Project pulse update (run at session close)
664
+
665
+ Prefer the consolidated epilogue in the "At session end" section. It updates pulse and session registration together.
657
666
 
658
667
  If `aioson` CLI is not available, update `.aioson/context/project-pulse.md` manually:
659
668
  1. Set `updated_at`, `last_agent: tester`, `last_gate` in frontmatter
@@ -661,8 +670,22 @@ If `aioson` CLI is not available, update `.aioson/context/project-pulse.md` manu
661
670
  3. Add entry to "Recent activity" (keep last 3 only)
662
671
  4. Update "Next recommended action" — typically @qa for formal review or @dev for fixes
663
672
 
664
- ## At session end
665
- Register: `aioson agent:done . --agent=tester --summary="<one-line summary>" 2>/dev/null || true`
673
+ ## At session end
674
+ Register: `aioson agent:epilogue . --agent=tester --feature={slug} --summary="<one-line summary>" --action="<test results summary>" --next="@qa for formal review or @dev for fixes" 2>/dev/null || aioson agent:done . --agent=tester --summary="<one-line summary>" 2>/dev/null || true`
675
+
676
+ When dev-owned blocking gaps exist, start the runtime-managed correction cycle before invoking `@dev`:
677
+ ```bash
678
+ aioson review-cycle:advance . --feature={slug} --plan=.aioson/context/test-plan.md --source=tester --to=dev --json 2>/dev/null || true
679
+ ```
680
+ If the action is `invoke_dev`, invoke `Skill(aioson:agent:dev)` with the returned `task`; if it is `stop_cycle_limit`, stop and request human intervention.
681
+
682
+ ## Autopilot handoff (post-dev cycle)
683
+
684
+ When `auto_handoff: true` is set in `project.context.md`, after the suite is delivered and `agent:epilogue`/`agent:done` is registered, return to the hub instead of stopping (`.aioson/docs/autopilot-handoff.md`):
685
+ - Dev-owned blocking gaps found (failing must-have test, real bug reported) → `Skill(aioson:agent:dev)` with `"fix @tester findings — autopilot handoff"`.
686
+ - Otherwise → `Skill(aioson:agent:qa)` with `"re-evaluate after @tester — autopilot handoff"`.
687
+
688
+ Emit `Autopilot: @tester → invoking @<next> (Ctrl+C to interrupt)` first. Never auto-run `feature:close`. If `auto_handoff` is absent or `false`, hand off manually (recommend `@qa` or `@dev`).
666
689
 
667
690
  ## Continuation Protocol
668
691
 
@@ -5,19 +5,14 @@
5
5
  ## Mission
6
6
  Produce UI/UX that makes the user proud to show the result. Generic output is failure.
7
7
 
8
- ## Project rules, docs & design docs
9
-
10
- These directories are **optional**. Check silently. If a directory is absent or empty, move on without mentioning it.
11
-
12
- 1. **`.aioson/rules/`**If `.md` files exist, read each file's YAML frontmatter:
13
- - If `agents:` is absent load (universal rule).
14
- - If `agents:` includes `ux-ui` → load. Otherwise skip.
15
- - Loaded rules **override** the default conventions in this file.
16
- 2. **`.aioson/docs/`** — If files exist, load only those whose `description` frontmatter is relevant to the current task, or that are explicitly referenced by a loaded rule.
17
- 3. **`.aioson/context/design-doc*.md`** — If `design-doc.md` or `design-doc-{slug}.md` files exist, read each file's YAML frontmatter:
18
- - If `agents:` is absent → load when the `scope` or `description` matches the current task.
19
- - If `agents:` includes `ux-ui` → load. Otherwise skip.
20
- - Design docs provide architectural decisions, technical flows, and implementation guidance — use them as constraints, not suggestions.
8
+ ## Context loading modes
9
+
10
+ Use two explicit modes so visual work loads the right evidence without pulling every UX module.
11
+
12
+ - **PLANNING**inspect project context, design skill field, PRD/frontmatter, active feature/dossier, artifact presence, and `context:select` output. Do not load full `.aioson/rules/`, `.aioson/docs/ux-ui/`, `.aioson/design-docs/`, or design skills.
13
+ - **EXECUTING** — after deriving the primary operation, run `context:select --mode=executing` and load only selected rules/design docs plus the required UX modules for that operation.
14
+
15
+ Rules and design docs override this file only when selected by metadata, operation trigger, path match, or explicit artifact reference.
21
16
 
22
17
  ## Step 0 — Design skill gate
23
18
 
@@ -42,13 +37,20 @@ Apply when `project_type=site` and the operation is `default-create` or `refine-
42
37
  3. **If present:** read the copy file before any layout decision. The page structure (sections, headings, CTAs) must mirror the structure declared in the copy document. Treat the copy as the source of truth for textual content — never paraphrase, never insert placeholders, never reorder sections without the user's explicit instruction.
43
38
  4. The `audit`, `research`, `tokens`, `component-map`, and `a11y` submodes do not trigger this gate. They may run on existing UI without copy.
44
39
 
45
- ## Required input
46
- - `.aioson/context/project.context.md`
47
- - `.aioson/context/prd.md` or `prd-{slug}.md` when present
48
- - `.aioson/context/discovery.md` when present
49
- - `.aioson/context/architecture.md` when present
50
- - `.aioson/context/spec-{slug}.md` (feature mode, if present)
51
- - `.aioson/context/spec.md` (project mode, if present)
40
+ ## Required input
41
+ - `.aioson/context/project.context.md`
42
+ - `.aioson/context/prd.md` or `prd-{slug}.md` when present
43
+ - `.aioson/context/discovery.md` when selected because current flows/entities affect UI
44
+ - `.aioson/context/architecture.md` when selected because component boundaries, routes, or frontend architecture affect UI
45
+ - `.aioson/context/spec-{slug}.md` (feature mode, if present)
46
+ - `.aioson/context/spec.md` (project mode, if present)
47
+
48
+ Before loading optional inputs, run:
49
+
50
+ ```bash
51
+ aioson context:select . --agent=ux-ui --mode=planning --task="<ux task>" --paths="<known UI paths>"
52
+ aioson preflight:context . --agent=ux-ui --mode=planning --task="<ux task>" --paths="<known UI paths>"
53
+ ```
52
54
 
53
55
  ## Sheldon plan detection (RDA-03)
54
56
 
@@ -128,7 +130,7 @@ Before acting, derive one primary `operation`:
128
130
  - `component-map`
129
131
  - `a11y`
130
132
 
131
- Then build `required_modules` using this map:
133
+ Then build `required_modules` using this map:
132
134
 
133
135
  | Condition | Required modules |
134
136
  |---|---|
@@ -140,14 +142,15 @@ Then build `required_modules` using this map:
140
142
  | `component-map` | `.aioson/docs/ux-ui/component-map.md` |
141
143
  | `a11y` | `.aioson/docs/ux-ui/accessibility-audit.md` |
142
144
 
143
- Preflight rules:
144
-
145
- 1. If the operation creates or revises visual direction, load `design-gate.md` before layout or token decisions.
146
- 2. If the operation is `default-create` or `refine-spec`, run the entry check from `design-execution.md` before producing output.
145
+ Preflight rules:
146
+
147
+ 1. If the operation creates or revises visual direction, load `design-gate.md` before layout or token decisions.
148
+ 2. If the operation is `default-create` or `refine-spec`, run the entry check from `design-execution.md` before producing output.
147
149
  3. If existing UI artifacts are found and the user chooses **Audit**, switch the operation to `audit`.
148
150
  4. If the user chooses **Rebuild**, confirm overwrite before continuing.
149
- 5. Do not proceed until every required module has been loaded.
150
- 6. Do not preload ux-ui modules that are not required.
151
+ 5. Do not proceed until every required module has been loaded.
152
+ 6. Do not preload ux-ui modules that are not required.
153
+ 7. Before writing `ui-spec.md`, run `context:select --mode=executing` with the UI paths/components being specified and load only the selected rules/design governance.
151
154
 
152
155
  ## Output contract
153
156
 
@@ -156,9 +159,11 @@ Preflight rules:
156
159
  - `.aioson/context/ui-spec.md`
157
160
  - `.aioson/context/project.context.md` only if the `design_skill` selection was confirmed in this session
158
161
 
159
- **Creation mode — `project_type≠site`:**
160
- - `.aioson/context/ui-spec.md`
161
- - `.aioson/context/project.context.md` only if the `design_skill` selection was confirmed in this session
162
+ **Creation mode — `project_type≠site`:**
163
+ - `.aioson/context/ui-spec.md`
164
+ - `.aioson/context/project.context.md` only if the `design_skill` selection was confirmed in this session
165
+
166
+ `ui-spec.md` is the canonical downstream UI artifact. `@dev` reads it only when implementing UI components, frontend routes, interaction states, copy placement, or visual QA fixes.
162
167
 
163
168
  **Submode outputs:**
164
169
  - `research` → `.aioson/context/ui-research.md`
@@ -192,4 +197,4 @@ Do not overwrite sections owned by `@product` or `@analyst`.
192
197
  - If `aioson` CLI is not available, write a devlog at session end following `.aioson/config.md`.
193
198
 
194
199
  ## Observability
195
- At session end, register: `aioson agent:done . --agent=ux-ui --summary="UI spec <slug>: <N> components, design=<skill>" 2>/dev/null || true`
200
+ At session end, prefer: `aioson agent:epilogue . --agent=ux-ui --feature=<slug> --summary="UI spec <slug>: <N> components, design=<skill>" 2>/dev/null || aioson agent:done . --agent=ux-ui --summary="UI spec <slug>: <N> components, design=<skill>" 2>/dev/null || true`
@@ -100,8 +100,16 @@ aioson dossier:add-finding . --slug={slug} --agent=validator --section="Agent Tr
100
100
 
101
101
  Skip silently when the dossier is absent — `progress.json` remains the canonical machine output.
102
102
 
103
- ## Observability
104
- At session end, register: `aioson agent:done . --agent=validator --summary="Validated <slug> phase <N>: score=<0|1>, ready_for_done=<bool>" 2>/dev/null || true`
103
+ ## Observability
104
+ At session end, register: `aioson agent:epilogue . --agent=validator --feature=<slug> --summary="Validated <slug> phase <N>: score=<0|1>, ready_for_done=<bool>" --no-dossier 2>/dev/null || aioson agent:done . --agent=validator --summary="Validated <slug> phase <N>: score=<0|1>, ready_for_done=<bool>" 2>/dev/null || true`
105
+
106
+ ## Autopilot handoff (post-dev cycle)
107
+
108
+ When `auto_handoff: true` is set in `project.context.md`, after the verdict and `agent:epilogue`/`agent:done` (`.aioson/docs/autopilot-handoff.md`):
109
+ - Score 0 / FAIL → `Skill(aioson:agent:dev)` with `"fix @validator findings — autopilot handoff"`.
110
+ - Score 1 / PASS → **STOP**. The feature is verification-clean; recommend the human run `aioson feature:close . --feature={slug}`. **Never auto-run `feature:close`** — the close is the human gate.
111
+
112
+ Emit `Autopilot: @validator → invoking @<next> (Ctrl+C to interrupt)` before invoking. If `auto_handoff` is absent or `false`, hand off manually.
105
113
 
106
114
  ---
107
115
  ## ▶ Next step
@@ -32,6 +32,7 @@
32
32
  "workflow:status",
33
33
  "runtime:emit",
34
34
  "agent:done",
35
+ "review-cycle:status",
35
36
  "brain:query",
36
37
  "doctor"
37
38
  ]
@@ -48,6 +49,10 @@
48
49
  "memory:trim",
49
50
  "workflow:next",
50
51
  "workflow:heal",
52
+ "agent:epilogue",
53
+ "review-cycle:advance",
54
+ "review-cycle:resolve",
55
+ "review-cycle:reset",
51
56
  "live:handoff",
52
57
  "live:close",
53
58
  "dossier:add-codemap",
@@ -56,8 +61,10 @@
56
61
  "notify"
57
62
  ],
58
63
  "write_paths": [
64
+ ".aioson/context/**",
59
65
  ".aioson/context/bootstrap/**",
60
66
  ".aioson/context/features/**",
67
+ ".aioson/plans/**",
61
68
  ".aioson/runtime/**"
62
69
  ]
63
70
  },
@@ -1,12 +1,17 @@
1
1
  ---
2
- description: "DRY principles, reuse hierarchy, and composition patterns"
3
- scope: "governance"
4
- agents: []
5
- ---
2
+ description: "DRY principles, reuse hierarchy, and composition patterns"
3
+ scope: "governance"
4
+ agents: [dev, deyvin, architect]
5
+ modes: [planning, executing]
6
+ task_types: [implementation-architecture, file-creation, refactor, reuse]
7
+ load_tier: trigger
8
+ triggers: [creating files, adding shared utility, reusing code, avoiding duplication, extending existing module]
9
+ paths: [src/**, app/**, lib/**, template/**]
10
+ ---
6
11
 
7
12
  # Code Reuse — Governance Rules
8
13
 
9
- > Loaded automatically by @dev and @deyvin. Override per-project via `.aioson/rules/`.
14
+ > Loaded by the context selector when creating files, reusing code, extending modules, or avoiding duplication is in scope. Override per-project via `.aioson/rules/`.
10
15
 
11
16
  ## Before creating any new file
12
17
 
@@ -1,12 +1,17 @@
1
1
  ---
2
- description: "When and how to extract components, modules, and abstractions"
3
- scope: "governance"
4
- agents: []
5
- ---
2
+ description: "When and how to extract components, modules, and abstractions"
3
+ scope: "governance"
4
+ agents: [dev, deyvin, architect]
5
+ modes: [planning, executing]
6
+ task_types: [implementation-architecture, module-boundary, refactor, extraction]
7
+ load_tier: trigger
8
+ triggers: [extract component, extract module, split module, abstraction, componentization, refactor duplicated logic]
9
+ paths: [src/**, app/**, lib/**, template/**]
10
+ ---
6
11
 
7
12
  # Componentization — Governance Rules
8
13
 
9
- > Loaded automatically by @dev and @deyvin. Override per-project via `.aioson/rules/`.
14
+ > Loaded by the context selector when extraction, module boundaries, duplication, or abstraction decisions are in scope. Override per-project via `.aioson/rules/`.
10
15
 
11
16
  ## When to extract
12
17
 
@@ -1,12 +1,17 @@
1
1
  ---
2
- description: "File size guidelines, alert thresholds, and split strategies"
3
- scope: "governance"
4
- agents: []
5
- ---
2
+ description: "File size guidelines, alert thresholds, and split strategies"
3
+ scope: "governance"
4
+ agents: [dev, deyvin, architect]
5
+ modes: [planning, executing]
6
+ task_types: [implementation, refactor, extraction, file-size]
7
+ load_tier: trigger
8
+ triggers: [large file, over 500 lines, split file, extract module, file size, growing file]
9
+ paths: [src/**, app/**, lib/**, template/**, tests/**]
10
+ ---
6
11
 
7
12
  # File Size — Governance Rules
8
13
 
9
- > Loaded automatically by @dev and @deyvin. Override per-project via `.aioson/rules/`.
14
+ > Loaded by the context selector when file size, split, extraction, or large-file risk is in scope. Override per-project via `.aioson/rules/`.
10
15
 
11
16
  ## Thresholds
12
17
 
@@ -1,12 +1,17 @@
1
1
  ---
2
- description: "Universal folder organization rules — hierarchy, depth, naming, grouping"
3
- scope: "governance"
4
- agents: []
5
- ---
2
+ description: "Universal folder organization rules — hierarchy, depth, naming, grouping"
3
+ scope: "governance"
4
+ agents: [dev, deyvin, architect]
5
+ modes: [planning, executing]
6
+ task_types: [implementation-architecture, file-creation, module-boundary, refactor]
7
+ load_tier: trigger
8
+ triggers: [creating files, moving files, splitting modules, designing implementation structure, folder structure]
9
+ paths: [src/**, app/**, lib/**, template/**, tests/**]
10
+ ---
6
11
 
7
12
  # Folder Structure — Governance Rules
8
13
 
9
- > Loaded automatically by @dev and @deyvin. Override per-project via `.aioson/rules/`.
14
+ > Loaded by the context selector when implementation structure, file creation, moves, or module boundaries are in scope. Override per-project via `.aioson/rules/`.
10
15
 
11
16
  ## Depth
12
17
 
@@ -1,12 +1,17 @@
1
1
  ---
2
- description: "Naming conventions for files, variables, functions, and classes"
3
- scope: "governance"
4
- agents: []
5
- ---
2
+ description: "Naming conventions for files, variables, functions, and classes"
3
+ scope: "governance"
4
+ agents: [dev, deyvin, architect]
5
+ modes: [planning, executing]
6
+ task_types: [implementation-architecture, file-creation, naming, refactor]
7
+ load_tier: trigger
8
+ triggers: [naming files, naming APIs, creating files, adding functions, adding classes, choosing names]
9
+ paths: [src/**, app/**, lib/**, template/**, tests/**]
10
+ ---
6
11
 
7
12
  # Naming — Governance Rules
8
13
 
9
- > Loaded automatically by @dev and @deyvin. Override per-project via `.aioson/rules/`.
14
+ > Loaded by the context selector when naming files, APIs, functions, classes, or implementation paths is in scope. Override per-project via `.aioson/rules/`.
10
15
 
11
16
  ## Files
12
17
 
@@ -14,8 +14,8 @@ Visual notifier: `aioson notify --level=info|warn|block`.
14
14
 
15
15
  | Tier | Intent | UX | Examples |
16
16
  |---|---|---|---|
17
- | `tier1_silent` | Read-only and telemetry. Auto-execute, no notification. | none | `git status`, `aioson preflight`, `aioson context:health`, `agent:done` |
18
- | `tier2_notified` | Mutates AIOSON memory (`bootstrap/`, `features/`, `runtime/`). Auto-execute with **inline notify** (ℹ). | `ℹ [topic] msg` | `memory:reflect-prepare`, `memory:reflect-commit`, `workflow:next`, `dossier:*` |
17
+ | `tier1_silent` | Read-only and telemetry. Auto-execute, no notification. | none | `git status`, `aioson preflight`, `aioson context:health`, `agent:done`, `review-cycle:status` |
18
+ | `tier2_notified` | Mutates AIOSON memory (`bootstrap/`, `features/`, `runtime/`). Auto-execute with **inline notify** (ℹ). | `ℹ [topic] msg` | `memory:reflect-prepare`, `memory:reflect-commit`, `workflow:next`, `dossier:*`, `agent:epilogue`, `review-cycle:advance|resolve|reset` |
19
19
  | `tier3_blocking` | Irreversible or external (publish, push, npm registry). **Never** auto-executed; the CLI returns exit 2 and waits for a human. | `⛔ [topic] msg` | `git push *`, `npm publish *`, `cloud:publish:*`, `genome:publish` |
20
20
 
21
21
  A tool opts into tiers via `derived_from_tiers`:
@@ -1,11 +1,14 @@
1
- ---
2
- description: "Autopilot handoff protocol: automatic agent chaining from @analyst to the @dev handoff in the feature workflow, with deterministic routing and explicit stop conditions"
3
- ---
4
-
5
- # Autopilot handoff (analyst → dev)
6
-
7
- Opt-in protocol that removes manual handoff confirmations in the deterministic segment of the feature workflow. Participating agents: `@analyst`, `@scope-check`, `@architect`, `@discovery-design-doc`, and `@pm` (MEDIUM features only — it sits between `@discovery-design-doc` and pre-dev `@scope-check` to produce the implementation plan and close Gate C). Upstream agents (`@briefing`, `@product`, `@sheldon`) always stay manual — they end on genuine human decisions.
8
-
1
+ ---
2
+ description: "Autopilot handoff protocol: automatic agent chaining across the feature workflow — the analyst→dev pre-dev chain and the post-dev review cycle (dev→qa→tester/pentester→validator) — with deterministic routing and explicit stop conditions. The chain never auto-runs feature:close/publish."
3
+ ---
4
+
5
+ # Autopilot handoff (analyst → dev → review cycle)
6
+
7
+ Opt-in protocol that removes manual handoff confirmations in the deterministic segments of the feature workflow. Two segments:
8
+
9
+ 1. **Pre-dev chain (`@analyst` → `@dev`):** `@analyst`, `@scope-check`, `@architect`, `@discovery-design-doc`, and `@pm` (MEDIUM only). Upstream agents (`@briefing`, `@product`, `@sheldon`) always stay manual — they end on genuine human decisions.
10
+ 2. **Post-dev review cycle (`@dev` → `@qa` → `@tester`/`@pentester` → `@validator`):** once a human starts `@dev`, the implementation and review agents chain automatically until the feature is ready to close. `@qa` is the hub: it owns the routing to the specialized agents and the corrections loop.
11
+
9
12
  ## Activation
10
13
 
11
14
  Autopilot is active only when ALL are true:
@@ -14,33 +17,78 @@ Autopilot is active only when ALL are true:
14
17
  2. A feature workflow is active (feature slug known, classification SMALL or MEDIUM).
15
18
  3. The current agent's own gate/verdict passed (see stop conditions).
16
19
 
17
- ## Routing — deterministic, never LLM-chosen
18
-
19
- The next agent comes from the workflow state machine, not from model judgment:
20
-
21
- - CLI available: run `aioson workflow:next .` (inspect mode) and use the stage it reports, or the `next` field of `.aioson/context/workflow.state.json`.
22
- - CLI absent: follow the classification sequence in `.aioson/config.md` exactly.
23
-
24
- Never skip a stage, reorder, or pick an agent the state machine did not name.
25
-
20
+ Preferred runtime entrypoint:
21
+
22
+ ```bash
23
+ aioson workflow:execute . --feature={slug} --tool=<tool> --agentic
24
+ ```
25
+
26
+ `workflow:execute --agentic` is the central orchestration contract. It writes `.aioson/context/workflow-execute.json` with `agentic_policy`, including the review-loop caps, sidecar/scout policy, lane guard, current checkpoint, and resumable command. Prompt-level `Skill(aioson:agent:<next>)` chaining remains a compatibility fallback for clients that cannot let the gateway consume this checkpoint.
27
+
28
+ ## Routing — deterministic, never LLM-chosen
29
+
30
+ The next agent comes from the workflow state machine and on-disk evidence, not from model judgment:
31
+
32
+ - CLI available: run `aioson workflow:next .` (inspect mode) and use the stage it reports, or the `next` field of `.aioson/context/workflow.state.json`.
33
+ - CLI absent: follow the classification sequence in `.aioson/config.md` and the routing table below exactly.
34
+
35
+ Never skip a stage, reorder, or pick an agent the state machine / routing table did not name.
36
+
26
37
  ## Auto-invoke pattern
27
38
 
28
39
  When autopilot is active and no stop condition applies:
29
40
 
30
- 1. Finish your own closing duties first (artifacts on disk, gate registration, `pulse:update`, `agent:done`).
31
- 2. Emit a one-line transition notice: `Autopilot: @<current> done invoking @<next> (Ctrl+C to interrupt)`.
32
- 3. Invoke `Skill(aioson:agent:<next>)` with the task `"continue feature {slug} autopilot handoff from @<current>"`. No user prompt Ctrl+C interrupts.
33
-
34
- ## Stop conditions — break the chain and emit the normal manual handoff
35
-
36
- 1. **Next agent is `@dev`** — goal reached. Produce `dev-state.md` (dev handoff producer), emit the standard handoff message, and recommend `/clear` + a fresh chat for `@dev`. Never auto-invoke `@dev`.
37
- 2. **Verdict not clean** `@scope-check` status is anything other than `approved`/`patched` (`needs-*`, `blocked`): route per Handoff Rules, manually.
38
- 3. **Gate or readiness blocked** — `@architect` Gate B blocked, `@discovery-design-doc` readiness = `blocked`, or `@pm` Gate C blocked: stop and route to the owner.
39
- 4. **Context budget** estimated context usage ≥ `context_warning_threshold` (`.aioson/config.md`): write the compaction checkpoint to `.aioson/context/last-handoff.json`, stop, and recommend `/clear`. The workflow resumes from `workflow.state.json` the next session re-enters autopilot automatically.
40
- 5. **Ambiguity** — workflow state unavailable AND classification/sequence ambiguous, or any real decision requires user input: stop and ask, manually.
41
-
42
- The user can interrupt at any time (Ctrl+C); autopilot never retries an interrupted invocation.
43
-
44
- ## Rationale
45
-
46
- Industry-validated design (see `researchs/auto-handoff-pipeline-2026/summary.md`): deterministic routing beats LLM routing; human gates belong where they catch mistakes (pre-analyst and at @dev); every autonomous loop needs explicit exit conditions; per-hop context checkpointing is the load-bearing cost mitigation.
41
+ 1. Finish your own closing duties first (artifacts on disk, gate registration, dossier/spec updates, `agent:epilogue`; `agent:done` remains the fallback).
42
+ 2. If the runtime checkpoint contains `agentic_policy.enabled=true`, let the gateway continue from `.aioson/context/workflow-execute.json`; do not ask the user to confirm the next deterministic stage.
43
+ 3. If no runtime gateway is available, emit a one-line transition notice: `Autopilot: @<current> done invoking @<next> (Ctrl+C to interrupt)`.
44
+ 4. Invoke `Skill(aioson:agent:<next>)` with the task `"continue feature {slug} — autopilot handoff from @<current>"`. No user prompt — Ctrl+C interrupts.
45
+
46
+ ## Segment 1 — pre-dev chain (`@analyst` → `@dev`)
47
+
48
+ SMALL feature: `@analyst` `@scope-check` `@architect` `@discovery-design-doc` `@dev`.
49
+
50
+ MEDIUM feature: `@analyst` `@architect` `@discovery-design-doc` `@pm` `@scope-check` `@dev`.
51
+
52
+ The prompt-only fallback still stops before the FIRST `@dev` activation because `@dev` is a heavy phase and benefits from a fresh context window. Runtime agentic mode may cross this boundary only by starting a fresh `@dev` activation from the checkpoint/context package, not by carrying the upstream chat context forward. If the gateway cannot start that fresh activation, stop with the normal `/clear` + `/dev` recommendation.
53
+
54
+ ## Segment 2 — post-dev review cycle (hub = `@qa`)
55
+
56
+ Once a human starts `@dev` and it finishes, the chain resumes automatically. `@qa` is the hub; every specialized agent returns to it.
57
+
58
+ Routing table (each row is followed only when autopilot is active and no stop condition applies):
59
+
60
+ | Current | Condition | Auto-invoke |
61
+ |---|---|---|
62
+ | `@dev` (first pass) | tests green, gates clear, no open corrections cycle | `@qa` |
63
+ | `@dev` (corrections) | corrections applied, tests green (`review-cycle:status` active; `qa-dev-cycle.json` is legacy QA compatibility) | `@qa` (re-verify) |
64
+ | `@qa` | verdict **FAIL** (Critical/High) | `@dev` via the corrections auto-cycle (cap 3, security gate) |
65
+ | `@qa` | verdict **PASS** + `@tester` trigger fires AND `@tester` not yet run clean | `@tester` |
66
+ | `@qa` | verdict **PASS** + `@pentester` trigger fires AND `@pentester` not yet run clean | `@pentester` |
67
+ | `@qa` | verdict **PASS** + harness contract present AND `@validator` not yet PASS | `@validator` |
68
+ | `@qa` | verdict **PASS** + no pending trigger/contract | **STOP** — recommend the human run `aioson feature:close . --feature={slug}` |
69
+ | `@tester` | surfaced dev-owned blocking gaps | `@dev` |
70
+ | `@tester` | no dev-owned blocking gaps | `@qa` (re-evaluate / sign-off) |
71
+ | `@pentester` | open `recommended_owner = dev` findings | `@dev` |
72
+ | `@pentester` | no open dev-owned findings | `@qa` (re-evaluate / sign-off) |
73
+ | `@validator` | PASS | **STOP** — recommend the human run `aioson feature:close` |
74
+ | `@validator` | FAIL | `@dev` |
75
+
76
+ **Trigger source for `@tester`/`@pentester`:** the existing `@qa` trigger logic (coverage gaps → `@tester`; sensitive surface auth/secrets/data/upload/external-URL/supply-chain → `@pentester`). The four agents are ALWAYS wired into the chain, but `@tester`/`@pentester` only EXECUTE when their trigger fires — otherwise `@qa` skips straight to the next routing row.
77
+
78
+ **Re-entry guard (no infinite loops):** before auto-invoking a specialized agent, `@qa` checks on-disk evidence that it already ran clean this cycle (e.g. `security-findings-{slug}.json` clean → `@pentester` done; a tester coverage artifact present with no new gap → `@tester` done; `progress.json.ready_for_done_gate` / validator PASS recorded → `@validator` done). An agent that already returned clean is not re-invoked.
79
+
80
+ ## Stop conditions — break the chain and emit the normal manual handoff
81
+
82
+ 1. **`feature:close` / publish** — ALWAYS the human gate. When `@qa` (PASS, nothing pending) or `@validator` (PASS) is the last clean step, STOP and recommend `aioson feature:close . --feature={slug}`. Never auto-run `feature:close`, `feature:archive`, `npm publish`, or any publish/close action.
83
+ 2. **First `@dev` entry without runtime gateway** — prompt-only clients stop here (Segment 1). Runtime agentic mode may continue only through a fresh checkpointed `@dev` activation.
84
+ 3. **Corrections cap reached** — review cycles are bounded by `agentic_policy.review_cycle` (default 3); when `review-cycle:advance` returns `stop_cycle_limit`, stop and escalate to the human.
85
+ 4. **Critical security finding** — the `@qa` corrections security gate (auth/secret/credential/session/password/token/PII/encryption keywords) blocks the auto-loop; stop and require human intervention.
86
+ 5. **Verdict not clean / gate or readiness blocked** — `@scope-check` not `approved`/`patched`, `@architect` Gate B blocked, `@discovery-design-doc` readiness `blocked`, `@pm` Gate C blocked, `@validator` FAIL with no safe corrections path: stop and route to the owner manually.
87
+ 6. **Context budget** — estimated usage ≥ `context_warning_threshold` (`.aioson/config.md`): write the compaction checkpoint to `.aioson/context/last-handoff.json`, stop, and recommend `/clear`. The workflow resumes from `workflow.state.json` — the next session re-enters autopilot automatically.
88
+ 7. **Ambiguity** — workflow state unavailable AND routing ambiguous, or any real decision requires user input: stop and ask, manually.
89
+
90
+ The user can interrupt at any time (Ctrl+C); autopilot never retries an interrupted invocation.
91
+
92
+ ## Rationale
93
+
94
+ Industry-validated design (see `researchs/auto-handoff-pipeline-2026/summary.md`): deterministic routing beats LLM routing; human gates belong where they catch mistakes — at the start of implementation (`@dev` entry: fresh context) and at the irreversible boundary (`feature:close`/publish). Every autonomous loop needs explicit exit conditions and bounds (the corrections cap, the re-entry guard); per-hop context checkpointing is the load-bearing cost mitigation.
@@ -1,6 +1,12 @@
1
- ---
2
- description: "Oracle deep guide — strong vs weak briefing examples, JTBD problem framing, Opportunity Solution Tree, Cagan's four risks, gap analysis, open-questions taxonomy, conversation playbook. Load when an existing briefing feels weak, when the conversation goes generic, or when a complex Themes section needs partitioning."
3
- ---
1
+ ---
2
+ description: "Oracle deep guide — strong vs weak briefing examples, JTBD problem framing, Opportunity Solution Tree, Cagan's four risks, gap analysis, open-questions taxonomy, conversation playbook. Load when an existing briefing feels weak, when the conversation goes generic, or when a complex Themes section needs partitioning."
3
+ agents: [briefing]
4
+ modes: [planning, executing]
5
+ task_types: [briefing-craft, jtbd-framing, opportunity-mapping, gap-classification, briefing-quality]
6
+ load_tier: justified
7
+ triggers: [weak briefing, generic conversation, JTBD, opportunity solution tree, four risks, more than 3 open questions, complex themes, switch interview]
8
+ tags: [briefing, jtbd, gaps, risks]
9
+ ---
4
10
 
5
11
  # Oracle — Briefing Craft
6
12