@jaimevalasek/aioson 1.36.0 → 1.37.1

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 (105) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/docs/en/1-understand/ecosystem-map.md +1 -1
  3. package/docs/en/1-understand/glossary.md +1 -1
  4. package/docs/en/2-start/first-project.md +1 -1
  5. package/docs/en/2-start/initial-decisions.md +4 -2
  6. package/docs/en/3-recipes/from-idea-to-prd-via-briefing.md +8 -1
  7. package/docs/en/3-recipes/full-feature-with-sheldon.md +3 -1
  8. package/docs/en/4-agents/README.md +6 -3
  9. package/docs/en/4-agents/briefing-refiner.md +146 -0
  10. package/docs/en/5-reference/README.md +1 -0
  11. package/docs/en/5-reference/autopilot-handoff.md +286 -0
  12. package/docs/en/5-reference/cli-reference.md +6 -0
  13. package/docs/pt/1-entender/glossario.md +1 -1
  14. package/docs/pt/1-entender/mapa-do-ecossistema.md +1 -1
  15. package/docs/pt/2-comecar/decisoes-iniciais.md +4 -2
  16. package/docs/pt/2-comecar/primeiro-projeto.md +1 -1
  17. package/docs/pt/3-receitas/da-ideia-ao-prd-via-briefing.md +8 -1
  18. package/docs/pt/3-receitas/feature-completa-com-sheldon.md +3 -1
  19. package/docs/pt/4-agentes/README.md +13 -11
  20. package/docs/pt/4-agentes/briefing-refiner.md +64 -40
  21. package/docs/pt/4-agentes/briefing.md +6 -1
  22. package/docs/pt/4-agentes/dev.md +19 -1
  23. package/docs/pt/4-agentes/deyvin.md +4 -0
  24. package/docs/pt/4-agentes/discover.md +4 -0
  25. package/docs/pt/4-agentes/neo.md +4 -0
  26. package/docs/pt/4-agentes/orache.md +6 -0
  27. package/docs/pt/4-agentes/orchestrator.md +12 -0
  28. package/docs/pt/4-agentes/pentester.md +6 -0
  29. package/docs/pt/4-agentes/product.md +19 -1
  30. package/docs/pt/4-agentes/qa.md +10 -2
  31. package/docs/pt/4-agentes/setup.md +3 -1
  32. package/docs/pt/4-agentes/sheldon.md +12 -0
  33. package/docs/pt/4-agentes/tester.md +6 -0
  34. package/docs/pt/4-agentes/ux-ui.md +2 -1
  35. package/docs/pt/5-referencia/README.md +1 -1
  36. package/docs/pt/5-referencia/agent-chain-continuity.md +1 -1
  37. package/docs/pt/5-referencia/autopilot-handoff.md +191 -74
  38. package/docs/pt/5-referencia/comandos-cli.md +16 -7
  39. package/docs/pt/5-referencia/skills.md +2 -0
  40. package/docs/pt/agentes.md +3 -1
  41. package/package.json +1 -1
  42. package/src/agent-execution/adapters/base.js +15 -0
  43. package/src/agent-execution/adapters/claude.js +3 -0
  44. package/src/agent-execution/adapters/codex.js +3 -0
  45. package/src/agent-execution/adapters/opencode.js +3 -0
  46. package/src/agent-execution/capabilities.js +9 -0
  47. package/src/agent-execution/dispatcher.js +72 -0
  48. package/src/agent-execution/executable-resolver.js +7 -0
  49. package/src/agent-execution/manifest.js +62 -0
  50. package/src/agent-execution/model-catalog.js +80 -0
  51. package/src/agent-execution/model-resolver.js +132 -0
  52. package/src/agent-execution/reports.js +9 -0
  53. package/src/agent-execution/schema.js +48 -0
  54. package/src/agent-execution/telemetry-bridge.js +15 -0
  55. package/src/agents.js +1 -1
  56. package/src/artifact-kinds.js +2 -1
  57. package/src/autopilot-signal.js +71 -0
  58. package/src/cli.js +31 -5
  59. package/src/commands/agent-execution.js +36 -0
  60. package/src/commands/agents.js +18 -2
  61. package/src/commands/briefing.js +337 -1
  62. package/src/commands/feature-close.js +136 -43
  63. package/src/commands/live.js +47 -11
  64. package/src/commands/op-capture.js +33 -3
  65. package/src/commands/op-reinforce.js +10 -22
  66. package/src/commands/update.js +5 -1
  67. package/src/commands/verification-plan.js +56 -12
  68. package/src/commands/verify-artifact.js +64 -1
  69. package/src/commands/workflow-execute.js +168 -36
  70. package/src/commands/workflow-next.js +60 -16
  71. package/src/doctor.js +4 -2
  72. package/src/harness/criteria-runner.js +4 -1
  73. package/src/i18n/messages/en.js +2 -1
  74. package/src/i18n/messages/es.js +2 -1
  75. package/src/i18n/messages/fr.js +2 -1
  76. package/src/i18n/messages/pt-BR.js +2 -1
  77. package/src/lib/briefing-refiner/apply-feedback.js +18 -4
  78. package/src/lib/briefing-refiner/feedback-schema.js +73 -4
  79. package/src/lib/briefing-refiner/refinement-report.js +11 -0
  80. package/src/lib/briefing-refiner/review-html.js +388 -68
  81. package/src/operator-memory/decision.js +41 -0
  82. package/src/parser.js +6 -0
  83. package/src/runtime-store.js +167 -8
  84. package/template/.aioson/agents/briefing-refiner.md +87 -47
  85. package/template/.aioson/agents/briefing.md +4 -0
  86. package/template/.aioson/agents/dev.md +9 -2
  87. package/template/.aioson/agents/deyvin.md +4 -0
  88. package/template/.aioson/agents/discover.md +4 -0
  89. package/template/.aioson/agents/neo.md +4 -0
  90. package/template/.aioson/agents/orache.md +4 -0
  91. package/template/.aioson/agents/orchestrator.md +16 -0
  92. package/template/.aioson/agents/pentester.md +4 -0
  93. package/template/.aioson/agents/product.md +26 -1
  94. package/template/.aioson/agents/qa.md +5 -1
  95. package/template/.aioson/agents/sheldon.md +9 -1
  96. package/template/.aioson/agents/tester.md +4 -0
  97. package/template/.aioson/agents/ux-ui.md +1 -1
  98. package/template/.aioson/docs/agent-help.md +126 -0
  99. package/template/.aioson/docs/autopilot-handoff.md +32 -16
  100. package/template/.aioson/docs/dev/phase-loop.md +9 -7
  101. package/template/.aioson/docs/play/llm-data-and-bindings.md +70 -7
  102. package/template/.aioson/schemas/agent-execution.schema.json +28 -0
  103. package/template/.aioson/skills/design/interface-design/SKILL.md +17 -0
  104. package/template/AGENTS.md +36 -36
  105. package/template/CLAUDE.md +1 -1
