@yunhozz/arc 0.4.1 → 0.4.3

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 (68) hide show
  1. package/MANIFEST.sha256 +66 -42
  2. package/README.md +6 -6
  3. package/claude/skill/references/coordination.md +1 -1
  4. package/codex/skill/references/coordination.md +1 -1
  5. package/gemini/skill/references/coordination.md +1 -1
  6. package/grok/AGENTS.md +8 -0
  7. package/grok/agents/arc-implementer.md +37 -0
  8. package/grok/agents/arc-planner.md +47 -0
  9. package/grok/agents/arc-qa.md +37 -0
  10. package/grok/agents/arc-reviewer.md +39 -0
  11. package/grok/agents/arc-scouter.md +38 -0
  12. package/grok/instructions.md +4 -0
  13. package/grok/skill/SKILL.md +78 -0
  14. package/grok/skill/models.toml +23 -0
  15. package/grok/skill/references/arc-visual-companion.md +28 -0
  16. package/grok/skill/references/commit.md +55 -0
  17. package/grok/skill/references/coordination.md +149 -0
  18. package/grok/skill/references/git-recovery.md +34 -0
  19. package/grok/skill/references/handoff-prep.md +110 -0
  20. package/grok/skill/references/handoff.md +227 -0
  21. package/grok/skill/references/limits.md +31 -0
  22. package/grok/skill/references/planning.md +168 -0
  23. package/grok/skill/references/verification.md +155 -0
  24. package/grok/skill/references/worktree-creation.md +8 -0
  25. package/lib/installer/grok-compat.mjs +107 -0
  26. package/lib/installer/plan.mjs +7 -3
  27. package/lib/installer/runtime-assets.mjs +1 -0
  28. package/lib/installer/uninstall.mjs +14 -1
  29. package/lib/installer/upgrade-state.mjs +4 -2
  30. package/lib/installer/upgrade.mjs +5 -0
  31. package/lib/management/operations.mjs +1 -1
  32. package/lib/management/status.mjs +4 -2
  33. package/lib/management/update.mjs +4 -4
  34. package/lib/models/codex-models.json +72 -0
  35. package/lib/models/grok-models.json +7 -0
  36. package/lib/platforms/formats/grok-markdown.mjs +49 -0
  37. package/lib/platforms/grok.mjs +14 -0
  38. package/lib/platforms/index.mjs +2 -1
  39. package/lib/policy/role-policy.json +34 -15
  40. package/lib/prompts/agent-fragments.json +70 -0
  41. package/lib/prompts/render.mjs +6 -1
  42. package/lib/runtime/bootstrap.mjs +1 -1
  43. package/lib/runtime/grok-stream.mjs +46 -0
  44. package/lib/runtime/platform-registry.mjs +21 -0
  45. package/lib/runtime/role-bridge-args.mjs +40 -0
  46. package/lib/runtime/role-bridge.mjs +1 -1
  47. package/lib/runtime/role-dispatch-policy.mjs +4 -2
  48. package/lib/runtime/role-routing.mjs +2 -1
  49. package/lib/runtime/role-supervisor.mjs +57 -13
  50. package/lib/tui/app.mjs +18 -11
  51. package/lib/tui/custom-preset.mjs +6 -4
  52. package/lib/tui/mode.mjs +26 -3
  53. package/lib/tui/render.mjs +19 -8
  54. package/lib/tui/setup.mjs +5 -5
  55. package/lib/tui/terminal.mjs +1 -1
  56. package/lib/watch/status-line.mjs +10 -2
  57. package/package.json +2 -1
  58. package/scripts/update-manifest.mjs +2 -2
  59. package/shared/skill/references/superpowers-provenance.json +1 -1
  60. package/shared/skill/runtime/bootstrap.mjs +1 -1
  61. package/shared/skill/runtime/grok-stream.mjs +46 -0
  62. package/shared/skill/runtime/platform-registry.mjs +21 -0
  63. package/shared/skill/runtime/role-bridge-args.mjs +40 -0
  64. package/shared/skill/runtime/role-bridge.mjs +1 -1
  65. package/shared/skill/runtime/role-dispatch-policy.mjs +4 -2
  66. package/shared/skill/runtime/role-policy.json +34 -15
  67. package/shared/skill/runtime/role-routing.mjs +2 -1
  68. package/shared/skill/runtime/role-supervisor.mjs +57 -13
