@jaimevalasek/aioson 1.23.0 → 1.23.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/docs/en/5-reference/cli-reference.md +85 -0
  2. package/docs/pt/4-agentes/pm.md +31 -4
  3. package/docs/pt/5-referencia/README.md +3 -0
  4. package/docs/pt/5-referencia/autopilot-handoff.md +131 -0
  5. package/docs/pt/5-referencia/comandos-cli.md +72 -6
  6. package/docs/pt/5-referencia/harness-retro.md +133 -0
  7. package/docs/pt/5-referencia/loop-guardrails.md +225 -0
  8. package/docs/pt/5-referencia/sdd-automation-scripts.md +25 -13
  9. package/package.json +1 -1
  10. package/src/cli.js +54 -29
  11. package/src/commands/agent-epilogue.js +186 -0
  12. package/src/commands/context-select.js +34 -0
  13. package/src/commands/preflight-context.js +13 -9
  14. package/src/commands/review-cycle.js +328 -0
  15. package/src/commands/runtime.js +4 -4
  16. package/src/commands/state-save.js +2 -0
  17. package/src/commands/workflow-execute.js +138 -28
  18. package/src/commands/workflow-next.js +3 -2
  19. package/src/commands/workflow-status.js +30 -10
  20. package/src/constants.js +15 -13
  21. package/src/context-memory.js +50 -25
  22. package/src/context-selector.js +420 -0
  23. package/src/gateway-pointer-merge.js +25 -4
  24. package/src/i18n/messages/en.js +13 -7
  25. package/src/i18n/messages/es.js +13 -7
  26. package/src/i18n/messages/fr.js +13 -7
  27. package/src/i18n/messages/pt-BR.js +13 -7
  28. package/src/parser.js +1 -1
  29. package/src/squad/preflight-context.js +26 -27
  30. package/template/.aioson/agents/analyst.md +41 -46
  31. package/template/.aioson/agents/architect.md +33 -46
  32. package/template/.aioson/agents/briefing.md +76 -67
  33. package/template/.aioson/agents/dev.md +66 -59
  34. package/template/.aioson/agents/deyvin.md +124 -114
  35. package/template/.aioson/agents/discovery-design-doc.md +35 -22
  36. package/template/.aioson/agents/manifests/architect.manifest.json +11 -1
  37. package/template/.aioson/agents/manifests/dev.manifest.json +15 -0
  38. package/template/.aioson/agents/manifests/pm.manifest.json +20 -0
  39. package/template/.aioson/agents/orchestrator.md +31 -18
  40. package/template/.aioson/agents/pentester.md +7 -7
  41. package/template/.aioson/agents/pm.md +41 -35
  42. package/template/.aioson/agents/product.md +116 -165
  43. package/template/.aioson/agents/qa.md +21 -14
  44. package/template/.aioson/agents/scope-check.md +46 -24
  45. package/template/.aioson/agents/tester.md +12 -6
  46. package/template/.aioson/agents/ux-ui.md +36 -31
  47. package/template/.aioson/agents/validator.md +3 -3
  48. package/template/.aioson/config/autonomy-protocol.json +7 -0
  49. package/template/.aioson/design-docs/code-reuse.md +10 -5
  50. package/template/.aioson/design-docs/componentization.md +10 -5
  51. package/template/.aioson/design-docs/file-size.md +10 -5
  52. package/template/.aioson/design-docs/folder-structure.md +10 -5
  53. package/template/.aioson/design-docs/naming.md +10 -5
  54. package/template/.aioson/docs/autonomy-protocol.md +2 -2
  55. package/template/.aioson/docs/autopilot-handoff.md +32 -21
  56. package/template/.aioson/docs/briefing/briefing-craft.md +9 -3
  57. package/template/.aioson/docs/deyvin/continuity-recovery.md +18 -22
  58. package/template/.aioson/docs/product/conversation-playbook.md +8 -3
  59. package/template/.aioson/docs/product/prd-contract.md +8 -3
  60. package/template/.aioson/docs/product/quality-lens.md +8 -3
  61. package/template/.aioson/docs/product/research-loop.md +8 -3
  62. package/template/.aioson/docs/ux-ui/accessibility-audit.md +7 -2
  63. package/template/.aioson/docs/ux-ui/audit-mode.md +7 -2
  64. package/template/.aioson/docs/ux-ui/component-map.md +7 -2
  65. package/template/.aioson/docs/ux-ui/design-execution.md +7 -2
  66. package/template/.aioson/docs/ux-ui/design-gate.md +7 -2
  67. package/template/.aioson/docs/ux-ui/research-mode.md +7 -2
  68. package/template/.aioson/docs/ux-ui/site-delivery.md +7 -2
  69. package/template/.aioson/docs/ux-ui/token-contract.md +7 -2
  70. package/template/.aioson/rules/aioson-context-boundary.md +1 -1
  71. package/template/.aioson/rules/disk-first-artifacts.md +1 -1
  72. package/template/.aioson/skills/process/aioson-spec-driven/SKILL.md +9 -7
  73. package/template/.aioson/skills/process/aioson-spec-driven/references/approval-gates.md +1 -1
  74. package/template/.aioson/skills/process/aioson-spec-driven/references/architect.md +3 -2
  75. package/template/.aioson/skills/process/aioson-spec-driven/references/artifact-map.md +21 -9
  76. package/template/.aioson/skills/process/aioson-spec-driven/references/dev.md +2 -1
  77. package/template/.aioson/skills/process/aioson-spec-driven/references/deyvin.md +19 -15
  78. package/template/.aioson/skills/process/aioson-spec-driven/references/pm.md +2 -1
  79. package/template/.aioson/skills/static/web-research-cache.md +29 -8
  80. package/template/AGENTS.md +13 -13
  81. package/template/CLAUDE.md +9 -9
  82. package/template/OPENCODE.md +3 -2
