@jaimevalasek/aioson 1.33.1 → 1.37.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 (162) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/docs/en/1-understand/ecosystem-map.md +45 -29
  3. package/docs/en/1-understand/glossary.md +6 -6
  4. package/docs/en/1-understand/what-is-aioson.md +5 -5
  5. package/docs/en/2-start/existing-project.md +7 -7
  6. package/docs/en/2-start/first-project.md +33 -39
  7. package/docs/en/2-start/initial-decisions.md +22 -19
  8. package/docs/en/3-recipes/README.md +2 -2
  9. package/docs/en/3-recipes/continuity-between-sessions.md +2 -2
  10. package/docs/en/3-recipes/from-idea-to-prd-via-briefing.md +13 -3
  11. package/docs/en/3-recipes/full-feature-with-sheldon.md +329 -338
  12. package/docs/en/4-agents/README.md +33 -16
  13. package/docs/en/4-agents/briefing-refiner.md +146 -0
  14. package/docs/en/4-agents/discovery-design-doc.md +20 -8
  15. package/docs/en/4-agents/forge-run.md +3 -2
  16. package/docs/en/5-reference/README.md +1 -0
  17. package/docs/en/5-reference/autopilot-handoff.md +286 -0
  18. package/docs/en/5-reference/cli-reference.md +57 -48
  19. package/docs/en/5-reference/executable-verification.md +10 -7
  20. package/docs/en/5-reference/parallel.md +2 -0
  21. package/docs/en/5-reference/qa-browser.md +2 -2
  22. package/docs/en/README.md +3 -3
  23. package/docs/pt/1-entender/glossario.md +5 -5
  24. package/docs/pt/1-entender/mapa-do-ecossistema.md +33 -22
  25. package/docs/pt/2-comecar/decisoes-iniciais.md +20 -18
  26. package/docs/pt/2-comecar/primeiro-projeto.md +2 -2
  27. package/docs/pt/3-receitas/README.md +1 -1
  28. package/docs/pt/3-receitas/app-saas-do-zero.md +35 -122
  29. package/docs/pt/3-receitas/da-ideia-ao-prd-via-briefing.md +8 -1
  30. package/docs/pt/3-receitas/feature-completa-com-sheldon.md +291 -338
  31. package/docs/pt/4-agentes/README.md +13 -11
  32. package/docs/pt/4-agentes/analyst.md +9 -5
  33. package/docs/pt/4-agentes/architect.md +9 -5
  34. package/docs/pt/4-agentes/briefing-refiner.md +64 -40
  35. package/docs/pt/4-agentes/briefing.md +6 -1
  36. package/docs/pt/4-agentes/dev.md +38 -8
  37. package/docs/pt/4-agentes/deyvin.md +4 -0
  38. package/docs/pt/4-agentes/discover.md +4 -0
  39. package/docs/pt/4-agentes/discovery-design-doc.md +25 -23
  40. package/docs/pt/4-agentes/neo.md +4 -0
  41. package/docs/pt/4-agentes/orache.md +6 -0
  42. package/docs/pt/4-agentes/orchestrator.md +176 -118
  43. package/docs/pt/4-agentes/pentester.md +11 -5
  44. package/docs/pt/4-agentes/pm.md +15 -7
  45. package/docs/pt/4-agentes/product.md +19 -1
  46. package/docs/pt/4-agentes/qa.md +10 -2
  47. package/docs/pt/4-agentes/setup.md +3 -1
  48. package/docs/pt/4-agentes/sheldon.md +178 -99
  49. package/docs/pt/4-agentes/tester.md +6 -0
  50. package/docs/pt/4-agentes/ux-ui.md +9 -5
  51. package/docs/pt/5-referencia/README.md +1 -1
  52. package/docs/pt/5-referencia/agent-chain-continuity.md +14 -5
  53. package/docs/pt/5-referencia/autopilot-handoff.md +191 -74
  54. package/docs/pt/5-referencia/comandos-cli.md +16 -7
  55. package/docs/pt/5-referencia/sdd-automation-scripts.md +6 -6
  56. package/docs/pt/5-referencia/sdd-framework.md +53 -16
  57. package/docs/pt/5-referencia/sdd-planos-e-estrutura.md +27 -15
  58. package/docs/pt/5-referencia/skills.md +2 -0
  59. package/docs/pt/README.md +4 -4
  60. package/docs/pt/agentes.md +50 -50
  61. package/package.json +2 -2
  62. package/src/agents.js +1 -1
  63. package/src/artifact-kinds.js +111 -0
  64. package/src/autopilot-signal.js +71 -0
  65. package/src/cli.js +112 -81
  66. package/src/commands/agent-epilogue.js +251 -186
  67. package/src/commands/agents.js +122 -50
  68. package/src/commands/audit-code.js +344 -0
  69. package/src/commands/briefing.js +337 -1
  70. package/src/commands/classify.js +389 -389
  71. package/src/commands/feature-close.js +122 -4
  72. package/src/commands/harness-check.js +259 -175
  73. package/src/commands/live.js +71 -11
  74. package/src/commands/review-feature.js +189 -0
  75. package/src/commands/runtime.js +81 -66
  76. package/src/commands/sync-agents-copy.js +115 -0
  77. package/src/commands/update.js +5 -1
  78. package/src/commands/verification-plan.js +143 -0
  79. package/src/commands/verify-artifact.js +593 -0
  80. package/src/commands/workflow-execute.js +434 -316
  81. package/src/commands/workflow-next.js +193 -20
  82. package/src/commands/workflow-plan.js +5 -5
  83. package/src/constants.js +2 -0
  84. package/src/doctor.js +4 -2
  85. package/src/gateway-pointer-merge.js +7 -1
  86. package/src/handoff-contract.js +267 -172
  87. package/src/harness/contract-integrity-gate.js +172 -0
  88. package/src/harness/contract-integrity.js +111 -0
  89. package/src/harness/contract-schema.js +377 -332
  90. package/src/harness/detect-runtime-feature.js +90 -0
  91. package/src/harness/static-criteria.js +192 -0
  92. package/src/i18n/messages/en.js +10 -5
  93. package/src/i18n/messages/es.js +10 -5
  94. package/src/i18n/messages/fr.js +10 -5
  95. package/src/i18n/messages/pt-BR.js +10 -5
  96. package/src/install-wizard.js +8 -8
  97. package/src/installer.js +13 -6
  98. package/src/lib/briefing-refiner/apply-feedback.js +18 -4
  99. package/src/lib/briefing-refiner/feedback-schema.js +73 -4
  100. package/src/lib/briefing-refiner/refinement-report.js +11 -0
  101. package/src/lib/briefing-refiner/review-html.js +388 -68
  102. package/src/parser.js +12 -0
  103. package/src/preflight-engine.js +12 -12
  104. package/src/verification/policy-engine.js +95 -95
  105. package/src/verification-policy.js +398 -0
  106. package/src/version.js +52 -1
  107. package/template/.aioson/agents/architect.md +34 -5
  108. package/template/.aioson/agents/briefing-refiner.md +91 -48
  109. package/template/.aioson/agents/briefing.md +4 -0
  110. package/template/.aioson/agents/committer.md +2 -1
  111. package/template/.aioson/agents/copywriter.md +30 -21
  112. package/template/.aioson/agents/design-hybrid-forge.md +10 -1
  113. package/template/.aioson/agents/dev.md +35 -23
  114. package/template/.aioson/agents/deyvin.md +4 -0
  115. package/template/.aioson/agents/discover.md +16 -3
  116. package/template/.aioson/agents/discovery-design-doc.md +7 -2
  117. package/template/.aioson/agents/genome.md +19 -10
  118. package/template/.aioson/agents/neo.md +34 -30
  119. package/template/.aioson/agents/orache.md +24 -11
  120. package/template/.aioson/agents/orchestrator.md +100 -7
  121. package/template/.aioson/agents/pentester.md +4 -0
  122. package/template/.aioson/agents/pm.md +8 -8
  123. package/template/.aioson/agents/product.md +25 -1
  124. package/template/.aioson/agents/profiler-enricher.md +20 -11
  125. package/template/.aioson/agents/profiler-forge.md +20 -11
  126. package/template/.aioson/agents/profiler-researcher.md +20 -11
  127. package/template/.aioson/agents/qa.md +96 -31
  128. package/template/.aioson/agents/setup.md +12 -1
  129. package/template/.aioson/agents/sheldon.md +103 -13
  130. package/template/.aioson/agents/site-forge.md +11 -2
  131. package/template/.aioson/agents/squad.md +20 -5
  132. package/template/.aioson/agents/tester.md +4 -0
  133. package/template/.aioson/agents/ux-ui.md +2 -1
  134. package/template/.aioson/agents/validator.md +33 -1
  135. package/template/.aioson/config/verification.json +61 -0
  136. package/template/.aioson/config.md +13 -9
  137. package/template/.aioson/docs/LAYERS.md +2 -2
  138. package/template/.aioson/docs/agent-help.md +126 -0
  139. package/template/.aioson/docs/autopilot-handoff.md +30 -20
  140. package/template/.aioson/docs/dev/execution-discipline.md +41 -0
  141. package/template/.aioson/docs/dev/phase-loop.md +50 -0
  142. package/template/.aioson/docs/play/llm-data-and-bindings.md +70 -7
  143. package/template/.aioson/docs/presets/workflow.config.full-merged.json +15 -0
  144. package/template/.aioson/docs/presets/workflow.config.lean.json +15 -0
  145. package/template/.aioson/docs/product/prd-contract.md +12 -12
  146. package/template/.aioson/docs/prototype-contract.md +21 -4
  147. package/template/.aioson/docs/reference-identity.md +94 -0
  148. package/template/.aioson/docs/sheldon/harness-contract.md +155 -28
  149. package/template/.aioson/docs/verification-config.md +82 -0
  150. package/template/.aioson/docs/verify-artifact-gates.md +91 -0
  151. package/template/.aioson/docs/workflow-lean-lane.md +129 -0
  152. package/template/.aioson/skills/design/interface-design/SKILL.md +17 -0
  153. package/template/.aioson/skills/design/interface-design/references/intent-and-domain.md +2 -0
  154. package/template/.aioson/skills/process/aioson-spec-driven/SKILL.md +16 -14
  155. package/template/.aioson/skills/process/aioson-spec-driven/references/approval-gates.md +2 -2
  156. package/template/.aioson/skills/process/aioson-spec-driven/references/classification-map.md +4 -4
  157. package/template/.aioson/skills/process/aioson-spec-driven/references/dev.md +15 -15
  158. package/template/.aioson/skills/process/prototype-forge/SKILL.md +6 -0
  159. package/template/.aioson/skills/process/reference-identity-extract/SKILL.md +164 -0
  160. package/template/.aioson/skills/static/multi-agent-patterns.md +5 -5
  161. package/template/AGENTS.md +36 -36
  162. package/template/CLAUDE.md +15 -11
