@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
@@ -16,8 +16,16 @@ description: One-line description of what this rule enforces
16
16
  agents: [dev, architect] # omit to apply to ALL agents
17
17
  priority: 10 # optional: higher = loaded first (default: 0)
18
18
  version: 1.0.0
19
- ---
20
- ```
19
+ modes: [planning, executing] # optional: restrict to a context:select mode
20
+ task_types: [payment, billing] # routing: matched against the current task
21
+ load_tier: trigger # trigger (default) | always | justified
22
+ triggers: [money, pricing, checkout] # routing: keywords/phrases matched against the task
23
+ aliases: [workspace, project] # routing: user/domain terms that may mean this rule
24
+ entities: [Workspace, Project] # routing: domain objects, tables, services, modules
25
+ retrieval_intents: [database, memory] # routing: why this file should be discovered
26
+ paths: [src/billing/**] # routing: matched against the files being touched
27
+ ---
28
+ ```
21
29
 
22
30
  ---
23
31
 
@@ -30,6 +38,14 @@ version: 1.0.0
30
38
  | `agents` | no | List of agent names. If absent → all agents load it |
31
39
  | `priority` | no | Loading order. Higher = loaded first. Default: 0 |
32
40
  | `version` | no | Semantic version for tracking changes |
41
+ | `modes` | no | `planning`, `executing`, or both. If declared, the rule is only eligible in those modes |
42
+ | `task_types` | no | Task categories matched against the `context:select` task description |
43
+ | `load_tier` | no | `trigger` (default, loads on match), `always` (loads on every select), `justified` (higher match bar) |
44
+ | `triggers` | no | Keywords or short verb phrases matched against the task (e.g. `creating files` matches "create a new file") |
45
+ | `aliases` | no | Alternate user/domain terms that should recall this rule, e.g. `workspace` when the code entity is `project` |
46
+ | `entities` | no | Domain objects, tables, services, modules, or concepts governed by the rule |
47
+ | `retrieval_intents` | no | Discovery intent labels such as `planning`, `implementation`, `database`, `memory`, `feature`, `security`, or `testing` |
48
+ | `paths` | no | Glob patterns matched against `--paths` (files about to be touched) |
33
49
 
34
50
  ---
35
51
 
@@ -41,6 +57,36 @@ version: 1.0.0
41
57
  - Rules are loaded silently — agents do not announce which rules were loaded
42
58
  - An agent named `dev` matches a rule with `agents: [dev]`
43
59
 
60
+ ### On-demand routing via context:select
61
+
62
+ Agents load rules on demand through `aioson context:select`. A rule is selected when its
63
+ metadata and semantic relevance score above the load threshold for the current task:
64
+ `task_types`/`triggers` matches weigh most, `aliases`/`entities`/`retrieval_intents`
65
+ help connect user language to project language, `paths` matches add when the touched
66
+ files overlap, `description` adds a small boost, and semantic search over the rule body
67
+ can recover relevant rules when the task wording does not exactly match the metadata.
68
+
69
+ `aioson context:search` is the broad discovery layer. It indexes `.aioson/rules`,
70
+ `.aioson/docs`, skills, context/bootstrap files, feature dossiers, plans, PRDs, and
71
+ research summaries, then returns `must_read`, `should_read`, and `maybe` buckets. Its
72
+ `--agent`, `--mode`, `--intent`, and `--source` flags are ranking boosts, not strict
73
+ filters. Use `context:search` to discover candidates; use `context:select` as the final
74
+ strict context package before loading files into an agent prompt.
75
+
76
+ Semantic search is a recall aid, not a permission bypass. `agents`, `modes`,
77
+ activation-only boundaries, and path/feature constraints still apply before a rule can
78
+ be selected. A rule with only `agents` + `description` is still weakly routed and will be
79
+ flagged by lint; either give it routing metadata (`task_types`, `triggers`, `paths`) or
80
+ mark it `load_tier: always` when it is genuinely global (keep always-rules small).
81
+
82
+ Check the health of your rules with:
83
+
84
+ ```bash
85
+ aioson rules:lint .
86
+ ```
87
+
88
+ It flags rules that are selector-invisible or missing required fields.
89
+
44
90
  ---
