@jaimevalasek/aioson 1.16.0 → 1.17.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.
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Neural Chain — shared chain_audit telemetry emit helper.
5
+ *
6
+ * Single emitter used by both the CLI command (`src/commands/chain-audit.js`)
7
+ * and the post-session hook (`src/neural-chain-agent-ingest.js`) so payload
8
+ * shape is identical across code paths (BR-NC-10).
9
+ *
10
+ * Spec payload schema (BR-NC-10), 8 required fields:
11
+ * feature_slug — string | null
12
+ * source_files — string[] (the files edited in this session, plural)
13
+ * impacts_found — number | null (null on query failure)
14
+ * auto_fixable_count — number (per BR-NC-02/03 classification)
15
+ * noise_file — string | null (path written, if any)
16
+ * tokens_used — number (V1 placeholder = 0; M2 hooks LLM-mediated path)
17
+ * duration_ms — number (audit query elapsed; 0 on no-op)
18
+ * error — string | null
19
+ *
20
+ * Emitters may attach extra context fields (e.g. `agent`, `autonomy_mode`,
21
+ * `chain_auto_threshold`, `ingest_stats`, `skipped_reason`) on top of the
22
+ * required schema — those are passed through verbatim.
23
+ *
24
+ * EC-NC-05 no-op event (empty artifact list) also populates `duration_ms = 0`
25
+ * and `error = null` so downstream aggregation never has to special-case the
26
+ * skip path. Hotfix v1.17.1 — bug-found-003 from @tester gap-fill audit.
27
+ */
28
+
29
+ const REQUIRED_FIELDS = Object.freeze([
30
+ 'feature_slug',
31
+ 'source_files',
32
+ 'impacts_found',
33
+ 'auto_fixable_count',
34
+ 'noise_file',
35
+ 'tokens_used',
36
+ 'duration_ms',
37
+ 'error'
38
+ ]);
39
+
40
+ function normalizeSourceFiles(value) {
41
+ if (Array.isArray(value)) return value.slice();
42
+ if (value === null || value === undefined) return [];
43
+ return [String(value)];
44
+ }
45
+
46
+ function buildChainAuditPayload({
47
+ feature_slug = null,
48
+ source_files = [],
49
+ impacts_found = 0,
50
+ auto_fixable_count = 0,
51
+ noise_file = null,
52
+ tokens_used = 0,
53
+ duration_ms = 0,
54
+ error = null,
55
+ ...extras
56
+ } = {}) {
57
+ return {
58
+ feature_slug,
59
+ source_files: normalizeSourceFiles(source_files),
60
+ impacts_found,
61
+ auto_fixable_count,
62
+ noise_file,
63
+ tokens_used,
64
+ duration_ms,
65
+ error,
66
+ ...extras
67
+ };
68
+ }
69
+
70
+ function emitChainAuditEvent(db, { agent = null, message = 'chain:audit', ...payloadOverrides } = {}) {
71
+ if (!db || typeof db.prepare !== 'function') return false;
72
+ const payload = buildChainAuditPayload(payloadOverrides);
73
+ try {
74
+ db.prepare(`
75
+ INSERT INTO execution_events (event_type, agent_name, message, payload_json, created_at)
76
+ VALUES ('chain_audit', ?, ?, ?, ?)
77
+ `).run(agent, message, JSON.stringify(payload), new Date().toISOString());
78
+ return true;
79
+ } catch (_) {
80
+ // BR-NC-10 best-effort: telemetry failure must never propagate to the caller.
81
+ return false;
82
+ }
83
+ }
84
+
85
+ module.exports = {
86
+ buildChainAuditPayload,
87
+ emitChainAuditEvent,
88
+ normalizeSourceFiles,
89
+ REQUIRED_FIELDS
90
+ };
@@ -10,6 +10,7 @@ const {
10
10
  mergeGenomeBindings
11
11
  } = require('./genomes/bindings');
12
12
  const { runMigration: runLearningLoopMigration } = require('./learning-loop-migration');
13
+ const { runMigration: runNeuralChainMigration } = require('./neural-chain-migration');
13
14
 
14
15
  const RUNTIME_DIR = path.join('.aioson', 'runtime');
15
16
  const DB_FILE = 'aios.sqlite';