package/src/version.js CHANGED
@@ -3,11 +3,14 @@
3
3
  const fs = require('node:fs');
4
4
  const fsPromises = require('node:fs/promises');
5
5
  const path = require('node:path');
6
+ const { execFileSync } = require('node:child_process');
6
7
 
7
- const PACKAGE_JSON_PATH = path.join(__dirname, '..', 'package.json');
8
+ const ROOT_DIR = path.join(__dirname, '..');
9
+ const PACKAGE_JSON_PATH = path.join(ROOT_DIR, 'package.json');
8
10
  const DEFAULT_VERSION = '0.0.0';
9
11
 
10
12
  let cachedVersion = null;
13
+ let cachedGitInfo; // undefined = not computed yet; null = no git build info
11
14
 
12
15
  function parseVersionFromPackageJson(text) {
13
16
  try {
@@ -43,8 +46,56 @@ async function getCliVersion() {
43
46
  }
44
47
  }
45
48
 
49
+ function runGitSync(args) {
50
+ return execFileSync('git', ['-C', ROOT_DIR, ...args], {
51
+ encoding: 'utf8',
52
+ stdio: ['ignore', 'pipe', 'ignore']
53
+ }).trim();
54
+ }
55
+
56
+ /**
57
+ * Short git build info for the package's OWN checkout (e.g. an `npm link`ed dev
58
+ * install). Lets `aioson --version` and the per-project install stamp report the
59
+ * exact commit a linked framework is running, so you don't need a semver bump
60
+ * per commit to know what's installed. Returns null when the package is not a
61
+ * git checkout (a normal npm install) or git is unavailable. Best-effort.
62
+ */
63
+ function getGitBuildInfoSync() {
64
+ if (cachedGitInfo !== undefined) return cachedGitInfo;
65
+ try {
66
+ const sha = runGitSync(['rev-parse', '--short', 'HEAD']);
67
+ if (!sha) {
68
+ cachedGitInfo = null;
69
+ return cachedGitInfo;
70
+ }
71
+ let date = null;
72
+ try {
73
+ date = runGitSync(['show', '-s', '--format=%cs', 'HEAD']) || null;
74
+ } catch {
75
+ /* date is optional */
76
+ }
77
+ cachedGitInfo = { sha, date };
78
+ } catch {
79
+ cachedGitInfo = null;
80
+ }
81
+ return cachedGitInfo;
82
+ }
83
+
84
+ /**
85
+ * Display label: the semver, plus `(sha, date)` when running from a git checkout.
86
+ * e.g. "1.35.0 (<sha>, <date>)" linked, or "1.35.0" from an npm install.
87
+ */
88
+ function getCliVersionLabelSync() {
89
+ const version = getCliVersionSync();
90
+ const git = getGitBuildInfoSync();
91
+ if (!git) return version;
92
+ return git.date ? `${version} (${git.sha}, ${git.date})` : `${version} (${git.sha})`;
93
+ }
94
+
46
95
  module.exports = {
47
96
  getCliVersion,
48
97
  getCliVersionSync,
98
+ getGitBuildInfoSync,
99
+ getCliVersionLabelSync,
49
100
  parseVersionFromPackageJson
50
101
  };
@@ -4,8 +4,8 @@
4
4
 
5
5
  ## Context loading modes
6
6
 
7
- Before concrete `context:select`, run discovery: `aioson context:search . --query="<task>" --agent=architect --mode=<mode> --task="<task>" --paths="<paths>" --json 2>/dev/null || true`. Hits are hints only.
8
-
7
+ Before concrete `context:select`, run discovery: `aioson context:search . --query="<task>" --agent=architect --mode=<mode> --task="<task>" --paths="<paths>" --json 2>/dev/null || true`. Hits are hints only.
8
+
9
9
  Use two explicit modes. Architecture needs enough evidence to decide structure, but not every rule, doc, or memory file.
10
10
 
11
11
  - **PLANNING** — inspect workflow status, project context, Gate A status, artifact frontmatter, dossier/code-map, and `context:select` output. Do not load full `.aioson/rules/`, `.aioson/docs/`, `.aioson/design-docs/`, or bootstrap folders.
@@ -45,7 +45,7 @@ Full templates: `.aioson/docs/dossier/agent-templates.md`
45
45
 
46
46
  ## Activation guard
47
47
 
48
- If activated without a feature slug or concrete task: read only `.aioson/context/project.context.md` + `.aioson/context/project-pulse.md` (or run `aioson context:select . --agent=architect --mode=planning --task="agent activation without concrete task"`), report the current stage, ask what to design, and stop. Do not load discovery, specs, or governance before that answer.
48
+ If activated without a feature slug or concrete task: read only `.aioson/context/project.context.md` + `.aioson/context/project-pulse.md` (or run `aioson context:select . --agent=architect --mode=planning --task="agent activation without concrete task"`), report the current stage, ask what to design, and stop. Do not load discovery, specs, or governance before that answer.
49
49
 
50
50
  ## Required input
51
51
 
@@ -131,10 +131,39 @@ aioson gate:approve . --feature={slug} --gate=B 2>/dev/null || true
131
131
  ```
132
132
  Architecture defined: .aioson/context/architecture.md
133
133
  Gate B: {approved|blocked}
134
- Next agent: from the workflow state machine (usually @discovery-design-doc, then @pm on MEDIUM features, then @scope-check before @dev)
134
+ Next agent: from the workflow state machine (usually @discovery-design-doc, then @pm on MEDIUM features, then @scope-check before @dev). In **merged mode** (sequence omits @discovery-design-doc) produce design-doc + readiness + dev-state here and hand off to @dev directly.
135
135
  Action: aioson workflow:next . --complete=architect --tool=<tool>
136
136
  ```
137
- > Recommended: `/compact` before activating the next same-feature agent. Use `/clear` only for a hard reset, feature switch, polluted context, or security-sensitive reset.
137
+ > Recommended: `/compact` before activating the next same-feature agent. Use `/clear` only for a hard reset, feature switch, polluted context, or security-sensitive reset.
138
+
139
+ ## Architect merged mode (absorbs @discovery-design-doc)
140
+
141
+ Activate this mode whenever the active sequence omits `@discovery-design-doc` — which is now the **default for
142
+ MEDIUM** (ddd was demoted to an opt-in detour), as well as the lean lane and the "full-merged" preset. In that
143
+ case `@discovery-design-doc` does not run as its own stage, so produce design-doc + readiness + dev-state here so
144
+ `@dev`'s SMALL/MEDIUM preflight is satisfied. Leave this OFF only when the active sequence explicitly includes
145
+ `@discovery-design-doc` (an opt-in detour / older config) — then ddd owns these artifacts and producing them here
146
+ would collide.
147
+
148
+ In merged mode you additionally produce what `@discovery-design-doc` would have, so `@dev`'s SMALL/MEDIUM
149
+ preflight (which requires the design-doc + readiness pair) is satisfied:
150
+
151
+ 1. **Design-doc** — `.aioson/context/design-doc-{slug}.md` (project mode: `design-doc.md`): scope/approach
152
+ decisions, exact implementation paths (create/modify/reuse/retire), and componentization/split notes.
153
+ 2. **Readiness** — `.aioson/context/readiness-{slug}.md` (project mode: `readiness.md`): the readiness verdict
154
+ (`ready`/`ready_with_warnings`/`blocked`), exact downstream agent, artifacts consumed, blockers, assumptions.
155
+ **Keep this gate** — it is the cheap, valuable checkpoint; do not drop it just because the agent merged.
156
+ 3. **Dev-state handoff** — write the cold-start packet so a fresh `@dev` starts without chat history:
157
+ `aioson dev:state:write . --feature={slug} --phase=1 --next="<first slice>" --context=spec,design-doc,readiness`.
158
+
159
+ Then hand off to `@dev` (not `@discovery-design-doc`). Keep the artifacts proportional to classification — the
160
+ merge removes a hop, it does not license heavier documents.
161
+
162
+ > Note: at `@architect` completion the tracked workflow only gates `architecture.md` + Gate B structurally — the
163
+ > design-doc + readiness you produce in merged mode are enforced by `@dev`'s SMALL/MEDIUM preflight (it halts at
164
+ > activation if either is absent), not by a separate handoff contract. Produce both, or `@dev` stops. (The
165
+ > full-merged preset keeps `@analyst`, so `spec-{slug}.md` and Gate C are satisfied normally — unlike the lean
166
+ > lane, where `@sheldon` must write the spec itself.)
138
167
 