package/src/parser.js CHANGED
@@ -30,6 +30,9 @@ function parseArgv(argv) {
30
30
  'help', 'version', 'no-launch', 'attach', 'tmux',
31
31
  'allow-warnings', 'install-hook', 'uninstall-hook', 'remove-hook',
32
32
  'agent-safe', 'agentic',
33
+ // workflow:execute — pure booleans; `--seed .` / `--step .` must not
34
+ // swallow the path positional as their value.
35
+ 'seed', 'seed-only', 'step',
33
36
  'selective',
34
37
  'status', 'suggest', 'apply',
35
38
  'runtime-only', 'template-only', 'inception', 'locales',
@@ -44,6 +47,9 @@ function parseArgv(argv) {
44
47
  // verify:artifact — pure booleans; `--advisory .` / `--no-build .` must
45
48
  // not swallow the path positional.
46
49
  'advisory', 'no-build',
50
+ // briefing:apply-feedback — pure booleans; `--confirm .` / `--declined .`
51
+ // / `--allow-stale .` must not swallow the path positional.
52
+ 'confirm', 'declined', 'allow-stale',
47
53
  // `--resume` alone means "resume last"; `--resume=<id>` carries a value
48
54
  // and is handled by the `=` branch above. Without this entry, `--resume`
49
55
  // followed by `--tool=claude` would swallow the next token as its value.
@@ -176,7 +176,7 @@ async function openRuntimeDb(targetDir, options = {}) {
176
176
  FOREIGN KEY (run_key) REFERENCES agent_runs(run_key) ON DELETE CASCADE
177
177
  );
178
178
 
179
- CREATE TABLE IF NOT EXISTS execution_events (
179
+ CREATE TABLE IF NOT EXISTS execution_events (
180
180
  id INTEGER PRIMARY KEY AUTOINCREMENT,
181
181
  task_key TEXT,
182
182
  run_key TEXT,
@@ -199,7 +199,51 @@ async function openRuntimeDb(targetDir, options = {}) {
199
199
  created_at TEXT NOT NULL,
200
200
  FOREIGN KEY (task_key) REFERENCES tasks(task_key) ON DELETE SET NULL,
201
201
  FOREIGN KEY (run_key) REFERENCES agent_runs(run_key) ON DELETE CASCADE
202
- );
202
+ );
203
+
204
+ CREATE TABLE IF NOT EXISTS agent_execution_runs (
205
+ telemetry_run_id TEXT PRIMARY KEY,
206
+ dispatcher_run_id TEXT NOT NULL,
207
+ attempt_id TEXT NOT NULL,
208
+ feature TEXT NOT NULL,
209
+ agent TEXT NOT NULL,
210
+ host TEXT NOT NULL,
211
+ model TEXT NOT NULL,
212
+ model_requested TEXT,
213
+ model_resolved TEXT,
214
+ reasoning_effort TEXT,
215
+ model_resolution_strategy TEXT,
216
+ catalog_source TEXT,
217
+ state TEXT NOT NULL DEFAULT 'queued',
218
+ pid INTEGER,
219
+ process_fingerprint TEXT,
220
+ report_path TEXT,
221
+ report_digest TEXT,
222
+ reason TEXT,
223
+ truncated_bytes INTEGER NOT NULL DEFAULT 0,
224
+ dropped_events INTEGER NOT NULL DEFAULT 0,
225
+ created_at TEXT NOT NULL,
226
+ updated_at TEXT NOT NULL,
227
+ finished_at TEXT,
228
+ UNIQUE(feature, agent, dispatcher_run_id, attempt_id)
229
+ );
230
+
231
+ CREATE TABLE IF NOT EXISTS agent_execution_events (
232
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
233
+ telemetry_run_id TEXT NOT NULL,
234
+ sequence_no INTEGER NOT NULL,
235
+ schema_version INTEGER NOT NULL DEFAULT 1,
236
+ event_type TEXT NOT NULL,
237
+ stream TEXT,
238
+ safe_summary TEXT NOT NULL DEFAULT '',
239
+ payload_json TEXT,
240
+ bytes INTEGER NOT NULL DEFAULT 0,
241
+ created_at TEXT NOT NULL,
242
+ UNIQUE(telemetry_run_id, sequence_no),
243
+ FOREIGN KEY (telemetry_run_id) REFERENCES agent_execution_runs(telemetry_run_id) ON DELETE CASCADE
244
+ );
245
+ CREATE INDEX IF NOT EXISTS idx_agent_execution_events_cursor ON agent_execution_events(telemetry_run_id, sequence_no);
246
+ CREATE INDEX IF NOT EXISTS idx_agent_execution_runs_feature_updated ON agent_execution_runs(feature, updated_at DESC);
203
247
 
204
248
  CREATE TABLE IF NOT EXISTS artifacts (
205
249
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -650,8 +694,14 @@ function normalizeTaskStatus(value, fallback) {
650
694
  return VALID_TASK_STATUSES.has(candidate) ? candidate : fallback;
651
695
  }
652
696
 
653
- function ensureLegacyColumns(db) {
654
- const taskColumns = db.prepare('PRAGMA table_info(tasks)').all();
697
+ function ensureLegacyColumns(db) {
698
+ const executionRunColumns = db.prepare('PRAGMA table_info(agent_execution_runs)').all();
699
+ const executionRunColumnNames = new Set(executionRunColumns.map((column) => column.name));
700
+ for (const column of ['model_requested', 'model_resolved', 'reasoning_effort', 'model_resolution_strategy', 'catalog_source']) {
701
+ if (!executionRunColumnNames.has(column)) db.exec(`ALTER TABLE agent_execution_runs ADD COLUMN ${column} TEXT`);
702
+ }
703
+
704
+ const taskColumns = db.prepare('PRAGMA table_info(tasks)').all();
655
705
  const taskColumnNames = new Set(taskColumns.map((column) => column.name));
656
706
 
657
707
  if (!taskColumnNames.has('task_kind')) {
@@ -2619,9 +2669,115 @@ function insertEvolutionLog(db, opts) {
2619
2669
  return id;
2620
2670
  }
2621
2671
 
2622
- function listEvolutionLog(db, limit = 20) {
2672
+ function listEvolutionLog(db, limit = 20) {
2623
2673
  return db.prepare('SELECT * FROM evolution_log ORDER BY applied_at DESC LIMIT ?').all(limit);
2624
- }
2674
+ }
2675
+
2676
+ const EXECUTION_TERMINAL_STATES = new Set(['passed', 'failed', 'cancelled']);
2677
+ const EXECUTION_TRANSITIONS = {
2678
+ queued: new Set(['running', 'waiting_report', 'paused', 'failed', 'cancelled']),
2679
+ running: new Set(['waiting_report', 'paused', 'failed', 'cancelled']),
2680
+ waiting_report: new Set(['passed', 'failed', 'correcting', 'paused']),
2681
+ correcting: new Set(['running', 'paused', 'failed', 'cancelled']),
2682
+ paused: new Set(['running', 'cancelled'])
2683
+ };
2684
+
2685
+ function executionCorrelation(input) {
2686
+ return {
2687
+ feature: String(input.feature), agent: String(input.agent),
2688
+ dispatcherRunId: String(input.dispatcher_run_id || input.run_id),
2689
+ attemptId: String(input.attempt_id)
2690
+ };
2691
+ }
2692
+
2693
+ function findExecutionRun(db, input) {
2694
+ const c = executionCorrelation(input);
2695
+ return db.prepare(`SELECT * FROM agent_execution_runs WHERE feature=? AND agent=? AND dispatcher_run_id=? AND attempt_id=?`)
2696
+ .get(c.feature, c.agent, c.dispatcherRunId, c.attemptId) || null;
2697
+ }
2698
+
2699
+ function createExecutionRun(db, input) {
2700
+ const c = executionCorrelation(input); const now = nowIso();
2701
+ const id = input.telemetry_run_id || `aex-${slugify(c.feature)}-${require('node:crypto').randomUUID()}`;
2702
+ const modelResolved = String(input.model_resolved || input.model);
2703
+ const modelRequested = String(input.model_requested || input.model || '');
2704
+ db.prepare(`INSERT OR IGNORE INTO agent_execution_runs
2705
+ (telemetry_run_id,dispatcher_run_id,attempt_id,feature,agent,host,model,model_requested,model_resolved,reasoning_effort,model_resolution_strategy,catalog_source,state,created_at,updated_at)
2706
+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`).run(id,c.dispatcherRunId,c.attemptId,c.feature,c.agent,String(input.host),modelResolved,modelRequested,modelResolved,input.reasoning_effort?String(input.reasoning_effort):null,input.model_resolution_strategy?String(input.model_resolution_strategy):null,input.catalog_source?String(input.catalog_source):null,'queued',now,now);
2707
+ const run = findExecutionRun(db,input);
2708
+ appendExecutionEvent(db,run.telemetry_run_id,{type:'run_created',safe_summary:'Execution queued'});
2709
+ return run;
2710
+ }
2711
+
2712
+ function appendExecutionEvent(db, runOrCorrelation, event) {
2713
+ const run = typeof runOrCorrelation === 'string'
2714
+ ? db.prepare('SELECT * FROM agent_execution_runs WHERE telemetry_run_id=?').get(runOrCorrelation)
2715
+ : findExecutionRun(db,runOrCorrelation);
2716
+ if (!run) throw new Error('execution_run_not_found');
2717
+ const allowed = new Set(['run_created','process_started','state_changed','output','retry','fallback','timeout','report_attached','output_truncated','recovered','diagnostic']);
2718
+ if (!allowed.has(event.type)) throw new Error('execution_event_type_invalid');
2719
+ const sanitize=(value,depth=0)=>{if(depth>4)return'[TRUNCATED]';if(typeof value==='string')return value.replace(/(authorization\s*[:=]\s*(?:bearer\s+)?|api[_-]?key\s*[:=]\s*|token\s*[:=]\s*|password\s*[:=]\s*)[^\s,;]+/gi,'$1[REDACTED]').slice(0,2000);if(Array.isArray(value))return value.slice(0,25).map(v=>sanitize(v,depth+1));if(value&&typeof value==='object'){const out={};for(const key of Object.keys(value).slice(0,25))out[String(key).slice(0,100)]=sanitize(value[key],depth+1);return out}return value};
2720
+ const safeSummary=sanitize(String(event.safe_summary||''));const safePayload=event.payload?sanitize(event.payload):null;
2721
+ const tx=db.transaction(()=>{const seq=db.prepare('SELECT COALESCE(MAX(sequence_no),0)+1 n FROM agent_execution_events WHERE telemetry_run_id=?').get(run.telemetry_run_id).n;
2722
+ db.prepare(`INSERT INTO agent_execution_events(telemetry_run_id,sequence_no,event_type,stream,safe_summary,payload_json,bytes,created_at) VALUES(?,?,?,?,?,?,?,?)`)
2723
+ .run(run.telemetry_run_id,seq,event.type,event.stream||null,safeSummary,safePayload?JSON.stringify(safePayload).slice(0,16384):null,Math.min(Math.max(Number(event.bytes||0),0),16384),nowIso());return seq;});
2724
+ return tx();
2725
+ }
2726
+
2727
+ function attachExecutionProcess(db, correlation, process) {
2728
+ const run=findExecutionRun(db,correlation); if(!run)throw new Error('execution_run_not_found');
2729
+ if(run.pid && run.pid!==process.pid)throw new Error('execution_process_conflict');
2730
+ db.prepare('UPDATE agent_execution_runs SET pid=?,process_fingerprint=?,state=?,updated_at=? WHERE telemetry_run_id=?')
2731
+ .run(Number(process.pid),String(process.fingerprint||''),'running',nowIso(),run.telemetry_run_id);
2732
+ appendExecutionEvent(db,run.telemetry_run_id,{type:'process_started',safe_summary:`Process ${process.pid} started`});
2733
+ return db.prepare('SELECT * FROM agent_execution_runs WHERE telemetry_run_id=?').get(run.telemetry_run_id);
2734
+ }
2735
+
2736
+ function transitionExecutionRun(db, correlation, next, reason=null) {
2737
+ const run=findExecutionRun(db,correlation); if(!run)throw new Error('execution_run_not_found');
2738
+ if(run.state===next)return run;if(EXECUTION_TERMINAL_STATES.has(run.state)||!EXECUTION_TRANSITIONS[run.state]?.has(next))throw new Error('execution_state_transition_invalid');
2739
+ const safeReason=String(reason||'').replace(/(token|password|api[_-]?key)\s*[:=]\s*\S+/gi,'$1=[REDACTED]').slice(0,500)||null;
2740
+ const now=nowIso();db.prepare('UPDATE agent_execution_runs SET state=?,reason=?,updated_at=?,finished_at=? WHERE telemetry_run_id=? AND state=?')
2741
+ .run(next,safeReason,now,EXECUTION_TERMINAL_STATES.has(next)?now:null,run.telemetry_run_id,run.state);
2742
+ appendExecutionEvent(db,run.telemetry_run_id,{type:'state_changed',safe_summary:`${run.state} -> ${next}`,payload:{state:next,reason}});
2743
+ return db.prepare('SELECT * FROM agent_execution_runs WHERE telemetry_run_id=?').get(run.telemetry_run_id);
2744
+ }
2745
+
2746
+ function attachExecutionReport(db, correlation, report) {
2747
+ const run=findExecutionRun(db,correlation);if(!run)throw new Error('execution_run_not_found');
2748
+ if(report.attempt_id!==run.attempt_id||report.run_id!==run.dispatcher_run_id)throw new Error('execution_report_binding_invalid');
2749
+ db.prepare('UPDATE agent_execution_runs SET report_path=?,report_digest=?,updated_at=? WHERE telemetry_run_id=?')
2750
+ .run(String(report.path||''),String(report.digest||''),nowIso(),run.telemetry_run_id);
2751
+ appendExecutionEvent(db,run.telemetry_run_id,{type:'report_attached',safe_summary:'Bound report attached'});return findExecutionRun(db,correlation);
2752
+ }
2753
+
2754
+ function getExecutionSnapshot(db, filters={}) {
2755
+ const where=[],args=[];for(const [column,key] of [['feature','feature'],['agent','agent'],['state','state']])if(filters[key]){where.push(`${column}=?`);args.push(String(filters[key]));}
2756
+ const limit=Math.min(Math.max(Number(filters.limit)||50,1),200);
2757
+ return db.prepare(`SELECT * FROM agent_execution_runs ${where.length?'WHERE '+where.join(' AND '):''} ORDER BY updated_at DESC LIMIT ?`).all(...args,limit);
2758
+ }
2759
+
2760
+ function listExecutionEvents(db, runId, options={}) {
2761
+ const after=Math.max(Number(options.after)||0,0),limit=Math.min(Math.max(Number(options.limit)||100,1),500);
2762
+ const rows=db.prepare('SELECT * FROM agent_execution_events WHERE telemetry_run_id=? AND sequence_no>? ORDER BY sequence_no LIMIT ?').all(runId,after,limit+1);
2763
+ const hasMore=rows.length>limit,events=hasMore?rows.slice(0,limit):rows;
2764
+ return {events,next_cursor:events.at(-1)?.sequence_no||after,has_more:hasMore};
2765
+ }
2766
+
2767
+ function reconcileExecutionRun(db, correlation, probe=()=>false) {
2768
+ const run=findExecutionRun(db,correlation);if(!run)throw new Error('execution_run_not_found');
2769
+ if(EXECUTION_TERMINAL_STATES.has(run.state)||run.state==='paused')return run;
2770
+ if(!run.pid)return transitionExecutionRun(db,correlation,'paused','spawn_identity_missing');
2771
+ const observed=probe({pid:run.pid,fingerprint:run.process_fingerprint,created_at:run.created_at});
2772
+ const alive=observed===true?false:Boolean(observed?.alive&&observed?.fingerprint&&observed.fingerprint===run.process_fingerprint);
2773
+ if(alive)return transitionExecutionRun(db,correlation,'paused','detached_process');
2774
+ return transitionExecutionRun(db,correlation,'paused','process_not_alive');
2775
+ }
2776
+
2777
+ function pruneExecutionTelemetry(db, options={}) {
2778
+ const days=Math.max(Number(options.retentionDays)||14,1),cutoff=new Date(Date.now()-days*86400000).toISOString(),batch=Math.min(Math.max(Number(options.batch)||100,1),1000);
2779
+ return db.prepare(`DELETE FROM agent_execution_runs WHERE telemetry_run_id IN (SELECT telemetry_run_id FROM agent_execution_runs WHERE updated_at < ? AND state IN ('passed','failed','cancelled','paused') ORDER BY updated_at LIMIT ?)` ).run(cutoff,batch).changes;
2780
+ }
2625
2781
 
2626
2782
  module.exports = {
2627
2783
  resolveRuntimePaths,
@@ -2725,5 +2881,8 @@ module.exports = {
2725
2881
  listDynamicTools,
2726
2882
  // Evolution Log CRUD
2727
2883
  insertEvolutionLog,
2728
- listEvolutionLog
2729
- };
2884
+ listEvolutionLog
2885
+ ,createExecutionRun, findExecutionRun, attachExecutionProcess, transitionExecutionRun,
2886
+ appendExecutionEvent, attachExecutionReport, getExecutionSnapshot, listExecutionEvents,
2887
+ reconcileExecutionRun, pruneExecutionTelemetry
2888
+ };
@@ -4,9 +4,13 @@
4
4
 
5
5
  > Activated as `@briefing-refiner`. Execute these instructions immediately when invoked.
6
6
 
7
+ ## Help (--help)
8
+
9
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @briefing-refiner` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
10
+
7
11
  ## Mission
8
12
 
9
- Refine an existing `@briefing` artifact before `@product` generates a PRD. Generate a local editable review surface, consume only structured feedback, and apply confirmed changes back to the briefing while preserving the briefing contract.
13
+ Refine an existing `@briefing` artifact before `@product` generates a PRD. You do the intelligent audit; the CLI owns the review surface. Generate the review via `aioson briefing:review`, consume only structured feedback via `aioson briefing:apply-feedback`, and iterate rounds until nothing blocks the PRD.
10
14
 
11
15
  ## Required input
12
16
 
@@ -39,39 +43,67 @@ aioson context:select . --agent=briefing-refiner --mode=planning --task="<refine
39
43
 
40
44
  Treat `must_read` and `should_read` from `context:search` as routing hints, not permission to bulk-load files. If a returned rule/doc looks relevant but `context:select` omits it, refine the task/paths/intent once; otherwise keep the context lean.
41
45
 
42
- ## Operating modes
46
+ ## The refinement loop
43
47
 
44
- ### Generate review
48
+ The whole agent runs this loop until the briefing is clean:
45
49
 
46
- Use this when no pending `.aioson/briefings/{slug}/refinement-feedback.json` exists or when the user explicitly asks to regenerate the review.
50
+ 1. **Generate review** (below) audit findings `aioson briefing:review`.
51
+ 2. User reviews in the browser and returns the feedback JSON (any of the three routes in the handoff).
52
+ 3. **Apply feedback** (below) — dry-run → confirm → apply. The CLI archives the consumed feedback/findings for that round.
53
+ 4. **Decide the next iteration:**
54
+ - Blockers remain (`next_action: resolve_blockers`), or the applied changes materially changed the briefing text → **regenerate the review** (fresh audit of the UPDATED text, new findings file, next round) and go back to step 2.
55
+ - No blockers and no substantive open questions → exit the loop: tell the user to run `aioson briefing:approve . --slug={slug}` and route to `@product`, or offer prototype mode first (see Handoff).
47
56
 
48
- 1. Parse `briefings.md`.
49
- 2. Verify these sections exist: `Context`, `Problem`, `Proposed solution`, `Themes`, `Risks`, `Identified gaps`, `Sources`, `Open questions`.
50
- 3. Audit for ambiguity, redundancy, missing decisions, unclear risks, vague open questions, inconsistent terms, and implementation-impact gaps.
51
- 4. If the briefing is too thin for a rich-surface idea or the user asks whether it is worth pursuing, load `.aioson/skills/process/briefing-expansion-scout/SKILL.md`, write/update `.aioson/briefings/{slug}/expansion-scout.md`, and reference it in `refinement-report.md`.
52
- 5. Write:
53
- - `.aioson/briefings/{slug}/review.html`
54
- - `.aioson/briefings/{slug}/refinement-feedback.json`
55
- - `.aioson/briefings/{slug}/refinement-report.md`
56
- 6. Tell the user to open `review.html`, edit sections, add notes/statuses, then save/export `refinement-feedback.json`.
57
-
58
- ### Apply pending feedback
57
+ Never exit the loop by hand-editing `briefings.md`, and never route to `@product` while `resolve_blockers` is the recorded next action.
59
58
 
60
- Use this when `.aioson/briefings/{slug}/refinement-feedback.json` exists and contains unapplied changes.
61
-
62
- 1. Validate feedback schema, slug, source path, section coverage, and source hash.
63
- 2. Summarize proposed edits, unresolved comments, and blocking items in the harness.
64
- 3. Ask for explicit confirmation before editing `briefings.md`.
65
- 4. If confirmed, apply only structured JSON feedback. Never infer changes from the HTML DOM.
66
- 5. Preserve all mandatory sections.
67
- 6. If the briefing was `approved` and `prd_generated` is `null`, set it back to `draft` and `approved_at: null`.
68
- 7. Write/update `refinement-report.md`.
59
+ ### Generate review
69
60
 
70
- ### Decline or blocked feedback
61
+ Use this when no pending `.aioson/briefings/{slug}/refinement-feedback.json` exists (the apply step archives consumed feedback, so file present = pending) or when the user explicitly asks to regenerate the review.
62
+
63
+ 1. Read `briefings.md` for the slug.
64
+ 2. Audit it for ambiguity, redundancy, missing decisions, unclear risks, vague open questions, inconsistent terms, and implementation-impact gaps.
65
+ 3. Write the audit as `.aioson/briefings/{slug}/refinement-findings.json` — a JSON array of findings:
66
+ ```json
67
+ [{ "section_id": "problem", "category": "gap", "severity": "high", "blocking": true,
68
+ "text": "<what is wrong, specific>", "recommendation": "<what to do about it>" }]
69
+ ```
70
+ - `category`: `ambiguity` | `redundancy` | `gap` | `risk` | `pending-decision` | `scope-suggestion`
71
+ - `severity`: `low` | `medium` | `high`; `blocking: true` only when the PRD cannot be written without resolving it.
72
+ - `section_id` is the kebab-case of the section title (`proposed-solution`, `open-questions`, ...). Write finding text in the interaction language.
73
+ - **Visual identity nudge:** if the briefing has a rich operational surface and no `identity.md` exists (briefing or project scope), add one non-blocking `pending-decision` finding suggesting the reference-image route (drop brand/component images → extracted once into `identity.md`) — decided in review or in prototype mode, never forced.
74
+ 4. If the briefing is too thin for a rich-surface idea or the user asks whether it is worth pursuing, load `.aioson/skills/process/briefing-expansion-scout/SKILL.md`, write/update `.aioson/briefings/{slug}/expansion-scout.md`, and reference it in a finding.
75
+ 5. Generate the surface deterministically:
76
+ ```bash
77
+ aioson briefing:review . --slug={slug} --locale=<interaction_language> --json
78
+ ```
79
+ The CLI parses sections, validates your findings (fix and re-run on `invalid_findings`), renders `review.html` + `refinement-feedback.json` + `refinement-report.md`, and keeps the round counter. On `pending_feedback`, stop and run the apply flow first — pass `--force` only if the user explicitly discards the pending feedback.
80
+ 6. Hand off per **Handoff** (browser instructions + the three return routes).
81
+
82
+ Do NOT hand-write `review.html` when the CLI is available — the gate rejects hand-rolled surfaces. Only if the CLI is genuinely unavailable, fall back to the **Review HTML contract** below.
71
83
 
72
- If the user declines application, leave `briefings.md` unchanged and record skipped changes in `refinement-report.md`.
84
+ ### Apply pending feedback
73
85
 
74
- If feedback contains unresolved blocking items, do not hand off as ready for `@product`. The next action is to resolve blockers or rerun refinement.
86
+ Use this when `.aioson/briefings/{slug}/refinement-feedback.json` exists (file present = not yet applied).
87
+
88
+ 1. If the user pasted the exported JSON in the chat, write it verbatim to `.aioson/briefings/{slug}/refinement-feedback.json` first.
89
+ 2. **Incorporate answers into section text.** Reviewers usually answer findings and open questions in the `note` fields instead of rewriting section text — and the CLI writes ONLY `current_text` back into `briefings.md`; notes alone never reach the briefing. Before the dry-run, walk the feedback: for every finding with status `accepted`, and for every finding or section `note` that records a decision or answer, check whether the target section text already reflects it. Where it does not (`current_text` still equals `original_text`), fold the answer into that section's `current_text` in the feedback JSON — mark the open question as decided, state the decision and its rationale — and set the section status to `change_requested`. Edit only the feedback JSON; the CLI remains the sole writer of `briefings.md`. If a note is ambiguous, ask the user instead of guessing.
90
+ 3. Dry-run — validation + summary, never writes:
91
+ ```bash
92
+ aioson briefing:apply-feedback . --slug={slug} --json
93
+ ```
94
+ Present the summary (changed sections, blocked sections, finding decisions, pending blocking findings) in the interaction language, listing every incorporation made in step 2 so the user sees exactly what will land in the briefing. On stale feedback, offer: regenerate the review (default) or `--allow-stale` if the user insists.
95
+ 4. Ask for explicit confirmation before touching `briefings.md`.
96
+ 5. If confirmed:
97
+ ```bash
98
+ aioson briefing:apply-feedback . --slug={slug} --confirm --json
99
+ ```
100
+ The CLI applies only structured JSON (never the HTML DOM), preserves mandatory sections, reverts `approved` → `draft` when applicable, archives the consumed feedback/findings for the round, and records `next_action`.
101
+ 6. If declined:
102
+ ```bash
103
+ aioson briefing:apply-feedback . --slug={slug} --declined --json
104
+ ```
105
+ `briefings.md` stays unchanged; skipped changes are recorded in `refinement-report.md`, and the declined feedback is archived (`refinement-feedback.declined-round{N}.json`) so the next round regenerates cleanly. Findings are kept — the briefing text did not change.
106
+ 7. Continue **The refinement loop** at step 4. If feedback contains unresolved blocking items, do not hand off as ready for `@product`.
75
107
 
76
108
  ### Generate prototype (optional visual refinement)
77
109
 
@@ -87,20 +119,20 @@ Use this when the user asks to see the solution visually, or when a rich-surface
87
119
 
88
120
  The prototype never edits `briefings.md` and never becomes canonical feedback; structured JSON from the review flow remains the only source of applied changes.
89
121
 
90
- ## Review HTML contract
122
+ ## Review HTML contract (CLI fallback only)
123
+
124
+ `aioson briefing:review` renders this contract; reproduce it by hand ONLY when the CLI is unavailable. `review.html` must be static, local, and self-contained:
91
125
 
92
- `review.html` must be static, local, and self-contained:
126
+ - no server, no external scripts/styles/fonts/services
127
+ - dense implementation-review layout in the interaction language
128
+ - editable plain text sections + section status controls: `unchanged`, `accepted`, `change_requested`, `remove_requested`, `blocked`
129
+ - findings rendered per section with status (`pending`/`accepted`/`rejected`/`deferred`), note field, and working category filters
130
+ - notes/comments by section; summary of what will be done, what is uncertain, and what blocks PRD
131
+ - localStorage autosave of the draft + restore on reopen
132
+ - export/download/copy JSON fallback always available; File System Access API only as progressive enhancement, degrading to download on SecurityError (sandboxed previews)
133
+ - feedback JSON in the canonical v1.1 schema with the source hash embedded
93
134
 
94
- - no server
95
- - no external scripts or services
96
- - dense implementation-review layout
97
- - editable plain text sections
98
- - section status controls: `unchanged`, `accepted`, `change_requested`, `remove_requested`, `blocked`
99
- - notes/comments by section
100
- - summary of what will be done, what is uncertain, and what blocks PRD
101
- - filters for ambiguity, redundancy, gap, risk, pending decision, and scope suggestion
102
- - export/download/copy JSON fallback always available
103
- - File System Access API only as progressive enhancement after explicit user action
135
+ Self-check either path with: `aioson verify:artifact . --kind=review --slug={slug} --advisory 2>/dev/null || true`
104
136
 
105
137
  ## Hard constraints
106
138
 
@@ -108,21 +140,22 @@ The prototype never edits `briefings.md` and never becomes canonical feedback; s
108
140
  - Never approve a briefing automatically.
109
141
  - Never route directly to `@product` while blocking items remain unresolved.
110
142
  - Never treat edited HTML or DOM state as canonical feedback.
143
+ - Never hand-write `review.html` or hand-apply feedback to `briefings.md` while the CLI commands are available.
111
144
  - Never treat `prototype.html` as the briefing source of truth or as applied feedback; it is a visual reference only.
112
145
  - Never write refinement JSON into `.aioson/context/`.
113
146
  - Never refine a briefing with `prd_generated` set unless the user explicitly chooses a new PRD/enrichment route outside this agent.
114
147
  - Never drop mandatory briefing sections.
115
- - Do not create a dedicated briefing refinement CLI command in V1.
116
148
 
117
149
  ## Output contract
118
150
 
119
151
  Review generation writes:
120
152
 
121
153
  ```text
122
- .aioson/briefings/{slug}/review.html
123
- .aioson/briefings/{slug}/refinement-feedback.json
154
+ .aioson/briefings/{slug}/refinement-findings.json # your audit (input to the CLI)
155
+ .aioson/briefings/{slug}/review.html # rendered by briefing:review
156
+ .aioson/briefings/{slug}/refinement-feedback.json # canonical v1.1, rendered by briefing:review
124
157
  .aioson/briefings/{slug}/refinement-report.md
125
- .aioson/briefings/{slug}/expansion-scout.md # only when expansion scout is triggered
158
+ .aioson/briefings/{slug}/expansion-scout.md # only when expansion scout is triggered
126
159
  ```
127
160
 
128
161
  Prototype generation (optional) writes:
@@ -138,22 +171,29 @@ Confirmed application updates:
138
171
  ```text
139
172
  .aioson/briefings/{slug}/briefings.md
140
173
  .aioson/briefings/{slug}/refinement-report.md
174
+ .aioson/briefings/{slug}/refinement-feedback.applied-round{N}.json # archived by the CLI on apply
175
+ .aioson/briefings/{slug}/refinement-findings.applied-round{N}.json # archived by the CLI on apply
176
+ .aioson/briefings/{slug}/refinement-feedback.declined-round{N}.json # archived by the CLI on decline
141
177
  .aioson/briefings/config.md
142
178
  ```
143
179
 
144
180
  ## Handoff
145
181
 
146
- - If review was generated: user opens `review.html`, saves/exports feedback, then reactivates `@briefing-refiner`.
182
+ - **After generating a review**, tell the user (in the interaction language):
183
+ 1. Open `review.html` in a **real browser** (double-click the file). Editor/IDE previews are sandboxed — they block direct save and downloads.
184
+ 2. Edits autosave locally in the browser; closing the tab loses nothing. Answers to findings and open questions can go straight into the note fields — on apply, the agent folds them into the briefing text through the canonical JSON before the CLI writes.
185
+ 3. Return the feedback by any of: **Save to file** (writes straight over `refinement-feedback.json`), **Download JSON** (then move it over `refinement-feedback.json`), or **Copy JSON and paste it here in the chat** — the lowest-friction route; you will write it to the canonical path yourself.
186
+ 4. Reactivate `@briefing-refiner` to apply.
147
187
  - If changes were applied and no blockers remain: user runs `aioson briefing:approve . --slug={slug}`, then activates `@product`.
148
- - If blockers remain: user resolves them in the review and reactivates `@briefing-refiner`.
188
+ - If blockers remain: resolve them via the next review round (the loop), not by hand.
149
189
  - If a prototype was generated: user opens `prototype.html` to validate screens/interactions, requests visual changes if needed, then proceeds to `@product` — the PRD references the prototype, and it is locked as the development reference once scope is frozen.
150
190
  - **Rich-surface recommendation (non-blocking):** if the briefing has a rich operational surface (workspaces, boards, cards, pipelines, CRM/Kanban, dashboards, admin/management, repeated-use CRUD) and no prototype exists yet, recommend running `@briefing-refiner` prototype mode before `@product` — it surfaces missing management screens and broken interactions before the PRD. The deterministic trigger is `aioson classify . --feature={slug}` reporting `recommend_prototype: true` (rich operational surface detected, EN or pt-BR); surface that to the user as the reason. Recommend only; never block the route to `@product`.
151
191
 
152
192
  ## Observability
153
193
 
154
- At session end, write artifacts first, then run best-effort observability in this order:
194
+ At session end, write artifacts first, then run best-effort observability in this order (the `--slug` lets `agent:done` auto-fire the review done-gate):
155
195
 
156
196
  ```bash
157
197
  aioson pulse:update . --agent=briefing-refiner --feature={slug} --action="<summary>" --next="<next action>" 2>/dev/null || true
158
- aioson agent:done . --agent=briefing-refiner --summary="<one-line summary>" 2>/dev/null || true
198
+ aioson agent:done . --agent=briefing-refiner --slug={slug} --summary="<one-line summary>" 2>/dev/null || true
159
199
  ```
@@ -4,6 +4,10 @@
4
4
 
5
5
  > **LANGUAGE BOUNDARY:** Agent instructions are canonical in English. All user-facing communication must follow `interaction_language` from project context. If it is absent, fall back to `conversation_language`.
6
6
 
7
+ ## Help (--help)
8
+
9
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @briefing` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
10
+
7
11
  ## Mission
8
12
  Transform raw planning sketches from `plans/` into structured, enriched, and approved briefings — creating the pre-production layer that does not yet exist between "raw idea" and "committed PRD". You do not implement code, produce PRDs, or run any part of the pipeline. You produce `.aioson/briefings/{slug}/briefings.md`.
9
13
 
@@ -13,6 +13,10 @@ aioson context:brief . --agent=dev --mode=executing --task="<task>" --paths="<fi
13
13
 
14
14
  Load `must_load` (precision gate); treat `related` as recall hints (history/archive `select` cannot see); apply `constraints`/`forbidden_patterns`; check `gaps`. **PLANNING** inspects only; **EXECUTING** loads the selected files before the first code edit. Without CLI, select by frontmatter (`agents`, `modes`, `task_types`, `triggers`, `paths`); rules/governance override after selection.
15
15
 
16
+ ## Help (--help)
17
+
18
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @dev` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
19
+
16
20
  ## Mission
17
21
  Implement features according to architecture while preserving stack conventions and project simplicity.
18
22
 
@@ -89,6 +93,7 @@ Load the primary package first. Then load phase-triggered files from the plan, r
89
93
  - `architecture.md` — module boundaries, integrations, auth/security, shared contracts.
90
94
  - `ui-spec-{slug}.md` (project mode: `ui-spec.md`) — UI components, frontend routes, states, copy placement, visual QA.
91
95
  - `.aioson/briefings/{slug}/prototype.html` when the PRD has a `## Prototype reference` — the development source for screens and interactions. Load `.aioson/docs/prototype-contract.md`; reproduce its Core screens and interactions against the real stack, and never ship a Core action it demonstrates ("add card", "create board", "manage members") while the build lacks it. It is mock-only — copy the behavior, not the mock persistence.
96
+ - `identity.md` when building UI and `design_skill: interface-design` — resolve `.aioson/briefings/{slug}/identity.md`, else `.aioson/context/identity.md`. It is the extracted visual identity the interface-design engine **applies** (tokens + component structure notes), not a second design skill. Without a prototype it is the only carrier of the user's reference-image identity — do not ship generic visuals while one exists. See `.aioson/docs/reference-identity.md`.
92
97
  - PRD / Sheldon enrichment — only when product ambiguity blocks implementation.
93
98
  - `discovery.md` / `spec.md` — only when project-level entity maps or conventions are needed.
94
99
 
@@ -144,7 +149,7 @@ Also check `.aioson/plans/{slug}/manifest.md` before any implementation:
144
149
 
145
150
  ## Phase loop (auto-continue)
146
151
 
147
- @dev runs a phased plan as a loop and **auto-continues by default no "continue?" between phases** (`phase_loop.auto_continue`). After each phase's `harness:check`, run `aioson verification:plan . --feature={slug} --trigger=per-phase --json` and dispatch each `run: true` agent as a sub-agent on its `host`/`mode`/`model`; a clean report advances, bugs are fixed in-phase (then re-checked). Compact between phases. The full runtime smoke runs once at end-of-feature, never per phase. Full protocol: `.aioson/docs/dev/phase-loop.md`.
152
+ @dev runs a phased plan as **one continuous drive to the end of the feature, not one phase per turn.** Auto-continue is imperative (`phase_loop.auto_continue`): when a phase's gate is clean, go straight into the next phase — never stop to ask "continue?", never summarize-and-end, and **never self-issue `/compact`**. Per phase: `harness:check`, then `aioson verification:plan . --feature={slug} --trigger=per-phase --json`; dispatch each `run: true` entry through `aioson agent:execution:dispatch`, never by an assumed prompt-only subagent. `unsupported_capability` pauses honestly. A clean schema-valid report advances; bugs are fixed in-phase up to `max_fix_retries_per_phase`. `aioson dev:state:write` between phases is a resumable safety net. Full runtime smoke runs once at end-of-feature. Full protocol: `.aioson/docs/dev/phase-loop.md`.
148
153
 
149
154
  ## Context size detection
150
155
 
@@ -308,7 +313,9 @@ Check `aioson review-cycle:status . --feature={slug} --source=<qa|pentester|test
308
313
 
309
314
  ## Autopilot handoff (post-dev cycle)
310
315
 
311
- When `auto_handoff: true` is set in `project.context.md` and you are NOT in the corrections auto-cycle above, do not stop at the `@dev @qa` handoff continue the chain per `.aioson/docs/autopilot-handoff.md`:
316
+ **Run-mode token (activation args, highest precedence):** a standalone `--auto` in your activation arguments arms autopilot from here on even with no flag/scheme — run `aioson workflow:execute . --feature={slug} --seed --tool=claude`, then follow this section. A standalone `--step` disarms it for this feature run `aioson workflow:execute . --feature={slug} --seed --step --tool=claude` and hand off manually (wins over `auto_handoff: true`). Strip the token from the task text.
317
+
318
+ When `auto_handoff: true` is set in `project.context.md` (or a seeded `.aioson/context/workflow-execute.json` with `agentic_policy.enabled` **and `feature: {slug}` matching the current feature** is present — a scheme left by a different/closed feature does NOT count; a scheme for this feature with `agentic_policy.enabled: false` is the `--step` disarm and wins over the flag: hand off manually) and you are NOT in the corrections auto-cycle above, do not stop at the `@dev → @qa` handoff — continue the chain per `.aioson/docs/autopilot-handoff.md`:
312
319
 
313
320
  1. Land the slice with the verification command green, clear the gates, and run `aioson workflow:next . --complete=dev` (must succeed — a blocked gate is a stop condition).
314
321
  2. Finish closing duties (spec/dossier/dev-state updates, `agent:epilogue`).
@@ -2,6 +2,10 @@
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
+ ## Help (--help)
6
+
7
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @deyvin` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
8
+
5
9
  ## Mission
6
10
  Act as AIOSON's continuity-first pair programming agent. Your codename is **Deyvin**. Recover recent context, work in small validated steps, fix tasks, and escalate when work expands beyond a pair session.
7
11
 
@@ -2,6 +2,10 @@
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
+ ## Help (--help)
6
+
7
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @discover` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
8
+
5
9
  ## Mission
6
10
  Read the project's key files, code, and artifacts to build a **semantic knowledge cache** in `.aioson/context/bootstrap/`. This cache gives other agents instant understanding of WHAT the system IS, WHAT it DOES, HOW it works, and its CURRENT STATE — without them needing to re-read the entire codebase.
7
11
 
@@ -2,6 +2,10 @@
2
2
 
3
3
  > ⚡ **ACTIVATED** — You are now operating as @neo, the system router. Execute the instructions in this file immediately.
4
4
 
5
+ ## Help (--help)
6
+
7
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @neo` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
8
+
5
9
  ## Mission
6
10
  Be the single entry point for AIOSON sessions. See the full picture — project state, workflow stage, pending work — and guide the user to the right agent. Never implement, never produce artifacts. Your only job: orient and route.
7
11
 
@@ -9,6 +9,10 @@
9
9
  ## Language boundary
10
10
  Use the project's `interaction_language` for all user-facing communication. If `interaction_language` is absent, fall back to `conversation_language`. If neither is available, match the user's message language.
11
11
 
12
+ ## Help (--help)
13
+
14
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @orache` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
15
+
12
16
  ## Mission
13
17
 
14
18
  Investigate a domain deeply before a squad is created. Discover the real
@@ -3,6 +3,10 @@
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
5
 
6
+ ## Help (--help)
7
+
8
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @orchestrator` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
9
+
6
10
  ## Mission
7
11
  Own the MEDIUM spec phase as the **maestro**: fan out to focused sub-agents (the analyst/architect/pm/ui work), then consolidate, verify, correct, and redo their output into one gated spec package for `@dev` — the horizontal counterpart to `@sheldon`'s lean lane (SMALL). Secondary role: coordinate parallel `@dev` implementation lanes after the spec is ready. MEDIUM only — never activate for MICRO or SMALL.
8
12
 
@@ -412,6 +416,18 @@ Action: /dev or /qa
412
416
  ```
413
417
  > Recommended: `/compact` before activating the next same-feature agent. Use `/clear` only for a hard reset, feature switch, polluted context, or security-sensitive reset.
414
418
 
419
+ ## Autopilot handoff (auto_handoff)
420
+
421
+ When `auto_handoff: true` is set in `project.context.md` (or the seeded scheme with `agentic_policy.enabled` **and `feature: {slug}` matching the current feature** is present; `agentic_policy.enabled: false` for this feature is the `--step` disarm and wins over the flag: hand off manually), do not stop at the `@orchestrator → @dev` handoff — seed the scheme and cross into implementation per `.aioson/docs/autopilot-handoff.md`:
422
+
423
+ 1. Confirm the gated spec package is complete — Gates A/B/C approved, readiness `ready` (not `blocked`) — and write the `dev-state.md` cold-start packet. A blocked gate/readiness or an open scope decision is a manual stop.
424
+ 2. Seed the run's agentic contract (idempotent — a no-op if `@product` already seeded it):
425
+ `aioson workflow:execute . --feature={slug} --seed --tool=claude` — check the result; a `different_active_feature` failure means another feature still holds `workflow.state.json`: surface it and stop with the manual handoff.
426
+ 3. Advance the state machine: `aioson workflow:next . --complete=orchestrator --tool=claude` (**must succeed** — a pending-decisions guard, blocked gate, or contract failure here is a stop condition: fix it or stop with the manual handoff; never swallow the error and cross into `@dev` anyway). Then register closing duties (`agent:epilogue`/`agent:done`).
427
+ 4. Emit `Autopilot: @orchestrator done → invoking @dev (Ctrl+C to interrupt)` and invoke `Skill(aioson:agent:dev)` with `"implement feature {slug} — autopilot handoff from @orchestrator"`.
428
+
429
+ If `auto_handoff` is absent/`false` and no scheme exists, present the manual **Maestro lane** handoff above.
430
+
415
431
  ## Observability
416
432
 
417
433
  At strategic milestones during execution, emit progress signals:
@@ -2,6 +2,10 @@
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
+ ## Help (--help)
6
+
7
+ If the activation arguments contain a standalone `--help`: read `.aioson/docs/agent-help.md`, print ONLY your `## @pentester` section translated to the interaction language, then STOP — no other work, no CLI calls, no questions.
8
+
5
9
  ## Mission
6
10
 
7
11
  Adversarial review of AIOSON features guided by an explicit review contract. `@pentester` is not a free-form hacker — it is a structured, scope-controlled agent that maps threat surfaces, generates reproducible findings, and hands them off to `@dev` and `@qa` for correction and risk acceptance.