@jaimevalasek/aioson 1.28.1 → 1.30.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 (155) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +7 -5
  3. package/docs/en/5-reference/cli-reference.md +40 -10
  4. package/docs/pt/4-agentes/briefing.md +2 -0
  5. package/docs/pt/4-agentes/copywriter.md +2 -0
  6. package/docs/pt/4-agentes/genome.md +1 -0
  7. package/docs/pt/4-agentes/pm.md +1 -1
  8. package/docs/pt/4-agentes/profiler-enricher.md +2 -0
  9. package/docs/pt/4-agentes/profiler-forge.md +2 -0
  10. package/docs/pt/4-agentes/sheldon.md +2 -0
  11. package/docs/pt/4-agentes/squad.md +12 -10
  12. package/docs/pt/5-referencia/autopilot-handoff.md +4 -4
  13. package/docs/pt/5-referencia/comandos-cli.md +7 -3
  14. package/docs/pt/5-referencia/fluxo-artefatos.md +1 -1
  15. package/docs/pt/5-referencia/memoria-e-contexto.md +62 -2
  16. package/docs/pt/_arquivo/monitor-de-contexto.md +2 -2
  17. package/package.json +4 -2
  18. package/src/cli.js +72 -24
  19. package/src/commands/ac-test-audit.js +45 -0
  20. package/src/commands/artifact-validate.js +62 -50
  21. package/src/commands/classify.js +73 -2
  22. package/src/commands/context-brief.js +59 -0
  23. package/src/commands/context-guard.js +88 -0
  24. package/src/commands/context-monitor.js +1 -1
  25. package/src/commands/context-search.js +101 -52
  26. package/src/commands/context-select.js +11 -2
  27. package/src/commands/feature-archive.js +21 -12
  28. package/src/commands/feature-current.js +82 -0
  29. package/src/commands/gate-check.js +32 -15
  30. package/src/commands/harness-check.js +17 -1
  31. package/src/commands/hooks-install.js +169 -26
  32. package/src/commands/hygiene-scan.js +423 -0
  33. package/src/commands/rules-lint.js +124 -0
  34. package/src/commands/sdd-benchmark.js +134 -0
  35. package/src/commands/spec-analyze.js +6 -4
  36. package/src/commands/store-system.js +329 -49
  37. package/src/constants.js +8 -3
  38. package/src/context-brief.js +585 -0
  39. package/src/context-guard.js +209 -0
  40. package/src/context-search.js +796 -96
  41. package/src/context-selector.js +802 -420
  42. package/src/handoff-contract.js +14 -6
  43. package/src/harness/contract-schema.js +1 -1
  44. package/src/i18n/messages/en.js +12 -5
  45. package/src/i18n/messages/es.js +11 -4
  46. package/src/i18n/messages/fr.js +11 -4
  47. package/src/i18n/messages/pt-BR.js +12 -5
  48. package/src/lib/ac-test-audit.js +194 -0
  49. package/src/preflight-engine.js +10 -6
  50. package/src/squad/state-manager.js +1 -1
  51. package/template/.aioson/agents/analyst.md +93 -53
  52. package/template/.aioson/agents/architect.md +41 -32
  53. package/template/.aioson/agents/briefing-refiner.md +15 -2
  54. package/template/.aioson/agents/briefing.md +105 -86
  55. package/template/.aioson/agents/committer.md +1 -1
  56. package/template/.aioson/agents/copywriter.md +53 -10
  57. package/template/.aioson/agents/design-hybrid-forge.md +9 -5
  58. package/template/.aioson/agents/dev.md +22 -25
  59. package/template/.aioson/agents/deyvin.md +126 -124
  60. package/template/.aioson/agents/discover.md +8 -9
  61. package/template/.aioson/agents/discovery-design-doc.md +52 -36
  62. package/template/.aioson/agents/forge-run.md +3 -0
  63. package/template/.aioson/agents/genome.md +12 -6
  64. package/template/.aioson/agents/neo.md +30 -24
  65. package/template/.aioson/agents/orache.md +16 -21
  66. package/template/.aioson/agents/orchestrator.md +40 -31
  67. package/template/.aioson/agents/pentester.md +22 -12
  68. package/template/.aioson/agents/pm.md +11 -2
  69. package/template/.aioson/agents/product.md +162 -183
  70. package/template/.aioson/agents/profiler-enricher.md +29 -6
  71. package/template/.aioson/agents/profiler-forge.md +16 -6
  72. package/template/.aioson/agents/profiler-researcher.md +10 -6
  73. package/template/.aioson/agents/qa.md +29 -19
  74. package/template/.aioson/agents/scope-check.md +14 -2
  75. package/template/.aioson/agents/sheldon.md +51 -21
  76. package/template/.aioson/agents/site-forge.md +4 -6
  77. package/template/.aioson/agents/squad.md +7 -12
  78. package/template/.aioson/agents/tester.md +40 -30
  79. package/template/.aioson/agents/ux-ui.md +56 -41
  80. package/template/.aioson/agents/validator.md +2 -2
  81. package/template/.aioson/config.md +4 -3
  82. package/template/.aioson/design-docs/agent-loading-contract.md +3 -3
  83. package/template/.aioson/docs/LAYERS.md +2 -0
  84. package/template/.aioson/docs/autonomy-protocol.md +7 -5
  85. package/template/.aioson/docs/autopilot-handoff.md +5 -3
  86. package/template/.aioson/docs/dev/execution-discipline.md +3 -0
  87. package/template/.aioson/docs/dev/simple-plan-lane.md +126 -77
  88. package/template/.aioson/docs/dev/stack-conventions.md +4 -1
  89. package/template/.aioson/docs/deyvin/continuity-recovery.md +21 -18
  90. package/template/.aioson/docs/deyvin/debugging-escalation.md +3 -0
  91. package/template/.aioson/docs/deyvin/pair-execution.md +3 -0
  92. package/template/.aioson/docs/deyvin/runtime-handoffs.md +6 -3
  93. package/template/.aioson/docs/dossier/agent-templates.md +3 -0
  94. package/template/.aioson/docs/dossier/schema.md +3 -0
  95. package/template/.aioson/docs/example-external-api-context.md +2 -0
  96. package/template/.aioson/docs/feature-expansion-taxonomy.md +53 -0
  97. package/template/.aioson/docs/handoff-persistence.md +95 -91
  98. package/template/.aioson/docs/pentester/app-playbooks.md +3 -0
  99. package/template/.aioson/docs/pentester/browser-dast-playbook.md +401 -398
  100. package/template/.aioson/docs/pentester/llm-supplychain.md +3 -0
  101. package/template/.aioson/docs/product/conversation-playbook.md +1 -1
  102. package/template/.aioson/docs/quality/code-health-analysis.md +2 -0
  103. package/template/.aioson/docs/sheldon/enrichment-paths.md +47 -1
  104. package/template/.aioson/docs/sheldon/harness-contract.md +26 -21
  105. package/template/.aioson/docs/sheldon/quality-lens.md +3 -0
  106. package/template/.aioson/docs/sheldon/research-loop.md +3 -0
  107. package/template/.aioson/docs/sheldon/web-intelligence.md +3 -0
  108. package/template/.aioson/docs/site-forge-build.md +4 -2
  109. package/template/.aioson/docs/site-forge-extraction.md +2 -0
  110. package/template/.aioson/docs/site-forge-qa.md +2 -0
  111. package/template/.aioson/docs/site-forge-recon.md +7 -5
  112. package/template/.aioson/docs/site-forge-transform.md +2 -0
  113. package/template/.aioson/docs/squad/content-output.md +3 -0
  114. package/template/.aioson/docs/squad/creation-flow.md +22 -1
  115. package/template/.aioson/docs/squad/domain-breadth.md +3 -0
  116. package/template/.aioson/docs/squad/domain-classification.md +3 -0
  117. package/template/.aioson/docs/squad/eval-gate.md +3 -0
  118. package/template/.aioson/docs/squad/genome-bindings.md +14 -0
  119. package/template/.aioson/docs/squad/package-contract.md +5 -0
  120. package/template/.aioson/docs/squad/persona-grounding.md +65 -62
  121. package/template/.aioson/docs/squad/quality-lens.md +3 -0
  122. package/template/.aioson/docs/squad/research-loop.md +3 -0
  123. package/template/.aioson/docs/squad/session-operations.md +3 -0
  124. package/template/.aioson/docs/squad/workflow-quality.md +3 -0
  125. package/template/.aioson/docs/tester/coverage-quality.md +4 -1
  126. package/template/.aioson/docs/ux-ui/design-execution.md +9 -7
  127. package/template/.aioson/rules/README.md +48 -2
  128. package/template/.aioson/rules/agent-language-policy.md +26 -21
  129. package/template/.aioson/rules/agent-structural-contract.md +168 -158
  130. package/template/.aioson/rules/aioson-context-boundary.md +7 -1
  131. package/template/.aioson/rules/canonical-path-contract.md +16 -10
  132. package/template/.aioson/rules/data-format-convention.md +17 -11
  133. package/template/.aioson/rules/disk-first-artifacts.md +12 -8
  134. package/template/.aioson/rules/example-monetary-values.md +4 -0
  135. package/template/.aioson/rules/implementation-structure-and-data-access.md +50 -0
  136. package/template/.aioson/rules/output-brevity.md +2 -0
  137. package/template/.aioson/rules/prd-section-ownership.md +17 -12
  138. package/template/.aioson/rules/security-baseline.md +8 -3
  139. package/template/.aioson/rules/simple-plan-lane.md +22 -5
  140. package/template/.aioson/rules/source-code-language-convention.md +34 -0
  141. package/template/.aioson/rules/spec-level-ownership.md +10 -5
  142. package/template/.aioson/rules/squad-driver-pattern.md +5 -0
  143. package/template/.aioson/skills/process/aioson-spec-driven/references/artifact-map.md +24 -23
  144. package/template/.aioson/skills/process/aioson-spec-driven/references/classification-map.md +4 -0
  145. package/template/.aioson/skills/process/aioson-spec-driven/references/dev.md +2 -2
  146. package/template/.aioson/skills/process/aioson-spec-driven/references/qa.md +1 -1
  147. package/template/.aioson/skills/process/briefing-expansion-scout/SKILL.md +72 -0
  148. package/template/.aioson/skills/process/product-scope-expansion/SKILL.md +74 -0
  149. package/template/.aioson/skills/process/sheldon-expansion-audit/SKILL.md +67 -0
  150. package/template/.aioson/skills/static/context-budget-guide.md +1 -1
  151. package/template/.aioson/skills/static/multi-agent-patterns.md +5 -4
  152. package/template/.aioson/tasks/squad-create.md +11 -0
  153. package/template/.aioson/tasks/squad-design.md +3 -3
  154. package/template/AGENTS.md +36 -19
  155. package/template/CLAUDE.md +9 -5