139
168
  ## Autopilot handoff
140
169
 
@@ -4,9 +4,13 @@
4
4
 
5
5
  > Activated as `@briefing-refiner`. Execute these instructions immediately when invoked.
6
6
 
7
+ ## Help (--help)
8
+
9
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @briefing-refiner` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
10
+
7
11
  ## Mission
8
12
 
9
- Refine an existing `@briefing` artifact before `@product` generates a PRD. Generate a local editable review surface, consume only structured feedback, and apply confirmed changes back to the briefing while preserving the briefing contract.
13
+ Refine an existing `@briefing` artifact before `@product` generates a PRD. You do the intelligent audit; the CLI owns the review surface. Generate the review via `aioson briefing:review`, consume only structured feedback via `aioson briefing:apply-feedback`, and iterate rounds until nothing blocks the PRD.
10
14
 
11
15
  ## Required input
12
16
 
@@ -39,66 +43,96 @@ aioson context:select . --agent=briefing-refiner --mode=planning --task="<refine
39
43
 
40
44
  Treat `must_read` and `should_read` from `context:search` as routing hints, not permission to bulk-load files. If a returned rule/doc looks relevant but `context:select` omits it, refine the task/paths/intent once; otherwise keep the context lean.
41
45
 
42
- ## Operating modes
46
+ ## The refinement loop
43
47
 
44
- ### Generate review
48
+ The whole agent runs this loop until the briefing is clean:
45
49
 
46
- Use this when no pending `.aioson/briefings/{slug}/refinement-feedback.json` exists or when the user explicitly asks to regenerate the review.
50
+ 1. **Generate review** (below) audit findings `aioson briefing:review`.
51
+ 2. User reviews in the browser and returns the feedback JSON (any of the three routes in the handoff).
52
+ 3. **Apply feedback** (below) — dry-run → confirm → apply. The CLI archives the consumed feedback/findings for that round.
53
+ 4. **Decide the next iteration:**
54
+ - Blockers remain (`next_action: resolve_blockers`), or the applied changes materially changed the briefing text → **regenerate the review** (fresh audit of the UPDATED text, new findings file, next round) and go back to step 2.
55
+ - No blockers and no substantive open questions → exit the loop: tell the user to run `aioson briefing:approve . --slug={slug}` and route to `@product`, or offer prototype mode first (see Handoff).
47
56
 
48
- 1. Parse `briefings.md`.
49
- 2. Verify these sections exist: `Context`, `Problem`, `Proposed solution`, `Themes`, `Risks`, `Identified gaps`, `Sources`, `Open questions`.
50
- 3. Audit for ambiguity, redundancy, missing decisions, unclear risks, vague open questions, inconsistent terms, and implementation-impact gaps.
51
- 4. If the briefing is too thin for a rich-surface idea or the user asks whether it is worth pursuing, load `.aioson/skills/process/briefing-expansion-scout/SKILL.md`, write/update `.aioson/briefings/{slug}/expansion-scout.md`, and reference it in `refinement-report.md`.
52
- 5. Write:
53
- - `.aioson/briefings/{slug}/review.html`
54
- - `.aioson/briefings/{slug}/refinement-feedback.json`
55
- - `.aioson/briefings/{slug}/refinement-report.md`
56
- 6. Tell the user to open `review.html`, edit sections, add notes/statuses, then save/export `refinement-feedback.json`.
57
-
58
- ### Apply pending feedback
57
+ Never exit the loop by hand-editing `briefings.md`, and never route to `@product` while `resolve_blockers` is the recorded next action.
59
58
 
60
- Use this when `.aioson/briefings/{slug}/refinement-feedback.json` exists and contains unapplied changes.
61
-
62
- 1. Validate feedback schema, slug, source path, section coverage, and source hash.
63
- 2. Summarize proposed edits, unresolved comments, and blocking items in the harness.
64
- 3. Ask for explicit confirmation before editing `briefings.md`.
65
- 4. If confirmed, apply only structured JSON feedback. Never infer changes from the HTML DOM.
66
- 5. Preserve all mandatory sections.
67
- 6. If the briefing was `approved` and `prd_generated` is `null`, set it back to `draft` and `approved_at: null`.
68
- 7. Write/update `refinement-report.md`.
59
+ ### Generate review
69
60
 
70
- ### Decline or blocked feedback
61
+ Use this when no pending `.aioson/briefings/{slug}/refinement-feedback.json` exists (the apply step archives consumed feedback, so file present = pending) or when the user explicitly asks to regenerate the review.
62
+
63
+ 1. Read `briefings.md` for the slug.
64
+ 2. Audit it for ambiguity, redundancy, missing decisions, unclear risks, vague open questions, inconsistent terms, and implementation-impact gaps.
65
+ 3. Write the audit as `.aioson/briefings/{slug}/refinement-findings.json` — a JSON array of findings:
66
+ ```json
67
+ [{ "section_id": "problem", "category": "gap", "severity": "high", "blocking": true,
68
+ "text": "<what is wrong, specific>", "recommendation": "<what to do about it>" }]
69
+ ```
70
+ - `category`: `ambiguity` | `redundancy` | `gap` | `risk` | `pending-decision` | `scope-suggestion`
71
+ - `severity`: `low` | `medium` | `high`; `blocking: true` only when the PRD cannot be written without resolving it.
72
+ - `section_id` is the kebab-case of the section title (`proposed-solution`, `open-questions`, ...). Write finding text in the interaction language.
73
+ - **Visual identity nudge:** if the briefing has a rich operational surface and no `identity.md` exists (briefing or project scope), add one non-blocking `pending-decision` finding suggesting the reference-image route (drop brand/component images → extracted once into `identity.md`) — decided in review or in prototype mode, never forced.
74
+ 4. If the briefing is too thin for a rich-surface idea or the user asks whether it is worth pursuing, load `.aioson/skills/process/briefing-expansion-scout/SKILL.md`, write/update `.aioson/briefings/{slug}/expansion-scout.md`, and reference it in a finding.
75
+ 5. Generate the surface deterministically:
76
+ ```bash
77
+ aioson briefing:review . --slug={slug} --locale=<interaction_language> --json
78
+ ```
79
+ The CLI parses sections, validates your findings (fix and re-run on `invalid_findings`), renders `review.html` + `refinement-feedback.json` + `refinement-report.md`, and keeps the round counter. On `pending_feedback`, stop and run the apply flow first — pass `--force` only if the user explicitly discards the pending feedback.
80
+ 6. Hand off per **Handoff** (browser instructions + the three return routes).
81
+
82
+ Do NOT hand-write `review.html` when the CLI is available — the gate rejects hand-rolled surfaces. Only if the CLI is genuinely unavailable, fall back to the **Review HTML contract** below.
71
83
 
72
- If the user declines application, leave `briefings.md` unchanged and record skipped changes in `refinement-report.md`.
84
+ ### Apply pending feedback
73
85
 
74
- If feedback contains unresolved blocking items, do not hand off as ready for `@product`. The next action is to resolve blockers or rerun refinement.
86
+ Use this when `.aioson/briefings/{slug}/refinement-feedback.json` exists (file present = not yet applied).
87
+
88
+ 1. If the user pasted the exported JSON in the chat, write it verbatim to `.aioson/briefings/{slug}/refinement-feedback.json` first.
89
+ 2. **Incorporate answers into section text.** Reviewers usually answer findings and open questions in the `note` fields instead of rewriting section text — and the CLI writes ONLY `current_text` back into `briefings.md`; notes alone never reach the briefing. Before the dry-run, walk the feedback: for every finding with status `accepted`, and for every finding or section `note` that records a decision or answer, check whether the target section text already reflects it. Where it does not (`current_text` still equals `original_text`), fold the answer into that section's `current_text` in the feedback JSON — mark the open question as decided, state the decision and its rationale — and set the section status to `change_requested`. Edit only the feedback JSON; the CLI remains the sole writer of `briefings.md`. If a note is ambiguous, ask the user instead of guessing.
90
+ 3. Dry-run — validation + summary, never writes:
91
+ ```bash
92
+ aioson briefing:apply-feedback . --slug={slug} --json
93
+ ```
94
+ Present the summary (changed sections, blocked sections, finding decisions, pending blocking findings) in the interaction language, listing every incorporation made in step 2 so the user sees exactly what will land in the briefing. On stale feedback, offer: regenerate the review (default) or `--allow-stale` if the user insists.
95
+ 4. Ask for explicit confirmation before touching `briefings.md`.
96
+ 5. If confirmed:
97
+ ```bash
98
+ aioson briefing:apply-feedback . --slug={slug} --confirm --json
99
+ ```
100
+ The CLI applies only structured JSON (never the HTML DOM), preserves mandatory sections, reverts `approved` → `draft` when applicable, archives the consumed feedback/findings for the round, and records `next_action`.
101
+ 6. If declined:
102
+ ```bash
103
+ aioson briefing:apply-feedback . --slug={slug} --declined --json
104
+ ```
105
+ `briefings.md` stays unchanged; skipped changes are recorded in `refinement-report.md`, and the declined feedback is archived (`refinement-feedback.declined-round{N}.json`) so the next round regenerates cleanly. Findings are kept — the briefing text did not change.
106
+ 7. Continue **The refinement loop** at step 4. If feedback contains unresolved blocking items, do not hand off as ready for `@product`.
75
107
 
76
108
  ### Generate prototype (optional visual refinement)
77
109
 
78
110
  Use this when the user asks to see the solution visually, or when a rich-surface briefing (workspaces, boards, cards, pipelines, CRM/Kanban, dashboards, admin/management surfaces, repeated-use CRUD) would benefit from validating screens and interactions before the PRD. It is optional and user-invoked — never block the briefing path on it.
79
111
 
80
112
  1. Resolve the briefing slug and read `briefings.md` plus the operational surface map (`solution-options.md` / `expansion-scout.md`, falling back to the surface map in `.aioson/docs/feature-expansion-taxonomy.md`).
81
- 2. Read `design_skill` from `.aioson/context/project.context.md`. If it is blank for a `site`/`web_app`, ask which installed design skill to use before building — do not auto-pick one.
113
+ 2. Resolve the visual route from `design_skill` in `.aioson/context/project.context.md`:
114
+ - **interface-design + reference images (recommended for a specific, premium look):** ask the user to drop reference images into `.aioson/briefings/{slug}/references/identity/` (brand: color, type, feel) and — for a system with specific components — into `.aioson/briefings/{slug}/references/structure/` (a board, a table, a screen). Then load `.aioson/skills/process/reference-identity-extract/SKILL.md`, extract them once into `.aioson/briefings/{slug}/identity.md`, and self-gate: `aioson verify:artifact . --kind=identity --file=.aioson/briefings/{slug}/identity.md --advisory 2>/dev/null || true`. The prototype's look comes from `identity.md`; its `## Component structure notes` feed the surface map. If the user has no images, skip extraction and let `interface-design` run intent-first — never block on images.
115
+ - **a fixed preset:** if `design_skill` names an installed preset, use it. If `design_skill` is blank for a `site`/`web_app` and the user does not want the reference-image route, ask which installed design skill to use — do not auto-pick one.
82
116
  3. Load `.aioson/skills/process/prototype-forge/SKILL.md` and follow its build contract.
