@yunhozz/arc 0.4.3 → 0.4.5

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 (87) hide show
  1. package/MANIFEST.sha256 +86 -84
  2. package/README.md +3 -2
  3. package/claude/agents/arc-implementer.md +1 -0
  4. package/claude/agents/arc-planner.md +1 -0
  5. package/claude/agents/arc-qa.md +1 -0
  6. package/claude/agents/arc-reviewer.md +1 -0
  7. package/claude/agents/arc-scouter.md +1 -0
  8. package/claude/skill/SKILL.md +7 -4
  9. package/claude/skill/references/commit.md +6 -4
  10. package/claude/skill/references/coordination.md +84 -9
  11. package/claude/skill/references/handoff-prep.md +4 -4
  12. package/claude/skill/references/handoff.md +1 -1
  13. package/claude/skill/references/planning.md +41 -4
  14. package/claude/skill/references/verification.md +4 -4
  15. package/codex/agents/arc-implementer.toml +1 -0
  16. package/codex/agents/arc-planner.toml +1 -0
  17. package/codex/agents/arc-qa.toml +1 -0
  18. package/codex/agents/arc-reviewer.toml +1 -0
  19. package/codex/agents/arc-scouter.toml +1 -0
  20. package/codex/skill/SKILL.md +7 -4
  21. package/codex/skill/references/commit.md +6 -4
  22. package/codex/skill/references/coordination.md +84 -9
  23. package/codex/skill/references/handoff-prep.md +4 -4
  24. package/codex/skill/references/handoff.md +1 -1
  25. package/codex/skill/references/planning.md +41 -4
  26. package/codex/skill/references/verification.md +4 -4
  27. package/gemini/agents/arc-implementer.md +1 -0
  28. package/gemini/agents/arc-planner.md +1 -0
  29. package/gemini/agents/arc-qa.md +1 -0
  30. package/gemini/agents/arc-reviewer.md +1 -0
  31. package/gemini/agents/arc-scouter.md +1 -0
  32. package/gemini/skill/SKILL.md +7 -4
  33. package/gemini/skill/references/commit.md +6 -4
  34. package/gemini/skill/references/coordination.md +85 -10
  35. package/gemini/skill/references/handoff-prep.md +4 -4
  36. package/gemini/skill/references/handoff.md +1 -1
  37. package/gemini/skill/references/planning.md +41 -4
  38. package/gemini/skill/references/verification.md +4 -4
  39. package/grok/agents/arc-implementer.md +1 -0
  40. package/grok/agents/arc-planner.md +1 -0
  41. package/grok/agents/arc-qa.md +1 -0
  42. package/grok/agents/arc-reviewer.md +1 -0
  43. package/grok/agents/arc-scouter.md +1 -0
  44. package/grok/skill/SKILL.md +7 -4
  45. package/grok/skill/references/commit.md +6 -4
  46. package/grok/skill/references/coordination.md +88 -13
  47. package/grok/skill/references/handoff-prep.md +4 -4
  48. package/grok/skill/references/handoff.md +1 -1
  49. package/grok/skill/references/planning.md +41 -4
  50. package/grok/skill/references/verification.md +4 -4
  51. package/lib/installer/global-config.mjs +8 -3
  52. package/lib/installer/language.mjs +54 -6
  53. package/lib/installer/plan.mjs +13 -11
  54. package/lib/installer/role-routing.mjs +2 -2
  55. package/lib/installer/runtime-assets.mjs +1 -0
  56. package/lib/installer/upgrade-state.mjs +10 -3
  57. package/lib/installer/upgrade.mjs +3 -3
  58. package/lib/management/operations.mjs +9 -6
  59. package/lib/management/status.mjs +22 -3
  60. package/lib/platforms/claude.mjs +1 -0
  61. package/lib/platforms/codex.mjs +1 -0
  62. package/lib/platforms/index.mjs +7 -0
  63. package/lib/policy/placement.mjs +2 -2
  64. package/lib/policy/render.mjs +1 -1
  65. package/lib/policy/role-policy.json +28 -2
  66. package/lib/prompts/agent-fragments.json +1 -1
  67. package/lib/prompts/render.mjs +1 -1
  68. package/lib/runtime/bootstrap.mjs +1 -1
  69. package/lib/runtime/grok-sandbox.mjs +234 -0
  70. package/lib/runtime/platform-registry.mjs +2 -2
  71. package/lib/runtime/role-bridge-args.mjs +6 -4
  72. package/lib/runtime/role-bridge.mjs +14 -6
  73. package/lib/runtime/role-dispatch-policy.mjs +30 -5
  74. package/lib/runtime/role-routing.mjs +31 -4
  75. package/lib/runtime/role-supervisor.mjs +77 -16
  76. package/lib/tui/mode.mjs +15 -3
  77. package/lib/tui/setup.mjs +51 -34
  78. package/package.json +1 -1
  79. package/shared/skill/runtime/bootstrap.mjs +1 -1
  80. package/shared/skill/runtime/grok-sandbox.mjs +234 -0
  81. package/shared/skill/runtime/platform-registry.mjs +2 -2
  82. package/shared/skill/runtime/role-bridge-args.mjs +6 -4
  83. package/shared/skill/runtime/role-bridge.mjs +14 -6
  84. package/shared/skill/runtime/role-dispatch-policy.mjs +30 -5
  85. package/shared/skill/runtime/role-policy.json +28 -2
  86. package/shared/skill/runtime/role-routing.mjs +31 -4
  87. package/shared/skill/runtime/role-supervisor.mjs +77 -16
@@ -1,13 +1,61 @@
1
1
  import {parseToml} from '../models/config.mjs';
2
2
  const MARKER='{{ARC_OUTPUT_LANGUAGE_POLICY}}';
3
+ const RUN_MODE_MARKER = '{{ARC_RUN_MODE_POLICY}}';
4
+ export const RUN_MODES = Object.freeze(['supervised', 'full-auto']);
5
+
3
6
  export function validateLanguage(language){if(!['en','ko'].includes(language))throw new Error(`Invalid language: ${language}`);return language;}
