@jaimevalasek/aioson 1.23.0 → 1.23.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/docs/en/5-reference/cli-reference.md +85 -0
  2. package/docs/pt/4-agentes/pm.md +31 -4
  3. package/docs/pt/5-referencia/README.md +3 -0
  4. package/docs/pt/5-referencia/autopilot-handoff.md +131 -0
  5. package/docs/pt/5-referencia/comandos-cli.md +72 -6
  6. package/docs/pt/5-referencia/harness-retro.md +133 -0
  7. package/docs/pt/5-referencia/loop-guardrails.md +225 -0
  8. package/docs/pt/5-referencia/sdd-automation-scripts.md +25 -13
  9. package/package.json +1 -1
  10. package/src/cli.js +54 -29
  11. package/src/commands/agent-epilogue.js +186 -0
  12. package/src/commands/context-select.js +34 -0
  13. package/src/commands/preflight-context.js +13 -9
  14. package/src/commands/review-cycle.js +328 -0
  15. package/src/commands/runtime.js +4 -4
  16. package/src/commands/state-save.js +2 -0
  17. package/src/commands/workflow-execute.js +138 -28
  18. package/src/commands/workflow-next.js +3 -2
  19. package/src/commands/workflow-status.js +30 -10
  20. package/src/constants.js +15 -13
  21. package/src/context-memory.js +50 -25
  22. package/src/context-selector.js +420 -0
  23. package/src/gateway-pointer-merge.js +25 -4
  24. package/src/i18n/messages/en.js +13 -7
  25. package/src/i18n/messages/es.js +13 -7
  26. package/src/i18n/messages/fr.js +13 -7
  27. package/src/i18n/messages/pt-BR.js +13 -7
  28. package/src/parser.js +1 -1
  29. package/src/squad/preflight-context.js +26 -27
  30. package/template/.aioson/agents/analyst.md +41 -46
  31. package/template/.aioson/agents/architect.md +33 -46
  32. package/template/.aioson/agents/briefing.md +76 -67
  33. package/template/.aioson/agents/dev.md +66 -59
  34. package/template/.aioson/agents/deyvin.md +124 -114
  35. package/template/.aioson/agents/discovery-design-doc.md +35 -22
  36. package/template/.aioson/agents/manifests/architect.manifest.json +11 -1
  37. package/template/.aioson/agents/manifests/dev.manifest.json +15 -0
  38. package/template/.aioson/agents/manifests/pm.manifest.json +20 -0
  39. package/template/.aioson/agents/orchestrator.md +31 -18
  40. package/template/.aioson/agents/pentester.md +7 -7
  41. package/template/.aioson/agents/pm.md +41 -35
  42. package/template/.aioson/agents/product.md +116 -165
  43. package/template/.aioson/agents/qa.md +21 -14
  44. package/template/.aioson/agents/scope-check.md +46 -24
  45. package/template/.aioson/agents/tester.md +12 -6
  46. package/template/.aioson/agents/ux-ui.md +36 -31
  47. package/template/.aioson/agents/validator.md +3 -3
  48. package/template/.aioson/config/autonomy-protocol.json +7 -0
  49. package/template/.aioson/design-docs/code-reuse.md +10 -5
  50. package/template/.aioson/design-docs/componentization.md +10 -5
  51. package/template/.aioson/design-docs/file-size.md +10 -5
  52. package/template/.aioson/design-docs/folder-structure.md +10 -5
  53. package/template/.aioson/design-docs/naming.md +10 -5
  54. package/template/.aioson/docs/autonomy-protocol.md +2 -2
  55. package/template/.aioson/docs/autopilot-handoff.md +32 -21
  56. package/template/.aioson/docs/briefing/briefing-craft.md +9 -3
  57. package/template/.aioson/docs/deyvin/continuity-recovery.md +18 -22
  58. package/template/.aioson/docs/product/conversation-playbook.md +8 -3
  59. package/template/.aioson/docs/product/prd-contract.md +8 -3
  60. package/template/.aioson/docs/product/quality-lens.md +8 -3
  61. package/template/.aioson/docs/product/research-loop.md +8 -3
  62. package/template/.aioson/docs/ux-ui/accessibility-audit.md +7 -2
  63. package/template/.aioson/docs/ux-ui/audit-mode.md +7 -2
  64. package/template/.aioson/docs/ux-ui/component-map.md +7 -2
  65. package/template/.aioson/docs/ux-ui/design-execution.md +7 -2
  66. package/template/.aioson/docs/ux-ui/design-gate.md +7 -2
  67. package/template/.aioson/docs/ux-ui/research-mode.md +7 -2
  68. package/template/.aioson/docs/ux-ui/site-delivery.md +7 -2
  69. package/template/.aioson/docs/ux-ui/token-contract.md +7 -2
  70. package/template/.aioson/rules/aioson-context-boundary.md +1 -1
  71. package/template/.aioson/rules/disk-first-artifacts.md +1 -1
  72. package/template/.aioson/skills/process/aioson-spec-driven/SKILL.md +9 -7
  73. package/template/.aioson/skills/process/aioson-spec-driven/references/approval-gates.md +1 -1
  74. package/template/.aioson/skills/process/aioson-spec-driven/references/architect.md +3 -2
  75. package/template/.aioson/skills/process/aioson-spec-driven/references/artifact-map.md +21 -9
  76. package/template/.aioson/skills/process/aioson-spec-driven/references/dev.md +2 -1
  77. package/template/.aioson/skills/process/aioson-spec-driven/references/deyvin.md +19 -15
  78. package/template/.aioson/skills/process/aioson-spec-driven/references/pm.md +2 -1
  79. package/template/.aioson/skills/static/web-research-cache.md +29 -8
  80. package/template/AGENTS.md +13 -13
  81. package/template/CLAUDE.md +9 -9
  82. package/template/OPENCODE.md +3 -2