@@ -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
+ ```
@@ -660,9 +660,9 @@ function testFuzz_transferNeverExceedsBalance(uint256 amount) public {
660
660
 
661
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.
662
662
 
663
- ## Project pulse update (run before session registration)
664
-
665
- 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.
666
666
 
667
667
  If `aioson` CLI is not available, update `.aioson/context/project-pulse.md` manually:
668
668
  1. Set `updated_at`, `last_agent: tester`, `last_gate` in frontmatter
@@ -670,12 +670,18 @@ If `aioson` CLI is not available, update `.aioson/context/project-pulse.md` manu
670
670
  3. Add entry to "Recent activity" (keep last 3 only)
671
671
  4. Update "Next recommended action" — typically @qa for formal review or @dev for fixes
672
672
 
673
- ## At session end
674
- 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.
675
681
 
676
682
  ## Autopilot handoff (post-dev cycle)
677
683
 
678
- When `auto_handoff: true` is set in `project.context.md`, after the suite is delivered and `agent:done` is registered, return to the hub instead of stopping (`.aioson/docs/autopilot-handoff.md`):
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`):
679
685
  - Dev-owned blocking gaps found (failing must-have test, real bug reported) → `Skill(aioson:agent:dev)` with `"fix @tester findings — autopilot handoff"`.
680
686
  - Otherwise → `Skill(aioson:agent:qa)` with `"re-evaluate after @tester — autopilot handoff"`.
681
687
 
@@ -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,12 +100,12 @@ 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
105
 
106
106
  ## Autopilot handoff (post-dev cycle)
107
107
 
108
- When `auto_handoff: true` is set in `project.context.md`, after the verdict and `agent:done` (`.aioson/docs/autopilot-handoff.md`):
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
109
  - Score 0 / FAIL → `Skill(aioson:agent:dev)` with `"fix @validator findings — autopilot handoff"`.
110
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
111
 