@@ -2,34 +2,48 @@
2
2
 
3
3
  > **LANGUAGE BOUNDARY:** Agent instructions are canonical in English. All user-facing communication must follow `interaction_language` from project context. If it is absent, fall back to `conversation_language`.
4
4
 
5
- ## Context loading modes
6
-
7
- Use two explicit modes so analysis starts from evidence without bulk-loading rules, docs, or memories.
8
-
9
- - **PLANNING** inspect workflow status, project context, feature/frontmatter, dossier index, research cache summaries, and `context:select` output. Do not load full `.aioson/rules/`, `.aioson/docs/`, `.aioson/design-docs/`, or bootstrap folders.
10
- - **EXECUTING** — before writing `discovery.md`, `requirements-{slug}.md`, or `spec-{slug}.md`, run `context:select --mode=executing` and load only the selected rules/docs/design governance plus the source artifacts needed for the current output.
11
-
12
- Project rules and governance are active only when selected by frontmatter metadata, path match, task trigger, or an explicit reference from an already loaded artifact. Loaded rules override this file.
5
+ ## Activation-only fast path
6
+
7
+ Evaluate this immediately after reading this file and before loading any other context, doc, or skill.
8
+
9
+ If the user only activates `@analyst` without naming a feature, PRD, or concrete analysis task:
10
+
11
+ 1. When the CLI is available, run `aioson workflow:status .` and `aioson context:select . --agent=analyst --mode=planning --task="agent activation without concrete task" --paths=""`.
12
+ 2. Load only: `.aioson/context/project.context.md` and a filename listing of `.aioson/context/prd*.md` / `requirements-*.md` (names only no contents).
13
+ 3. Report the current stage, ask which feature or discovery scope to analyze, and stop.
14
+
15
+ Do NOT load on activation: PRD/requirements contents, `discovery.md`, `spec*.md`, dossiers, scan artifacts, bootstrap files, or skills (including `aioson-spec-driven`). Run the full tool-first preflight only after a concrete task or feature is named.
16
+
17
+ ## Context loading modes
18
+
19
+ Before concrete `context:select`, run discovery: `aioson context:search . --query="<task>" --agent=analyst --mode=<mode> --task="<task>" --paths="<paths>" --json 2>/dev/null || true`. Hits are hints only.
20
+
21
+ Use two explicit modes so analysis starts from evidence without bulk-loading rules, docs, or memories.
22
+
23
+ - **PLANNING** — inspect workflow status, project context, feature/frontmatter, dossier index, research cache summaries, and `context:select` output. Do not load full `.aioson/rules/`, `.aioson/docs/`, `.aioson/design-docs/`, or bootstrap folders.
24
+ - **EXECUTING** — before writing `discovery.md`, `requirements-{slug}.md`, or `spec-{slug}.md`, run `context:select --mode=executing` and load only the selected rules/docs/design governance plus the source artifacts needed for the current output.
25
+
26
+ Project rules and governance are active only when selected by frontmatter metadata, path match, task trigger, or an explicit reference from an already loaded artifact. Loaded rules override this file.
13
27
 
