@yunhozz/arc 0.5.5 → 0.5.7

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 (84) hide show
  1. package/MANIFEST.sha256 +83 -74
  2. package/claude/agents/arc-implementer.md +2 -2
  3. package/claude/agents/arc-planner.md +1 -1
  4. package/claude/agents/arc-reviewer.md +1 -1
  5. package/claude/agents/arc-scouter.md +1 -1
  6. package/claude/agents/arc-tester.md +1 -1
  7. package/claude/skill/SKILL.md +3 -3
  8. package/claude/skill/references/arc-visual-companion.md +2 -21
  9. package/claude/skill/references/commit.md +3 -30
  10. package/claude/skill/references/coordination.md +20 -126
  11. package/claude/skill/references/git-recovery.md +3 -3
  12. package/claude/skill/references/handoff-prep.md +9 -24
  13. package/claude/skill/references/handoff.md +19 -108
  14. package/claude/skill/references/limits.md +4 -15
  15. package/claude/skill/references/planning.md +56 -95
  16. package/claude/skill/references/verification.md +16 -118
  17. package/claude/skill/references/worktree-creation.md +1 -1
  18. package/codex/agents/arc-implementer.toml +3 -1
  19. package/codex/agents/arc-planner.toml +4 -0
  20. package/codex/agents/arc-reviewer.toml +6 -0
  21. package/codex/agents/arc-scouter.toml +6 -0
  22. package/codex/agents/arc-tester.toml +6 -0
  23. package/codex/skill/SKILL.md +3 -3
  24. package/codex/skill/references/arc-visual-companion.md +3 -27
  25. package/codex/skill/references/commit.md +3 -30
  26. package/codex/skill/references/coordination.md +19 -126
  27. package/codex/skill/references/git-recovery.md +2 -7
  28. package/codex/skill/references/handoff-prep.md +9 -24
  29. package/codex/skill/references/handoff.md +18 -107
  30. package/codex/skill/references/limits.md +5 -16
  31. package/codex/skill/references/planning.md +56 -95
  32. package/codex/skill/references/verification.md +15 -117
  33. package/gemini/agents/arc-implementer.md +1 -1
  34. package/gemini/skill/SKILL.md +3 -3
  35. package/gemini/skill/references/arc-visual-companion.md +2 -21
  36. package/gemini/skill/references/commit.md +3 -30
  37. package/gemini/skill/references/coordination.md +23 -129
  38. package/gemini/skill/references/git-recovery.md +3 -3
  39. package/gemini/skill/references/handoff-prep.md +9 -24
  40. package/gemini/skill/references/handoff.md +19 -108
  41. package/gemini/skill/references/limits.md +4 -15
  42. package/gemini/skill/references/planning.md +56 -95
  43. package/gemini/skill/references/verification.md +16 -118
  44. package/grok/agents/arc-implementer.md +1 -1
  45. package/grok/skill/SKILL.md +2 -2
  46. package/grok/skill/references/arc-visual-companion.md +2 -21
  47. package/grok/skill/references/commit.md +3 -30
  48. package/grok/skill/references/coordination.md +21 -127
  49. package/grok/skill/references/git-recovery.md +3 -3
  50. package/grok/skill/references/handoff-prep.md +9 -24
  51. package/grok/skill/references/handoff.md +19 -108
  52. package/grok/skill/references/limits.md +4 -15
  53. package/grok/skill/references/planning.md +56 -95
  54. package/grok/skill/references/verification.md +16 -118
  55. package/lib/policy/role-policy.json +1 -1
  56. package/lib/prompts/agent-fragments.json +20 -9
  57. package/lib/prompts/render.mjs +16 -5
  58. package/lib/runtime/adapters/codex.mjs +1 -1
  59. package/lib/runtime/assignment.mjs +3 -2
  60. package/lib/runtime/cooperative.mjs +36 -3
  61. package/lib/runtime/evaluate.mjs +21 -6
  62. package/lib/runtime/gate.mjs +2 -1
  63. package/lib/runtime/schema.mjs +16 -0
  64. package/lib/runtime/target-preparation.mjs +7 -2
  65. package/lib/runtime/verification.mjs +1 -1
  66. package/package.json +1 -1
  67. package/shared/skill/references/arc-visual-companion-common.md +39 -0
  68. package/shared/skill/references/commit-common.md +45 -0
  69. package/shared/skill/references/coordination-common.md +193 -0
  70. package/shared/skill/references/git-recovery-common.md +15 -0
  71. package/shared/skill/references/handoff-common.md +182 -0
  72. package/shared/skill/references/handoff-prep-common.md +53 -0
  73. package/shared/skill/references/limits-common.md +34 -0
  74. package/shared/skill/references/planning-common.md +185 -0
  75. package/shared/skill/references/verification-common.md +170 -0
  76. package/shared/skill/runtime/adapters/codex.mjs +1 -1
  77. package/shared/skill/runtime/assignment.mjs +3 -2
  78. package/shared/skill/runtime/cooperative.mjs +36 -3
  79. package/shared/skill/runtime/evaluate.mjs +21 -6
  80. package/shared/skill/runtime/gate.mjs +2 -1
  81. package/shared/skill/runtime/role-policy.json +1 -1
  82. package/shared/skill/runtime/schema.mjs +16 -0
  83. package/shared/skill/runtime/target-preparation.mjs +7 -2
  84. package/shared/skill/runtime/verification.mjs +1 -1
