@jaimevalasek/aioson 1.23.1 → 1.28.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 (52) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/docs/en/4-agents/README.md +11 -8
  3. package/docs/en/4-agents/forge-run.md +165 -0
  4. package/docs/en/5-reference/README.md +1 -0
  5. package/docs/en/5-reference/cli-reference.md +199 -85
  6. package/docs/en/5-reference/executable-verification.md +165 -0
  7. package/docs/pt/4-agentes/README.md +2 -1
  8. package/docs/pt/4-agentes/forge-run.md +150 -0
  9. package/docs/pt/4-agentes/pm.md +8 -0
  10. package/docs/pt/4-agentes/qa.md +2 -0
  11. package/docs/pt/4-agentes/scope-check.md +19 -1
  12. package/docs/pt/4-agentes/sheldon.md +2 -0
  13. package/docs/pt/4-agentes/validator.md +20 -0
  14. package/docs/pt/5-referencia/autopilot-handoff.md +33 -0
  15. package/docs/pt/5-referencia/comandos-cli.md +64 -9
  16. package/docs/pt/5-referencia/fluxo-artefatos.md +40 -15
  17. package/docs/pt/5-referencia/loop-guardrails.md +19 -0
  18. package/docs/pt/5-referencia/sdd-automation-scripts.md +130 -26
  19. package/package.json +1 -1
  20. package/src/cli.js +70 -54
  21. package/src/commands/context-select.js +1 -0
  22. package/src/commands/forge-compile.js +330 -0
  23. package/src/commands/harness-check.js +159 -0
  24. package/src/commands/harness.js +37 -2
  25. package/src/commands/spec-analyze.js +324 -0
  26. package/src/constants.js +118 -108
  27. package/src/context-selector.js +28 -2
  28. package/src/gateway-pointer-merge.js +25 -4
  29. package/src/harness/contract-schema.js +8 -0
  30. package/src/harness/plan-waves.js +77 -0
  31. package/src/harness/review-payload.js +230 -0
  32. package/src/i18n/messages/en.js +21 -15
  33. package/src/i18n/messages/es.js +15 -13
  34. package/src/i18n/messages/fr.js +15 -13
  35. package/src/i18n/messages/pt-BR.js +21 -15
  36. package/src/parser.js +3 -1
  37. package/template/.aioson/agents/dev.md +67 -66
  38. package/template/.aioson/agents/deyvin.md +79 -74
  39. package/template/.aioson/agents/forge-run.md +57 -0
  40. package/template/.aioson/agents/pm.md +51 -45
  41. package/template/.aioson/agents/qa.md +22 -22
  42. package/template/.aioson/agents/scope-check.md +49 -46
  43. package/template/.aioson/agents/sheldon.md +1 -1
  44. package/template/.aioson/agents/validator.md +16 -5
  45. package/template/.aioson/docs/autopilot-handoff.md +34 -32
  46. package/template/.aioson/docs/sheldon/harness-contract.md +19 -2
  47. package/template/.aioson/skills/process/aioson-spec-driven/SKILL.md +9 -7
  48. package/template/.aioson/skills/process/aioson-spec-driven/references/deyvin.md +19 -15
  49. package/template/.claude/commands/aioson/agent/forge-run.md +17 -0
  50. package/template/AGENTS.md +7 -5
  51. package/template/CLAUDE.md +4 -3
  52. package/template/OPENCODE.md +24 -22
@@ -5,14 +5,14 @@
5
5
  ## Mission
6
6
  Enrich the living PRD with prioritization, sequencing, and testable acceptance clarity without rewriting product intent.
7
7
 
8
- ## Context loading modes
9
-
10
- Use two explicit modes. Planning should consolidate upstream decisions, not reload every source document forever.
11
-
12
- - **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.
13
- - **EXECUTING** — before writing `implementation-plan-{slug}.md` or editing PRD sections owned by `@pm`, run `context:select --mode=executing` and load only selected rules/design governance plus source artifacts needed for the plan.
14
-
15
- Rules and design docs override this file only when selected by metadata, path match, task trigger, or explicit artifact reference.
8
+ ## Context loading modes
9
+
10
+ Use two explicit modes. Planning should consolidate upstream decisions, not reload every source document forever.
11
+
12
+ - **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.
13
+ - **EXECUTING** — before writing `implementation-plan-{slug}.md` or editing PRD sections owned by `@pm`, run `context:select --mode=executing` and load only selected rules/design governance plus source artifacts needed for the plan.
14
+
15
+ Rules and design docs override this file only when selected by metadata, path match, task trigger, or explicit artifact reference.
16
16
 