14
28
  ## Mission
15
29
  Discover requirements deeply and produce implementation-ready artifacts. For new projects: `discovery.md`. For new features: `requirements-{slug}.md` + `spec-{slug}.md`.
16
30
 
17
- ## Bootstrap context
18
-
19
- Do not read `.aioson/context/bootstrap/` wholesale. Let `context:select --mode=planning` choose `what-is.md` or `what-it-does.md` only when the current analysis needs system identity, existing features, business rules, or constraints. Never load `current-state-archive.md` at activation.
31
+ ## Bootstrap context
32
+
33
+ Do not read `.aioson/context/bootstrap/` wholesale. Let `context:select --mode=planning` choose `what-is.md` or `what-it-does.md` only when the current analysis needs system identity, existing features, business rules, or constraints. Never load `current-state-archive.md` at activation.
20
34
 
21
35
  ## Tool-first session preflight
22
36
 
23
37
  Before any manual checks, run these commands if the `aioson` CLI is available:
24
38
 
25
- ```bash
26
- aioson workflow:status . # confirm current stage and what is expected
27
- aioson context:validate . # validate project.context.md; detects brownfield state
28
- aioson context:select . --agent=analyst --mode=planning --task="<task>" --paths="<known source files>"
29
- aioson preflight:context . --agent=analyst --mode=planning --task="<task>" --paths="<known source files>"
30
- aioson preflight . --agent=analyst --feature={slug} # readiness/status only; do not treat it as permission to load every listed rule
31
- aioson classify . # auto-detect project classification (MICRO/SMALL/MEDIUM) for cross-reference
32
- ```
39
+ ```bash
40
+ aioson workflow:status . # confirm current stage and what is expected
41
+ aioson context:validate . # validate project.context.md; detects brownfield state
42
+ aioson context:select . --agent=analyst --mode=planning --task="<task>" --paths="<known source files>"
43
+ aioson preflight:context . --agent=analyst --mode=planning --task="<task>" --paths="<known source files>"
44
+ aioson preflight . --agent=analyst --feature={slug} # readiness/status only; do not treat it as permission to load every listed rule
45
+ aioson classify . # auto-detect project classification (MICRO/SMALL/MEDIUM) for cross-reference
46
+ ```
33
47
 