45
91
 
46
92
  ## When to Create a Rule
@@ -4,20 +4,25 @@ description: Agent files default to English for universal reuse. Locale-specific
4
4
  priority: 9
5
5
  version: 1.1.0
6
6
  agents: [squad, genome, orache, design-hybrid-forge, site-forge]
7
+ modes: [planning, executing]
8
+ task_types: [squad-creation, agent-generation, localization]
9
+ load_tier: trigger
10
+ triggers: [creating squads, generating agents, choosing language, locale scope, translating agents]
11
+ paths: [.aioson/squads/**]
7
12
  ---
8
13
 
9
14
  # Agent Language Policy
10
15
 
11
- Agent files are instruction code. Default is English because it maximizes LLM reasoning quality, reduces token cost, and enables universal reuse. User-facing replies still follow the selected project language (`interaction_language`, fallback `conversation_language`). Locale-scoped generated squads may declare `locale_scope` when their own generated agent files must be locale-native.
16
+ Agent files are instruction code. Default is English because it maximizes LLM reasoning quality, reduces token cost, and enables universal reuse. User-facing replies still follow the selected project language (`interaction_language`, fallback `conversation_language`). Locale-scoped generated squads may declare `locale_scope` when their own generated agent files must be locale-native.
12
17
 
13
18
  ## Language decision tree
14
19
 
15
20
  ```
16
- New or existing squad
17
- ├── ephemeral: true → any language
18
- └── ephemeral: false
19
- ├── locale_scope: "universal" (or absent) → agent files in English
20
- └── locale_scope: "{locale}" declared → generated squad agent files in that locale language
21
+ New or existing squad
22
+ ├── ephemeral: true → any language
23
+ └── ephemeral: false
24
+ ├── locale_scope: "universal" (or absent) → agent files in English
25
+ └── locale_scope: "{locale}" declared → generated squad agent files in that locale language
21
26
  ```
22
27
 
23
28
  ## Declaring locale_scope
@@ -26,9 +31,9 @@ In `squad.manifest.json`:
26
31
 
27
32
  ```json
28
33
  {
29
- "slug": "pharmacy-support",
30
- "locale_scope": "pt-BR",
31
- "locale_rationale": "Domain regulated by ANVISA; law, prescriptions, and customer interactions are exclusively Brazilian."
34
+ "slug": "pharmacy-support",
35
+ "locale_scope": "pt-BR",
36
+ "locale_rationale": "Domain regulated by ANVISA; law, prescriptions, and customer interactions are exclusively Brazilian."
32
37
  }
33
38
  ```
34
39
 
@@ -43,8 +48,8 @@ Valid values: `"universal"` (default) or any BCP-47 code: `"pt-BR"`, `"en-US"`,
43
48
  | No portability | Squad never reused in another country without full rewrite? |
44
49
  | Native domain reasoning | Technical domain richer in native language? |
45
50
 
46
- Justified: ANVISA pharmacy support, eSocial tax/payroll, Brazilian legal support, national support desk.
47
- Not justified: digital marketing, software development, YouTube creator, psychology/coaching.
51
+ Justified: ANVISA pharmacy support, eSocial tax/payroll, Brazilian legal support, national support desk.
52
+ Not justified: digital marketing, software development, YouTube creator, psychology/coaching.
48
53
 
49
54
  ## Rules by layer
50
55
 
@@ -68,16 +73,16 @@ Not justified: digital marketing, software development, YouTube creator, psychol
68
73
  | Agent output | Locale language |
69
74
  | Content docs | Locale language |
70
75
 
71
- ## Mandatory Question During Squad Creation
72
-
73
- Before generating any generated squad file, ask in the selected project language:
74
-
75
- ```
76
- Is this squad for one specific country/language, or should it be universal?
77
-
78
- 1. Universal (English) — reusable in any project, publishable on aiosforge.com
79
- 2. Specific locale — for example Brazil-only in Portuguese
80
- ```
76
+ ## Mandatory Question During Squad Creation
77
+
78
+ Before generating any generated squad file, ask in the selected project language:
79
+
80
+ ```
81
+ Is this squad for one specific country/language, or should it be universal?
82
+
83
+ 1. Universal (English) — reusable in any project, publishable on aiosforge.com
84
+ 2. Specific locale — for example Brazil-only in Portuguese
85
+ ```
81
86
 
82
87
  If (2): request locale code. If unclear: infer from domain and confirm.
83
88
 
@@ -1,158 +1,168 @@
1
- ---
2
- name: agent-structural-contract
3
- description: Structural contract every AIOSON agent must follow — mandatory sections, observability order, handoff pattern, and CLI command integrity
4
- priority: 5
5
- version: 1.0.0
6
- ---
7
-
8
- # Agent Structural Contract
9
-
10
- Every AIOSON agent file (`template/.aioson/agents/*.md`) must comply with this structural contract. Violations are caught by `@qa` during Gate D and by `@sheldon` during enrichment reviews.
11
-
12
- ## 1. Language boundary (mandatory, line 3)
13
-
14
- Every agent MUST start with:
15
-
16
- ```markdown
17
- > **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`.
18
- ```
19
-
20
- ## 2. Mandatory sections
21
-
22
- Every agent that interacts with the user MUST have these sections (order may vary):
23
-
24
- | Section | Purpose | Required for |
25
- |---|---|---|
26
- | `## Mission` | What the agent does in 1-2 lines | All agents |
27
- | `## Required input` | What files must be read before acting | All agents |
28
- | `## Hard constraints` | Non-negotiable rules | All agents |
29
- | Observability block | `agent:done` + `pulse:update` at session end | All agents |
30
-
31
- Agents that are part of the SDD workflow additionally MUST have:
32
-
33
- | Section | Purpose | Required for |
34
- |---|---|---|
35
- | Handoff section | Structured next-agent recommendation | briefing, product, sheldon, analyst, architect, pm, orchestrator |
36
- | `## Feature dossier` | Dossier read/write integration | product, sheldon, analyst, architect, pm, orchestrator |
37
-
38
- ## 3. Observability command order (session end)
39
-
40
- At session end, commands MUST appear in this exact order. Missing steps are acceptable when marked N/A — wrong order is not.
41
-
42
- ```
43
- 1. gate:approve (if this agent owns a gate — analyst=A, architect=B, pm=C, qa=D)
44
- 2. op:capture (if user confirmed decisions — product, sheldon, pm)
45
- 3. pulse:update (ALL agents — automated project-pulse update)
46
- 4. agent:done (ALL agentsALWAYS LAST)
47
- ```
48
-
49
- `runtime:emit` milestones happen DURING the session at strategic moments, NOT in the session-end block. Each agent should emit at least 2 milestones during execution.
50
-
51
- ### Milestone timing per agent
52
-
53
- | Agent | Milestone 1 (emit during work) | Milestone 2 (emit during work) |
54
- |---|---|---|
55
- | @briefing | Briefing draft written | Briefing approved |
56
- | @product | PRD written | Feature registered in features.md |
57
- | @sheldon | Sizing decided | Enrichment applied |
58
- | @analyst | Requirements written | Spec skeleton created |
59
- | @architect | Architecture decided | Gate B check |
60
- | @pm | Implementation plan written | Gate C approved |
61
- | @orchestrator | Lanes initialized | Merge complete |
62
- | @dev | Slice started | Slice landed |
63
- | @qa | Review started | Verdict decided |
64
-
65
- ## 4. Handoff contract
66
-
67
- Every workflow agent MUST end with a handoff block following this template:
68
-
69
- ```markdown
70
- **Handoff message:**
71
- ```
72
- [Artifact produced]: .aioson/context/[artifact].md
73
- [Gate status]: Gate [X]: [approved|pending]
74
- Next agent: @[name] ([condition or rationale])
75
- Action: /[agent-name]
76
- ```
77
- > Recommended: `/clear` before activating — fresh context window.
78
- ```
79
-
80
- Rules:
81
- - The handoff message MUST include at least: artifact path, next agent, and rationale.
82
- - `/clear` recommendation MUST be present.
83
- - Do NOT continue into the next agent's work output only the handoff and stop.
84
-
85
- ## 5. CLI error handling
86
-
87
- Best-effort `aioson` CLI commands in agent files MUST end with `2>/dev/null || true` to prevent optional telemetry or context helpers from breaking the session when the CLI is unavailable.
88
-
89
- ```
90
- aioson <command> . --flag=value 2>/dev/null || true
91
- ```
92
-
93
- Do not silence blocking commands whose result controls safety, routing, or user action. These commands must run normally, and the agent must inspect their result before continuing.
94
-
95
- Blocking examples:
96
- - `aioson git:guard`
97
- - `aioson commit:prepare`
98
- - `aioson gate:check`
99
- - `aioson preflight`
100
- - `aioson workflow:status`
101
- - `aioson context:validate`
102
-
103
- Best-effort examples:
104
- - `aioson runtime:emit`
105
- - `aioson pulse:update`
106
- - `aioson agent:done`
107
- - `aioson dossier:*`
108
- - `aioson memory:search`
109
- - `aioson context:search`
110
- - `aioson context:pack`
111
-
112
- Commands inside "Quick start" or "Prerequisites" sections are user-run examples and do not need the best-effort suffix.
113
-
114
- ## 6. CLI flag integrity
115
-
116
- Agent files must reference CLI commands with correct flag names. When adding a new command reference:
117
-
118
- 1. Check `src/commands/<command>.js` for the actual option names.
119
- 2. Use `--flag=value` syntax (not positional arguments) for clarity.
120
- 3. Never guess flags verify against the source.
121
-
122
- Known correct signatures (reference table):
123
-
124
- | Command | Correct flags |
125
- |---|---|
126
- | `gate:approve` | `--feature=<slug> --gate=<A\|B\|C\|D>` |
127
- | `gate:check` | `--feature=<slug> --gate=<A\|B\|C\|D>` |
128
- | `pulse:update` | `--agent=<name> --feature=<slug> --action="<summary>" --next="<recommendation>"` |
129
- | `op:capture` | `--signal=<type> --quote="<verbatim>" --proposal="<paraphrase>" --source-agent=<name>` |
130
- | `brain:query` | `--tags=<csv> --min-quality=<n> --format=<compact\|json\|ids>` |
131
- | `artifact:validate` | `--feature=<slug>` (NOT `--spec=<file>`) |
132
- | `dossier:audit` | `--check=<template-parity\|coverage>` (NOT `--slug=<slug>`) |
133
- | `dossier:add-finding` | `--slug=<slug> --agent=<name> --section="<section>" --content="<text>"` |
134
- | `dossier:add-codemap` | `--slug=<slug> --file=<path> --role=<role> --coupling=<low\|medium\|high> --added-by=<agent>` |
135
- | `dossier:link-rule` | `--slug=<slug> --rule=<path> --reason="<text>"` |
136
- | `runtime:emit` | `--agent=<name> --type=<milestone\|gate_check> --summary="<text>"` |
137
- | `memory:search` | `--query="<text>"` |
138
- | `context:search` | `--query="<text>"` |
139
- | `preflight` | `--agent=<name> --feature=<slug>` |
140
- | `dev:state:write` | `--feature=<slug> --phase=<n> --next="<description>" --context=<tokens>`; supports `simple-plan` |
141
-
142
- ## 7. Template-workspace parity
143
-
144
- Agent files in `template/.aioson/agents/` are the canonical source. Workspace files in `.aioson/agents/` are copies synced via `npm run sync:agents`.
145
-
146
- Rules:
147
- - Edits MUST be made in `template/` first, then synced to workspace.
148
- - After any agent edit session, verify parity with `diff template/.aioson/agents/<file> .aioson/agents/<file>`.
149
- - Drift between template and workspace is a bug — the template always wins.
150
-
151
- ## On violation detected
152
-
153
- When an agent file violates this contract:
154
-
155
- 1. **During @qa Gate D:** flag as a Medium finding with `recommended_owner: dev`.
156
- 2. **During @sheldon enrichment:** flag in `sheldon-enrichment-{slug}.md` improvements list.
157
- 3. **During @deyvin pair session:** fix inline if the touched file is already in scope.
158
- 4. **Never block a feature** for structural violations alone document and fix as follow-up.
1
+ ---
2
+ name: agent-structural-contract
3
+ description: Structural contract every AIOSON agent must follow — mandatory sections, observability order, handoff pattern, and CLI command integrity
4
+ priority: 5
5
+ version: 1.0.0
6
+ modes: [planning, executing]
7
+ task_types: [agent-contract, agent-authoring]
8
+ load_tier: trigger
9
+ guard: true
10
+ triggers: [editing agent files, creating agents, agent prompt, handoff contract, observability block, milestone order]
11
+ paths: [.aioson/agents/**, template/.aioson/agents/**, .aioson/squads/**]
12
+ ---
13
+
14
+ # Agent Structural Contract
15
+
16
+ Every AIOSON agent file (`template/.aioson/agents/*.md`) must comply with this structural contract. Violations are caught by `@qa` during Gate D and by `@sheldon` during enrichment reviews.
17
+
18
+ ## 1. Language boundary (mandatory, line 3)
19
+
20
+ Every agent MUST start with:
21
+
22
+ ```markdown
23
+ > **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`.
24
+ ```
25
+
26
+ ## 2. Mandatory sections
27
+
28
+ Every agent that interacts with the user MUST have these sections (order may vary):
29
+
30
+ | Section | Purpose | Required for |
31
+ |---|---|---|
32
+ | `## Mission` | What the agent does in 1-2 lines | All agents |
33
+ | `## Required input` | What files must be read before acting | All agents |
34
+ | `## Hard constraints` | Non-negotiable rules | All agents |
35
+ | Observability block | `agent:done` + `pulse:update` at session end | All agents |
36
+
37
+ Agents that are part of the SDD workflow additionally MUST have:
38
+
39
+ | Section | Purpose | Required for |
40
+ |---|---|---|
41
+ | Handoff section | Structured next-agent recommendation | briefing, product, sheldon, analyst, architect, pm, orchestrator |
42
+ | `## Feature dossier` | Dossier read/write integration | product, sheldon, analyst, architect, pm, orchestrator |
43
+
44
+ ## 3. Observability command order (session end)
45
+
46
+ At session end, commands MUST appear in this exact order. Missing steps are acceptable when marked N/A wrong order is not.
47
+
48
+ ```
49
+ 1. gate:approve (if this agent owns a gate analyst=A, architect=B, pm=C, qa=D)
50
+ 2. op:capture (if user confirmed decisions — product, sheldon, pm)
51
+ 3. pulse:update (ALL agents automated project-pulse update)
52
+ 4. agent:done (ALL agents — ALWAYS LAST)
53
+ ```
54
+
55
+ `runtime:emit` milestones happen DURING the session at strategic moments, NOT in the session-end block. Each agent should emit at least 2 milestones during execution.
56
+
57
+ ### Milestone timing per agent
58
+
59
+ | Agent | Milestone 1 (emit during work) | Milestone 2 (emit during work) |
60
+ |---|---|---|
61
+ | @briefing | Briefing draft written | Briefing approved |
62
+ | @product | PRD written | Feature registered in `.aioson/context/features.md` |
63
+ | @sheldon | Sizing decided | Enrichment applied |
64
+ | @analyst | Requirements written | Spec skeleton created |
65
+ | @architect | Architecture decided | Gate B check |
66
+ | @pm | Implementation plan written | Gate C approved |
67
+ | @orchestrator | Lanes initialized | Merge complete |
68
+ | @dev | Slice started | Slice landed |
69
+ | @qa | Review started | Verdict decided |
70
+
71
+ ## 4. Handoff contract
72
+
73
+ Every workflow agent MUST end with a handoff block following this template:
74
+
75
+ ```markdown
76
+ **Handoff message:**
77
+ ```
78
+ [Artifact produced]: .aioson/context/[artifact].md
79
+ [Gate status]: Gate [X]: [approved|pending]
80
+ Next agent: @[name] ([condition or rationale])
81
+ Action: /[agent-name]
82
+ ```
83
+ > Recommended: `/compact` before activating the next same-feature agent. Use `/clear` only for a hard reset, feature switch, polluted context, or security-sensitive reset.
84
+ ```
85
+
86
+ Rules:
87
+ - The handoff message MUST include at least: artifact path, next agent, and rationale.
88
+ - `/compact` recommendation MUST be present for same-feature continuation.
89
+ - `/clear` MUST be described only as a hard reset option.
90
+ - Do NOT continue into the next agent's work — output only the handoff and stop.
91
+
92
+ ## 5. CLI error handling
93
+
94
+ Best-effort `aioson` CLI commands in agent files MUST end with `2>/dev/null || true` to prevent optional telemetry or context helpers from breaking the session when the CLI is unavailable.
95
+
96
+ ```
97
+ aioson <command> . --flag=value 2>/dev/null || true
98
+ ```
99
+
100
+ Do not silence blocking commands whose result controls safety, routing, or user action. These commands must run normally, and the agent must inspect their result before continuing.
101
+
102
+ Blocking examples:
103
+ - `aioson git:guard`
104
+ - `aioson commit:prepare`
105
+ - `aioson gate:check`
106
+ - `aioson preflight`
107
+ - `aioson workflow:status`
108
+ - `aioson context:validate`
109
+
110
+ Best-effort examples:
111
+ - `aioson runtime:emit`
112
+ - `aioson pulse:update`
113
+ - `aioson agent:done`
114
+ - `aioson dossier:*`
115
+ - `aioson memory:search`
116
+ - `aioson context:search`
117
+ - `aioson context:brief`
118
+ - `aioson context:pack`
119
+
120
+ Commands inside "Quick start" or "Prerequisites" sections are user-run examples and do not need the best-effort suffix.
121
+
122
+ ## 6. CLI flag integrity
123
+
124
+ Agent files must reference CLI commands with correct flag names. When adding a new command reference:
125
+
126
+ 1. Check `src/commands/<command>.js` for the actual option names.
127
+ 2. Use `--flag=value` syntax (not positional arguments) for clarity.
128
+ 3. Never guess flags verify against the source.
129
+
130
+ Known correct signatures (reference table):
131
+
132
+ | Command | Correct flags |
133
+ |---|---|
134
+ | `gate:approve` | `--feature=<slug> --gate=<A\|B\|C\|D>` |
135
+ | `gate:check` | `--feature=<slug> --gate=<A\|B\|C\|D>` |
136
+ | `pulse:update` | `--agent=<name> --feature=<slug> --action="<summary>" --next="<recommendation>"` |
137
+ | `op:capture` | `--signal=<type> --quote="<verbatim>" --proposal="<paraphrase>" --source-agent=<name>` |
138
+ | `brain:query` | `--tags=<csv> --min-quality=<n> --format=<compact\|json\|ids>` |
139
+ | `artifact:validate` | `--feature=<slug>` (NOT `--spec=<file>`) |
140
+ | `dossier:audit` | `--check=<template-parity\|coverage>` (NOT `--slug=<slug>`) |
141
+ | `dossier:add-finding` | `--slug=<slug> --agent=<name> --section="<section>" --content="<text>"` |
142
+ | `dossier:add-codemap` | `--slug=<slug> --file=<path> --role=<role> --coupling=<low\|medium\|high> --added-by=<agent>` |
143
+ | `dossier:link-rule` | `--slug=<slug> --rule=<path> --reason="<text>"` |
144
+ | `runtime:emit` | `--agent=<name> --type=<milestone\|gate_check> --summary="<text>"` |
145
+ | `memory:search` | `--query="<text>"` |
146
+ | `context:search` | `[path] --query="<text>" --agent=<name> --mode=<mode> --task="<text>" --paths=<csv> --intent=<csv>` |
147
+ | `context:brief` | `[path] --agent=<name> --mode=<planning\|executing> --task="<text>" --paths=<csv> [--no-recall]` |
148
+ | `context:index` | `[path] --force` |
149
+ | `preflight` | `--agent=<name> --feature=<slug>` |
150
+ | `dev:state:write` | `--feature=<slug> --phase=<n> --next="<description>" --context=<tokens>`; supports `simple-plan` |
151
+
152
+ ## 7. Template-workspace parity
153
+
154
+ Agent files in `template/.aioson/agents/` are the canonical source. Workspace files in `.aioson/agents/` are copies synced via `npm run sync:agents`.
155
+
156
+ Rules:
157
+ - Edits MUST be made in `template/` first, then synced to workspace.
158
+ - After any agent edit session, verify parity with `diff template/.aioson/agents/<file> .aioson/agents/<file>`.
159
+ - Drift between template and workspace is a bug — the template always wins.
160
+
161
+ ## On violation detected
162
+
163
+ When an agent file violates this contract:
164
+
165
+ 1. **During @qa Gate D:** flag as a Medium finding with `recommended_owner: dev`.
166
+ 2. **During @sheldon enrichment:** flag in `sheldon-enrichment-{slug}.md` improvements list.
167
+ 3. **During @deyvin pair session:** fix inline if the touched file is already in scope.
168
+ 4. **Never block a feature** for structural violations alone — document and fix as follow-up.
@@ -4,6 +4,12 @@ description: .aioson/context/ is Markdown-first with explicit machine-readable e
4
4
  priority: 10
5
5
  version: 1.0.0
6
6
  agents: [product, analyst, architect, ux-ui, pm, dev, qa, sheldon]
7
+ modes: [executing]
8
+ task_types: [artifact-write, file-creation]
9
+ load_tier: trigger
10
+ guard: true
11
+ triggers: [writing artifacts, creating files, saving context, context artifact, machine-readable file]
12
+ paths: [.aioson/context/**]
7
13
  ---
8
14
 
9
15
  # Context Boundary: .aioson/context/
@@ -44,7 +50,7 @@ project.context.md ← setup
44
50
  discovery.md ← analyst
45
51
  requirements-{slug}.md ← analyst
46
52
  architecture.md ← architect
47
- ui-spec.md / ui-spec-{slug}.md ← ux-ui (`ui-spec.md` is the current canonical runtime artifact)
53
+ ui-spec.md / ui-spec-{slug}.md ← ux-ui (`ui-spec.md` is the current canonical runtime artifact)
48
54
  prd.md / prd-{slug}.md ← product
49
55
  spec-{slug}.md ← dev
50
56
  implementation-plan-{slug}.md ← pm
@@ -1,9 +1,15 @@
1
1
  ---
2
2
  name: canonical-path-contract
3
- description: Mandatory distinction between root plans/, .aioson/plans/{slug}/, docs/pt/, and implementation-plan. Every artifact-writing agent must consult this contract before creating files.
3
+ description: Mandatory distinction between root plans/, .aioson/plans/{slug}/, docs/pt/, and implementation-plan. Every artifact-writing agent must consult this contract before creating files.
4
4
  priority: 10
5
5
  version: 1.0.0
6
6
  agents: []
7
+ modes: [planning, executing]
8
+ task_types: [artifact-write, file-creation, plan-write]
9
+ load_tier: trigger
10
+ guard: true
11
+ triggers: [writing plans, creating files, saving artifacts, choosing paths, artifact destination]
12
+ paths: [plans/**, .aioson/plans/**, .aioson/context/**, docs/**]
7
13
  ---
8
14
 
9
15
  # Canonical Path Contract
@@ -27,9 +33,9 @@ Every agent that creates or writes files MUST resolve the target path using this
27
33
  | PRD | `.aioson/context/prd-{slug}.md` | `@product` |
28
34
  | Requirements | `.aioson/context/requirements-{slug}.md` | `@analyst` |
29
35
  | Architecture | `.aioson/context/architecture.md` | `@architect` |
30
- | Spec (living memory) | `.aioson/context/spec-{slug}.md` | `@dev` |
31
- | Simple implementation plan | `.aioson/context/simple-plans/{slug}.md` | `@dev` / `@deyvin` |
32
- | QA report | `.aioson/context/qa-report-{slug}.md` | `@qa` |
36
+ | Spec (living memory) | `.aioson/context/spec-{slug}.md` | `@dev` |
37
+ | Simple implementation plan | `.aioson/context/simple-plans/{slug}.md` | `@dev` / `@deyvin` |
38
+ | QA report | `.aioson/context/qa-report-{slug}.md` | `@qa` |
33
39
 
34
40
  ## Violation behaviors
35
41
 
@@ -44,9 +50,9 @@ Every agent that creates or writes files MUST resolve the target path using this
44
50
  |---|---|
45
51
  | "plans" or "plans folder" | Ask: root `plans/` (pre-production) or `.aioson/plans/{slug}/` (feature plan)? |
46
52
  | "docs" or "documentation" | Ask: `docs/` root (project docs) or `docs/pt/` (PT system docs) or `.aioson/docs/` (agent on-demand docs)? |
47
- | "context" | `.aioson/context/` (framework artifacts) |
48
- | "rules" | `.aioson/rules/` (agent rules) |
49
-
50
- ## Simple plan distinction
51
-
52
- `simple-plans/{slug}.md` is not a PRD, not a Sheldon phased plan, and not a MEDIUM implementation plan. It is a lightweight implementation artifact for bounded technical work that `@dev` or `@deyvin` can execute directly under `.aioson/rules/simple-plan-lane.md`.
53
+ | "context" | `.aioson/context/` (framework artifacts) |
54
+ | "rules" | `.aioson/rules/` (agent rules) |
55
+
56
+ ## Simple plan distinction
57
+
58
+ `simple-plans/{slug}.md` is not a PRD, not a Sheldon phased plan, and not a MEDIUM implementation plan. It is a lightweight implementation artifact for bounded technical work that `@dev` or `@deyvin` can execute directly under `.aioson/rules/simple-plan-lane.md`.
@@ -3,6 +3,12 @@ name: data-format-convention
3
3
  description: Which file format to use when producing or consuming structured data — YAML for agent-readable reference data, Markdown for narrative, JSON for machine-consumed data
4
4
  priority: 8
5
5
  version: 1.0.0
6
+ modes: [executing]
7
+ task_types: [artifact-write, data-format]
8
+ load_tier: trigger
9
+ guard: true
10
+ triggers: [choosing format, structured data, writing yaml, writing json, producing output, data file]
11
+ paths: [output/**, .aioson/squads/**]
6
12
  ---
7
13
 
8
14
  # Data Format Convention
@@ -27,17 +33,17 @@ Use for: ICP profiles, persona profiles, audience segments, offer sheets, pricin
27
33
 
28
34
  **Example (`icp-primary.yaml`):**
29
35
  ```yaml
30
- profile:
31
- name: "Agency-Dependent Founder"
32
- description: "Business owner dependent on agencies or external developers"
33
- pain_points:
34
- - Loss of control over the product
35
- - Unpredictable delays and costs
36
- desired_outcome: "Autonomy and speed"
37
- buying_trigger: "Deadline approaching or delayed developer invoice arriving"
38
- messaging:
39
- primary: "Take back control of your product"
40
- channels: [instagram, linkedin, youtube]
36
+ profile:
37
+ name: "Agency-Dependent Founder"
38
+ description: "Business owner dependent on agencies or external developers"
39
+ pain_points:
40
+ - Loss of control over the product
41
+ - Unpredictable delays and costs
42
+ desired_outcome: "Autonomy and speed"
43
+ buying_trigger: "Deadline approaching or delayed developer invoice arriving"
44
+ messaging:
45
+ primary: "Take back control of your product"
46
+ channels: [instagram, linkedin, youtube]
41
47
  ```
42
48
 
43
49
  ### Markdown — narrative for humans and linear agent reading