4
- export function parseLanguage(bytes){
5
- if(!Buffer.isBuffer(bytes))throw new Error('Language settings must be bytes');
6
- const data=parseToml(new TextDecoder('utf-8',{fatal:true,ignoreBOM:true}).decode(bytes));
7
- if(Object.keys(data).length!==2||!Object.hasOwn(data,'version')||!Object.hasOwn(data,'language')||data.version!==1n&&data.version!==1)throw new Error('Invalid language settings schema or version');
8
- return{version:1,language:validateLanguage(data.language)};
7
+
8
+ export function validateRunMode(value) {
9
+ if (!RUN_MODES.includes(value)) throw new Error(`Invalid run mode: ${String(value)}`);
10
+ return value;
9
11
  }
10
- export function serializeLanguage(language){return Buffer.from(`version = 1\nlanguage = "${validateLanguage(language)}"\n`);}
12
+
13
+ export function parseSettings(bytes) {
14
+ if (!Buffer.isBuffer(bytes)) throw new Error('Language settings must be bytes');
15
+ const data = parseToml(new TextDecoder('utf-8', {fatal: true, ignoreBOM: true}).decode(bytes));
16
+ const keyCount = Object.keys(data).length;
17
+ const isV1 = (data.version === 1 || data.version === 1n) && keyCount === 2;
18
+ const isV2 = (data.version === 2 || data.version === 2n) && keyCount === 3 && Object.hasOwn(data, 'run_mode');
19
+ if (!Object.hasOwn(data, 'version') || !Object.hasOwn(data, 'language') || (!isV1 && !isV2)) {
20
+ throw new Error('Invalid ARC settings schema or version');
21
+ }
22
+ return {
23
+ version: isV1 ? 1 : 2,
24
+ language: validateLanguage(data.language),
25
+ runMode: isV1 ? 'supervised' : validateRunMode(data.run_mode),
26
+ };
27
+ }
28
+
29
+ export function serializeSettings({language, runMode = 'supervised'}) {
30
+ const validatedLanguage = validateLanguage(language);
31
+ if (validateRunMode(runMode) === 'supervised') {
32
+ return Buffer.from(`version = 1\nlanguage = "${validatedLanguage}"\n`);
33
+ }
34
+ return Buffer.from(`version = 2\nlanguage = "${validatedLanguage}"\nrun_mode = "full-auto"\n`);
35
+ }
36
+
37
+ export function parseLanguage(bytes) {
38
+ const {version, language} = parseSettings(bytes);
39
+ return {version, language};
40
+ }
41
+
42
+ export function serializeLanguage(language) {
43
+ return serializeSettings({language});
44
+ }
45
+
11
46
  export function defaultLanguage(existing){return existing.length&&existing.every(value=>value===existing[0])&&existing[0]?validateLanguage(existing[0]):'en';}
12
47
  export function languagePolicy(language){return `Use ${validateLanguage(language)==='ko'?'Korean':'English'} by default for user-facing responses, progress updates, reports, and document titles and prose, including designs, specs, and plans. An explicit user language request overrides this installed default. Preserve identifiers, skill/API names, code, paths, commands, and literal values exactly.`;}
13
48
  export function renderLanguagePolicy(bytes,language){const text=new TextDecoder('utf-8',{fatal:true}).decode(bytes);if(text.split(MARKER).length!==2)throw new Error('Expected exactly one ARC output language policy marker');return Buffer.from(text.replace(MARKER,languagePolicy(language)));}
49
+
50
+ export function runModePolicy(runMode) {
51
+ if (validateRunMode(runMode) === 'supervised') {
52
+ return "**Run mode:** Supervised. Every approval and choice gate in this skill and its references requires the user's explicit answer; Orchestrator does not auto-decide gates.";
53
+ }
54
+ return "**Run mode:** Full Auto. Orchestrator decides the gates listed in [planning](references/planning.md#full-auto-run-mode) itself: it completes that gate's required checks first, then chooses the recommended option; without a recommendation and supporting evidence, it asks the user. New product decisions outside the original request, external actions, failures, partial completion, holds, unknown state, ownership conflicts, preservation-rule Git actions, permission or sandbox approvals, and unknown slots or exhausted capacity still go to the user. Plan depth, local commit rules, QA, Reviewer and acceptance are unchanged. Record each decision as `auto-decided (Full Auto): <gate> → <choice>; reason; alternatives; evidence` in a user-visible progress message and in the canonical handoff record. If the user asks in this chat to stop auto-deciding or to use Supervised, apply Supervised from the next gate; this overrides the installed default, and earlier auto-decisions stay recorded.";
55
+ }
56
+
57
+ export function renderRunModePolicy(bytes, runMode) {
58
+ const text = new TextDecoder('utf-8', {fatal: true}).decode(bytes);
59
+ if (text.split(RUN_MODE_MARKER).length !== 2) throw new Error('Expected exactly one ARC run mode policy marker');
60
+ return Buffer.from(text.replace(RUN_MODE_MARKER, runModePolicy(runMode)));
61
+ }
@@ -3,7 +3,7 @@ import {installerRegistryOf} from '../platforms/index.mjs';
3
3
  import {renderAgentProfile} from '../prompts/render.mjs';
4
4
  import {PayloadValidationError} from './manifest.mjs';
5
5
  import {composeSkillSources} from './skill-sources.mjs';
6
- import{parseLanguage,serializeLanguage,renderLanguagePolicy,validateLanguage}from'./language.mjs';
6
+ import{parseSettings,serializeSettings,renderLanguagePolicy,renderRunModePolicy,validateLanguage,validateRunMode}from'./language.mjs';
7
7
  import{resolveLimits}from'../limits.mjs';import{parseLimits,serializeLimits}from'./limits.mjs';import{assertPlanSnapshot}from'./transaction.mjs';
8
8
  import{validateModelConfig}from'../models/config.mjs';
9
9
  import{assertCatalogRoles}from'../models/catalog.mjs';
@@ -18,8 +18,8 @@ export function previewLimits({target,safeFs}){
18
18
  export function previewLanguage({target,safeFs}){
19
19
  const snapshot=new Map(),filename=path.join(target.home,'skills/arc/settings.toml');
20
20
  const current=inspectPath(safeFs,filename,{kind:'file',read:true,snapshot});
21
- let existing=null;try{if(current.exists)existing=parseLanguage(current.bytes).language;}catch(cause){fail(`Invalid ARC language settings: ${cause.message}`);}
22
- return{existing,snapshot};
21
+ let settings;try{if(current.exists)settings=parseSettings(current.bytes);}catch(cause){fail(`Invalid ARC language settings: ${cause.message}`);}
22
+ return{existing:settings?.language??null,existingRunMode:settings?.runMode??null,snapshot};
23
23
  }
24
24
  function renderModelAssets({payload,target,roles,modelConfig,language,verifiedCatalog,platforms,runtimePlatforms}){
25
25
  const input=payload.modelInputs[target.platform];if(!input)fail('Selected payload platform is unavailable');
@@ -30,12 +30,13 @@ function renderModelAssets({payload,target,roles,modelConfig,language,verifiedCa
30
30
  return{profiles,modelBytes};
31
31
  }
32
32
  export function renderStandaloneProfiles({payload,target,modelConfig,language,platforms,runtimePlatforms}){return renderModelAssets({payload,target,modelConfig,language,platforms,runtimePlatforms}).profiles;}
33
- function renderSkillPayload({payload,target,language,modelBytes,limits,platforms}){
33
+ function renderSkillPayload({payload,target,language,runMode,modelBytes,limits,platforms}){
34
34
  let skill;try{skill=composeSkillSources(payload.files,target.platform,{platforms});}catch(cause){throw new PayloadValidationError(`Payload skill composition failed: ${cause.message}`,{cause});}
35
- skill.set('SKILL.md',renderLanguagePolicy(skill.get('SKILL.md'),language));skill.set('settings.toml',serializeLanguage(language));skill.set('models.toml',modelBytes);skill.set('limits.toml',serializeLimits(limits));
35
+ skill.set('SKILL.md',renderRunModePolicy(renderLanguagePolicy(skill.get('SKILL.md'),language),runMode));
36
+ skill.set('settings.toml',serializeSettings({language,runMode}));skill.set('models.toml',modelBytes);skill.set('limits.toml',serializeLimits(limits));
36
37
  return skill;
37
38
  }
38
- function renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurrentExplicit,limits,summary,language,platforms}){
39
+ function renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurrentExplicit,limits,summary,language,runMode,platforms}){
39
40
  const home=target.home;
40
41
  const globalChanges=[];
41
42
  if(limits.max_concurrent_subagents>limits.max_total_subagents)summary.push(`Effective concurrency is at most ${limits.max_total_subagents} for a fresh ARC session; it may be lower after cumulative use or due to native capacity.`);
@@ -45,7 +46,7 @@ function renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurre
45
46
  if(filename!==target.instructionPath&&!runtimeConfig.renderConcurrency&&typeof runtimeConfig.globalRender!=='function')continue;
46
47
  const current=inspectPath(safeFs,filename,{kind:'file',read:true,snapshot}),original=current.bytes??null;
47
48
  let rendered;
48
- if(filename===target.instructionPath)rendered=renderManagedBlock(original,agentsBlockBody(home,target.userHome,language,target.platform));
49
+ if(filename===target.instructionPath)rendered=renderManagedBlock(original,agentsBlockBody(home,target.userHome,language,target.platform,runMode));
49
50
  else{
50
51
  if(typeof runtimeConfig.globalRender==='function'){
51
52
  try{rendered=runtimeConfig.globalRender(original);}catch(cause){fail(`Cannot update ${filename}: ${cause.message}; fix it or use --skip-global`);}
@@ -62,17 +63,18 @@ function renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurre
62
63
  }
63
64
  return globalChanges;
64
65
  }
65
- export function buildInstallPlan({payload,target,roles,profiles:profileMode='write',skipGlobal=false,safeFs,limits,concurrentExplicit=false,limitsPreview,language='en',languagePreview,modelConfig,verifiedCatalog,platforms,runtimePlatforms}){
66
+ export function buildInstallPlan({payload,target,roles,profiles:profileMode='write',skipGlobal=false,safeFs,limits,concurrentExplicit=false,limitsPreview,language='en',languagePreview,runMode,modelConfig,verifiedCatalog,platforms,runtimePlatforms}){
66
67
  validateLanguage(language);
67
68
  if(languagePreview)assertPlanSnapshot({snapshot:languagePreview.snapshot},{safeFs});
68
69
  const languageState=languagePreview??previewLanguage({target,safeFs});
70
+ runMode=runMode!==undefined?validateRunMode(runMode):languageState.existingRunMode??'supervised';
69
71
  if(limitsPreview)assertPlanSnapshot({snapshot:limitsPreview.snapshot},{safeFs});
70
72
  const preview=limitsPreview??previewLimits({target,safeFs});
71
73
  limits=resolveLimits({existing:preview.existing,overrides:limits??{}});
72
74
  const modelSnapshot=new Map();
73
75
  if(modelConfig===undefined&&roles===undefined){const installed=inspectPath(safeFs,path.join(target.home,'skills/arc/models.toml'),{kind:'file',read:true,snapshot:modelSnapshot});if(installed.exists)modelConfig=loadModelConfig(installed.bytes,target.platform,{runtimePlatforms});}
74
76
  const {profiles,modelBytes}=renderModelAssets({payload,target,roles,modelConfig,language,verifiedCatalog,platforms,runtimePlatforms});
75
- const skill=renderSkillPayload({payload,target,language,modelBytes,limits,platforms});
77
+ const skill=renderSkillPayload({payload,target,language,runMode,modelBytes,limits,platforms});
76
78
  const snapshot=new Map(),home=target.home;const skills=path.join(home,'skills'),agents=path.join(home,'agents'),arc=path.join(skills,'arc');
77
79
  for(const name of [home,skills,agents])inspectPath(safeFs,name,{kind:'directory',snapshot});
78
80
  inspectPath(safeFs,arc,{kind:'directory',tree:true,allowLinks:true,snapshot});
@@ -80,13 +82,13 @@ export function buildInstallPlan({payload,target,roles,profiles:profileMode='wri
80
82
  if(profileMode!=='omit')for(const [name,bytes]of profiles){const found=inspectStandaloneProfile({safeFs,target,role:name.split('.')[0].replace('-','_'),snapshot,platforms});if(found.exists&&!found.owned){residualPaths.push(found.path);continue;}profilePaths.push(found.path);profileWrites.set(name,bytes);}
81
83
  const externalPaths=[],summary=['Verified packaged Superpowers references will be installed inside ARC'];
82
84
  summary.push(`ARC limits: total ${limits.max_total_subagents}; concurrent ${limits.max_concurrent_subagents} (policy: ${arc}/limits.toml)`);
83
- const globalChanges=renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurrentExplicit,limits,summary,language,platforms});
85
+ const globalChanges=renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurrentExplicit,limits,summary,language,runMode,platforms});
84
86
  const managedPaths=[arc,...profilePaths,...globalChanges.map(change=>change.path)];
85
87
  for(const [filename,metadata]of preview.snapshot)snapshot.set(filename,metadata);
86
88
  for(const [filename,metadata]of languageState.snapshot)snapshot.set(filename,metadata);
87
89
  summary.push(`ARC output language: ${language}`);
88
90
  for(const item of modelSnapshot)snapshot.set(...item);
89
- const plan={target,language,roles,skipGlobal,limits,concurrentExplicit,profileWrites,residualPaths,generated:{models:modelBytes,profiles,skill},globalChanges,managedPaths,externalPaths,snapshot,summary};validatePlanSet([plan]);return plan;
91
+ const plan={target,language,runMode,roles,skipGlobal,limits,concurrentExplicit,profileWrites,residualPaths,generated:{models:modelBytes,profiles,skill},globalChanges,managedPaths,externalPaths,snapshot,summary};validatePlanSet([plan]);return plan;
90
92
  }
91
93
  function overlaps(a,b){return a===b||a.startsWith(b+'/')||b.startsWith(a+'/');}
92
94
  export function validatePlanSet(plans){
@@ -1,4 +1,4 @@
1
- import {installerRegistryOf,sortByAnchor} from '../platforms/index.mjs';
1
+ import {defaultCompositePlatformIds,installerRegistryOf,sortByAnchor} from '../platforms/index.mjs';
2
2
  import {renderStandaloneProfiles} from './plan.mjs';
3
3
  import {verifyPayload} from './manifest.mjs';
4
4
  import {loadModelConfig} from '../models/index.mjs';
@@ -40,7 +40,7 @@ export function renameCompositeProfile(bytes,platform,role,revision,context={}){
40
40
  return installerRegistryOf(context).getPlatform(platform).profiles.renameForRouting(bytes,role,revision);
41
41
  }
42
42
 
43
- const defaultCompositePlatforms=context=>installerRegistryOf(context).byAnchorOrder().filter(descriptor=>descriptor.runtime.capabilities.compositeHost.state==='verified').map(descriptor=>descriptor.runtime.id);
43
+ const defaultCompositePlatforms=context=>defaultCompositePlatformIds(installerRegistryOf(context));
44
44
 
45
45
  /** Inspect only ARC-owned composite paths; existing unknown files are never replaced. */
46
46
  export function prepareCompositeFiles({context,targets,config,platforms=config.platforms??defaultCompositePlatforms(context),anchor=sortByAnchor(platforms,installerRegistryOf(context))[0],profileInputs,modelConfigs,previous}){
@@ -17,6 +17,7 @@ export const RUNTIME_MODULE_PATHS = Object.freeze([
17
17
  'lib/runtime/gemini-stream.mjs',
18
18
  'lib/runtime/git-evidence.mjs',
19
19
  'lib/runtime/git-query.mjs',
20
+ 'lib/runtime/grok-sandbox.mjs',
20
21
  'lib/runtime/grok-stream.mjs',
21
22
  'lib/runtime/identity.mjs',
22
23
  'lib/runtime/local-cli.mjs',
@@ -4,7 +4,7 @@ import path from 'node:path';
4
4
  import {createHash} from 'node:crypto';
5
5
  import {resolveTargets,inspectPath,TargetConfigurationError} from './targets.mjs';
6
6
  import {loadModelConfig} from '../models/index.mjs';
7
- import {parseLanguage} from './language.mjs';
7
+ import {parseSettings} from './language.mjs';
8
8
  import {parseLimits} from './limits.mjs';
9
9
  import {removeManagedBlock} from './global-config.mjs';
10
10
  import {removeShellCompletion} from './shell-completion.mjs';
@@ -24,14 +24,21 @@ export function collectInstalledState({safeFs,userHome,env={},cwd,platforms,runt
24
24
  if(!skill.exists){if(profiles.some(item=>item.exists&&item.owned)||managed.changed)fail(`Incomplete ARC installation: ${target.home}`);residualPaths.push(...profiles.filter(item=>item.exists&&!item.owned).map(item=>item.path));continue;}
25
25
  function mandatory(name){const found=inspectPath(safeFs,path.join(arc,name),{kind:'file',read:true,snapshot});if(!found.exists||!found.bytes.length)fail(`Incomplete ARC installation: missing ${name} at ${target.home}`);return found.bytes;}
26
26
  mandatory('SKILL.md');if(profiles.some(item=>!item.exists))fail(`Incomplete ARC installation: missing profile at ${target.home}`);
27
- let language,modelConfig,limits;try{language=parseLanguage(mandatory('settings.toml')).language;modelConfig=loadModelConfig(mandatory('models.toml'),platform,{runtimePlatforms});limits=parseLimits(mandatory('limits.toml'));}catch(cause){throw new TargetConfigurationError(`Invalid installed ARC settings at ${target.home}: ${cause.message}`,{cause});}
27
+ let language,runMode,modelConfig,limits;
28
+ try{
29
+ const parsed=parseSettings(mandatory('settings.toml'));
30
+ language=parsed.language;
31
+ runMode=parsed.runMode;
32
+ modelConfig=loadModelConfig(mandatory('models.toml'),platform,{runtimePlatforms});
33
+ limits=parseLimits(mandatory('limits.toml'));
34
+ }catch(cause){throw new TargetConfigurationError(`Invalid installed ARC settings at ${target.home}: ${cause.message}`,{cause});}
28
35
  const runtimeConfig=registry.getPlatform(platform).runtimeConfig;
29
36
  if(typeof runtimeConfig.readConcurrency==='function'){const native=inspectPath(safeFs,target.runtimeConfigPath,{kind:'file',read:true,snapshot});if(native.exists)try{runtimeConfig.readConcurrency(native.bytes);}catch(cause){throw new TargetConfigurationError(`Invalid native configuration at ${target.runtimeConfigPath}: ${cause.message}`,{cause});}}
30
37
  const shell=inspectPath(safeFs,path.join(userHome,'.zshrc'),{kind:'file',read:true,snapshot});if(shell.exists)removeShellCompletion(shell.bytes);
31
38
  const modeKeys=new Set();
32
39
  if(mode==='composite')for(const [filename,value]of modeSnapshot)if(value){snapshot.set(filename,value);modeKeys.add(filename);}
33
40
  for(const [filename,value]of snapshot)if(!value)snapshot.delete(filename);
34
- targets.push({target,language,modelConfig,limits,snapshot,modeKeys,residualPaths:profiles.filter(item=>item.exists&&!item.owned).map(item=>item.path)});
41
+ targets.push({target,language,runMode,modelConfig,limits,snapshot,modeKeys,residualPaths:profiles.filter(item=>item.exists&&!item.owned).map(item=>item.path)});
35
42
  }
36
43
  const hash=createHash('sha256');for(const entry of targets){hash.update(entry.target.platform+'\0'+entry.target.home+'\0');for(const [name,value]of [...entry.snapshot].sort(([a],[b])=>a.localeCompare(b)))hash.update(JSON.stringify([name,value],(key,value)=>key==='atimeNs'?undefined:typeof value==='bigint'?value.toString():value));}
37
44
  return{targets,mode,platforms:installation.platforms,registry,residualPaths,stateToken:hash.digest('hex')};
@@ -12,11 +12,11 @@ export function buildUpgradePlans({payload,state,safeFs,registry=state.registry}
12
12
  const platforms=installerRegistryOf({platforms:registry}),runtimePlatforms=createPlatformRegistry(platforms.byAnchorOrder().map(descriptor=>descriptor.runtime));
13
13
  for(const entry of state.targets)assertPlanSnapshot(entry,{safeFs});
14
14
  const plans=state.targets.map(entry=>{
15
- const {target,language,modelConfig,limits}=entry;
16
- const plan=buildInstallPlan({payload,target,profiles:state.mode==='composite'&&state.platforms.includes(target.platform)?'omit':'write',language,modelConfig,limits,skipGlobal:true,safeFs,platforms,runtimePlatforms});
15
+ const {target,language,runMode,modelConfig,limits}=entry;
16
+ const plan=buildInstallPlan({payload,target,profiles:state.mode==='composite'&&state.platforms.includes(target.platform)?'omit':'write',language,runMode,modelConfig,limits,skipGlobal:true,safeFs,platforms,runtimePlatforms});
17
17
  for(const [name,value]of entry.snapshot)plan.snapshot.set(name,value);
18
18
  const current=inspectPath(safeFs,target.instructionPath,{kind:'file',read:true,snapshot:plan.snapshot});
19
- if(current.exists&&removeManagedBlock(current.bytes).changed){const rendered=renderManagedBlock(current.bytes,agentsBlockBody(target.home,target.userHome,language,target.platform));plan.managedPaths.push(target.instructionPath);if(!rendered.content.equals(current.bytes))plan.globalChanges.push({path:target.instructionPath,original:current.bytes,...rendered});}
19
+ if(current.exists&&removeManagedBlock(current.bytes).changed){const rendered=renderManagedBlock(current.bytes,agentsBlockBody(target.home,target.userHome,language,target.platform,runMode));plan.managedPaths.push(target.instructionPath);if(!rendered.content.equals(current.bytes))plan.globalChanges.push({path:target.instructionPath,original:current.bytes,...rendered});}
20
20
  return plan;
21
21
  });
22
22
  const writePaths=plans.map(plan=>new Set(plan.managedPaths));
@@ -2,7 +2,7 @@ import {readInstallMode,assertVerifiedInstallMode} from '../installer/install-mo
2
2
  import os from 'node:os';
3
3
  import {fileURLToPath} from 'node:url';
4
4
  import {resolveTarget,resolveTargets} from '../installer/targets.mjs';
5
- import {installerRegistryOf,sortByAnchor,sortByDisplay,platformLabel} from '../platforms/index.mjs';
5
+ import {defaultCompositePlatformIds,installerRegistryOf,sortByAnchor,sortByDisplay,platformLabel} from '../platforms/index.mjs';
6
6
  import {platformAvailability} from '../platforms/availability.mjs';
7
7
  import {buildInstallPlan,renderStandaloneProfiles,validatePlanSet} from '../installer/plan.mjs';
8
8
  import {verifyPayload} from '../installer/manifest.mjs';
@@ -21,7 +21,7 @@ import {prepareCompositeFiles,publishCompositeFiles,readCompositeRoutingConfig,p
21
21
  import {inspectPath,sameObjectIdentity,TargetConfigurationError} from '../installer/targets.mjs';
22
22
  import {assertPlanSnapshot} from '../installer/transaction.mjs';
23
23
  import {acquireRoleRoutingLock} from '../runtime/role-routing.mjs';
24
- import {parseLanguage} from '../installer/language.mjs';
24
+ import {parseSettings} from '../installer/language.mjs';
25
25
  import path from 'node:path';
26
26
  /** @typedef {{packageRoot:string,userHome:string,cwd:string,env:object,safeFs:object,signal?:AbortSignal}} ManagementContext */
27
27
  /** @typedef {{kind:string,plans:object[],options:object}} PreparedOperation */
@@ -50,7 +50,7 @@ export async function prepareOperation(context,options,{selections=[]}={}){
50
50
  if(options.kind==='uninstall')options={...options,removeCli:options.removeCli!==false};
51
51
  let compositeActivePath,compositeUninstallAnchor;if(options.kind==='uninstall'){const mode=readInstallMode(modeOptions),anchor=mode.mode==='composite'?mode.anchor:registry.byAnchorOrder().find(descriptor=>targets[descriptor.runtime.id])?.runtime.id;if(anchor)compositeActivePath=path.join(targets[anchor].home,'arc-role-platform-routing.json');if(mode.mode==='composite')compositeUninstallAnchor=anchor;}
52
52
  const platforms=platformOrder.filter(platform=>!skipped.some(item=>item.platform===platform)),payload=options.kind==='install'?verifyPayload(context):null;
53
- const plans=platforms.map(platform=>{const target=resolveTarget(platform,context),selection=selections.find(item=>item.target.platform===platform&&item.target.home===target.home);if(options.kind==='preset')return buildPresetPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,loadPayload:()=>verifyPayload(context),target,roles:options.roles,safeFs:context.safeFs,verifiedCatalog:options.verifiedCatalog});if(options.kind==='uninstall')return buildUninstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,target,safeFs:context.safeFs,skipGlobal:options.skipGlobal,removeCompletion:options.removeCli!==false,compositeActivePath});return buildInstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,payload,target,limitsPreview:selection?.preview,languagePreview:selection?.languagePreview,roles:options.roles,verifiedCatalog:options.verifiedCatalog,language:options.language,skipGlobal:options.skipGlobal,safeFs:context.safeFs,limits:{...(options.maxTotalSubagents===undefined?{}:{max_total_subagents:options.maxTotalSubagents}),...(options.maxConcurrentSubagents===undefined?{}:{max_concurrent_subagents:options.maxConcurrentSubagents})},concurrentExplicit:options.maxConcurrentSubagents!==undefined||Boolean(options.concurrentSelected)});});
53
+ const plans=platforms.map(platform=>{const target=resolveTarget(platform,context),selection=selections.find(item=>item.target.platform===platform&&item.target.home===target.home);if(options.kind==='preset')return buildPresetPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,loadPayload:()=>verifyPayload(context),target,roles:options.roles,safeFs:context.safeFs,verifiedCatalog:options.verifiedCatalog});if(options.kind==='uninstall')return buildUninstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,target,safeFs:context.safeFs,skipGlobal:options.skipGlobal,removeCompletion:options.removeCli!==false,compositeActivePath});return buildInstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,payload,target,limitsPreview:selection?.preview,languagePreview:selection?.languagePreview,roles:options.roles,verifiedCatalog:options.verifiedCatalog,language:options.language,runMode:options.runMode,skipGlobal:options.skipGlobal,safeFs:context.safeFs,limits:{...(options.maxTotalSubagents===undefined?{}:{max_total_subagents:options.maxTotalSubagents}),...(options.maxConcurrentSubagents===undefined?{}:{max_concurrent_subagents:options.maxConcurrentSubagents})},concurrentExplicit:options.maxConcurrentSubagents!==undefined||Boolean(options.concurrentSelected)});});
54
54
  // Retain the active config until every other uninstall snapshot has read it.