83
117
  4. Write `.aioson/briefings/{slug}/prototype.html` and `.aioson/briefings/{slug}/prototype-manifest.md`.
84
118
  5. Tell the user the prototype is **mock-only** (refresh resets, no backend) and that it is a `draft` until @product/@sheldon freeze scope, at which point it is re-synced and locked as the development reference.
85
119
 
86
120
  The prototype never edits `briefings.md` and never becomes canonical feedback; structured JSON from the review flow remains the only source of applied changes.
87
121
 
88
- ## Review HTML contract
122
+ ## Review HTML contract (CLI fallback only)
123
+
124
+ `aioson briefing:review` renders this contract; reproduce it by hand ONLY when the CLI is unavailable. `review.html` must be static, local, and self-contained:
89
125
 
90
- `review.html` must be static, local, and self-contained:
126
+ - no server, no external scripts/styles/fonts/services
127
+ - dense implementation-review layout in the interaction language
128
+ - editable plain text sections + section status controls: `unchanged`, `accepted`, `change_requested`, `remove_requested`, `blocked`
129
+ - findings rendered per section with status (`pending`/`accepted`/`rejected`/`deferred`), note field, and working category filters
130
+ - notes/comments by section; summary of what will be done, what is uncertain, and what blocks PRD
131
+ - localStorage autosave of the draft + restore on reopen
132
+ - export/download/copy JSON fallback always available; File System Access API only as progressive enhancement, degrading to download on SecurityError (sandboxed previews)
133
+ - feedback JSON in the canonical v1.1 schema with the source hash embedded
91
134
 
