@yunhozz/arc 0.2.3 → 0.2.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.
Files changed (80) hide show
  1. package/MANIFEST.sha256 +73 -79
  2. package/claude/agents/arc-implementer.md +32 -42
  3. package/claude/agents/arc-planner.md +33 -47
  4. package/claude/agents/arc-qa.md +28 -44
  5. package/claude/agents/arc-reviewer.md +28 -41
  6. package/claude/agents/arc-scouter.md +26 -38
  7. package/claude/skill/SKILL.md +41 -59
  8. package/claude/skill/references/arc-visual-companion.md +19 -24
  9. package/claude/skill/references/commit.md +38 -70
  10. package/claude/skill/references/coordination.md +77 -126
  11. package/claude/skill/references/git-recovery.md +17 -35
  12. package/claude/skill/references/handoff-prep.md +91 -103
  13. package/claude/skill/references/handoff.md +110 -208
  14. package/claude/skill/references/limits.md +19 -31
  15. package/claude/skill/references/planning.md +93 -244
  16. package/claude/skill/references/verification.md +105 -261
  17. package/claude/skill/runtime/adapters/claude.mjs +10 -9
  18. package/claude/skill/runtime/adapters/codex.mjs +7 -8
  19. package/claude/skill/runtime/bootstrap.mjs +3 -2
  20. package/claude/skill/runtime/capabilities.mjs +12 -0
  21. package/claude/skill/runtime/cooperative-schema.mjs +3 -2
  22. package/claude/skill/runtime/cooperative.mjs +52 -4
  23. package/claude/skill/runtime/evaluate.mjs +115 -2
  24. package/claude/skill/runtime/identity.mjs +22 -0
  25. package/claude/skill/runtime/role-policy.json +18 -18
  26. package/claude/skill/runtime/schema.mjs +19 -0
  27. package/claude/skill/scripts/model_config.py +3 -79
  28. package/codex/agents/arc-implementer.toml +34 -30
  29. package/codex/agents/arc-planner.toml +27 -23
  30. package/codex/agents/arc-qa.toml +24 -15
  31. package/codex/agents/arc-reviewer.toml +25 -16
  32. package/codex/agents/arc-scouter.toml +20 -26
  33. package/codex/skill/SKILL.md +42 -57
  34. package/codex/skill/references/arc-visual-companion.md +21 -27
  35. package/codex/skill/references/commit.md +35 -81
  36. package/codex/skill/references/coordination.md +76 -104
  37. package/codex/skill/references/git-recovery.md +29 -51
  38. package/codex/skill/references/handoff-prep.md +76 -134
  39. package/codex/skill/references/handoff-worktree.md +32 -66
  40. package/codex/skill/references/handoff.md +111 -271
  41. package/codex/skill/references/limits.md +21 -34
  42. package/codex/skill/references/planning.md +125 -299
  43. package/codex/skill/references/verification.md +90 -272
  44. package/codex/skill/runtime/adapters/claude.mjs +10 -9
  45. package/codex/skill/runtime/adapters/codex.mjs +7 -8
  46. package/codex/skill/runtime/bootstrap.mjs +3 -2
  47. package/codex/skill/runtime/capabilities.mjs +12 -0
  48. package/codex/skill/runtime/cooperative-schema.mjs +3 -2
  49. package/codex/skill/runtime/cooperative.mjs +52 -4
  50. package/codex/skill/runtime/evaluate.mjs +115 -2
  51. package/codex/skill/runtime/identity.mjs +22 -0
  52. package/codex/skill/runtime/role-policy.json +18 -18
  53. package/codex/skill/runtime/schema.mjs +19 -0
  54. package/lib/installer/global-config.mjs +1 -0
  55. package/lib/installer/manifest.mjs +1 -1
  56. package/lib/installer/plan.mjs +0 -3
  57. package/lib/installer/uninstall.mjs +2 -2
  58. package/lib/management/operations.mjs +4 -2
  59. package/lib/management/update.mjs +3 -3
  60. package/lib/models/profiles.mjs +1 -40
  61. package/lib/policy/render.mjs +1 -5
  62. package/lib/policy/role-policy.json +18 -18
  63. package/lib/runtime/adapters/claude.mjs +10 -9
  64. package/lib/runtime/adapters/codex.mjs +7 -8
  65. package/lib/runtime/bootstrap.mjs +3 -2
  66. package/lib/runtime/capabilities.mjs +12 -0
  67. package/lib/runtime/cooperative-schema.mjs +3 -2
  68. package/lib/runtime/cooperative.mjs +52 -4
  69. package/lib/runtime/evaluate.mjs +115 -2
  70. package/lib/runtime/identity.mjs +22 -0
  71. package/lib/runtime/schema.mjs +19 -0
  72. package/lib/tui/app.mjs +12 -8
  73. package/lib/tui/setup.mjs +5 -8
  74. package/package.json +1 -2
  75. package/claude/skill/hooks/git-policy.json +0 -208
  76. package/claude/skill/hooks/role-git-guard.mjs +0 -18
  77. package/claude/skill/hooks/runtime-gate.mjs +0 -12
  78. package/codex/skill/hooks/runtime-gate.mjs +0 -10
  79. package/lib/policy/claude-hook.mjs +0 -80
  80. package/scripts/probe-runtime-hooks.mjs +0 -55