55
55
  if(compositeUninstallAnchor&&options.target==='all')plans.sort((a,b)=>Number(a.target.platform===compositeUninstallAnchor)-Number(b.target.platform===compositeUninstallAnchor));
56
56
  if(options.kind==='install')attachShellCompletionCleanup(plans,context);
@@ -79,7 +79,7 @@ export function readCompositeConfig(context){return readCompositeRoutingConfig(c
79
79
  export async function prepareCompositeOperation(context,options){
80
80
  if(!['install','preset'].includes(options.kind))throw new TargetConfigurationError('Unsupported composite operation');
81
81
  const registry=installerRegistryOf(context),resolved=resolveTargets(context),targets=resolved.targets,mode=assertVerifiedInstallMode({safeFs:context.safeFs,...resolved,platforms:registry});
82
- const ids=[...new Set([...(options.platforms??(mode.mode==='composite'?mode.platforms:registry.byAnchorOrder().filter(descriptor=>descriptor.runtime.capabilities.compositeHost.state==='verified').map(descriptor=>descriptor.runtime.id))),...Object.values(options.config.roles).map(role=>role.platform)])];
82
+ const ids=[...new Set([...(options.platforms??(mode.mode==='composite'?mode.platforms:defaultCompositePlatformIds(registry))),...Object.values(options.config.roles).map(role=>role.platform)])];
83
83
  for(const id of ids)if(!registry.isPlatformId(id))throw new TargetConfigurationError(`Unknown platform: ${id}`);
84
84
  if(ids.length<2)throw new TargetConfigurationError('Mixed routing requires at least two platforms');
85
85
  const platforms=sortByAnchor(ids,registry),anchor=platforms[0],config=buildRoleRoutingConfig({revision:options.config.revision,platforms,roles:options.config.roles},context);
@@ -96,8 +96,11 @@ export async function prepareCompositeOperation(context,options){
96
96
  const payload=verifyPayload(context);
97
97
  for(const platform of platforms){
98
98
  const target=targets[platform],status=statuses.find(item=>item.platform===platform),existing=new Map(),modelFile=inspectPath(context.safeFs,path.join(target.home,'skills/arc/models.toml'),{kind:'file',read:true,snapshot:existing}),languageFile=inspectPath(context.safeFs,path.join(target.home,'skills/arc/settings.toml'),{kind:'file',read:true,snapshot:existing});
99
- const modelConfig=loadModelConfig(modelFile.exists?modelFile.bytes:payload.modelInputs[platform].models,platform,context),language=options.settings?.language??(languageFile.exists?parseLanguage(languageFile.bytes).language:'en');
100
- const plan=buildInstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,payload,target,profiles:mode.mode==='composite'&&mode.platforms.includes(platform)?'omit':'write',modelConfig,language,safeFs:context.safeFs,limits:{...(options.settings?.maxTotalSubagents===undefined?{}:{max_total_subagents:options.settings.maxTotalSubagents}),...(options.settings?.maxConcurrentSubagents===undefined?{}:{max_concurrent_subagents:options.settings.maxConcurrentSubagents})},skipGlobal:options.settings?.skipGlobal??false,concurrentExplicit:Boolean(options.settings?.concurrentSelected)||options.settings?.maxConcurrentSubagents!==undefined});assertPlanSnapshot({snapshot:existing},{safeFs:context.safeFs});
99
+ const modelConfig=loadModelConfig(modelFile.exists?modelFile.bytes:payload.modelInputs[platform].models,platform,context);
100
+ const parsed=languageFile.exists?parseSettings(languageFile.bytes):null;
101
+ const language=options.settings?.language??parsed?.language??'en';
102
+ const runMode=options.settings?.runMode??parsed?.runMode??'supervised';
103
+ const plan=buildInstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,payload,target,profiles:mode.mode==='composite'&&mode.platforms.includes(platform)?'omit':'write',modelConfig,language,runMode,safeFs:context.safeFs,limits:{...(options.settings?.maxTotalSubagents===undefined?{}:{max_total_subagents:options.settings.maxTotalSubagents}),...(options.settings?.maxConcurrentSubagents===undefined?{}:{max_concurrent_subagents:options.settings.maxConcurrentSubagents})},skipGlobal:options.settings?.skipGlobal??false,concurrentExplicit:Boolean(options.settings?.concurrentSelected)||options.settings?.maxConcurrentSubagents!==undefined});assertPlanSnapshot({snapshot:existing},{safeFs:context.safeFs});
101
104
  plans.push(plan);profileInputs[platform]=plan.generated.profiles;modelConfigs[platform]=modelConfig;
102
105
  }
