@yunhozz/arc 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/MANIFEST.sha256 +96 -0
  2. package/README.md +61 -2
  3. package/bin/arc.mjs +3 -0
  4. package/claude/agents/arc-coder.md +67 -0
  5. package/claude/agents/arc-planner.md +74 -0
  6. package/claude/agents/arc-qa.md +68 -0
  7. package/claude/agents/arc-reviewer.md +65 -0
  8. package/claude/agents/arc-scouter.md +63 -0
  9. package/claude/skill/SKILL.md +370 -0
  10. package/claude/skill/hooks/git-policy.json +208 -0
  11. package/claude/skill/hooks/role-git-guard.mjs +98 -0
  12. package/claude/skill/models.toml +64 -0
  13. package/claude/skill/references/commit.md +77 -0
  14. package/claude/skill/references/git-recovery.md +46 -0
  15. package/claude/skill/references/handoff-prep.md +102 -0
  16. package/claude/skill/references/handoff.md +100 -0
  17. package/claude/skill/references/limits.md +42 -0
  18. package/claude/skill/references/planning.md +250 -0
  19. package/claude/skill/references/superpowers/LICENSE +21 -0
  20. package/claude/skill/references/superpowers/brainstorming/SKILL.md +225 -0
  21. package/claude/skill/references/superpowers/brainstorming/builder-check-prompt.md +23 -0
  22. package/claude/skill/references/superpowers/brainstorming/scripts/frame-template.html +213 -0
  23. package/claude/skill/references/superpowers/brainstorming/scripts/helper.js +167 -0
  24. package/claude/skill/references/superpowers/brainstorming/scripts/server.cjs +723 -0
  25. package/claude/skill/references/superpowers/brainstorming/scripts/start-server.sh +209 -0
  26. package/claude/skill/references/superpowers/brainstorming/scripts/stop-server.sh +120 -0
  27. package/claude/skill/references/superpowers/brainstorming/visual-companion.md +299 -0
  28. package/claude/skill/references/superpowers/provenance.json +26 -0
  29. package/claude/skill/references/superpowers/test-driven-development/SKILL.md +330 -0
  30. package/claude/skill/references/superpowers/test-driven-development/writing-good-tests.md +198 -0
  31. package/claude/skill/references/superpowers/writing-plans/SKILL.md +204 -0
  32. package/claude/skill/references/verification.md +125 -0
  33. package/claude/skill/references/visual-companion.md +16 -0
  34. package/claude/skill/scripts/apply-models.py +31 -0
  35. package/claude/skill/scripts/model_config.py +211 -0
  36. package/codex/agents/arc-coder.toml +37 -0
  37. package/codex/agents/arc-planner.toml +38 -0
  38. package/codex/agents/arc-qa.toml +24 -0
  39. package/codex/agents/arc-reviewer.toml +25 -0
  40. package/codex/agents/arc-scouter.toml +37 -0
  41. package/codex/skill/SKILL.md +356 -0
  42. package/codex/skill/models.toml +64 -0
  43. package/codex/skill/references/commit.md +100 -0
  44. package/codex/skill/references/git-recovery.md +64 -0
  45. package/codex/skill/references/handoff-prep.md +153 -0
  46. package/codex/skill/references/handoff-worktree.md +93 -0
  47. package/codex/skill/references/handoff.md +181 -0
  48. package/codex/skill/references/limits.md +43 -0
  49. package/codex/skill/references/planning.md +287 -0
  50. package/codex/skill/references/superpowers/LICENSE +21 -0
  51. package/codex/skill/references/superpowers/brainstorming/SKILL.md +225 -0
  52. package/codex/skill/references/superpowers/brainstorming/builder-check-prompt.md +23 -0
  53. package/codex/skill/references/superpowers/brainstorming/scripts/frame-template.html +213 -0
  54. package/codex/skill/references/superpowers/brainstorming/scripts/helper.js +167 -0
  55. package/codex/skill/references/superpowers/brainstorming/scripts/server.cjs +723 -0
  56. package/codex/skill/references/superpowers/brainstorming/scripts/start-server.sh +209 -0
  57. package/codex/skill/references/superpowers/brainstorming/scripts/stop-server.sh +120 -0
  58. package/codex/skill/references/superpowers/brainstorming/visual-companion.md +299 -0
  59. package/codex/skill/references/superpowers/provenance.json +26 -0
  60. package/codex/skill/references/superpowers/test-driven-development/SKILL.md +330 -0
  61. package/codex/skill/references/superpowers/test-driven-development/writing-good-tests.md +198 -0
  62. package/codex/skill/references/superpowers/writing-plans/SKILL.md +204 -0
  63. package/codex/skill/references/verification.md +163 -0
  64. package/codex/skill/references/visual-companion.md +23 -0
  65. package/codex/skill/scripts/apply-models.py +207 -0
  66. package/codex/skill/scripts/model_config.py +362 -0
  67. package/install.command +5 -0
  68. package/lib/cli/choices.mjs +47 -0
  69. package/lib/cli/completion.mjs +53 -0
  70. package/lib/cli/index.mjs +55 -0
  71. package/lib/cli/preset.mjs +29 -0
  72. package/lib/cli/progress.mjs +10 -0
  73. package/lib/cli/root.mjs +20 -0
  74. package/lib/cli/uninstall.mjs +17 -0
  75. package/lib/installer/acquisition.mjs +77 -0
  76. package/lib/installer/global-config.mjs +43 -0
  77. package/lib/installer/install.mjs +28 -0
  78. package/lib/installer/language.mjs +13 -0
  79. package/lib/installer/limits.mjs +21 -0
  80. package/lib/installer/manifest.mjs +37 -0
  81. package/lib/installer/package-references.mjs +32 -0
  82. package/lib/installer/plan.mjs +62 -0
  83. package/lib/installer/preset.mjs +26 -0
  84. package/lib/installer/runtime-config.mjs +85 -0
  85. package/lib/installer/shell-completion.mjs +29 -0
  86. package/lib/installer/stage-cleanup.mjs +40 -0
  87. package/lib/installer/superpowers.mjs +113 -0
  88. package/lib/installer/targets.mjs +55 -0
  89. package/lib/installer/transaction.mjs +91 -0
  90. package/lib/installer/uninstall.mjs +32 -0
  91. package/lib/limits.mjs +13 -0
  92. package/lib/models/config.mjs +58 -0
  93. package/lib/models/index.mjs +2 -0
  94. package/lib/models/profiles.mjs +111 -0
  95. package/lib/policy/claude-hook.mjs +40 -0
  96. package/lib/policy/render.mjs +74 -0
  97. package/lib/policy/role-policy.json +577 -0
  98. package/lib/safe-fs/index.mjs +67 -0
  99. package/lib/safe-fs/native.mjs +54 -0
  100. package/native/binding.c +157 -0
  101. package/native/binding.gyp +1 -0
  102. package/package.json +43 -4
  103. package/prebuilds/darwin-arm64/arc_safe_fs.node +0 -0
  104. package/prebuilds/darwin-x64/arc_safe_fs.node +0 -0
  105. package/prebuilds/index.json +64 -0
  106. package/prebuilds/linux-arm64-gnu/arc_safe_fs.node +0 -0
  107. package/prebuilds/linux-x64-gnu/arc_safe_fs.node +0 -0
  108. package/scripts/build-native.mjs +36 -0
  109. package/scripts/check-installer-parity.mjs +59 -0
  110. package/scripts/update-manifest.mjs +28 -0
  111. package/scripts/update-role-policy.mjs +15 -0
  112. package/scripts/update-superpowers.mjs +4 -0
  113. package/scripts/vendor-toml.mjs +40 -0
  114. package/vendor/toml/LICENSE +24 -0
  115. package/vendor/toml/dist/date.js +156 -0
  116. package/vendor/toml/dist/error.js +67 -0
  117. package/vendor/toml/dist/extract.js +293 -0
  118. package/vendor/toml/dist/index.js +34 -0
  119. package/vendor/toml/dist/parse.js +164 -0
  120. package/vendor/toml/dist/primitive.js +151 -0
  121. package/vendor/toml/dist/stringify.js +219 -0
  122. package/vendor/toml/dist/struct.js +156 -0
  123. package/vendor/toml/dist/util.js +57 -0
  124. package/vendor/toml/package.json +6 -0
  125. package/vendor/toml/provenance.json +35 -0