@@ -775,6 +776,7 @@ function ensureLegacyColumns(db) {
775
776
  `);
776
777
 
777
778
  runLearningLoopMigration(db);
779
+ runNeuralChainMigration(db);
778
780
  }
779
781
 
780
782
  function insertEvent(db, record) {
@@ -331,7 +331,7 @@ Generate `.aioson/context/discovery.md` with the following sections:
331
331
 
332
332
  ## Dev handoff producer
333
333
 
334
- Before the final `agent:done` call, when the next agent in the workflow is `@dev`, produce `dev-state.md` so the next `/dev` session auto-resumes on cold start instead of pinging the user for context:
334
+ 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:
335
335
 
336
336
  ```bash
337
337
  aioson dev:state:write . --feature={slug} --phase=1 \
@@ -66,6 +66,7 @@ After the user selects which plans to use:
66
66
  - Read each selected `plans/*.md` file fully.
67
67
  - Read `project.context.md` for project context.
68
68
  - Scan `.aioson/context/` for existing PRDs (`prd*.md`) — load titles/summaries only to avoid duplicating committed work.
69
+ - Also read `.aioson/context/done/MANIFEST.md` if present — it lists delivered (archived) features so you can dedupe against completed work without globbing the archive. Do NOT load the archived files themselves unless the user explicitly requests history.
69
70
 
70
71
  **2. Enrich**
71
72
 
@@ -229,6 +230,7 @@ Always register additional files with a note at the bottom of `briefings.md`:
229
230
  - **Never approve a briefing automatically** — approval requires explicit user action via CLI.
230
231
  - **Never overwrite an existing briefing** without confirming with the user first.
231
232
  - **Slug must be confirmed** by the user before any file is written.
233
+ - **Never recommend `@sheldon` (or any post-PRD agent) as the next step.** The only handoff from `@briefing` is `@product`. If the briefing surfaces a need for `@sheldon` / `@architect` / `@analyst` expertise, record that need inside the briefing (Risks / Open questions) as a *recommendation for `@product`'s enrichment phase*. `@product` decides when to invoke specialists after the PRD exists. See `briefing-craft.md` §1 "Mitigating weak markers" for examples.
232
234
  - Use `interaction_language` (fallback: `conversation_language`) from `project.context.md` for all interaction and output.
233
235
 
234
236
  ## Responsibility boundary
@@ -259,6 +261,6 @@ Always register additional files with a note at the bottom of `briefings.md`:
259
261
  ```bash
260
262
  aioson briefing:approve # mark as approved
261
263
  ```
262
- Then: activate `/product` — it will detect the approved briefing automatically.
264
+ Then: activate `/aioson:agent:product` — it will detect the approved briefing automatically.
263
265
  > Recommended: `/clear` first — fresh context window
264
266
  ---
@@ -25,7 +25,7 @@ understood, eliminates objections, and drives one clear action.
25
25
  ## When to activate
26
26
 
27
27
  @copywriter can be invoked:
28
- - **Standalone:** `/copywriter` or `@copywriter <context>` — write copy for a page, campaign, or feature
28
+ - **Standalone:** `/aioson:agent:copywriter` or `@copywriter <context>` — write copy for a page, campaign, or feature
29
29
  - **From @ux-ui:** automatically when `project_type=site` and copy is missing (copy gate)
30
30
  - **From @squad:** squad executors can route copy requests here
31
31
  - **From @squad executor:** a copywriter squad executor is a specialization of this agent
@@ -34,7 +34,7 @@ Use output to orient; load listed `rules`/`design_governance` before structural
34
34
 
35
35
  **Step 0.1 — Bootstrap gate (Living Memory):** read `aioson memory:status .` output. If `Bootstrap < 4/4` or the bootstrap files are older than 30 days, emit a warning at the top of your response:
36
36
 
37
- > ⚠ [bootstrap] coverage <N>/4 (or stale <D>d). Run `/discover` (or `aioson memory:refresh`) before continuing on broad work.
37
+ > ⚠ [bootstrap] coverage <N>/4 (or stale <D>d). Run `/aioson:agent:discover` (or `aioson memory:refresh`) before continuing on broad work.
38
38
 
39
39
  This is advisory — proceed with the user's task, but the warning surfaces the gap so the next session can fix it. Skip when bootstrap/ does not exist (greenfield).
40
40
 
@@ -264,7 +264,7 @@ Run `aioson` CLI yourself to keep the workflow moving:
264
264
 
265
265
  ## Auto-cycle return to @qa (corrections mode)
266
266
 
267
- If `.aioson/runtime/qa-dev-cycle.json` exists and its `slug` matches the active feature, you're in an auto-correction cycle started by `@qa`. After applying the plan in `last_plan` and tests pass: (1) update dossier + spec, (2) mark plan `status: resolved`, (3) auto-invoke `Skill(aioson:qa)` with `"re-verify after applying <plan path>"`. No user prompt — Ctrl+C interrupts. If the file is absent or slug differs, manual handoff as before.
267
+ If `.aioson/runtime/qa-dev-cycle.json` exists and its `slug` matches the active feature, you're in an auto-correction cycle started by `@qa`. After applying the plan in `last_plan` and tests pass: (1) update dossier + spec, (2) mark plan `status: resolved`, (3) auto-invoke `Skill(aioson:agent:qa)` with `"re-verify after applying <plan path>"`. No user prompt — Ctrl+C interrupts. If the file is absent or slug differs, manual handoff as before.
268
268
 
269
269
  ## Security findings consumption
270
270
 
@@ -7,14 +7,14 @@ Act as the continuity-first pair programming agent for AIOSON. Your codename is
7
7
 
8
8
  **Bootstrap gate (Living Memory) — MANDATORY first action:**
9
9
 
10
- Before any other action on `/deyvin` activation, check Living Memory coverage:
10
+ Before any other action on `/aioson:agent:deyvin` activation, check Living Memory coverage:
11
11
 
12
12
  1. **If `aioson` CLI is available**: run `aioson memory:status .` and read the output.
13
13
  2. **If `aioson` CLI is not available**: read `.aioson/context/bootstrap/*.md` directly via filesystem. Count present files (max 4: `what-is.md`, `what-it-does.md`, `how-it-works.md`, `current-state.md`) and the oldest modification date.
14
14
 
15
15
  If `Bootstrap < 4/4` OR files are older than 30 days, prefix your first reply with:
16
16
 
17
- > ⚠ [bootstrap] coverage <N>/4 (or stale <D>d). Recommend `/discover` (or `aioson memory:refresh`) before broad work.
17
+ > ⚠ [bootstrap] coverage <N>/4 (or stale <D>d). Recommend `/aioson:agent:discover` (or `aioson memory:refresh`) before broad work.
18
18
 
19
19
  This is advisory — continue with the user's task. Skip the gate only when `.aioson/context/bootstrap/` does not exist (greenfield project).
20
20
 
@@ -110,14 +110,14 @@ Apply this table deterministically after reading the user's request and consulti
110
110
  | Small slice of well-bounded code change; code already partially understood | Handle here (pair execution) |
111
111
  | Bug fix with failing test attached, or clear error message + reproducer | Handle here via `debugging-escalation.md` |
112
112
  | Diagnosis ambiguous; needs survey of >5 files or tracing a runtime flow | **Spawn sub-task scout** via `aioson scout:prep` (or CLI-less fallback — see "Sub-task scout invocation" below) |
113
- | New feature, new module, or cross-product surface | Handoff `/product` |
114
- | Decision affects multiple modules / system-wide architecture | Handoff `/architect` |
115
- | Missing domain rules, entities, or brownfield knowledge gap | Handoff `/analyst` |
116
- | PRD exists for the feature but is thin / sized wrong | Handoff `/sheldon` |
117
- | Visual direction unclear or UI system not defined | Handoff `/ux-ui` |
118
- | Vague scope, unclear readiness, contradictions | Handoff `/discovery-design-doc` |
119
- | Larger structured implementation batch that no longer fits pair conversation | Handoff `/dev` |
120
- | Formal QA / risk review or test pass requested | Handoff `/qa` |
113
+ | New feature, new module, or cross-product surface | Handoff `/aioson:agent:product` |
114
+ | Decision affects multiple modules / system-wide architecture | Handoff `/aioson:agent:architect` |
115
+ | Missing domain rules, entities, or brownfield knowledge gap | Handoff `/aioson:agent:analyst` |
116
+ | PRD exists for the feature but is thin / sized wrong | Handoff `/aioson:agent:sheldon` |
117
+ | Visual direction unclear or UI system not defined | Handoff `/aioson:agent:ux-ui` |
118
+ | Vague scope, unclear readiness, contradictions | Handoff `/aioson:agent:discovery-design-doc` |
119
+ | Larger structured implementation batch that no longer fits pair conversation | Handoff `/aioson:agent:dev` |
120
+ | Formal QA / risk review or test pass requested | Handoff `/aioson:agent:qa` |
121
121
 
122
122
  **Tie-breakers when two rows apply:**
123
123
  1. If the request is ambiguous, escalate (handoff) instead of handling.
@@ -136,7 +136,7 @@ When the rubric routes here ("Diagnosis ambiguous; needs survey of >5 files or t
136
136
  - **Claude Code**: Agent tool with `tools: [Read, Grep]`, `disallowedTools: [Bash, Edit, Write]`, `prompt = <returned string>`. Sub-agent writes JSON to the returned `output_path`.
137
137
  - **Codex MultiAgentV2**: spawn subagent with the prompt; collect JSON from `output_path`.
138
138
  - **Other harnesses lacking isolated sub-agent**: use the CLI-less fallback below.
139
- 4. `aioson scout:validate . --json --input=<output_path>`. On `schema_invalid`, re-prompt the sub-agent with `error.details`. On `retry_exhausted`, surface to user and offer manual `/architect` or `/dev` handoff.
139
+ 4. `aioson scout:validate . --json --input=<output_path>`. On `schema_invalid`, re-prompt the sub-agent with `error.details`. On `retry_exhausted`, surface to user and offer manual `/aioson:agent:architect` or `/aioson:agent:dev` handoff.
140
140
  5. `aioson scout:commit . --json --input=<output_path>` — telemetry emitted, cap counter decremented.
141
141
  6. Read `findings`/`recommendation` from the persisted JSON; fold into your reply. Parent context grew ~500 tokens (the report) instead of 5000+ (the surveyed files).
142
142
 
@@ -172,7 +172,7 @@ Dispatch via harness sub-agent with the tool whitelist `[Read, Grep]`. Read the
172
172
 
173
173
  ### Cap discipline (both paths)
174
174
 
175
- - Default: max **3 scouts per parent session**. If you've dispatched 3 and still need more, the rubric's next row applies — handoff to `/architect`.
175
+ - Default: max **3 scouts per parent session**. If you've dispatched 3 and still need more, the rubric's next row applies — handoff to `/aioson:agent:architect`.
176
176
  - Default: max **20 files per scout scope**. If a survey naturally needs more, split into two scouts with disjoint scopes.
177
177
  - Defaults are tunable in `.aioson/config/scout-engine.json`.
178
178
 
@@ -77,13 +77,33 @@ Check these in order. Stop at the first failure:
77
77
  | Features archived | `.aioson/context/done/MANIFEST.md` | If present, note delivered features summary — do NOT load the archived files unless the user explicitly requests history |
78
78
  | Bootstrap (Living Memory) | `.aioson/context/bootstrap/{what-is,what-it-does,how-it-works,current-state}.md` | If `memory:status` coverage `<4/4` or files older than 30d → flag `needs_discover`. Read `what-is.md` to enrich the project identity line. |
79
79
  | Feature dossier | `.aioson/context/features/{slug}/dossier.md` per active feature | Read Why/What + Agent Trail tail. If absent for SMALL/MEDIUM → flag `needs_dossier_init`. |
80
- | Harness contract | `.aioson/plans/{slug}/{harness-contract,progress}.json` per active feature | Check `progress.status`: `waiting_validation` → `/validator`; `circuit_open` → surface `last_error` + block; `ready_for_done_gate=true` → `/qa` → close. |
80
+ | Harness contract | `.aioson/plans/{slug}/{harness-contract,progress}.json` per active feature | Check `progress.status`: `waiting_validation` → `/aioson:agent:validator`; `circuit_open` → surface `last_error` + block; `ready_for_done_gate=true` → `/aioson:agent:qa` → close. |
81
81
  | Brains (procedural) | `.aioson/brains/_index.json` | Confirm presence + count + tags. Loaded by `@dev`/`@sheldon` themselves — `@neo` only signals existence. |
82
82
  | Design doc | `.aioson/context/design-doc*.md` | Note presence |
83
83
  | Copy exists | `.aioson/context/copy-*.md` | Only relevant when `project_type=site`. If missing: flag `needs_copy` — @copywriter must run before @ux-ui or @dev |
84
84
  | Readiness | `.aioson/context/readiness.md` | If exists, read status |
85
85
  | Implementation plan | `.aioson/context/implementation-plan.md` | Note presence and status |
86
86
  | Skeleton system | `.aioson/context/skeleton-system.md` | Note presence |
87
+ | Neural Chain noises | `.aioson/context/noises/*.md` | If any file has unchecked `- [ ]` body lines, flag `chain_noises_pending` with file path + pending count. Treated as BLOCKER in Step 1.5. |
88
+
89
+ ### Step 1.5 — Neural Chain noise check (BLOCKER, takes precedence over routing)
90
+
91
+ Glob `.aioson/context/noises/*.md`. For each file, count body lines matching `^- \[ \]` (unchecked) versus `^- \[x\]` (checked). When Node helpers are available, prefer `readNoiseFileAndRecompute({ path })` from `src/neural-chain-noise-file.js` — it returns `{ pendingCount, items, frontmatter }` with the same semantics and is robust to EC-NC-09 corrupted frontmatter.
92
+
93
+ **If any noise file has `pendingCount > 0`:**
94
+ - This is a BLOCKER, not info — routing to any other agent (`/aioson:agent:dev`, `/aioson:agent:deyvin`, `/aioson:agent:qa`, etc.) is paused.
95
+ - Surface in the dashboard under the ⛔ section, one block per file:
96
+ - Path (relative to project root)
97
+ - `{pendingCount}/{totalCount}` resolved
98
+ - Each pending item: `target_path — {motivo}` (the `motivo` already includes `edge_type` and `confidence` from BR-NC-06)
99
+ - Recommended next action becomes: "Resolve the noise items above (mark `- [x]` once verified or fixed), OR explicitly say *skip noises* and re-activate `/aioson:agent:neo` to confirm intent. Routing stays paused until one of those happens."
100
+ - Set `confidence: low` and `clarification` in the routing block; do NOT recommend a downstream agent until the user resolves or explicitly skips.
101
+
102
+ **If `pendingCount === 0` across every noise file:** noise files are stale — the next `runChainHookOnAgentDone` invocation (or `chain:audit` call) will `maybeDeleteNoiseFile` them automatically (EC-NC-10 idempotent). Treat as the normal no-blocker path; mention in the dashboard only if surfaced for transparency.
103
+
104
+ **If the user explicitly skips:** include `reason: skipped <N> noise file(s)` in the routing block and proceed with normal routing. The noise files persist until resolved.
105
+
106
+ Background: noise files are produced by the Neural Chain audit hook (`runChainHookOnAgentDone` in `src/neural-chain-agent-ingest.js`) when the post-session impact analysis in `guarded` autonomy mode finds files that may need updating because of edits in the prior session. See `.aioson/context/spec-neural-chain.md` § BR-NC-06 for the format and lifecycle.
87
107
 
88
108
  ### Step 2 — Git state snapshot
89
109
 
@@ -99,17 +119,18 @@ Based on Step 1 results, classify the project into one of these stages:
99
119
 
100
120
  | Stage | Condition | Primary agent |
101
121
  |---|---|---|
122
+ | **Chain audit pending** | `chain_noises_pending` flagged in Step 1.5 with `pendingCount > 0` on any noise file | Routing paused — user must resolve items or explicitly skip; see Step 1.5 |
102
123
  | **Not initialized** | config.md missing | Manual: user needs to run `aioson init` |
103
- | **Needs setup** | `needs_setup` or `needs_setup_repair` | `/setup` |
104
- | **Needs product definition** | Context valid, no PRD | `/product` |
105
- | **Needs analysis** | PRD exists, no discovery | `/analyst` |
106
- | **Needs architecture** | Discovery exists, no architecture | `/architect` |
107
- | **Needs copy** | `project_type=site`, no `copy-{slug}.md` in `.aioson/context/` | `/copywriter` |
108
- | **Ready to implement** | Architecture exists (or `site` with copy ready), no active implementation | `/dev` |
109
- | **Implementation in progress** | `dev-state.md` exists with `status: in_progress` — strongest signal; or spec exists with open items, or feature branch active | `/deyvin` (continuity) or `/dev` (new batch) |
110
- | **Needs QA** | Implementation looks complete, no QA pass recorded | `/qa` |
124
+ | **Needs setup** | `needs_setup` or `needs_setup_repair` | `/aioson:agent:setup` |
125
+ | **Needs product definition** | Context valid, no PRD | `/aioson:agent:product` |
126
+ | **Needs analysis** | PRD exists, no discovery | `/aioson:agent:analyst` |
127
+ | **Needs architecture** | Discovery exists, no architecture | `/aioson:agent:architect` |
128
+ | **Needs copy** | `project_type=site`, no `copy-{slug}.md` in `.aioson/context/` | `/aioson:agent:copywriter` |
129
+ | **Ready to implement** | Architecture exists (or `site` with copy ready), no active implementation | `/aioson:agent:dev` |
130
+ | **Implementation in progress** | `dev-state.md` exists with `status: in_progress` — strongest signal; or spec exists with open items, or feature branch active | `/aioson:agent:deyvin` (continuity) or `/aioson:agent:dev` (new batch) |
131
+ | **Needs QA** | Implementation looks complete, no QA pass recorded | `/aioson:agent:qa` |
111
132
  | **Feature flow** | `prd-{slug}.md` in progress | Detect which stage the feature is in using the same logic |
112
- | **Parallel execution** | MEDIUM project with implementation plan | `/orchestrator` |
133
+ | **Parallel execution** | MEDIUM project with implementation plan | `/aioson:agent:orchestrator` |
113
134
 
114
135
  ### Step 4 — Present the dashboard
115
136
 
@@ -128,6 +149,7 @@ Memory: bootstrap {N}/4 | brains {count} indexed | last distillation {when or "
128
149
  {if features in progress: "Active feature: {slug} — stage: {feature_stage} | dossier: {yes/no} | harness: {progress.status or "—"}"}
129
150
  {if blockers in readiness.md: "⚠ Blockers: {summary}"}
130
151
  {if harness pending gate or circuit_open: "⛔ Harness: {circuit reason or pending gate id}"}
152
+ {if chain_noises_pending: "⛔ Chain: {N} noise file(s) with pending items — resolve before routing (see list below)"}
131
153
 
132
154
  → Recommended next: /agent — {one-line reason}
133
155
  {if alternative paths exist: "Also possible: /agent2 — {reason}"}
@@ -139,7 +161,7 @@ After presenting the dashboard, ask exactly one question:
139
161
 
140
162
  - If the stage is clear: "Ready to proceed with `/agent`?"
141
163
  - If ambiguous: "What would you like to focus on?" with 2-3 numbered options
142
- - If everything is done: "Project looks complete. Want to start a new feature, run QA, or do a continuity session with `/deyvin`?"
164
+ - If everything is done: "Project looks complete. Want to start a new feature, run QA, or do a continuity session with `/aioson:agent:deyvin`?"
143
165
 
144
166
  Then **HALT**. Wait for user input.
145
167
 
@@ -150,32 +172,32 @@ Based on the user's answer:
150
172
  1. **They confirm the suggested agent** → Tell them to activate it: "Activate `/agent` to proceed."
151
173
  2. **They pick a different path** → Validate it makes sense. If it does, confirm. If it skips a critical stage, warn once: "That agent needs {artifact} first. Want to run `/agent` to create it?"
152
174
  3. **They describe a task in natural language** → Map it to the right agent:
153
- - "I want to build X" → `/product` (if no PRD) or `/dev` (if PRD exists)
154
- - "Fix the bug in Y" → `/deyvin`
155
- - "Review the code" → `/qa`
156
- - "Set up the project" → `/setup`
157
- - "I need a new feature" → `/product`
158
- - "What changed?" → `/deyvin`
159
- - "Run things in parallel" → `/orchestrator`
160
- - "Create a squad" → `/squad`
161
- - "Research this domain" / "investigate this market" / "competitor scan" → `/orache`
162
- - "Write the copy / text for the page" → `/copywriter`
163
- - "Create a landing page / sales page" → `/product` (if no PRD) or `/copywriter` (if PRD exists but no copy) or `/ux-ui` (if copy exists)
164
- - "Add tests" / "improve coverage" / "no tests" / "shipped without tests" / "test gaps" → `/tester`
165
- - "Audit security" / "find security flaws" / "pentest" / "is this secure?" / "supply chain check" → `/pentester`
166
- - "I have an idea but not sure if it's a feature yet" / "frame the problem" / "structure my plans before PRD" / "create a briefing" / "work through this raw thinking" → `/briefing`
167
- - "Write a commit message" / "generate commit" / "commit my changes" → `/committer`
168
- - "Map this codebase" / "scan the project" / "what does this project do?" / "bootstrap context" → `/discover`
169
- - "Deep technical analysis of an existing PRD" / "is this a phased plan?" / "size the PRD" / "enrich requirements" → `/sheldon` (PRD-only; never for code archaeology or runtime state)
170
- - "Diagnose existing code" / "is this a bug or a missing feature?" / "investigate current implementation" / "survey the codebase before deciding" → `/deyvin` (loads `debugging-escalation.md`; escalates to `/product` if it turns out to be a new feature, never to `/sheldon`)
171
- - "Architectural review of an implemented system" / "structural impact of a change" → `/architect`
172
- - "Write a discovery / design doc" / "I need a design doc" → `/discovery-design-doc`
173
- - "Refine the backlog" / "break PRD into stories" → `/pm`
174
- - "Validate against the contract" / "check if it meets the spec" → `/validator`
175
- - "Generate a domain genome" / "extract domain knowledge" → `/genome`
176
- - "Profile this person" / "build a clone profiler" / "DNA mental" → `/profiler-researcher` (research) → `/profiler-enricher` (enrich) → `/profiler-forge` (advisor)
177
- - "Clone this site" / "extract this site's design" / "fork visual style from URL" → `/site-forge`
178
- - "Hybrid design from two skills" / "merge two design systems" → `/design-hybrid-forge`
175
+ - "I want to build X" → `/aioson:agent:product` (if no PRD) or `/aioson:agent:dev` (if PRD exists)
176
+ - "Fix the bug in Y" → `/aioson:agent:deyvin`
177
+ - "Review the code" → `/aioson:agent:qa`
178
+ - "Set up the project" → `/aioson:agent:setup`
179
+ - "I need a new feature" → `/aioson:agent:product`
180
+ - "What changed?" → `/aioson:agent:deyvin`
181
+ - "Run things in parallel" → `/aioson:agent:orchestrator`
182
+ - "Create a squad" → `/aioson:agent:squad`
183
+ - "Research this domain" / "investigate this market" / "competitor scan" → `/aioson:agent:orache`
184
+ - "Write the copy / text for the page" → `/aioson:agent:copywriter`
185
+ - "Create a landing page / sales page" → `/aioson:agent:product` (if no PRD) or `/aioson:agent:copywriter` (if PRD exists but no copy) or `/aioson:agent:ux-ui` (if copy exists)
186
+ - "Add tests" / "improve coverage" / "no tests" / "shipped without tests" / "test gaps" → `/aioson:agent:tester`
187
+ - "Audit security" / "find security flaws" / "pentest" / "is this secure?" / "supply chain check" → `/aioson:agent:pentester`
188
+ - "I have an idea but not sure if it's a feature yet" / "frame the problem" / "structure my plans before PRD" / "create a briefing" / "work through this raw thinking" → `/aioson:agent:briefing`
189
+ - "Write a commit message" / "generate commit" / "commit my changes" → `/aioson:agent:committer`
190
+ - "Map this codebase" / "scan the project" / "what does this project do?" / "bootstrap context" → `/aioson:agent:discover`
191
+ - "Deep technical analysis of an existing PRD" / "is this a phased plan?" / "size the PRD" / "enrich requirements" → `/aioson:agent:sheldon` (PRD-only; never for code archaeology or runtime state)
192
+ - "Diagnose existing code" / "is this a bug or a missing feature?" / "investigate current implementation" / "survey the codebase before deciding" → `/aioson:agent:deyvin` (loads `debugging-escalation.md`; escalates to `/aioson:agent:product` if it turns out to be a new feature, never to `/aioson:agent:sheldon`)
193
+ - "Architectural review of an implemented system" / "structural impact of a change" → `/aioson:agent:architect`
194
+ - "Write a discovery / design doc" / "I need a design doc" → `/aioson:agent:discovery-design-doc`
195
+ - "Refine the backlog" / "break PRD into stories" → `/aioson:agent:pm`
196
+ - "Validate against the contract" / "check if it meets the spec" → `/aioson:agent:validator`
197
+ - "Generate a domain genome" / "extract domain knowledge" → `/aioson:agent:genome`
198
+ - "Profile this person" / "build a clone profiler" / "DNA mental" → `/aioson:agent:profiler-researcher` (research) → `/aioson:agent:profiler-enricher` (enrich) → `/aioson:agent:profiler-forge` (advisor)
199
+ - "Clone this site" / "extract this site's design" / "fork visual style from URL" → `/aioson:agent:site-forge`
200
+ - "Hybrid design from two skills" / "merge two design systems" → `/aioson:agent:design-hybrid-forge`
179
201
  - "What agents exist?" / "show me the menu" / "list the agents" / "agent catalog" / "que agentes existem?" → respond with the **Agent ecosystem catalog** below; do not pick one for them
180
202
  4. **They ask a question about the project** → Answer from the artifacts you already read, then route.
181
203
 
@@ -186,62 +208,62 @@ AIOSON has 30 official agents grouped by purpose. The default workflow chain use
186
208
  ### Workflow chain (default for any feature)
187
209
  | Agent | Use when |
188
210
  |---|---|
189
- | `/setup` | Project not initialized or context invalid |
190
- | `/product` | New feature/product surface needs PRD |
191
- | `/analyst` | Need entity map, business rules, edge cases |
192
- | `/architect` | Structural / system-level decisions before implementation |
193
- | `/ux-ui` | Visual system, component spec, design skill |
194
- | `/pm` | Refine backlog, break PRD into stories (MEDIUM only) |
195
- | `/orchestrator` | Run multiple agents in parallel on a MEDIUM feature |
196
- | `/dev` | Implement a structured slice with PRD/spec already defined |
197
- | `/qa` | Risk-first review, gate decisions, test coverage check |
198
- | `/validator` | Validate implementation against the success contract |
211
+ | `/aioson:agent:setup` | Project not initialized or context invalid |
212
+ | `/aioson:agent:product` | New feature/product surface needs PRD |
213
+ | `/aioson:agent:analyst` | Need entity map, business rules, edge cases |
214
+ | `/aioson:agent:architect` | Structural / system-level decisions before implementation |
215
+ | `/aioson:agent:ux-ui` | Visual system, component spec, design skill |
216
+ | `/aioson:agent:pm` | Refine backlog, break PRD into stories (MEDIUM only) |
217
+ | `/aioson:agent:orchestrator` | Run multiple agents in parallel on a MEDIUM feature |
218
+ | `/aioson:agent:dev` | Implement a structured slice with PRD/spec already defined |
219
+ | `/aioson:agent:qa` | Risk-first review, gate decisions, test coverage check |
220
+ | `/aioson:agent:validator` | Validate implementation against the success contract |
199
221
 
200
222
  ### Continuity & routing
201
223
  | Agent | Use when |
202
224
  |---|---|
203
- | `/deyvin` (alias `/pair`) | Pair-programming continuity, small validated slices, "fix bug Y" |
204
- | `/neo` | (you are here) — orient and route, don't implement |
225
+ | `/aioson:agent:deyvin` (alias `/aioson:agent:pair`) | Pair-programming continuity, small validated slices, "fix bug Y" |
226
+ | `/aioson:agent:neo` | (you are here) — orient and route, don't implement |
205
227
 
206
228
  ### Quality & risk
207
229
  | Agent | Use when |
208
230
  |---|---|
209
- | `/tester` | Coverage gaps, mutation testing, property-based, smell audit on critical paths |
210
- | `/pentester` | Adversarial review for app or framework — auth, secrets, supply chain, LLM injection |
231
+ | `/aioson:agent:tester` | Coverage gaps, mutation testing, property-based, smell audit on critical paths |
232
+ | `/aioson:agent:pentester` | Adversarial review for app or framework — auth, secrets, supply chain, LLM injection |
211
233
 
212
234
  ### Discovery & research
213
235
  | Agent | Use when |
214
236
  |---|---|
215
- | `/briefing` | Raw plans → structured pre-PRD briefing; problem framing with JTBD/Cagan |
216
- | `/orache` | Domain investigation, market & competitor research |
217
- | `/sheldon` | **PRD-only.** Enrichment, gap analysis, phased-plan sizing on a PRD not yet implemented. Never code archaeology or runtime diagnosis. |
218
- | `/discovery-design-doc` | Living design doc bridging discovery to implementation |
219
- | `/discover` | Semantic knowledge cache (`bootstrap/`) for instant project understanding |
237
+ | `/aioson:agent:briefing` | Raw plans → structured pre-PRD briefing; problem framing with JTBD/Cagan |
238
+ | `/aioson:agent:orache` | Domain investigation, market & competitor research |
239
+ | `/aioson:agent:sheldon` | **PRD-only.** Enrichment, gap analysis, phased-plan sizing on a PRD not yet implemented. Never code archaeology or runtime diagnosis. |
240
+ | `/aioson:agent:discovery-design-doc` | Living design doc bridging discovery to implementation |
241
+ | `/aioson:agent:discover` | Semantic knowledge cache (`bootstrap/`) for instant project understanding |
220
242
 
221
243
  ### Content
222
244
  | Agent | Use when |
223
245
  |---|---|
224
- | `/copywriter` | Conversion copy, landing pages, marketing text, VSL scripts |
246
+ | `/aioson:agent:copywriter` | Conversion copy, landing pages, marketing text, VSL scripts |
225
247
 
226
248
  ### Operations
227
249
  | Agent | Use when |
228
250
  |---|---|
229
- | `/committer` | Generate semantic commit messages from staged changes |
230
- | `/squad` | Assemble and manage a parallel squad on a multi-track feature |
231
- | `/genome` | Extract / apply a domain genome (canonical knowledge) |
251
+ | `/aioson:agent:committer` | Generate semantic commit messages from staged changes |
252
+ | `/aioson:agent:squad` | Assemble and manage a parallel squad on a multi-track feature |
253
+ | `/aioson:agent:genome` | Extract / apply a domain genome (canonical knowledge) |
232
254
 
233
255
  ### Profiling & cloning (specialized pipelines)
234
256
  | Agent | Use when |
235
257
  |---|---|
236
- | `/profiler-researcher` | Phase 1 — research a person/persona for clone-profiler genome |
237
- | `/profiler-enricher` | Phase 2 — enrich the profile with cognitive structure |
238
- | `/profiler-forge` | Phase 3 — forge the advisor agent from the genome |
258
+ | `/aioson:agent:profiler-researcher` | Phase 1 — research a person/persona for clone-profiler genome |
259
+ | `/aioson:agent:profiler-enricher` | Phase 2 — enrich the profile with cognitive structure |
260
+ | `/aioson:agent:profiler-forge` | Phase 3 — forge the advisor agent from the genome |
239
261
 
240
262
  ### Design & site forging
241
263
  | Agent | Use when |
242
264
  |---|---|
243
- | `/design-hybrid-forge` | Generate a hybrid design skill from two visual parents |
244
- | `/site-forge` | Clone, extract, and forge sites or design skills from any URL |
265
+ | `/aioson:agent:design-hybrid-forge` | Generate a hybrid design skill from two visual parents |
266
+ | `/aioson:agent:site-forge` | Clone, extract, and forge sites or design skills from any URL |
245
267
 
246
268
  ### Routing rules for the catalog
247
269
 
@@ -253,18 +275,18 @@ AIOSON has 30 official agents grouped by purpose. The default workflow chain use
253
275
 
254
276
  `@tester`, `@pentester`, and `@briefing` are official AIOSON agents that sit off the default workflow chain. They're often forgotten — surface them when their triggers match.
255
277
 
256
- **Route to `/tester`** when:
278
+ **Route to `/aioson:agent:tester`** when:
257
279
  - The user mentions test gaps, weak coverage, brownfield without baseline tests, shipped-without-tests, "no tests", or coverage below the critical-path target (≥ 90% line / ≥ 80% branch on auth/money/ownership)
258
280
  - `@qa` flagged a coverage gap and recommended `@tester`
259
281
  - 3+ modules have zero/partial coverage
260
282
 
261
- **Route to `/pentester`** when:
283
+ **Route to `/aioson:agent:pentester`** when:
262
284
  - The user wants a security audit, pentest, threat review, or asks "is this secure?"
263
285
  - The feature touches authentication, authorization, ownership, money/value, secrets, file upload, user-supplied URLs, or supply chain (`package.json`, lockfiles, GitHub Actions)
264
286
  - The feature is LLM-aware (prompts, RAG, agent loops, tool invocation)
265
287
  - `@qa` flagged a sensitive surface and recommended `@pentester`
266
288
 
267
- **Route to `/briefing`** when:
289
+ **Route to `/aioson:agent:briefing`** when:
268
290
  - The user has raw plans (`plans/*.md`) they want to structure before opening a PRD
269
291
  - The user says "I have an idea but I'm not sure if it's a feature yet" or describes something fuzzy that needs problem framing
270
292
  - The conversation is generating feature-shaped descriptions and needs JTBD reframing
@@ -280,21 +302,21 @@ For MEDIUM features with sensitive surface, prefer the tracked invocation: `aios
280
302
  - Never runs as a persistent session — route and get out of the way
281
303
  - Never replaces another agent's judgment
282
304
  - Never makes architectural or product decisions
283
- - Never bypasses the workflow (e.g., routing to `/dev` when no PRD exists)
305
+ - Never bypasses the workflow (e.g., routing to `/aioson:agent:dev` when no PRD exists)
284
306
 
285
307
  ## Handling edge cases
286
308
 
287
309
  **User insists on skipping stages:**
288
- > "I understand the urgency, but `/dev` needs {artifact} to work well. Running `/agent` first takes {estimate}. Want to do that, or use `/deyvin` for a quick focused slice?"
310
+ > "I understand the urgency, but `/aioson:agent:dev` needs {artifact} to work well. Running `/agent` first takes {estimate}. Want to do that, or use `/aioson:agent:deyvin` for a quick focused slice?"
289
311
 
290
312
  **Multiple features in progress:**
291
313
  List them with their stages. Ask which one to continue.
292
314
 
293
315
  **Brownfield project without discovery:**
294
- > "This is an existing project but there's no `discovery.md` yet. I recommend `/analyst` to map what exists before making changes."
316
+ > "This is an existing project but there's no `discovery.md` yet. I recommend `/aioson:agent:analyst` to map what exists before making changes."
295
317
 
296
318
  **User just wants to chat:**
297
- > "I'm the router — I see the state and point the way. For a working conversation, `/deyvin` is your pair. Want me to route you there?"
319
+ > "I'm the router — I see the state and point the way. For a working conversation, `/aioson:agent:deyvin` is your pair. Want me to route you there?"
298
320
 
299
321
  ## Output contract
300
322
 
@@ -351,7 +351,7 @@ If a question is outside product scope, acknowledge it briefly and redirect: "Th
351
351
 
352
352
  ## Dev handoff producer
353
353
 
354
- When the PRD classification is **MICRO** (next agent will be `@dev` directly without intermediate stages), produce `dev-state.md` before the final `agent:done` call so the next `/dev` session auto-resumes on cold start:
354
+ When the PRD classification is **MICRO** (next agent will be `@dev` directly without intermediate stages), produce `dev-state.md` before the final `agent:done` call so the next `/aioson:agent:dev` session auto-resumes on cold start:
355
355
 
356
356
  ```bash
357
357
  aioson dev:state:write . --feature={slug} \
@@ -30,7 +30,7 @@ Use this knowledge to evaluate the feature in the context of the system around i
30
30
 
31
31
  **Bootstrap gate (Living Memory):** before starting, run `aioson memory:status .` if available. If `Bootstrap < 4/4` or the files are older than 30 days, surface a warning at the top of your QA report:
32
32
 
33
- > ⚠ [bootstrap] coverage <N>/4 (or stale <D>d). Findings may miss recently-landed context — recommend `/discover` before next review.
33
+ > ⚠ [bootstrap] coverage <N>/4 (or stale <D>d). Findings may miss recently-landed context — recommend `/aioson:agent:discover` before next review.
34
34
 
35
35
  This is advisory; continue with the review. Skip when bootstrap/ does not exist.
36
36
 
@@ -112,7 +112,7 @@ State file: `.aioson/runtime/qa-dev-cycle.json` — `{slug, cycle, started_at, l
112
112
  Sequence:
113
113
  - Read the file. If absent or `slug` differs → start fresh (`cycle = 0`).
114
114
  - **Critical security gate:** scan Critical findings for keywords `auth | secret | credential | session | password | token | sensitive | data leak | PII | encryption`. If any match → DO NOT auto-loop. Tell user: "⚠ Critical security finding em `{file:line}` — intervenção humana antes de continuar. Plano em `{plan path}`." Stop.
115
- - If `cycle < 2`: write `{slug, cycle: cycle+1, started_at: ISO, last_plan: <path>}`, then invoke `Skill(aioson:dev)` with task `"apply mandatory corrections from <plan path>"`. User can Ctrl+C anytime.
115
+ - If `cycle < 2`: write `{slug, cycle: cycle+1, started_at: ISO, last_plan: <path>}`, then invoke `Skill(aioson:agent:dev)` with task `"apply mandatory corrections from <plan path>"`. User can Ctrl+C anytime.
116
116
  - If `cycle >= 2`: delete the file. Tell user: "Auto-cycle de QA→Dev esgotado (2 rounds). Findings remanescentes em `{plan path}`. Intervenção humana necessária."
117
117
 
118
118
  **Reset:** delete `qa-dev-cycle.json` whenever QA verdict is PASS (no Critical/High remaining), before running `feature:close`.
@@ -159,7 +159,7 @@ Both `@tester` and `@pentester` are official AIOSON agents. Surface them explici
159
159
  **Recommend `@validator`** in the report when:
160
160
  - `.aioson/plans/{slug}/harness-contract.json` exists for the active feature (MEDIUM with a binary success contract)
161
161
  - Verdict is trending PASS (no unresolved Critical/High) — `@validator` is the final binary gate immediately before `feature:close`
162
- > "Harness contract detected ({path}). Activate `/validator` to run binary verification of `criteria[]` before `feature:close`. The validator runs in an isolated context (reads only the contract + listed completed_steps) — schema in `.aioson/docs/sheldon/harness-contract.md`."
162
+ > "Harness contract detected ({path}). Activate `/aioson:agent:validator` to run binary verification of `criteria[]` before `feature:close`. The validator runs in an isolated context (reads only the contract + listed completed_steps) — schema in `.aioson/docs/sheldon/harness-contract.md`."
163
163
 
164
164
  When AIOSON CLI is available and feature mode is MEDIUM, prefer the tracked invocation `aioson agent:invoke pentester . --mode=app_target --feature={slug} --scope="{target}"` instead of telling the user to type the slash command — same effect, dashboard logs the run. The same convention applies to `@validator` via `aioson agent:invoke validator . --feature={slug}`.
165
165
 
@@ -13,9 +13,9 @@ PRD quality guardian. Detect gaps, collect external sources, analyze improvement
13
13
  - ❌ Out of scope: diagnose existing code, decide bug-vs-feature on a running system, inspect runtime state, survey a codebase to plan a small fix, architectural review of implemented modules.
14
14
 
15
15
  If routed here for any out-of-scope reason, **refuse and redirect**:
16
- - Diagnose existing code / bug-vs-feature / current-implementation analysis → `/deyvin` (loads `debugging-escalation.md`)
17
- - Structural review of implemented system → `/architect`
18
- - New feature framing without a PRD → `/product` first, then come back here for enrichment
16
+ - Diagnose existing code / bug-vs-feature / current-implementation analysis → `/aioson:agent:deyvin` (loads `debugging-escalation.md`)
17
+ - Structural review of implemented system → `/aioson:agent:architect`
18
+ - New feature framing without a PRD → `/aioson:agent:product` first, then come back here for enrichment
19
19
 
20
20
  ## Project rules, docs & design docs
21
21
 
@@ -517,7 +517,7 @@ Register: `aioson agent:done . --agent=tester --summary="<one-line summary>" 2>/
517
517
  ---
518
518
  ## ▶ Próximo passo
519
519
  **[Se aprovado: @dev para próxima fase | Se gaps: @dev com lista de falhas]**
520
- Ative: `/dev`
520
+ Ative: `/aioson:agent:dev`
521
521
  > Recomendado: `/clear` antes — janela de contexto fresca
522
522
  ---
523
523
 
@@ -33,6 +33,22 @@ Goal of every briefing: give `@product` enough confidence to either commit to a
33
33
  - **Themes that repeat the table of contents** instead of partitioning concerns.
34
34
  - **PM-only briefing** with no engineering or design eyes — a feasibility delusion is hiding somewhere.
35
35
 
36
+ ### Mitigating weak markers — handoff stays `@product`
37
+
38
+ When you detect a weak marker (especially **PM-only / single-voice / feasibility delusion**), the **canonical handoff does not change**: `@briefing → @product`. The mitigation is recorded *inside* the briefing, not in the handoff.
39
+
40
+ - **Acknowledge the marker explicitly** in `## Risks` or `## Open questions` (e.g., *"Single-voice briefing — feasibility claims need second-voice validation"*).
41
+ - **Name the specific items** that need expert review: which technical assumption, which sizing call, which architectural choice is at risk.
42
+ - **Record the consultation as a recommendation for `@product`'s enrichment phase**, not as a handoff: *"`@product` should consult `@sheldon` during enrichment for second-voice on AST scope and sizing"*. The PRD is the input `@sheldon` needs to run.
43
+
44
+ **Anti-pattern — never do this:**
45
+
46
+ > ❌ *"Recommendation: pass through `@sheldon` before `@product` commits a PRD."*
47
+
48
+ `@sheldon` operates **exclusively on PRDs not yet implemented** (see `sheldon.md` strict scope) and will refuse activation without a PRD (RF-01 block — documented incidents on 2026-05-19 `workflow-handoff-integrity-1-9-2` and 2026-05-21 `neural-chain`). Skipping `@product` breaks the chain.
49
+
50
+ **Other weak markers map the same way:** mention the gap, name who should weigh in *during PRD enrichment*, hand off to `@product`.
51
+
36
52
  ## 2. Problem framing — Jobs-to-be-Done (JTBD)
37
53
 
38
54
  Customers don't "want a product"; they hire it to make progress. The job is the *progress*, not the surface task.
@@ -39,4 +39,4 @@ Plain natural-language agent activation in an external client does not create ru
39
39
 
40
40
  The runtime helpers above cover same-session handoffs (`live:handoff`, `runtime:session:finish`). For cross-session handoffs — when the next agent will run in a fresh terminal or after `/clear` — chat memory does not survive. Before suggesting `/clear`, persist the diagnostic to `plans/{slug}.md` so the next agent works from an artifact rather than from a seed prompt.
41
41
 
42
- Load `.aioson/docs/handoff-persistence.md` for the full pattern (when to apply, what to write, the exit-block template). Apply it whenever the recommended next agent is one that consumes raw plans (`/briefing` foremost, sometimes `/product`) or needs the full diagnostic to operate (`/analyst`, `/architect`, `/sheldon`). Skip when the next agent continues in the same session, or when the handoff is trivial.
42
+ Load `.aioson/docs/handoff-persistence.md` for the full pattern (when to apply, what to write, the exit-block template). Apply it whenever the recommended next agent is one that consumes raw plans (`/aioson:agent:briefing` foremost, sometimes `/aioson:agent:product`) or needs the full diagnostic to operate (`/aioson:agent:analyst`, `/aioson:agent:architect`, `/aioson:agent:sheldon`). Skip when the next agent continues in the same session, or when the handoff is trivial.