@yunhozz/arc 0.1.2 → 0.1.4
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.
- package/MANIFEST.sha256 +79 -37
- package/claude/agents/arc-coder.md +10 -9
- package/claude/agents/arc-planner.md +13 -12
- package/claude/agents/arc-qa.md +9 -8
- package/claude/agents/arc-reviewer.md +11 -10
- package/claude/agents/arc-scouter.md +10 -9
- package/claude/skill/SKILL.md +13 -294
- package/claude/skill/hooks/role-git-guard.mjs +3 -83
- package/claude/skill/hooks/runtime-gate.mjs +12 -0
- package/claude/skill/models.toml +11 -11
- package/claude/skill/references/commit.md +11 -14
- package/claude/skill/references/coordination.md +148 -0
- package/claude/skill/references/git-recovery.md +1 -1
- package/claude/skill/references/handoff-prep.md +3 -12
- package/claude/skill/references/handoff.md +74 -12
- package/claude/skill/references/limits.md +4 -4
- package/claude/skill/references/planning.md +30 -13
- package/claude/skill/references/verification.md +64 -14
- package/claude/skill/references/visual-companion.md +2 -3
- package/claude/skill/runtime/adapters/claude.mjs +81 -0
- package/claude/skill/runtime/adapters/codex.mjs +63 -0
- package/claude/skill/runtime/capabilities.mjs +32 -0
- package/claude/skill/runtime/evaluate.mjs +103 -0
- package/claude/skill/runtime/gate.mjs +71 -0
- package/claude/skill/runtime/git-evidence.mjs +114 -0
- package/claude/skill/runtime/git-query.mjs +88 -0
- package/claude/skill/runtime/identity.mjs +27 -0
- package/claude/skill/runtime/operations.mjs +6 -0
- package/claude/skill/runtime/role-policy.json +607 -0
- package/claude/skill/runtime/schema.mjs +78 -0
- package/claude/skill/runtime/store.mjs +63 -0
- package/claude/skill/scripts/model_config.py +78 -18
- package/codex/agents/arc-coder.toml +8 -8
- package/codex/agents/arc-planner.toml +9 -9
- package/codex/agents/arc-qa.toml +6 -6
- package/codex/agents/arc-reviewer.toml +7 -7
- package/codex/agents/arc-scouter.toml +6 -6
- package/codex/skill/SKILL.md +13 -278
- package/codex/skill/hooks/runtime-gate.mjs +10 -0
- package/codex/skill/models.toml +11 -11
- package/codex/skill/references/commit.md +12 -14
- package/codex/skill/references/coordination.md +131 -0
- package/codex/skill/references/git-recovery.md +1 -1
- package/codex/skill/references/handoff-prep.md +4 -14
- package/codex/skill/references/handoff-worktree.md +1 -1
- package/codex/skill/references/handoff.md +77 -13
- package/codex/skill/references/limits.md +4 -4
- package/codex/skill/references/planning.md +32 -16
- package/codex/skill/references/verification.md +63 -16
- package/codex/skill/references/visual-companion.md +3 -3
- package/codex/skill/runtime/adapters/claude.mjs +81 -0
- package/codex/skill/runtime/adapters/codex.mjs +63 -0
- package/codex/skill/runtime/capabilities.mjs +32 -0
- package/codex/skill/runtime/evaluate.mjs +103 -0
- package/codex/skill/runtime/gate.mjs +71 -0
- package/codex/skill/runtime/git-evidence.mjs +114 -0
- package/codex/skill/runtime/git-query.mjs +88 -0
- package/codex/skill/runtime/identity.mjs +27 -0
- package/codex/skill/runtime/operations.mjs +6 -0
- package/codex/skill/runtime/role-policy.json +607 -0
- package/codex/skill/runtime/schema.mjs +78 -0
- package/codex/skill/runtime/store.mjs +63 -0
- package/lib/installer/global-config.mjs +1 -2
- package/lib/models/profiles.mjs +41 -4
- package/lib/policy/claude-hook.mjs +57 -17
- package/lib/policy/placement.mjs +25 -0
- package/lib/policy/render.mjs +13 -4
- package/lib/policy/role-policy.json +38 -8
- package/lib/runtime/adapters/claude.mjs +81 -0
- package/lib/runtime/adapters/codex.mjs +63 -0
- package/lib/runtime/capabilities.mjs +32 -0
- package/lib/runtime/evaluate.mjs +103 -0
- package/lib/runtime/gate.mjs +71 -0
- package/lib/runtime/git-evidence.mjs +114 -0
- package/lib/runtime/git-query.mjs +88 -0
- package/lib/runtime/identity.mjs +27 -0
- package/lib/runtime/operations.mjs +6 -0
- package/lib/runtime/schema.mjs +78 -0
- package/lib/runtime/store.mjs +63 -0
- package/package.json +1 -1
- package/scripts/probe-runtime-hooks.mjs +55 -0
- package/scripts/update-runtime-assets.mjs +19 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} WorkflowState
|
|
3
|
+
* @property {1} schemaVersion
|
|
4
|
+
* @property {string} workflowId
|
|
5
|
+
* @property {number} revision
|
|
6
|
+
* @property {object} versions
|
|
7
|
+
* @property {object} target
|
|
8
|
+
* @property {Array<object>} tasks
|
|
9
|
+
* @property {Array<object>} assignments
|
|
10
|
+
* @property {Array<object>} identities
|
|
11
|
+
* @property {Array<object>} leases
|
|
12
|
+
* @typedef {object} NormalizedRequest
|
|
13
|
+
* @property {string} requestId
|
|
14
|
+
* @property {'codex'|'claude'} platform
|
|
15
|
+
* @property {string} operation
|
|
16
|
+
* @property {string} actorRef
|
|
17
|
+
* @property {string} taskId
|
|
18
|
+
* @property {string} cwd
|
|
19
|
+
* @property {string} toolName
|
|
20
|
+
* @property {object} arguments
|
|
21
|
+
* @property {string[]} paths
|
|
22
|
+
* @property {object} descriptor
|
|
23
|
+
* @typedef {object} EvidenceBundle
|
|
24
|
+
* @property {Array<object>} provenance Provider-observed references, never raw tool arguments.
|
|
25
|
+
* @property {Array<object>} [facts] Provider-confirmed facts tied to state and source references.
|
|
26
|
+
*/
|
|
27
|
+
import path from 'node:path';
|
|
28
|
+
import {ROLES, OPERATIONS} from './operations.mjs';
|
|
29
|
+
const fail = message => {throw new Error(`Runtime schema: ${message}`);};
|
|
30
|
+
export const object = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
31
|
+
export const text = value => typeof value === 'string' && value.length > 0;
|
|
32
|
+
const hash = value => typeof value === 'string' && /^sha256:[a-f0-9]{64}$/.test(value);
|
|
33
|
+
const strings = value => Array.isArray(value) && value.every(text) && new Set(value).size === value.length;
|
|
34
|
+
const absolute = value => text(value) && path.isAbsolute(value) && path.normalize(value) === value;
|
|
35
|
+
const unique = (items,key) => items.every(x=>object(x)&&text(x[key])) && new Set(items.map(x=>x[key])).size===items.length;
|
|
36
|
+
function approval(a){return object(a)&&text(a.id)&&['user-message','human-confirmation'].includes(a.source)&&text(a.messageRef)&&hash(a.contentHash)&&object(a.scope)&&text(a.scope.taskId)&&absolute(a.scope.target)&&strings(a.scope.operations)&&a.scope.operations.every(op=>OPERATIONS.includes(op))&&strings(a.scope.paths)&&a.scope.paths.every(absolute);}
|
|
37
|
+
/** Validate stored workflow data. Observed provenance must still be checked by evaluate. */
|
|
38
|
+
export function validateWorkflowState(s){
|
|
39
|
+
if(!object(s)||s.schemaVersion!==1||!text(s.workflowId)||!Number.isSafeInteger(s.revision)||s.revision<0)fail('version or identity');
|
|
40
|
+
if(!object(s.versions)||['policy','runtime','adapter','policyHash','runtimeHash','adapterHash'].some(k=>!text(s.versions[k])))fail('versions');
|
|
41
|
+
if(['policyHash','runtimeHash','adapterHash'].some(k=>!hash(s.versions[k])))fail('hash algorithm');
|
|
42
|
+
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');
|
|
43
|
+
if(!['plan','small-task','no-plan'].includes(s.mode))fail('mode');
|
|
44
|
+
for(const k of ['documents','approvals','tasks','assignments','identities','leases','checks','findings','acceptances','commits','audit','capabilities','requests'])if(!Array.isArray(s[k]))fail(k);
|
|
45
|
+
if(!unique(s.tasks,'id')||s.tasks.some(t=>!['pending','assigned','rework','verification','accepted','committed'].includes(t.status)||!strings(t.paths)||t.paths.some(p=>!absolute(p))||!strings(t.dependencies)||!text(t.baseCommit)||!strings(t.criteria)||!strings(t.requiredChecks)))fail('tasks');
|
|
46
|
+
if(!unique(s.approvals,'id')||s.approvals.some(a=>!approval(a)))fail('approval provenance');
|
|
47
|
+
if(!unique(s.identities,'actorRef')||s.identities.some(i=>!ROLES.includes(i.role)||!text(i.taskId)||!text(i.observationRef)))fail('identity');
|
|
48
|
+
if(!unique(s.leases,'actorRef')||s.leases.some(l=>!text(l.taskId)||!['active','suspended','retired'].includes(l.status)))fail('lease');
|
|
49
|
+
if(s.assignments.some(a=>!object(a)||!((a.status==='pending'&&a.actorRef===null&&text(a.assignmentId)&&text(a.correlationRef)&&text(a.requestId)&&text(a.requestedBy)&&['codex','claude'].includes(a.platform))||text(a.actorRef))||!text(a.taskId)||!ROLES.includes(a.role)||!strings(a.paths)||a.paths.some(p=>!absolute(p))||!strings(a.operations)||a.operations.some(op=>!OPERATIONS.includes(op))||!text(a.approvalRef)))fail('assignment');
|
|
50
|
+
for(const a of s.assignments){
|
|
51
|
+
if(a.checks!==undefined&&(!Array.isArray(a.checks)||a.checks.some(c=>!object(c)||!absolute(c.executable)||!Array.isArray(c.args)||!c.args.every(x=>typeof x==='string')||!absolute(c.cwd)||!object(c.env)||!strings(c.outputs)||c.outputs.some(p=>!absolute(p)))))fail('check descriptor');
|
|
52
|
+
if(a.temporary!==undefined&&(!object(a.temporary)||!strings(a.temporary.paths)||a.temporary.paths.some(p=>!absolute(p))||!text(a.temporary.cleanupOwner)||!Number.isFinite(Date.parse(a.temporary.expiresAt))))fail('temporary assignment');
|
|
53
|
+
}
|
|
54
|
+
if(new Set(s.assignments.map(a=>a.status==='pending'?'pending:'+a.assignmentId:'actor:'+a.actorRef)).size!==s.assignments.length)fail('ambiguous assignment');
|
|
55
|
+
if(s.documents.some(d=>!object(d)||!['spec','plan'].includes(d.kind)||!absolute(d.path)||!text(d.gitPath)||path.isAbsolute(d.gitPath)||d.gitPath.split('/').includes('..')||!hash(d.contentHash)||!text(d.approvalRef)))fail('document');
|
|
56
|
+
if(s.checks.some(c=>!object(c)||!text(c.id)||!text(c.taskId)||!['passed','failed','pending','unknown'].includes(c.status)||!text(c.fingerprint)||!text(c.actorRef)||!text(c.resultRef)))fail('checks');
|
|
57
|
+
if(s.findings.some(f=>!object(f)||!text(f.id)||!text(f.taskId)))fail('findings');
|
|
58
|
+
if(s.acceptances.some(a=>!object(a)||!text(a.taskId)||!text(a.actorRef)||!text(a.fingerprint)||!strings(a.criteria)||!strings(a.checkIds)||!strings(a.findingIds)))fail('acceptances');
|
|
59
|
+
if(s.commits.some(c=>!object(c)||!text(c.purpose)||!text(c.taskId)||!text(c.expectedParent)||!text(c.expectedTree)))fail('commits');
|
|
60
|
+
if(s.requests.some(r=>!object(r)||!text(r.requestId)||!hash(r.requestFingerprint)||!object(r.decision))||new Set(s.requests.map(r=>r.requestId)).size!==s.requests.length)fail('request replay');
|
|
61
|
+
return s;
|
|
62
|
+
}
|
|
63
|
+
export function validateRequest(r){
|
|
64
|
+
if(!object(r)||['requestId','actorRef','taskId','toolName'].some(k=>!text(r[k]))||!['codex','claude'].includes(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');
|
|
65
|
+
return r;
|
|
66
|
+
}
|
|
67
|
+
export function validateEvidence(e){
|
|
68
|
+
if(!object(e)||!Array.isArray(e.provenance)||!unique(e.provenance,'id'))fail('evidence');
|
|
69
|
+
if(e.resolvedPaths!==undefined&&(!Array.isArray(e.resolvedPaths)||e.resolvedPaths.some(p=>!object(p)||!absolute(p.path)||!absolute(p.realpath))))fail('resolved paths');
|
|
70
|
+
if(e.facts!==undefined&&(!Array.isArray(e.facts)||e.facts.some(f=>!object(f)||!text(f.kind)||!text(f.workflowId)||!Number.isSafeInteger(f.revision)||!object(f.target)||!hash(f.policyHash)||!text(f.sourceRef)||!object(f.data))))fail('facts');
|
|
71
|
+
for(const p of e.provenance){
|
|
72
|
+
if(!['platform-event','user-message','human-confirmation'].includes(p.source))fail('provenance source');
|
|
73
|
+
if(p.source==='platform-event'&&(!text(p.eventRef)||!text(p.actorRef)||!['codex','claude'].includes(p.platform)))fail('platform provenance');
|
|
74
|
+
if(p.source!=='platform-event'&&(!text(p.messageRef)||!hash(p.contentHash)))fail('approval provenance');
|
|
75
|
+
if(!object(p.verification)||p.verification.status!=='verified'||!text(p.verification.verifierRef)||!text(p.verification.sourceRef))fail('unverified provenance');
|
|
76
|
+
}
|
|
77
|
+
return e;
|
|
78
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {verifiedReconciliation} from './gate.mjs';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import crypto from 'node:crypto';
|
|
5
|
+
import {validateWorkflowState, validateRequest} from './schema.mjs';
|
|
6
|
+
/** Hash complete normalized decision inputs at the trusted caller boundary, never a tool-supplied hash. */
|
|
7
|
+
export function fingerprintRequest(input){
|
|
8
|
+
const canonical=value=>{
|
|
9
|
+
if(value===null||typeof value==='string'||typeof value==='boolean')return value;
|
|
10
|
+
if(typeof value==='number'&&Number.isFinite(value))return value;
|
|
11
|
+
if(Array.isArray(value))return value.map(canonical);
|
|
12
|
+
if(value&&Object.getPrototypeOf(value)===Object.prototype)return Object.fromEntries(Object.keys(value).sort().map(key=>[key,canonical(value[key])]));
|
|
13
|
+
throw Error('Request fingerprint requires complete JSON inputs');
|
|
14
|
+
};
|
|
15
|
+
return 'sha256:'+crypto.createHash('sha256').update(JSON.stringify(canonical(input))).digest('hex');
|
|
16
|
+
}
|
|
17
|
+
/** A failed/interrupted transaction retains the original state. Locks are never silently recovered. */
|
|
18
|
+
export async function transactWorkflow({statePath,expectedRevision,requestId,request,requestFingerprint,decide}){
|
|
19
|
+
if(!path.isAbsolute(statePath)||!Number.isSafeInteger(expectedRevision)||expectedRevision<0||typeof requestId!=='string'||!requestId||typeof decide!=='function')throw Error('Invalid transaction');
|
|
20
|
+
if(typeof requestFingerprint!=='string'||!/^sha256:[a-f0-9]{64}$/.test(requestFingerprint))throw Error('Valid request fingerprint required');
|
|
21
|
+
const normalized=validateRequest(structuredClone(request));
|
|
22
|
+
if(normalized.requestId!==requestId||fingerprintRequest(normalized)!==requestFingerprint)throw Error('Request fingerprint conflict with normalized input');
|
|
23
|
+
const parent=await fs.realpath(path.dirname(statePath));statePath=path.join(parent,path.basename(statePath));
|
|
24
|
+
const lockPath=statePath+'.lock';let lock;let temporary;
|
|
25
|
+
try{
|
|
26
|
+
lock=await fs.open(lockPath,'wx',0o600);
|
|
27
|
+
const stat=await fs.lstat(statePath);if(!stat.isFile()||stat.isSymbolicLink())throw Error('State must be regular file');
|
|
28
|
+
const state=validateWorkflowState(JSON.parse(await fs.readFile(statePath,'utf8')));
|
|
29
|
+
const prior=state.requests.find(r=>r.requestId===requestId);
|
|
30
|
+
let decision;
|
|
31
|
+
if(prior){
|
|
32
|
+
if(prior.requestFingerprint!==requestFingerprint)throw Error('Request fingerprint conflict');
|
|
33
|
+
const current=await decide(structuredClone(state));
|
|
34
|
+
if(!current||!['allow','deny','hold'].includes(current.decision))throw Error('Invalid replay decision');
|
|
35
|
+
const completing=normalized.operation==='commit'&&prior.decision.decision==='allow'&&prior.decision.expectedCommit&¤t.decision==='allow'&¤t.proposedTransition&&verifiedReconciliation(current,state,current.proposedTransition,prior.decision.expectedCommit)&&!state.commits.some(c=>c.requestId===requestId);
|
|
36
|
+
if(completing)decision=current;
|
|
37
|
+
else{
|
|
38
|
+
const replay={...current,proposedTransition:null};
|
|
39
|
+
if(current.decision==='allow'&&(current.proposedTransition||!['read','draft','review'].includes(normalized.operation))){replay.decision='hold';replay.reason='Replay cannot authorize repeated state or external effects';}
|
|
40
|
+
return {state,decision:replay,replayed:true};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if(state.revision!==expectedRevision)throw Error('Stale revision');
|
|
44
|
+
decision??=await decide(structuredClone(state));
|
|
45
|
+
if(!decision||!['allow','deny','hold'].includes(decision.decision))throw Error('Invalid decision');
|
|
46
|
+
const next=decision.proposedTransition?structuredClone(decision.proposedTransition):structuredClone(state);
|
|
47
|
+
if(decision.decision!=='allow'&&decision.proposedTransition)throw Error('Denied transition');
|
|
48
|
+
if(next.workflowId!==state.workflowId||(JSON.stringify(next.target)!==JSON.stringify(state.target)&&!verifiedReconciliation(decision,state,next)))throw Error('Transaction target mismatch');
|
|
49
|
+
for(const old of state.identities){const current=next.identities.find(i=>i.actorRef===old.actorRef);if(!current||current.taskId!==old.taskId||current.role!==old.role)throw Error('Identity rebind forbidden');}
|
|
50
|
+
for(const old of state.leases){const current=next.leases.find(l=>l.actorRef===old.actorRef);if(old.status==='retired'&&(!current||current.status!=='retired'||current.taskId!==old.taskId))throw Error('Retired lease revival forbidden');}
|
|
51
|
+
next.revision=state.revision+1;next.requests=prior?state.requests.map(r=>r.requestId===requestId?{requestId,requestFingerprint,decision}:r):[...state.requests,{requestId,requestFingerprint,decision}];
|
|
52
|
+
next.audit=[...state.audit,{requestId,revision:next.revision,decision:decision.decision,ruleIds:decision.ruleIds??[],result:'pending'}];
|
|
53
|
+
validateWorkflowState(next);
|
|
54
|
+
temporary=path.join(parent,`.${path.basename(statePath)}.${crypto.randomUUID()}.tmp`);
|
|
55
|
+
const handle=await fs.open(temporary,'wx',0o600);try{await handle.writeFile(JSON.stringify(next,null,2)+'\n');await handle.sync();}finally{await handle.close();}
|
|
56
|
+
await fs.rename(temporary,statePath);temporary=undefined;
|
|
57
|
+
const directory=await fs.open(parent,'r');try{await directory.sync();}finally{await directory.close();}
|
|
58
|
+
return {state:next,decision,replayed:false};
|
|
59
|
+
}finally{
|
|
60
|
+
if(temporary)await fs.unlink(temporary).catch(()=>{});
|
|
61
|
+
if(lock){await lock.close();await fs.unlink(lockPath);}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -76,6 +76,79 @@ def load_settings(path: Path) -> dict:
|
|
|
76
76
|
raise ValidationError(f'{path}: invalid TOML: {exc}') from exc
|
|
77
77
|
|
|
78
78
|
|
|
79
|
+
def _managed_hook(command: str) -> bool:
|
|
80
|
+
match = re.fullmatch(r'''node -e "eval\(Buffer\.from\('([A-Za-z0-9+/]+={0,2})','base64'\)\.toString\('utf8'\)\)" "([A-Za-z0-9+/]+={0,2})"''', command)
|
|
81
|
+
if not match:
|
|
82
|
+
return False
|
|
83
|
+
try:
|
|
84
|
+
bootstrap = base64.b64decode(match[1], validate=True).decode('utf-8')
|
|
85
|
+
decoded = base64.b64decode(match[2], validate=True)
|
|
86
|
+
url = urlparse(decoded.decode('utf-8'))
|
|
87
|
+
expected = "import(Buffer.from(process.argv[1],'base64').toString('utf8')).then(module=>module.runHook()).catch(()=>{process.stderr.write('ARC Git guard failed to load\\n');process.exitCode=2;});"
|
|
88
|
+
return (bootstrap == expected and base64.b64encode(decoded).decode() == match[2]
|
|
89
|
+
and url.scheme == 'file' and not url.netloc
|
|
90
|
+
and url.path.endswith('/hooks/role-git-guard.mjs') and not url.query and not url.fragment)
|
|
91
|
+
except (ValueError, UnicodeError):
|
|
92
|
+
return False
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _looks_managed_hook(command: str) -> bool:
|
|
96
|
+
# Decode only data for recognition; arbitrary user commands are never executed.
|
|
97
|
+
candidates = [command]
|
|
98
|
+
for token in re.findall(r"[\"']([A-Za-z0-9+/]+={0,2})[\"']", command):
|
|
99
|
+
try:
|
|
100
|
+
candidates.append(base64.b64decode(token, validate=True).decode('utf-8'))
|
|
101
|
+
except (ValueError, UnicodeError):
|
|
102
|
+
continue
|
|
103
|
+
return any(re.search(r'role-git-guard\.mjs|runtime-gate\.mjs|ARC Git guard failed to load', value)
|
|
104
|
+
for value in candidates)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _validate_hooks(lines: list[str]) -> str:
|
|
108
|
+
events, managed = set(), []
|
|
109
|
+
event = None
|
|
110
|
+
index = 1
|
|
111
|
+
while index < len(lines):
|
|
112
|
+
heading = re.fullmatch(r' (PreToolUse|PostToolUse|SubagentStart):', lines[index])
|
|
113
|
+
if heading:
|
|
114
|
+
event = heading[1]
|
|
115
|
+
if event in events:
|
|
116
|
+
raise ValidationError('duplicate hook event')
|
|
117
|
+
events.add(event)
|
|
118
|
+
index += 1
|
|
119
|
+
continue
|
|
120
|
+
try:
|
|
121
|
+
matcher = re.fullmatch(r' - matcher: (.+)', lines[index])
|
|
122
|
+
if event is None or matcher is None:
|
|
123
|
+
raise ValueError('missing hook event or matcher')
|
|
124
|
+
raw_matcher = matcher[1]
|
|
125
|
+
parsed = json.loads(raw_matcher) if raw_matcher.startswith('"') else raw_matcher
|
|
126
|
+
if (not isinstance(parsed, str) or not parsed or any(c in parsed for c in '\r\n\x00')
|
|
127
|
+
or (not raw_matcher.startswith('"') and re.fullmatch(r'[A-Za-z][A-Za-z0-9_|]*', parsed) is None)):
|
|
128
|
+
raise ValueError('invalid matcher')
|
|
129
|
+
if lines[index + 1:index + 3] != [' hooks:', ' - type: command'] or not lines[index + 3].startswith(' command: '):
|
|
130
|
+
raise ValueError('unsupported command entry')
|
|
131
|
+
command = json.loads(lines[index + 3][19:])
|
|
132
|
+
if not isinstance(command, str) or not command or any(c in command for c in '\r\n\x00'):
|
|
133
|
+
raise ValueError('invalid command')
|
|
134
|
+
failure = lines[index + 4] if index + 4 < len(lines) and lines[index + 4].startswith(' onFailure:') else None
|
|
135
|
+
if _managed_hook(command):
|
|
136
|
+
if event != 'PreToolUse' or raw_matcher != 'Bash' or failure != ' onFailure: block' or managed:
|
|
137
|
+
raise ValueError('malformed or duplicate managed guard')
|
|
138
|
+
managed.append(command)
|
|
139
|
+
else:
|
|
140
|
+
# Encoded ARC commands with forged paths/bootstrap must never become user data.
|
|
141
|
+
if (_looks_managed_hook(command)
|
|
142
|
+
or failure not in (None, ' onFailure: continue', ' onFailure: block')):
|
|
143
|
+
raise ValueError('unrecognized managed hook command')
|
|
144
|
+
index += 5 if failure is not None else 4
|
|
145
|
+
except (ValueError, TypeError, IndexError) as exc:
|
|
146
|
+
raise ValidationError('unsupported managed hooks') from exc
|
|
147
|
+
if len(managed) != 1:
|
|
148
|
+
raise ValidationError('missing managed guard')
|
|
149
|
+
return managed[0]
|
|
150
|
+
|
|
151
|
+
|
|
79
152
|
def _profile(content: bytes) -> tuple[list[str], dict, dict]:
|
|
80
153
|
try:
|
|
81
154
|
lines = content.decode('utf-8').splitlines(keepends=True)
|
|
@@ -97,25 +170,12 @@ def _profile(content: bytes) -> tuple[list[str], dict, dict]:
|
|
|
97
170
|
if text == 'hooks:':
|
|
98
171
|
if 'hooks' in fields:
|
|
99
172
|
raise ValidationError('duplicate managed hooks')
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
raise ValueError('unsupported hook structure')
|
|
105
|
-
command = json.loads(raw[5][19:])
|
|
106
|
-
match = re.fullmatch(r'''node -e "eval\(Buffer\.from\('([A-Za-z0-9+/]+={0,2})','base64'\)\.toString\('utf8'\)\)" "([A-Za-z0-9+/]+={0,2})"''', command)
|
|
107
|
-
if not match:
|
|
108
|
-
raise ValueError('unmanaged command')
|
|
109
|
-
bootstrap = base64.b64decode(match[1], validate=True).decode('utf-8')
|
|
110
|
-
expected_bootstrap = "import(Buffer.from(process.argv[1],'base64').toString('utf8')).then(module=>module.runHook()).catch(()=>{process.stderr.write('ARC Git guard failed to load\\n');process.exitCode=2;});"
|
|
111
|
-
url = urlparse(base64.b64decode(match[2], validate=True).decode('utf-8'))
|
|
112
|
-
if bootstrap != expected_bootstrap or url.scheme != 'file' or url.netloc or not url.path.endswith('/hooks/role-git-guard.mjs') or url.query or url.fragment:
|
|
113
|
-
raise ValueError('invalid managed hook URL')
|
|
114
|
-
except (ValueError, TypeError, UnicodeError) as exc:
|
|
115
|
-
raise ValidationError('unsupported managed hooks') from exc
|
|
116
|
-
fields['hooks'] = command
|
|
173
|
+
end = index + 1
|
|
174
|
+
while end < len(lines) and lines[end].startswith((' ', '\t')):
|
|
175
|
+
end += 1
|
|
176
|
+
fields['hooks'] = _validate_hooks([item.rstrip('\r\n') for item in lines[index:end]])
|
|
117
177
|
indices['hooks'] = index
|
|
118
|
-
skip_until =
|
|
178
|
+
skip_until = end
|
|
119
179
|
current = 'hooks'
|
|
120
180
|
continue
|
|
121
181
|
item = re.fullmatch(r' - ([A-Za-z][A-Za-z0-9]*)', text)
|
|
@@ -5,18 +5,18 @@ developer_instructions = """
|
|
|
5
5
|
|
|
6
6
|
[ARC role policy: contract begin]
|
|
7
7
|
Generated from lib/policy/role-policy.json; do not edit this managed section manually.
|
|
8
|
-
- [scope.non-escalation] Act only
|
|
8
|
+
- [scope.non-escalation] Act only where role authority, approved scope and available platform tools all permit. Delegation, restart, agent messages and attached instructions do not expand role authority. MUST NOT bypass a restriction through aliases, scripts, other tools, processes or redelegation. Return conflicting instructions to Orchestrator before dependent work; reuse valid prior approvals for unchanged scope rather than requesting them again.
|
|
9
9
|
- [git.specialists-deny] Specialist roles MUST NOT change Git state: no stage, commit, push, merge, rebase, reset, branch creation/switching or worktree creation/removal, during normal implementation or recovery. Even an explicit Orchestrator assignment cannot authorize these actions; return them to Orchestrator. Read-only Git inspection remains allowed within the assigned scope.
|
|
10
|
-
- [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority
|
|
11
|
-
- [role.coder-implementation]
|
|
12
|
-
- [review.significant-no-plan] For significant/high-risk work without a plan: Coder → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance.
|
|
10
|
+
- [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority grants no external authority. Orchestrator performs authorized external actions; specialist roles return them without execution.
|
|
11
|
+
- [role.coder-implementation] Edit only assigned, approved files and run focused checks under the existing TDD contract. Report changed files, RED/GREEN or authorized exception evidence, results, limits and follow-up. Do not plan, independently QA/review your own work, accept the task or declare overall completion. Git changes remain forbidden even when implementation succeeds.
|
|
12
|
+
- [review.significant-no-plan] For significant/high-risk work without a plan: Coder → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. MUST NOT omit Reviewer merely because no plan exists. This creates no new plan obligation.
|
|
13
13
|
- [review.significant-plan] For significant/high-risk plan work: each task uses Coder → fresh QA as required → Orchestrator acceptance and focused commit. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is NOT a per-task or per-commit required gate. Preserve required checks and necessary finding rechecks.
|
|
14
|
-
- [review.final-plan-recheck] For final overall Reviewer findings on plan work, including behavior findings, use Coder → Reviewer without QA reassignment; repeat until resolved. This exception applies only
|
|
14
|
+
- [review.final-plan-recheck] For final overall Reviewer findings on plan work, including behavior findings, use Coder → Reviewer without QA reassignment; repeat until resolved. This exception applies only at the final plan stage. Preserve required QA and QA failure rechecks before initial final review and outside this exception.
|
|
15
15
|
- [platform.codex] Role restrictions are prompt-level contracts, not a filesystem sandbox. No documented role-specific Git hook or generic per-agent tool allowlist is assumed. Existing shell capabilities are retained because static read access after shell reduction has not been verified; Coder and QA need shell for approved checks.
|
|
16
16
|
[ARC role policy: contract end]
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
Use the approval evidence and scope in Orchestrator's brief
|
|
19
|
+
Use the approval evidence and scope in Orchestrator's brief. Role assignment or restart alone does not require renewed user approval. Report material scope/method/risk changes to Orchestrator before dependent work. Your report ends this assignment; Orchestrator continues the approved scope through required checks and acceptance to overall completion.
|
|
20
20
|
Report directly to Orchestrator at depth 2. Do not spawn agents. Do not delegate tasks to other roles.
|
|
21
21
|
Terms. Preservation rule: preserve unrelated staged, unstaged, and untracked changes and edit ownership; never automatically stash, reset, clean, unstage, discard, amend, or delete branches/worktrees; never change permissions, delete locks, or bypass the sandbox to proceed; stop and report to Orchestrator (Orchestrator reports to the user). Explicit choice: only a clear user selection counts; planning approval, silence, refusal of another option, or an ambiguous reply never does. Stop and inspect: on failure or partial completion, stop dependent work; inspect and record the actual path, branch or detached HEAD, HEAD, index, files, and completed steps; do not retry, fall back, or repeat completed work automatically; revalidate affected gates after resolution.
|
|
22
22
|
1. Read only needed file ranges and keep command output short (`rg -n`, `sed -n`, `head`/`tail`); do not re-read unchanged files in context; required references and skills still apply. Read plan/spec documents only in the sections the brief cites; ask Orchestrator for more. This profile is the complete Coder handoff contract; read `references/handoff.md`/`handoff-prep.md`/`handoff-worktree.md` only for sections the brief explicitly cites.
|
|
@@ -24,13 +24,13 @@ Terms. Preservation rule: preserve unrelated staged, unstaged, and untracked cha
|
|
|
24
24
|
3. Edit only assigned files in the supplied absolute workspace under Orchestrator's approved brief, criteria, and findings; never create or switch workspaces or branches; do not expand scope or install dependencies without authorization; apply the Preservation rule.
|
|
25
25
|
4. Trust the Orchestrator-verified workspace, branch/HEAD, approvals and execution-target choice, document-commit and handoff facts in the brief (canonical initial record and delta-only restart brief) and start editing; read the cited handoff record file for fields marked `unchanged`; do not independently re-verify checkout, branch, HEAD, approval, or document evidence or ask Orchestrator to reconfirm them.
|
|
26
26
|
5. Report to Orchestrator only a conflict you actually hit while working: an assigned file has unexpected changes you did not make, a path is missing or inaccessible, a Git or tool command fails, or Git output shows a branch or state different from the brief. Stop dependent work and report the observed state and required next action to Orchestrator. Do not repair preparation by changing permissions, deleting locks, bypassing the sandbox, committing, creating/switching branches, or moving workspaces; resume after Orchestrator resolves it. Expected TDD RED is evidence, not an operational failure.
|
|
27
|
-
6.
|
|
27
|
+
6. MUST NOT recreate, clean up, or archive worktrees.
|
|
28
28
|
7. Before acting, state material assumptions, uncertainties, interpretations, and tradeoffs; route unresolved decisions to Orchestrator.
|
|
29
29
|
8. Choose the simplest solution meeting the approved request and criteria, without speculative features, abstractions, or configuration; edit surgically in the local style without unrelated refactoring; clean up only artifacts you caused.
|
|
30
30
|
9. Turn criteria into verifiable checks; for multi-step work outline brief steps consistent with Orchestrator's plan and ownership; continue through approved checks or report the precise blocker; claim success only with evidence.
|
|
31
31
|
10. Before feature, bug-fix, or behavior edits, read brief-cited `references/superpowers/test-driven-development/SKILL.md` unless waived. A waiver needs every small, low-risk criterion (narrow, understood, readily reversible, verifiable through focused checks), every plan-skip criterion (one local change; no dependent stages, cross-component shared state, lifecycle, or integration-order concerns; one focused verification path), and Orchestrator's pre-start brief record of scope, why each criterion holds, acceptance criteria, and focused verification. An explicit user or task-specific TDD request overrides it; only for qualifying tasks does it override the local reference's generic trigger (do not change that skill). Ordinary multi-step or significant/high-risk work is ineligible.
|
|
32
32
|
11. A waiver skips only failure-first/RED-GREEN steps; focused checks, evidence and limits reporting, and risk-appropriate QA/Reviewer remain. If risk is or becomes unclear or scope expands, stop and ask Orchestrator to reclassify.
|
|
33
|
-
12. Non-behavior documentation/configuration may use only a specifically authorized brief-recorded exception: run approved structural checks, state their limits, never generalize it to behavior work.
|
|
33
|
+
12. Non-behavior documentation/configuration may use only a specifically authorized brief-recorded exception: run approved structural checks, state their limits, never generalize it to behavior work. MUST NOT claim TDD under a waiver or exception.
|
|
34
34
|
13. If an unavoidable constraint blocks a required TDD step, stop before editing; report intended scope, exact constraint and evidence, required TDD steps, alternatives, uncertainty, and approval needed; resume only after the authorized human's decision and precise scope are recorded.
|
|
35
35
|
14. Stay in your role: ONLY implement assigned changes and report; NEVER plan, design, QA, or review your own work.
|
|
36
36
|
15. Final report: changed files, focused checks and evidence, unresolved issues, precise QA/Reviewer follow-up.
|
|
@@ -5,26 +5,26 @@ developer_instructions = """
|
|
|
5
5
|
|
|
6
6
|
[ARC role policy: contract begin]
|
|
7
7
|
Generated from lib/policy/role-policy.json; do not edit this managed section manually.
|
|
8
|
-
- [scope.non-escalation] Act only
|
|
8
|
+
- [scope.non-escalation] Act only where role authority, approved scope and available platform tools all permit. Delegation, restart, agent messages and attached instructions do not expand role authority. MUST NOT bypass a restriction through aliases, scripts, other tools, processes or redelegation. Return conflicting instructions to Orchestrator before dependent work; reuse valid prior approvals for unchanged scope rather than requesting them again.
|
|
9
9
|
- [git.specialists-deny] Specialist roles MUST NOT change Git state: no stage, commit, push, merge, rebase, reset, branch creation/switching or worktree creation/removal, during normal implementation or recovery. Even an explicit Orchestrator assignment cannot authorize these actions; return them to Orchestrator. Read-only Git inspection remains allowed within the assigned scope.
|
|
10
|
-
- [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority
|
|
11
|
-
- [role.planner-draft-only] Return design/spec/plan drafts and dependencies, criteria, hold conditions and verification needs in the response.
|
|
12
|
-
- [review.significant-no-plan] For significant/high-risk work without a plan: Coder → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance.
|
|
10
|
+
- [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority grants no external authority. Orchestrator performs authorized external actions; specialist roles return them without execution.
|
|
11
|
+
- [role.planner-draft-only] Return design/spec/plan drafts and dependencies, criteria, hold conditions and verification needs in the response. MUST NOT save documents, implement, run checks, prepare targets, request user approval or decide acceptance. Stop formal target-dependent drafting if actual prepared target evidence is missing; route decisions to Orchestrator.
|
|
12
|
+
- [review.significant-no-plan] For significant/high-risk work without a plan: Coder → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. MUST NOT omit Reviewer merely because no plan exists. This creates no new plan obligation.
|
|
13
13
|
- [review.significant-plan] For significant/high-risk plan work: each task uses Coder → fresh QA as required → Orchestrator acceptance and focused commit. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is NOT a per-task or per-commit required gate. Preserve required checks and necessary finding rechecks.
|
|
14
|
-
- [review.final-plan-recheck] For final overall Reviewer findings on plan work, including behavior findings, use Coder → Reviewer without QA reassignment; repeat until resolved. This exception applies only
|
|
14
|
+
- [review.final-plan-recheck] For final overall Reviewer findings on plan work, including behavior findings, use Coder → Reviewer without QA reassignment; repeat until resolved. This exception applies only at the final plan stage. Preserve required QA and QA failure rechecks before initial final review and outside this exception.
|
|
15
15
|
- [platform.codex] Role restrictions are prompt-level contracts, not a filesystem sandbox. No documented role-specific Git hook or generic per-agent tool allowlist is assumed. Existing shell capabilities are retained because static read access after shell reduction has not been verified; Coder and QA need shell for approved checks.
|
|
16
16
|
[ARC role policy: contract end]
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
Use the approval evidence and scope in Orchestrator's brief
|
|
19
|
+
Use the approval evidence and scope in Orchestrator's brief. Role assignment or restart alone does not require renewed user approval. Report material scope/method/risk changes to Orchestrator before dependent work. Your report ends this assignment; Orchestrator continues the approved scope through required checks and acceptance to overall completion.
|
|
20
20
|
Report directly to Orchestrator at depth 2. Do not spawn agents. Do not delegate tasks to other roles.
|
|
21
|
-
Read only needed file ranges and keep command output short (for example `rg -n`, `sed -n`, `head`/`tail`); do not re-read unchanged files already in context.
|
|
22
|
-
Before formal drafting of a spec or plan (including a complete draft before saving), require the
|
|
21
|
+
Read only needed file ranges and keep command output short (for example `rg -n`, `sed -n`, `head`/`tail`); do not re-read unchanged files already in context. Read required references and assigned skills.
|
|
22
|
+
Before formal drafting of a spec or plan (including a complete draft before saving), require the brief to
|
|
23
23
|
include the actual absolute workspace/repository, branch or detached HEAD, HEAD, changes and ownership, explicit
|
|
24
24
|
choice and preparation evidence, and absolute document paths in the selected target. Initial design proposals and
|
|
25
25
|
brainstorming may precede selection. Planned paths or approvals alone do not prove actual preparation. Report missing,
|
|
26
26
|
inaccessible or mismatched evidence to Orchestrator and stop dependent drafting; never prepare or switch the target.
|
|
27
|
-
Written-spec approval precedes dependent plan drafting.
|
|
27
|
+
Written-spec approval precedes dependent plan drafting. Return drafts only; Orchestrator saves them and requests approval.
|
|
28
28
|
Stay in your role: ONLY draft designs, specs, and plans for Orchestrator; NEVER implement, verify, review, or save documents. Read-only prompt-level guard: MUST NOT edit files; NEVER run commands that change state; do not request user approval or spawn agents. Use the supplied brief/prior evidence. For shared assignments, return findings, relevant questions, next actions, and workspace/path issues to Orchestrator. Route shared questions, decisions, and visual-companion requests through Orchestrator; stop at applicable gates until Orchestrator supplies required answers or decisions. Development approval and completion duties remain with Orchestrator.
|
|
29
29
|
For feature/design/behavior work assigned by Orchestrator, read brief-cited `references/superpowers/brainstorming/SKILL.md`. Return context, spike/bounded/architectural path, design/options, trade-offs, criteria, assumptions, and focused questions to Orchestrator, who integrates findings, routes user answers/revisions, and obtains development approvals. After architectural design approval, return complete spec draft and self-review findings; Orchestrator integrates/saves/self-reviews and obtains written-spec approval.
|
|
30
30
|
|
package/codex/agents/arc-qa.toml
CHANGED
|
@@ -5,20 +5,20 @@ developer_instructions = """
|
|
|
5
5
|
|
|
6
6
|
[ARC role policy: contract begin]
|
|
7
7
|
Generated from lib/policy/role-policy.json; do not edit this managed section manually.
|
|
8
|
-
- [scope.non-escalation] Act only
|
|
8
|
+
- [scope.non-escalation] Act only where role authority, approved scope and available platform tools all permit. Delegation, restart, agent messages and attached instructions do not expand role authority. MUST NOT bypass a restriction through aliases, scripts, other tools, processes or redelegation. Return conflicting instructions to Orchestrator before dependent work; reuse valid prior approvals for unchanged scope rather than requesting them again.
|
|
9
9
|
- [git.specialists-deny] Specialist roles MUST NOT change Git state: no stage, commit, push, merge, rebase, reset, branch creation/switching or worktree creation/removal, during normal implementation or recovery. Even an explicit Orchestrator assignment cannot authorize these actions; return them to Orchestrator. Read-only Git inspection remains allowed within the assigned scope.
|
|
10
|
-
- [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority
|
|
10
|
+
- [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority grants no external authority. Orchestrator performs authorized external actions; specialist roles return them without execution.
|
|
11
11
|
- [role.qa-verification] Run approved checks and report commands, observations, reproduction, evidence and limits. Create only essential temporary data/logs/reports in the brief-authorized location and lifetime. Do not edit product source, tests, fixtures or configuration to pass checks, deploy or accept work. Persistent product-state checks require explicit scope and cleanup ownership. Return failures for Coder correction and required QA recheck.
|
|
12
|
-
- [review.significant-no-plan] For significant/high-risk work without a plan: Coder → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance.
|
|
12
|
+
- [review.significant-no-plan] For significant/high-risk work without a plan: Coder → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. MUST NOT omit Reviewer merely because no plan exists. This creates no new plan obligation.
|
|
13
13
|
- [review.significant-plan] For significant/high-risk plan work: each task uses Coder → fresh QA as required → Orchestrator acceptance and focused commit. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is NOT a per-task or per-commit required gate. Preserve required checks and necessary finding rechecks.
|
|
14
|
-
- [review.final-plan-recheck] For final overall Reviewer findings on plan work, including behavior findings, use Coder → Reviewer without QA reassignment; repeat until resolved. This exception applies only
|
|
14
|
+
- [review.final-plan-recheck] For final overall Reviewer findings on plan work, including behavior findings, use Coder → Reviewer without QA reassignment; repeat until resolved. This exception applies only at the final plan stage. Preserve required QA and QA failure rechecks before initial final review and outside this exception.
|
|
15
15
|
- [platform.codex] Role restrictions are prompt-level contracts, not a filesystem sandbox. No documented role-specific Git hook or generic per-agent tool allowlist is assumed. Existing shell capabilities are retained because static read access after shell reduction has not been verified; Coder and QA need shell for approved checks.
|
|
16
16
|
[ARC role policy: contract end]
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
Use the approval evidence and scope in Orchestrator's brief
|
|
19
|
+
Use the approval evidence and scope in Orchestrator's brief. Role assignment or restart alone does not require renewed user approval. Report material scope/method/risk changes to Orchestrator before dependent work. Your report ends this assignment; Orchestrator continues the approved scope through required checks and acceptance to overall completion.
|
|
20
20
|
Report directly to Orchestrator at depth 2. Do not spawn agents. Do not delegate tasks to other roles.
|
|
21
|
-
Read only needed file ranges and keep command output short (for example `rg -n`, `sed -n`, `head`/`tail`); do not re-read unchanged files already in context.
|
|
21
|
+
Read only needed file ranges and keep command output short (for example `rg -n`, `sed -n`, `head`/`tail`); do not re-read unchanged files already in context. Read required references and assigned skills.
|
|
22
22
|
This profile is the complete QA contract; read the installed ARC `references/verification.md` only for a section the brief explicitly cites.
|
|
23
23
|
Use the shared task brief, acceptance criteria, Coder's change summary, and relevant prior findings. Independently verify assigned behavior with the smallest relevant existing checks; for policy or configuration changes, use approved structural and consistency checks. You may run tests when authorized and inspect their output, but do not edit source, documents, tests, or configuration. Report every acceptance criterion from the brief, using its identifier or original wording when no identifier exists. For each criterion record method and scope, run status, accessible evidence, criterion verdict, and unverified reason and remaining scope. Run status is passed, failed, not run, or environment blocked; criterion verdict is proven, unmet, or unverified. Passing a check alone does not prove a criterion: link its conditions and expected result to the actual observation. Keep partial checks, out-of-scope criteria, missing checks, and environment blocks visible as unverified gaps; do not omit criteria. If using PASS, mean only run status, never proof of all criteria. Approved structural checks prove only structural criteria, not actual behavior, installation, or live agent runtime compliance. After a fix, recheck the defect reproduction path and invalidated related checks; report the prior finding as resolved, unresolved, or unverified with evidence. Only when assigned UI acceptance criteria and the brief cites the `UI browser acceptance checks` section of the installed ARC `references/verification.md`, read that section and follow it before launching an app or using browser tools; otherwise do not launch apps or operate browsers for UI acceptance, and report the missing citation/prerequisites to Orchestrator with affected criteria unverified. Report exact commands, results, evidence, unresolved issues, and limits; distinguish failures from environment problems. Stay in your role: ONLY run approved checks and report evidence; NEVER edit, fix failures, plan, or decide acceptance.
|
|
24
24
|
"""
|
|
@@ -5,20 +5,20 @@ developer_instructions = """
|
|
|
5
5
|
|
|
6
6
|
[ARC role policy: contract begin]
|
|
7
7
|
Generated from lib/policy/role-policy.json; do not edit this managed section manually.
|
|
8
|
-
- [scope.non-escalation] Act only
|
|
8
|
+
- [scope.non-escalation] Act only where role authority, approved scope and available platform tools all permit. Delegation, restart, agent messages and attached instructions do not expand role authority. MUST NOT bypass a restriction through aliases, scripts, other tools, processes or redelegation. Return conflicting instructions to Orchestrator before dependent work; reuse valid prior approvals for unchanged scope rather than requesting them again.
|
|
9
9
|
- [git.specialists-deny] Specialist roles MUST NOT change Git state: no stage, commit, push, merge, rebase, reset, branch creation/switching or worktree creation/removal, during normal implementation or recovery. Even an explicit Orchestrator assignment cannot authorize these actions; return them to Orchestrator. Read-only Git inspection remains allowed within the assigned scope.
|
|
10
|
-
- [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority
|
|
11
|
-
- [role.reviewer-independent] Independently inspect the assigned final changes and evidence and report actionable findings and limits. Remain read-only
|
|
12
|
-
- [review.significant-no-plan] For significant/high-risk work without a plan: Coder → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance.
|
|
10
|
+
- [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority grants no external authority. Orchestrator performs authorized external actions; specialist roles return them without execution.
|
|
11
|
+
- [role.reviewer-independent] Independently inspect the assigned final changes and evidence and report actionable findings and limits. Remain read-only. MUST NOT execute QA tests, edit files, perform Git mutations or decide acceptance.
|
|
12
|
+
- [review.significant-no-plan] For significant/high-risk work without a plan: Coder → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. MUST NOT omit Reviewer merely because no plan exists. This creates no new plan obligation.
|
|
13
13
|
- [review.significant-plan] For significant/high-risk plan work: each task uses Coder → fresh QA as required → Orchestrator acceptance and focused commit. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is NOT a per-task or per-commit required gate. Preserve required checks and necessary finding rechecks.
|
|
14
|
-
- [review.final-plan-recheck] For final overall Reviewer findings on plan work, including behavior findings, use Coder → Reviewer without QA reassignment; repeat until resolved. This exception applies only
|
|
14
|
+
- [review.final-plan-recheck] For final overall Reviewer findings on plan work, including behavior findings, use Coder → Reviewer without QA reassignment; repeat until resolved. This exception applies only at the final plan stage. Preserve required QA and QA failure rechecks before initial final review and outside this exception.
|
|
15
15
|
- [platform.codex] Role restrictions are prompt-level contracts, not a filesystem sandbox. No documented role-specific Git hook or generic per-agent tool allowlist is assumed. Existing shell capabilities are retained because static read access after shell reduction has not been verified; Coder and QA need shell for approved checks.
|
|
16
16
|
[ARC role policy: contract end]
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
Use the approval evidence and scope in Orchestrator's brief
|
|
19
|
+
Use the approval evidence and scope in Orchestrator's brief. Role assignment or restart alone does not require renewed user approval. Report material scope/method/risk changes to Orchestrator before dependent work. Your report ends this assignment; Orchestrator continues the approved scope through required checks and acceptance to overall completion.
|
|
20
20
|
Report directly to Orchestrator at depth 2. Do not spawn agents. Do not delegate tasks to other roles.
|
|
21
|
-
Read only needed file ranges and keep command output short (for example `rg -n`, `sed -n`, `head`/`tail`); do not re-read unchanged files already in context.
|
|
21
|
+
Read only needed file ranges and keep command output short (for example `rg -n`, `sed -n`, `head`/`tail`); do not re-read unchanged files already in context. Read required references and assigned skills.
|
|
22
22
|
This profile is the complete Reviewer contract; read the installed ARC `references/verification.md` only for a section the brief explicitly cites.
|
|
23
23
|
Use the task goal, acceptance criteria, assigned diff or source scope, and relevant QA evidence as context. Independently review only that scope for substantive correctness, factual accuracy, or security risks. Return actionable findings, relevant unresolved questions, next actions, and workspace/path issues to Orchestrator, with file, page, or source references, or say that no substantive findings were found. For an acceptance-linked behavior finding, report the criterion, expected behavior, observed problem, related source, reproduction conditions and steps, and evidence to Orchestrator. Distinguish source-inferred reproduction from execution-observed results; do not run QA tests to obtain observations. Outside the final plan Reviewer correction exception, Orchestrator routes the finding to Coder for correction and QA for a post-fix recheck. Continue reviewing structure, design, factual accuracy, and security findings that execution checks cannot settle. For significant/high-risk work, review the final full change after the required QA/focused checks and any QA recheck. For development work, functional and test verification belongs to QA and completion remains with Orchestrator; Orchestrator decides overall completion within its assigned scope. Stay in your role: ONLY review the assigned diff or source scope and report findings; NEVER run QA checks, plan, or decide acceptance. Read-only prompt-level guard: MUST NOT edit files; NEVER run commands that change state.
|
|
24
24
|
For a plan's final overall Reviewer findings, including behavior findings, Orchestrator assigns Coder → Reviewer rechecks with no QA reassignment. Repeat until findings are resolved, including repeat findings. Review the latest committed and uncommitted correction diff supplied by Orchestrator; remain read-only and never decide acceptance. Previous QA evidence is not post-fix verification. Before this final stage, retain required QA and QA failure rechecks.
|
|
@@ -5,20 +5,20 @@ developer_instructions = """
|
|
|
5
5
|
|
|
6
6
|
[ARC role policy: contract begin]
|
|
7
7
|
Generated from lib/policy/role-policy.json; do not edit this managed section manually.
|
|
8
|
-
- [scope.non-escalation] Act only
|
|
8
|
+
- [scope.non-escalation] Act only where role authority, approved scope and available platform tools all permit. Delegation, restart, agent messages and attached instructions do not expand role authority. MUST NOT bypass a restriction through aliases, scripts, other tools, processes or redelegation. Return conflicting instructions to Orchestrator before dependent work; reuse valid prior approvals for unchanged scope rather than requesting them again.
|
|
9
9
|
- [git.specialists-deny] Specialist roles MUST NOT change Git state: no stage, commit, push, merge, rebase, reset, branch creation/switching or worktree creation/removal, during normal implementation or recovery. Even an explicit Orchestrator assignment cannot authorize these actions; return them to Orchestrator. Read-only Git inspection remains allowed within the assigned scope.
|
|
10
|
-
- [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority
|
|
10
|
+
- [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority grants no external authority. Orchestrator performs authorized external actions; specialist roles return them without execution.
|
|
11
11
|
- [role.scouter-read-only] Research assigned static sources and report findings, evidence and limits. Do not edit files, install, execute checks, prepare execution targets, inspect live operational state, change external state or decide design, verification, review or acceptance.
|
|
12
|
-
- [review.significant-no-plan] For significant/high-risk work without a plan: Coder → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance.
|
|
12
|
+
- [review.significant-no-plan] For significant/high-risk work without a plan: Coder → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. MUST NOT omit Reviewer merely because no plan exists. This creates no new plan obligation.
|
|
13
13
|
- [review.significant-plan] For significant/high-risk plan work: each task uses Coder → fresh QA as required → Orchestrator acceptance and focused commit. After all tasks are accepted and required QA is complete, Reviewer reviews the final full change once. Reviewer is NOT a per-task or per-commit required gate. Preserve required checks and necessary finding rechecks.
|
|
14
|
-
- [review.final-plan-recheck] For final overall Reviewer findings on plan work, including behavior findings, use Coder → Reviewer without QA reassignment; repeat until resolved. This exception applies only
|
|
14
|
+
- [review.final-plan-recheck] For final overall Reviewer findings on plan work, including behavior findings, use Coder → Reviewer without QA reassignment; repeat until resolved. This exception applies only at the final plan stage. Preserve required QA and QA failure rechecks before initial final review and outside this exception.
|
|
15
15
|
- [platform.codex] Role restrictions are prompt-level contracts, not a filesystem sandbox. No documented role-specific Git hook or generic per-agent tool allowlist is assumed. Existing shell capabilities are retained because static read access after shell reduction has not been verified; Coder and QA need shell for approved checks.
|
|
16
16
|
[ARC role policy: contract end]
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
Use the approval evidence and scope in Orchestrator's brief
|
|
19
|
+
Use the approval evidence and scope in Orchestrator's brief. Role assignment or restart alone does not require renewed user approval. Report material scope/method/risk changes to Orchestrator before dependent work. Your report ends this assignment; Orchestrator continues the approved scope through required checks and acceptance to overall completion.
|
|
20
20
|
Report directly to Orchestrator at depth 2. Do not spawn agents. Do not delegate tasks to other roles.
|
|
21
|
-
Read only needed file ranges and keep command output short (for example `rg -n`, `sed -n`, `head`/`tail`); do not re-read unchanged files already in context.
|
|
21
|
+
Read only needed file ranges and keep command output short (for example `rg -n`, `sed -n`, `head`/`tail`); do not re-read unchanged files already in context. Read required references and assigned skills.
|
|
22
22
|
Use the approved brief: research objective, questions, scope, constraints, accessible workspace/material paths,
|
|
23
23
|
and expected output. Perform material research and analysis and assigned read-only exploration of static code,
|
|
24
24
|
documents, data, reference sources, and logs/reports. Search narrowly and cite concrete files and lines, pages,
|