@@ -1,123 +1,95 @@
1
+ <a id="role-assignment-and-coordination"></a>
1
2
  # Role assignment and coordination
2
3
 
3
- Orchestrator reads this before first creating or assigning a specialist and making related coordination decisions. Also read [limits](limits.md) and installed `../limits.toml` before first creation. Missing, inaccessible or conflicting references stop dependent work; report the exact paths.
4
+ Before first specialist creation/assignment and related decisions, Orchestrator reads this. Also read [limits](limits.md) and installed `../limits.toml` before creation. Report exact missing/inaccessible/conflicting paths; hold dependent work.
4
5
 
6
+ <a id="ownership"></a>
5
7
  ## Ownership
6
8
 
7
- - Orchestrator: sole owner of development, configuration, tests, implementation-dependent documentation, and mixed tasks
8
- requiring implementation, assigning their edits to Implementer. Coordinates scope, planning, approvals, integration
9
- (save, route, obtain approval; never author), acceptance, verification, and completion.
10
- - Scouter: read-only material research/analysis and assigned static code/document/data/log exploration. Reports
11
- evidence, assumptions, unresolved questions, impact, next actions, and workspace/path issues to Orchestrator.
12
- Does not edit files, author standalone documents, or decide design/plans, verification, review, or completion.
13
- - Planner: returns design/spec/plan drafts.
14
- - Implementer: edits assigned, approved implementation/configuration/test-code files and assigned dependent docs.
15
- Orchestrator does not edit them directly except under the Orchestrator direct path for small tasks.
16
- - QA: verifies without edits.
17
- - Reviewer: independently reviews the final full change.
18
- - All five roles report directly to Orchestrator at depth 2: Scouter, Planner, Implementer, QA, and Reviewer.
19
- Orchestrator is depth 1.
20
- Depth-2 roles cannot create agents or delegate tasks to another role. Reviewer remains independent.
21
- - Aliases: Scouter=`arc_scouter`, Planner=`arc_planner`, Implementer=`arc_implementer`, QA=`arc_qa`, Reviewer=`arc_reviewer`.
22
- - Across the full tree, obey configured limits for simultaneous subagents, including Scouter; there are no reserved slots.
23
- Before first creating a subagent, read `references/limits.md` and installed `limits.toml`; maintain its cumulative ledger and reservations.
24
- Parallelize independent tasks only; dependent handoffs are sequential and editing scopes cannot overlap.
25
- - After each read-only role returns (Scouter, Planner, Reviewer), Orchestrator checks `git status` against a pre-spawn
26
- snapshot for unexpected changes; on any change Orchestrator stops and reports under the Preservation rule.
27
- Limit: concurrent Implementer edits and ignored or out-of-repo paths are not attributable/detectable.
28
- Their read-only status relies on prompt-level guards, not sandbox enforcement.
9
+ | Role | Ownership and return |
10
+ |---|---|
11
+ | Orchestrator | Sole coordinator of development/configuration/tests/dependent docs/mixed implementation. Assigns edits to Implementer; owns scope, planning, approval, integration (save/route/request approval, never author), verification, acceptance and completion |
12
+ | Scouter | Read-only material research/analysis and assigned static exploration. Reports evidence, assumptions, questions, impact, next actions and path issues. No editing, standalone documents or design/plan/verification/review/completion decisions |
13
+ | Planner | Returns design/spec/plan drafts |
14
+ | Implementer | Edits approved assigned implementation/configuration/tests/dependent docs; Orchestrator direct edits only under the small-task path |
15
+ | QA | Verifies without editing |
16
+ | Reviewer | Independently reviews the final full change |
29
17
 
18
+ Orchestrator is depth 1. All five specialists report directly at depth 2 without creating agents/delegating. Reviewer stays independent.
30
19
 