@@ -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`:
@@ -9,13 +9,21 @@ Opt-in protocol that removes manual handoff confirmations in the deterministic s
9
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
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
11
 
12
- ## Activation
13
-
14
- Autopilot is active only when ALL are true:
15
-
16
- 1. `project.context.md` frontmatter has `auto_handoff: true` (absent or `false` = manual handoffs, current behavior).
17
- 2. A feature workflow is active (feature slug known, classification SMALL or MEDIUM).
18
- 3. The current agent's own gate/verdict passed (see stop conditions).
12
+ ## Activation
13
+
14
+ Autopilot is active only when ALL are true:
15
+
16
+ 1. `project.context.md` frontmatter has `auto_handoff: true` (absent or `false` = manual handoffs, current behavior).
17
+ 2. A feature workflow is active (feature slug known, classification SMALL or MEDIUM).
18
+ 3. The current agent's own gate/verdict passed (see stop conditions).
19
+
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.
19
27
 
20
28
  ## Routing — deterministic, never LLM-chosen
21
29
 
@@ -26,19 +34,22 @@ The next agent comes from the workflow state machine and on-disk evidence, not f
26
34
 
27
35
  Never skip a stage, reorder, or pick an agent the state machine / routing table did not name.
28
36
 
29
- ## Auto-invoke pattern
30
-
31
- When autopilot is active and no stop condition applies:
32
-
33
- 1. Finish your own closing duties first (artifacts on disk, gate registration, dossier/spec updates, `pulse:update`, `agent:done`).
34
- 2. Emit a one-line transition notice: `Autopilot: @<current> done invoking @<next> (Ctrl+C to interrupt)`.
35
- 3. Invoke `Skill(aioson:agent:<next>)` with the task `"continue feature {slug} autopilot handoff from @<current>"`. No user prompt Ctrl+C interrupts.
37
+ ## Auto-invoke pattern
38
+
39
+ When autopilot is active and no stop condition applies:
40
+
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.
36
45
 
37
46
  ## Segment 1 — pre-dev chain (`@analyst` → `@dev`)
38
47
 
39
- `@analyst` → `@scope-check` → `@architect` → `@discovery-design-doc` → (`@pm` on MEDIUM) → **STOP before `@dev`**.
40
-
41
- The pre-dev chain stops before the FIRST `@dev` activation. The human clears context (`/clear`) and starts implementation with a fresh budget — `@dev` is a heavy phase and benefits from a clean context window. Produce `dev-state.md` (the dev handoff producer), emit the standard handoff message, and recommend `/clear` + `/dev`. **Never auto-invoke the initial `@dev` entry.**
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.
42
53
 
43
54
  ## Segment 2 — post-dev review cycle (hub = `@qa`)
44
55
 
@@ -49,8 +60,8 @@ Routing table (each row is followed only when autopilot is active and no stop co
49
60
  | Current | Condition | Auto-invoke |
50
61
  |---|---|---|
51
62
  | `@dev` (first pass) | tests green, gates clear, no open corrections cycle | `@qa` |
52
- | `@dev` (corrections) | corrections applied, tests green (`qa-dev-cycle.json` present) | `@qa` (re-verify) |
53
- | `@qa` | verdict **FAIL** (Critical/High) | `@dev` via the corrections auto-cycle (cap 2, security gate) |
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) |
54
65
  | `@qa` | verdict **PASS** + `@tester` trigger fires AND `@tester` not yet run clean | `@tester` |
55
66
  | `@qa` | verdict **PASS** + `@pentester` trigger fires AND `@pentester` not yet run clean | `@pentester` |
56
67
  | `@qa` | verdict **PASS** + harness contract present AND `@validator` not yet PASS | `@validator` |
@@ -69,8 +80,8 @@ Routing table (each row is followed only when autopilot is active and no stop co
69
80
  ## Stop conditions — break the chain and emit the normal manual handoff
70
81
 
71
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.
72
- 2. **First `@dev` entry** — the pre-dev chain stops here (Segment 1). The human clears context and starts implementation.
73
- 3. **Corrections cap reached** — the `@qa`↔`@dev` auto-cycle is bounded at 2 rounds (`qa-dev-cycle.json`); when exhausted, stop and escalate to the human.
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.
74
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.
75
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.
76
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.
@@ -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
 
@@ -4,25 +4,21 @@ description: "Deyvin continuity recovery — session start order, resumption rul
4
4
 
5
5
  # Deyvin Continuity Recovery
6
6
 
7
- Load this module at the start of every `@deyvin` session before touching code.
7
+ Load this module only when the task is continuity recovery, recent-work reconstruction, stale-state diagnosis, or resuming an existing slice.
8
8
 
9
9
  ## Session start order
10
10
 
11
- Build context in this order:
12
-
13
- 1. If `aioson` is available, run `aioson memory:summary . --last=5` as the fast continuity bootstrap
14
- 2. Read `.aioson/context/project.context.md`
15
- 3. Check `.aioson/rules/`; load universal rules and rules targeted at `deyvin`
16
- 4. Check `.aioson/docs/`; load docs referenced by rules or relevant to the task
17
- 5. If the task is specific, run `aioson context:pack . --agent=deyvin --goal="<task>"` and read the generated pack
18
- 6. Read `.aioson/context/memory-index.md` if present
19
- 7. Read `.aioson/context/spec-current.md` and `.aioson/context/spec-history.md` if present
20
- 8. Read `.aioson/context/spec.md` if present
21
- 9. Read `.aioson/context/features.md` if present; if a feature is in progress, also read `prd-{slug}.md`, `requirements-{slug}.md`, and `spec-{slug}.md`
22
- 10. Read `.aioson/context/skeleton-system.md`, `discovery.md`, and `architecture.md` as needed
23
- 11. When the task matches procedural tags, run `aioson brain:query . --tags=<tags> --min-quality=4`
24
- 12. Inspect recent runtime state in `.aioson/runtime/aios.sqlite` when memory summary is insufficient
25
- 13. Use Git only as a fallback after memory + runtime + rules/docs
11
+ Build context in this order:
12
+
13
+ 1. If `aioson` is available, run `aioson memory:summary . --last=5` as the fast continuity bootstrap.
14
+ 2. Read `.aioson/context/project.context.md`
15
+ 3. Run `aioson context:select . --agent=deyvin --mode=planning --task="<task>" --paths="<known paths>"`.
16
+ 4. Load only the selected PLANNING files. Do not load full `.aioson/rules/`, `.aioson/docs/`, `.aioson/design-docs/`, `discovery.md`, or `architecture.md` from this step alone.
17
+ 5. If a feature slug is known, load its dossier/spec only when `context:select`, `dev-state.md`, or `project-pulse.md` points to that slug; use `spec-current.md` for active spec and `spec-history.md` only for history.
18
+ 6. If code inspection/editing is about to start, run `aioson context:select . --agent=deyvin --mode=executing --task="<task>" --paths="<files to touch>"` and load only the selected EXECUTING files.
19
+ 7. When the task matches procedural tags, run `aioson brain:query . --tags=<tags> --min-quality=4`.
20
+ 8. Inspect recent runtime state in `.aioson/runtime/aios.sqlite` when memory summary is insufficient.
21
+ 9. Use Git only as a fallback after memory + runtime + selected rules/docs.
26
22
 
27
23
  If the user asks what happened recently, answer from memory and runtime first. Go to Git only if those sources are insufficient.
28
24
 
@@ -39,12 +35,12 @@ Do not duplicate or rewrite the shared SDD references inside `@deyvin`.
39
35
 
40
36
  ## Brownfield guardrails
41
37
 
42
- If `framework_installed=true` in `project.context.md` and the task depends on existing system behavior:
43
-
44
- - prefer `discovery.md` + `spec.md` as the primary memory pair
45
- - use `skeleton-system.md` or `memory-index.md` first for faster orientation
46
- - if `discovery.md` is missing but scan artifacts exist, stop and hand off to `@analyst`
47
- - if broad architecture decisions are required, hand off to `@architect`
38
+ If `framework_installed=true` in `project.context.md` and the task depends on existing system behavior:
39
+
40
+ - prefer selected module memory, `memory-index.md`, dossier, or spec before opening broad `discovery.md` / `architecture.md`
41
+ - use `skeleton-system.md` or `memory-index.md` first for faster orientation
42
+ - if `discovery.md` is missing but scan artifacts exist, stop and hand off to `@analyst`
43
+ - if broad architecture decisions are required, hand off to `@architect`
48
44
 
49
45
  ## Git fallback
50
46
 
@@ -1,6 +1,11 @@
1
- ---
2
- description: "Product conversation playbook — opening messages, batching rules, proactive triggers, conversation phases, and finalize/surprise handling."
3
- ---
1
+ ---
2
+ description: "Product conversation playbook — opening messages, batching rules, proactive triggers, conversation phases, and finalize/surprise handling."
3
+ agents: [product]
4
+ modes: [planning]
5
+ task_types: [product-conversation, product-intake, feature-definition, prd-scoping]
6
+ load_tier: trigger
7
+ triggers: [asking product questions, structured intake, broad product discovery, visual preferences, finalize conversation]
8
+ ---
4
9
 
5
10
  # Product Conversation Playbook
6
11
 
@@ -1,6 +1,11 @@
1
- ---
2
- description: "Product PRD contract — exact PRD structure, visual identity block, output paths, and next-step routing."
3
- ---
1
+ ---
2
+ description: "Product PRD contract — exact PRD structure, visual identity block, output paths, and next-step routing."
3
+ agents: [product]
4
+ modes: [executing]
5
+ task_types: [prd-writing, prd-finalization, output-contract, artifact-writing]
6
+ load_tier: trigger
7
+ triggers: [writing PRD, updating PRD, PRD contract, output path, next-step routing, visual identity]
8
+ ---
4
9
 
5
10
  # Product PRD Contract
6
11