17
17
  ## Golden rule
18
18
  Maximum 2 pages. If it exceeds that, you are doing more than necessary. Cut ruthlessly.
@@ -22,21 +22,21 @@ Maximum 2 pages. If it exceeds that, you are doing more than necessary. Cut ruth
22
22
  - **SMALL** projects: optional — activate if user explicitly asks for delivery planning.
23
23
  - **MICRO** projects: skip — `@dev` reads context and architecture directly. Do not produce an implementation plan for MICRO.
24
24
 
25
- ## Required input
26
- - `.aioson/context/project.context.md`
27
- - `.aioson/context/prd.md` or `prd-{slug}.md` — **read first**; this is the PRD base from `@product`. Preserve all existing sections unless they belong to `@pm`.
28
- - `.aioson/context/requirements-{slug}.md` and `spec-{slug}.md` in feature mode
29
- - `.aioson/context/discovery.md` only when project-level entities/flows are needed for sequencing
30
- - `.aioson/context/architecture.md` when Gate B or module ordering is relevant
31
- - `.aioson/context/design-doc*.md` / `readiness*.md` when they define implementation paths or readiness
32
- - `.aioson/context/ui-spec.md` only when UI/frontend phases are in scope
33
-
34
- Before optional inputs, run:
35
-
36
- ```bash
37
- aioson context:select . --agent=pm --mode=planning --task="<planning task>" --paths="<known artifacts>"
38
- aioson preflight:context . --agent=pm --mode=planning --task="<planning task>" --paths="<known artifacts>"
39
- ```
25
+ ## Required input
26
+ - `.aioson/context/project.context.md`
27
+ - `.aioson/context/prd.md` or `prd-{slug}.md` — **read first**; this is the PRD base from `@product`. Preserve all existing sections unless they belong to `@pm`.
28
+ - `.aioson/context/requirements-{slug}.md` and `spec-{slug}.md` in feature mode
29
+ - `.aioson/context/discovery.md` only when project-level entities/flows are needed for sequencing
30
+ - `.aioson/context/architecture.md` when Gate B or module ordering is relevant
31
+ - `.aioson/context/design-doc*.md` / `readiness*.md` when they define implementation paths or readiness
32
+ - `.aioson/context/ui-spec.md` only when UI/frontend phases are in scope
33
+
34
+ Before optional inputs, run:
35
+
36
+ ```bash
37
+ aioson context:select . --agent=pm --mode=planning --task="<planning task>" --paths="<known artifacts>"
38
+ aioson preflight:context . --agent=pm --mode=planning --task="<planning task>" --paths="<known artifacts>"
39
+ ```
40
40
 
41
41
  ## Workflow position reality
42
42
 
@@ -92,26 +92,32 @@ gate_status: approved
92
92
  ## Gate C Summary
93
93
  [Why Gate C is approved — prerequisites satisfied]
94
94
 
95
- ## Required Context Package
96
- [Ordered list of files @dev must read, split into "Primary activation package" and "Phase-triggered loads"]
95
+ ## Required Context Package
96
+ [Ordered list of files @dev must read, split into "Primary activation package" and "Phase-triggered loads"]
97
97
 
98
98
  ## Pre-Taken Decisions
99
99
  [Decisions already made — @dev does not re-discuss these]
100
100
 
101
101
  ## Execution Sequence