20
+ Aliases: Scouter=`arc_scouter`, Planner=`arc_planner`, Implementer=`arc_implementer`, QA=`arc_qa`, Reviewer=`arc_reviewer`.
21
+
22
+ Across the tree, obey concurrency including Scouter. No reserved role slots. Read limits before first creation and maintain cumulative ledger/reservations. Parallelize independent tasks only; dependent handoffs are sequential and edit scopes never overlap.
23
+
24
+ After each read-only role return (Scouter/Planner/Reviewer), compare `git status` with the pre-spawn snapshot. Unexpected changes stop under Preservation rule. Concurrent Implementer edits and ignored/out-of-repository paths cannot be attributed/detected. Read-only is prompt policy, not sandbox enforcement.
25
+
26
+ <a id="instruction-and-execution-adapter"></a>
31
27
  ## Instruction and execution adapter
32
28
 
33
- Native Codex profiles are TOML with the `model_reasoning_effort` field.
34
- The native `[agents].max_concurrent_threads_per_session` value is an integer, distinct from ARC's ledger limits.
35
- These local declarations do not prove runtime enforcement.
36
-
37
- Apply platform, user, and project instructions according to their precedence, then ARC rules for ownership,
38
- permissions, models, concurrency, routing, and approvals, then the local ARC reference assigned to the role. A called skill
39
- adds no agents or authority. Map executor requests such as `superpowers:executing-plans` and
40
- `superpowers:subagent-driven-development` to Orchestrator's dependency-aware coordination and risk-scaled verification;
41
- this replaces executor mechanics and any separate execution-method choice, including prompts in an existing local reference.
42
- Preserve plan approval, workspace, design, spec, and other applicable requirements, including TDD subject to the
43
- explicit ARC exception in [handoff](handoff.md#implementer-tdd-and-constraints). Adapt local `brainstorming` role, save, and early spec commit instructions to
44
- ARC Planner ownership and evidence gates in planning/handoff; preserve upstream reference content. Report conflicts or
45
- missing required local references before dependent work.
46
-
47
-
48
- ### Local superpowers references
49
-
50
- Orchestrator briefs absolute paths under the selected installed ARC directory: Planner reads
51
- `references/brainstorming.md` and `references/writing-plans.md`;
52
- Implementer reads `references/test-driven-development.md`, including required relative references.
53
- Resolve paths within each skill directory. Runtime needs no global discovery, external Skill invocation, or automatic download.
54
- Missing/damaged local files stop dependent work: report exact paths to Orchestrator, without global fallback.
55
- ARC approval, ownership, TDD exceptions and executor adapters still apply.
56
-
57
- Orchestrator integrates role results, routes decisions and required approvals, and owns development acceptance
58
- and completion. Orchestrator runs dependent implementation tasks sequentially and starts a fresh Implementer for each top-level task (Role gate); reuse the current Implementer only for corrections, rework,
59
- or rechecks of the same task while the approved scope, workspace, ownership, and relevant assignment context remain valid;
60
- default to the current Implementer for same-task QA corrections. A QA finding within the current task does not itself create a new task. Before sending corrections or rework to a reused Implementer, Orchestrator rechecks workspace, branch/HEAD and change state against the brief.
61
- Replace or restart a role only when its context is invalid or unavailable, or the task boundary changes, subject to the
62
- amendment exception below. A fresh Implementer for the next task is a restart under handoff (choice reuse and restart brief rules are in handoff).
63
- After an approved plan or acceptance-criteria amendment, start a fresh Implementer for
64
- the remaining work even within the same task; it is also a restart under handoff. Task-boundary gates
65
- follow [Risk-scaled execution](verification.md#risk-scaled-execution).
66
-
67
-
68
- ## Token discipline and handoffs
69
-
70
- - Only Orchestrator calls agents or assigns specialist tasks. Every `spawn_agent` call must explicitly set a descriptive
71
- lowercase snake_case `task_name` in the form `<role>_<short_task>` (for example `planner_scope_review` or `qa_installer_checks`). Do not use arbitrary or random names. `task_name` identifies the run; `agent_type` and its configured profile determine the role and model.
72
-
73
- - Keep one shared brief in this fixed field order: Goal; Criteria (IDs); Exact scope/ownership (absolute workspace,
74
- branch or detached HEAD and HEAD, handoff record path, when one exists, files);
75
- Constraints/decisions; Evidence (paths/lines, commands, artifact links); Prior findings; Exact next objective (one
76
- bounded objective); Return format (conclusion, evidence locations, unresolved points, next step). On follow-ups send only changed fields and mark the rest `unchanged` (relative to a brief the recipient received);
77
- restart briefs follow handoff; a fresh specialist gets every other field in full. Send only the self-contained subset the next role needs and links to accessible artifacts; omit full history, repeated instructions, and raw logs. No findings may be brief; requested deliverables such as complete plan drafts remain
78
- complete. Cite paths/lines/pages/commands/links instead of logs; investigate gaps only.
79
- - Every specialist spawn sets `fork_turns="none"`; full-history forks are not allowed. Supply that brief.
80
- Reuse an existing specialist for related follow-up with only changed facts/objective when its context
81
- remains relevant; start fresh for unrelated or bloated context. Implementer and QA freshness follow the Role gate.
82
- - `request_user_input` questions use only `title` and `options` fields, never `question`.
83
- - In Implementer briefs, cite the plan/spec path with the task section's line range and include only the needed excerpts,
84
- acceptance criteria, and constraints; do not ask Implementer to read whole plans or specs.
85
- - Follow [Planner drafting preparation and consolidated feedback](planning.md#planner-drafting-preparation-and-consolidated-feedback).
86
- Complete the initial brief and whole-draft checklist before sending consolidated corrections. Gate further calls
87
- on documented changes or criterion progress; hold repetition without progress.
88
- - Before optional calls, name the unresolved question and expected artifact. Skip calls for questions resolved by available evidence or direct inspection.
89
- - Wait for a specialist with `wait_agent` using the maximum supported timeout, repeating only until it completes; a
90
- timeout is not a reason to poll or check status in between. Do not poll with `list_agents`, `sleep`, or repeated short
91
- waits; use `list_agents` only to resolve an unknown agent name or state. Send each specialist one complete brief per
92
- objective and batch related corrections or follow-ups into one message. Do not poll long-running commands with
93
- repeated `sleep` or short status checks; use a single blocking wait with the tool's longest yield.
94
- - Read only the needed ranges of files and outputs (for example `rg -n`, `sed -n`, `head`/`tail`) and cap long command
95
- output. Do not re-read files or outputs already in context unless they changed. A mandatory reference already read in this context and unchanged need not be re-read, and this skill file, once read in this context and unchanged, is not re-read on follow-up turns; this does not shorten any triggered mandatory reference read.
96
- - When a plan completes or before starting another plan in a session with long history, Orchestrator records the canonical handoff state in the handoff record file and recommends that the user continue in a new session.
97
- - Before handoff, post one short update with role/objective/expected output; after return, combine findings and next
98
- stage concisely. Do not expose hidden reasoning or raw prompts.
29
+ Codex profiles are TOML with `model_reasoning_effort`. Native `[agents].max_concurrent_threads_per_session` is an integer separate from ARC ledger limits. Local declarations prove no runtime enforcement.
30
+
31
+ Apply platform/user/project instructions by precedence, then ARC ownership/permissions/models/concurrency/routing/approval and role-local references. Skills add neither agents nor authority. Map `superpowers:executing-plans`/`superpowers:subagent-driven-development` to dependency-aware Orchestrator coordination and risk-scaled verification, replacing executor mechanics and separate execution-method prompts in existing references.
32
+
33
+ Preserve plan approval, workspace, design, spec and all applicable requirements. TDD uses only [handoff](handoff.md#implementer-tdd-and-constraints)'s explicit ARC exceptions. Adapt local `brainstorming` role/save/early-spec-commit instructions to Planner ownership and planning/handoff evidence gates, preserving upstream text. Report conflicts/missing required references before dependent work.
34
+
35
+ Orchestrator integrates results, routes decisions/approvals and owns acceptance/completion. Run dependent implementation sequentially with a fresh Implementer per top-level task. Reuse current Implementer only for same-task correction/rework/rechecks while scope/workspace/ownership/context remain valid. Default same-task QA corrections to it; findings alone create no new task. Before reuse, compare actual workspace, branch/HEAD and change state to the brief.
36
+
37
+ Replace/restart only for invalid/unavailable context or changed task boundary, except approved plan/criteria amendments require a fresh Implementer for remaining work even within the same task. Next-task and amendment assignments are handoff restarts, subject to choice reuse/restart briefs. Follow [risk-scaled execution](verification.md#risk-scaled-execution) at task boundaries.
38
+
39
+
99
40
 
41
+ <a id="local-superpowers-references"></a>
42
+ ### Local Superpowers references
100
43
 
44
+ Supply absolute paths under the selected installed ARC directory. Planner reads `references/brainstorming.md`/`references/writing-plans.md`; Implementer reads `references/test-driven-development.md` and required relative references. Resolve relatives within skill directories. Runtime needs no global discovery/external Skill call/automatic download. Missing/damaged files stop dependent work; report paths without global fallback. Preserve ARC approvals, ownership, TDD exceptions and executor adapters.
45
+
46
+ <a id="token-discipline-and-handoffs"></a>
47
+ ## Context discipline and handoffs
48
+
49
+ Only Orchestrator creates/assigns specialists. Every `spawn_agent` sets descriptive lowercase snake_case `task_name` as `<role>_<short_task>` (e.g. `planner_scope_review`, `qa_installer_checks`), never random/arbitrary. It identifies the run; `agent_type`/profile determine role/model.
50
+
51
+ Use this fixed brief order:
52
+
53
+ 1. Goal
54
+ 2. Criteria (IDs)
55
+ 3. Exact scope/ownership: absolute workspace, branch or detached HEAD and HEAD, existing record path, files
56
+ 4. Constraints/decisions
57
+ 5. Evidence: paths/lines, commands, artifact links
58
+ 6. Prior findings
59
+ 7. Exact next objective: one bounded objective
60
+ 8. Return format: conclusion, evidence locations, unresolved points, next step
61
+
62
+ - Follow-ups send changed fields only; mark others `unchanged` relative to a received brief. Restarts follow handoff; fresh specialists receive other fields in full.
63
+ - Send a self-contained needed subset and accessible artifacts. Omit full history/repeated instructions/raw logs. No-findings reports may be brief; requested full drafts remain complete. Cite locations/commands/links, investigating gaps only.
64
+ - Every spawn uses `fork_turns="none"` and the shared brief; full-history forks are forbidden. Reuse relevant valid context with deltas; start fresh for unrelated/bloated context. Implementer/QA freshness follows Role gate.
65
+ - `request_user_input` uses `title`/`options`, never `question`.
66
+ - Implementer briefs cite spec/plan task-section line ranges and needed excerpts/criteria/constraints; never request whole-document reading.
67
+ - Follow [Planner preparation/feedback](planning.md#planner-drafting-preparation-and-consolidated-feedback). Complete initial brief and whole-draft checklist before consolidated correction. Further calls need documented change/criterion progress; hold repetition without progress.
68
+ - Before optional calls name the unresolved question/expected artifact. Skip questions already resolved by evidence/direct inspection.
69
+ - Wait with maximum supported `wait_agent` timeout until completion; timeouts do not justify polling. Use `list_agents` only to resolve unknown names/state, never sleep/short-wait loops. Batch corrections in one complete brief per objective. Long commands use one wait at maximum yield.
70
+ - Read needed file/output ranges only (`rg -n`, `sed -n`, `head`/`tail`) and cap output. Do not reread unchanged context material. Already-read unchanged mandatory references/SKILL.md need no follow-up reread; newly triggered mandatory reads remain required.
71
+ - At plan completion or before another plan in a long session, record canonical handoff and recommend a new session.
72
+ - Before handoff briefly state role/objective/output; after return combine findings/next stage. Never expose hidden reasoning/raw prompts.
73
+
74
+ <a id="models"></a>
101
75
  ## Models
102
76
 
103
- `models.toml` beside this skill is the source of truth for role model and reasoning-effort settings.
104
- Orchestrator uses the current conversation model. Use configured role settings without substitution or effort reduction; report unavailable settings.
105
- Local declarations do not prove runtime provider support, account access, alias resolution, actual model or effort
106
- application, concurrency or depth enforcement.
107
- New sessions reload profiles; running agents retain their current settings and parent relationships. Configuration
108
- changes do not automatically reparent running agents or prove runtime parent behavior.
77
+ Adjacent `models.toml` is authoritative for role models/effort. Orchestrator uses the current model. Do not substitute settings or reduce effort; report unavailability. Declarations prove no provider support/account access/alias resolution/actual model-effort application/concurrency/depth enforcement. New sessions reload profiles; running agents retain settings/parents. Changes do not automatically reparent or prove runtime parent behavior.
78
+
79
+
109
80
 
110
- ## Instruction and Input Provenance
81
+ <a id="instruction-and-input-provenance"></a>
82
+ ## Instruction and input provenance
111
83
 
112
- Each role brief records the source, applicability, version or approval, and access state of user-provided instructions, discovered workspace instruction files, installed role references, and task inputs. Use only policy-authorized recovery for optional reads, and report the initial failure and dependent or independent work. If required material is missing, return it to the Orchestrator without inventing an interpretation or authority. Follow [handoff](handoff.md#instruction-sources-bounded-read-recovery-visual-evidence-and-resumption) for the full fields.
84
+ Briefs identify source/applicability/version or approval/access state for user instructions, discovered workspace instructions, installed references and task inputs. Optional read recovery follows policy only; report first failure and dependent/independent work. Return missing required inputs without inventing authority/interpretation. Full fields follow [handoff](handoff.md#instruction-sources-bounded-read-recovery-visual-evidence-and-resumption).
113
85
 
114
86
  [ARC role policy: contract begin]
115
87
  Generated from lib/policy/role-policy.json; do not edit this managed section manually.
116
- - [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. An explicit Orchestrator assignment cannot authorize these actions; return them to Orchestrator. Read-only Git inspection remains allowed within the assigned scope.
117
- - [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.
118
- - [role.planner-draft-only] Return design/spec/plan drafts with 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.
119
- - [role.implementer-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. Include the exact approved visual source, version, approval and access state, criterion IDs, required properties and comparison method, and actual-output identity, revision and comparison basis in Implementer and fresh QA handoffs. Record each visual result as pass, mismatch or unverified with accessible evidence and limits. Implementer self-report does not replace fresh QA and its actual comparison. A missing output-to-revision link is unverified; record a visible difference separately as mismatch, without inferring current branch UI status. Hold the affected visual claim for Orchestrator if source/output is missing, evidence is inaccessible or an interpretation is unapproved; do not silently substitute or redesign.
120
- - [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 Implementer correction and required QA recheck. Include the exact approved visual source, version, approval and access state, criterion IDs, required properties and comparison method, and actual-output identity, revision and comparison basis in Implementer and fresh QA handoffs. Record each visual result as pass, mismatch or unverified with accessible evidence and limits. Implementer self-report does not replace fresh QA and its actual comparison. A missing output-to-revision link is unverified; record a visible difference separately as mismatch, without inferring current branch UI status. Hold the affected visual claim for Orchestrator if source/output is missing, evidence is inaccessible or an interpretation is unapproved; do not silently substitute or redesign.
121
- - [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.
122
- - [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; Implementer and QA need shell for approved checks.
88
+ - [git.specialists-deny] Specialists must not change Git state during implementation or recovery: no stage, commit, push, merge, rebase, reset, branch creation/switching or worktree creation/removal. Explicit Orchestrator assignment cannot authorize these actions; return them to Orchestrator. Read-only Git inspection within the assigned scope remains allowed.
89
+ - [role.scouter-read-only] Research assigned static sources and report findings, evidence and limits. Do not edit, install, execute checks, prepare targets, inspect live operational state or change external state. Do not decide design, verification, review or acceptance.
90
+ - [role.planner-draft-only] Return design/spec/plan drafts with dependencies, criteria, holds and verification needs in the response. During initial drafting and revisions, report progress only to Orchestrator: briefly state the stage, feedback being applied, actual blocker or next step, without draft prose or excerpts. Return the complete draft and self-review for review and correction. Raw responses may appear in app/tool surfaces; prompt policy cannot hide them. Do not save documents, implement, run checks, prepare targets, request user approval or decide acceptance. Stop formal target-dependent drafting when actual prepared-target evidence is missing. Route decisions to Orchestrator.
91
+ - [role.implementer-implementation] Edit only assigned, approved files and run focused checks under the existing TDD contract. Report changed files, RED/GREEN or approved exception evidence, results, limits and follow-up. Do not plan, independently QA/review your own work, accept the task or declare overall completion. Git mutations remain forbidden after successful implementation. Implementer and fresh QA handoffs include the exact approved visual source, version, approval and access state; criterion IDs, required properties and comparison method; and actual-output identity, revision and comparison basis. Record pass, mismatch or unverified with accessible evidence and limits. Implementer self-report does not replace fresh QA and its actual comparison. A missing output-to-revision link is unverified; record a visible difference separately as mismatch without inferring current branch UI state. Missing source/output, inaccessible evidence or unapproved interpretation holds the affected visual claim for Orchestrator. Do not silently substitute or redesign.
92
+ - [role.qa-verification] Run approved checks and report commands, observations, reproduction, evidence and limits. Create only essential temporary data/logs/reports within brief-authorized locations and lifetimes. Do not edit product source, tests, fixtures or configuration to pass checks, deploy or accept work. Persistent product-state checks need explicit scope and cleanup ownership. Return failures for Implementer correction and required QA recheck. Implementer and fresh QA handoffs include the exact approved visual source, version, approval and access state; criterion IDs, required properties and comparison method; and actual-output identity, revision and comparison basis. Record pass, mismatch or unverified with accessible evidence and limits. Implementer self-report does not replace fresh QA and its actual comparison. A missing output-to-revision link is unverified; record a visible difference separately as mismatch without inferring current branch UI state. Missing source/output, inaccessible evidence or unapproved interpretation holds the affected visual claim for Orchestrator. Do not silently substitute or redesign.
93
+ - [role.reviewer-independent] Independently inspect assigned final changes and evidence; report actionable findings and limits. Remain read-only. Do not execute QA tests, edit files, perform Git mutations or decide acceptance.
94
+ - [platform.codex] Role restrictions are prompt-level contracts, not a filesystem sandbox. ARC supplies no native observer hook or role-specific Git guard. Existing shell capabilities are retained because static read access after shell reduction has not been verified; Implementer and QA need shell for approved checks.
123
95
  [ARC role policy: contract end]
@@ -1,66 +1,44 @@
1
+ <a id="git-recovery-contract"></a>
1
2
  # Git recovery contract
2
3
 
3
- Read on branch collision, Git preparation failure, partial completion, metadata write denial, or handoff record write denial.
4
- Use [handoff-prep.md](handoff-prep.md) for approved branch selection, [handoff-worktree.md](handoff-worktree.md) for the
5
- managed worktree path, and [handoff.md](handoff.md) for the complete restart gate.
4
+ Read on branch collision, Git preparation failure/partial completion, metadata or handoff-record write denial. Use [handoff-prep](handoff-prep.md) for branch selection and [handoff](handoff.md) for full restart gates.
6
5
 
7
- ## Recovery cases
6
+ On actual Git/tool failure, partial completion, unexpected branch/HEAD, missing path or conflicting edit, stop dependent work. Record absolute path, branch or detached HEAD, HEAD, index, working-tree/untracked files, ownership and completed steps. Return the precise blocker/resolution to Orchestrator. Never automatically retry, fall back or repeat completed mutations.
8
7
 
9
- ### Git metadata write denial
8
+ Apply Preservation rule: preserve unrelated work/recovery artifacts. No automatic stash/reset/clean/unstage/discard/amend, branch/worktree deletion, lock removal, permission changes or sandbox bypass. Orchestrator obtains needed human decisions, resolves within authority, revalidates gates and supplies a delta restart brief. Explicit choice is required where applicable; silence, planning approval and refusal of another option do not count.
10
9
 
11
- If authorized staging, committing, branch creation, or switching is denied while writing `.git/index.lock` or other
12
- Git metadata, Orchestrator blocks handoff and safely inspects the exact command, workspace, error, failed path,
13
- actual Git directory, branch, HEAD, index state, and partial completion. Read-only inspection includes lock existence and any
14
- observable related processes, sandbox restrictions, OS permissions/ACLs, and concurrent Git activity. Record supported
15
- causes and remaining uncertainty; denial of lock creation alone does not prove a stale lock.
10
+ <a id="branch-collision-and-invalid-names"></a>
11
+ ## Branch collisions and invalid names
16
12
 
17
- Apply the Preservation rule: do not delete lock files, use `chmod` or `chown`, bypass the sandbox, or move to another
18
- workspace. If evidence confirms sandbox denial of an already authorized operation, request through the permission system only (not
19
- a sandbox bypass) the tool-supported minimum escalation for only the exact single Git command and workspace, never
20
- broad Git access. Before retrying, recheck branch, HEAD, index, and partial completion; do not repeat work already
21
- completed. After success verify the commit or branch result and final state, then reevaluate the entire handoff gate.
22
- Denied escalation or unresolved OS permission/ACL problems keep handoff blocked; report the reason and actual state to Orchestrator/user.
23
- Choosing the final message in advance prevents unnecessary amend but does not repair required Git write access; only successful
24
- authorized writes and verified results establish recovery.
13
+ Invalid names, creation/switch failures, lookup errors or unexpected branches require recorded errors/state and stopped handoff. Branch creation without switching is partial completion; report it without automatic deletion or success claims. No branch/checkout fallback. New collision suffixes need approval. Preserve staged/unstaged/untracked changes; blocked switching or unclear ownership waits for Orchestrator.
25
14
 
26
- ### Handoff record write denial
15
+ <a id="git-metadata-write-denial"></a>
16
+ ## Git metadata write denial
27
17
 
28
- If writing the canonical handoff record is denied or unavailable, stop that write, report the path and error to
29
- Orchestrator, and do not change permissions or bypass the sandbox. Use the inline-record fallback in
30
- [handoff.md](handoff.md).
18
+ 1. Denial of authorized stage/commit/branch creation/switch at `.git/index.lock` or other metadata blocks handoff.
19
+ 2. Inspect exact command/workspace/error/failed path, actual Git directory/branch/HEAD/index/partial completion read-only. Inspect lock existence, observable processes, sandbox limits, OS permissions/ACLs and concurrent Git activity. Record supported causes/uncertainty. Lock-creation denial alone proves no stale lock.
20
+ 3. Do not remove locks, `chmod`/`chown`, bypass sandbox or move workspaces. Only when evidence confirms that the sandbox denied an already authorized operation, request through the permission system only the supported minimum escalation for that exact single Git command and workspace, never broad Git access.
21
+ 4. Before authorized retry, recheck branch/HEAD/index/partial completion without repeating completed work. After success verify operation/final state and the entire handoff gate.
22
+ 5. Denied approval or unresolved OS/ACL issues keep handoff blocked; report actual state/cause. A finalized message avoids unnecessary amend but cannot repair write access. Only authorized successful writes plus verified results prove recovery.
31
23
 
32
- ### Existing changes and failures
24
+ <a id="handoff-record-write-denial"></a>
25
+ ## Handoff record write denial
33
26
 
34
- Unlike a worktree, a branch does not isolate uncommitted changes in a separate directory. Record how existing staged,
35
- unstaged, and untracked changes relate to the task and their preservation and edit ownership in the brief. Apply the
36
- Preservation rule and do not automatically commit or delete changes to prepare the checkout. Only the
37
- approved docs commit on all three paths is an exception to that no-commit rule; preserve all unrelated dirty files.
38
- If existing changes prevent switching or ownership is unclear, stop handoff until Orchestrator resolves the state and
39
- scope.
27
+ If canonical-record writing is denied/unavailable, stop it and report path/error. Never change permissions or bypass sandbox. Use [handoff](handoff.md)'s inline fallback.
40
28
 
41
- For an invalid name, branch creation or switching failure, lookup error, or unexpected current branch, inspect and
42
- record the error and actual Git state, then stop Implementer handoff. A branch created without a successful switch is partial
43
- completion: report it, do not automatically delete it, and do not treat preparation as complete. Do not automatically fall back to the current checkout path after an operational failure. Both operational failure and missing
44
- execution-target choice block handoff. Orchestrator resolves the problem and rechecks preparation before handoff.
29
+ <a id="recovery-cases"></a>
30
+ ## Recovery cases
45
31
 
32
+ <a id="existing-changes-and-failures"></a>
33
+ ### Existing changes and failures
46
34
 
35
+ A branch does not isolate uncommitted changes in another directory. Record task relationship/preservation/ownership in the brief. Never automatically commit/delete changes to prepare. Approved docs commits on the three paths are the sole exception; preserve unrelated dirty files. Switching blocks or unclear ownership hold handoff until resolution. Both operational failure and missing target choice block handoff.
36
+
37
+ <a id="worktree-failures-and-partial-completion"></a>
47
38
  ### Worktree failures and partial completion
48
39
 
49
- Worktree creation, registration, attachment, identity/base verification, checkout, document transfer, staging,
50
- or commit failure means stop dependent work and Implementer handoff. Partial completion includes branch-only creation, partial
51
- path creation, registration/actual-path mismatch, wrong base or branch, and partial document transfer. Record source and
52
- target exact command, error, branch, HEAD, Git common directory, registration, index and files, including target dirty
53
- state and source preservation. Before any authorized retry, inspect actual state and completed work under the Stop and
54
- inspect rule; do not repeat completed actions.
55
- Do not automatically fallback, retry another path/branch, delete paths, prune registrations with `git worktree prune`,
56
- or use `--force` or `-B`; apply the Preservation rule.
57
- Normal worktree preparation after explicit managed-worktree selection is permitted under handoff; moving to an arbitrary
58
- workspace during recovery remains prohibited. Resolve preparation and revalidate the full gate; a new explicit choice
59
- follows Choice lifetime and restart record in handoff.md. No automatic cleanup/archive is authorized.
60
-
61
- For managed worktree failures record tool inputs, operationId, result/error, returned actual path, app-managed
62
- registration and current-chat attachment, initial/final branch, base/ref SHA, source/target HEAD/index/files and
63
- ownership.
64
- The completion, attach-retry and no-fallback limits of New managed worktree in handoff-worktree.md apply; after an
65
- attach retry check completion and current-chat attachment again; if it still fails or results cannot be verified, stop
66
- and report actual state. A directory alone does not prove app management.
40
+ [Managed-worktree](handoff-worktree.md) creation/registration/attachment/identity/base/checkout/transfer/stage/commit failures stop dependent work/handoff. Branch-only or partial-path creation, registration/path mismatch, wrong base/branch and partial transfer count as partial completion.
41
+
42
+ Record source/target commands/errors/branch/HEAD/common directory/registration/index/files, target dirty state and source preservation. Include tool inputs/operationId/results/returned path, app management/current-chat attachment, initial/final branch, base/ref SHA and ownership. Inspect actual state/completed work before authorized retry.
43
+
44
+ No automatic alternate path/branch, deletion, `git worktree prune`, `--force`/`-B`, cleanup or archive. Normal preparation after explicit managed selection is allowed; arbitrary recovery workspace moves are not. Resolve and revalidate the full gate; renewed choice follows handoff lifetime rules. Preserve completion/attach-retry/no-fallback limits. Recheck completion/current-chat attachment after attach retry; failure or unverifiable results stop with actual-state reporting. Directory existence does not prove app management.