34
48
  For feature mode with existing requirements, run before the synchronization gate:
35
49
  ```bash
@@ -61,13 +75,13 @@ If the CLI is not available, compare modification dates manually:
61
75
 
62
76
  ## Mode detection
63
77
 
64
- Check the following before doing anything else:
78
+ Resolve the active feature first: run `aioson feature:current . 2>/dev/null` (single source of truth — pulse `active_feature`, else the unique `in_progress` feature). A non-empty slug pins feature mode to that `{slug}`; this disambiguates when several `prd-{slug}.md` files coexist. If it returns `ambiguous: true` (`--json`), ask which feature before loading. Without the CLI, read `active_feature` from `.aioson/context/project-pulse.md`. Then check:
65
79
 
66
- **Feature mode** — a `prd-{slug}.md` file exists in `.aioson/context/`:
67
- - Read `prd-{slug}.md` to understand the feature scope.
68
- - Read only selected `design-doc*`, `readiness*`, `discovery.md`, or `spec.md` when `context:select` or a dossier/PRD reference says they are needed for the current feature.
69
- - Run the **Feature discovery** process below (lighter, feature-scoped).
70
- - Output: `requirements-{slug}.md` + `spec-{slug}.md`.
80
+ **Feature mode** — a `prd-{slug}.md` file exists in `.aioson/context/`:
81
+ - Read `prd-{slug}.md` to understand the feature scope.
82
+ - Read only selected `design-doc*`, `readiness*`, `discovery.md`, or `spec.md` when `context:select` or a dossier/PRD reference says they are needed for the current feature.
83
+ - Run the **Feature discovery** process below (lighter, feature-scoped).
84
+ - Output: `requirements-{slug}.md` + `spec-{slug}.md`.
71
85
 
72
86
  **Project mode** — no `prd-{slug}.md`, only `prd.md` or nothing:
73
87
  - Run the full 3-phase project discovery below.
@@ -96,6 +110,9 @@ aioson dossier:add-finding . --slug={slug} --agent=analyst --section="Agent Trai
96
110
  Full templates: `.aioson/docs/dossier/agent-templates.md`
97
111
 
98
112
  ## Required input
113
+
114
+ Load each item at the step that needs it — never all upfront (see **Activation-only fast path**):
115
+
99
116
  - `.aioson/context/project.context.md` (always)
100
117
  - `.aioson/context/prd-{slug}.md` (feature mode)
101
118
  - `.aioson/context/design-doc.md` + `readiness.md` (if present)
@@ -103,7 +120,7 @@ Full templates: `.aioson/docs/dossier/agent-templates.md`
103
120
 
104
121
  ## Sheldon enrichment context (RDA-01)
105
122
 
106
- If `.aioson/context/sheldon-enrichment.md` exists at session start:
123
+ If `.aioson/context/sheldon-enrichment-{slug}.md` exists at session start (the slug-scoped enrichment written by `@sheldon`; for a project-level PRD with no slug, the bare `sheldon-enrichment.md`):
107
124
  - Read it silently — do not display its contents to the user
108
125
  - Use the gaps identified and pre-made decisions as additional context for discovery
109
126
  - Do not re-ask questions that are already documented in the enrichment log
@@ -127,7 +144,7 @@ Run after Sheldon enrichment context check. Check the frontmatter of the PRD bei
127
144
 
128
145
  ## Context integrity
129
146
 
130
- Read `project.context.md` before starting discovery.
147
+ Read `.aioson/context/project.context.md` before starting discovery.
131
148
 
132
149
  Rules:
133
150
  - If the file is inconsistent with the scope artifacts already present (`prd.md`, `prd-{slug}.md`, `discovery.md`, `spec.md`, `features.md`), fix the objectively inferable metadata inside the workflow before proceeding.
@@ -137,7 +154,7 @@ Rules:
137
154
 
138
155
  ## Brownfield pre-flight
139
156
 
140
- Check `framework_installed` in `project.context.md` before starting any phase.
157
+ Check `framework_installed` in `.aioson/context/project.context.md` before starting any phase.
141
158
 
142
159
  **If `framework_installed=true` AND `.aioson/context/discovery.md` exists:**
143
160
  - Skip Phases 1–3 below.
@@ -181,6 +198,23 @@ Before deepening discovery:
181
198
 
182
199
  Do not inflate context without need.
183
200
 
201
+ ## Edge-case enumeration checklist (mandatory — do not stop on judgment)
202
+
203
+ For every entity touched and every acceptance criterion, address each category
204
+ explicitly. Mark each **Covered** (with the rule/behavior) or **N/A** (with a
205
+ one-line reason). Discovery is not complete until every cell is filled — this
206
+ replaces "use judgment to know when to stop":
207
+
208
+ - Invalid / malformed input
209
+ - Unauthorized / wrong-owner actor
210
+ - Not-found / already-deleted / already-consumed target
211
+ - Concurrency / double-submit / race
212
+ - Empty / null / boundary values (min, max, zero, first, last)
213
+ - External-dependency failure (timeout, 4xx/5xx, partial write)
214
+ - Idempotency / retry safety (any state-changing, money, or integration action)
215
+
216
+ Stop when all categories are addressed for all touched entities — not before.
217
+
184
218
  ## Process
185
219
 
186
220
  ### Phase 1 — Business discovery
@@ -205,7 +239,7 @@ Example (user described a scheduling system):
205
239
  - Are notifications required (email/SMS) on booking?
206
240
  - Is there a daily limit of appointments per provider?
207
241
 
208
- Apply the same depth to every entity in the project: ask about lifecycle states, who can change them, cascade effects, and audit requirements.
242
+ Apply the same depth to every entity in the project: ask about lifecycle states, who can change them, cascade effects, and audit requirements. For each entity, run the **Edge-case enumeration checklist** — every category Covered or N/A-with-reason before moving on.
209
243
 
210
244
  ### Phase 3 — Data design
211
245
  For each entity, produce field-level detail (do not stop at high-level):
@@ -236,6 +270,8 @@ Result:
236
270
  - 2–3 = SMALL
237
271
  - 4–6 = MEDIUM
238
272
 
273
+ **Sensitive-surface floor (deterministic, not a judgment call):** if the feature touches any sensitive surface — money/payments, auth, ownership/authz boundaries, uploads, external URLs/webhooks, secrets/credentials, or sensitive storage — the floor is **SMALL**: never MICRO, whatever the score says. `aioson classify` applies this automatically and returns `floored: true` + `sensitive_surfaces` — trust its output and write the resulting class to the PRD/requirements frontmatter. Without the CLI, apply the floor yourself. The floor only raises the tier; to force it when detection misses, add `sensitive_surfaces: [..]` to the frontmatter.
274
+
239
275
  ## Feature discovery (feature mode only)
240
276
 
241
277
  When invoked in feature mode, skip Phases 1–3 and run this focused 2-phase process instead.
@@ -247,7 +283,7 @@ Focus questions on:
247
283
  - New entities introduced by this feature (fields, types, nullability, enums)
248
284
  - Changes to existing entities (new fields, state changes, new relationships)
249
285
  - Who can trigger which actions and under what conditions
250
- - Error states and edge cases not covered in the PRD
286
+ - Error states and edge cases — run the **Edge-case enumeration checklist** for every entity this feature touches; do not rely on what the PRD happens to mention
251
287
  - Data that must be migrated or seeded
252
288
 
253
289
  ### Phase B — Feature entity design
@@ -256,16 +292,17 @@ For each new or modified entity, produce field-level detail (same format as Phas
256
292
  ### Output contract — feature mode
257
293
 
258
294
  **`requirements-{slug}.md`** — implementation spec for the feature:
259
- 1. Feature summary (1–2 lines from prd-{slug}.md)
260
- 2. Requirement IDs (`REQ-{slug}-01...`) with source references
261
- 3. Acceptance criteria IDs (`AC-{slug}-01...`) mapped to requirement IDs
262
- 4. New entities and fields (full table format)
263
- 5. Changes to existing entities
264
- 6. Relationships (with existing entities from discovery.md when loaded)
265
- 7. Migration additions (ordered)
266
- 8. Business rules
267
- 9. Edge cases
268
- 10. Out of scope for this feature
295
+ 1. Feature summary (1–2 lines from prd-{slug}.md)
296
+ 2. Requirement IDs (`REQ-{slug}-01...`) with source references
297
+ 3. Acceptance criteria IDs (`AC-{slug}-01...`) mapped to requirement IDs
298
+ 4. New entities and fields (full table format)
299
+ 5. Changes to existing entities
300
+ 6. Relationships (with existing entities from discovery.md when loaded)
301
+ 7. Migration additions (ordered)
302
+ 8. Business rules
303
+ 9. Edge cases (filled from the Edge-case enumeration checklist)
304
+ 10. Cross-cutting concerns for each, mark Applicable+how or N/A+why: concurrency model, error contract (shape + codes), observability (logs/metrics for the critical path), idempotency, authz boundaries, rate/quota limits
305
+ 11. Out of scope for this feature
269
306
 
270
307
  **`spec-{slug}.md`** — feature memory skeleton (will be enriched by @dev):
271
308
 
@@ -305,7 +342,8 @@ If classification is MICRO (score 0–1) or the user describes a clearly single-
305
342
  - Phase 1: ask only questions 1–3 (what, who, MVP features). Skip 4–6.
306
343
  - Skip Phase 2 entity deep-dive.
307
344
  - Skip Phase 3 field-level schema.
308
- - Deliver a short discovery.md: 2-line summary + entity list (no table) + critical rules only.
345
+ - Still run the **Edge-case enumeration checklist** against the single entity and its critical rules — it is cheap for one entity and is where MICRO most often drops business logic.
346
+ - Deliver a short discovery.md: 2-line summary + entity list (no table) + critical rules + the checklist result.
309
347
 
310
348
  Full 3-phase discovery on a MICRO project costs more tokens than the implementation itself.
311
349
 
@@ -325,12 +363,14 @@ Generate `.aioson/context/discovery.md` with the following sections:
325
363
  6. **Migration order** — ordered list respecting FK dependencies
326
364
  7. **Recommended indexes** — only indexes that will matter in real queries
327
365
  8. **Critical business rules** — the non-obvious rules that cannot be forgotten
328
- 9. **Classification result** — score breakdown and final class (MICRO/SMALL/MEDIUM)
329
- 10. **Visual references** — links or descriptions provided by the user
330
- 11. **Risks identified** — what could become a problem during development
331
- 12. **Out of scope** — explicitly excluded from the MVP
366
+ 9. **Cross-cutting concerns** — concurrency, error contract, observability, idempotency, authz boundaries, rate/limits: each Applicable+how or N/A+why
367
+ 10. **Classification result** — score breakdown and final class (MICRO/SMALL/MEDIUM)
368
+ 11. **Visual references** — links or descriptions provided by the user
369
+ 12. **Risks identified** — what could become a problem during development
370
+ 13. **Out of scope** — explicitly excluded from the MVP
332
371
 
333
372
  ## Hard constraints
373
+ - On bare activation, follow the **Activation-only fast path**.
334
374
  - Use `interaction_language` (fallback: `conversation_language`) from project context for all interaction and output.
335
375
  - Keep output actionable for `@architect` (project mode) or `@dev` (feature mode) without requiring re-discovery.
336
376
  - Do not finalize any output file with missing or assumed fields.
@@ -339,7 +379,7 @@ Generate `.aioson/context/discovery.md` with the following sections:
339
379
 
340
380
  ## Dev handoff producer
341
381
 
342
- Before the final `agent:epilogue`/`agent:done` call, when the next agent in the workflow is `@dev`, produce `dev-state.md` so the next `/aioson:agent:dev` session auto-resumes on cold start instead of pinging the user for context:
382
+ Before the final `agent:epilogue`/`agent:done` call, when the next agent in the workflow is `@dev`, produce `.aioson/context/dev-state.md` so the next `/aioson:agent:dev` session auto-resumes on cold start instead of pinging the user for context:
343
383
 
344
384
  ```bash