@@ -21,12 +21,16 @@ module.exports = {
21
21
  'aioson agent:prompt <agent> [path] [--tool=codex|claude|opencode] [--lang=<bcp47-tag>] [--locale=en]',
22
22
  help_agent_help:
23
23
  'aioson agent:help [agent] [--json]',
24
- help_agent_invoke:
25
- 'aioson agent:invoke <agent> [path] [--tool=codex|claude|opencode] [--mode=framework_target|app_target] [--feature=<slug>] [--scope=<area>] [--lang=<bcp47-tag>] [--locale=en]',
24
+ help_agent_invoke:
25
+ 'aioson agent:invoke <agent> [path] [--tool=codex|claude|opencode] [--mode=framework_target|app_target] [--feature=<slug>] [--scope=<area>] [--lang=<bcp47-tag>] [--locale=en]',
26
+ help_agent_epilogue:
27
+ 'aioson agent:epilogue [path] --agent=<agent> --summary=<text> [--feature=<slug>] [--approve-gate=A|B|C|D] [--json] [--locale=en]',
26
28
  help_context_validate: 'aioson context:validate [path] [--json] [--locale=en]',
27
- help_context_pack:
28
- 'aioson context:pack [path] [--agent=<agent>] [--goal=<text>] [--module=<module-or-folder>] [--max-files=8] [--json] [--locale=en]',
29
- help_context_load:
29
+ help_context_pack:
30
+ 'aioson context:pack [path] [--agent=<agent>] [--goal=<text>] [--module=<module-or-folder>] [--max-files=8] [--json] [--locale=en]',
31
+ help_context_select:
32
+ 'aioson context:select [path] [--agent=<agent>] [--mode=planning|executing] [--task=<text>] [--paths=<path[,path2]>] [--feature=<slug>] [--json] [--locale=en]',
33
+ help_context_load:
30
34
  'aioson context:load [path] --target=<rule|brain>:<slug> --agent=<name> [--batch="slug1,slug2"] [--feature=<slug>] [--classification=<MICRO|SMALL|MEDIUM>] [--verbose] [--json] [--locale=en]',
31
35
  help_chain_audit:
32
36
  'aioson chain:audit <file> [path] [--limit=N] [--feature=<slug>] [--json] [--locale=en]',
@@ -118,8 +122,10 @@ module.exports = {
118
122
  'aioson workflow:next [path] [--complete[=<agent>]] [--agent=<agent>] [--skip=<agent>] [--status] [--suggest] [--tool=codex|claude|opencode] [--json] [--locale=en]',
119
123
  help_workflow_status:
120
124
  'aioson workflow:status [path] [--suggest] [--tool=codex|claude|opencode] [--json] [--locale=en]',
121
- help_workflow_execute:
122
- 'aioson workflow:execute [path] [--steps=<n>] [--dry-run] [--lane=<n>] [--json] [--locale=en]',
125
+ help_workflow_execute:
126
+ 'aioson workflow:execute [path] [--feature=<slug>] [--agentic] [--max-dev-qa-cycles=<n>] [--max-tester-cycles=<n>] [--max-pentester-cycles=<n>] [--dry-run] [--lane=<n>] [--json] [--locale=en]',
127
+ help_review_cycle:
128
+ 'aioson review-cycle:<status|advance|resolve|reset> [path] --feature=<slug> [--plan=<path>] [--source=qa|tester|pentester] [--json] [--locale=en]',
123
129
  help_parallel_init:
124
130
  'aioson parallel:init [path] [--workers=2..6] [--force] [--dry-run] [--json] [--locale=en]',
125
131
  help_parallel_doctor:
@@ -22,12 +22,16 @@ module.exports = {
22
22
  'aioson agent:prompt <agent> [path] [--tool=codex|claude|opencode] [--lang=<bcp47-tag>] [--locale=es]',
23
23
  help_agent_help:
24
24
  'aioson agent:help [agent] [--json]',
25
- help_agent_invoke:
26
- 'aioson agent:invoke <agent> [path] [--tool=codex|claude|opencode] [--mode=framework_target|app_target] [--feature=<slug>] [--scope=<area>] [--lang=<bcp47-tag>] [--locale=es]',
25
+ help_agent_invoke:
26
+ 'aioson agent:invoke <agent> [path] [--tool=codex|claude|opencode] [--mode=framework_target|app_target] [--feature=<slug>] [--scope=<area>] [--lang=<bcp47-tag>] [--locale=es]',
27
+ help_agent_epilogue:
28
+ 'aioson agent:epilogue [path] --agent=<agente> --summary=<texto> [--feature=<slug>] [--approve-gate=A|B|C|D] [--json] [--locale=es]',
27
29
  help_context_validate: 'aioson context:validate [path] [--json] [--locale=es]',
28
- help_context_pack:
29
- 'aioson context:pack [path] [--agent=<agente>] [--goal=<texto>] [--module=<modulo-o-carpeta>] [--max-files=8] [--json] [--locale=es]',
30
- help_context_load:
30
+ help_context_pack:
31
+ 'aioson context:pack [path] [--agent=<agente>] [--goal=<texto>] [--module=<modulo-o-carpeta>] [--max-files=8] [--json] [--locale=es]',
32
+ help_context_select:
33
+ 'aioson context:select [path] [--agent=<agente>] [--mode=planning|executing] [--task=<texto>] [--paths=<ruta[,ruta2]>] [--feature=<slug>] [--json] [--locale=es]',
34
+ help_context_load:
31
35
  'aioson context:load [path] --target=<rule|brain>:<slug> --agent=<nombre> [--batch="slug1,slug2"] [--feature=<slug>] [--classification=<MICRO|SMALL|MEDIUM>] [--verbose] [--json] [--locale=es]',
32
36
  help_chain_audit:
33
37
  'aioson chain:audit <archivo> [path] [--limit=N] [--feature=<slug>] [--json] [--locale=es]',
@@ -108,8 +112,10 @@ module.exports = {
108
112
  'aioson test:package [source-path] [--keep] [--dry-run] [--json] [--locale=es]',
109
113
  help_workflow_plan:
110
114
  'aioson workflow:plan [path] [--classification=MICRO|SMALL|MEDIUM] [--json] [--locale=es]',
111
- help_workflow_execute:
112
- 'aioson workflow:execute [path] [--steps=<n>] [--dry-run] [--lane=<n>] [--json] [--locale=es]',
115
+ help_workflow_execute:
116
+ 'aioson workflow:execute [path] [--feature=<slug>] [--agentic] [--max-dev-qa-cycles=<n>] [--max-tester-cycles=<n>] [--max-pentester-cycles=<n>] [--dry-run] [--lane=<n>] [--json] [--locale=es]',
117
+ help_review_cycle:
118
+ 'aioson review-cycle:<status|advance|resolve|reset> [path] --feature=<slug> [--plan=<path>] [--source=qa|tester|pentester] [--json] [--locale=es]',
113
119
  help_parallel_init:
114
120
  'aioson parallel:init [path] [--workers=2..6] [--force] [--dry-run] [--json] [--locale=es]',
115
121
  help_parallel_doctor:
@@ -22,12 +22,16 @@ module.exports = {
22
22
  'aioson agent:prompt <agent> [path] [--tool=codex|claude|opencode] [--lang=<bcp47-tag>] [--locale=fr]',
23
23
  help_agent_help:
24
24
  'aioson agent:help [agent] [--json]',
25
- help_agent_invoke:
26
- 'aioson agent:invoke <agent> [path] [--tool=codex|claude|opencode] [--mode=framework_target|app_target] [--feature=<slug>] [--scope=<area>] [--lang=<bcp47-tag>] [--locale=fr]',
25
+ help_agent_invoke:
26
+ 'aioson agent:invoke <agent> [path] [--tool=codex|claude|opencode] [--mode=framework_target|app_target] [--feature=<slug>] [--scope=<area>] [--lang=<bcp47-tag>] [--locale=fr]',
27
+ help_agent_epilogue:
28
+ 'aioson agent:epilogue [path] --agent=<agent> --summary=<texte> [--feature=<slug>] [--approve-gate=A|B|C|D] [--json] [--locale=fr]',
27
29
  help_context_validate: 'aioson context:validate [path] [--json] [--locale=fr]',
28
- help_context_pack:
29
- 'aioson context:pack [path] [--agent=<agent>] [--goal=<texte>] [--module=<module-ou-dossier>] [--max-files=8] [--json] [--locale=fr]',
30
- help_context_load:
30
+ help_context_pack:
31
+ 'aioson context:pack [path] [--agent=<agent>] [--goal=<texte>] [--module=<module-ou-dossier>] [--max-files=8] [--json] [--locale=fr]',
32
+ help_context_select:
33
+ 'aioson context:select [path] [--agent=<agent>] [--mode=planning|executing] [--task=<texte>] [--paths=<chemin[,chemin2]>] [--feature=<slug>] [--json] [--locale=fr]',
34
+ help_context_load:
31
35
  'aioson context:load [path] --target=<rule|brain>:<slug> --agent=<nom> [--batch="slug1,slug2"] [--feature=<slug>] [--classification=<MICRO|SMALL|MEDIUM>] [--verbose] [--json] [--locale=fr]',
32
36
  help_chain_audit:
33
37
  'aioson chain:audit <fichier> [path] [--limit=N] [--feature=<slug>] [--json] [--locale=fr]',
@@ -108,8 +112,10 @@ module.exports = {
108
112
  'aioson test:package [source-path] [--keep] [--dry-run] [--json] [--locale=fr]',
109
113
  help_workflow_plan:
110
114
  'aioson workflow:plan [path] [--classification=MICRO|SMALL|MEDIUM] [--json] [--locale=fr]',
111
- help_workflow_execute:
112
- 'aioson workflow:execute [path] [--steps=<n>] [--dry-run] [--lane=<n>] [--json] [--locale=fr]',
115
+ help_workflow_execute:
116
+ 'aioson workflow:execute [path] [--feature=<slug>] [--agentic] [--max-dev-qa-cycles=<n>] [--max-tester-cycles=<n>] [--max-pentester-cycles=<n>] [--dry-run] [--lane=<n>] [--json] [--locale=fr]',
117
+ help_review_cycle:
118
+ 'aioson review-cycle:<status|advance|resolve|reset> [path] --feature=<slug> [--plan=<path>] [--source=qa|tester|pentester] [--json] [--locale=fr]',
113
119
  help_parallel_init:
114
120
  'aioson parallel:init [path] [--workers=2..6] [--force] [--dry-run] [--json] [--locale=fr]',
115
121
  help_parallel_doctor:
@@ -22,12 +22,16 @@ module.exports = {
22
22
  'aioson agent:prompt <agent> [path] [--tool=codex|claude|opencode] [--lang=<bcp47-tag>] [--locale=pt-BR]',
23
23
  help_agent_help:
24
24
  'aioson agent:help [agent] [--json]',
25
- help_agent_invoke:
26
- 'aioson agent:invoke <agent> [path] [--tool=codex|claude|opencode] [--mode=framework_target|app_target] [--feature=<slug>] [--scope=<area>] [--lang=<bcp47-tag>] [--locale=pt-BR]',
25
+ help_agent_invoke:
26
+ 'aioson agent:invoke <agent> [path] [--tool=codex|claude|opencode] [--mode=framework_target|app_target] [--feature=<slug>] [--scope=<area>] [--lang=<bcp47-tag>] [--locale=pt-BR]',
27
+ help_agent_epilogue:
28
+ 'aioson agent:epilogue [path] --agent=<agente> --summary=<texto> [--feature=<slug>] [--approve-gate=A|B|C|D] [--json] [--locale=pt-BR]',
27
29
  help_context_validate: 'aioson context:validate [path] [--json] [--locale=pt-BR]',
28
- help_context_pack:
29
- 'aioson context:pack [path] [--agent=<agente>] [--goal=<texto>] [--module=<modulo-ou-pasta>] [--max-files=8] [--json] [--locale=pt-BR]',
30
- help_context_load:
30
+ help_context_pack:
31
+ 'aioson context:pack [path] [--agent=<agente>] [--goal=<texto>] [--module=<modulo-ou-pasta>] [--max-files=8] [--json] [--locale=pt-BR]',
32
+ help_context_select:
33
+ 'aioson context:select [path] [--agent=<agente>] [--mode=planning|executing] [--task=<texto>] [--paths=<caminho[,caminho2]>] [--feature=<slug>] [--json] [--locale=pt-BR]',
34
+ help_context_load:
31
35
  'aioson context:load [path] --target=<rule|brain>:<slug> --agent=<nome> [--batch="slug1,slug2"] [--feature=<slug>] [--classification=<MICRO|SMALL|MEDIUM>] [--verbose] [--json] [--locale=pt-BR]',
32
36
  help_chain_audit:
33
37
  'aioson chain:audit <arquivo> [path] [--limit=N] [--feature=<slug>] [--json] [--locale=pt-BR]',
@@ -120,8 +124,10 @@ module.exports = {
120
124
  'aioson workflow:next [path] [--complete[=<agente>]] [--agent=<agente>] [--skip=<agente>] [--status] [--suggest] [--tool=codex|claude|opencode] [--json] [--locale=pt-BR]',
121
125
  help_workflow_status:
122
126
  'aioson workflow:status [path] [--suggest] [--tool=codex|claude|opencode] [--json] [--locale=pt-BR]',
123
- help_workflow_execute:
124
- 'aioson workflow:execute [path] [--steps=<n>] [--dry-run] [--lane=<n>] [--json] [--locale=pt-BR]',
127
+ help_workflow_execute:
128
+ 'aioson workflow:execute [path] [--feature=<slug>] [--agentic] [--max-dev-qa-cycles=<n>] [--max-tester-cycles=<n>] [--max-pentester-cycles=<n>] [--dry-run] [--lane=<n>] [--json] [--locale=pt-BR]',
129
+ help_review_cycle:
130
+ 'aioson review-cycle:<status|advance|resolve|reset> [path] --feature=<slug> [--plan=<path>] [--source=qa|tester|pentester] [--json] [--locale=pt-BR]',
125
131
  help_parallel_init:
126
132
  'aioson parallel:init [path] [--workers=2..6] [--force] [--dry-run] [--json] [--locale=pt-BR]',
127
133
  help_parallel_doctor:
package/src/parser.js CHANGED
@@ -29,7 +29,7 @@ function parseArgv(argv) {
29
29
  'all', 'force', 'dry-run', 'no-interactive', 'fix', 'json',
30
30
  'help', 'version', 'no-launch', 'attach', 'tmux',
31
31
  'allow-warnings', 'install-hook', 'uninstall-hook', 'remove-hook',
32
- 'agent-safe',
32
+ 'agent-safe', 'agentic',
33
33
  'selective',
34
34
  'status', 'suggest', 'apply',
35
35
  'runtime-only', 'template-only', 'inception', 'locales',
@@ -13,9 +13,10 @@
13
13
  * Output: visual bar chart of context budget per component.
14
14
  */
15
15
 
16
- const fs = require('node:fs/promises');
17
- const path = require('node:path');
18
- const crypto = require('node:crypto');
16
+ const fs = require('node:fs/promises');
17
+ const path = require('node:path');
18
+ const crypto = require('node:crypto');
19
+ const { selectContext } = require('../context-selector');
19
20
 
20
21
  const SQUADS_DIR = path.join('.aioson', 'squads');
21
22
 
@@ -120,10 +121,10 @@ function formatSize(chars) {
120
121
  * @param {object} options — { agent, squad, verbose }
121
122
  * @returns {Promise<object>} — { components[], total, totalLimit, duplicates[], warnings[] }
122
123
  */
123
- async function estimateContext(projectDir, options = {}) {
124
- const { agent = 'dev', squad, verbose } = options;
125
- const components = [];
126
- const warnings = [];
124
+ async function estimateContext(projectDir, options = {}) {
125
+ const { agent = 'dev', squad, verbose, mode = 'planning', task = '', paths = '' } = options;
126
+ const components = [];
127
+ const warnings = [];
127
128
 
128
129
  // 1. Agent file
129
130
  const agentPath = path.join(projectDir, '.aioson', 'agents', `${agent}.md`);
@@ -164,26 +165,24 @@ async function estimateContext(projectDir, options = {}) {
164
165
  content: ctxFile.content
165
166
  });
166
167
 
167
- // 4. Active rules
168
- const rulesDir = path.join(projectDir, '.aioson', 'rules');
169
- let rulesChars = 0;
170
- let rulesContent = '';
171
- try {
172
- const entries = await fs.readdir(rulesDir);
173
- const mdFiles = entries.filter((f) => f.endsWith('.md'));
174
- for (const f of mdFiles) {
175
- const r = await readFileChars(path.join(rulesDir, f));
176
- rulesChars += r.chars;
177
- rulesContent += r.content + '\n';
178
- }
179
- } catch { /* no rules dir */ }
180
- components.push({
181
- label: 'active rules',
182
- path: rulesDir,
183
- chars: rulesChars,
184
- limit: DEFAULT_LIMITS.rules,
185
- content: rulesContent
186
- });
168
+ // 4. Selected context (rules/docs/design governance/memory) by mode + task.
169
+ const selection = await selectContext(projectDir, { agent, mode, task, paths });
170
+ let selectedChars = 0;
171
+ let selectedContent = '';
172
+ for (const item of selection.selected) {
173
+ if (item.path === '.aioson/context/project.context.md') continue;
174
+ const selected = await readFileChars(path.join(projectDir, item.path));
175
+ selectedChars += selected.chars;
176
+ selectedContent += selected.content + '\n';
177
+ }
178
+ components.push({
179
+ label: `selected context (${mode})`,
180
+ path: path.join(projectDir, '.aioson'),
181
+ chars: selectedChars,
182
+ limit: DEFAULT_LIMITS.rules,
183
+ content: selectedContent,
184
+ selected: selection.selected.map((item) => item.path)
185
+ });
187
186
 
188
187
  // 5. Squad-specific files (if --squad provided)
189
188
  if (squad) {
@@ -2,41 +2,34 @@
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
- ## Project rules, docs & design governance
6
-
7
- These directories are optional. Check them silently if absent or empty, continue without mentioning them.
8
-
9
- 1. `.aioson/rules/` if `.md` files exist, read YAML frontmatter:
10
- - if `agents:` is absent or `[]` load the rule
11
- - if `agents:` includes `analyst` → load the rule
12
- - otherwise skip it
13
- 2. `.aioson/docs/` — load only docs whose `description` is relevant to the current analysis task, or that are referenced by a loaded rule.
14
- 3. `.aioson/context/design-doc*.md` — load when `scope`, `description`, or `agents:` matches the current feature or analysis task.
15
- 4. `.aioson/design-docs/*.md` — load only when requirements imply module boundaries, file creation, naming, reuse, or componentization. Treat loaded governance docs as structural constraints for downstream agents.
16
-
17
- Loaded rules and governance override the default conventions in this file.
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.
18
13
 
19
14
  ## Mission
20
15
  Discover requirements deeply and produce implementation-ready artifacts. For new projects: `discovery.md`. For new features: `requirements-{slug}.md` + `spec-{slug}.md`.
21
16
 
22
- ## Bootstrap context
23
-
24
- If `.aioson/context/bootstrap/` exists, read these files before starting discovery:
25
- - `.aioson/context/bootstrap/what-is.md` — system identity and users
26
- - `.aioson/context/bootstrap/what-it-does.md` — features, business rules, constraints
27
-
28
- Use this semantic knowledge to avoid re-discovering domain basics that are already documented.
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.
29
20
 
30
21
  ## Tool-first session preflight
31
22
 
32
23
  Before any manual checks, run these commands if the `aioson` CLI is available:
33
24
 
34
- ```bash
35
- aioson workflow:status . # confirm current stage and what is expected
36
- aioson context:validate . # validate project.context.md; detects brownfield state
37
- aioson preflight . --agent=analyst --feature={slug} # unified pre-session check: loads rules, design governance, and context
38
- aioson classify . # auto-detect project classification (MICRO/SMALL/MEDIUM) for cross-reference
39
- ```
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
+ ```
40
33
 
41
34
  For feature mode with existing requirements, run before the synchronization gate:
42
35
  ```bash
@@ -70,12 +63,11 @@ If the CLI is not available, compare modification dates manually:
70
63
 
71
64
  Check the following before doing anything else:
72
65
 
73
- **Feature mode** — a `prd-{slug}.md` file exists in `.aioson/context/`:
74
- - Read `prd-{slug}.md` to understand the feature scope.
75
- - Read `design-doc.md` and `readiness.md` if present to understand scope framing and readiness.
76
- - Read `discovery.md` and `spec.md` if present (project context — entities already built).
77
- - Run the **Feature discovery** process below (lighter, feature-scoped).
78
- - Output: `requirements-{slug}.md` + `spec-{slug}.md`.
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`.
79
71
 
80
72
  **Project mode** — no `prd-{slug}.md`, only `prd.md` or nothing:
81
73
  - Run the full 3-phase project discovery below.
@@ -264,14 +256,16 @@ For each new or modified entity, produce field-level detail (same format as Phas
264
256
  ### Output contract — feature mode
265
257
 
266
258
  **`requirements-{slug}.md`** — implementation spec for the feature:
267
- 1. Feature summary (1–2 lines from prd-{slug}.md)
268
- 2. New entities and fields (full table format)
269
- 3. Changes to existing entities
270
- 4. Relationships (with existing entities from discovery.md)
271
- 5. Migration additions (ordered)
272
- 6. Business rules
273
- 7. Edge cases
274
- 8. Out of scope for this 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
275
269
 
276
270
  **`spec-{slug}.md`** — feature memory skeleton (will be enriched by @dev):
277
271
 
@@ -345,7 +339,7 @@ Generate `.aioson/context/discovery.md` with the following sections:
345
339
 
346
340
  ## Dev handoff producer
347
341
 
348
- Before the final `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:
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:
349
343
 
350
344
  ```bash
351
345
  aioson dev:state:write . --feature={slug} --phase=1 \
@@ -353,7 +347,9 @@ aioson dev:state:write . --feature={slug} --phase=1 \
353
347
  --context=spec,requirements
354
348
  ```
355
349
 
356
- `--context` accepts canonical tokens (`prd`, `requirements`, `spec`, `architecture`, `impl-plan`, `sheldon`, `design-doc`, `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.
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.
357
353
 
358
354
  **Handoff message:**
359
355
  ```
@@ -387,7 +383,6 @@ aioson runtime:emit . --agent=analyst --type=milestone --summary="Spec skeleton
387
383
 
388
384
  At session end, register:
389
385
  ```bash
390
- aioson gate:approve . --feature={slug} --gate=A 2>/dev/null || true
391
- aioson pulse:update . --agent=analyst --feature={slug} --action="Discovery completed: {N} entities, {N} rules" --next="<next agent recommendation>" 2>/dev/null || true
392
- aioson agent:done . --agent=analyst --summary="Discovery <slug>: <N> entities, <N> rules" 2>/dev/null || true
393
- ```
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
+ ```
@@ -2,38 +2,23 @@
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
- ## Project rules, docs & design governance
6
-
7
- These directories are optional. Check them silently if absent or empty, continue without mentioning them.
8
-
9
- 1. `.aioson/rules/`if `.md` files exist, read YAML frontmatter:
10
- - if `agents:` is absent or `[]` load the rule
11
- - if `agents:` includes `architect` → load the rule
12
- - otherwise skip it
13
- 2. `.aioson/docs/` — load only docs whose `description` is relevant to the current architecture task, or that are referenced by a loaded rule.
14
- 3. `.aioson/context/design-doc*.md` — load when `scope`, `description`, or `agents:` matches the current feature or architecture task.
15
- 4. `.aioson/design-docs/*.md` — load relevant governance docs before deciding folder structure, component boundaries, naming, reuse strategy, or file-size split guidance.
16
-
17
- Loaded rules and governance override the default conventions in this file.
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.
11
+
12
+ Rules and governance override this file only when selected by metadata, path match, task trigger, or explicit reference.
18
13
 
19
14
  ## Mission
20
15
  Transform discovery into technical architecture with concrete implementation direction.
21
16
 
22
- ## Bootstrap context
23
-
24
- If `.aioson/context/bootstrap/` exists, read all files that are present before starting architectural planning.
25
-
26
- Prioritize:
27
- - `current-state.md`
28
- - `how-it-works.md`
29
-
30
- Also read when present:
31
- - `what-is.md`
32
- - `what-it-does.md`
33
-
34
- This gives you full semantic understanding of the system without reading the codebase directly.
35
-
36
- > `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`.
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`.
37
22
 
38
23
  ## Feature dossier
39
24
 
@@ -68,11 +53,13 @@ Full templates: `.aioson/docs/dossier/agent-templates.md`
68
53
 
69
54
  Before entering PLANNING MODE, run these commands if the `aioson` CLI is available:
70
55
 
71
- ```bash
72
- aioson workflow:status . # confirm Gate A passed and @architect is the active stage
73
- aioson context:validate . # validate project.context.md; confirms discovery.md exists
74
- aioson context:health . # shows context file sizes and token costs before loading
75
- ```
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
+ ```
76
63
 
77
64
  For feature mode, also run:
78
65
  ```bash
@@ -131,14 +118,14 @@ When Gate B passes, register it via CLI:
131
118
  aioson gate:approve . --feature={slug} --gate=B 2>/dev/null || true
132
119
  ```
133
120
 
134
- **Handoff message:**
135
- ```
136
- Architecture defined: .aioson/context/architecture.md
137
- Gate B: {approved|blocked}
138
- Next agent: @pm (MEDIUM implementation planning) or @dev (SMALL — direct implementation)
139
- Action: /pm or /dev
140
- ```
141
- > Recommended: `/clear` before activating — fresh context window.
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.
142
129
 
143
130
  ## Autopilot handoff
144
131
 
@@ -322,8 +309,9 @@ Generate `.aioson/context/architecture.md` with:
322
309
  4. **Models and relationships** — concrete mapping from discovery entities
323
310
  5. **Integration architecture** — external services and how they connect
324
311
  6. **Cross-cutting concerns** — auth, validation, logging, error handling decisions
325
- 7. **Implementation sequence for `@dev`** — order in which modules should be built
326
- 8. **Explicit non-goals/deferred items** — what was deliberately excluded and why
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
327
315
 
328
316
  When frontend quality is important, add a handoff section for `@ux-ui` covering:
329
317
  - Key screens
@@ -359,6 +347,5 @@ aioson runtime:emit . --agent=architect --type=gate_check --summary="Gate B: {ap
359
347
 
360
348
  At session end, register:
361
349
  ```bash
362
- aioson pulse:update . --agent=architect --feature={slug} --action="Architecture defined: {stack}, {N} modules" --next="<next agent recommendation>" 2>/dev/null || true
363
- aioson agent:done . --agent=architect --summary="Architecture <slug>: <stack>, <N> modules" 2>/dev/null || true
364
- ```
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
+ ```