102
- | Phase | Scope | Primary files | Done criteria |
103
- |---|---|---|---|
104
- | 1 | ... | ... | ... |
105
-
106
- ## Checkpoints
107
- [After each phase, what @dev must update]
108
- ```
109
-
110
- Required Context Package rules:
111
- - Keep the primary activation package to 2-4 files: `project.context.md`, `spec-{slug}.md`, `implementation-plan-{slug}.md`, and optionally the most relevant `design-doc/readiness` artifact.
112
- - 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.
113
- - Each execution phase must state: files to read, files allowed to change, upstream decisions to respect, and verification expected.
114
- - Never copy whole upstream documents into the plan. Reference artifact paths and sections.
102
+ | Phase | Wave | Scope | Primary files | Done criteria |
103
+ |---|---|---|---|---|
104
+ | 1 | 1 | ... | ... | ... |
105
+
106
+ ## Checkpoints
107
+ [After each phase, what @dev must update]
108
+ ```
109
+
110
+ Wave column rules (parallelism markers):
111
+ - Phases sharing a Wave number are **file-disjoint and dependency-free with respect to each other** they may be executed in parallel (isolated subagents/worktrees) or in any order. Waves execute in ascending order.
112
+ - Assign the same Wave to two phases ONLY when their Primary files do not overlap AND neither consumes the other's output (no shared data contract, migration, or API shape in flight).
113
+ - Default is sequential: when in doubt, each phase gets its own Wave. A wrong sequential marking costs wall-clock; a wrong parallel marking costs a merge conflict or a broken contract.
114
+ - `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.
115
+
116
+ Required Context Package rules:
117
+ - Keep the primary activation package to 2-4 files: `project.context.md`, `spec-{slug}.md`, `implementation-plan-{slug}.md`, and optionally the most relevant `design-doc/readiness` artifact.
118
+ - 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.
119
+ - Each execution phase must state: files to read, files allowed to change, upstream decisions to respect, and verification expected.
120
+ - Never copy whole upstream documents into the plan. Reference artifact paths and sections.
115
121
 
116
122
  After writing the plan, always close Gate C:
117
123
  ```
@@ -125,9 +131,9 @@ Implementation plan written: .aioson/context/implementation-plan-{slug}.md
125
131
  Gate C: approved
126
132
  Next agent: from the workflow state machine (MEDIUM feature: @scope-check pre-dev; MEDIUM project: @orchestrator; SMALL with user-confirmed plan: @dev)
127
133
  Tracked action: aioson workflow:next . --complete=pm --tool=<tool>
128
- Direct fallback: /scope-check {slug}, /orchestrator {slug} or /dev {slug} per the state machine
129
- ```
130
- > Recommended: `/clear` before activating — fresh context window.
134
+ Direct fallback: /scope-check {slug}, /orchestrator {slug} or /dev {slug} per the state machine
135
+ ```
136
+ > Recommended: `/clear` before activating — fresh context window.
131
137
 
132
138
  ## Observability
133
139
 
@@ -140,11 +146,11 @@ aioson runtime:emit . --agent=pm --type=gate_check --summary="Gate C approved: {
140
146
  At session end, register:
141
147
  ```bash
142
148
  # Capture user decisions for operator memory
143
- aioson op:capture --signal=confirmation --quote="<user's verbatim choice>" --proposal="<decision paraphrase>" --source-agent=pm 2>/dev/null || true
144
- aioson agent:epilogue . --agent=pm --feature={slug} --summary="PM <slug>: <N> stories prioritized, Gate C <approved|pending>" --action="PM completed: {N} stories prioritized, Gate C {approved|pending}" --next="<next agent recommendation>" --gate="Gate C: <approved|pending>" 2>/dev/null || aioson agent:done . --agent=pm --summary="PM <slug>: <N> stories prioritized, Gate C <approved|pending>" 2>/dev/null || true
145
- ```
149
+ aioson op:capture --signal=confirmation --quote="<user's verbatim choice>" --proposal="<decision paraphrase>" --source-agent=pm 2>/dev/null || true
150
+ aioson agent:epilogue . --agent=pm --feature={slug} --summary="PM <slug>: <N> stories prioritized, Gate C <approved|pending>" --action="PM completed: {N} stories prioritized, Gate C {approved|pending}" --next="<next agent recommendation>" --gate="Gate C: <approved|pending>" 2>/dev/null || aioson agent:done . --agent=pm --summary="PM <slug>: <N> stories prioritized, Gate C <approved|pending>" 2>/dev/null || true
151
+ ```
146
152
 
147
- If `agent:epilogue`/`agent:done` does not report workflow auto-advance, tell the user to run the tracked action above before activating the next agent. Never recommend a bare `/orchestrator` activation for a feature; include `{slug}` so the activation preflight can recover context even without a workflow handoff.
153
+ If `agent:epilogue`/`agent:done` does not report workflow auto-advance, tell the user to run the tracked action above before activating the next agent. Never recommend a bare `/orchestrator` activation for a feature; include `{slug}` so the activation preflight can recover context even without a workflow handoff.
148
154
 
149
155
  ## Autopilot handoff
150
156
 
@@ -122,21 +122,21 @@ aioson dev:state:write . --feature={slug} --next="Apply mandatory corrections fr
122
122
 
123
123
  If the CLI is unavailable, edit `.aioson/context/dev-state.md` directly: set `next_step` to the corrections-plan path and add the plan to the context package. `aioson dev:resume-data` also auto-surfaces any `corrections-*.md` with `status: open|in_progress` for the active feature, but the dev-state pointer is the primary trail — a fresh @dev session must find the corrections without any chat history.
124
124
 
125
- 3. **Auto-cycle to @dev (runtime-managed, cap from `agentic_policy`, default 3):**
126
-
127
- Before looping, scan Critical findings for keywords `auth | secret | credential | session | password | token | sensitive | data leak | PII | encryption`. If any match, pass `--critical-security`.
128
-
129
- ```bash
130
- aioson review-cycle:advance . --feature={slug} --plan=.aioson/plans/{slug}/corrections-{date}.md --source=qa --to=dev --json 2>/dev/null || true
131
- ```
132
-
133
- Interpret the JSON action:
134
- - `invoke_dev`: invoke `Skill(aioson:agent:dev)` with the returned `task`. User can Ctrl+C anytime.
135
- - `human_gate`: tell the user that the Critical security finding requires human intervention before continuing. Include the plan path.
136
- - `stop_cycle_limit`: tell the user the QA-to-Dev auto-cycle exhausted after `max_cycles`; remaining findings are in the returned plan path.
137
- - command unavailable: use the legacy state file `.aioson/runtime/qa-dev-cycle.json` with `{slug, cycle, started_at, last_plan}` and the same 3-round behavior.
138
-
139
- **Reset:** on QA PASS (no Critical/High remaining), run `aioson review-cycle:reset . --feature={slug} --source=qa --to=dev 2>/dev/null || true` before `feature:close`.
125
+ 3. **Auto-cycle to @dev (runtime-managed, cap from `agentic_policy`, default 3):**
126
+
127
+ Before looping, scan Critical findings for keywords `auth | secret | credential | session | password | token | sensitive | data leak | PII | encryption`. If any match, pass `--critical-security`.
128
+
129
+ ```bash
130
+ aioson review-cycle:advance . --feature={slug} --plan=.aioson/plans/{slug}/corrections-{date}.md --source=qa --to=dev --json 2>/dev/null || true
131
+ ```
132
+
133
+ Interpret the JSON action:
134
+ - `invoke_dev`: invoke `Skill(aioson:agent:dev)` with the returned `task`. User can Ctrl+C anytime.
135
+ - `human_gate`: tell the user that the Critical security finding requires human intervention before continuing. Include the plan path.
136
+ - `stop_cycle_limit`: tell the user the QA-to-Dev auto-cycle exhausted after `max_cycles`; remaining findings are in the returned plan path.
137
+ - command unavailable: use the legacy state file `.aioson/runtime/qa-dev-cycle.json` with `{slug, cycle, started_at, last_plan}` and the same 3-round behavior.
138
+
139
+ **Reset:** on QA PASS (no Critical/High remaining), run `aioson review-cycle:reset . --feature={slug} --source=qa --to=dev 2>/dev/null || true` before `feature:close`.
140
140
 
141
141
  4. **Fallback (when auto-loop is blocked or skipped):** the durable trail from step 2 must already be on disk before you say this. Inform the user:
142
142
  > "Corrections plan created at `.aioson/plans/{slug}/corrections-{date}.md`.
@@ -173,7 +173,7 @@ Both `@tester` and `@pentester` are official AIOSON agents. Surface them explici
173
173
  **Recommend `@validator`** in the report when:
174
174
  - `.aioson/plans/{slug}/harness-contract.json` exists for the active feature (MEDIUM with a binary success contract)
175
175
  - Verdict is trending PASS (no unresolved Critical/High) — `@validator` is the final binary gate immediately before `feature:close`
176
- > "Harness contract detected ({path}). Activate `/aioson:agent:validator` to run binary verification of `criteria[]` before `feature:close`. The validator runs in an isolated context (reads only the contract + listed completed_steps) — schema in `.aioson/docs/sheldon/harness-contract.md`."
176
+ > "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`."
177
177
 