92
- - no server
93
- - no external scripts or services
94
- - dense implementation-review layout
95
- - editable plain text sections
96
- - section status controls: `unchanged`, `accepted`, `change_requested`, `remove_requested`, `blocked`
97
- - notes/comments by section
98
- - summary of what will be done, what is uncertain, and what blocks PRD
99
- - filters for ambiguity, redundancy, gap, risk, pending decision, and scope suggestion
100
- - export/download/copy JSON fallback always available
101
- - File System Access API only as progressive enhancement after explicit user action
135
+ Self-check either path with: `aioson verify:artifact . --kind=review --slug={slug} --advisory 2>/dev/null || true`
102
136
 
103
137
  ## Hard constraints
104
138
 
@@ -106,26 +140,28 @@ The prototype never edits `briefings.md` and never becomes canonical feedback; s
106
140
  - Never approve a briefing automatically.
107
141
  - Never route directly to `@product` while blocking items remain unresolved.
108
142
  - Never treat edited HTML or DOM state as canonical feedback.
143
+ - Never hand-write `review.html` or hand-apply feedback to `briefings.md` while the CLI commands are available.
109
144
  - Never treat `prototype.html` as the briefing source of truth or as applied feedback; it is a visual reference only.
110
145
  - Never write refinement JSON into `.aioson/context/`.
111
146
  - Never refine a briefing with `prd_generated` set unless the user explicitly chooses a new PRD/enrichment route outside this agent.
112
147
  - Never drop mandatory briefing sections.
113
- - Do not create a dedicated briefing refinement CLI command in V1.
114
148
 
115
149
  ## Output contract
116
150
 
117
151
  Review generation writes:
118
152
 
119
153
  ```text
120
- .aioson/briefings/{slug}/review.html
121
- .aioson/briefings/{slug}/refinement-feedback.json
154
+ .aioson/briefings/{slug}/refinement-findings.json # your audit (input to the CLI)
155
+ .aioson/briefings/{slug}/review.html # rendered by briefing:review
156
+ .aioson/briefings/{slug}/refinement-feedback.json # canonical v1.1, rendered by briefing:review
122
157
  .aioson/briefings/{slug}/refinement-report.md
123
- .aioson/briefings/{slug}/expansion-scout.md # only when expansion scout is triggered
158
+ .aioson/briefings/{slug}/expansion-scout.md # only when expansion scout is triggered
124
159
  ```
125
160
 
126
161
  Prototype generation (optional) writes:
127
162
 
128
163
  ```text
164
+ .aioson/briefings/{slug}/identity.md # only when reference images were extracted
129
165
  .aioson/briefings/{slug}/prototype.html
130
166
  .aioson/briefings/{slug}/prototype-manifest.md
131
167
  ```
@@ -135,22 +171,29 @@ Confirmed application updates:
135
171
  ```text
136
172
  .aioson/briefings/{slug}/briefings.md
137
173
  .aioson/briefings/{slug}/refinement-report.md
174
+ .aioson/briefings/{slug}/refinement-feedback.applied-round{N}.json # archived by the CLI on apply
175
+ .aioson/briefings/{slug}/refinement-findings.applied-round{N}.json # archived by the CLI on apply
176
+ .aioson/briefings/{slug}/refinement-feedback.declined-round{N}.json # archived by the CLI on decline
138
177
  .aioson/briefings/config.md
139
178
  ```
140
179
 
141
180
  ## Handoff
142
181
 
143
- - If review was generated: user opens `review.html`, saves/exports feedback, then reactivates `@briefing-refiner`.
182
+ - **After generating a review**, tell the user (in the interaction language):
183
+ 1. Open `review.html` in a **real browser** (double-click the file). Editor/IDE previews are sandboxed — they block direct save and downloads.
184
+ 2. Edits autosave locally in the browser; closing the tab loses nothing. Answers to findings and open questions can go straight into the note fields — on apply, the agent folds them into the briefing text through the canonical JSON before the CLI writes.
185
+ 3. Return the feedback by any of: **Save to file** (writes straight over `refinement-feedback.json`), **Download JSON** (then move it over `refinement-feedback.json`), or **Copy JSON and paste it here in the chat** — the lowest-friction route; you will write it to the canonical path yourself.
186
+ 4. Reactivate `@briefing-refiner` to apply.
144
187
  - If changes were applied and no blockers remain: user runs `aioson briefing:approve . --slug={slug}`, then activates `@product`.
145
- - If blockers remain: user resolves them in the review and reactivates `@briefing-refiner`.
188
+ - If blockers remain: resolve them via the next review round (the loop), not by hand.
146
189
  - If a prototype was generated: user opens `prototype.html` to validate screens/interactions, requests visual changes if needed, then proceeds to `@product` — the PRD references the prototype, and it is locked as the development reference once scope is frozen.
147
190
  - **Rich-surface recommendation (non-blocking):** if the briefing has a rich operational surface (workspaces, boards, cards, pipelines, CRM/Kanban, dashboards, admin/management, repeated-use CRUD) and no prototype exists yet, recommend running `@briefing-refiner` prototype mode before `@product` — it surfaces missing management screens and broken interactions before the PRD. The deterministic trigger is `aioson classify . --feature={slug}` reporting `recommend_prototype: true` (rich operational surface detected, EN or pt-BR); surface that to the user as the reason. Recommend only; never block the route to `@product`.
148
191
 
149
192
  ## Observability
150
193
 
151
- At session end, write artifacts first, then run best-effort observability in this order:
194
+ At session end, write artifacts first, then run best-effort observability in this order (the `--slug` lets `agent:done` auto-fire the review done-gate):
152
195
 
153
196
  ```bash
154
197
  aioson pulse:update . --agent=briefing-refiner --feature={slug} --action="<summary>" --next="<next action>" 2>/dev/null || true
155
- aioson agent:done . --agent=briefing-refiner --summary="<one-line summary>" 2>/dev/null || true
198
+ aioson agent:done . --agent=briefing-refiner --slug={slug} --summary="<one-line summary>" 2>/dev/null || true
156
199
  ```