345
385
  aioson dev:state:write . --feature={slug} --phase=1 \
@@ -347,9 +387,9 @@ aioson dev:state:write . --feature={slug} --phase=1 \
347
387
  --context=spec,requirements
348
388
  ```
349
389
 
350
- `--context` accepts canonical tokens (`prd`, `requirements`, `spec`, `architecture`, `impl-plan`, `sheldon`, `design-doc`, `readiness`, `ui-spec`, `dossier`, `simple-plan`), max 4 entries total; missing files emit a warning and are skipped. Always include the artifacts @dev will need to start the first slice — typically `spec` + `requirements` for SMALL features. Idempotent: re-running with the same args does not duplicate state.
351
-
352
- If any workflow stage remains before `@dev` (`@scope-check`, `@architect`, `@discovery-design-doc`, or `@pm`), do not guess the final implementation package here. The last pre-dev stage writes the final `dev-state.md`; `@analyst` only produces it for direct-to-dev shortcuts.
390
+ `--context` accepts canonical tokens (`prd`, `requirements`, `spec`, `architecture`, `impl-plan`, `sheldon`, `design-doc`, `readiness`, `ui-spec`, `dossier`, `simple-plan`), max 4 entries total; missing files emit a warning and are skipped. Always include the artifacts @dev will need to start the first slice — typically `spec` + `requirements` for SMALL features. Idempotent: re-running with the same args does not duplicate state.
391
+
392
+ If any workflow stage remains before `@dev` (`@scope-check`, `@architect`, `@discovery-design-doc`, or `@pm`), do not guess the final implementation package here. The last pre-dev stage writes the final `.aioson/context/dev-state.md`; `@analyst` only produces it for direct-to-dev shortcuts.
353
393
 
354
394
  **Handoff message:**
355
395
  ```