@@ -0,0 +1,98 @@
1
+ import fs from 'node:fs';
2
+ import {pathToFileURL} from 'node:url';
3
+
4
+ const deny = reason => ({allowed:false,reason});
5
+ const isGit = word => /(?:^|[\\/])git(?:\.exe)?$/i.test(word);
6
+ export function validateGitPolicy(policy) {
7
+ if (!policy || policy.schemaVersion !== 1 || !Array.isArray(policy.globalValueOptions) || !Array.isArray(policy.globalFlags) || !policy.commands || typeof policy.commands !== 'object' || Array.isArray(policy.commands)) throw Error('Invalid Git policy');
8
+ const strings = list => Array.isArray(list) && list.every(x=>typeof x === 'string' && x.startsWith('-'));
9
+ if (!strings(policy.globalValueOptions) || !strings(policy.globalFlags) || !Object.keys(policy.commands).length) throw Error('Invalid Git policy');
10
+ for (const rule of Object.values(policy.commands)) if (!rule || !strings(rule.flags) || !strings(rule.values) || !['any','none','query','list'].includes(rule.positionals)) throw Error('Invalid Git command policy');
11
+ return policy;
12
+ }
13
+ // This deliberately supports a small shell grammar, rather than executing a shell.
14
+ function tokenize(command) {
15
+ const tokens=[]; let word='', started=false, quote=null;
16
+ for(let i=0;i<command.length;i++) {
17
+ const char=command[i];
18
+ if(char==='\\' && /[\r\n]/.test(command[i+1]??'')) throw Error('Escaped line terminator');
19
+ if(quote) {
20
+ if(char===quote){quote=null;continue;}
21
+ if(quote==='"' && /[$`]/.test(char)) throw Error('Dynamic shell syntax');
22
+ // Preserve Windows paths in quoted executable names.
23
+ if(char==='\\' && quote==='"' && /["\\$`]/.test(command[i+1]??'')){word+=command[++i];continue;}
24
+ word+=char;continue;
25
+ }
26
+ if(char==='"'||char==="'"){quote=char;started=true;continue;}
27
+ if(/[\r\n\x00<>`$(){}&]/.test(char) && !(char==='&'&&command[i+1]==='&')) throw Error('Unsupported shell syntax');
28
+ if(char===';'||char==='|'||char==='&') {
29
+ if(started){tokens.push(word);word='';started=false;}
30
+ const operator=command.slice(i,i+2); if(operator==='&&'||operator==='||')i++;
31
+ tokens.push({operator:operator==='&&'||operator==='||'?operator:char});continue;
32
+ }
33
+ if(/\s/.test(char)){if(started){tokens.push(word);word='';started=false;}continue;}
34
+ if(char==='\\') {if(i+1>=command.length)throw Error('Incomplete escape'); word+=command[++i];started=true;continue;}
35
+ if(char==='#')throw Error('Unsupported shell comment');
36
+ word+=char;started=true;
37
+ }
38
+ if(quote)throw Error('Unclosed quote'); if(started)tokens.push(word);return tokens;
39
+ }
40
+ function classifyWords(words,policy,depth) {
41
+ if(!words.length)return deny('Empty shell segment');
42
+ const executable=words[0].split(/[\\/]/).at(-1).toLowerCase();
43
+ if(['sh','bash','sh.exe','bash.exe'].includes(executable)) {
44
+ if(depth>=4 || words.length!==3 || words[1]!=='-c')return deny('Unsupported shell wrapper');
45
+ return classifyGitCommand(words[2],policy,depth+1);
46
+ }
47
+ if(!isGit(words[0]))return words.some(isGit)?deny('Unsupported indirect Git invocation'):{allowed:true};
48
+ let i=1;
49
+ while(i<words.length && words[i].startsWith('-')) {
50
+ const option=words[i++],equal=option.indexOf('='),key=equal<0?option:option.slice(0,equal);
51
+ if(policy.globalFlags.includes(option))continue;
52
+ if(!policy.globalValueOptions.includes(key))return deny('Unknown Git global option');
53
+ if(equal<0 && (i>=words.length || words[i++].startsWith('-')))return deny('Missing Git option value');
54
+ if(equal>=0 && !option.slice(equal+1))return deny('Missing Git option value');
55
+ }
56
+ const combined=`${words[i]} ${words[i+1]}`;
57
+ const name=Object.hasOwn(policy.commands,combined)?(i+=2,combined):words[i++];
58
+ const rule=Object.hasOwn(policy.commands,name)?policy.commands[name]:null; if(!rule)return deny('Git mutation or unknown subcommand');
59
+ let positions=0,query=false,list=false,paths=false;
60
+ for(;i<words.length;i++) {
61
+ const arg=words[i];
62
+ if(arg==='--' && rule.positionals==='any'){paths=true;continue;}
63
+ if(!paths && arg.startsWith('-')) {
64
+ if(/^-[0-9]+$/.test(arg)&&rule.flags.includes('-<count>'))continue;
65
+ const equal=arg.indexOf('='),key=equal<0?arg:arg.slice(0,equal);
66
+ if(rule.values.includes(key)) {if(equal<0 && (i+1>=words.length||words[++i].startsWith('-')))return deny('Missing query option value'); if(equal>=0&&!arg.slice(equal+1))return deny('Missing query option value');continue;}
67
+ if(!rule.flags.includes(arg))return deny('Unknown or mutating Git option');
68
+ if(['--get','--get-all','--get-regexp','--list','-l'].includes(arg))query=true;
69
+ if(['--list','-l','--show-current'].includes(arg))list=true;
70
+ } else positions++;
71
+ }
72
+ if(rule.positionals==='none'&&positions || rule.positionals==='query'&&(!query||positions>1) || rule.positionals==='list'&&positions&&!list)return deny('Git write or unsupported arguments');
73
+ return {allowed:true};
74
+ }
75
+ export function classifyGitCommand(command,policy,depth=0) {
76
+ try {
77
+ validateGitPolicy(policy);
78
+ if(typeof command!=='string'||!command.trim())return deny('Missing shell command');
79
+ const tokens=tokenize(command); let words=[];
80
+ for(const token of [...tokens,{operator:'end'}]) {
81
+ if(typeof token==='string'){words.push(token);continue;}
82
+ const result=classifyWords(words,policy,depth);if(!result.allowed)return result;words=[];
83
+ }
84
+ return {allowed:true};
85
+ } catch {return deny('Invalid policy or unsupported command syntax');}
86
+ }
87
+ export function evaluateHookEvent(event,policy) {
88
+ const result=event?.hook_event_name!=='PreToolUse' ? deny('Invalid hook event') : event?.tool_name!=='Bash' ? deny('Missing Bash event') : classifyGitCommand(event?.tool_input?.command,policy);
89
+ return result.allowed?{}:{hookSpecificOutput:{hookEventName:'PreToolUse',permissionDecision:'deny',permissionDecisionReason:`ARC specialist Git guard: ${result.reason}. Return the operation to Orchestrator.`}};
90
+ }
91
+ export function runHook() {
92
+ let response;
93
+ try {const policy=validateGitPolicy(JSON.parse(fs.readFileSync(new URL('./git-policy.json',import.meta.url),'utf8')));response=evaluateHookEvent(JSON.parse(fs.readFileSync(0,'utf8')),policy);}
94
+ catch {response={hookSpecificOutput:{hookEventName:'PreToolUse',permissionDecision:'deny',permissionDecisionReason:'ARC specialist Git guard: invalid input or policy asset. Stop and report to Orchestrator.'}};}
95
+ process.stdout.write(JSON.stringify(response)+'\n');
96
+ }
97
+
98
+ if(process.argv[1] && pathToFileURL(process.argv[1]).href===import.meta.url)runHook();
@@ -0,0 +1,64 @@
1
+ # Single source for all role model and effort presets.
2
+ # Use configured settings without substitution; report unavailable settings.
3
+ version = 1
4
+ preset = "balanced"
5
+
6
+ [roles.arc_scouter.economy]
7
+ model = "haiku"
8
+ effort = "high"
9
+
10
+ [roles.arc_scouter.balanced]
11
+ model = "sonnet"
12
+ effort = "medium"
13
+
14
+ [roles.arc_scouter.smart]
15
+ model = "sonnet"
16
+ effort = "high"
17
+
18
+ [roles.arc_planner.economy]
19
+ model = "sonnet"
20
+ effort = "medium"
21
+
22
+ [roles.arc_planner.balanced]
23
+ model = "sonnet"
24
+ effort = "high"
25
+
26
+ [roles.arc_planner.smart]
27
+ model = "opus"
28
+ effort = "high"
29
+
30
+ [roles.arc_coder.economy]
31
+ model = "sonnet"
32
+ effort = "low"
33
+
34
+ [roles.arc_coder.balanced]
35
+ model = "sonnet"
36
+ effort = "medium"
37
+
38
+ [roles.arc_coder.smart]
39
+ model = "opus"
40
+ effort = "high"
41
+
42
+ [roles.arc_qa.economy]
43
+ model = "haiku"
44
+ effort = "high"
45
+
46
+ [roles.arc_qa.balanced]
47
+ model = "sonnet"
48
+ effort = "medium"
49
+
50
+ [roles.arc_qa.smart]
51
+ model = "sonnet"
52
+ effort = "high"
53
+
54
+ [roles.arc_reviewer.economy]
55
+ model = "sonnet"
56
+ effort = "medium"
57
+
58
+ [roles.arc_reviewer.balanced]
59
+ model = "sonnet"
60
+ effort = "high"
61
+
62
+ [roles.arc_reviewer.smart]
63
+ model = "opus"
64
+ effort = "high"
@@ -0,0 +1,77 @@
1
+ # Focused commits
2
+
3
+ Orchestrator reviews task evidence and accepts the approved task before committing.
4
+ Verify approved plan/task, absolute workspace, branch/HEAD, index/worktree/untracked state and ownership.
5
+ Stage exactly the accepted task paths; inspect staged scope and content to exclude unrelated changes.
6
+ After acceptance, Orchestrator creates the focused local commit without additional user commit approval.
7
+ After Orchestrator accepts a task, the next action is the required Git state/scope checks, staging, and focused commit.
8
+ Do not commit before task acceptance or defer the task commit until the plan ends.
9
+ Only Orchestrator accepts the task and executes its focused commit; Coder completion does not replace acceptance.
10
+ Existing plan-skip paths have no new automatic commit obligation; their commits follow applicable guidance and user requests.
11
+ Commit one logical task promptly, using Conventional Commits with a concise English description.
12
+ Task acceptance/commit is distinct from final plan acceptance; remaining final checks and Reviewer timing follow verification.
13
+ Planning documents have their own batch docs commit before Coder handoff.
14
+
15
+ After commit, verify exact SHA, subject, included paths, branch/HEAD and remaining index/worktree state.
16
+ Preserve unrelated changes; never automatically unstage, amend, reset, clean, stash, or delete branches.
17
+ On failure stop dependent work and report actual state and completed steps. Do not blindly repeat a commit or staging
18
+ command. Push, publication and merge require user authorization. Coder must not commit, even when explicitly assigned.
19
+
20
+ Hold the task commit for unmet or unresolved criteria, failed or not-run required checks, undispositioned findings or
21
+ evidence gaps, scope expansion, ownership or staged scope/content mismatch, unexpected workspace/branch/HEAD/Git state,
22
+ or Git failure/partial completion; record the reason and next action. Never waive unmet criteria or required checks to
23
+ commit. If commit creation is unclear, stop and inspect before any retry (see git-recovery).
24
+
25
+ For a no-change task make no empty commit; record acceptance evidence and no change.
26
+ On resume verify the same task's existing commit SHA, content, and validity and reuse it; never duplicate a successful
27
+ task commit. For final Reviewer findings on already committed plan work, Orchestrator defines a follow-up task and required
28
+ planning/approvals. Coder leaves corrections uncommitted during rechecks. Orchestrator refreshes the latest committed
29
+ state plus uncommitted diff and changed-file list in the Reviewer artifact/brief. Reuse an independent Reviewer or
30
+ assign another independent Reviewer as needed. Repeat Coder → Reviewer without QA reassignment until findings are
31
+ resolved; Orchestrator then accepts the corrections and creates one focused follow-up commit.
32
+ Final QA findings retain Coder correction and QA recheck before a new focused commit.
33
+ Do not automatically amend/reset or duplicate the original task commit. Scope expansion keeps existing new
34
+ planning and approval obligations.
35
+
36
+ Commit message form: `<type>(<scope>): <description>` (Conventional Commits) with a concise, specific English description
37
+ without trailing period, lowercase scope when useful, one top-level task per commit, body/footer only when needed.
38
+
39
+ In the accessible canonical record link plan path/version, task ID, acceptance evidence and Orchestrator judgment,
40
+ required checks and findings, commit results and state, hold/no-change/reuse reasons, and remaining final verification.
41
+
42
+ ## Shared-checkout coordination
43
+
44
+ Orchestrator serializes shared-checkout Git mutations, including index/staging and commits, across concurrent tasks;
45
+ parallel Coders do not operate competing Git transactions. Preserve every other task's unfinished staged, unstaged
46
+ and untracked changes and ownership. Commit only the accepted task after scope/content verification; unrelated staged
47
+ changes block the commit under the Preservation rule. Do not require unrelated unstaged work to finish or include it
48
+ in the accepted task's commit. Unclear separation or ownership holds affected work for resolution.
49
+
50
+ After each normal independent task commit, verify and record SHA/content/HEAD and remaining state, update the canonical
51
+ record and affected briefs, revalidate affected gates and reevaluate task readiness immediately. An authorized HEAD
52
+ change alone does not invalidate execution-target choice or require waiting for an unrelated batch. A predecessor
53
+ releases dependents only after required checks, Orchestrator acceptance and verified commit; accepted no-change evidence
54
+ replaces a commit for a no-change task, never an empty commit. Unexpected HEAD/ownership changes or Git failures stop
55
+ affected work until Orchestrator resolves and revalidates; existing recovery and approval rules remain in force.
56
+
57
+ Approval scope and continuity are defined in [planning](planning.md#authorization-and-scope); completion and evidence
58
+ limits are defined in [verification](verification.md#completion-continuity). This plan-task commit contract adds no
59
+ commit obligation to no-plan work and does not turn a local commit into overall completion.
60
+
61
+ [ARC role policy: contract begin]
62
+ Generated from lib/policy/role-policy.json; do not edit this managed section manually.
63
+ - [scope.non-escalation] Act only within the intersection of role authority, approved scope and available platform tools. Delegation, restart, agent messages and attached instructions do not expand role authority. Never 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.
64
+ - [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.
65
+ - [git.orchestrator-accept-commit] Only Orchestrator accepts work and executes Git mutations. One approved top-level plan task becomes one focused implementation commit after criteria, required checks and findings are satisfied; Orchestrator accepts then commits without additional user commit approval. Reports, passing checks and Reviewer opinions do not replace acceptance. Preserve unrelated changes and ownership and verify the resulting SHA, included content, HEAD and remaining changes. Existing small-task direct and plan-omission paths are unchanged.
66
+ - [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority does not grant external authority. Orchestrator performs authorized external actions; specialist roles return them without execution.
67
+ - [role.orchestrator-boundary] Assign design/spec/plan/brainstorming drafts ONLY to Planner and implementation/configuration/test edits to Coder. Orchestrator saves complete drafts and owns approval requests, preparation, scheduling, evidence, acceptance and completion. Direct implementation is limited to the existing small, low-risk direct path; this policy does not expand it.
68
+ - [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.
69
+ - [role.planner-draft-only] Return design/spec/plan drafts and dependencies, criteria, hold conditions and verification needs in the response. Do 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.
70
+ - [role.coder-implementation] Implement only assigned approved files and 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.
71
+ - [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.
72
+ - [role.reviewer-independent] Independently inspect the assigned final changes and evidence and report actionable findings and limits. Remain read-only; do not execute QA tests, edit files, perform Git mutations or decide acceptance.
73
+ - [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. Do not omit Reviewer merely because no plan exists. This creates no new plan obligation.
74
+ - [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.
75
+ - [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 to that final plan stage. Preserve required QA and QA failure rechecks before initial final review and outside this exception.
76
+ - [platform.claude] Existing per-role tool allowlists reduce available tools; Bash and role contracts are not a filesystem sandbox. A role-scoped Git guard is a separate integration and is not supplied by these policy sections alone.
77
+ [ARC role policy: contract end]
@@ -0,0 +1,46 @@
1
+ # Preserve state after failure
2
+
3
+ Read on branch collision, Git preparation failure, partial completion, or Git metadata write denial.
4
+
5
+ On an actual failed Git/tool command, partial completion, unexpected branch/HEAD, missing assigned path,
6
+ or conflicting edit, stop dependent work. Inspect and record the actual absolute path, branch or detached HEAD, HEAD,
7
+ index, worktree/untracked files, ownership, and completed steps. Report the precise blocker and needed resolution to
8
+ Orchestrator. Do not retry, fall back, or repeat completed mutations automatically.
9
+
10
+ Never automatically stash, reset, clean, unstage, discard, amend, delete branches/worktrees, remove locks,
11
+ change permissions to bypass a blocker, or bypass sandbox restrictions. Preserve all unrelated work and recovery
12
+ artifacts. Orchestrator obtains any needed human decision, resolves preparation within authorization,
13
+ then revalidates affected gates and issues a precise delta restart brief. An explicit user selection is required where a
14
+ choice is needed; silence, planning approval and refusal of another option do not count.
15
+
16
+ A profile reapplication failure should restore all previously replaced profile bytes and modes.
17
+ If rollback itself fails, preserve recovery files and report their paths; do not claim a clean state or remove manual
18
+ recovery material.
19
+
20
+ ## Branch collision and invalid names
21
+
22
+ For an invalid name, branch creation/switch failure, lookup error, or unexpected current branch, inspect and record the
23
+ error and actual Git state, then stop Coder handoff. A branch created without a successful switch is partial completion:
24
+ report it, never delete it automatically, and do not treat preparation as complete.
25
+ Do not fall back to another branch or checkout. A new collision suffix requires fresh user approval of the candidate
26
+ (handoff-prep). Existing staged/unstaged/untracked changes stay preserved; if they block a switch or ownership is
27
+ unclear, stop until Orchestrator resolves it.
28
+
29
+ ## Git metadata write denial
30
+
31
+ If authorized staging, commit, branch creation, or switch is denied writing `.git/index.lock` or other Git metadata,
32
+ block handoff and inspect read-only the exact command, workspace, error, failed path, Git directory, branch, HEAD,
33
+ index, partial completion, lock existence, related processes, and OS permissions/ACLs, sandbox restrictions,
34
+ and concurrent Git activity (Orchestrator performs read-only inspection of related processes and ACLs itself or assigns
35
+ it to QA; Scouter, Planner, and Reviewer cannot run commands); record supported causes and remaining uncertainty.
36
+ Lock-creation denial alone does not prove a stale lock. Do not delete locks, change permissions/ownership,
37
+ bypass the sandbox, or move workspaces. If the denial is a permission-system prompt for an already authorized operation,
38
+ request only the permission system's approval for that exact single Git command and workspace, never broad Git access.
39
+ Before retrying recheck branch, HEAD, index, and partial completion; do not repeat completed work.
40
+ After success verify the result and revalidate the whole handoff gate. Denied approval keeps handoff blocked;
41
+ report the actual state.
42
+
43
+ ## Handoff record write denial
44
+
45
+ If writing the canonical handoff record is denied or unavailable, stop that write, report the path and error to
46
+ Orchestrator, and do not change permissions or bypass the sandbox. Use the inline-record fallback in handoff.
@@ -0,0 +1,102 @@
1
+ # Prepare the current checkout
2
+
3
+ Claude v1 supports the current checkout only; ARC-managed worktree execution is unsupported.
4
+ Do not create or attach worktrees as a fallback. Report unsupported requests before dependent work.
5
+
6
+ ### Execution-target request gate
7
+
8
+ Before requesting the user's execution-target choice, Orchestrator verifies and records planned document scope,
9
+ absolute paths and scope coverage, design/plan depth and valid omissions, dependencies and intended execution order.
10
+ The request does not require completed documents or individual approvals; unfinished drafts alone do not block it.
11
+ The set contains required artifacts, not a spec on every path. Resolve scope/dependency decisions needed to identify
12
+ the target; do not require choice evidence before asking for that choice.
13
+ For every supported execution-target option, before obtaining the user's choice, present to the user:
14
+
15
+ - Planned document list, each document's scope and coverage, repository-relative expected paths, dependencies and order,
16
+ and pending writing and approval status.
17
+ - Verified absolute workspace, intended repository, current branch or detached HEAD, base HEAD, any validated
18
+ new-branch candidate and collision status when offered, staged/unstaged/untracked changes, preservation and edit ownership.
19
+
20
+ Obtain explicit choice under the Explicit choice rule before preparation.
21
+ Claude v1 offers current checkout/current branch (or detached HEAD) or a task branch in that checkout only.
22
+ Planning approval or silence does not select a branch. Before branch creation present its exact candidate and base.
23
+ Preserve unrelated changes; never stash, reset or clean to prepare.
24
+
25
+ ### Git mutation evidence gate
26
+
27
+ Before each preparation Git mutation—branch creation/switch, approved-document staging,
28
+ or commit—read this reference and recheck explicit execution-target choice or verified valid reuse; absolute workspace
29
+ and intended repository; current branch or detached HEAD and HEAD; staged/unstaged/untracked changes, preservation and
30
+ edit ownership; and the exact command, target paths, and approved scope. Confirm no unresolved failure or partial
31
+ completion. Record these facts before the action. Missing or mismatched evidence stops that mutation.
32
+ Initial target preparation does not require the complete approved document set: verify planned scope and target inputs.
33
+ For approved-document staging and commit, also verify the complete approved document set and individual approval
34
+ evidence, approved versions, dependencies, and actual index. Read-only Git checks remain allowed.
35
+ Do not infer execution authority from an external skill's early commit step.
36
+
37
+ After branch creation/switch verify actual absolute path, branch, HEAD and preserved state before dependent drafting.
38
+ After staging verify index paths and diff before commit; unrelated staged files block the mutation. Stop and inspect
39
+ on failure or partial completion, record actual state and completed steps, and revalidate affected gates after resolution.
40
+
41
+ Batch-commit all remaining approved planning documents together in one focused docs commit before the first Coder
42
+ handoff. Stage only those document paths and verify the staged content and scope.
43
+ Verify the resulting SHA, subject, paths, branch, HEAD and remaining state. Already committed approved documents need no
44
+ duplicate commit. Record actual preparation order and any deviation honestly, then complete the handoff gate before the
45
+ next Coder start. User authorization persists for the unchanged approved target and scope; do not repeatedly ask for the
46
+ same choice.
47
+
48
+ ## New task branch naming
49
+
50
+ With explicit user approval of the exact candidate and base, create the branch in the current checkout (for example
51
+ `git switch -c <branch>` from the approved base HEAD). Name it `<type>/<short-kebab-case-topic>`: a lowercase prefix for
52
+ the task's main purpose and a short, specific lowercase kebab-case topic without spaces.
53
+
54
+ | Prefix | Purpose |
55
+ |---|---|
56
+ | feat/ | Add a feature |
57
+ | fix/ | Fix a bug |
58
+ | refactor/ | Restructure preserving behavior |
59
+ | docs/ | Change documentation |
60
+ | test/ | Add or change tests |
61
+ | build/ | Build, packaging, dependencies |
62
+ | ci/ | CI configuration |
63
+ | perf/ | Improve performance |
64
+ | style/ | Formatting or style only |
65
+ | chore/ | Operational policy, tools, maintenance |
66
+ | revert/ | Revert a prior change |
67
+
68
+ Validate the name and check collisions before creation. If the base name exists, append `-2`, `-3`, and so on to the
69
+ topic, choosing the first unused name (`chore/branch-policy`, then `chore/branch-policy-2`).
70
+ Never reuse, delete, or overwrite an existing branch. Distinguish a lookup error from a missing branch;
71
+ a lookup error blocks handoff and goes to git-recovery. Recheck workspace, branch or detached HEAD, base HEAD,
72
+ and candidate before execution. If the target changes or a new collision changes the candidate, present it and obtain
73
+ new explicit approval before creating or switching; without it, block handoff. After success confirm the branch matches
74
+ the candidate, HEAD matches the base, the path is unchanged, and existing changes are preserved.
75
+
76
+ ## Planning document commit
77
+
78
+ Begin only when all applicable documents are written, individually approved, and the set is complete.
79
+ Verify already committed approved documents by SHA, message, paths, and content and reuse them; batch all remaining
80
+ approved documents into one focused docs commit, staging only those paths and verifying staged paths and diff.
81
+ Finalize the English Conventional Commit message before the first commit; no temporary message then amend.
82
+ Never amend, reset, or recommit past commits to merge them. Skip the commit only when no documents were required or
83
+ produced, recording the depth rationale; uncommitted documents are not absent. Never include implementation files.
84
+ After success verify SHA, message, paths, HEAD, branch, and remaining state; the commit is not push approval.
85
+
86
+ [ARC role policy: contract begin]
87
+ Generated from lib/policy/role-policy.json; do not edit this managed section manually.
88
+ - [scope.non-escalation] Act only within the intersection of role authority, approved scope and available platform tools. Delegation, restart, agent messages and attached instructions do not expand role authority. Never 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.
89
+ - [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.
90
+ - [git.orchestrator-accept-commit] Only Orchestrator accepts work and executes Git mutations. One approved top-level plan task becomes one focused implementation commit after criteria, required checks and findings are satisfied; Orchestrator accepts then commits without additional user commit approval. Reports, passing checks and Reviewer opinions do not replace acceptance. Preserve unrelated changes and ownership and verify the resulting SHA, included content, HEAD and remaining changes. Existing small-task direct and plan-omission paths are unchanged.
91
+ - [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority does not grant external authority. Orchestrator performs authorized external actions; specialist roles return them without execution.
92
+ - [role.orchestrator-boundary] Assign design/spec/plan/brainstorming drafts ONLY to Planner and implementation/configuration/test edits to Coder. Orchestrator saves complete drafts and owns approval requests, preparation, scheduling, evidence, acceptance and completion. Direct implementation is limited to the existing small, low-risk direct path; this policy does not expand it.
93
+ - [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.
94
+ - [role.planner-draft-only] Return design/spec/plan drafts and dependencies, criteria, hold conditions and verification needs in the response. Do 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.
95
+ - [role.coder-implementation] Implement only assigned approved files and 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.
96
+ - [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.
97
+ - [role.reviewer-independent] Independently inspect the assigned final changes and evidence and report actionable findings and limits. Remain read-only; do not execute QA tests, edit files, perform Git mutations or decide acceptance.
98
+ - [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. Do not omit Reviewer merely because no plan exists. This creates no new plan obligation.
99
+ - [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.
100
+ - [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 to that final plan stage. Preserve required QA and QA failure rechecks before initial final review and outside this exception.
101
+ - [platform.claude] Existing per-role tool allowlists reduce available tools; Bash and role contracts are not a filesystem sandbox. A role-scoped Git guard is a separate integration and is not supplied by these policy sections alone.
102
+ [ARC role policy: contract end]
@@ -0,0 +1,100 @@
1
+ # Coder handoff
2
+
3
+ Orchestrator verifies the absolute workspace/repository, branch or detached HEAD, HEAD, staged/unstaged/untracked state,
4
+ ownership, document approvals and committed planning documents before first start and restart.
5
+ The approved execution target must remain valid. Claude v1 supports current checkout execution and does not support
6
+ ARC-managed worktrees.
7
+
8
+ Execution-target choice and actual preparation precede formal drafting and saving of required specs/plans.
9
+ Initial design proposals may precede choice. Initial target preparation does not authorize Coder; all applicable
10
+ approvals, complete documents, verified batch docs commits or valid absence, and final Git verification remain required.
11
+ Record planned document scope/paths and actual preparation separately, followed by actual drafting/save/approval and
12
+ commit results; preserve actual order and evidence gaps. Reuse a valid choice during document drafting and subsequent
13
+ implementation while scope and target remain unchanged. Authorized HEAD and dirty-state changes alone do not invalidate
14
+ choice; verify preservation and ownership. A changed scope or target requires fresh explicit choice before dependent
15
+ drafting or preparation and does not require document completion. Never fall back automatically.
16
+
17
+ Resolve the Git common directory (`git rev-parse --path-format=absolute --git-common-dir`) and keep one canonical record
18
+ at `<git-common-dir>/arc/handoff/<plan-or-task-slug>.md`, outside the working tree.
19
+ The slug is unique per plan: the dated plan filename stem, or a spec/task slug when no plan exists; never overwrite
20
+ another plan's record. Never stage it or store secrets there. Orchestrator updates the record after each accepted task
21
+ commit (task ID, SHA, state). Record approved document paths/versions/coverage/dependencies and approval evidence;
22
+ explicit target choice; prior and resulting Git state; document commit SHA/subject/files; task scope, ownership,
23
+ checks and limits. If a gate or record was late, record actual order and resolve forward; never claim retroactive
24
+ compliance.
25
+
26
+ The Coder brief supplies absolute workspace, verified branch/HEAD, canonical record path, approved task/criteria,
27
+ exact file ownership, expected tests, dependency limits and blocked conditions. Restart brief: supply only verified
28
+ deltas and mark unchanged fields; `unchanged` means unchanged relative to the record file the fresh Coder reads,
29
+ and every other brief field is in full. Coder trusts Orchestrator verified prep rather than independently repeating
30
+ approval/Git evidence checks, reads fields marked unchanged, and stops on an actual observed conflict.
31
+ Tell Coder that others share the repository and unrelated work must be preserved.
32
+
33
+ Roles report directly to Orchestrator. Do not delegate at depth 2. Orchestrator sequences dependent work,
34
+ resolves actual blockers and revalidates affected gates before resume. No automatic retry after unexpected Git or tool
35
+ failure.
36
+
37
+ If the record write is denied or unavailable, Orchestrator carries the full record inline in every Coder brief (no
38
+ delta, no record-file `unchanged`) and states why; that satisfies the accessible-record requirement.
39
+ Do not delete it automatically.
40
+
41
+ ## Task readiness at every assignment
42
+
43
+ Before each first start or restart, if an approved plan exists, link its current dependency/readiness record
44
+ (planning.md) in the canonical record and brief. Where plan omission is valid under existing rules, do not create a
45
+ plan or map solely to satisfy this linking duty; record the applicable omission judgment and rationale in the
46
+ canonical record and brief. Plan absence alone does not qualify for omission, and an unapproved required plan
47
+ cannot bypass its approval gate.
48
+
49
+ Before assignment, apply every readiness condition in
50
+ [planning.md, Dependency and readiness record](planning.md#dependency-and-readiness-record), including predecessor
51
+ checks, Orchestrator acceptance and verified focused commit or accepted no-change evidence. A Coder completion report
52
+ alone is insufficient. Verify the linked record is current and capacity and file ownership permit assignment.
53
+ Readiness supplements the full handoff gate and execution-target restrictions; it never waives them.
54
+ For authorized HEAD or state changes, refresh this record and affected briefs, verify preservation and ownership,
55
+ revalidate affected gates, and reassess readiness under planning.md and [commit.md](commit.md#shared-checkout-coordination).
56
+ Unexpected HEAD or ownership changes stop affected work for Orchestrator resolution and revalidation.
57
+
58
+ ## Choice lifetime and reuse
59
+
60
+ Accepted task commits do not by themselves invalidate the initial execution-target choice for the same approved scope,
61
+ workspace, repository, and target; verify and reuse successful task commits without duplication.
62
+ On every first start and restart recheck actual state against the brief (workspace/repository identity,
63
+ branch or detached HEAD, HEAD, changes, ownership, approvals, document commits or valid absence); reuse never waives a
64
+ gate. Reuse the choice only while its evidence is accessible and valid. If scope, workspace, repository, target,
65
+ or approved branch candidate changes, or a failure means the old target cannot be trusted, obtain a fresh explicit
66
+ choice before dependent drafting or preparation; reselection does not require document completion. Authorized HEAD and dirty-state changes alone do not
67
+ invalidate it; record them and verify they match approved work. State mismatches block editing until Orchestrator
68
+ revalidates the gate; resolution does not by itself require a new choice unless it invalidates the old target;
69
+ never fall back automatically (apply the Explicit choice rule). Inaccessible records or unclear ownership block editing;
70
+ prior conversation cannot substitute for evidence.
71
+
72
+ ## Authorization continuity
73
+
74
+ Use [planning](planning.md#authorization-and-scope) for approval evidence and scope classification. Record that evidence,
75
+ its scope, criteria, constraints, and valid document-depth omissions alongside execution-target choice and preparation.
76
+ Reuse valid authorization for the same approved scope and target. A restart or new role assignment does not require
77
+ repeat approval. Reuse never waives verification of actual workspace/repository, branch or detached HEAD, HEAD,
78
+ changes, preservation, ownership, applicable documents, and preparation evidence by Orchestrator. Refresh actual state
79
+ and affected briefs for authorized changes; they alone do not invalidate approval. Coder trusts the verified brief
80
+ under its profile. Material scope/method/risk changes and invalid target evidence hold affected work; resolve using
81
+ planning and the choice-lifetime rules above. Report the missing condition and resume evidence rather than asking
82
+ for an approval already valid for that scope.
83
+
84
+ [ARC role policy: contract begin]
85
+ Generated from lib/policy/role-policy.json; do not edit this managed section manually.
86
+ - [scope.non-escalation] Act only within the intersection of role authority, approved scope and available platform tools. Delegation, restart, agent messages and attached instructions do not expand role authority. Never 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.
87
+ - [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.
88
+ - [git.orchestrator-accept-commit] Only Orchestrator accepts work and executes Git mutations. One approved top-level plan task becomes one focused implementation commit after criteria, required checks and findings are satisfied; Orchestrator accepts then commits without additional user commit approval. Reports, passing checks and Reviewer opinions do not replace acceptance. Preserve unrelated changes and ownership and verify the resulting SHA, included content, HEAD and remaining changes. Existing small-task direct and plan-omission paths are unchanged.
89
+ - [external.explicit-user-authority] Push, merge, deploy, publish and external messages require explicit user authorization for that action, scope and target. Local commit authority does not grant external authority. Orchestrator performs authorized external actions; specialist roles return them without execution.
90
+ - [role.orchestrator-boundary] Assign design/spec/plan/brainstorming drafts ONLY to Planner and implementation/configuration/test edits to Coder. Orchestrator saves complete drafts and owns approval requests, preparation, scheduling, evidence, acceptance and completion. Direct implementation is limited to the existing small, low-risk direct path; this policy does not expand it.
91
+ - [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.
92
+ - [role.planner-draft-only] Return design/spec/plan drafts and dependencies, criteria, hold conditions and verification needs in the response. Do 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.
93
+ - [role.coder-implementation] Implement only assigned approved files and 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.
94
+ - [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.
95
+ - [role.reviewer-independent] Independently inspect the assigned final changes and evidence and report actionable findings and limits. Remain read-only; do not execute QA tests, edit files, perform Git mutations or decide acceptance.
96
+ - [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. Do not omit Reviewer merely because no plan exists. This creates no new plan obligation.
97
+ - [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.
98
+ - [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 to that final plan stage. Preserve required QA and QA failure rechecks before initial final review and outside this exception.
99
+ - [platform.claude] Existing per-role tool allowlists reduce available tools; Bash and role contracts are not a filesystem sandbox. A role-scoped Git guard is a separate integration and is not supplied by these policy sections alone.
100
+ [ARC role policy: contract end]
@@ -0,0 +1,42 @@
1
+ # Subagent limits
2
+
3
+ Before the first subagent creation, Orchestrator reads this reference and the adjacent
4
+ `../limits.toml` (installed at `skills/arc/limits.toml`). Require version = 1,
5
+ `max_total_subagents` and `max_concurrent_subagents` as positive safe integers.
6
+ Installation defaults are max_total_subagents = 100 and max_concurrent_subagents = 5.
7
+ A missing, malformed or unreadable policy blocks new creation; report it rather than assuming defaults.
8
+ Freeze these settings for one ARC coordination session/tree; reinstalling affects new sessions.
9
+
10
+ ## Counting and reservations
11
+
12
+ Maintain a session ledger of instance IDs, parent IDs, pending reservations, creation outcomes,
13
+ and active/completed state. The Orchestrator itself is excluded. All created descendants,
14
+ including nested or non-ARC agents, count toward the total. A completed agent never refunds
15
+ the cumulative budget. Follow-up/resume of the same instance does not increment total;
16
+ a fresh instance, retry that creates a new instance, or replacement does increment it.
17
+ Waiting, blocked, running and idle resumable instances consume concurrency until their
18
+ completion/termination is confirmed. Obey any lower actual runtime capacity, including
19
+ native retention of completed instances; ARC counts do not prove that a native slot is free.
20
+
21
+ Before any parallel dispatch, reserve the entire proposed batch in the ledger:
22
+ created + pending reservations + proposed <= max_total_subagents, and
23
+ active + pending reservations + proposed <= max_concurrent_subagents and available runtime capacity.
24
+ Record a reservation before each creation call. Confirmed creation converts it into a created,
25
+ active ID. Release a reservation only when failure proves that no instance was created.
26
+ An uncertain result keeps its reservation and capacity until reconciled; never retry blindly.
27
+ Serialize work when a batch does not fit. There are no reserved role slots.
28
+
29
+ ## Continuation and exhaustion
30
+
31
+ Preserve the ledger through continuation, resume and context compaction; reconcile actual instance
32
+ IDs before dispatch. Ledger loss must never reset counters to zero. If reconstruction is incomplete,
33
+ hold creation and report the unknown budget; use a conservative bound only with sufficient evidence.
34
+ Completion frees confirmed active capacity, never the total-created budget. Exhaustion holds new
35
+ creation and requires reporting remaining work and budgets. It never authorizes skipping required
36
+ QA or Reviewer, role freshness, approval, ownership, dependency or same-file edit gates.
37
+
38
+ This cumulative guard and ARC scheduling are prompt-level policy, not hard runtime enforcement.
39
+ Policy text tests prove package consistency, not actual agent compliance or native runtime support.
40
+ Claude `settings.json.env.CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS` constrains its native session.
41
+ Independent sessions, accounts and platforms do not share this ARC ledger; Agent Teams and hosted APIs
42
+ are outside this contract. Native application must be checked in a supported new session separately.