@@ -13,6 +13,7 @@ import {fingerprintRequest,saveDurableState,applyCooperativeCommitTransition,app
13
13
  import {commandResult,cooperativeVersions} from './bootstrap.mjs';
14
14
  import {evaluateCooperative,reconcileCooperativeResult} from './evaluate.mjs';
15
15
  import {evaluateTargetPreparation,readTargetPreparationEvidence} from './target-preparation.mjs';
16
+ import {expectedCooperativePlanningKinds,hasExactPlanningKinds,preparedTargetIntent} from './schema.mjs';
16
17
  const same=(a,b)=>JSON.stringify(a)===JSON.stringify(b);
17
18
  const sameCheckout=(a,b)=>['realpath','gitCommonDir','gitDir'].every(k=>a[k]===b[k]);
18
19
  /** Only trusted code may inject observation/storage. CLI JSON cannot set either. */
@@ -59,8 +60,17 @@ export async function runCooperativeCommand({cwd,workflowId,command,input,observ
59
60
  const changes=state.tasks.length?await readChanges({state}):undefined;
60
61
  const plannerArtifacts=plannerWork?await readPlannerArtifacts(state,command==='record'&&input.evidence.kind==='planner-evidence'?input.evidence:undefined):undefined;
61
62
  const plannerHistory=command==='record'&&input.evidence.kind==='planner-stage'?await readPlannerHistory(state,statePath,input.evidence.data.document?.path):{};
63
+ let reviewedSpec;
64
+ if(command==='record'&&input.evidence.kind==='planner-stage'&&input.evidence.data.document?.kind==='plan'){
65
+ const intent=preparedTargetIntent(state),spec=intent?.documents.find(d=>d.kind==='spec');
66
+ if(spec){
67
+ let observed;
68
+ try{observed=await readTargetPreparationEvidence({state,targetIntent:intent,destination:{realpath:state.target.realpath,path:spec.path},observe,readChanges});}catch{}
69
+ reviewedSpec={path:spec.path,hash:observed?.destination?.document?.hash};
70
+ }
71
+ }
62
72
  let destinationReview=false;
63
- let decision=evaluateCooperative({state,request:{command,input},evidence:{target:currentTarget,versions,git,changes,requestFingerprint,plannerArtifacts,...plannerHistory}});
73
+ let decision=evaluateCooperative({state,request:{command,input},evidence:{target:currentTarget,versions,git,changes,requestFingerprint,plannerArtifacts,...plannerHistory,reviewedSpec}});
64
74
  if(command==='record'&&input.evidence.kind==='planner-review'){
65
75
  const data=input.evidence.data,stage=state.plannerLedger?.stages.find(s=>s.id===data.stageId),intent=state.targetIntents?.find(i=>i.id===stage?.targetIntentId),transition=state.targetTransitions?.find(t=>t.intentId===intent?.id&&t.targetVersion===state.targetVersion),document=intent?.documents.find(d=>d.kind===stage?.document.kind);
66
76
  if(transition&&document){
@@ -70,7 +80,11 @@ export async function runCooperativeCommand({cwd,workflowId,command,input,observ
70
80
  decision=valid?{decision:'allow',ruleIds:['cooperative.target-preparation']}:{decision:'hold',ruleIds:['cooperative.target-preparation'],reason:'Current destination bytes and complete source-bound review required'};
71
81
  }
72
82
  }
73
- if(command==='record'&&['document','approval'].includes(input.evidence.kind)&&state.targetIntents?.some(intent=>!state.targetTransitions?.some(t=>t.intentId===intent.id)&&intent.documents.some(doc=>doc.kind===input.evidence.data.kind&&(input.evidence.data.path===doc.path||input.evidence.data.path===path.join(intent.sourceTarget.realpath,doc.path)))))decision={decision:'hold',ruleIds:['cooperative.target-preparation'],reason:'Prepared target transition required before document records'};
83
+ if(command==='record'&&['document','approval'].includes(input.evidence.kind)){
84
+ const {kind,data}=input.evidence;
85
+ const documents=kind==='approval'&&Array.isArray(data.documents)?data.documents:[data];
86
+ if(state.targetIntents?.some(intent=>!state.targetTransitions?.some(t=>t.intentId===intent.id)&&intent.documents.some(doc=>documents.some(d=>d?.kind===doc.kind&&[doc.path,path.join(intent.sourceTarget.realpath,doc.path)].includes(d.path)))))decision={decision:'hold',ruleIds:['cooperative.target-preparation'],reason:'Prepared target transition required before document records'};
87
+ }
74
88
  if(command==='record'&&input.evidence.kind==='approval'){
75
89
  const data=input.evidence.data,intent=state.targetIntents?.find(i=>state.targetTransitions?.some(t=>t.intentId===i.id&&t.targetVersion===state.targetVersion)&&i.documents.some(d=>d.kind===data.kind));
76
90
  if(intent){
@@ -81,6 +95,25 @@ export async function runCooperativeCommand({cwd,workflowId,command,input,observ
81
95
  if(stage?.scopeVersion!==state.scopeVersion||![document.path,path.join(state.target.realpath,document.path)].includes(data.path)||!review||observed?.destination?.document?.hash!==data.contentHash||!same(currentTarget,state.target)||!same(versions,state.versions)||input.actor.role!=='orchestrator')decision={decision:'hold',ruleIds:['cooperative.target-preparation'],reason:'Current reviewed destination bytes required for approval'};
82
96
  }
83
97
  }
98
+ if(command==='record'&&input.evidence.kind==='approval'&&Array.isArray(input.evidence.data.documents)&&decision.decision==='allow'){
99
+ const intent=preparedTargetIntent(state),documents=input.evidence.data.documents;
100
+ if(intent){
101
+ let valid=input.actor.role==='orchestrator'&&same(currentTarget,state.target)&&same(versions,state.versions)&&hasExactPlanningKinds(documents,expectedCooperativePlanningKinds(state));
102
+ for(const doc of intent.documents){
103
+ if(!valid)break;
104
+ const absolutePath=path.join(state.target.realpath,doc.path);
105
+ const entry=documents.find(d=>d.kind===doc.kind&&[doc.path,absolutePath].includes(d.path));
106
+ const firstStage=state.plannerLedger?.stages.find(s=>s.id===intent.firstStageId);
107
+ const stage=firstStage?.document.kind===doc.kind?firstStage:state.plannerLedger?.stages.find(s=>s.document.kind===doc.kind&&s.document.path===absolutePath&&s.targetVersion===state.targetVersion);
108
+ const review=entry&&state.records.findLast(r=>r.kind==='planner-review'&&r.source==='operator-attested'&&r.scopeVersion===state.scopeVersion&&r.targetVersion===state.targetVersion&&r.data?.stageId===stage?.id&&r.data?.resultRef===stage?.result?.ref&&r.data?.full===true&&r.data?.complete===true&&r.data?.hash===entry.contentHash);
109
+ if(!review||stage?.scopeVersion!==state.scopeVersion){valid=false;break;}
110
+ let observed;
111
+ try{observed=await readTargetPreparationEvidence({state,targetIntent:intent,destination:{realpath:state.target.realpath,path:doc.path},observe,readChanges});}catch{}
112
+ valid=same(observed?.destination?.target,state.target)&&observed.destination.document?.hash===entry.contentHash;
113
+ }
114
+ if(!valid)decision={decision:'hold',ruleIds:['cooperative.target-preparation'],reason:'Current reviewed bytes required for every approved document'};
115
+ }
116
+ }
84
117
  if(command==='record'&&input.evidence.kind==='target-preparation'){
85
118
  let observed;
86
119
  try{const intent=state.targetIntents?.find(i=>i.id===input.evidence.data.intentId);observed=await readTargetPreparationEvidence({state,targetIntent:intent,destination:input.evidence.data.destination,observe,readChanges});}catch{}
@@ -171,7 +204,7 @@ export async function runCooperativeCommand({cwd,workflowId,command,input,observ
171
204
  const task=state.tasks.find(t=>t.id===id),approval=state.records.findLast(r=>r.kind==='approval'&&(!r.data.affectedTaskIds||r.data.affectedTaskIds.includes(id)));
172
205
  if(!task||task.invalidated||task.scopeVersion!==state.scopeVersion||!approval||approval.revision<=marker.revision||approval.scopeVersion!==state.scopeVersion||approval.targetVersion!==state.targetVersion||task.approvalRef!==approval.messageRef||task.approvalVersion!==approval.data.approvalVersion||task.documentVersion!==approval.data.documentVersion){ready=false;break;}
173
206
  const documents=approval.data.documents;
174
- if(!Array.isArray(documents)||documents.length!==2||!['spec','plan'].every(kind=>documents.some(d=>d.kind===kind))){ready=false;break;}
207
+ if(!hasExactPlanningKinds(documents,expectedCooperativePlanningKinds(state))){ready=false;break;}
175
208
  try{const observed=await readGit({target:currentTarget,documents});if(!same(observed.target,currentTarget)||!observed.docsCommit||!same(observed.docsCommit.documents,documents)||documents.some(d=>d.commit!==observed.docsCommit.commit||d.approvalRef!==approval.messageRef||!observed.documents?.some(o=>o.path===d.path&&o.gitPath===d.gitPath&&o.observedHash===d.contentHash&&o.currentHash===d.contentHash))){ready=false;break;}}
176
209
  catch{ready=false;break;}
177
210
  const scope=state.scopes.find(s=>s.scopeVersion===state.scopeVersion);if(!scope||task.paths.some(p=>!scope.data.paths.some(base=>within(base,p)))){ready=false;break;}
@@ -15,7 +15,7 @@ import {prepareCooperativeAssignment} from './assignment.mjs';
15
15
  */
16
16
  import path from 'node:path';
17
17
  import {legacyCooperativeRoleDenial,validateCooperativeState,validateCooperativeCommand} from './cooperative-schema.mjs';
18
- import {validateWorkflowState, validateRequest, validateEvidence,validatePlannerStage} from './schema.mjs';
18
+ import {validateWorkflowState, validateRequest, validateEvidence,validatePlannerStage,hasExactPlanningKinds,planningDocumentKinds} from './schema.mjs';
19
19
  import {ROLES, ROLE_OPERATIONS, GIT_OPERATIONS, EXTERNAL_OPERATIONS, canonicalCooperativeRole} from './operations.mjs';
20
20
  const same=(a,b)=>JSON.stringify(a)===JSON.stringify(b);
21
21
  const within=(base,file)=>{const relative=path.relative(base,file);return relative===''||(!relative.startsWith('..'+path.sep)&&relative!=='..'&&!path.isAbsolute(relative));};
@@ -68,7 +68,7 @@ export function evaluate(policy, state, request, evidence){
68
68
  if(d.role==='implementer'){
69
69
  if(state.mode==='plan'){
70
70
  // T3 supplies verified Git object evidence. Local assertions never satisfy this gate.
71
- if(!state.documents.some(d=>d.kind==='spec')||!state.documents.some(d=>d.kind==='plan'))return result('hold','runtime.docs-commit','approved complete spec and plan required',['approved-documents','docs-only-commit']);
71
+ if(!hasExactPlanningKinds(state.documents,planningDocumentKinds(state.planningDepth)))return result('hold','runtime.docs-commit','approved complete planning-document set required',['approved-documents','docs-only-commit']);
72
72
  const docs=fact('docs-commit')?.data;
73
73
  const approved=state.documents.every(d=>state.approvals.some(a=>a.id===d.approvalRef&&a.contentHash===d.contentHash&&evidence.provenance.some(p=>p.id===a.id&&p.source===a.source&&p.verification.sourceRef===p.messageRef&&p.messageRef===a.messageRef&&p.contentHash===d.contentHash)));
74
74
  if(!approved||!docs||!docs.commit||!docs.parent||!docs.tree||!same(docs.documents,state.documents)||!same([...docs.paths??[]].sort(),state.documents.map(d=>d.gitPath).sort())||state.documents.some(d=>d.commit!==docs.commit))return result('hold','runtime.docs-commit','Git object and approval verification required',['verified-docs-only-commit']);
@@ -88,7 +88,12 @@ export function evaluate(policy, state, request, evidence){
88
88
  const stage=state.plannerLedger?.stages.find(s=>s.id===d.plannerCall?.stageId),proof=fact('planner-call');
89
89
  const contract=stage&&{document:stage.document,inputVersion:stage.inputVersion,criteriaVersion:stage.criteriaVersion,scopeVersion:stage.scopeVersion};
90
90
  if(!stage||stage.workflowId!==state.workflowId||stage.approvalRef!==approval.id||!same(approval.scope.plannerStage,contract)||!d.paths.includes(stage.document.path)||proof?.sourceRef!==correlation.sourceRef||!same({stageId:proof?.data.stageId,inputVersion:proof?.data.inputVersion,criteriaVersion:proof?.data.criteriaVersion,scopeVersion:proof?.data.scopeVersion},{stageId:stage.id,inputVersion:stage.inputVersion,criteriaVersion:stage.criteriaVersion,scopeVersion:stage.scopeVersion}))return result('hold','runtime.planner-call','Current approved Planner stage and provider evidence required',['planner-stage-ledger','planner-call-evidence']);
91
- if(stage.document.kind==='plan'&&!state.documents.some(doc=>doc.kind==='spec'&&state.approvals.some(a=>a.id===doc.approvalRef&&a.contentHash===doc.contentHash&&evidence.provenance.some(p=>p.id===a.id&&p.messageRef===a.messageRef&&p.contentHash===doc.contentHash&&p.verification.sourceRef===a.messageRef))))return result('hold','runtime.planner-call','Approved spec prerequisite required',['approved-spec']);
91
+ if(state.planningDepth==='Bounded'&&stage.document.kind==='spec')return result('hold','runtime.planner-call','Bounded depth has no spec stage',['approved-spec']);
92
+ if(stage.document.kind==='plan'&&state.planningDepth!=='Bounded'){
93
+ const reviewedSpecStage=state.plannerLedger.stages.some(s=>s.workflowId===state.workflowId&&s.document.kind==='spec'&&s.ready===true&&s.review.full===true&&s.review.complete===true&&s.scopeVersion===stage.scopeVersion);
94
+ const approvedSpec=reviewedSpecStage||state.documents.some(doc=>doc.kind==='spec'&&state.approvals.some(a=>a.id===doc.approvalRef&&a.contentHash===doc.contentHash&&evidence.provenance.some(p=>p.id===a.id&&p.messageRef===a.messageRef&&p.contentHash===doc.contentHash&&p.verification.sourceRef===a.messageRef)));
95
+ if(!approvedSpec)return result('hold','runtime.planner-call','Reviewed spec prerequisite required',['approved-spec']);
96
+ }
92
97
  const planner=evaluatePlannerCall({stage,request:{...d.plannerCall,requestId:request.requestId},evidence:{artifacts:proof.data.artifacts,semanticProvenance:'operator-attested'}});
93
98
  if(planner.decision!=='allow')return planner;
94
99
  next.plannerLedger.stages[next.plannerLedger.stages.findIndex(s=>s.id===stage.id)]=planner.proposedTransition;
@@ -108,7 +113,7 @@ export function evaluate(policy, state, request, evidence){
108
113
  const relative=p=>typeof p==='string'&&p.length>0&&!/[\\\x00\r\n:]/.test(p)&&!p.startsWith('/')&&!p.split('/').some(x=>!x||x==='.'||x==='..');
109
114
  if(!observed||!same(observed,d)||d.parent!==state.target.head||!d.indexTree||!Array.isArray(d.paths)||!d.paths.length||!d.paths.every(relative)||new Set(d.paths).size!==d.paths.length||!same([...d.paths.map(p=>path.join(state.target.realpath,...p.split('/')))].sort(),[...request.paths].sort()))return result('hold','git.orchestrator-accept-commit','actual Git objects and relative path verification required',['git-evidence']);
110
115
  if(d.kind==='documents'){
111
- if(state.mode!=='plan'||state.documents.length!==2||!same(state.documents.map(x=>x.kind).sort(),['plan','spec'])||!same([...d.paths].sort(),state.documents.map(x=>x.gitPath).sort())||state.documents.some(doc=>doc.path!==path.join(state.target.realpath,...doc.gitPath.split('/'))||!state.approvals.some(a=>a.id===doc.approvalRef&&a.contentHash===doc.contentHash&&evidence.provenance.some(p=>p.id===a.id&&p.source===a.source&&p.messageRef===a.messageRef&&p.contentHash===doc.contentHash&&p.verification.sourceRef===a.messageRef))))return result('hold','runtime.docs-commit','exact approved documents required',['approved-documents']);
116
+ if(state.mode!=='plan'||!hasExactPlanningKinds(state.documents,planningDocumentKinds(state.planningDepth))||!same([...d.paths].sort(),state.documents.map(x=>x.gitPath).sort())||state.documents.some(doc=>doc.path!==path.join(state.target.realpath,...doc.gitPath.split('/'))||!state.approvals.some(a=>a.id===doc.approvalRef&&a.contentHash===doc.contentHash&&evidence.provenance.some(p=>p.id===a.id&&p.source===a.source&&p.messageRef===a.messageRef&&p.contentHash===doc.contentHash&&p.verification.sourceRef===a.messageRef))))return result('hold','runtime.docs-commit','exact approved documents required',['approved-documents']);
112
117
  }else{
113
118
  const accepted=state.acceptances.find(a=>a.taskId===task.id&&a.fingerprint===d.fingerprint&&state.identities.some(i=>i.actorRef===a.actorRef&&i.role==='orchestrator'));
114
119
  if(d.kind!=='task'||!accepted||task.status!=='accepted'||request.paths.some(p=>!task.paths.some(base=>within(base,p))))return result('hold','git.orchestrator-accept-commit','accepted task verification required',['git-evidence']);
@@ -222,8 +227,18 @@ export function evaluateCooperativePlanner({state,request,evidence}={}){
222
227
  if(data.targetIntentId){const intent=state.targetIntents?.find(i=>i.id===data.targetIntentId);if(!intent||intent.firstStageId!==data.id||intent.sourceTargetVersion!==state.targetVersion||intent.documents.some(d=>d.kind==='spec')&&data.document.kind!=='spec'||!intent.documents.some(d=>d.kind===data.document.kind&&path.join(state.target.realpath,d.path)===data.document.path))return result('hold','Current target intent and matching first document required');}
223
228
  const targetIntent=state.targetIntents?.find(i=>i.id===data.targetIntentId);
224
229
  const approvedOmission=targetIntent?.depth==='Bounded'&&targetIntent.firstStageId===data.id&&targetIntent.documents.length===1&&targetIntent.documents[0].kind==='plan';
225
- const approvedSpec=approval.data.prerequisiteRefs?.some(ref=>state.records.some(r=>r.kind==='approval'&&r.messageRef===ref&&r.data.kind==='spec'&&r.source==='operator-attested'&&r.scopeVersion===state.scopeVersion&&r.targetVersion===state.targetVersion&&(!preparedIntent||state.targetDocuments?.some(d=>d.intentId===preparedIntent.id&&preparedIntent.documents.some(doc=>doc.kind==='spec'&&doc.path===d.path)&&d.approvalRef===ref&&d.scopeVersion===state.scopeVersion&&d.targetVersion===state.targetVersion&&[d.path,path.join(state.target.realpath,d.path)].includes(r.data.path)&&d.hash===r.data.contentHash))));
226
- if(data.document.kind==='plan'&&!approvedOmission&&!approvedSpec)return result('hold','Approved spec prerequisite is required for plan drafting');
230
+ if(data.document.kind==='plan'&&!approvedOmission){
231
+ const refs=approval.data.prerequisiteRefs;
232
+ const current=r=>r.source==='operator-attested'&&r.scopeVersion===state.scopeVersion&&r.targetVersion===state.targetVersion;
233
+ if(preparedIntent){
234
+ const spec=preparedIntent.documents.find(d=>d.kind==='spec');
235
+ const reviewedSpec=state.targetDocuments?.findLast(d=>d.intentId===preparedIntent.id&&d.path===spec?.path&&d.scopeVersion===state.scopeVersion&&d.targetVersion===state.targetVersion);
236
+ const review=reviewedSpec&&state.records.find(r=>r.kind==='planner-review'&&r.messageRef===reviewedSpec.reviewRef&&current(r)&&r.data?.full===true&&r.data?.complete===true&&r.data?.hash===reviewedSpec.hash);
237
+ const approvedSpec=reviewedSpec?.approvalRef&&state.records.find(r=>r.kind==='approval'&&r.messageRef===reviewedSpec.approvalRef&&r.data.kind==='spec'&&current(r)&&[reviewedSpec.path,path.join(state.target.realpath,reviewedSpec.path)].includes(r.data.path)&&r.data.contentHash===reviewedSpec.hash);
238
+ if(!review||approval.actor?.role!=='orchestrator'||!Array.isArray(refs)||!(refs.includes(reviewedSpec.reviewRef)||approvedSpec&&refs.includes(approvedSpec.messageRef)))return result('hold','Reviewed spec prerequisite is required for plan drafting');
239
+ if(evidence.reviewedSpec?.hash!==reviewedSpec.hash)return result('hold','Reviewed spec bytes changed');
240
+ }else if(!Array.isArray(refs)||!refs.some(ref=>state.records.some(r=>r.kind==='approval'&&r.messageRef===ref&&r.data.kind==='spec'&&current(r))))return result('hold','Reviewed spec prerequisite is required for plan drafting');
241
+ }
227
242
  const previous=[...ledger.stages,...(evidence.plannerHistory??[]).map(h=>h.stage)].filter(s=>s.document.path===data.document.path&&s.document.kind===data.document.kind&&s.document.phase===data.document.phase);
228
243
  if(evidence.plannerHistoryError)return result('hold','Planner history could not be verified: '+evidence.plannerHistoryError);
229
244
  if(previous.length){
@@ -1,6 +1,7 @@
1
1
  import {validateGitPreflight,validateGitCommitResult} from './git-evidence.mjs';
2
2
  export {validateGitPreflight,validateGitCommitResult} from './git-evidence.mjs';
3
3
  import path from 'node:path';
4
+ import {hasExactPlanningKinds,planningDocumentKinds} from './schema.mjs';
4
5
 
5
6
  const reconciliations=new WeakMap();
6
7
  export function verifiedReconciliation(decision,state,next,expectedCommit){const proof=reconciliations.get(decision);return !!proof&&proof.before===JSON.stringify(state)&&proof.after===JSON.stringify(next)&&(expectedCommit===undefined||proof.expected===JSON.stringify(expectedCommit));}
@@ -33,7 +34,7 @@ export async function runGate({phase,state,request,gitEvidence,expectedCommit,re
33
34
  return path.relative(state.target.realpath,file).split(path.sep).join('/');
34
35
  }),d.paths))return hold('Request paths differ from commit paths');
35
36
  if(d.kind==='documents'){
36
- if(state.mode!=='plan'||state.documents?.length!==2||!samePaths(state.documents.map(x=>x.kind),['spec','plan'])||!samePaths(d.paths,state.documents.map(x=>x.gitPath)))return hold('Complete exact approved spec and plan set required','runtime.docs-commit');
37
+ if(state.mode!=='plan'||!hasExactPlanningKinds(state.documents,planningDocumentKinds(state.planningDepth))||!samePaths(d.paths,state.documents.map(x=>x.gitPath)))return hold('Complete exact approved planning-document set required','runtime.docs-commit');
37
38
  for(const document of state.documents){
38
39
  const approvals=state.approvals?.filter(a=>a.id===document.approvalRef);
39
40
  if(!hash(document.contentHash)||document.path!==path.join(state.target.realpath,...document.gitPath.split('/'))||approvals?.length!==1||!['user-message','human-confirmation'].includes(approvals[0].source)||!approvals[0].messageRef||approvals[0].contentHash!==document.contentHash)return hold('Approved document hash unavailable','runtime.docs-commit');
@@ -43,6 +43,7 @@ export function validateWorkflowState(s,{allowLegacyOperations=true,preserveStor
43
43
  if(['policyHash','runtimeHash','adapterHash'].some(k=>!hash(s.versions[k])))fail('hash algorithm');
44
44
  if(!object(s.target)||!absolute(s.target.realpath)||['repository','worktree','baseHead','head'].some(k=>!text(s.target[k]))||!(s.target.branch===null||text(s.target.branch)))fail('target');
45
45
  if(!['plan','small-task','no-plan'].includes(s.mode))fail('mode');
46
+ if(s.planningDepth!==undefined&&!['Architectural','Bounded'].includes(s.planningDepth))fail('planning depth');
46
47
  for(const k of ['documents','approvals','tasks','assignments','identities','leases','checks','findings','acceptances','commits','audit','capabilities','requests'])if(!Array.isArray(s[k]))fail(k);
47
48
  const stored=s,normalized=normalizeStoredOperations(s);
48
49
  if(!allowLegacyOperations&&normalized!==s&&(!legacyOperationsFrom||hasNewStoredOperationAliases(s,legacyOperationsFrom)))fail('legacy operation in new state');
@@ -66,6 +67,21 @@ export function validateWorkflowState(s,{allowLegacyOperations=true,preserveStor
66
67
  if(s.plannerLedger!==undefined){validatePlannerLedger(s.plannerLedger);if(s.plannerLedger.stages.some(stage=>stage.workflowId!==s.workflowId))fail('Planner workflow binding');}
67
68
  return preserveStoredOperations?stored:s;
68
69
  }
70
+ export function planningDocumentKinds(depth){
71
+ return depth==='Bounded'?['plan']:['plan','spec'];
72
+ }
73
+ export function hasExactPlanningKinds(documents,kinds){
74
+ if(!Array.isArray(documents)||documents.length!==kinds.length)return false;
75
+ const actual=documents.map(d=>d?.kind).sort();
76
+ return kinds.every((kind,index)=>kind===actual[index]);
77
+ }
78
+ export function preparedTargetIntent(state){
79
+ return state.targetIntents?.find(i=>state.targetTransitions?.some(t=>t.intentId===i.id&&t.targetVersion===state.targetVersion));
80
+ }
81
+ export function expectedCooperativePlanningKinds(state){
82
+ const intent=preparedTargetIntent(state);
83
+ return intent?[...new Set(intent.documents.map(d=>d.kind))].sort():planningDocumentKinds();
84
+ }
69
85
  export function validateRequest(r){
70
86
  if(!object(r)||['requestId','actorRef','taskId','toolName'].some(k=>!text(r[k]))||!isPlatformId(r.platform)||!OPERATIONS.includes(r.operation)||!absolute(r.cwd)||!object(r.arguments)||!object(r.descriptor)||!strings(r.paths)||r.paths.some(p=>!absolute(p)))fail('request');
71
87
  return r;
@@ -38,7 +38,7 @@ export function validateTargetPreparationRecord(kind,data){
38
38
  if(kind==='intent'&&(!Number.isSafeInteger(data.sourceTargetVersion)||data.sourceTargetVersion<1||!['realpath','gitCommonDir','gitDir'].every(k=>typeof data.sourceTarget[k]==='string'&&path.isAbsolute(data.sourceTarget[k])&&path.normalize(data.sourceTarget[k])===data.sourceTarget[k])||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(data.sourceTarget.head)||!(data.sourceTarget.branch===null||text(data.sourceTarget.branch))||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(data.base)||new Set(data.documents.map(d=>d.path)).size!==data.documents.length))throw Error('Invalid target preparation intent identity');
39
39
  if(kind==='checkpoint'&&(!text(data.intentId)||!text(data.stageId)||!text(data.resultRef)||!text(data.selfReviewRef)))throw Error('Invalid target preparation checkpoint');
40
40
  if(kind==='transition'&&(!text(data.intentId)||!text(data.checkpointRef)||!Number.isSafeInteger(data.expectedRevision)||data.expectedRevision<0))throw Error('Invalid target preparation transition');
41
- if(kind==='destination'&&(!text(data.intentId)||!text(data.transitionRef)||!text(data.stageId)||!text(data.resultRef)||!text(data.selfReviewRef)||!relative(data.path)||!/^sha256:[a-f0-9]{64}$/.test(data.hash)||![0o100644,0o100755].includes(data.mode)||!text(data.reviewRef)||!text(data.approvalRef)||!Number.isSafeInteger(data.targetVersion)||data.targetVersion<1))throw Error('Invalid target preparation destination');
41
+ if(kind==='destination'&&(!text(data.intentId)||!text(data.transitionRef)||!text(data.stageId)||!text(data.resultRef)||!text(data.selfReviewRef)||!relative(data.path)||!/^sha256:[a-f0-9]{64}$/.test(data.hash)||![0o100644,0o100755].includes(data.mode)||!text(data.reviewRef)||(data.approvalRef!==undefined&&!text(data.approvalRef))||!Number.isSafeInteger(data.targetVersion)||data.targetVersion<1))throw Error('Invalid target preparation destination');
42
42
  return data;
43
43
  }
44
44
 
@@ -49,6 +49,7 @@ export function evaluateTargetPreparation({state,request,evidence}={}){
49
49
  if(state.targetIntents?.some(intent=>!state.targetTransitions?.some(transition=>transition.intentId===intent.id)))return hold('Existing target preparation intent is still active');
50
50
  const approval=state.records?.find(r=>r.kind==='approval'&&r.messageRef===request.approvalRef&&r.source==='operator-attested'&&r.actor?.role==='orchestrator'&&r.targetVersion===state.targetVersion&&r.scopeVersion===state.scopeVersion);
51
51
  const approved=approval?.data?.targetPreparation;
52
+ if(request.depth==='Bounded'&&request.documents.some(d=>d.kind==='spec'))return hold('Bounded depth has no spec stage');
52
53
  if(!['Bounded','Architectural'].includes(request.depth)||(request.depth==='Architectural'&&(!request.documents.some(d=>d.kind==='spec')||!request.documents.some(d=>d.kind==='plan'))))return hold('Approved depth requires its complete document set');
53
54
  if(!text(request.approvalRef)||!text(request.depth)||['depth','selectionRef','kind','candidate','base','workflowId','firstStageId','sourceTargetVersion'].some(k=>approved?.[k]!==request[k])||!same(approved?.sourceTarget,request.sourceTarget)||!same(approved?.documents,request.documents)||request.workflowId!==state.workflowId||request.sourceTargetVersion!==state.targetVersion||!same(request.sourceTarget,state.target)||!same(evidence?.source?.target,state.target)||!text(evidence?.source?.fingerprint)||!state.selections?.some(s=>s.messageRef===request.selectionRef&&s.targetVersion===state.targetVersion)||state.targetIntents?.some(i=>i.id===request.id)||request.base!==state.target.head)return hold('Current approval, document set, source, explicit choice and preservation snapshot required');
54
55
  return {decision:'allow',ruleIds:['cooperative.target-preparation'],proposedTransition:{intent:{...structuredClone(request),scopeVersion:state.scopeVersion,sourceFingerprint:evidence.source.fingerprint,...(evidence.source.snapshot?{sourceSnapshot:structuredClone(evidence.source.snapshot)}:{}),source:'operator-attested'}}};
@@ -70,8 +71,12 @@ export function evaluateTargetPreparation({state,request,evidence}={}){
70
71
  if(request.type==='destination'){
71
72
  const intent=state.targetIntents?.find(i=>i.id===request.intentId),document=intent?.documents?.find(d=>d.path===request.path),transition=state.targetTransitions?.find(t=>t.intentId===request.intentId&&t.messageRef===request.transitionRef&&t.targetVersion===state.targetVersion),checkpoint=state.targetCheckpoints?.find(c=>c.intentId===request.intentId&&c.messageRef===transition?.checkpointRef),stage=state.plannerLedger?.stages?.find(s=>s.id===request.stageId),chat=stage?.result?.chatDraft,observed=evidence?.destination?.document;
72
73
  const review=state.records?.find(r=>r.kind==='planner-review'&&r.messageRef===request.reviewRef&&r.scopeVersion===state.scopeVersion&&r.targetVersion===state.targetVersion&&r.source==='operator-attested'),approval=state.records?.find(r=>r.kind==='approval'&&r.messageRef===request.approvalRef&&r.scopeVersion===state.scopeVersion&&r.targetVersion===state.targetVersion&&r.source==='operator-attested');
74
+ if(intent&&document&&request.approvalRef===undefined&&!(intent.depth==='Architectural'&&document.kind==='spec'))return hold('Document approval required for this destination');
73
75
  if(!intent||!document||intent.firstStageId!==request.stageId||!transition||!same(transition.target,state.target)||request.targetVersion!==state.targetVersion||!checkpoint||checkpoint.stageId!==request.stageId||checkpoint.resultRef!==request.resultRef||checkpoint.selfReviewRef!==request.selfReviewRef||stage?.targetIntentId!==intent.id||stage.result?.ref!==request.resultRef||stage.result.status!=='succeeded'||chat?.intentId!==intent.id||chat.complete!==true||chat.selfReviewRef!==request.selfReviewRef||!same(evidence?.destination?.target,state.target)||observed?.verification?.status!=='verified'||observed.verification.source!=='local-bytes'||observed.path!==request.path||observed.hash!==request.hash||observed.mode!==request.mode)return hold('Current transition, source attestation and observed destination bytes required');
74
- if(stage.scopeVersion!==state.scopeVersion||review?.data?.resultRef!==request.resultRef||review.data.full!==true||review.data.complete!==true||review.data.hash!==request.hash||!Array.isArray(stage.criteria)||!Array.isArray(review.data.criteria)||review.data.criteria.length!==stage.criteria.length||new Set(review.data.criteria.map(c=>c.id)).size!==stage.criteria.length||review.data.criteria.some(c=>!stage.criteria.some(s=>s.id===c.id)||c.status!=='resolved'||!text(c.judgmentRef))||approval?.data?.kind!==document.kind||approval.data.contentHash!==request.hash||![request.path,path.join(state.target.realpath,request.path)].includes(approval.data.path))return hold('Current full review and document approval required');
76
+ const approvedPath=[request.path,path.join(state.target.realpath,request.path)];
77
+ const matchesApproval=entry=>entry?.kind===document.kind&&entry.contentHash===request.hash&&approvedPath.includes(entry.path);
78
+ const approved=request.approvalRef===undefined||(Array.isArray(approval?.data?.documents)?stage?.document?.kind===document.kind&&approval.data.documents.filter(matchesApproval).length===1:matchesApproval(approval?.data));
79
+ if(stage.scopeVersion!==state.scopeVersion||review?.data?.resultRef!==request.resultRef||review.data.full!==true||review.data.complete!==true||review.data.hash!==request.hash||!Array.isArray(stage.criteria)||!Array.isArray(review.data.criteria)||review.data.criteria.length!==stage.criteria.length||new Set(review.data.criteria.map(c=>c.id)).size!==stage.criteria.length||review.data.criteria.some(c=>!stage.criteria.some(s=>s.id===c.id)||c.status!=='resolved'||!text(c.judgmentRef))||!approved)return hold('Current full review and document approval required');
75
80
  return {decision:'allow',ruleIds:['cooperative.target-preparation'],proposedTransition:{destination:{...structuredClone(request),scopeVersion:state.scopeVersion,sourceLink:'operator-attested',verification:{status:'verified',source:'local-bytes'}}}};
76
81
  }
77
82
  if(request?.type!=='checkpoint')return hold('Unsupported target preparation request');
@@ -67,7 +67,7 @@ function record({state,request,evidence}){
67
67
  export function evaluateCooperativeVerification({state,request,evidence}={}){
68
68
  const denial=legacyCooperativeRoleDenial(request);
69
69
  if(denial)return {...base(state),...denial};
70
- if(state?.mode!=='plan')return hold(state,'unsupported','Only the complete spec and plan path is supported');
70
+ if(state?.mode!=='plan')return hold(state,'unsupported','Only the plan path is supported');
71
71
  if(!request||request.expectedRevision!==state.revision)return hold(state,'revision','Stale verification request');
72
72
  if(request.actor?.role!=='orchestrator')return hold(state,'verification-actor','Orchestrator statement required');
73
73
  if(request.operation==='verification-record')return record({state,request,evidence});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yunhozz/arc",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -0,0 +1,39 @@
1
+ # Visual companion — shared text
2
+
3
+ This file holds text shared by every platform's arc-visual-companion.md. Each part belongs to the section that links to it and has the same force there.
4
+
5
+ <a id="visual-companion"></a>
6
+ # Visual companion
7
+
8
+ Read before offering or operating the companion. Design discussion is distinct from Tester UI acceptance under an approved test brief.
9
+
10
+ Use visuals when they materially help design discussion or verification. Orchestrator determines actual capability/consent. Planner returns visualization needs only; DO NOT invent browser/shell access. Other depth-2 roles stay within their profile tool limits and cannot delegate visualization.
11
+
12
+ - Verify actual browser/preview capability; NEVER assume platform preview support.
13
+ - Use an available authorized local/browser flow only within Orchestrator scope.
14
+ - Separate preview artifacts from user files, record side effects and preserve unrelated work. Report unavailable capability without claiming visual verification.
15
+ - NEVER expose secrets or publish previews without authorization.
16
+
17
+ 1. Planner returns a useful visual question, reason, options, user decision and complete content draft; no screen writing, server/browser operation or approval request.
18
+ 2. Orchestrator offers in a separate message when visuals clarify the question, then waits for acceptance. After refusal, continue in text without reoffering unless the user raises it.
19
+ 3. After acceptance, decide per question. A UI topic or companion consent does not route every question to a browser.
20
+ 4. Orchestrator owns guide, server/browser, paths, live-session checks, complete keyed URL, screens/session state, feedback/events and cleanup. Clear stale screens when returning to text. Check the server before display. After replies, terminal text is primary and events supplemental.
21
+
22
+ Upstream guide/scripts: `<installed ARC>/references/visual-companion.md` and adjacent `scripts/`. ARC guide: `references/arc-visual-companion.md`. Orchestrator supplies absolute paths and owns approval/server/browser. Missing files stop dependent work; no global fallback.
23
+
24
+ 1. Run upstream relative commands from installed ARC `references/`; Orchestrator supplies the absolute working directory.
25
+ 2. Record `screen_dir`, `state_dir` and the complete keyed URL from the server or this session's `state/server-info`. NEVER guess another session path.
26
+ 3. A/B highlighting proves selection display only. Separately inspect that session's exact `state_dir/events` for saved events. Clicking starts neither a chat turn nor an automatic response.
27
+ 4. Tell the user to return to chat and send a follow-up after selection. On the actual next turn, reread the same events file and combine it with the current message. Current chat text is primary; events are supplemental. Chat wins conflicts; clarify missing/ambiguous feedback.
28
+ 5. DO NOT infer storage from highlighting or next-turn consumption from an earlier Tester parse. Preserve imported guide/scripts.
29
+
30
+ <a id="follow-up-verification-of-approved-visual-sources"></a>
31
+ ## Follow-up verification of approved visual sources
32
+
33
+ Each visual criterion requires the exact approved source location, version, approval and access state; criterion IDs, properties and comparison method; and evidence linking the actual output to its revision. Implementer reporting does not replace fresh Tester comparison.
34
+
35
+ - Record pass/mismatch/unverified and connect to proven/unmet/unverified criterion verdicts. Pass requires accessible evidence meeting the criterion; unsupported claims remain unverified.
36
+ - A missing revision link is unverified; a visible difference is a mismatch. Record them separately without inferring the current branch UI state.
37
+ - Hold comparison for inaccessible source/output or missing interpretation approval.
38
+
39
+ Static checks of policy, generated files and the manifest prove structure only, not actual role behavior, installed builds, platform CLI compliance or visual fidelity. Report changes, exclusions, checks run and omitted, criterion evidence and limits, and platform availability. Separate baseline failures. Independent progress never relaxes checks or criteria.
@@ -0,0 +1,45 @@
1
+ # Focused commits — shared text
2
+
3
+ This file holds text shared by every platform's commit.md. Each part belongs to the section that links to it and has the same force there.
4
+
5
+ <a id="automatic-commit-after-plan-task-acceptance"></a>
6
+ ## Automatic commit after plan-task acceptance
7
+
8
+ One approved top-level task is one focused implementation commit. Orchestrator verifies criteria, current checks and findings, accepts by judgment, then immediately commits locally without separate user commit approval. After acceptance, Orchestrator records that task's progress (checkboxes, notes, results, evidence and status) and includes it with that task's implementation work in the same commit. DO NOT amend the original planning commit or create a separate docs/fixup commit for those records. After acceptance, check Git state/scope, stage and commit. NEVER commit before acceptance or defer until plan completion. Implementer completion is not acceptance; explicit assignment never permits Implementer commits.
9
+
10
+ Substeps and checkboxes track progress, not commits. Completion marks, reports and passing checks do not establish acceptance; connect conditions and expected results to evidence. Plan omission creates neither new plans nor automatic commits; follow applicable guidance/user requests. Push/merge/publish/deploy/install retain separate approvals. Reviewer timing follows [verification](verification.md#risk-scaled-execution).
11
+
12
+ 1. Before commit verify approved plan version/task ID/accepted scope, actual absolute workspace/repository/branch or detached HEAD/HEAD, staged/unstaged/untracked state and ownership.
13
+ 2. Verify staged content/paths include only this task, its own progress records, eligible plan-level progress records, eligible pending approved spec/plan revisions and final message; verify revision scope and required trailers. Prove safe separation of other tasks/user changes in shared files. Unrelated staging blocks commit under Preservation rule.
14
+ 3. After commit verify SHA/message/paths/content, HEAD/branch and remaining state. Successful exit alone proves no completion.
15
+ 4. Canonically link plan path/version, task ID, acceptance evidence/judgment, required checks/findings, commit results/state, hold/no-change/reuse reasons and remaining final verification.
16
+
17
+ Hold commits for unmet/unresolved criteria, failed/not-run required checks, undispositioned findings/gaps, scope expansion/revised-plan needs, ownership/staged scope/content mismatch, unexpected workspace/branch/HEAD/Git state or failure/partial completion. Record reason/next action; NEVER waive criteria/checks to commit. Disposition follows Evidence verdict. Inspect actual branch/HEAD/index/working tree/partial completion before retry; uncertain commit creation stops immediate retries. Orchestrator follows [recovery](git-recovery.md), resolves and revalidates evidence.
18
+
19
+ No-change tasks record acceptance/no change without empty commits. Resume verifies/reuses the same task's SHA/content/validity without duplication. Missing records require actual-result inspection before retry. Normal accepted commits retain valid choice reuse with fresh state/ownership checks. Task acceptance/commit differs from final plan acceptance; remaining Tester/Reviewer/integration checks retain their timing.
20
+
21
+ For final Reviewer findings on committed plan work, define follow-up task/required planning/approvals. Implementer leaves corrections uncommitted through rechecks. Orchestrator refreshes committed state plus uncommitted diff/changed-file list in Reviewer artifacts/briefs. Reuse/assign an independent Reviewer; repeat Implementer → Reviewer without Tester reassignment until resolved, then accept and create one focused follow-up commit. Final Tester findings retain Implementer → Tester before a new commit. NEVER automatically amend/reset/duplicate original implementation commits. NEVER amend planning or implementation commits. Scope expansion retains planning/approval duties.
22
+
23
+ Local commit authority never permits early planning-document commits. Pre-Implementer approvals/explicit target/batch preparation remain. NEVER amend planning or implementation commits or retroactively authorize past work. Structural checks prove no live compliance.
24
+
25
+ <a id="execution-time-plan-document-updates"></a>
26
+ ## Execution-time plan document updates
27
+
28
+ Follow [planning](planning.md#plan-updates-during-execution) and [preparation](handoff-prep.md#execution-time-plan-revision). Include all pending approved spec/plan revisions in the accepted commit of the first top-level task executed or reconfirmed against the revised version; otherwise use a current task acceptance or final Reviewer follow-up commit. Same-task progress records follow the task implementation commit path above. Preserve actual approval chronology; NEVER authorize past work retroactively.
29
+
30
+ Plan-level progress records are final verification results, each final Reviewer round's verdict and finding dispositions (including references to user decisions) and overall completion status. Preserving the approved contract, they need no new approval; changing it makes them a plan revision. They are the sole exception to excluding other tasks' records: Orchestrator includes them in that plan's next commit, either a task acceptance commit created by final Reviewer finding work or the final Reviewer follow-up commit. When no implementation work remains, such as a final Reviewer approval without findings or a user decision not to fix a non-blocking finding, Orchestrator creates no commit for them alone: unless a standalone closing commit made for pending revisions carries them, Orchestrator keeps them only in the canonical handoff record, leaves the plan document unchanged and the working tree clean, and states this in the completion report. Plan-level progress records alone never trigger the standalone `docs(plan)` closing commit. Write plan-level progress records into the plan document only while staging the commit that carries them; until then keep them in the canonical handoff record.
31
+
32
+ Only when no implementation work remains before overall completion MAY Orchestrator create one standalone `docs(plan): <description>` closing commit. Record the supporting evidence canonically, include all pending revisions and required trailers, and include no implementation files. This is the sole separate docs/fixup exception; overall completion requires no pending revision. NEVER amend planning or implementation commits, reset, replay or rewrite their history. When this closing commit is made for pending revisions, it also carries the plan-level progress records.
33
+
34
+ For independent tasks accepted against a prior version, exclude pending revision hunks and stage only that task's own progress records; hold the commit if separation is unsafe. Before staging/commit verify pending revision inclusion/exclusion against the selected task/version and compare staged scope/content to approved copies. For every document add `Plan-Revision: <gitPath> v<from> -> v<to>`; for each version after from through to add `Plan-Approved-At: <gitPath> v<N> <actual ISO 8601 approval time>` and `Plan-Reason: <gitPath> v<N> <reason>`. Use ASCII `->`, repeat keys as needed, preserve existing Git trailers and verify trailers before commit.
35
+
36
+ After commit verify blobs/latest approved content and clear pending revisions under [verification](verification.md#evidence-after-plan-revision-commit). Preserve implementation acceptance, focused commits and correction follow-ups. Initial complete approved batch still precedes handoff; existing approvals/authority remain.
37
+
38
+ <a id="shared-checkout-coordination"></a>
39
+ ## Shared-checkout coordination
40
+
41
+ Orchestrator serializes shared Git/index/staging/commits across tasks; parallel Implementers NEVER compete in Git transactions. Preserve all other unfinished changes/ownership. Commit accepted work only after scope/content checks. Unrelated staging blocks, but unrelated unstaged work need not finish or enter this commit. Unclear separation/ownership holds affected work.
42
+
43
+ After each normal independent commit verify/record SHA/content/HEAD/remaining state, refresh canonical record/briefs/gates and immediately reassess readiness. Authorized HEAD changes alone invalidate neither choice nor independent dispatch. Predecessors release dependents only after checks/acceptance/verified commit; accepted no-change replaces commits, never empty commits. Unexpected HEAD/ownership/Git failure stops affected work until resolution/revalidation.
44
+
45
+ Authorization follows [planning](planning.md#authorization-and-scope); completion/limits follow [verification](verification.md#completion-continuity). Add no no-plan commit duty or claim that local commits establish overall completion.
@@ -0,0 +1,193 @@
1
+ # Role assignment and coordination — shared text
2
+
3
+ This file holds text shared by every platform's coordination.md. Each part belongs to the section that links to it and has the same force there.
4
+
5
+ <a id="role-assignment-and-coordination"></a>
6
+ # Role assignment and coordination
7
+
8
+ Orchestrator reads this before the first specialist creation or assignment and related decisions. Also read [limits](limits.md) and installed `../limits.toml` before creation. Report exact missing, inaccessible or conflicting paths; hold dependent work.
9
+
10
+ <a id="ownership"></a>
11
+ ## Ownership
12
+
13
+ | Role | Ownership and return |
14
+ |---|---|
15
+ | Orchestrator | Sole coordinator of development/configuration/tests/dependent docs/mixed implementation. Assigns edits to Implementer; owns scope, planning, approval, integration (save/review/directly revise the same spec or plan after Planner first draft, route decisions and request approval), verification, acceptance and completion |
16
+ | Scouter | Read-only material research/analysis and assigned static exploration. Reports evidence, assumptions, questions, impact, next actions and path issues. No editing, standalone documents or design/plan/verification/review/completion decisions |
17
+ | Planner | Returns design/spec/plan drafts |
18
+ | Implementer | Edits approved assigned implementation/configuration/tests/dependent docs; Orchestrator direct edits only under the small-task path |
19
+ | Tester | Verifies without editing |
20
+ | Reviewer | Independently reviews the final full change |
21
+
22
+ Orchestrator is depth 1. All five specialists report directly at depth 2 without creating agents/delegating. Reviewer stays independent.
23
+
24
+ <a id="coordination-execution-mode"></a>
25
+ ### Execution mode
26
+
27
+ Obey concurrency limits across the tree, including Scouter. No reserved role slots. Read limits before first creation and maintain cumulative ledger/reservations. Parallelize independent tasks only; dependent handoffs are sequential and edit scopes never overlap.
28
+
29
+ <a id="instruction-and-execution-adapter"></a>
30
+ ## Instruction and execution adapter
31
+
32
+ Apply platform/user/project instructions by precedence, then ARC ownership/permissions/models/concurrency/routing/approval and role-local references. Skills add neither agents nor authority. Map `superpowers:executing-plans`/`superpowers:subagent-driven-development` to dependency-aware Orchestrator coordination and risk-scaled verification, replacing executor mechanics and separate execution-method prompts in existing references.
33
+
34
+ Preserve plan approval, workspace, design, spec and all applicable requirements. TDD applies to permitted test work under [handoff](handoff.md#implementer-tdd-and-constraints)'s explicit ARC exceptions. Follow an applicable higher-priority prohibition on adding or running tests; when its precedence and scope are clear, neither report a conflict on that basis nor ask permission to violate it. Record unperformed verification; hold only affected work and acceptance when scope or precedence is genuinely unclear or required verification is blocked. Adapt local `brainstorming` role/save/early-spec-commit instructions to Planner ownership and planning/handoff evidence gates, preserving upstream text. Report conflicts/missing required references before dependent work.
35
+
36
+ Orchestrator integrates results, routes decisions/approvals and owns acceptance/completion. Run dependent implementation sequentially with a fresh Implementer per top-level task. Reuse current Implementer only for same-task correction/rework/rechecks while scope/workspace/ownership/context remain valid. Default same-task Tester corrections to it; findings alone create no new task. Before reuse, compare actual workspace, branch/HEAD and change state to the brief.
37
+
38
+ For each plan task, keep the current Implementer conversation ID, status, last result and reuse/replacement decision in the canonical handoff record. Before each call, identify the task and current Implementer. Send same-task corrections, rework and rechecks as follow-up work in that conversation. A completed or idle turn, partial implementation, failed result, missing brief, division by step or file, or Tester/Reviewer finding alone does not justify a new Implementer; consolidate the missing information or findings and send them to the current one. For an initial successful call, record the returned ID; if its result is uncertain, reconcile it before another assignment.
39
+
40
+ Before a same-task replacement, establish an allowed reason: the existing context is invalid/unavailable or the Implementer cannot continue, or an approved plan/acceptance-criteria amendment requires a fresh Implementer. Record the prior conversation ID, status, reason and supporting evidence before calling. Hold if the reason is not established. After a successful call, update the current ID; reconcile an uncertain result before any further assignment. These are prompt-level procedures, not proof of automatic interception of native collaboration calls.
41
+
42
+ Replace/restart only for invalid/unavailable context or changed task boundary, except approved plan/criteria amendments require a fresh Implementer for remaining work even within the same task. Next-task and amendment assignments are handoff restarts, subject to choice reuse/restart briefs. Follow [risk-scaled execution](verification.md#risk-scaled-execution) at task boundaries.
43
+
44
+ <a id="local-superpowers-references"></a>
45
+ ### Local Superpowers references
46
+
47
+ Supply absolute paths under the selected installed ARC directory. Planner reads `references/brainstorming.md`/`references/writing-plans.md`; Implementer reads `references/test-driven-development.md` and required relative references. Resolve relatives within skill directories. Runtime needs no global discovery/external Skill call/automatic download. Missing/damaged files stop dependent work; report paths without global fallback. Preserve ARC approvals, ownership, TDD exceptions and executor adapters.
48
+
49
+ <a id="token-discipline-and-handoffs"></a>
50
+ ### Local Superpowers references
51
+
52
+ Return the complete first required draft and self-review from the verified source before target preparation; compare the prepared target before saving or handoff.
53
+
54
+ <a id="coordination-context-discipline-and-handoffs"></a>
55
+ ## Context discipline and handoffs
56
+
57
+ Use this fixed brief order:
58
+
59
+ 1. Goal
60
+ 2. Criteria (IDs)
61
+ 3. Exact scope/ownership: absolute workspace, branch or detached HEAD and HEAD, existing record path, files
62
+ 4. Constraints/decisions
63
+ 5. Evidence: paths/lines, commands, artifact links
64
+ 6. Prior findings
65
+ 7. Exact next objective: one bounded objective
66
+ 8. Return format: conclusion, evidence locations, unresolved points, next step
67
+
68
+ <a id="coordination-context-discipline-and-handoffs-2"></a>
69
+ ## Context discipline and handoffs
70
+
71
+ The [task envelope](handoff.md#orchestrator-direct-path-for-small-tasks) fits this fixed brief order: Goal carries task/path/outcome; Criteria carries IDs and checks; Exact scope/ownership carries target/state/ownership/record; Constraints/decisions carries approval, F1–F8, risk/depth and TDD; Evidence carries fingerprint and approval/check evidence; Prior findings carries changes, revalidation and holds; Exact next objective gives the bounded next goal; Return format requests evidence, limits and unresolved points. Give a new role its native profile and actual applicable instructions, not hash alone.
72
+
73
+ <a id="coordination-planner-dispatch-efficiency"></a>
74
+ ## Planner dispatch efficiency
75
+
76
+ Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Orchestrator can read a few already identified files; route material research and broad static exploration to Scouter. Planner briefs carry path/line-verified evidence and a Read/Grep exploration budget (default about 15 for Bounded and about 30 for Architectural when no task-specific number is set; state a number before depth is chosen or for Spike work); additional broad exploration goes to Scouter, not Planner. NEVER reuse a Planner across stages, except that on the Architectural path the design Planner continues as the spec Planner after [start confirmation](planning.md#architectural-start-confirmation) while role, context and source remain valid. Within the design/brainstorming stage one Planner handles every [design conversation](planning.md#design-conversation) response, the final design, its consolidated correction and any eligible further call; within a spec or plan stage, that stage's Planner is reused only for a budget-hold delta. Every plan stage, and an Architectural spec stage without that continuation, uses a fresh Planner whose brief contains every required field plus saved document paths and approved versions (for the Architectural plan stage, the reviewed spec path, version and SHA-256); cite a prior brief only when it is an accessible file. A Planner return that stops at the budget with a Scouter request is an input hold, not a missing or failed draft: after Scouter evidence arrives, resend that stage's brief as a delta to the same stage Planner, which counts as new input. In the design stage, conversation responses are expected returns and use no correction opportunity; calls after the final-design correction still need new input. Orchestrator MAY set a handback size limit in the brief.
77
+
78
+ <a id="models"></a>
79
+ ## Models
80
+
81
+ Adjacent `models.toml` is authoritative for role models/effort. Orchestrator uses the current model. DO NOT substitute settings or reduce effort; report unavailability. Declarations prove no provider support/account access/alias resolution/actual model-effort application/concurrency/depth enforcement. New sessions reload profiles; running agents retain settings/parents. Changes do not automatically reparent or prove runtime parent behavior.
82
+
83
+ <a id="instruction-and-input-provenance"></a>
84
+ ## Instruction and input provenance
85
+
86
+ Briefs identify source/applicability/version or approval/access state for user instructions, discovered workspace instructions, installed references and task inputs. Optional read recovery follows policy only; report first failure and dependent/independent work. Return missing required inputs without inventing authority/interpretation. Full fields follow [handoff](handoff.md#instruction-sources-bounded-read-recovery-visual-evidence-and-resumption).
87
+
88
+ <a id="coordination-composite-platform-role-dispatch"></a>
89
+ ## Composite Platform Role Dispatch
90
+
91
+ `Mixed routing` keeps the current session as the Orchestrator. Each role runs either as a native `arc-routing-*` profile on the host or as a bridge: a child process of the peer CLI started by the runtime. Invoke `$ARC_RUNTIME_ENTRY` as described in [planning](planning.md#approved-cooperative-execution-path-within-the-repository): `node "$ARC_RUNTIME_ENTRY" <command> --cwd <absolute worktree> --workflow <workflow ID> --input -`, with one JSON object on stdin. Output is one JSON line. Exit codes: allow 0, deny 2, hold 3, error 1. Every input is validated against an exact key set; a missing or unknown key is denied with `invalid_request`. `hostPlatform` (`codex`, `claude`, `gemini` or `grok`) and `executionEnvironment` (`codex-cli`, `claude-cli`, `gemini-cli`, `grok-cli`, `codex-desktop`, or `claude-desktop`) are caller-provided claims, not host attestations. Gemini host routing is held in this release (see the host support table below).
92
+
93
+ Choose `executionEnvironment` by where the session actually runs: a terminal CLI or TUI session, including one in an IDE integrated terminal, uses `codex-cli`, `claude-cli`, `gemini-cli` or `grok-cli` for its host. Desktop values apply only to Codex and Claude. Use them only for a session confirmed to run inside the corresponding Desktop app. NEVER infer the environment from paths or directory names (for example `~/Desktop/...`). When unsure, declare the CLI value.
94
+
95
+ Procedure, in order:
96
+
97
+ 1. `routing-status` with `hostPlatform`, `executionEnvironment`. Reads the active revision, each role's route, profile, model and effort, platform authentication and CLI versions without reserving anything. Authentication and version probes start a child process. The Codex authentication probe refreshes the login token over the network through `codex app-server`; a permanently rejected refresh is `Unauthorized` and a probe that cannot decide is `Incomplete`.
98
+ 2. `prepare-dispatch` with `hostPlatform`, `executionEnvironment`, `role` (`arc_scouter`, `arc_planner`, `arc_implementer`, `arc_tester`, or `arc_reviewer`), `expectedRevision` (the revision from step 1), `requestId`, `taskId`, and `allowedPaths` (worktree-relative path array; required and non-empty for `arc_implementer`, optional for `arc_tester` where empty or omitted allows no writes, omitted for other roles). `allow` returns `dispatchId`, the route and initial claims and reserves a lease; `hold` returns every reason with its release condition; `deny` rejects the request. Reuse of a `requestId`, or a non-terminal dispatch for the same workflow, task and role, is denied with `duplicate_dispatch`.
99
+ 3. Native route: before spawning, compare the `[arc-routing rev <revision>]` tag in the agent list description with the `routing-status` revision. If it differs or is not shown, hold the role as `native_profile_reload_unverified` and report that a new session is required. Then spawn: Claude host Agent tool `subagent_type: "arc-routing-<suffix>"`; Codex host `spawn_agent` `agent_type: "arc_routing_<suffix>"` with the existing `fork_turns="none"` and `task_name` rules. On Grok use `spawn_subagent` with `subagent_type: "arc-routing-<suffix>"`. The revision tag appears in the `subagent_type` description. Use the returned `subagent_id` as `nativeAgentId`. The Grok child uses the session model, so its model claim remains `operator-attested`. The child has no `spawn_subagent` tool. NEVER pass a model argument. On Claude and Codex the profile decides. Record the lifecycle with `observe` using `dispatchId`, `event` (`started`, `completed`, `failed`, or `cancelled`) and `nativeAgentId`. `nativeAgentId` is required with `started` and forbidden with every other event. A `cancelled` event is also accepted for a `reserved` native lease that was never started (without `nativeAgentId`). These are `operator-attested` claims.
100
+ 4. Bridge route: `run-dispatch` with `hostPlatform`, `executionEnvironment`, `dispatchId`, `brief` (UTF-8, at most 256 KiB, delivered on stdin only). It starts a detached supervisor and returns at once with `routeStatus` and `resultPath`. Then `observe` with `hostPlatform`, `executionEnvironment`, `dispatchId` and optional `waitMs` (0 to 540000). Use the maximum wait for each call and DO NOT run a short polling loop. With `waitMs`, `observe` returns only when the dispatch reaches `completed`, `failed`, `cancelled` or `unknown`, or when `waitMs` elapses; a transition such as `starting` to `running` does not end the wait. `observe` returns status, claims, `resultPath` and reasons; `failed` and `unknown` are reported as hold (exit 3).
101
+ 5. `resume` with `hostPlatform`, `executionEnvironment`, `dispatchId`, `brief`. It continues the same session as a new segment only for a dispatch in `completed` or `failed` state with a recorded session ID and an unchanged active revision (otherwise `revision_changed`). All flags are re-specified, the concurrency limit is checked again, and a session ID mismatch makes the state `unknown`. `unknown` and `cancelled` dispatches cannot be resumed. New Tester or Reviewer assignments never reuse a session.
102
+ 6. `cancel` with `hostPlatform`, `executionEnvironment`, `dispatchId`. A `reserved` lease (native or bridge) becomes `cancelled` at once; a `starting` or `running` native lease is denied and is closed with `observe` events. A cancelled `unknown` lease keeps its recorded reasons. A running child gets SIGTERM, a 10 second grace, then SIGKILL; the result is `cancelling` and `cancelled` is recorded only after exit is observed. A reused PID or missing child information (including a `starting` lease whose supervisor is lost and that has no child record) is left unchanged and the result is hold, because exit cannot be observed; clean it up manually.
103
+
104
+ <a id="coordination-host-rules"></a>
105
+ ### Host rules
106
+
107
+ | executionEnvironment | Claude target | Codex target | Gemini target | Grok target |
108
+ |---|---|---|---|---|
109
+ | `claude-cli` | Native, all roles | Bridge, all roles | Bridge, read roles only (GG1 `fail`; Implementer/Tester held as `permission_scope_unverified`) | Bridge, all roles |
110
+ | `codex-cli` | Bridge, all roles | Native, all roles | Bridge, read roles only (GG1 `fail`; Implementer/Tester held as `permission_scope_unverified`) | Bridge, all roles |
111
+ | `gemini-cli` | Held (`capability_not_verified`; GG2 `fail`, `compositeHost` off) | Held (`capability_not_verified`; GG2 `fail`, `compositeHost` off) | Held (`capability_not_verified`; GG2 `fail`, `compositeHost` off) | Held (`capability_not_verified`; GG2 `fail`, `compositeHost` off) |
112
+ | `grok-cli` | Bridge, all roles | Bridge, all roles | Bridge, read roles only (GG1 `fail`; Implementer/Tester held as `permission_scope_unverified`) | Native, all roles |
113
+ | `claude-desktop` | Held (`environment_unverified`) | Held (`environment_unverified`) | Held (`environment_unverified`) | Held (`environment_unverified`) |
114
+ | `codex-desktop` | Held (`environment_unverified`) | Held (`environment_unverified`) | Held (`environment_unverified`) | Held (`environment_unverified`) |
115
+
116
+ Read roles are Scouter, Planner and Reviewer. The table shows which routes the recorded gates permit; apply the host rules and check each dispatch result.
117
+
118
+ **Claude**
119
+
120
+ - Approval: No per-call ARC approval gate.
121
+ - Target home probe: None.
122
+ - Desktop: Held as described below.
123
+
124
+ **Codex**
125
+
126
+ - On a Codex host ask the user for escalation approval each time any runtime command (`routing-status`, `prepare-dispatch`, `run-dispatch`, `observe`, `resume`, `cancel`) runs, because each may write `CODEX_HOME`. The runtime does not check this approval; asking for it is an Orchestrator obligation. Without approval or on failure the result is `host_sandbox_blocked`.
127
+ - In a Codex host sandbox writes to `CODEX_HOME` are denied (G2), so a Codex-host bridge is not held in advance but runs only with the per-call escalation approval; a refused approval or a denied write is `host_sandbox_blocked`. Detached supervisor survival itself was observed under variant conditions, and native routes there remain supported.
128
+ - Target home probe: None.
129
+ - Desktop: Held as described below.
130
+
131
+ **Gemini**
132
+
133
+ - Approval: Hold the host pending live host measurement (GG2). The registry lists `gemini` and `gemini-cli`, but `compositeHost` is off.
134
+ - Target home probe: See the shared probe rule below. The capability hold applies before the probe.
135
+ - Desktop: No Desktop value.
136
+
137
+ **Grok**
138
+
139
+ GK2 is `approval`.
140
+
141
+ - On a Grok host start the session with `grok --permission-mode default` (ask), keep the platform-default sandbox off, and ask the user for approval each time any runtime command (`routing-status`, `prepare-dispatch`, `run-dispatch`, `observe`, `resume`, `cancel`) runs; NEVER use auto-review, `/auto`, `bypassPermissions`, `--always-approve` or `--yolo`, and DO NOT choose `Always allow`, which saves `permission_mode = "always-approve"` to the Grok config. Spawn with `spawn_subagent` only roles whose route is `native`; Grok can also list Claude `arc-routing-*` profiles, which remain bridge roles. The runtime does not check this approval; asking for it is an Orchestrator obligation. A denied write (for example by a host sandbox) is `host_sandbox_blocked`; ARC does not detect whether the host sandbox is on.
142
+ - Target home probe: See the shared probe rule below.
143
+ - Desktop: No Desktop value.
144
+
145
+ <a id="coordination-shared-host-rules"></a>
146
+ #### Shared host rules
147
+
148
+ - On a Grok or Gemini host, bridge `prepare-dispatch`, `run-dispatch` and `resume` first check that the target platform home is writable: a denied write is `host_sandbox_blocked`, a missing home is `activation_unverified`, and a probe file that cannot be removed is reported in `residualPaths`.
149
+ - On Desktop hosts (`codex-desktop`, `claude-desktop`) every role (native and bridge) is held as `environment_unverified` in this release; the manual checklist in the ARC operation guide is a list of manual checks for a future ARC update that may change the support status, and recording it releases nothing. Even then `supportStatus` is at most `unverified`.
150
+
151
+ <a id="coordination-bridge-target-rules"></a>
152
+ ### Bridge target rules
153
+
154
+ - Bridge prepare, run and resume hold `permission_scope_unverified` when `allowedPaths` cover `.`, `.git`, `.claude`, `.claude/settings*.json`, `.codex` or `.codex/config.toml`; any change to `.git` config, hooks or info (except `info/refs`, which `git update-server-info` may rewrite after a fetch or gc; that change alone is recorded under `tolerated.control`), `.claude/settings*.json` or `.codex/config.toml` fails the dispatch as `permission_violation_observed` regardless of role and `allowedPaths`, and Grok writing roles also fail on changes to the security keys of the Grok home `config.toml` or to its `sandbox.toml`.
155
+ - All bridge children: Apply the shared child guard in [Shared dispatch rules](coordination.md#coordination-shared-dispatch-rules). The guard denies routing commands only; native delegation inside a child follows each platform's Delegation item below.
156
+
157
+ **Claude**
158
+
159
+ - Writing roles: Claude bridge `arc_implementer` and `arc_tester` run with recorded sandbox settings on every host and are held as `permission_scope_unverified` when an injected G1 fails or settings are missing (G1). Claude Implementer/Tester bridges also deny writes under `.git` (permission rules and sandbox `denyWrite`), and are held as `permission_scope_unverified` when the worktree `.claude/settings.json` or `.claude/settings.local.json` would widen their scope (additional directories, allow rules for tools outside the safe list (Bash, Read, Grep, Glob, WebFetch, WebSearch), hooks, sandbox or defaultMode).
160
+ - Permission claim: Compare the `init` event with the expected tools and permission mode. If `init` is missing, the `permissions` claim is `unverified`. If the tools or permission mode differ, the claim is `unverified` and the reason is `permission_scope_mismatch`.
161
+ - Delegation: Role instructions forbid re-delegation. Claude children expose no Task tool.
162
+ - Execution confirmation: Check the stream session identity and model, transcript effort, and the observed terminal result.
163
+
164
+ **Codex**
165
+
166
+ - Gate: G4 applies to every Codex bridge role. G4 `pass` permits dispatch; a failed G4 holds as `permission_scope_unverified`.
167
+ - Writing roles: Codex `workspace-write` may reach beyond the worktree (G5): writes outside the worktree are outside post-run detection.
168
+ - Permission claim: For a Codex bridge the `permissions` claim is at most `operator-attested` and notes `user-config-mcp-not-controlled`, because the child loads the user's Codex configuration (for example MCP servers), which ARC does not control; its `supportStatus` is therefore never `verified`.
169
+ - Delegation: Codex rollout checks apply. The re-delegation of a Codex child is not blocked, and a spawn found afterwards in its rollout fails the dispatch as `delegation_observed` (G3).
170
+ - Execution confirmation: Check the rollout for model, effort, sandbox mode and approval policy, and check the observed terminal result.
171
+
172
+ **Gemini**
173
+
174
+ - Writing roles: Gemini bridge `arc_implementer` and `arc_tester` are held as `permission_scope_unverified` while GG1 is `fail`. Scouter, Planner and Reviewer remain supported.
175
+ - Permission claim: The worktree snapshot covers only Git-visible worktree changes.
176
+ - Delegation: The dispatch record reports `unverifiedContracts.delegation` as `undetectable`.
177
+ - Execution confirmation: Check the stream session ID against the recorded ID, the observed model and the terminal result. Effort stays `unverified`.
178
+
179
+ **Grok**
180
+
181
+ - Writing roles: Grok bridge `arc_implementer` and `arc_tester` use a per-dispatch sandbox profile and require a verified `ProfileApplied` event after execution (GK1), with read-role behavior unchanged. Writing roles are held as `permission_scope_unverified` if GK1 is anything other than `pass`.
182
+ - Grok records `ProfileApplied` itself in a file the child can write. If a Grok version neither applies the profile nor emits the event, a single forged candidate is indistinguishable from a genuine one. A forgery alongside a genuine event fails the two-candidate check.
183
+ - On cancellation, the events check adds no `permission_scope_mismatch` if a valid events file has no matching `ProfileApplied` candidate or the file was absent both before and after execution. Other reasons still apply.
184
+ - Permission claim: The worktree snapshot covers only Git-visible worktree changes.
185
+ - Delegation: The dispatch record reports `unverifiedContracts.delegation` as `undetectable`.
186
+ - Execution confirmation: Check the stream session ID against the recorded ID, the observed model and the terminal result. Effort stays `unverified`.
187
+
188
+ <a id="coordination-bridge-tool-access"></a>
189
+ ### Bridge tool access
190
+
191
+ The Orchestrator requests `toolAccess` only for the current bridge dispatch when the approved task needs it (D-a). Use scratch first. Scouter, Planner and Reviewer cannot request `toolAccess`. Implementer MAY request loopback, registered path or socket IDs, and the `ci`, `daemon-off` and `polling` presets. Tester MAY also request domain-scoped or full network access and registered browser services, subject to the platform gates. On Codex, Claude and Gemini, the gates for full network access and all three Playwright services have the value `held`; on Grok they are `unmeasured`. NEVER enable additional access by default for Tester. Check the dispatch's `toolAccess.conditions` when a grant is conditional.
192
+
193
+ Use `ARC_SCRATCH_DIR` for temporary files and put files that MUST survive the dispatch in `ARC_EVIDENCE_DIR` for supervisor collection. Read `ARC_HOST_SERVICES_FILE` for service endpoints when a host service was granted. When a host-only operation blocks a check, report it as “environment constraint (host only)” and identify the blocked check and what remains unverified. Host-only operations include process inspection (`ps`, `pgrep`), Docker, writes to actual CLI authentication or configuration, dependency installation and its remote fetches, Git writes, Cypress, and Keychain operations. The Orchestrator handles host verification within existing authority.