178
178
  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}`.
179
179
 
@@ -403,7 +403,7 @@ When QA is complete and all Critical and High findings are resolved:
403
403
 
404
404
  When `auto_handoff: true` is set in `project.context.md`, you are the hub of the post-dev review cycle (`.aioson/docs/autopilot-handoff.md`). After your verdict and closing duties, route automatically instead of stopping — the four agents (`@dev`/`@qa`/`@tester`/`@pentester`) are always chained, but `@tester`/`@pentester` only run when their trigger fires:
405
405
 
406
- - **Verdict FAIL (Critical/High):** the corrections auto-cycle above already invokes `@dev` (cap 3, security gate). That path takes precedence — do not also route here.
406
+ - **Verdict FAIL (Critical/High):** the corrections auto-cycle above already invokes `@dev` (cap 3, security gate). That path takes precedence — do not also route here.
407
407
  - **Verdict PASS — evaluate in order; auto-invoke the FIRST that applies and is not already done clean this cycle:**
408
408
  1. `@tester` trigger fires (coverage gap / no mutation tests on auth·money) → `Skill(aioson:agent:tester)`.
409
409
  2. `@pentester` trigger fires (sensitive surface: auth/secrets/data/upload/external URL/supply chain) → `Skill(aioson:agent:pentester)`.
@@ -469,8 +469,8 @@ aioson workflow:next .
469
469
 
470
470
  If `.aioson/runtime/reflect-prompt.json` exists at the start of your turn: read it, edit the listed `targets` in `bootstrap/*.md` (frontmatter intact, `generated_at` bumped, no writes outside `validation_rules.allowed_paths`), then `aioson memory:reflect-commit . --agent=qa --output=<path>` with `{ "files": { "<rel>": "<content>" } }`. See `.aioson/docs/autonomy-protocol.md` for tier semantics. Skip silently if no manifest is present.
471
471
 
472
- ## Observability
473
- At session end, prefer the consolidated epilogue:
474
- ```bash
475
- aioson agent:epilogue . --agent=qa --feature=<slug> --summary="Reviewed <slug>: <N> findings (<H> high, <M> med)" --verdict=<PASS|FAIL> 2>/dev/null || aioson agent:done . --agent=qa --summary="Reviewed <slug>: <N> findings (<H> high, <M> med)" 2>/dev/null || true
476
- ```
472
+ ## Observability
473
+ At session end, prefer the consolidated epilogue:
474
+ ```bash
475
+ aioson agent:epilogue . --agent=qa --feature=<slug> --summary="Reviewed <slug>: <N> findings (<H> high, <M> med)" --verdict=<PASS|FAIL> 2>/dev/null || aioson agent:done . --agent=qa --summary="Reviewed <slug>: <N> findings (<H> high, <M> med)" 2>/dev/null || true
476
+ ```
@@ -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 -> @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
- ```
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,19 +34,22 @@ 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
- ## 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
- ```
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
+ aioson spec:analyze . --feature={slug} --json
50
+ ```
51
+
52
+ `spec:analyze` is the deterministic cross-artifact consistency pass (ID traceability, upstream-modified-after-downstream staleness, readiness blocked, contract sanity). Treat its `error` findings as blockers (route to the owner agent before any verdict); fold `warning` findings into your drift comparison as pre-computed evidence — confirm or dismiss each one explicitly. Do not re-derive by hand what the report already proves.
50
53
 
51
54
  ## Evidence
52
55
 
@@ -149,33 +152,33 @@ Why: {reason}
149
152
  Optional handoff: {when useful, suggest `@scope-check --scope-mode=post-dev|post-fix|final`; otherwise "none"}
150
153
  ```
151
154
 
152
- ## Handoff Rules
153
-
154
- - `approved` or `patched`: continue to the next workflow stage.
155
+ ## Handoff Rules
156
+
157
+ - `approved` or `patched`: continue to the next workflow stage.
155
158
  - `needs-*`: do not continue downstream; route to the owner with exact files and changes needed.
156
159
  - `blocked`: ask one specific question.
157
160
  - `post-dev` can route to `@qa` or `@pentester` only when drift is resolved.
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.
161
+ - `post-fix` can route to `@qa` when verification owns the final decision.
162
+
163
+ ## Dev-State Producer
164
+
165
+ 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`:
166
+
167
+ ```bash
168
+ aioson dev:state:write . --feature={slug} --phase=1 \
169
+ --next="<first concrete implementation slice from scope-check + plan/readiness>" \
170
+ --context=spec,design-doc,readiness
171
+ ```
172
+
173
+ For MEDIUM features with `implementation-plan-{slug}.md`, use:
174
+
175
+ ```bash
176
+ aioson dev:state:write . --feature={slug} --phase=1 \
177
+ --next="<first phase from implementation-plan-{slug}.md>" \
178
+ --context=spec,impl-plan,readiness
179
+ ```
180
+
181
+ 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.
179
182
 
180
183
  ## Autopilot Handoff
181
184
 
@@ -194,5 +197,5 @@ If `auto_handoff: true` in `project.context.md` frontmatter, a feature workflow
194
197
  At session end:
195
198
 
196
199
  ```bash
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
- ```
200
+ 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
201
+ ```
@@ -272,7 +272,7 @@ Run after writing `sheldon-enrichment-{slug}.md` only when `classification: MEDI
272
272
 
273
273
  Goal: convert binary ACs from the enriched PRD into a machine-checkable contract consumed by `@validator`. Implements AC-HD-06 of `harness-driven-aioson`.
274
274
 
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.
275
+ Load `.aioson/docs/sheldon/harness-contract.md` for the full procedure: init via `aioson harness:init`, criteria population (binary vs advisory), `verification` command authoring (every `binary: true` criterion carries an executable check when mechanically possible — exit 0 = pass, run via `aioson harness:check`), `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
277
  ## Retro dossier analysis (on-demand)
278
278
 
@@ -25,6 +25,7 @@ Rules and governance docs may *add* binary criteria but never override the expli
25
25
  - `.aioson/plans/{slug}/progress.json` — current state and `completed_steps`
26
26
  - Files listed in `progress.json.completed_steps` — the only delivered artifacts in scope
27
27
  - Diagnostic tool output — linters, test runners, compilers for deterministic verification
28
+ - `.aioson/plans/{slug}/validator-prompt.txt` (when generated by `aioson harness:validate`) — self-contained review payload: deterministic check results, changed-file list, and unified diff vs base. **Preferred activation: run from this prompt in a fresh, isolated context** (subagent or separate session) — never inline in the session that implemented the feature.
28
29
  > Strict sandbox: read ONLY the above. Never read other agents' history, PRDs/requirements/architecture, or unrelated code — see **Context restrictions (mandatory)** below.
29
30
 
30
31
  ## Context restrictions (mandatory)
@@ -50,13 +51,23 @@ To preserve impartiality and avoid continuity hallucinations, you operate in a *
50
51
  Locate `harness-contract.json` for the current feature. Identify criteria with `binary: true`.
51
52
 
52
53
  ### Step 2 — Deterministic verification
53
- Run (or request execution of) local tools for each criterion:
54
+ First, run the executable checks declared in the contract:
55
+
56
+ ```bash
57
+ aioson harness:check . --slug={slug} --json
58
+ ```
59
+
60
+ For every criterion that has a `verification` command, the check's exit code **is** the verdict — copy `ok` into `passed` verbatim (reason = the check's stderr first line on failure). Never override a deterministic result with judgment. The report is also persisted at `.aioson/plans/{slug}/last-check-output.json` (allowed reading — it is diagnostic tool output).
61
+
62
+ For criteria **without** `verification` that are still mechanically checkable, run (or request execution of) local tools yourself:
54
63
  - `ls -l {path}` to check file existence.
55
64
  - `cat {path}` to validate patterns or content.
56
65
  - `npm test` or equivalent for execution criteria.
57
66
 
67
+ If the `aioson` CLI is unavailable, fall back to running each criterion's `verification` command directly and use its exit code.
68
+
58
69
  ### Step 3 — Semantic verification
59
- For criteria that require understanding (e.g., "API follows REST conventions"), analyze the delivered code strictly against what the contract requires — nothing more.
70
+ Only for criteria with no `verification` command that require understanding (e.g., "API follows REST conventions"): analyze the delivered code strictly against what the contract requires — nothing more.
60
71
 
61
72
  ### Step 4 — Verdict generation
62
73
  Your output must be **EXCLUSIVELY** a structured JSON object designed to be parsed by a machine. Do not add preambles or explanations outside the JSON.
@@ -100,12 +111,12 @@ aioson dossier:add-finding . --slug={slug} --agent=validator --section="Agent Tr
100
111
 
101
112
  Skip silently when the dossier is absent — `progress.json` remains the canonical machine output.
102
113
 
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`
114
+ ## Observability
115
+ 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
116
 
106
117
  ## Autopilot handoff (post-dev cycle)
107
118
 
108
- When `auto_handoff: true` is set in `project.context.md`, after the verdict and `agent:epilogue`/`agent:done` (`.aioson/docs/autopilot-handoff.md`):
119
+ When `auto_handoff: true` is set in `project.context.md`, after the verdict and `agent:epilogue`/`agent:done` (`.aioson/docs/autopilot-handoff.md`):
109
120
  - Score 0 / FAIL → `Skill(aioson:agent:dev)` with `"fix @validator findings — autopilot handoff"`.
110
121
  - 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
122
 
@@ -9,21 +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).
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.
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.
27
27
 
28
28
  ## Routing — deterministic, never LLM-chosen
29
29
 
@@ -34,22 +34,22 @@ The next agent comes from the workflow state machine and on-disk evidence, not f
34
34
 
35
35
  Never skip a stage, reorder, or pick an agent the state machine / routing table did not name.
36
36
 
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.
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.
45
45
 
46
46
  ## Segment 1 — pre-dev chain (`@analyst` → `@dev`)
47
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.
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
53
 
54
54
  ## Segment 2 — post-dev review cycle (hub = `@qa`)
55
55
 
@@ -60,8 +60,8 @@ Routing table (each row is followed only when autopilot is active and no stop co
60
60
  | Current | Condition | Auto-invoke |
61
61
  |---|---|---|
62
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) |
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
65
  | `@qa` | verdict **PASS** + `@tester` trigger fires AND `@tester` not yet run clean | `@tester` |
66
66
  | `@qa` | verdict **PASS** + `@pentester` trigger fires AND `@pentester` not yet run clean | `@pentester` |
67
67
  | `@qa` | verdict **PASS** + harness contract present AND `@validator` not yet PASS | `@validator` |
@@ -77,11 +77,13 @@ Routing table (each row is followed only when autopilot is active and no stop co
77
77
 
78
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
79
 
80
+ **`@validator` runs fresh-context:** when routing to `@validator` with a harness contract present, do not run it inline in the current session — the implementation history biases the verdict. Instead: (1) `aioson harness:check . --slug={slug}` (deterministic checks), (2) `aioson harness:validate . --slug={slug}` — the generated `validator-prompt.txt` is self-contained (criteria + check results + diff vs base), (3) execute that prompt in an **isolated subagent** (Task tool, no conversation context) that writes its JSON verdict to `last-validator-output.json`, (4) re-run `aioson harness:validate` to consume the verdict through the circuit breaker. Clients without subagent support fall back to `Skill(aioson:agent:validator)` in a fresh session, as before.
81
+
80
82
  ## Stop conditions — break the chain and emit the normal manual handoff
81
83
 
82
84
  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
+ 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.
86
+ 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
87
  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
88
  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
89
  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.
@@ -37,7 +37,8 @@ For every AC in the enriched PRD with an objective, mechanically verifiable asse
37
37
  "id": "C1",
38
38
  "description": "<AC text — human-readable for PR review>",
39
39
  "assertion": "<machine-verifiable expression — e.g. 'tests/foo.test.js passes' or 'src/x/y.js exports parseX'>",
40
- "binary": true
40
+ "binary": true,
41
+ "verification": "<shell command whose exit code 0 = pass — e.g. 'node --test tests/foo.test.js'>"
41
42
  }
42
43
  ```
43
44
 
@@ -45,6 +46,19 @@ ACs that are subjective (UX feel, code style preference) get `binary: false` and
45
46
 
46
47
  **Rule of thumb:** if the assertion can be answered by a single shell command exit code or a single test, it qualifies as `binary: true`. Otherwise mark it advisory and let `@qa` cover it.
47
48
 
49
+ ### 2b. Author `verification` commands
50
+
51
+ Every `binary: true` criterion **must** carry a `verification` shell command whenever one is mechanically possible. Exit code 0 = pass; anything else = fail. These commands are executed deterministically by `aioson harness:check . --slug={slug}` (and by `self:loop`) — `@validator` only LLM-judges criteria that have no `verification`.
52
+
53
+ Authoring rules for `verification`:
54
+
55
+ - **Prefer the project's own test runner** (`node --test tests/x.test.js`, `npm test -- --grep "..."`, `pytest tests/test_x.py`). A criterion backed by a real test is the gold standard.
56
+ - **One-liner assertions** when no test exists yet: `node -e "const m = require('./src/x'); process.exit(typeof m.parseX === 'function' ? 0 : 1)"`.
57
+ - **Deterministic only**: no network calls, no wall-clock dependence, no interactive prompts.
58
+ - **Cross-platform**: single commands or npm scripts — avoid shell chaining (`&&`, `||`) and POSIX-only utilities (`grep`, `test -f`) on Windows-first projects; use `node -e` for file/shape assertions instead.
59
+ - **Self-contained**: the command must pass/fail on a clean checkout after install — no hidden setup steps.
60
+ - A `binary: true` criterion **without** `verification` remains valid (judged by `@validator`, as before), but the contract schema emits a coverage warning — treat each one as debt and justify it in the enrichment log.
61
+
48
62
  ### 3. Set `contract_mode`
49
63
 
50
64
  By classification and risk surface:
@@ -90,12 +104,15 @@ Safe defaults for `BALANCED`:
90
104
  "id": "C1",
91
105
  "description": "...",
92
106
  "assertion": "...",
93
- "binary": true
107
+ "binary": true,
108
+ "verification": "node --test tests/foo.test.js"
94
109
  }
95
110
  ]
96
111
  }
97
112
  ```
98
113
 
114
+ `verification` is optional per criterion (legacy contracts remain valid), executed via `aioson harness:check` with exit code 0 = pass.
115
+
99
116
  ### `progress.json`
100
117
 
101
118
  ```json
@@ -5,13 +5,15 @@
5
5
 
6
6
  ## When to use
7
7
 
8
- Load this skill when:
9
- - starting spec work for a new feature or project (any agent)
10
- - deciding phase depth based on classification (MICRO / SMALL / MEDIUM)
11
- - preparing a clean handoff to the next agent
12
- - retaking work after a session break (check `last_checkpoint` + `phase_gates` first)
13
-
14
- Do NOT load the entire `references/` folder. Load only the file matching your current need.
8
+ Load this skill when:
9
+ - starting spec work for a new feature or project (any agent)
10
+ - deciding phase depth based on classification (MICRO / SMALL / MEDIUM)
11
+ - preparing a clean handoff to the next agent
12
+ - retaking work after a session break (check `last_checkpoint` + `phase_gates` first)
13
+
14
+ Do not load this skill for `@deyvin` activation-only recovery. A bare `@deyvin` activation is status recovery, not spec work; run Deyvin's fast path and stop before opening this file.
15
+
16
+ Do NOT load the entire `references/` folder. Load only the file matching your current need.
15
17
 
16
18
  ## What phases exist
17
19