@@ -0,0 +1,168 @@
1
+ <a id="planning-and-approval"></a>
2
+ # Planning and approval
3
+
4
+ <a id="authorization-and-scope"></a>
5
+ ## Authorization and scope
6
+
7
+ Use the [fast gate and envelope](handoff.md#orchestrator-direct-path-for-small-tasks) alongside these existing scope and approval rules; reuse valid approvals and hold changed scope under these rules.
8
+
9
+ An explicit execution request authorizes only sufficiently specified scope from that request or a description the user explicitly references. Confirm intent/outcome/constraints/document depth/verification risk and no unresolved material behavior/method/risk decision. Record approval evidence, scope, criteria, constraints and depth. Orchestrator MAY choose routine execution/check details, not unapproved product behavior/material scope. Restating/handoff/restart of unchanged scope needs no new approval.
10
+
11
+ Silence, ambiguous assent, other-work approval and vague blanket improvements are insufficient. Planner's new material choices are not automatically approved. Request missing decisions through Orchestrator. Required specs/plans retain separate ordered approval.
12
+
13
+ Hold affected work for material changes to scope, method or risk, and report the missing decision, evidence and remaining scope. Target change, unclear ownership, unexpected state, unresolved failure or missing inputs also hold under [handoff](handoff.md)/[recovery](git-recovery.md). Distinguish new authorization from existing-scope execution issues; routine correction/reverification needs no duplicate approval. Revalidate after resolution.
14
+
15
+ <a id="probe-scope"></a>
16
+ ### Probe scope
17
+
18
+ Probe-only work ends with approved-question findings/evidence/limits/uncertainty, including well-supported infeasibility. It authorizes neither product retention nor subsequent implementation. Record question/method/scope/criteria/constraints; a specific request may approve them. Match checks to purpose/risk, not product-proof claims.
19
+
20
+ If explicitly requested probe+implementation is fully specified, classify the whole scope. Under Bounded conditions, probing is internal with no new report-time approval boundary. Unknown implementation is not blanket authorization. Materially changed scope/method/risk or new decisions hold implementation for reassessment and required design/spec/plan approvals. Probe-only remains separate.
21
+
22
+ <a id="formal-drafting-boundary"></a>
23
+ ## Formal drafting boundary
24
+
25
+ Initial design/brainstorming MAY precede target choice. Before the first required spec/plan draft, record verified source workspace/repository, branch/HEAD, changes/ownership, explicit choice, approved scope/depth/document set and planned relative paths. Planner returns the complete first draft and self-review in chat before target preparation. Revalidate source and selected target at the focused preparation gate, prepare the chosen target, compare actual target and preservation, then review and save in the verified prepared target. Planned paths prove no preparation. Missing or mismatched evidence holds affected work; preparation alone never starts Implementer.
26
+
27
+ Small-task direct edits follow only [handoff](handoff.md#orchestrator-direct-path-for-small-tasks), stopping/reclassifying changed scope/risk. Otherwise follow this reference. `brainstorming`/`writing-plans` instruct existing roles, not extra agents; ARC routing/approval overrides alternate executors. Missing required skills block their stage. Integration includes saving, reviewing and directly revising the same spec or plan after the complete Planner first draft; design/brainstorming retain their Planner drafting path.
28
+
29
+ For Korean requests and briefs, Planner uses Korean titles and prose unless another language is requested, preserving identifiers, skill/API names, code, paths, commands and literals. Orchestrator preserves agreed language when saving.
30
+
31
+ <a id="planner-drafting-preparation-and-consolidated-feedback"></a>
32
+ ## Planner drafting preparation and consolidated feedback
33
+
34
+ Planner reports initial/revision progress only to Orchestrator: brief stage/feedback/blocker/next step, never body/excerpts/incremental drafts. Return complete draft/self-review. Raw responses may appear in app/tool surfaces; prompt policy cannot hide them. User updates stay brief/status-based without draft content. At approval present integrated/saved/reviewed Markdown without repeating its body in chat.
35
+
36
+ Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Orchestrator can read a few already identified files directly; route material research and broad static exploration to Scouter.
37
+
38
+ 1. Preflight relevant policy/references/profiles/tests/parity/manifest/conflicts. Apply formal-target and coordination provenance/input/local-skill gates, including required paths, approved bounded read alternatives and return conditions. Missing inputs/conflicts hold drafting. Read recovery grants no preparation/check/write/approval authority.
39
+ 2. Maintain a compact ledger of original requirements/IDs, approved/open decisions, exclusions and scope deltas. Consolidate intervening user changes into one brief delta. Separate approvals, path/line-verified facts, assumptions and open decisions.
40
+ 3. NEVER reuse a Planner instance across stages. Within the design/brainstorming stage, reuse one Planner instance for the initial draft, its consolidated correction and any eligible further call while role, context and source remain valid; within a spec or plan stage, reuse that stage's Planner only for a budget-hold delta. After design approval, the spec stage and the plan stage each use a fresh Planner; its initial brief contains every required field plus saved document paths and approved versions, and cites a prior brief only when that brief is an accessible file. Send one complete stage-specific initial brief. Include verified source/HEAD/ownership, selected target intent and planned paths (or prepared target for later stages), and scope/exclusions/depth/dependencies/shared contracts/criteria/checks/evidence/holds. Include preceding approved versions and paths, current behavior and connected source/generated/runtime/installer/docs, policy conflicts/resolution direction and exact deliverable. Visual work includes approved sources/versions/criteria/open interpretations. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields; inaccessible conversations or hashes alone cannot replace required inputs. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose, approval scope and accessible context. When source, target or scope changed, reconfirm affected inputs.
41
+ 4. Planner returns the complete proportional first draft and self-review. Bounded plan density follows the Planner profile's ARC adaptation (per task ID/title, goal/scope/files, predecessors, criteria and required checks; short self-review checklist), while Architectural plans keep full writing-plans.md density. Briefs carry the Read/Grep exploration budget and MAY set a handback size limit. A return that stops at the exploration budget with a Scouter request is an input hold, not a missing or failed first draft; resend the stage brief as a delta with the Scouter evidence to the same stage Planner. In the design stage, a resend after a return without a draft uses the consolidated-correction opportunity. Orchestrator saves and reviews it against the fixed checklist: scope/evidence; targets/ownership/paths; policy/conflicts; task boundaries/dependencies/criteria; checks/evidence/holds; roles/approval/commit boundaries; completeness. For spec or plan, Orchestrator directly revises the same document, including substantive omissions, before requesting approval. New product decisions outside approved scope require user input first; Orchestrator then revises the document. Missing or failed first drafts stop the stage and do not transfer initial authorship.
42
+ 5. For design and brainstorming, finish the checklist before one consolidated correction covering every substantive omission with criterion/defect/evidence/expected fix. Use deltas/`unchanged`; NEVER split by omission. Further calls after correction need approved material scope/evidence changes or concrete unmet checklist items plus meaningful new input/criterion progress. State changed input/target criterion/expected artifact/progress. Existing-scope omissions need no renewed scope approval. Repeated unmet criteria without new input/evidence/progress hold the stage; report criterion/observation/exact unblock decision. DO NOT repeat resolved questions or count rewording/agent replacement as progress.
43
+
44
+ For design and brainstorming, allow initial draft and one consolidated correction. Orchestrator handles reformatting, re-expression, save and patch errors without Planner calls. Separate substantive work uses normal gates. Design/spec/plan stages remain separately ordered; spec approval precedes dependent planning. Add no fixed call cap/profile count condition or incomplete-draft acceptance.
45
+
46
+ <a id="design-and-planning"></a>
47
+ <a id="design-path-and-plan-depth"></a>
48
+ ## Design path and plan depth
49
+
50
+ Record depth separately from risk. Risk controls checks/review, not design paths/plan approval. Bounded/omission is not low risk; Architectural adds no QA/Reviewer at every stage. Apply risk rules and specific obligations.
51
+
52
+ 1. Before feature/design/behavior work, assign brief/evidence/local `brainstorming` to Planner. Planner proposes context/path/options/tradeoffs/criteria/assumptions/questions; Orchestrator selects path, integrates, announces scope, routes revisions and obtains approval. NEVER run drafting skills itself. Direct path uses scope record only.
53
+ 2. Spike distinguishes probe-only from specific combined scope. Bounded approves short design before Implementer; direct edits use approved scope record. Architectural approves design, then complete Planner spec/self-review, Orchestrator save/review and written-spec approval before planning. Planner is read-only and requests no approval.
54
+ 3. Assess plan depth after design/spec approval and before Implementer, separately from files/LOC/Bounded label. Architectural always uses `writing-plans` and written-plan approval regardless of size/locality/risk. Bounded skips only for one local change, no dependent stages/cross-component shared state/lifecycle/integration-order concerns and one verification path. Otherwise require a plan. Labels/no-plan requests do not bypass judgment, which also records Bounded spec necessity.
55
+ 4. Record dependencies/depth reasons; also post the design path, depth and risk judgments in the SKILL.md Pre-action gate record. Planner returns complete plan/assumptions/open decisions/checks/self-review. Orchestrator saves/reviews/obtains approval before Implementer at user path or `docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md`. Default spec path is `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`.
56
+ 5. Every Implementer first start/restart needs applicable approvals/artifacts/brief/findings and full handoff. Non-behavior docs/config omit only inapplicable stages. Direct edits need approved scope record and same first-edit gates.
57
+
58
+ If Bounded requires written spec, record necessity/scope using approved short design as basis. Planner returns proportional full spec/self-review; After actual preparation, Orchestrator saves/reviews/obtains individual approval in the prepared target before the dependent plan. Short design approval never substitutes. This applies recorded judgment, not new spec necessity. Required plans alone imply no written spec.
59
+
60
+ Only Planner authors the first complete spec or plan draft and self-review. Orchestrator reviews and directly revises the same document before approval. Unavailable/failed Planner stops first drafting rather than transferring authorship. Design approval does not transfer initial authorship.
61
+
62
+ For initial fast judgment apply the [fast gate](handoff.md#orchestrator-direct-path-for-small-tasks); its sufficient conditions do not change these depth decisions.
63
+
64
+ <a id="top-level-plan-tasks"></a>
65
+ ## Top-level plan tasks
66
+
67
+ Apply Planner rules: ID/title, goal/scope/files, predecessors/dependencies, criteria, required pre-acceptance QA/checks/evidence and holds. Tasks MUST be independently implementable/verifiable/acceptable. Inseparable policy/profile/tests/manifest contracts start in one task. If inseparability appears later, stop for revised scope/planning/approvals; NEVER merge distinct approved tasks during execution.
68
+
69
+ Substeps/checkboxes/RED-GREEN/commands are not commits. One top-level task becomes one focused commit after acceptance; [commit](commit.md) governs no-change/hold/resume. Reviewer is never a per-task check. Final whole verification has separate scope/timing; significant work lists one Reviewer after all task acceptances/risk checks. Task boundaries alone add no QA. Apply only to required plans; omission paths gain no plan obligation.
70
+
71
+ <a id="dependency-and-readiness-record"></a>
72
+ ## Dependency and readiness record
73
+
74
+ After approval and before first assignment, canonically link every task ID to plan version. Record explicit/implicit predecessors, inputs/outputs/shared contracts, files/conflicting resources, check/QA paths, ready/held/reasons, initial ready batch and capacity/serialization reasons. Analyze shared APIs/contracts/generated artifacts/resources even across files. Unsettled contracts/incomplete dependencies block affected tasks; same-file concurrent Implementers are forbidden even on different lines. File separation/list order proves no independence.
75
+
76
+ Ready requires approvals/preparation, settled inputs/contracts, predecessor checks/Orchestrator acceptance/verified commits or accepted no-change, nonconflicting ownership/resources, available checks/QA and slots under both full-tree ARC and lower actual runtime limits. Read [limits](limits.md); report runtime constraints without claiming capability. Start ready independent tasks concurrently with fresh Implementers within capacity. Record holds/serialization rather than silently following order. Preserve risk/QA/Reviewer/target gates.
77
+
78
+ Update on reports/checks/acceptance/commit/slot return/conflicts. Completion alone releases no dependent. Immediately reassess newly ready tasks without waiting for unrelated batches. Failed/uncertain predecessors hold only their chains. Refresh handoff each dispatch; shared Git follows commit rules. This map cannot rewrite approved boundaries or waive approval.
79
+
80
+ Example: with A → B → C, independent D and two slots, start A/D. After A's checks/acceptance/verified commit, B may start while D continues. A failure holds B/C, not unaffected D.
81
+
82
+ <a id="document-save-evidence-gates"></a>
83
+ ## Document-save evidence gates
84
+
85
+ Before first Architectural spec, required Bounded spec or plan save, read this and record accessible brief/canonical evidence. Saving creates reviewable files, not approval/commits.
86
+
87
+ | Save | Required evidence |
88
+ |---|---|
89
+ | Spec | Approved design scope/evidence, complete Planner draft/self-review, Orchestrator integration/save/review ownership and absolute path. Required Bounded specs also need depth judgment, short design, necessity/scope |
90
+ | Plan | Approved design and required approved spec/version/evidence, depth judgment, plan list/dependencies, complete Planner draft/self-review, ownership and absolute path |
91
+
92
+ Saving for review does not require prior written-spec approval, but does require valid target choice/actual preparation. Individually approved specs enter the document set before dependent planning. NEVER call uncommitted files committed. Missing or mismatched evidence stops the affected save.
93
+
94
+ <a id="complete-planning-document-set"></a>
95
+ ## Complete planning-document set
96
+
97
+ Include all current-scope required specs/plans, excluding future projects. Record scope/depth/absolute paths/coverage/versions/status/dependencies/order/omissions/reasons/pending drafting and approvals. Complete means every required document written/individually approved and no unresolved decision requiring another document. Omit no required artifact.
98
+
99
+ A required plan implies no spec. Bounded follows recorded judgment; spec stages cover Architectural/required Bounded only, plan stages required plans only. Add no spec duty to Spike/plan-skip/non-behavior paths.
100
+
101
+ Order: initial design approval → explicit target and source snapshot → first required draft/self-review → focused preparation gate → actual preparation/comparison → save/review/individual approval → dependent plans drafting/save/review/individual approval → full set → verify existing commits/batch remaining approvals → final Git → Implementer. Omission skips only inapplicable documents with rationale. Complete documents precede staging/commit/handoff, not initial preparation/choice request. Partial approvals authorize no early implementation.
102
+
103
+ Defer local `brainstorming`'s early spec commit: save/self-review/approve uncommitted spec, approve all plans, then final batch. Modify no external skill. `writing-plans` implementation commits grant neither planning-document commits nor early Implementer.
104
+
105
+ | Path | Approval/preparation |
106
+ |---|---|
107
+ | Spike | Approve question/method/scope/criteria/constraints; no forced unknown-implementation docs. Implementer probes require handoff; read-only Orchestrator/Planner probes without Implementer do not trigger it |
108
+ | Bounded, plan skipped | Approve short design; record omission conditions. Complete approvals, target choice, actual docs or valid absence, then handoff |
109
+ | Bounded, plan required | Approve design/all required plans; approve necessary specs before dependent planning. Draft the first required document before target preparation; complete set before batch/handoff |
110
+ | Architectural | Design → written spec → all `writing-plans` plans. First spec draft before target preparation; full set before batch/final checks/handoff |
111
+ | Non-behavior docs/config | Record scope/criteria/inapplicability. Preserve target/Git/docs-or-absence/handoff |
112
+
113
+ New planning scope requires list/depth/dependency reassessment and approvals before dependent drafting/commit. Approved-body changes need revised approval except task progress records below. New implementation scope holds execution until docs/approvals/preparation complete. Running Implementer stops before newly dependent edits; inspect actual changes/Git without retrospective preparation claims. Reflect approved versions through pending revisions below. Unchanged-document restarts follow handoff lifetime.
114
+
115
+ <a id="plan-updates-during-execution"></a>
116
+ ## Plan updates during execution
117
+
118
+ Task progress records (checkboxes, notes, results, evidence and completion status) preserving the approved contract need no new approval; record classification/reason/actual time. After task completion Orchestrator includes that task's own records with its accepted implementation work in the same focused commit, excluding other tasks. DO NOT amend the original planning commit or create a separate docs/fixup commit for those records. Accepted no-change tasks follow the no-change path without empty commits. Removing checks, invented success, unsupported acceptance or mixed scope changes are not progress records.
119
+
120
+ Changes to goals, task boundaries, scope, criteria, method, risk, dependencies or checks require revised approval before affected work. Hold, obtain ordered design/spec/plan approvals and prepare target/ownership/checks/handoff. Other body corrections follow version approval; classify typos/paths/commands/explanations by semantic effect. Every non-progress content change, including a mechanical correction, is a plan revision requiring applicable approval/preparation. A contract revision requires a fresh Implementer for remaining work; obtain written-spec approval before a dependent plan revision.
121
+
122
+ After approval Orchestrator edits the same file, appends a revision-history row and leaves the revision uncommitted. Apply cumulative revisions to that file and append another row. At document end use `Version | Approval time | Classification | Affected tasks | Reason`; keep rows append-only, with no SHA. Add v1 at the first revision using the actual initial approval time. Preserve actual approval chronology, not retroactive authorization; later committed content proves no earlier approval.
123
+
124
+ Keep all approved spec/plan revisions pending for the accepted commit of the first top-level task executed or reconfirmed against the revised version. Otherwise include them in a current task acceptance or final Reviewer follow-up commit. Only when no implementation work remains before overall completion MAY Orchestrator make one standalone `docs(plan)` closing commit: record that evidence canonically, include all pending revisions/trailers and no implementation files. No separate docs/fixup commit is allowed outside this sole closing exception. Overall completion requires no pending revisions. Exclude revision hunks from independent tasks accepted on a prior version; hold that commit if safe separation is impossible.
125
+
126
+ NEVER amend planning or implementation commits, reset, replay or rewrite their history. Preserve canonical pending revisions, approved content copies, versions/hashes, approval references/actual times, classification/reason, affected tasks and hold/preparation/resume evidence under [preparation](handoff-prep.md#execution-time-plan-revision). NEVER overwrite old approvals/content. Follow [commit](commit.md#execution-time-plan-document-updates) and [verification](verification.md#evidence-after-plan-revision-commit). Add no Git automation/runtime enforcement/authority/check exemptions.
127
+
128
+ <a id="evidence-refresh-and-limits"></a>
129
+ ## Evidence refresh and limits
130
+
131
+ Missing/mismatched evidence, unfinished approvals, unclear ownership or unresolved failures block affected save/choice request/Git mutation/handoff. Resolve/reverify before resume and on changed scope/version/path/target/Git state. Preserve unrelated changes; read-only investigation remains allowed.
132
+
133
+ NEVER retroactively call early saves/commits compliant or approved. Record actual order/gaps. Structure proves authored contracts only; absent role/approval/save/Git execution records leave runtime compliance unverified. Add no runtime infrastructure or external-skill changes for checks. Only the narrow cooperative exception below applies.
134
+
135
+ <a id="local-planning-references"></a>
136
+ ## Local planning references
137
+
138
+ Brief absolute installed `references/brainstorming.md`/`references/writing-plans.md`. Planner reads directly, resolving relatives from installed `references/`. Missing paths stop the stage without global fallback. Preserve ARC approval/ownership.
139
+
140
+ <a id="instruction-and-input-provenance"></a>
141
+ ## Instruction and input provenance
142
+
143
+ Supply exact skill/reference paths/access state. Separate user instructions/discovered files, approved versions/open questions. Visual criteria link approved source/version/access/IDs/method. Missing inputs/unapproved interpretation hold dependent drafting. Optional alternatives follow [handoff](handoff.md#instruction-sources-bounded-read-recovery-visual-evidence-and-resumption). Planner stays draft-only in recovery.
144
+
145
+ <a id="managed-worktree-preparation"></a>
146
+ ### Managed worktree preparation
147
+
148
+ Follow [handoff-worktree](handoff-worktree.md).
149
+
150
+ [ARC role policy: contract begin]
151
+ Generated from lib/policy/role-policy.json; do not edit this managed section manually.
152
+ - [git.orchestrator-accept-commit] Only Orchestrator accepts work and performs Git mutations. One approved top-level plan task becomes one focused implementation commit after criteria, required checks and findings are satisfied. Orchestrator accepts, then includes that task's own progress records made after task completion (checkboxes, notes, results, evidence and status) with its implementation work in that commit, without a separate docs/fixup commit or planning-commit amendment for those records. Exclude other tasks; pending approved spec/plan revisions follow planning.plan-revision and preserve the no-change path without empty commits. Orchestrator commits without separate user commit approval. Reports, passing checks and Reviewer opinions do not replace acceptance. Preserve unrelated changes and ownership; verify the resulting SHA, content, HEAD and remaining changes. Existing small-task direct and plan-omission paths remain unchanged.
153
+ - [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
154
+ - [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. 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 gate. Preserve required checks and necessary finding rechecks.
155
+ - [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
156
+ - [planning.plan-revision] Task progress records (checkboxes, notes, results, evidence and status) preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit and records classification, reason and actual time as applicable. All other spec/plan content changes, contract or mechanical, require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval, preparation and holds on affected work before it continues, with a fresh Implementer for remaining work. After approval Orchestrator edits the same document, appends a revision-history row and leaves it uncommitted as an Orchestrator-owned pending revision, recording version, content hash, approval reference, actual time, classification, reason, affected tasks and the full approved content in the canonical handoff record. Orchestrator includes all pending revisions with Plan-Revision, Plan-Approved-At and Plan-Reason trailers in the accepted commit of the first top-level task executed or reconfirmed against the revised version, otherwise in a current task or final Reviewer follow-up commit; only when no implementation work remains before overall completion MAY it make one standalone docs(plan) closing commit without implementation files. Exclude revision hunks from commits of independent tasks accepted on a prior version, or hold that commit when separation is unsafe. NEVER amend or rewrite planning or implementation commits, create any other docs/fixup commit or authorize past work retroactively. After commit verify the committed document content matches the latest approved content apart from classified progress records of that commit's task or committed for other tasks after approval, and that no pending revision remains. Follow planning, handoff-prep, commit and verification for the full contract.
157
+ - [planning.planner-brief] Follow planning.md's Planner drafting preparation and review procedure, including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before Planner dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Planner instance only within the design/brainstorming stage while its role, context and source remain valid; after design approval, use a fresh Planner instance for each spec and plan stage, whose initial brief contains every required field, saved document paths and approved versions. Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. When source, target or scope changed, reconfirm affected inputs. Planner returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, allow the initial draft and one consolidated correction. Orchestrator reviews once with the fixed checklist and sends one consolidated correction using changed fields only. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. DO NOT split omissions, repeat resolved items or count rewording/agent replacement as progress. DO NOT invoke Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal Planner gate. Preserve separate sequential design/spec/plan approvals. Add no fixed call cap or profile call-count conditions, and NEVER accept an incomplete draft. Keep user progress brief and based on Planner status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.
158
+ - [platform.grok] Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified.
159
+ [ARC role policy: contract end]
160
+
161
+ <a id="approved-cooperative-execution-path-within-the-repository"></a>
162
+ ## Approved cooperative execution path within the repository
163
+
164
+ Installed workflow connects plan-mode document commits to initial Implementer assignment. Resolve `<target-home>/skills/arc/runtime/cli.mjs` from the actual loaded skill selected by the installer, including custom homes. Pass path/options as separate `node` arguments. Shell uses safely assigned/quoted `node "$ARC_RUNTIME_ENTRY" <command> --cwd "$ARC_CHECKOUT" --workflow "$ARC_WORKFLOW_ID" --input -`. Follow [handoff](handoff.md) invocation/continuity.
165
+
166
+ Entry updates migrate no state/renew no approvals; drift requires current evidence. Scope is repository cooperative decisions/records, not native hook/provider/installer installation or blocking direct tools. `no-plan`/omission stays unsupported through Phases 2/3, implying neither policy violation nor new document duty.
167
+
168
+ Record approved spec/plan SHA-256, shared docs-only commit and document/approval versions. CLI verifies exact Git-object paths/current bytes before assignment intent. New workflows/late commits prove no past compliance. Prior history/outside execution stays unverified. Approval/native results are `operator-attested`; agent IDs are not authenticated identity.
@@ -0,0 +1,155 @@
1
+ <a id="verification-and-acceptance"></a>
2
+ # Verification and acceptance
3
+
4
+ Behavior work follows meaningful failing test observation → minimal implementation → focused success → project suite. Report skill/test constraints before edits. Waivers need recorded narrow/understood/reversible scope, no dependent/cross-component lifecycle stages and one check path. Docs exceptions permit named structural checks only, never TDD claims. Report side effects within scope. Reviewer lacks Bash and requests runtime checks. Local tests prove neither remote models nor effort application. Policy prose needs independent role/approval review; text presence proves no compliance. Unexpected failure triggers diagnosis/holds; expected RED grants no unrelated repairs.
5
+
6
+ Read before verification design, QA/Reviewer assignment, correction rechecks or UI acceptance. QA/Reviewer use their profiles and brief-cited sections only. Design companions differ from UI acceptance.
7
+
8
+ **Evidence verdict:** Criteria are proven, unmet or unverified. Passing runs/reports/dispositions never convert unverified to proven; retain gaps.
9
+
10
+ <a id="visual-evidence-and-adjudication"></a>
11
+ ## Visual evidence and adjudication
12
+
13
+ Each criterion needs the exact approved source, version, approval and access state; IDs, properties and comparison method; and a link between output and revision. Implementer reporting does not replace fresh QA. Record pass/mismatch/unverified and connect to criterion verdicts; pass needs accessible supporting evidence. Missing linkage is unverified; visible difference is mismatch, separately, without inferring current branch UI. Hold comparison when materials are inaccessible or interpretation approval is missing.
14
+
15
+ Policy, generated-file and manifest checks prove structure, not role behavior, installed builds, Grok CLI compliance or fidelity. Report changes, exclusions, checks run and omitted, criterion evidence and limits, and platform availability. Report baseline failures separately; independent progress does not relax checks.
16
+
17
+ <a id="risk-scaled-execution"></a>
18
+ ## Risk-scaled execution
19
+
20
+ The [fast gate](handoff.md#orchestrator-direct-path-for-small-tasks) references this risk definition; refresh affected evidence when inputs change and preserve independent verification boundaries.
21
+
22
+ Edits belong to Implementer except the [small direct path](handoff.md#orchestrator-direct-path-for-small-tasks). Orchestrator determines behavior, risk and minimum meaningful checks.
23
+
24
+ | Risk | Minimum flow |
25
+ |---|---|
26
+ | Small, low risk | Implementer or direct edit → Orchestrator focused checks → acceptance |
27
+ | Ordinary behavior | Implementer → independent QA → acceptance |
28
+ | Significant/high risk, no plan | Implementer → QA/rechecks → final full-change Reviewer → acceptance |
29
+ | Significant/high risk, plan | Per task Implementer → required fresh QA → acceptance/commit; final independent whole-change Reviewer once after all accepted tasks/required checks/rechecks |
30
+
31
+ Ordinary/significant tasks need fresh QA before acceptance. Low risk requires narrow/understood/reversible/focused-verifiable work. Ordinary behavior fails these without significant triggers. Shared role/behavior contracts/state, lifecycle/integration order, security/permissions, data loss/migration, public interfaces and costly install/deploy/rollback are significant. Substantial behavior/contracts are significant regardless of file count. Unclear risk requires investigation/higher flow. Environment failure waives no check or depth judgment.
32
+
33
+ - Task boundaries alone add no QA/review. Reviewer is never a plan-task/commit prerequisite. Plans review once at final relevant state after task acceptances/checks; no-plan Reviewer follows QA before acceptance.
34
+ - Preserve specific commitments. Risky unverified dependencies need QA/resolved or explicitly dispositioned findings before implementation.
35
+ - Reuse evidence only for matching scope/state/independence/freshness/flow position. Changes/failures/missing-conflicting evidence invalidate affected reuse.
36
+ - QA independently checks without edits. Reviewer performs no QA/planning/editing/delegation/completion decisions. Orchestrator routes fixes to Implementer and required QA rechecks; direct-check failures return to normal flow. Accept after findings/gaps resolved or dispositioned.
37
+ - Fresh-per-task applies to Implementer/QA, not Reviewer. Reuse Reviewer only with independence, valid context and refreshed scope/target/evidence, never an old verdict or waived timing/coverage.
38
+
39
+ Record which risk/instruction/approved obligations each check satisfies. DO NOT automatically assign QA/Reviewer for clear low-risk scope with sufficient evidence and no requirement. Metadata counts alone prove no significance; one permission/loss rule may. Vague file deletion is not low-risk evidence; reclassify installer/manifest impacts. Confirm cleanup targets unused, required materials intact, ignore patterns scoped and diff approved before focused-check-only acceptance.
40
+
41
+ Distinguish environment failures from code failures and report exact limits and gaps. Use Planner/Scouter only for unresolved planning/discovery. Reviewer covers substantial correctness/factual/security/data/interface risks. Orchestrator assigns support as needed. Claim only verified outputs. Read cited `references/test-driven-development.md`, preserving exceptions.
42
+
43
+ <a id="final-plan-reviewer-correction-loop"></a>
44
+ ### Final plan Reviewer correction loop
45
+
46
+ Only final overall Reviewer findings on plan work, including behavior, follow Implementer → Reviewer without QA reassignment until resolved. One initial full review permits necessary rechecks. Before it, risk checks/QA failures/unmet criteria still need Implementer → QA. No-plan flow remains unchanged.
47
+
48
+ Expanded scope/separate obligations/gaps hold affected work for resolution/approval. Orchestrator assigns/accepts; Reviewer stays read-only without QA/acceptance. NEVER present old QA as post-fix execution. Report actual actor/target/check/result/limits only.
49
+
50
+ <a id="evidence-after-plan-revision-commit"></a>
51
+ ## Evidence after plan revision commit
52
+
53
+ Verify every committed document blob against its latest approved content hash and full approved copy. If no progress records have been committed since approval, the SHA-256 of the committed document content (not the Git blob OID) MUST equal the latest approved `contentHash`. Otherwise the diff from the latest approved copy MUST contain only classified progress records belonging to that commit's task or committed for other tasks after approval (including R-8 separation). Record the SHA-256 of the expected content used for this comparison in the canonical record; NEVER overwrite approved copies. Verify each pending revision's status is `committed` and no pending revision remains before overall completion. Link commit SHA in the canonical record only, not the document. Preserve actual approval chronology; later committed content proves no earlier approval.
54
+
55
+ Existing commit evidence links remain valid because history is unchanged. For a contract revision, affected checks and rechecks MUST be rerun against the revised version. Stale evidence from plan-file changes requires refresh under existing rules. Preserve exact-HEAD/document/policy/fingerprint requirements; NEVER rewrite old fingerprints to suggest execution at a new state. Refresh briefs/gates before dependencies. Structure proves no live compliance.
56
+
57
+ <a id="task-acceptance-and-final-plan-acceptance"></a>
58
+ <a id="reviewer-timing-and-task-acceptance"></a>
59
+ ## Task acceptance and final plan acceptance
60
+
61
+ Task acceptance differs from final verification/acceptance. Connect criteria/observations/current checks/findings, not checkboxes/reports/passing commands alone. Use fresh QA where required or low-risk focused checks. For same-task QA findings and required QA rechecks, reuse the current QA while scope/workspace/ownership/context remain valid. Final overall Reviewer findings on plan work follow Implementer → Reviewer without QA reassignment; see the [final plan Reviewer correction loop](#final-plan-reviewer-correction-loop).
62
+
63
+ DO NOT delay independently acceptable tasks solely for final-only checks or defer currently required checks to accept early. State final integration scope/timing separately. Whole-plan Reviewer is final verification; task commits prove no unperformed final checks. Orchestrator decides final acceptance with QA/Reviewer/integration evidence/findings and unverified/disposition records. Shared evidence MUST satisfy all reuse rules.
64
+
65
+ Committed-plan final Reviewer findings need a follow-up task/planning/approvals. Keep corrections uncommitted; refresh committed state plus uncommitted diff/files in Reviewer artifacts/briefs. Reuse/assign independent Reviewer and repeat Implementer → Reviewer until resolved, then accept/commit one focused follow-up. Final QA findings still use Implementer → QA. No automatic amend/reset/duplicate originals; scope growth retains planning/approvals.
66
+
67
+ Orchestrator writes approved-base final base..HEAD diff/changed-file list to `<git-common-dir>/arc/review/<slug>.diff`, using handoff slug and absolute brief citation; inline if small/write denied. Reviewer reads artifact, not Git commands, stating limits.
68
+
69
+ <a id="ui-browser-acceptance-checks"></a>
70
+ ### UI browser acceptance checks
71
+
72
+ QA has no browser tool: launch/exercise apps/URLs through Bash only with assigned criteria/cited prerequisites, following installed browser-skill CLI guidance.
73
+
74
+ Briefs MUST supply workspace, existing launch command/URL, account/test-data scope, allowed interactions and this section's accessible citation. Use existing approved environment/tool/browser-skill instructions. No source/docs/tests/config edits, dependencies or environment changes. Missing prerequisites/tools/environment leave exact reported limits/unverified criteria.
75
+
76
+ For each criterion record command/URL, test state/viewport or inapplicability, interactions, expected/observed results and evidence. Startup/page-load/static checks alone prove no complete UI. Clean only QA-created processes/sessions; preserve shared services/sessions.
77
+
78
+ <a id="criterion-evidence-and-finding-handoff"></a>
79
+ ### Criterion evidence and finding handoff
80
+
81
+ Report every criterion by ID or wording: method/scope, run status, evidence, verdict, unverified reason/remaining scope. Run status: passed/failed/not run/environment blocked. Verdict: proven/unmet/unverified. Connect conditions/expectations to actual observations; partial/out-of-scope/missing/environment gaps stay unverified. PASS means run status only. Structure proves structure only.
82
+
83
+ Current-task failures/unmet criteria default to current Implementer/current QA under coordination context/boundary/amendment rules; findings alone create no task. Before Reviewer, rerun reproduction/invalidated checks, reporting actor/target/results/limits and prior finding resolved/unresolved/unverified with evidence. Repeat Implementer→QA if unresolved; QA reuse is no stale-evidence reuse. Environment/missing/out-of-scope are gaps, not presumed code defects; Reviewer cannot replace QA.
84
+
85
+ Reviewer behavior findings report criterion/expectation/problem/source/reproduction/evidence, separating source inference/execution. No QA execution. Outside final-plan exception route Implementer→QA; other Reviewer rechecks depend on scope/independence. Continue source review of structure/design/facts/security; observable security/interfaces may need both QA/Reviewer.
86
+
87
+ Accept from criterion verdicts/findings/rechecks/gaps, not overall run status. Disposition never proves unverified. Low-risk work also links each criterion to focused evidence.
88
+
89
+ <a id="completion-continuity"></a>
90
+ ## Completion continuity
91
+
92
+ Once approval/depth/target/handoff hold, continue execution/correction/reverification/required QA-Reviewer/disposition/acceptance/report. Preserve timing without new task-level gates. Reports/probes/commands never complete remaining approved scope. DO NOT make authorized execution an optional offer awaiting response. Probe-only ends at question/evidence/limits; combined work follows planning. Omission changes neither risk nor acceptance. Hold only actual affected conditions and report resume requirements. Structure proves no live compliance.
93
+
94
+ <a id="verification-lifecycle-in-the-cooperative-cli"></a>
95
+ ## Verification lifecycle in the cooperative CLI
96
+
97
+ Supported `workflow` is approved complete spec+plan. No-plan/small-task/omission is `cooperative.unsupported`, not policy violation/new documents. CLI executes no checks/Reviewer. Actors/results/verdicts are `operator-attested`, not identity/independence/semantic/enforcement proof.
98
+
99
+ 1. Orchestrator (`actor.role: "orchestrator"`) registers through `record`/`acceptance-evidence` with `data: {kind: "task", task: {...}}`. Task includes `id`, absolute `paths`, `criteria`, `requiredChecks`, `dependencies`, `approvalRef`, `approvalVersion`, `documentVersion`, `scopeVersion`, `targetVersion`. Pending-only registration is not acceptance/commit. Descriptor: `{executable, args, cwd, env, outputs}`; executable/cwd/outputs absolute, cwd/outputs inside workspace. No Reviewer in task checks.
100
+ 2. `status` observes `changeFingerprints.tasks[taskId]`/`changeFingerprints.final` independently from read-only Git inventory/index and current regular-file bytes/modes/deletions. Task covers owned paths, final the repository. Symlinks/submodules/unmerged indexes hold. This is no atomic observation/execution sandbox. RuntimeHash drift stays stale/hold without automatic stored-version update/migration/reapproval.
101
+ 3. Check preparation: `operation: "check"`, `taskId`, `arguments: {scope: "task", actor: {id, role: "qa"}, descriptor, changeFingerprint, findingIds?}`. QA identity attestation MUST differ from Implementer/Orchestrator; cross-task QA/Implementer reuse is rejected. Descriptor exactly matches registration. After durable intent, execute only existing authorized scope.
102
+ 4. `result`/`reconcile` records `intentId`, `{status, messageRef, data}` with same actor/descriptor/scope, taskId where applicable, fingerprint and `verdict: "proven" | "unmet" | "unverified"`. Even succeeded/proven applies only to that version. It replaces neither semantic proof nor acceptance. Failed/unknown/mismatch/unverified is not passing evidence. Preserve history.
103
+
104
+ Failed checks/reviews leave findings. Open separately via `data: {action: "open", id, checkId, message}`. After fixes record `data: {action: "resolve", id, actor: {id, role: "implementer"}, changeFingerprint}` plus evidence messageRef. Actor MUST be assigned to the task or relevant overall task. Resolved becomes closed only after later prepare `findingIds` and same-version successful revalidation. Prior QA failures retain Implementer→QA.
105
+
106
+ Final review uses `operation: "review"`, `scope: "final"`, `actor.role: "reviewer"`, `descriptor: {kind: "source-review", paths: [...]}` without taskId. Initial final review needs all tasks accepted/current required QA, never task acceptance/commit prerequisite. Plan-final findings repeat Implementer resolution→Reviewer without QA reassignment; old QA is not subsequent-fix execution. Separate unresolved QA remains.
107
+
108
+ Scope/document/approval records preserve history. `data.affectedTaskIds` invalidates those tasks/dependents and task/check/acceptance evidence; omitted IDs hold all. Final evidence becomes stale. Preserve unaffected independent evidence. Orchestrator determines semantic impact. Affected tasks need new current-scope approval/contracts before preparation, not revived old approvals; fresh checks/reviews/revalidation too. Current evidence supersedes failures without deletion. Acceptance/commit/completion stay Orchestrator decisions.
109
+
110
+ <a id="task-acceptance-and-focused-commit-reconciliation-in-the-cooperative-cli"></a>
111
+ ### Task acceptance and focused commit reconciliation in the cooperative CLI
112
+
113
+ Plan-mode `prepare` supports `operation: "accept"`/`operation: "commit"`. Acceptance attests `actor.role: "orchestrator"`, taskId and arguments messageRef/same criteria/current exact QA checkIds/all findingIds/current fingerprint. Latest required descriptors MUST be passed/proven and findings closed by fixes/QA. Successful attestation marks accepted; reports/checks alone do not. `operator-attested` means operator confirms semantics/identity.
114
+
115
+ Acceptance pins actual index tree/staged diff/paths/fingerprint. Stage approved paths beforehand and confirm QA for that index. Unrelated/other-task paths or in-scope unstaged/untracked changes hold. Code cannot identify semantically unrelated same-file hunks; Orchestrator reads diff.
116
+
117
+ Commit preparation references `arguments: {"acceptanceId": "acceptance requestId"}`. Check current approval/contract/QA/findings/index match acceptance and persist expected parent/tree/paths/residual paths. CLI stages/commits nothing. Orchestrator makes one matching focused commit.
118
+
119
+ Submit intentId/`actor.role: "orchestrator"` and `result: {"status": "succeeded", "messageRef": "actual result evidence", "data": {"commit": "full OID"}}` through reconcile/result. CLI rereads local object/parent/tree/paths/HEAD/index/residual changes. Only complete match updates target HEAD/committed. Preserve failed/unknown/mismatch/history; never arbitrary target updates. Same request/completed intent permits no repeated effect. Inspect/resolve/reconcile existing intent after failure.
120
+
121
+ NEVER rewrite QA fingerprints after commit. Separate post-commit observations detect changes. Final review needs current task evidence/final fingerprint. RuntimeHash drift keeps existing stale/hold without automatic version update.
122
+
123
+ [ARC role policy: contract begin]
124
+ Generated from lib/policy/role-policy.json; do not edit this managed section manually.
125
+ - [git.orchestrator-accept-commit] Only Orchestrator accepts work and performs Git mutations. One approved top-level plan task becomes one focused implementation commit after criteria, required checks and findings are satisfied. Orchestrator accepts, then includes that task's own progress records made after task completion (checkboxes, notes, results, evidence and status) with its implementation work in that commit, without a separate docs/fixup commit or planning-commit amendment for those records. Exclude other tasks; pending approved spec/plan revisions follow planning.plan-revision and preserve the no-change path without empty commits. Orchestrator commits without separate user commit approval. Reports, passing checks and Reviewer opinions do not replace acceptance. Preserve unrelated changes and ownership; verify the resulting SHA, content, HEAD and remaining changes. Existing small-task direct and plan-omission paths remain unchanged.
126
+ - [review.significant-no-plan] Significant/high-risk work without a plan follows Implementer → QA and required QA rechecks → Reviewer of the final full change → Orchestrator acceptance. DO NOT omit Reviewer because no plan exists. This adds no plan obligation.
127
+ - [review.significant-plan] Significant/high-risk plan work follows Implementer → required fresh QA → Orchestrator acceptance and focused commit for each task. 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 gate. Preserve required checks and necessary finding rechecks.
128
+ - [review.final-plan-recheck] Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.
129
+ - [planning.plan-revision] Task progress records (checkboxes, notes, results, evidence and status) preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit and records classification, reason and actual time as applicable. All other spec/plan content changes, contract or mechanical, require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval, preparation and holds on affected work before it continues, with a fresh Implementer for remaining work. After approval Orchestrator edits the same document, appends a revision-history row and leaves it uncommitted as an Orchestrator-owned pending revision, recording version, content hash, approval reference, actual time, classification, reason, affected tasks and the full approved content in the canonical handoff record. Orchestrator includes all pending revisions with Plan-Revision, Plan-Approved-At and Plan-Reason trailers in the accepted commit of the first top-level task executed or reconfirmed against the revised version, otherwise in a current task or final Reviewer follow-up commit; only when no implementation work remains before overall completion MAY it make one standalone docs(plan) closing commit without implementation files. Exclude revision hunks from commits of independent tasks accepted on a prior version, or hold that commit when separation is unsafe. NEVER amend or rewrite planning or implementation commits, create any other docs/fixup commit or authorize past work retroactively. After commit verify the committed document content matches the latest approved content apart from classified progress records of that commit's task or committed for other tasks after approval, and that no pending revision remains. Follow planning, handoff-prep, commit and verification for the full contract.
130
+ - [platform.grok] Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified.
131
+ [ARC role policy: contract end]
132
+
133
+ <a id="external-operations-and-recovery-in-the-cooperative-cli"></a>
134
+ ## External operations and recovery in the cooperative CLI
135
+
136
+ Three phases cover state/documents/assignment; scope/verification/acceptance/focused commits; external approval/results/audit recovery. Inspect nine areas/limits with `status.support`. Support is spec+plan `plan`, not no-plan/omission. CLI executes no native/provider/push/merge/deploy/publish calls.
137
+
138
+ Operator-confirmed approvals/results are `operator-attested`, `nativeVerified: false`, `remoteVerified: false`; no outside-call blocking or independent remote verification.
139
+
140
+ Record already confirmed external approval using `evidence: {kind: "external-approval", messageRef, data: {operation, scope, descriptor}}`. `scope` is unique absolute checkout paths. Local commit approval grants no external approval. Record exact action/scope/target and all descriptor fields:
141
+
142
+ | operation | descriptor fields |
143
+ |---|---|
144
+ | push | repository, destination, refspec, sourceOid, expectedRemoteOid |
145
+ | merge | repository, changeRef, targetRef, expectedTargetOid |
146
+ | deploy | service, project, environment, artifactId, destination |
147
+ | publish | service, namespace, name, version, artifactHash, destination |
148
+
149
+ Git OIDs are full lowercase 40/64-character hex; artifactHash is `sha256:<64-hex>`. Without remote observation OIDs are asserted expectations, not verified state. Destination is secret-free. No URL userinfo/query/fragment/password/token/credentials. Recognized secrets are rejected before persistence, but arbitrary-string secrecy cannot be guaranteed.
150
+
151
+ `prepare` accepts `{requestId, expectedRevision, actor: {id, role: "orchestrator"}, operation, arguments: {approvalRef, scope, descriptor}}`; approvalRef matches external approval messageRef. Persist only exact approval/scope/target/runtime versions with no unresolved effects. After `allow`/`persisted: true`, Orchestrator executes separately approved scope; CLI expands no authority.
152
+
153
+ `result`/`reconcile` accept `{requestId, expectedRevision, actor, intentId, result: {status, messageRef, data: {operation, scope, descriptor}}}`, with prepare requestId as intentId. Mismatch/unknown/stale outcomes hold while preserving attestations. After interruption inspect intent/`state.requests`/`state.audit`/`state.results` through `status` and investigate actual effects. Reconcile that same intent, not fresh preparation or replayed approvals.
154
+
155
+ Cancellation also requires `notExecutedEvidence: {messageRef}`; approval remains consumed. No automatic update/migration/renewed permission to fix drift. Report holds. Succeeded results remain attestations, not remote proof. `audit` links request→decision→intent→result→resolution but is locally editable, not tamper-proof. NEVER retry uncertain external outcomes.
@@ -0,0 +1,8 @@
1
+ <a id="grok-managed-worktree-creation"></a>
2
+ # Grok managed worktree creation
3
+
4
+ Follow the common [managed worktree contract](handoff-worktree.md) only after explicit user selection and verified preparation scope. Preserve the approved source/base, branch candidate, absent destination, unrelated changes and transfer evidence.
5
+
6
+ Grok native attachment has not been verified. Do not substitute Claude EnterWorktree, invent an attachment call or treat Git registration as attachment evidence. Hold managed worktree creation until Orchestrator has an approved, verified attachment method. The current checkout remains available only after explicit target selection.
7
+
8
+ On failure or partial completion, stop dependent work, preserve actual state and return paths, branch/HEAD, registration, completed steps and required resolution. Never retry with a different name, remove a worktree, change permissions or bypass the sandbox.
@@ -0,0 +1,107 @@
1
+ import {isDeepStrictEqual} from 'node:util';
2
+ import {parseToml} from '../models/config.mjs';
3
+
4
+ const MANAGED_KEYS = ['agents', 'skills', 'rules'];
5
+ const managedKey = /^[ \t]*(agents|skills|rules)[ \t]*=[ \t]*(true|false)[ \t]*#[ \t]*arc:managed[ \t]*(\r?\n)?$/;
6
+ const managedHeader = /^[ \t]*\[[ \t]*compat[ \t]*\.[ \t]*claude[ \t]*\][ \t]*#[ \t]*arc:managed[ \t]*(\r?\n)?$/;
7
+ const header = /^[ \t]*\[[ \t]*compat[ \t]*\.[ \t]*claude[ \t]*\][ \t]*(?:#[^\r\n]*)?(\r?\n)?$/;
8
+ const subtable = /^[ \t]*\[[ \t]*compat[ \t]*\.[ \t]*claude[ \t]*\./;
9
+ const fail = message => {throw new Error(message);};
10
+ const table = value => value !== null && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Date);
11
+ function read(original) {
12
+ let text;
13
+ try {text = new TextDecoder('utf-8', {fatal: true, ignoreBOM: true}).decode(original);}
14
+ catch {fail('config.toml is not UTF-8');}
15
+ let data;
16
+ try {data = parseToml(text);} catch {fail('TOML parse failed');}
17
+ return {text, data, lines: text.match(/[^\n]*\n|[^\n]+$/g) ?? []};
18
+ }
19
+ const lineForMatch = (lines, index) => index === 0 ? lines[index].replace(/^\uFEFF/, '') : lines[index];
20
+ function sections(lines) {
21
+ const result = [];
22
+ for (let start = 0; start < lines.length; start++) if (header.test(lineForMatch(lines, start))) {
23
+ let end = start + 1;
24
+ while (end < lines.length && !/^[ \t]*\[/.test(lineForMatch(lines, end))) end++;
25
+ result.push({start, end});
26
+ }
27
+ return result;
28
+ }
29
+ function verify(updated, expected) {
30
+ let actual;
31
+ try {actual = parseToml(updated);} catch {fail('cannot verify the safe edit');}
32
+ if (!isDeepStrictEqual(actual, expected)) fail('cannot verify the safe edit');
33
+ }
34
+ export function renderGrokCompat(original) {
35
+ const {text, data, lines} = read(original ?? Buffer.alloc(0));
36
+ const eol = /\r?\n/.exec(text)?.[0] ?? '\n', ranges = sections(lines);
37
+ if (data.compat !== undefined && !table(data.compat) || data.compat?.claude !== undefined && !table(data.compat.claude)) fail('[compat.claude] uses an unsupported representation');
38
+ if (data.compat?.claude !== undefined && !ranges.length && !lines.some((line, index) => subtable.test(lineForMatch(lines, index)))) fail('[compat.claude] uses an unsupported representation');
39
+ const entries = new Map();
40
+ for (const key of MANAGED_KEYS) {
41
+ if (data.compat?.claude?.[key] === undefined) continue;
42
+ if (typeof data.compat.claude[key] !== 'boolean') fail(`[compat.claude] ${key} must be a boolean`);
43
+ const matches = [];
44
+ for (const {start, end} of ranges) for (let i = start + 1; i < end; i++) if (new RegExp(`^[ \\t]*${key}[ \\t]*=`).test(lines[i])) matches.push(i);
45
+ if (matches.length !== 1) fail(`[compat.claude] ${key} uses an unsupported representation`);
46
+ entries.set(key, matches[0]);
47
+ }
48
+ const notes = [], written = [], missing = [];
49
+ for (const key of MANAGED_KEYS) {
50
+ const index = entries.get(key);
51
+ if (index === undefined) {missing.push(key); written.push(key); continue;}
52
+ if (managedKey.test(lines[index])) {
53
+ if (data.compat.claude[key]) {
54
+ lines[index] = lines[index].replace(/(=[ \t]*)true/, '$1false');
55
+ notes.push(`[compat.claude] ${key} reset to false (arc:managed)`);
56
+ written.push(key);
57
+ }
58
+ } else {
59
+ if (data.compat.claude[key]) fail(`[compat.claude] ${key} = true is set by the user; set it to false or remove it`);
60
+ notes.push(`[compat.claude] ${key} = false is user-owned and kept`);
61
+ }
62
+ }
63
+ if (missing.length) {
64
+ const end = ranges[0]?.end ?? lines.length;
65
+ if (end && !lines[end - 1].endsWith('\n')) lines[end - 1] += eol;
66
+ lines.splice(end, 0, ...(!ranges.length ? [`[compat.claude] # arc:managed${eol}`] : []), ...missing.map(key => `${key} = false # arc:managed${eol}`));
67
+ }
68
+ const updated = lines.join(''), expected = parseToml(text);
69
+ if (written.length) {
70
+ expected.compat ??= parseToml('[compat.claude]\n').compat;
71
+ expected.compat.claude ??= parseToml('[compat.claude]\n').compat.claude;
72
+ for (const key of written) expected.compat.claude[key] = false;
73
+ }
74
+ verify(updated, expected);
75
+ const changed = updated !== text;
76
+ if (changed) notes.push(`set [compat.claude] ${written.join(', ')} = false (arc:managed)`);
77
+ return {content: Buffer.from(updated), action: changed ? 'set Grok Claude compatibility' : 'unchanged', notes};
78
+ }
79
+ export function removeGrokCompat(original) {
80
+ if (original === null) return {content: null, notes: []};
81
+ const {text, data: expected, lines} = read(original), deleted = new Set();
82
+ let removedHeader = false;
83
+ for (const {start, end} of sections(lines)) {
84
+ for (let i = start + 1; i < end; i++) {
85
+ const match = managedKey.exec(lines[i]);
86
+ if (match) {
87
+ if (!table(expected.compat?.claude)) fail('cannot verify the safe edit');
88
+ deleted.add(i); delete expected.compat.claude[match[1]];
89
+ }
90
+ }
91
+ const hasKeys = lines.slice(start + 1, end).some((line, offset) => !deleted.has(start + 1 + offset) && /^[ \t]*[^#\r\n \t][^\r\n]*=/.test(line));
92
+ if (managedHeader.test(lineForMatch(lines, start)) && !hasKeys) {
93
+ if (!table(expected.compat?.claude)) fail('cannot verify the safe edit');
94
+ deleted.add(start); removedHeader = true;
95
+ }
96
+ }
97
+ if (!deleted.size) return {content: null, notes: []};
98
+ const updated = (deleted.has(0) && text.startsWith('\uFEFF') ? '\uFEFF' : '') + lines.filter((line, index) => !deleted.has(index)).join('');
99
+ if (removedHeader && Object.keys(expected.compat.claude).length === 0) delete expected.compat.claude;
100
+ if (removedHeader && Object.keys(expected.compat).length === 0) {
101
+ let actual;
102
+ try {actual = parseToml(updated);} catch {fail('cannot verify the safe edit');}
103
+ if (!Object.hasOwn(actual, 'compat')) delete expected.compat;
104
+ }
105
+ verify(updated, expected);
106
+ return {content: Buffer.from(updated), notes: ['restored [compat.claude] managed lines']};
107
+ }
@@ -39,19 +39,23 @@ function renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurre
39
39
  const home=target.home;
40
40
  const globalChanges=[];
41
41
  if(limits.max_concurrent_subagents>limits.max_total_subagents)summary.push(`Effective concurrency is at most ${limits.max_total_subagents} for a fresh ARC session; it may be lower after cumulative use or due to native capacity.`);
42
- if(skipGlobal)summary.push('Native concurrency update skipped (--skip-global).');
42
+ const runtimeConfig=installerRegistryOf({platforms}).getPlatform(target.platform).runtimeConfig;
43
+ if(skipGlobal){summary.push('Native concurrency update skipped (--skip-global).');if(typeof runtimeConfig.globalRender==='function')summary.push(`${target.runtimeConfigPath}: compatibility settings update skipped (--skip-global).`);}
43
44
  else for(const filename of target.globalPaths){
44
- if(filename!==target.instructionPath&&!installerRegistryOf({platforms}).getPlatform(target.platform).runtimeConfig.renderConcurrency)continue;
45
+ if(filename!==target.instructionPath&&!runtimeConfig.renderConcurrency&&typeof runtimeConfig.globalRender!=='function')continue;
45
46
  const current=inspectPath(safeFs,filename,{kind:'file',read:true,snapshot}),original=current.bytes??null;
46
47
  let rendered;
47
48
  if(filename===target.instructionPath)rendered=renderManagedBlock(original,agentsBlockBody(home,target.userHome,language,target.platform));
48
49
  else{
49
- const runtimeConfig=installerRegistryOf({platforms}).getPlatform(target.platform).runtimeConfig;
50
+ if(typeof runtimeConfig.globalRender==='function'){
51
+ try{rendered=runtimeConfig.globalRender(original);}catch(cause){fail(`Cannot update ${filename}: ${cause.message}; fix it or use --skip-global`);}
52
+ }else{
50
53
  let previous;try{previous=runtimeConfig.readConcurrency(original);}catch(cause){fail(`Invalid native configuration: ${cause.message}`);}
51
54
  if(preview.existing&&previous!==null&&previous!==preview.existing.max_concurrent_subagents&&!concurrentExplicit)fail(`Native concurrency drift at ${filename}; explicitly select --max-concurrent-subagents to update it`);
52
55
  let base=original;if(runtimeConfig.extraRender){const extra=runtimeConfig.extraRender(original);base=extra.content??original;if(extra.content===null)summary.push(`${filename}: ${extra.action}`);}
53
56
  try{rendered=runtimeConfig.renderConcurrency(base,limits.max_concurrent_subagents);}catch(cause){fail(`Cannot merge native concurrency: ${cause.message}`);}
54
57
  summary.push(`${filename}: native concurrency ${previous??'missing'} -> ${limits.max_concurrent_subagents}`);
58
+ }
55
59
  }
56
60
  if(rendered.content!==null&&(original===null||!rendered.content.equals(original)))globalChanges.push({path:filename,original,content:rendered.content,action:rendered.action});
57
61
  for(const note of rendered.notes??[])summary.push(`${filename}: ${note}`);
@@ -17,6 +17,7 @@ export const RUNTIME_MODULE_PATHS = Object.freeze([
17
17
  'lib/runtime/gemini-stream.mjs',
18
18
  'lib/runtime/git-evidence.mjs',
19
19
  'lib/runtime/git-query.mjs',
20
+ 'lib/runtime/grok-stream.mjs',
20
21
  'lib/runtime/identity.mjs',
21
22
  'lib/runtime/local-cli.mjs',
22
23
  'lib/runtime/operations.mjs',
@@ -19,9 +19,22 @@ export function buildUninstallPlan({target,safeFs,skipGlobal=false,removeComplet
19
19
  }
20
20
  for(const skill of linkedSkills){const root=arc+'/references/superpowers/'+skill,directory=safeFs.openRoot(root);try{if(!sameIdentity(snapshot.get(root),directory.stat()))throw new TargetConfigurationError('Removal reference root changed');snapshotSkill(directory,root,[]);}finally{directory.close();}}
21
21
  if(!skipGlobal){const filename=target.instructionPath??target.globalPaths[0],found=inspectPath(safeFs,filename,{kind:'file',read:true,snapshot});managedPaths.push(filename);if(found.exists){const removed=removeManagedBlock(found.bytes);if(removed.changed)globalChanges.push({path:filename,content:removed.content});}}
22
+ const {runtimeConfig,uninstallSummary}=installerRegistryOf({platforms}).getPlatform(target.platform),summary=[uninstallSummary];
23
+ if(typeof runtimeConfig.globalRemove==='function'){
24
+ const filename=target.runtimeConfigPath;
25
+ if(skipGlobal)summary.push(`${filename}: compatibility settings not restored (--skip-global).`);
26
+ else{
27
+ const found=inspectPath(safeFs,filename,{kind:'file',read:true,snapshot});
28
+ if(found.exists){
29
+ let removed;
30
+ try{removed=runtimeConfig.globalRemove(found.bytes);}catch(cause){summary.push(`${filename}: ARC-managed [compat.claude] lines were not restored (${cause.message}); remove lines marked # arc:managed manually`);}
31
+ if(removed?.content!==null&&removed!==undefined){managedPaths.push(filename);globalChanges.push({path:filename,content:removed.content});for(const note of removed.notes??[])summary.push(`${filename}: ${note}`);}
32
+ }
33
+ }
34
+ }
22
35
  const composite=inspectCompositeRemoval({target,safeFs,activeConfigPath:compositeActivePath,snapshot,runtimePlatforms});
23
36
  removals.push(...composite.removals);managedPaths.push(...composite.removals);
24
- const plan={target,skipGlobal,snapshot,removals,managedPaths,externalPaths:[],globalChanges,compositeOwned:composite.removals.length>0,compositeResidual:[...standaloneResidual,...composite.residualPaths],summary:[installerRegistryOf({platforms}).getPlatform(target.platform).uninstallSummary]};
37
+ const plan={target,skipGlobal,snapshot,removals,managedPaths,externalPaths:[],globalChanges,compositeOwned:composite.removals.length>0,compositeResidual:[...standaloneResidual,...composite.residualPaths],summary};
25
38
  if(removeCompletion)attachShellCompletionCleanup([plan],{safeFs});return plan;
26
39
  }
27
40
  import {assertPlanSnapshot,applyUninstallTransaction} from './transaction.mjs';
@@ -15,6 +15,7 @@ export function collectInstalledState({safeFs,userHome,env={},cwd,platforms,runt
15
15
  const resolved=resolveTargets({userHome,env,cwd,platforms}),modeSnapshot=new Map(),installation=readInstallMode({safeFs,...resolved,snapshot:modeSnapshot,platforms}),mode=installation.mode,targets=[],residualPaths=[];
16
16
  if(resolved.unresolved.some(({platform})=>installation.platforms.includes(platform)))fail('Mixed routing configuration cannot be verified.');
17
17
  for(const platform of ids){
18
+ if(registry.getPlatform(platform).runtime.capabilities.install.state!=='verified')continue;
18
19
  const target=resolved.targets[platform];if(!target)continue;
19
20
  const snapshot=new Map(),arc=path.join(target.home,'skills/arc');
20
21
  const skill=inspectPath(safeFs,arc,{kind:'directory',tree:true,allowLinks:true,snapshot});
@@ -27,9 +28,10 @@ export function collectInstalledState({safeFs,userHome,env={},cwd,platforms,runt
27
28
  const runtimeConfig=registry.getPlatform(platform).runtimeConfig;
28
29
  if(typeof runtimeConfig.readConcurrency==='function'){const native=inspectPath(safeFs,target.runtimeConfigPath,{kind:'file',read:true,snapshot});if(native.exists)try{runtimeConfig.readConcurrency(native.bytes);}catch(cause){throw new TargetConfigurationError(`Invalid native configuration at ${target.runtimeConfigPath}: ${cause.message}`,{cause});}}
29
30
  const shell=inspectPath(safeFs,path.join(userHome,'.zshrc'),{kind:'file',read:true,snapshot});if(shell.exists)removeShellCompletion(shell.bytes);
30
- if(mode==='composite')for(const [filename,value]of modeSnapshot)if(value)snapshot.set(filename,value);
31
+ const modeKeys=new Set();
32
+ if(mode==='composite')for(const [filename,value]of modeSnapshot)if(value){snapshot.set(filename,value);modeKeys.add(filename);}
31
33
  for(const [filename,value]of snapshot)if(!value)snapshot.delete(filename);
32
- targets.push({target,language,modelConfig,limits,snapshot,residualPaths:profiles.filter(item=>item.exists&&!item.owned).map(item=>item.path)});
34
+ targets.push({target,language,modelConfig,limits,snapshot,modeKeys,residualPaths:profiles.filter(item=>item.exists&&!item.owned).map(item=>item.path)});
33
35
  }
34
36
  const hash=createHash('sha256');for(const entry of targets){hash.update(entry.target.platform+'\0'+entry.target.home+'\0');for(const [name,value]of [...entry.snapshot].sort(([a],[b])=>a.localeCompare(b)))hash.update(JSON.stringify([name,value],(key,value)=>key==='atimeNs'?undefined:typeof value==='bigint'?value.toString():value));}
35
37
  return{targets,mode,platforms:installation.platforms,registry,residualPaths,stateToken:hash.digest('hex')};