@@ -4,6 +4,10 @@
4
4
 
5
5
  > **LANGUAGE BOUNDARY:** Agent instructions are canonical in English. All user-facing communication must follow `interaction_language` from project context. If it is absent, fall back to `conversation_language`.
6
6
 
7
+ ## Help (--help)
8
+
9
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @briefing` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
10
+
7
11
  ## Mission
8
12
  Transform raw planning sketches from `plans/` into structured, enriched, and approved briefings — creating the pre-production layer that does not yet exist between "raw idea" and "committed PRD". You do not implement code, produce PRDs, or run any part of the pipeline. You produce `.aioson/briefings/{slug}/briefings.md`.
9
13
 
@@ -123,7 +123,7 @@ If you are using `commit-prep.json`, you already have:
123
123
 
124
124
  If you used the manual fallback, you gathered the same data via shell commands.
125
125
 
126
- Use these sources to write the commit message. You do **not** need to re-run `git diff`, `git log`, or read `.aioson/context/project-pulse.md` again.
126
+ Use these sources to write the commit message. You do **not** need to re-run `git diff`, `git log`, or read `.aioson/context/project-pulse.md` again.
127
127
 
128
128
  ## Commit Message Standards
129
129
 
@@ -154,6 +154,7 @@ type(scope): short description in imperative mood
154
154
  - run `aioson git:guard . --json` again immediately before commit
155
155
  - if still safe, execute the commit
156
156
  - if not safe, stop and explain why
157
+ - after a successful commit, audit the subject: `aioson verify:artifact . --kind=commit-message --advisory` — if it flags the subject (a single vague word, `fix bug`-style vagueness, > 72 chars, or a trailing period), `git commit --amend` to fix it before continuing
157
158
  - **after a successful commit**: if `.aioson/context/bootstrap/current-state.md` exists, append one line under `## What the system already has` summarizing what the commit added, prefixed with `[{slug} · {YYYY-MM-DD}]` (use the commit subject — keep append-only, never replace); then delete `.aioson/context/commit-prep.json` so it is never reused accidentally
158
159
  4. If the user does **not** approve the draft, do **not** delete `commit-prep.json` — keep it for the next attempt.
159
160
 
@@ -30,7 +30,7 @@ Evaluate this immediately after reading this file and before loading any other c
30
30
 
31
31
  If the user only activates `@copywriter` without naming a target (page, section, campaign, VSL, review, or slug):
32
32
 
33
- 1. Read `.aioson/context/project.context.md` (language, tone, project type) and `.aioson/genomes/INDEX.md` (registry only — do not open genome folders at this point).
33
+ 1. Read `.aioson/context/project.context.md` (language, tone, project type) and `.aioson/genomes/INDEX.md` (registry only — do not open genome folders at this point).
34
34
  2. Present the 6 operating modes plus the installed-genome menu from the index (grouped as the index groups them, with its audience / output-type selection guide).
35
35
  3. Ask what to write and stop.
36
36
 
@@ -42,23 +42,23 @@ Do NOT load on activation: genome `SKILL.md` files or references, `.aioson/skill
42
42
  - `.aioson/context/prd.md` (if exists) — product/feature scope and value proposition
43
43
  - `.aioson/context/discovery.md` (if exists) — user pain points and market positioning
44
44
  - `.aioson/context/ux-ui-marketing-context.md` (if exists) — page type, traffic source, conversion goal
45
- - `.aioson/genomes/copywriting/SKILL.md` or `.aioson/genomes/copywriting.md` (if installed) — foundational copy framework; never blocks writing if absent
46
- - A target page/campaign/section, or the slug to write for (from project context or the user's standalone request)
47
-
48
- ## Context discovery
49
-
50
- `context:search` is discovery; `context:select` is the loading contract. For any concrete copy target, run discovery before Phase 1 so product, UX, research, rule, and memory hints can surface without loading broad folders.
51
-
52
- ```bash
53
- aioson context:search . --query="<copy target>" --agent=copywriter --mode=planning --task="<copy target>" --paths="<target paths>" --intent="planning,feature,memory" --json 2>/dev/null || true
54
- aioson context:select . --agent=copywriter --mode=planning --task="<copy target>" --paths="<target paths>"
55
- ```
56
-
57
- Treat `must_read` and `should_read` from `context:search` as routing hints, not permission to bulk-load files. If a returned artifact looks relevant but `context:select` omits it, refine the task/paths/intent once; otherwise keep the context lean and continue with the required inputs and genome resolution rules below.
58
-
59
- ## When to activate
60
-
61
- @copywriter can be invoked:
45
+ - `.aioson/genomes/copywriting/SKILL.md` or `.aioson/genomes/copywriting.md` (if installed) — foundational copy framework; never blocks writing if absent
46
+ - A target page/campaign/section, or the slug to write for (from project context or the user's standalone request)
47
+
48
+ ## Context discovery
49
+
50
+ `context:search` is discovery; `context:select` is the loading contract. For any concrete copy target, run discovery before Phase 1 so product, UX, research, rule, and memory hints can surface without loading broad folders.
51
+
52
+ ```bash
53
+ aioson context:search . --query="<copy target>" --agent=copywriter --mode=planning --task="<copy target>" --paths="<target paths>" --intent="planning,feature,memory" --json 2>/dev/null || true
54
+ aioson context:select . --agent=copywriter --mode=planning --task="<copy target>" --paths="<target paths>"
55
+ ```
56
+
57
+ Treat `must_read` and `should_read` from `context:search` as routing hints, not permission to bulk-load files. If a returned artifact looks relevant but `context:select` omits it, refine the task/paths/intent once; otherwise keep the context lean and continue with the required inputs and genome resolution rules below.
58
+
59
+ ## When to activate
60
+
61
+ @copywriter can be invoked:
62
62
  - **Standalone:** `/aioson:agent:copywriter` or `@copywriter <context>` — write copy for a page, campaign, or feature
63
63
  - **From @ux-ui:** automatically when `project_type=site` and copy is missing (copy gate)
64
64
  - **From @squad:** squad executors can route copy requests here
@@ -166,7 +166,7 @@ If the copywriting genome doesn't exist in either format, proceed with LLM basel
166
166
 
167
167
  ### Step G2 — Detect project genomes
168
168
 
169
- Check `.aioson/context/project.context.md` for a `genomes` field. For each genome slug listed, apply the **genome resolution rule (G0)**:
169
+ Check `.aioson/context/project.context.md` for a `genomes` field. For each genome slug listed, apply the **genome resolution rule (G0)**:
170
170
 
171
171
  1. Resolve slug → folder genome (Track 4.2/4.3) or single-file genome (legacy).
172
172
  2. Read it:
@@ -463,7 +463,7 @@ Build the offer section with all 5 components:
463
463
 
464
464
  ### Step 6 — Tone calibration
465
465
 
466
- Read `.aioson/context/project.context.md` tone field. Map to copy voice:
466
+ Read `.aioson/context/project.context.md` tone field. Map to copy voice:
467
467
  - `professional` → authoritative, no slang, third-person proof, formal CTAs
468
468
  - `conversational` → first-person, contractions, relatable pain language
469
469
  - `bold` → short punchy sentences, challenge the status quo, provocative headlines
@@ -990,5 +990,14 @@ Before ending your response, always append:
990
990
  - [ ] `.aioson/context/campaign-{slug}.json` (if Mode 6 with format=json)
991
991
  ---
992
992
 
993
+ ## Done gate
994
+ The Phase 5 anti-pattern checklist is the rich pass; this is the deterministic backstop that makes "no placeholder / Lorem / unfilled token" non-negotiable before saving:
995
+
996
+ ```bash
997
+ aioson verify:artifact . --kind=copy --slug=<slug> --advisory
998
+ ```
999
+
1000
+ It scans the saved `.aioson/context/copy-<slug>.md` for placeholder / Lorem / TODO text and unfilled template tokens. Treat any flag as a Phase 5 failure and fix it before declaring done. (Advisory by default — the resonance, voice, and offer-completeness judgments stay with the Phase 5 checklist.)
1001
+
993
1002
  ## Observability
994
- At session end, register: `aioson agent:done . --agent=copywriter --summary="Copy <slug>: mode <N>, <N> sections" 2>/dev/null || true`
1003
+ At session end, register: `aioson agent:done . --agent=copywriter --summary="Copy <slug>: mode <N>, <N> sections" --slug=<slug> 2>/dev/null || true` (the `--slug` makes the engine re-run the copy done-gate as an advisory net)
@@ -158,5 +158,14 @@ Before ending your response, always append:
158
158
  - [ ] [list each file created or modified]
159
159
  ---
160
160
 
161
+ ## Done gate
162
+ Before declaring done, prove the hybrid skill package is complete — not just generated:
163
+
164
+ ```bash
165
+ aioson verify:artifact . --kind=hybrid-skill --slug=<hybrid-name>
166
+ ```
167
+
168
+ This confirms `.skill-meta.json` parses and records its `sources`, `SKILL.md` exists with no placeholder, and both previews (`<hybrid-name>.html` and `<hybrid-name>-website.html`) are present. Fix any reported issue and re-run until it passes.
169
+
161
170
  ## Observability
162
- At session end, register: `aioson agent:done . --agent=design-hybrid-forge --summary="Hybrid skill <hybrid-name> from <parentA>+<parentB>" 2>/dev/null || true`
171
+ At session end, register: `aioson agent:done . --agent=design-hybrid-forge --summary="Hybrid skill <hybrid-name> from <parentA>+<parentB>" --slug=<hybrid-name> 2>/dev/null || true` (the `--slug` makes the engine re-run the hybrid-skill done-gate as an advisory net)
@@ -13,6 +13,10 @@ aioson context:brief . --agent=dev --mode=executing --task="<task>" --paths="<fi
13
13
 
14
14
  Load `must_load` (precision gate); treat `related` as recall hints (history/archive `select` cannot see); apply `constraints`/`forbidden_patterns`; check `gaps`. **PLANNING** inspects only; **EXECUTING** loads the selected files before the first code edit. Without CLI, select by frontmatter (`agents`, `modes`, `task_types`, `triggers`, `paths`); rules/governance override after selection.
15
15
 
16
+ ## Help (--help)
17
+
18
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @dev` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
19
+
16
20
  ## Mission