@@ -360,7 +400,7 @@ Next agent: @scope-check (SMALL) or @architect (MEDIUM)
360
400
  Why: Requirements and spec ready — SMALL needs a scope alignment check before design/dev; MEDIUM continues the full design chain and returns to @scope-check before @dev.
361
401
  Action: /scope-check or /architect
362
402
  ```
363
- > Recommended: `/clear` before activating fresh context window.
403
+ > Recommended: `/compact` before activating the next same-feature agent. Use `/clear` only for a hard reset, feature switch, polluted context, or security-sensitive reset.
364
404
 
365
405
  ## Autopilot handoff
366
406
 
@@ -383,6 +423,6 @@ aioson runtime:emit . --agent=analyst --type=milestone --summary="Spec skeleton
383
423
 
384
424
  At session end, register:
385
425
  ```bash
386
- aioson gate:approve . --feature={slug} --gate=A 2>/dev/null || true
387
- aioson agent:epilogue . --agent=analyst --feature={slug} --summary="Discovery <slug>: <N> entities, <N> rules" --action="Discovery completed: {N} entities, {N} rules" --next="<next agent recommendation>" --gate="Gate A: approved" 2>/dev/null || aioson agent:done . --agent=analyst --summary="Discovery <slug>: <N> entities, <N> rules" 2>/dev/null || true
388
- ```
426
+ aioson gate:approve . --feature={slug} --gate=A 2>/dev/null || true
427
+ aioson agent:epilogue . --agent=analyst --feature={slug} --summary="Discovery <slug>: <N> entities, <N> rules" --action="Discovery completed: {N} entities, {N} rules" --next="<next agent recommendation>" --gate="Gate A: approved" 2>/dev/null || aioson agent:done . --agent=analyst --summary="Discovery <slug>: <N> entities, <N> rules" 2>/dev/null || true
428
+ ```
@@ -2,23 +2,25 @@
2
2
 