103
106
  attachShellCompletionCleanup(plans,context);validatePlanSet(plans);
@@ -2,7 +2,7 @@ import {readInstallMode,inspectStandaloneProfile} from '../installer/install-mod
2
2
  import path from 'node:path';
3
3
  import {resolveTarget,resolveTargets,inspectPath} from '../installer/targets.mjs';
4
4
  import {installerRegistryOf} from '../platforms/index.mjs';
5
- import {parseLanguage} from '../installer/language.mjs';
5
+ import {parseSettings} from '../installer/language.mjs';
6
6
  import {parseLimits} from '../installer/limits.mjs';
7
7
  import {loadModelConfig} from '../models/index.mjs';
8
8
  import {removeManagedBlock} from '../installer/global-config.mjs';
@@ -14,9 +14,28 @@ export async function collectStatus(context,{codexCheck='refresh'}={}){const reg
14
14
  if(!skill.exists&&!profiles.some(x=>x.exists&&x.owned)&&!managed)return{platform,target,state:'absent',residualPaths:profiles.filter(x=>x.exists&&!x.owned).map(x=>x.path),diagnostics:[]};
15
15
  const mandatory=name=>{const found=read(path.join(arc,name));if(!found.exists||!found.bytes.length)throw Error(`Incomplete ARC installation: missing ${name} at ${target.home}`);return found.bytes;};
16
16
  mandatory('SKILL.md');if(profiles.some(x=>!x.exists))throw Error(`Incomplete ARC installation: missing profile at ${target.home}`);
17
- const settings={language:parseLanguage(mandatory('settings.toml')).language,modelConfig:loadModelConfig(mandatory('models.toml'),platform,context),limits:parseLimits(mandatory('limits.toml'))},runtimeConfig=registry.getPlatform(platform).runtimeConfig;if(typeof runtimeConfig.readConcurrency==='function'){const native=read(target.runtimeConfigPath);if(native.exists)runtimeConfig.readConcurrency(native.bytes);}const shell=read(path.join(context.userHome,'.zshrc'));if(shell.exists)removeShellCompletion(shell.bytes);
17
+ const {language,runMode}=parseSettings(mandatory('settings.toml'));
18
+ const settings={language,runMode,modelConfig:loadModelConfig(mandatory('models.toml'),platform,context),limits:parseLimits(mandatory('limits.toml'))},runtimeConfig=registry.getPlatform(platform).runtimeConfig;if(typeof runtimeConfig.readConcurrency==='function'){const native=read(target.runtimeConfigPath);if(native.exists)runtimeConfig.readConcurrency(native.bytes);}const shell=read(path.join(context.userHome,'.zshrc'));if(shell.exists)removeShellCompletion(shell.bytes);
18
19
  return{platform,target,state:'installed',settings,snapshot,residualPaths:profiles.filter(x=>x.exists&&!x.owned).map(x=>x.path),diagnostics:[]};
19
- }catch(error){return{platform,target,state:'incomplete',diagnostics:[error]};}
20
+ }catch(error){
21
+ const status={platform,target,state:'incomplete',diagnostics:[error]};
22
+ if(!target)return status;
23
+ const arc=path.join(target.home,'skills/arc');
24
+ const read=name=>inspectPath(context.safeFs,path.join(arc,name),{kind:'file',read:true});
25
+ const settings={};
26
+ try{
27
+ const found=read('settings.toml');
28
+ if(found.exists){
29
+ const {language,runMode}=parseSettings(found.bytes);
30
+ Object.assign(settings,{language,runMode});
31
+ }
32
+ }catch{}
33
+ try{
34
+ const found=read('limits.toml');
35
+ if(found.exists)settings.limits=parseLimits(found.bytes);
36
+ }catch{}
37
+ return Object.keys(settings).length?{...status,settings}:status;
38
+ }
20
39
  });return Promise.all(statuses.map(async status=>{
21
40
  const runtime=registry.getPlatform(status.platform).runtime;
22
41
  if(runtime.capabilities.install.state!=='verified')return{...status,cliVersion:{version:null,reason:'capability_not_verified'},authentication:{authStatus:'unknown',reason:'capability_not_verified'}};
@@ -4,6 +4,7 @@ import {discoverAnthropicCatalog} from '../models/catalog-anthropic.mjs';
4
4
 
5
5
  export const CLAUDE_INSTALLER = Object.freeze({
6
6
  runtime: getPlatform('claude'),
7
+ defaultComposite: true,
7
8
  payloadPrefix: 'claude', instructionFile: 'CLAUDE.md', runtimeConfigFile: 'settings.json',
8
9
  globalPaths: Object.freeze(['CLAUDE.md', 'settings.json']),
9
10
  models: Object.freeze({staticCatalog: new URL('../models/claude-models.json', import.meta.url), effortField: getPlatform('claude').models.effortField, discover: discoverAnthropicCatalog}),
@@ -6,6 +6,7 @@ import {listCodexModelCapabilities} from '../models/codex-catalog.mjs';
6
6
 
7
7
  export const CODEX_INSTALLER = Object.freeze({
8
8
  runtime: getPlatform('codex'),
9
+ defaultComposite: true,
9
10
  payloadPrefix: 'codex', instructionFile: 'AGENTS.md', runtimeConfigFile: 'config.toml',
10
11
  globalPaths: Object.freeze(['AGENTS.md', 'config.toml']),
11
12
  models: Object.freeze({staticCatalog: new URL('../models/codex-models.json', import.meta.url), effortField: getPlatform('codex').models.effortField, discover: listCodexModelCapabilities}),
@@ -21,6 +21,13 @@ export function createInstallerRegistry({runtime, descriptors}) {
21
21
  }
22
22
 
23
23
  export const DEFAULT_INSTALLER_REGISTRY = createInstallerRegistry({runtime: DEFAULT_PLATFORM_REGISTRY, descriptors: [CLAUDE_INSTALLER, CODEX_INSTALLER, GEMINI_INSTALLER, GROK_INSTALLER]});
24
+
25
+ export function defaultCompositePlatformIds(registry = DEFAULT_INSTALLER_REGISTRY) {
26
+ return registry.byAnchorOrder()
27
+ .filter(descriptor => descriptor.defaultComposite === true && descriptor.runtime.capabilities.compositeHost.state === 'verified')
28
+ .map(descriptor => descriptor.runtime.id);
29
+ }
30
+
24
31
  export const installerRegistryOf = context => context?.platforms ?? DEFAULT_INSTALLER_REGISTRY;
25
32
  export const platformLabel = (id, registry = DEFAULT_INSTALLER_REGISTRY) => registry.getPlatform(id)?.runtime.label ?? id;
26
33
  export const sortByDisplay = (ids, registry = DEFAULT_INSTALLER_REGISTRY) => [...ids].sort((a, b) => registry.getPlatform(a).runtime.displayOrder - registry.getPlatform(b).runtime.displayOrder);
@@ -1,9 +1,9 @@
1
1
  // Instruction placement only; runtime policy and role authority remain canonical.
2
2
  const reviews = ['review.significant-no-plan', 'review.significant-plan', 'review.final-plan-recheck'];
3
3
  export const POLICY_PROJECTIONS = Object.freeze(Object.fromEntries(Object.entries({
4
- core: ['scope.non-escalation', 'external.explicit-user-authority', 'role.orchestrator-boundary'],
4
+ core: ['scope.non-escalation', 'external.explicit-user-authority', 'approval.run-mode', 'role.orchestrator-boundary'],
5
5
  assignment: ['git.specialists-deny', 'role.scouter-read-only', 'role.planner-draft-only', 'role.implementer-implementation', 'role.qa-verification', 'role.reviewer-independent'],
6
- planning: ['git.orchestrator-accept-commit', ...reviews, 'planning.plan-revision', 'planning.planner-brief'],
6
+ planning: ['git.orchestrator-accept-commit', ...reviews, 'planning.plan-revision', 'planning.planner-brief', 'approval.run-mode'],
7
7
  handoff: ['git.specialists-deny', 'role.implementer-implementation', ...reviews],
8
8
  preparation: ['scope.non-escalation', 'git.specialists-deny', 'git.orchestrator-accept-commit', 'external.explicit-user-authority', 'planning.plan-revision'],
9
9
  verification: ['git.orchestrator-accept-commit', ...reviews, 'planning.plan-revision'],
@@ -20,7 +20,7 @@ export function validateRolePolicy(input) {
20
20
  if (!strings(rule.roles) || rule.roles.some(x=>!ROLES.includes(x)) || !['allow','deny','require'].includes(rule.effect) || !strings(rule.operations) || !strings(rule.evidence) || !['user','orchestrator'].includes(rule.authority) || typeof rule.text !== 'string' || !rule.text || /[\r\n]/.test(rule.text)) fail(`invalid rule ${rule.id}`);
21
21
  if (!object(rule.controls) || !same(Object.keys(rule.controls).sort(),[...platformIds()].sort()) || Object.values(rule.controls).some(x=>!CONTROLS.includes(x))) fail(`invalid control level for ${rule.id}`);
22
22
  }
23
- for (const id of ['scope.non-escalation','git.specialists-deny','git.orchestrator-accept-commit','external.explicit-user-authority',...ROLES.map(x=>({orchestrator:'role.orchestrator-boundary',scouter:'role.scouter-read-only',planner:'role.planner-draft-only',implementer:'role.implementer-implementation',qa:'role.qa-verification',reviewer:'role.reviewer-independent'})[x]),'review.significant-no-plan','review.significant-plan','review.final-plan-recheck']) if(!ids.has(id)) fail(`missing required rule ${id}`);
23
+ for (const id of ['scope.non-escalation','git.specialists-deny','git.orchestrator-accept-commit','external.explicit-user-authority','approval.run-mode',...ROLES.map(x=>({orchestrator:'role.orchestrator-boundary',scouter:'role.scouter-read-only',planner:'role.planner-draft-only',implementer:'role.implementer-implementation',qa:'role.qa-verification',reviewer:'role.reviewer-independent'})[x]),'review.significant-no-plan','review.significant-plan','review.final-plan-recheck']) if(!ids.has(id)) fail(`missing required rule ${id}`);
24
24
  for (const platform of POLICY_PLATFORMS) if (!object(input.platforms?.[platform]) || !CONTROLS.includes(input.platforms[platform].level) || typeof input.platforms[platform].notice !== 'string' || !input.platforms[platform].notice) fail(`invalid ${platform} controls`);
25
25
  // These are workflow invariants, not customizable scheduling options.
26
26
  const routes = {noPlan:['implementer','qa','reviewer','orchestrator-accept'],planTask:['implementer','fresh-qa','orchestrator-accept','orchestrator-commit'],planFinal:['required-qa','reviewer'],planFinding:['implementer','reviewer']};
@@ -108,7 +108,7 @@
108
108
  "task-progress-classification-reason-time"
109
109
  ],
110
110
  "authority": "orchestrator",
111
- "text": "Only Orchestrator accepts work and performs Git mutations. One approved top-level plan task becomes one focused implementation commit after criteria, required checks and findings are satisfied. Orchestrator accepts, then includes that task's own progress records made after task completion (checkboxes, notes, results, evidence and status) with its implementation work in that commit, without a separate docs/fixup commit or planning-commit amendment for those records. Exclude other tasks; pending approved spec/plan revisions follow planning.plan-revision and preserve the no-change path without empty commits. Orchestrator commits without separate user commit approval. Reports, passing checks and Reviewer opinions do not replace acceptance. Preserve unrelated changes and ownership; verify the resulting SHA, content, HEAD and remaining changes. Existing small-task direct and plan-omission paths remain unchanged.",
111
+ "text": "Only Orchestrator accepts work and performs Git mutations. One approved top-level plan task becomes one focused implementation commit after criteria, required checks and findings are satisfied. Orchestrator accepts, then includes that task's own progress records made after task completion (checkboxes, notes, results, evidence and status) with its implementation work in that commit, without a separate docs/fixup commit or planning-commit amendment for those records. Exclude other tasks; pending approved spec/plan revisions follow planning.plan-revision and preserve the no-change path without empty commits. Plan-level progress records (final verification results, final Reviewer verdicts and finding dispositions, overall completion status) are the sole exception: include them in the plan's next task acceptance or final Reviewer follow-up commit; when no implementation work remains and no standalone closing commit for pending revisions is made, keep them only in the canonical handoff record without changing the plan document or creating a commit. Orchestrator commits without separate user commit approval. Reports, passing checks and Reviewer opinions do not replace acceptance. Preserve unrelated changes and ownership; verify the resulting SHA, content, HEAD and remaining changes. Existing small-task direct and plan-omission paths remain unchanged.",
112
112
  "controls": {
113
113
  "codex": "prompt",
114
114
  "claude": "prompt",
@@ -146,6 +146,32 @@
146
146
  "grok": "prompt"
147
147
  }
148
148
  },
149
+ {
150
+ "id": "approval.run-mode",
151
+ "roles": [
152
+ "orchestrator",
153
+ "scouter",
154
+ "planner",
155
+ "implementer",
156
+ "qa",
157
+ "reviewer"
158
+ ],
159
+ "effect": "require",
160
+ "operations": [
161
+ "gate-decision"
162
+ ],
163
+ "evidence": [
164
+ "user-choice-or-recorded-full-auto-decision"
165
+ ],
166
+ "authority": "user",
167
+ "text": "The installed ARC Run mode is Supervised unless the installed skill states Full Auto. In Full Auto, an Orchestrator decision recorded as `auto-decided (Full Auto)` with gate, choice, reason and evidence counts as the explicit choice or approval for that listed gate only; briefs cite it as `full-auto:<doc>@<version>` or the recorded decision. It never authorizes new product decisions outside the original request, external actions, resolution of failures, holds, unknown state or ownership conflicts, preservation-rule Git actions, permission or sandbox changes, or unknown slots and exhausted capacity, and it changes no plan-depth, commit, QA, Reviewer or acceptance rule. A user request to stop or use Supervised applies from the next gate.",
168
+ "controls": {
169
+ "codex": "prompt",
170
+ "claude": "prompt",
171
+ "gemini": "prompt",
172
+ "grok": "prompt"
173
+ }
174
+ },
149
175
  {
150
176
  "id": "role.orchestrator-boundary",
151
177
  "roles": [
@@ -378,7 +404,7 @@
378
404
  "plan-revision-trailers"
379
405
  ],
380
406
  "authority": "orchestrator",
381
- "text": "Task progress records (checkboxes, notes, results, evidence and status) preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit and records classification, reason and actual time as applicable. All other spec/plan content changes, contract or mechanical, require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval, preparation and holds on affected work before it continues, with a fresh Implementer for remaining work. After approval Orchestrator edits the same document, appends a revision-history row and leaves it uncommitted as an Orchestrator-owned pending revision, recording version, content hash, approval reference, actual time, classification, reason, affected tasks and the full approved content in the canonical handoff record. Orchestrator includes all pending revisions with Plan-Revision, Plan-Approved-At and Plan-Reason trailers in the accepted commit of the first top-level task executed or reconfirmed against the revised version, otherwise in a current task or final Reviewer follow-up commit; only when no implementation work remains before overall completion MAY it make one standalone docs(plan) closing commit without implementation files. Exclude revision hunks from commits of independent tasks accepted on a prior version, or hold that commit when separation is unsafe. NEVER amend or rewrite planning or implementation commits, create any other docs/fixup commit or authorize past work retroactively. After commit verify the committed document content matches the latest approved content apart from classified progress records of that commit's task or committed for other tasks after approval, and that no pending revision remains. Follow planning, handoff-prep, commit and verification for the full contract.",
407
+ "text": "Task progress records (checkboxes, notes, results, evidence and status) preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit and records classification, reason and actual time as applicable. Plan-level progress records preserving the approved contract also need no new user approval and alone never trigger the standalone docs(plan) closing commit. All other spec/plan content changes, contract or mechanical, require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval, preparation and holds on affected work before it continues, with a fresh Implementer for remaining work. After approval Orchestrator edits the same document, appends a revision-history row and leaves it uncommitted as an Orchestrator-owned pending revision, recording version, content hash, approval reference, actual time, classification, reason, affected tasks and the full approved content in the canonical handoff record. Orchestrator includes all pending revisions with Plan-Revision, Plan-Approved-At and Plan-Reason trailers in the accepted commit of the first top-level task executed or reconfirmed against the revised version, otherwise in a current task or final Reviewer follow-up commit; only when no implementation work remains before overall completion MAY it make one standalone docs(plan) closing commit without implementation files. Exclude revision hunks from commits of independent tasks accepted on a prior version, or hold that commit when separation is unsafe. NEVER amend or rewrite planning or implementation commits, create any other docs/fixup commit or authorize past work retroactively. After commit verify the committed document content matches the latest approved content apart from classified progress records of that commit's task or committed for other tasks after approval, or plan-level progress records carried by that commit, and that no pending revision remains. Follow planning, handoff-prep, commit and verification for the full contract.",
382
408
  "controls": {
383
409
  "codex": "prompt",
384
410
  "claude": "prompt",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  {
13
13
  "id": "common.preservation-choice-inspection",
14
- "text": "- **Preservation rule:** Preserve unrelated staged, unstaged and untracked changes and edit ownership. NEVER automatically stash, reset, clean, unstage, discard, amend or delete branches/worktrees. DO NOT change permissions, delete locks or bypass the sandbox to proceed. Stop and report to Orchestrator, who reports to the user.\n- **Explicit choice:** Only a clear user selection counts. Planning approval, silence, refusal of another option and ambiguous replies do not.\n- **Stop and inspect:** On failure or partial completion, stop dependent work. Record actual path, branch or detached HEAD, HEAD, index, files and completed steps. DO NOT automatically retry, fall back or repeat completed work. Revalidate affected gates after resolution."
14
+ "text": "- **Preservation rule:** Preserve unrelated staged, unstaged and untracked changes and edit ownership. NEVER automatically stash, reset, clean, unstage, discard, amend or delete branches/worktrees. DO NOT change permissions, delete locks or bypass the sandbox to proceed. Stop and report to Orchestrator, who reports to the user.\n- **Explicit choice:** Only a clear user selection counts, or a recorded Full Auto auto-decision under [approval.run-mode]. Planning approval, silence, refusal of another option and ambiguous replies do not.\n- **Stop and inspect:** On failure or partial completion, stop dependent work. Record actual path, branch or detached HEAD, HEAD, index, files and completed steps. DO NOT automatically retry, fall back or repeat completed work. Revalidate affected gates after resolution."
15
15
  },
16
16
  {
17
17
  "id": "common.optional-read-exception",
@@ -142,7 +142,7 @@ export function validateAgentRegistry(registry) {
142
142
  const ids = new Set(Object.values(EXPECTED).flat());
143
143
  const fragments = new Map();
144
144
  for (const item of registry.fragments) {
145
- if (!keys(item, ['id', 'text']) || !ids.has(item.id) || fragments.has(item.id) || typeof item.text !== 'string' || !item.text || /ARC_AGENT_FRAGMENT|ARC_OUTPUT_LANGUAGE_POLICY|\[ARC role policy: contract (?:begin|end)\]/.test(item.text) || item.text.includes('\r')) throw Error('Invalid fragment');
145
+ if (!keys(item, ['id', 'text']) || !ids.has(item.id) || fragments.has(item.id) || typeof item.text !== 'string' || !item.text || /ARC_AGENT_FRAGMENT|ARC_OUTPUT_LANGUAGE_POLICY|ARC_RUN_MODE_POLICY|\[ARC role policy: contract (?:begin|end)\]/.test(item.text) || item.text.includes('\r')) throw Error('Invalid fragment');
146
146
  fragments.set(item.id, item.text);
147
147
  }
148
148
  if (fragments.size !== ids.size || registry.targets.length !== Object.keys(EXPECTED).length) throw Error('Incomplete fragment inventory');
@@ -8,7 +8,7 @@ export const COOPERATIVE_RUNTIME_MODULES=Object.freeze([
8
8
  'cli.mjs','command.mjs','bootstrap.mjs','cooperative-schema.mjs','cooperative.mjs','evaluate.mjs',
9
9
  'scope.mjs','store.mjs','git-evidence.mjs','assignment.mjs','verification.mjs','acceptance.mjs','external.mjs','schema.mjs','operations.mjs','gate.mjs','adapters/codex.mjs','adapters/claude.mjs','capabilities.mjs','identity.mjs','git-query.mjs','target-preparation.mjs',
10
10
  'local-cli.mjs','role-routing-config.mjs','role-routing.mjs','role-bridge.mjs',
11
- 'role-dispatch-policy.mjs','role-dispatch-store.mjs','role-bridge-args.mjs','role-observe.mjs','role-supervisor.mjs','platform-registry.mjs','gemini-stream.mjs','grok-stream.mjs'
11
+ 'role-dispatch-policy.mjs','role-dispatch-store.mjs','role-bridge-args.mjs','role-observe.mjs','role-supervisor.mjs','platform-registry.mjs','gemini-stream.mjs','grok-stream.mjs','grok-sandbox.mjs'
12
12
  ]);
13
13
  export const cooperativeCoverage=()=>({enforcement:'cooperative',provenance:'operator-attested',nativeVerified:false});
14
14
  export function commandResult({workflowId,state,input,decision='allow',ruleId='cooperative.recorded',persisted=false,...extra}){