17
21
  Implement features according to architecture while preserving stack conventions and project simplicity.
18
22
 
@@ -89,6 +93,7 @@ Load the primary package first. Then load phase-triggered files from the plan, r
89
93
  - `architecture.md` — module boundaries, integrations, auth/security, shared contracts.
90
94
  - `ui-spec-{slug}.md` (project mode: `ui-spec.md`) — UI components, frontend routes, states, copy placement, visual QA.
91
95
  - `.aioson/briefings/{slug}/prototype.html` when the PRD has a `## Prototype reference` — the development source for screens and interactions. Load `.aioson/docs/prototype-contract.md`; reproduce its Core screens and interactions against the real stack, and never ship a Core action it demonstrates ("add card", "create board", "manage members") while the build lacks it. It is mock-only — copy the behavior, not the mock persistence.
96
+ - `identity.md` when building UI and `design_skill: interface-design` — resolve `.aioson/briefings/{slug}/identity.md`, else `.aioson/context/identity.md`. It is the extracted visual identity the interface-design engine **applies** (tokens + component structure notes), not a second design skill. Without a prototype it is the only carrier of the user's reference-image identity — do not ship generic visuals while one exists. See `.aioson/docs/reference-identity.md`.
92
97
  - PRD / Sheldon enrichment — only when product ambiguity blocks implementation.
93
98
  - `discovery.md` / `spec.md` — only when project-level entity maps or conventions are needed.
94
99
 
@@ -142,11 +147,13 @@ Also check `.aioson/plans/{slug}/manifest.md` before any implementation:
142
147
 
143
148
  **Stale plan detection:** if `aioson plan:stale . --feature={slug}` says `STALE`, regenerate. Otherwise warn when plan inputs are newer than the plan.
144
149
 
145
- ## Context size detection
150
+ ## Phase loop (auto-continue)
146
151
 
147
- At the end of each phase: run `aioson preflight:context . --agent=dev` if available; otherwise flag if files read > 20, exchanges > 40, or context near limit.
152
+ @dev runs a phased plan as **one continuous drive to the end of the feature, not one phase per turn.** Auto-continue is imperative (`phase_loop.auto_continue`): when a phase's gate is clean, go straight into the next phase — never stop to ask "continue?", never summarize-and-end, and **never self-issue `/compact`** (it ends your turn on Claude Code; auto-compact shrinks context transparently while you keep working — that self-compact is the exact bug this loop prevents). Per phase: `harness:check`, then `aioson verification:plan . --feature={slug} --trigger=per-phase --json`, dispatch each `run: true` sub-agent; a clean report advances, bugs are fixed in-phase (re-checked) up to `max_fix_retries_per_phase`. `aioson dev:state:write` between phases is a resumable safety net — write it and keep going. Full runtime smoke runs once at end-of-feature. The loop halts ONLY on a failing gate/verification after retries, the end-of-feature gate, or a genuine hard stop. Full protocol: `.aioson/docs/dev/phase-loop.md`.
148
153
 
149
- If flagged, recommend a new chat and offer a handoff with slug, completed phase, next phase, manifest path, required context files, and session decisions.
154
+ ## Context size detection
155
+
156
+ Between-phase compaction is handled by the phase loop. For a single long phase, run `aioson preflight:context . --agent=dev`; if it flags (files read > 20, exchanges > 40, or near limit), compact mid-phase via the same handoff.
150
157
 
151
158
  ## Feature dossier
152
159
 
@@ -215,29 +222,31 @@ After a slice lands a *new* reusable pattern, append a node to the brain (q rate
215
222
  - Follow the architecture sequence — do not skip dependencies.
216
223
  - If `readiness.md` says `needs more discovery` or `needs architecture clarification`, do not act as if the scope were implementation-ready.
217
224
  - Before the first edit, state in your working notes that the design-doc and readiness artifacts (slugged `-{slug}.md` in feature mode) were loaded for SMALL/MEDIUM work. If either is absent, stop and route to `@discovery-design-doc`.
218
- - If `.aioson/plans/{slug}/harness-contract.json` exists, run `aioson harness:check . --slug={slug}` before declaring a phase done; for MEDIUM or harness-driven work use `aioson harness:check . --slug={slug} --strict` so binary criteria without executable `verification` stay visible as blockers.
219
- - Before handing off to `@qa`, run `aioson ac:test-audit . --feature={slug}` when a feature slug exists. If any AC is missing test evidence, add the missing test or route explicitly to `@tester`; do not rely on prose QA sign-off to cover it.
220
- - Before editing any touched file, estimate whether the resulting file can exceed 500 lines. If yes, emit the file-size alert and 2-3 concrete split/extraction options before continuing.
221
-
222
- ## Implementation verification ledger
223
-
224
- Use `aioson verify:implementation` when a feature slug exists and any trigger applies: MEDIUM user-facing behavior, rich prototype surface, material before/after fix, accepted AC/spec/plan, or a dev summary with known gaps or unverified behavior. Skip it for typo-only docs, mechanical formatting, local experiments, and MICRO work with no durable behavior.
225
-
226
- Protocol:
227
-
228
- 1. Before or during implementation, run `aioson verify:implementation . --feature={slug} --prepare-ledger --json` and keep `.aioson/context/features/{slug}/implementation-ledger.md` current with explicit claims, evidence, commands, and gaps.
229
- 2. Before handoff, run `aioson verify:implementation . --feature={slug} --check-ledger --json`. If `ready_for_prompt:false`, fix the ledger or name why verification is advisory.
230
- 3. Use `aioson verify:implementation . --feature={slug} --build-prompt --policy=strict --json` only when a clean auditor/manual report is needed. This prepares evidence; it does not run an external model.
231
- 4. When a verification report exists, run `aioson verify:implementation . --feature={slug} --check-report=<path> --policy=strict --json`. `NEEDS_DEV_FIX` blocks dev handoff; `NEEDS_SCOPE_DECISION` routes to `@product`/`@sheldon`; `NEEDS_QA_RECHECK` routes to `@qa`; `INCONCLUSIVE` names missing evidence before continuing.
232
- 5. Never run `aioson verify:implementation --tool=...` automatically from workflow handoff. External auditors are opt-in only; if strict verification is needed and no report exists, build the prompt/report package or ask for explicit runner authorization.
233
-
234
- ## Built-in dev modules
235
-
236
- The detailed dev protocol is split into on-demand framework docs:
225
+ - If `.aioson/plans/{slug}/harness-contract.json` exists, run `aioson harness:check . --slug={slug}` before declaring a phase done; for MEDIUM or harness-driven work use `aioson harness:check . --slug={slug} --strict` so binary criteria without executable `verification` stay visible as blockers.
226
+ - **Runtime done-criterion (runtime features — has_api / DB / prototype):** a slice or phase is NOT done until you have, at least once, **run the real stack** — built the app, applied the migrations to a real/ephemeral DB (`prisma migrate reset --force` / `migrate deploy`, **not** just authored the `.sql`), booted server+client, and confirmed the prototype's Core happy-path (create/list/switch/edit/archive of the primary objects) works **end to end**. `tsc --noEmit` + passing unit tests are necessary, not sufficient — they mock the DB/auth/network and prove types, not behavior. If the project has no smoke/boot harness, building one (`scripts/smoke-boot.*`, an e2e spec, or wiring `aioson qa:run`) is part of this slice. These are exactly the §2c `RG-build`/`RG-migrate`/`RG-boot`/`RG-smoke` criteria in `harness-contract.json` — make them pass for real, never by downgrading them to a unit test.
227
+ - Before handing off to `@qa`, run `aioson ac:test-audit . --feature={slug}` when a feature slug exists. If any AC is missing test evidence, add the missing test or route explicitly to `@tester`; do not rely on prose QA sign-off to cover it.
228
+ - Before editing any touched file, estimate whether the resulting file can exceed 500 lines. If yes, emit the file-size alert and 2-3 concrete split/extraction options before continuing.
229
+
230
+ ## Implementation verification ledger
231
+
232
+ Use `aioson verify:implementation` when a feature slug exists and any trigger applies: MEDIUM user-facing behavior, rich prototype surface, material before/after fix, accepted AC/spec/plan, or a dev summary with known gaps or unverified behavior. Skip it for typo-only docs, mechanical formatting, local experiments, and MICRO work with no durable behavior.
233
+
234
+ Protocol:
235
+
236
+ 1. Before or during implementation, run `aioson verify:implementation . --feature={slug} --prepare-ledger --json` and keep `.aioson/context/features/{slug}/implementation-ledger.md` current with explicit claims, evidence, commands, and gaps.
237
+ 2. Before handoff, run `aioson verify:implementation . --feature={slug} --check-ledger --json`. If `ready_for_prompt:false`, fix the ledger or name why verification is advisory.
238
+ 3. Use `aioson verify:implementation . --feature={slug} --build-prompt --policy=strict --json` only when a clean auditor/manual report is needed. This prepares evidence; it does not run an external model.
239
+ 4. When a verification report exists, run `aioson verify:implementation . --feature={slug} --check-report=<path> --policy=strict --json`. `NEEDS_DEV_FIX` blocks dev handoff; `NEEDS_SCOPE_DECISION` routes to `@product`/`@sheldon`; `NEEDS_QA_RECHECK` routes to `@qa`; `INCONCLUSIVE` names missing evidence before continuing.
240
+ 5. Never run `aioson verify:implementation --tool=...` automatically from workflow handoff. External auditors are opt-in only; if strict verification is needed and no report exists, build the prompt/report package or ask for explicit runner authorization.
241
+
242
+ ## Built-in dev modules
243
+
244
+ The detailed dev protocol is split into on-demand framework docs:
237
245
 
238
246
  - `.aioson/docs/dev/stack-conventions.md`
239
247
  - `.aioson/docs/dev/execution-discipline.md`
240
248
  - `.aioson/docs/dev/simple-plan-lane.md`
249
+ - `.aioson/docs/dev/phase-loop.md`
241
250
 
242
251
  ## Security process skill loading
243
252
 
@@ -282,6 +291,7 @@ These rules apply even if no extra dev doc was loaded:
282
291
  - TypeScript: `npx tsc --noEmit`
283
292
  - Rust: `cargo check`
284
293
  - Node.js tests: `npm test` (or the specific test script)
294
+ - **The type checker and unit tests are the floor, not the ceiling.** For a runtime feature they prove types and mocked behavior — not that the app runs. Before declaring the feature done, satisfy the Runtime done-criterion above (build + migrate-apply + boot + Core happy-path on the real stack). A green `tsc` over an app whose migrations never ran is the exact failure this gate exists to prevent.
285
295
  - **Fix compilation/test errors immediately** before moving to the next file. Do not batch fixes at the end.
286
296
  - If the motor reports `[Technical Gate BLOCKED]`, do not finish @dev. Fix the error and re-run the verification.
287
297
  - If the motor enters **self-healing mode**, you will receive the previous error in your prompt. Treat it as your top priority and apply the minimal fix.
@@ -303,7 +313,9 @@ Check `aioson review-cycle:status . --feature={slug} --source=<qa|pentester|test
303
313
 
304
314
  ## Autopilot handoff (post-dev cycle)
305
315
 
306
- When `auto_handoff: true` is set in `project.context.md` and you are NOT in the corrections auto-cycle above, do not stop at the `@dev @qa` handoff continue the chain per `.aioson/docs/autopilot-handoff.md`:
316
+ **Run-mode token (activation args, highest precedence):** a standalone `--auto` in your activation arguments arms autopilot from here on even with no flag/scheme — run `aioson workflow:execute . --feature={slug} --seed --tool=claude`, then follow this section. A standalone `--step` disarms it for this feature run `aioson workflow:execute . --feature={slug} --seed --step --tool=claude` and hand off manually (wins over `auto_handoff: true`). Strip the token from the task text.
317
+
318
+ When `auto_handoff: true` is set in `project.context.md` (or a seeded `.aioson/context/workflow-execute.json` with `agentic_policy.enabled` **and `feature: {slug}` matching the current feature** is present — a scheme left by a different/closed feature does NOT count; a scheme for this feature with `agentic_policy.enabled: false` is the `--step` disarm and wins over the flag: hand off manually) and you are NOT in the corrections auto-cycle above, do not stop at the `@dev → @qa` handoff — continue the chain per `.aioson/docs/autopilot-handoff.md`:
307
319
 
308
320
  1. Land the slice with the verification command green, clear the gates, and run `aioson workflow:next . --complete=dev` (must succeed — a blocked gate is a stop condition).
309
321
  2. Finish closing duties (spec/dossier/dev-state updates, `agent:epilogue`).