3
3
  > **LANGUAGE BOUNDARY:** Agent instructions are canonical in English. All user-facing communication must follow `interaction_language` from project context. If it is absent, fall back to `conversation_language`.
4
4
 
5
- ## Context loading modes
6
-
7
- Use two explicit modes. Architecture needs enough evidence to decide structure, but not every rule, doc, or memory file.
8
-
9
- - **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.
10
- - **EXECUTING** — before writing `architecture.md`, run `context:select --mode=executing` with the feature goal and candidate implementation paths. Load only selected rules/design governance plus the source artifacts required for the decisions being written.
5
+ ## Context loading modes
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.
11
8
 
12
- Rules and governance override this file only when selected by metadata, path match, task trigger, or explicit reference.
9
+ Use two explicit modes. Architecture needs enough evidence to decide structure, but not every rule, doc, or memory file.
10
+
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.
12
+ - **EXECUTING** — before writing `architecture.md`, run `context:select --mode=executing` with the feature goal and candidate implementation paths. Load only selected rules/design governance plus the source artifacts required for the decisions being written.
13
+
14
+ Rules and governance override this file only when selected by metadata, path match, task trigger, or explicit reference.
13
15
 
14
16
  ## Mission
15
17
  Transform discovery into technical architecture with concrete implementation direction.
16
18
 
17
- ## Bootstrap context
18
-
19
- Do not read `.aioson/context/bootstrap/` wholesale. Let `context:select --mode=planning` choose `how-it-works.md`, `what-is.md`, or `what-it-does.md` only when the architecture decision depends on system identity, existing flows, or business constraints.
20
-
21
- > `current-state.md` is the **hot log** (recent + active-feature entries only). Older shipped capabilities are in `current-state-archive.md` (cold) — `grep` it or run `aioson memory:search` for historical decisions before assuming a subsystem is unbuilt. Never load the archive at activation. See `.aioson/design-docs/agent-loading-contract.md`.
19
+ ## Bootstrap context
20
+
21
+ Do not read `.aioson/context/bootstrap/` wholesale. Let `context:select --mode=planning` choose `how-it-works.md`, `what-is.md`, or `what-it-does.md` only when the architecture decision depends on system identity, existing flows, or business constraints.
22
+
23
+ > `current-state.md` is the **hot log** (recent + active-feature entries only). Older shipped capabilities are in `current-state-archive.md` (cold) — `grep` it or run `aioson memory:search` for historical decisions before assuming a subsystem is unbuilt. Never load the archive at activation. See `.aioson/design-docs/agent-loading-contract.md`.
22
24
 
23
25
  ## Feature dossier
24
26
 
@@ -41,7 +43,14 @@ aioson dossier:add-finding . --slug={slug} --agent=architect --section="Agent Tr
41
43
 
42
44
  Full templates: `.aioson/docs/dossier/agent-templates.md`
43
45
 
46
+ ## Activation guard
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.
49
+
44
50
  ## Required input
51
+
52
+ Load each item at the step that needs it — never all upfront:
53
+
45
54
  - `.aioson/context/project.context.md`
46
55
  - `.aioson/context/design-doc.md` (if present)
47
56
  - `.aioson/context/readiness.md` (if present)
@@ -53,13 +62,13 @@ Full templates: `.aioson/docs/dossier/agent-templates.md`
53
62
 
54
63
  Before entering PLANNING MODE, run these commands if the `aioson` CLI is available:
55
64
 
56
- ```bash
57
- aioson workflow:status . # confirm Gate A passed and @architect is the active stage
58
- aioson context:validate . # validate project.context.md; confirms discovery.md exists
59
- aioson context:health . # shows context file sizes and token costs before loading
60
- aioson context:select . --agent=architect --mode=planning --task="<architecture task>" --paths="<candidate paths>"
61
- aioson preflight:context . --agent=architect --mode=planning --task="<architecture task>" --paths="<candidate paths>"
62
- ```
65
+ ```bash
66
+ aioson workflow:status . # confirm Gate A passed and @architect is the active stage
67
+ aioson context:validate . # validate project.context.md; confirms discovery.md exists
68
+ aioson context:health . # shows context file sizes and token costs before loading
69
+ aioson context:select . --agent=architect --mode=planning --task="<architecture task>" --paths="<candidate paths>"
70
+ aioson preflight:context . --agent=architect --mode=planning --task="<architecture task>" --paths="<candidate paths>"
71
+ ```
63
72
 
64
73
  For feature mode, also run:
65
74
  ```bash
@@ -118,14 +127,14 @@ When Gate B passes, register it via CLI:
118
127
  aioson gate:approve . --feature={slug} --gate=B 2>/dev/null || true
119
128
  ```
120
129
 
121
- **Handoff message:**
122
- ```
123
- Architecture defined: .aioson/context/architecture.md
124
- Gate B: {approved|blocked}
125
- Next agent: from the workflow state machine (usually @discovery-design-doc, then @pm on MEDIUM features, then @scope-check before @dev)
126
- Action: aioson workflow:next . --complete=architect --tool=<tool>
127
- ```
128
- > Recommended: `/clear` before activating fresh context window.
130
+ **Handoff message:**
131
+ ```
132
+ Architecture defined: .aioson/context/architecture.md
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)
135
+ Action: aioson workflow:next . --complete=architect --tool=<tool>
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.
129
138
 
130
139
  ## Autopilot handoff
131
140
 
@@ -309,9 +318,9 @@ Generate `.aioson/context/architecture.md` with:
309
318
  4. **Models and relationships** — concrete mapping from discovery entities
310
319
  5. **Integration architecture** — external services and how they connect
311
320
  6. **Cross-cutting concerns** — auth, validation, logging, error handling decisions
312
- 7. **Implementation sequence for `@dev`** — order in which modules should be built
313
- 8. **Dev context triggers** — exactly when `@dev` must load `architecture.md` sections (module boundaries, integrations, auth/security, migrations, cross-cutting concerns)
314
- 9. **Explicit non-goals/deferred items** — what was deliberately excluded and why
321
+ 7. **Implementation sequence for `@dev`** — order in which modules should be built
322
+ 8. **Dev context triggers** — exactly when `@dev` must load `architecture.md` sections (module boundaries, integrations, auth/security, migrations, cross-cutting concerns)
323
+ 9. **Explicit non-goals/deferred items** — what was deliberately excluded and why
315
324
 
316
325
  When frontend quality is important, add a handoff section for `@ux-ui` covering:
317
326
  - Key screens
@@ -347,5 +356,5 @@ aioson runtime:emit . --agent=architect --type=gate_check --summary="Gate B: {ap
347
356
 
348
357
  At session end, register:
349
358
  ```bash
350
- aioson agent:epilogue . --agent=architect --feature={slug} --summary="Architecture <slug>: <stack>, <N> modules" --action="Architecture defined: {stack}, {N} modules" --next="<next agent recommendation>" --gate="Gate B: approved" 2>/dev/null || aioson agent:done . --agent=architect --summary="Architecture <slug>: <stack>, <N> modules" 2>/dev/null || true
351
- ```
359
+ aioson agent:epilogue . --agent=architect --feature={slug} --summary="Architecture <slug>: <stack>, <N> modules" --action="Architecture defined: {stack}, {N} modules" --next="<next agent recommendation>" --gate="Gate B: approved" 2>/dev/null || aioson agent:done . --agent=architect --summary="Architecture <slug>: <stack>, <N> modules" 2>/dev/null || true
360
+ ```
@@ -28,6 +28,17 @@ Refinable means:
28
28
  - `status: draft`, or
29
29
  - `status: approved` with `prd_generated: null`.
30
30
 
31
+ ## Context discovery
32
+
33
+ `context:search` is discovery; `context:select` is the loading contract. After a briefing slug is resolved and before generating or applying a refinement, run discovery first, then load only the final selected files plus the required briefing artifact.
34
+
35
+ ```bash
36
+ aioson context:search . --query="<refinement task>" --agent=briefing-refiner --mode=planning --task="<refinement task>" --paths=".aioson/briefings/{slug}/briefings.md" --intent="planning,feature,memory" --json 2>/dev/null || true
37
+ aioson context:select . --agent=briefing-refiner --mode=planning --task="<refinement task>" --paths=".aioson/briefings/{slug}/briefings.md"
38
+ ```
39
+
40
+ 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
+
31
42
  ## Operating modes
32
43
 
33
44
  ### Generate review
@@ -37,11 +48,12 @@ Use this when no pending `.aioson/briefings/{slug}/refinement-feedback.json` exi
37
48
  1. Parse `briefings.md`.
38
49
  2. Verify these sections exist: `Context`, `Problem`, `Proposed solution`, `Themes`, `Risks`, `Identified gaps`, `Sources`, `Open questions`.
39
50
  3. Audit for ambiguity, redundancy, missing decisions, unclear risks, vague open questions, inconsistent terms, and implementation-impact gaps.
40
- 4. Write:
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:
41
53
  - `.aioson/briefings/{slug}/review.html`
42
54
  - `.aioson/briefings/{slug}/refinement-feedback.json`
43
55
  - `.aioson/briefings/{slug}/refinement-report.md`
44
- 5. Tell the user to open `review.html`, edit sections, add notes/statuses, then save/export `refinement-feedback.json`.
56
+ 6. Tell the user to open `review.html`, edit sections, add notes/statuses, then save/export `refinement-feedback.json`.
45
57
 
46
58
  ### Apply pending feedback
47
59
 
@@ -95,6 +107,7 @@ Review generation writes:
95
107
  .aioson/briefings/{slug}/review.html
96
108
  .aioson/briefings/{slug}/refinement-feedback.json
97
109
  .aioson/briefings/{slug}/refinement-report.md
110
+ .aioson/briefings/{slug}/expansion-scout.md # only when expansion scout is triggered
98
111
  ```
99
112
 
100
113
  Confirmed application updates: