@arbiterforge/ca-pi 0.15.10 → 0.16.0

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 (69) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/plugins/ca-pi/CHANGELOG.md +45 -0
  4. package/plugins/ca-pi/SKILLS.md +1 -1
  5. package/plugins/ca-pi/agents/infra-author.md +7 -1
  6. package/plugins/ca-pi/agents/scout.md +40 -8
  7. package/plugins/ca-pi/generated/command-catalog.json +1 -1
  8. package/plugins/ca-pi/helpers/artifacts/ca-artifact-darwin-amd64 +0 -0
  9. package/plugins/ca-pi/helpers/artifacts/ca-artifact-darwin-arm64 +0 -0
  10. package/plugins/ca-pi/helpers/artifacts/ca-artifact-linux-amd64 +0 -0
  11. package/plugins/ca-pi/helpers/artifacts/ca-artifact-linux-arm64 +0 -0
  12. package/plugins/ca-pi/helpers/artifacts/ca-artifact-windows-amd64.exe +0 -0
  13. package/plugins/ca-pi/helpers/artifacts/ca-artifact-windows-arm64.exe +0 -0
  14. package/plugins/ca-pi/helpers/artifacts/release.json +104 -6
  15. package/plugins/ca-pi/hooks/_activationlib.py +97 -13
  16. package/plugins/ca-pi/hooks/_arbiterstatelib.py +7 -2
  17. package/plugins/ca-pi/hooks/_artifactauthoritylib.py +519 -16
  18. package/plugins/ca-pi/hooks/_artifactlib.py +244 -7
  19. package/plugins/ca-pi/hooks/_artifactpromptlib.py +106 -2
  20. package/plugins/ca-pi/hooks/_bashguardlib.py +23 -8
  21. package/plugins/ca-pi/hooks/_contextreportlib.py +564 -6
  22. package/plugins/ca-pi/hooks/_contextselectlib.py +464 -0
  23. package/plugins/ca-pi/hooks/_contextsnapshotlib.py +999 -0
  24. package/plugins/ca-pi/hooks/_debughandofflib.py +767 -0
  25. package/plugins/ca-pi/hooks/_hooklib.py +2 -1
  26. package/plugins/ca-pi/hooks/_host.py +1 -1
  27. package/plugins/ca-pi/hooks/_intentlib.py +5 -5
  28. package/plugins/ca-pi/hooks/_protectedlib.py +3 -3
  29. package/plugins/ca-pi/hooks/_protectedstatelib.py +152 -2
  30. package/plugins/ca-pi/hooks/_provenancelib.py +604 -34
  31. package/plugins/ca-pi/hooks/_readinjectlib.py +131 -1
  32. package/plugins/ca-pi/hooks/_sensitivelib.py +28 -14
  33. package/plugins/ca-pi/hooks/artifact-authority-hook.py +1 -0
  34. package/plugins/ca-pi/hooks/artifact-authority.py +25 -1
  35. package/plugins/ca-pi/hooks/debug-handoff.py +85 -0
  36. package/plugins/ca-pi/hooks/doctor.py +4 -2
  37. package/plugins/ca-pi/hooks/git-enforce.py +7 -6
  38. package/plugins/ca-pi/hooks/hostapi.py +1 -1
  39. package/plugins/ca-pi/hooks/init-codearbiter.py +143 -15
  40. package/plugins/ca-pi/hooks/prompt-submit.py +14 -0
  41. package/plugins/ca-pi/hooks/session-start.py +26 -7
  42. package/plugins/ca-pi/includes/artifacts.md +41 -0
  43. package/plugins/ca-pi/includes/author-tdd-workflow.md +16 -4
  44. package/plugins/ca-pi/includes/helper-invocation.md +128 -0
  45. package/plugins/ca-pi/includes/pi-host-notes.md +13 -0
  46. package/plugins/ca-pi/includes/routing-table.md +1 -1
  47. package/plugins/ca-pi/includes/security-gate-record.md +5 -3
  48. package/plugins/ca-pi/package.json +1 -1
  49. package/plugins/ca-pi/routines/INDEX.md +1 -1
  50. package/plugins/ca-pi/routines/commit-gate/SKILL.md +5 -3
  51. package/plugins/ca-pi/routines/context-check/SKILL.md +103 -17
  52. package/plugins/ca-pi/routines/context-creation/SKILL.md +290 -54
  53. package/plugins/ca-pi/routines/debug/SKILL.md +303 -55
  54. package/plugins/ca-pi/routines/debug/references/debug-handoff.schema.json +879 -0
  55. package/plugins/ca-pi/routines/debug/references/handoff.md +155 -0
  56. package/plugins/ca-pi/routines/decompose/SKILL.md +13 -0
  57. package/plugins/ca-pi/routines/subagent-driven-development/SKILL.md +34 -0
  58. package/plugins/ca-pi/routines/tdd/SKILL.md +91 -17
  59. package/plugins/ca-pi/skills/ca-commit/SKILL.md +5 -3
  60. package/plugins/ca-pi/skills/ca-context-check/SKILL.md +103 -17
  61. package/plugins/ca-pi/skills/ca-create-context/SKILL.md +290 -54
  62. package/plugins/ca-pi/skills/ca-debug/SKILL.md +303 -55
  63. package/plugins/ca-pi/skills/ca-decompose/SKILL.md +13 -0
  64. package/plugins/ca-pi/skills/ca-feature/SKILL.md +1 -1
  65. package/plugins/ca-pi/skills/ca-fix/SKILL.md +36 -3
  66. package/plugins/ca-pi/skills/ca-init/SKILL.md +19 -0
  67. package/plugins/ca-pi/skills/ca-review/SKILL.md +33 -4
  68. package/plugins/ca-pi/skills/ca-status/SKILL.md +5 -0
  69. package/plugins/ca-pi/skills/ca-task/SKILL.md +55 -8
@@ -16,6 +16,11 @@ Wrap an existing codebase in project state, without guessing. Routed to by `/cre
16
16
 
17
17
  This back-fills from existing source. It complements `/ca-init`, which scaffolds an empty `.codearbiter/` for a fresh project; here the docs are derived from what is already on disk.
18
18
 
19
+ An initialized refresh is requested through `/ca-status drift` and the
20
+ existing `context-check` owner after an explicit scoped or full selection. This
21
+ initial-population route keeps its `<!--INITIALIZED-->` lock; an initialized
22
+ repository never clears the marker or re-enters Phase 6 to refresh content.
23
+
19
24
  ## Pre-flight
20
25
 
21
26
  Read these, or STOP and surface the gap — never guess project identity or a command:
@@ -25,6 +30,38 @@ Read these, or STOP and surface the gap — never guess project identity or a co
25
30
 
26
31
  The excluded set (not "meaningful source"): `.git/`, `.codearbiter/`, `.claude/`, `AGENTS.md`, `CLAUDE.md`, `README.md`, `LICENSE`, `.gitignore`, `.gitmodules`, and standard tooling dotfiles (`.editorconfig`, `.prettierrc`, etc.). Meaningful source MUST exist beyond it.
27
32
 
33
+ ## Resume after an interrupted initial population
34
+
35
+ Before continuing, inventory the actual `.codearbiter/` files and the prior
36
+ operation outcome. If the scaffold stopped partway through, rerun
37
+ `init-codearbiter.py --root <exact repository root>` only while the project is
38
+ uninitialized. It retains existing regular scaffold files and creates only
39
+ absent ones; an initialized, malformed or conflicting scaffold requires review.
40
+ Never clear the directory, reset a marker, or replace an existing task board,
41
+ question board or append-only audit record to make a retry pass.
42
+
43
+ For each content document, compare the document and its v2 provenance as a
44
+ pair. A missing or mismatched companion is incomplete, not usable context.
45
+ Identify the last approved preview, receipt and operation ID; inspect its
46
+ native transaction outcome before retrying an apply whose response was lost.
47
+ Use the existing engine's `recover` protocol for a pending transaction with
48
+ that same operation ID and a justified complete or rollback choice. A committed
49
+ result is read back and retained; do not repeat its write. An absent output may
50
+ be created only through a fresh typed preview and its own approval. A diverged
51
+ human file, unknown journal, stale expected identity or unresolved ownership
52
+ returns a precise conflict and leaves current bytes intact. Resume independent
53
+ valid outputs without claiming that individual replacements made the entire
54
+ set atomically visible.
55
+
56
+ Check finalization separately. An initialized marker with matching current
57
+ `CONTEXT` provenance is the committed outcome; retain it and route to normal
58
+ operation. Without that proven outcome, re-inventory all 13 required output
59
+ identities and use a fresh `finalize` preview and its own host-observed receipt.
60
+ If a prior finalization transaction is pending or its result is uncertain,
61
+ inspect or recover that operation first. Never append the marker by hand or
62
+ reuse a document approval for finalization. Initialized projects use the
63
+ existing scoped refresh lifecycle, with their marker and history retained.
64
+
28
65
  ## Phase 1 — Pre-flight confirmation · gate: BLOCK
29
66
 
30
67
  Confirm the repository is a brownfield codebase safe for scout-based extraction:
@@ -39,17 +76,137 @@ Gate: `<!--INITIALIZED-->` absent AND meaningful source present. If the marker i
39
76
 
40
77
  ## Phase 2 — Scout dispatch · gate: BLOCK
41
78
 
42
- A **scout** is a restricted, read-only role, not an unconstrained
43
- `general-purpose` agent. A scout reads one targeted slice of the codebase and
44
- returns a structured findings report — file paths, line numbers, and named
45
- values only, never raw code excerpts. Scouts are internal to this skill; they
46
- are never invoked from a command.
47
-
48
- Dispatch six isolated `scout` subagents simultaneously. If the active host
49
- cannot provide isolated subagents, BLOCK context creation and report the host
50
- capability gap. The general inline-role fallback does not apply here: this
51
- skill's report-only synthesis contract depends on the orchestrator never
52
- loading the scouts' raw source into its own context.
79
+ A context scout reads one targeted slice of the codebase and returns a bounded
80
+ findings report — file paths, line numbers, and named values only, never raw
81
+ code excerpts. Scouts are internal to this skill; they are never invoked from a
82
+ command.
83
+
84
+ ## Context-creation containment profile
85
+
86
+ BLOCK before dispatch unless the active host actually exposes a context-specific
87
+ child profile with a fresh child identity and host-enforced read-only containment.
88
+ The profile may use a read-only sandbox or a tool set limited to source read and
89
+ report delivery. A context-specific profile with Bash is eligible only when the
90
+ actual read-only OS boundary also contains the parent and every child, and a
91
+ closed guard permits exact frozen `git hash-object -- '<source path>'` reads only.
92
+ It must deny every other shell command, mutating file tool, nested Agent call,
93
+ unsandboxed retry and unknown child. A role label, an
94
+ agents capability, or a promise in the prompt does not qualify containment.
95
+ MUST NOT dispatch the existing `scout` role as this profile: its shared
96
+ frontmatter permits Bash for `decision-variance`. The current generated host
97
+ surfaces do not themselves provide a qualified context-specific restriction.
98
+ Without an explicitly prepared and observed caller profile, report
99
+ context-creation scout dispatch as unavailable and BLOCK before dispatch.
100
+ Do not invent per-dispatch tool flags, a model-tier mapping, or an inline
101
+ substitute. This restriction does not change `decision-variance` dispatch.
102
+
103
+ One candidate caller route is Claude Code's documented session-only `--agents`
104
+ inline JSON defining `context-scout` with `Read`, `Grep`, `Glob`, `Bash`, an exact
105
+ caller-selected model, and the context assignment prompt. The codeArbiter
106
+ CI-only fixture `.github/scripts/test_context_host.py` provides
107
+ `--prepare-context-profile` and `--guard-context-profile` for that route. The
108
+ fixture is not shipped in installed plugins. A separately prepared caller must
109
+ pin this repository source before using the preparation CLI below; ordinary
110
+ consumers cannot assume that file exists in their project or installation. The
111
+ former requires an explicit A–F assignment-to-file map, rejects `.git`, `.env`,
112
+ other private `.env.*` paths and symlink components, then freezes each
113
+ assignment's regular files, their raw SHA-256 values, the union source-list
114
+ digest, package digest, runtime identity, model and exact Git command strings.
115
+ The caller must supply a trusted, pinned absolute Git executable and its
116
+ SHA-256 from outside the source snapshot. The preparer rejects source-root Git
117
+ and a different executable selected by `PATH` before any Git invocation; a
118
+ hash of an untrusted `PATH` candidate is not provenance.
119
+ The guard consumes a native `PreToolUse` JSON event. It admits only a bound
120
+ child's assigned file to Read or Grep; Glob requires an exact assigned filename
121
+ with no wildcard, and Bash requires an exact assigned hash command. A parent
122
+ may only dispatch the session-only `context-scout` during this phase. Active
123
+ Git clean filters are rejected before preparation can finish; the guard
124
+ rechecks the frozen Git executable, effective config, filter attributes and
125
+ relevant environment before each Bash hash. The caller must start the native
126
+ phase with a sanitized Bash and Git environment: no shell startup hooks,
127
+ exported Bash functions, dynamic-loader injection variables, Git trace output
128
+ variables, or other rejected
129
+ environment keys. The preparer and guard reject such keys, but they cannot
130
+ prove the native Bash process inherited that environment; the caller must
131
+ verify it at the OS boundary. The parent `Agent` hook check limits agent type
132
+ and observes bound-child count, but repeated calls before `SubagentStart` can
133
+ all pass. The trusted caller must atomically reserve exactly one launch per
134
+ assignment, at most six total, before dispatch and bind each resulting native
135
+ child ID; hook decisions alone never establish that bound. Protect the resulting profile and
136
+ hook command from the solver, use the host's documented hook settings, and retain the exact
137
+ settings, agent definition and installed package bytes. The preparer never
138
+ invokes a host or qualifies containment. It does not set an OS sandbox, admit
139
+ children, collect reports or grant native task authority. A caller must supply
140
+ and qualify those missing layers before any dispatch. A settings declaration
141
+ alone is not a host observation. Native Windows Bash is not an eligible OS
142
+ read-only boundary for this route; a supported Linux/WSL2 sandbox must fail if
143
+ unavailable and refuse unsandboxed retries. Unknown platform or settings
144
+ behavior leaves this route unavailable. Native file tools need their own
145
+ source-scoped permission boundary because the Bash sandbox alone does not
146
+ contain them. A caller must also retain and independently validate all six
147
+ read, hash, guard-denied write, OS-denied write and report observations with
148
+ distinct native child IDs. The preparer's supplied-observation completeness
149
+ check always returns `unverified`; it is not a native receipt.
150
+
151
+ The exact inert preparation CLI is `python <pinned-source>/test_context_host.py
152
+ --prepare-context-profile <repo-root> <assignment-map.json>
153
+ <union-source-list-sha256> <installed-package-sha256> <runtime-id>
154
+ <exact-model> <trusted-git-absolute-path> <trusted-git-sha256>
155
+ <protected-profile.json>`. It creates that profile and its
156
+ `<protected-profile.json>.settings.json` template only at absent paths. Pass
157
+ the profile's `agents` object as inline JSON to the documented session-only
158
+ `--agents` flag; the caller installs and verifies the protected settings and
159
+ OS read-only phase separately. On each real `SubagentStart`, the trusted caller
160
+ binds its native `agent_id` to the predeclared assignment with
161
+ `bind_context_child` before the child's first tool. Unknown or extra children
162
+ are denied, and the caller retains each bound input/result/denial/report rather
163
+ than inserting synthetic answers into the report. The CLI's guard mode is
164
+ `python <pinned-source>/test_context_host.py --guard-context-profile
165
+ <protected-profile.json>` with the native hook event on stdin. These source
166
+ helpers expose a repository-only caller preparation interface; they do not make any installed
167
+ plugin host qualified by themselves.
168
+
169
+ Before treating a newly supported host profile as qualified, observe distinct
170
+ child identities for all six assignments, a successful source read and a
171
+ bounded report from each child, and a benign write attempt denied by the
172
+ actual host boundary. Check that the attempted write left the target bytes unchanged. A
173
+ missing or inconclusive observation leaves the profile unavailable. If source
174
+ hashes cannot be obtained through the qualified exact-command Bash route or
175
+ another trusted deterministic read-only collector, the profile remains
176
+ unavailable. Verify that each cited command actually ran against the frozen
177
+ source and retain its result; the preparer's source-list digest is not a scout
178
+ report digest. Keep `git-blob-normalized-sha1` and `sha256-raw` method identities
179
+ distinct in `_contextreportlib`.
180
+ The orchestrator receives only reports after Phase 1, preserving report-only synthesis.
181
+ Never count a failed or missing report as completed coverage.
182
+
183
+ When the profile is actually qualified, create one full run with six root
184
+ assignments, one for each logical category below. Queue launches within the
185
+ host's qualified concurrency limit; simultaneous execution is not required.
186
+ For an affected-scope refresh, create only the affected root assignments and
187
+ retain the extent of prior coverage separately. A scoped run cannot assert a
188
+ new full scan. Fix the run's source snapshot, deadline and host-specific time,
189
+ token and tool budgets before any authorized dispatch. If a mandatory budget
190
+ or qualified profile is unavailable, block before dispatch.
191
+
192
+ Use `_contextreportlib.admit_scout_attempt` before each launch and retain every
193
+ admitted assignment/attempt pair in the same run ledger, including failed,
194
+ oversize, retry and child attempts. The aggregate limit is 24 launches, one
195
+ retry per unchanged assignment, subdivision depth 3 and fanout 4. Subdivision
196
+ keeps the parent assignment ID and uses a finite set of preflight coverage
197
+ paths: the children's union must equal the parent's set. Name any intentional
198
+ overlap in the child assignments, then reconcile the returned observations;
199
+ unexplained overlap or contradictory overlap blocks. No renamed child or retry
200
+ starts a new run budget or deadline. A failed parent is still counted when its
201
+ work is subdivided. A parent that completed cannot be silently replaced by
202
+ children.
203
+
204
+ Each report must pass the versioned closed `_contextreportlib` decoder with
205
+ its exact assignment, attempt, snapshot and scope binding; the
206
+ legacy `decision-variance` Markdown report does not satisfy this transport.
207
+ No inline fallback is allowed: this skill's report-only
208
+ synthesis boundary depends on the orchestrator never loading the scouts' raw
209
+ source into its own context.
53
210
  Each reads only its assigned slice:
54
211
 
55
212
  - **Scout A — Tech stack.** Read `package.json`, lockfiles, `pyproject.toml`, `requirements.txt`, `go.mod`, `Cargo.toml`, `*.gemspec`, `Gemfile`. Report languages, runtime versions, frameworks, key dependencies, the dependency manager, license fields. Additionally report, at the repository root only: which of `package.json` / `pyproject.toml` / `Cargo.toml` / `composer.json` carry a version field (candidate release manifests), which of `CHANGELOG.md` / `CHANGES.md` / `HISTORY.md` are present (candidate changelogs), and any existing tag naming convention visible in the repo (e.g. a `v*` tag) — the inputs Phase 3/5 use to draft `.codearbiter/release-targets.md`.
@@ -61,31 +218,82 @@ Each reads only its assigned slice:
61
218
 
62
219
  The orchestrator reads only the scout reports in later phases — never the raw source — to preserve working context. A scout that finds nothing returns an explicit "not found" report, never silence.
63
220
 
64
- **Content hashes:** Scouts additionally emit a `git hash-object <path>` content oid per cited file in the hash field of their evidence entry. The scout already Read those files — no additional pass is needed, and no raw content is forwarded to the orchestrator.
65
-
66
- Gate: all six scout reports returned. A missing report is a blocking gap — do not proceed with an incomplete picture. Re-dispatch a failing scout before Phase 3.
221
+ **Content hashes:** Each cited file needs a digest and method accepted by the
222
+ closed report decoder. The legacy scout's `git hash-object <path>` instruction
223
+ belongs to `decision-variance`; context-creation needs a trusted read-only
224
+ collector with the decoder's declared method and shape. No raw content is
225
+ forwarded to the orchestrator.
226
+
227
+ Before synthesis call `_contextreportlib.join_scout_reports` with the unchanged
228
+ run, complete attempt ledger and every returned transport payload. The join
229
+ requires six complete logical categories for an initial or explicitly full
230
+ run, or exactly the declared affected categories for a scoped refresh.
231
+ Complete ambiguous, not-inspected, failed or oversize category outcomes enter
232
+ gap handling; a missing, failed or oversize **report transport** blocks the
233
+ join. The normalized joined input is capped at 48 KiB; overflow is a named
234
+ scope/report-size blocker, never truncation or quiet omission. Recheck the
235
+ source snapshot at join through the source-snapshot owner before relying on
236
+ retained evidence. These pure helpers do not supply dispatch, containment,
237
+ freshness, authorization or live qualification.
238
+
239
+ Gate: an observed containment boundary and complete transports for every
240
+ declared logical assignment, including all six on a full run.
241
+ MUST NOT proceed to Phase 3 on an unavailable profile, failed or missing report,
242
+ or an unobserved read/write/report boundary. Re-dispatch a failing scout only
243
+ through the qualified profile after its failure is understood.
67
244
 
68
245
  ## Phase 3 — Synthesis · gate: BLOCK
69
246
 
70
- Draft every surviving project-state doc from the six reports, working only from the reports. Map source to destination:
247
+ Draft every surviving project-state doc from the admitted joined reports,
248
+ working only from those reports. For initial or explicitly full onboarding,
249
+ the join covers all six logical domains; a scoped refresh changes only its
250
+ declared affected domains and makes no new full-coverage claim. Map source to
251
+ destination:
71
252
 
72
253
  | Scout source | Destination |
73
254
  |---|---|
74
- | A (tech stack), B (build/test/lint commands), E (test runner) | `tech-stack.md` |
75
- | C (architecture), E (structure) | `coding-standards.md` |
76
- | D (security) | `security-controls.md` (thin) |
77
- | A (candidate manifest, candidate changelog, tag convention) | `.codearbiter/release-targets.md` |
78
- | All scouts | `CONTEXT.md` (project identity, purpose, scope, NOT-building) |
79
-
80
- Classify every finding by confidence:
81
-
82
- - **HIGH** — directly and unambiguously in a report (e.g., `"jest"` in `package.json`). Write it as fact.
83
- - **MEDIUM** — inferred from an indirect signal (directory layout implies layered architecture, no explicit config). Write it with a note: inferred from [signal], verify before relying on it.
84
- - **LOW** — no signal, or conflicting signals. Write a `[CONFIRM-NN]` placeholder.
85
-
86
- Every `[CONFIRM-NN]` carries: a sequential ID, one sentence on what is unknown, why it matters, and what would resolve it. IDs are sequential with `open-questions.md`.
87
-
88
- **`.codearbiter/release-targets.md` is HIGH-confidence only when Scout A found exactly one candidate manifest and exactly one candidate changelog at the repository root.** Draft the row then, in the grammar `<plugin-root>/hooks/_releaselib.py`'s module docstring declares — a single-target project needs only `prefix`, `manifest`, `changelog`, `payload`:
255
+ | Stack, infrastructure/commands, tests/verification | `tech-stack.md` |
256
+ | Architecture/source ownership, tests/structure | `coding-standards.md` |
257
+ | Security boundaries | `security-controls.md` (thin) |
258
+ | Stack/release candidates | `.codearbiter/release-targets.md` when supported |
259
+ | All applicable domains | `CONTEXT.md` (project identity, purpose, scope, NOT-building) |
260
+
261
+ For each retained claim, name its purpose, owning source and actual consumer
262
+ (or a specific retention reason), with the report citation and source snapshot.
263
+ Separate observed, inferred, proposed and approved content. Keep command
264
+ declarations inert, with their actual cwd and declared/verified state: never convert a package script into a passed verification. Keep unsupported fields
265
+ unknown; make no blanket security claim from absence. Confidence describes
266
+ evidence strength, not governance: confidence never grants normative authority.
267
+ A HIGH observation may support a source-bound fact, but it cannot approve a
268
+ rule, permission, scope change or publication. Mark indirect inferences as
269
+ inferences with their signal and recheck need.
270
+
271
+ Preserve existing effective local instructions at their native precedence and
272
+ human ownership, subject to governing session/platform rules. Cite an AGENTS
273
+ or equivalent file without copying it into a new local rule or requiring a new
274
+ approval for unchanged use. Treat an upstream instruction, README convention or
275
+ accepted upstream ADR as source-scoped evidence; use a source-bound ADR reference
276
+ without manufacturing a local decision. If an upstream rule conflicts with a
277
+ local constraint, keep both citations for Phase 4 and do not silently displace
278
+ either. There is no new task or ADR from an observed pattern.
279
+
280
+ Distinguish report transport from category outcome. A complete transport with
281
+ `observed`, `not_applicable`, `not_found_in_scope`, `not_inspected` or
282
+ `ambiguous` still counts as a returned report; a missing, failed or oversized
283
+ transport blocks Phase 3. A justified `not_applicable` records why the domain
284
+ does not apply. A `not_found_in_scope` records its searched scope and predicates;
285
+ it does not prove universal absence. In a small static project with known tests
286
+ and justified no-storage evidence, ask no database question for a scoped test
287
+ change. Keep partial-domain uncertainty visible, but ask the user only if a
288
+ missing decision affects the current output or selected task.
289
+
290
+ Use `[CONFIRM-NN]` only for a material user-owned decision that evidence cannot
291
+ settle. Give each a sequential ID, the missing choice, why it matters now and
292
+ what would resolve it; align IDs with `open-questions.md`. Other unknowns stay
293
+ explicitly unknown or become a bounded evidence reinspection, not an automatic
294
+ interview. Do not synthesize a user deferral.
295
+
296
+ **`.codearbiter/release-targets.md` is a candidate only when the stack report found exactly one candidate manifest and exactly one candidate changelog at the repository root.** Draft the row then, in the grammar `<plugin-root>/hooks/_releaselib.py`'s module docstring declares — a single-target project needs only `prefix`, `manifest`, `changelog`, `payload`:
89
297
 
90
298
  ```text
91
299
  <!-- release-targets -->
@@ -98,25 +306,50 @@ latest-eligible: true
98
306
  <!-- /release-targets -->
99
307
  ```
100
308
 
101
- (`prefix` defaults to `v` unless Scout A found a different existing tag convention; `payload` is `.` for a single-package repository.) Zero, or more than one, candidate manifest or changelog is LOW confidence — the same "no signal, or conflicting signals" rule above — and gets a `[CONFIRM-NN]` instead of a guessed row; this doc is never scaffolded from an ambiguous scan, and the file is simply not written until the gap is resolved in Phase 4.
309
+ (`prefix` defaults to `v` unless the report found a different existing tag convention; `payload` is `.` for a single-package repository.) Zero, or more than one, candidate manifest or changelog cannot produce a guessed row. Record the evidence gap; ask about a release target only when that choice is needed now. Otherwise leave this conditional draft absent.
102
310
 
103
311
  **`latest-eligible: true` is not cosmetic.** `/release`'s own back-fill detector (`detect_candidate_target`) emits it for this exact single-target shape, so a project drafted here and one back-filled through `/release` must agree — omitting it here would default the row's Phase-3 publish to `--latest=false`, and the same project would get different release behavior depending on which lane happened to declare it first.
104
312
 
105
- Gate: every surviving doc drafted; every low-confidence inference carries a `[CONFIRM-NN]`. No silent omission. A domain with no scout signal gets a doc with a `[CONFIRM-NN]` for the whole section — never an empty file.
313
+ Gate: every surviving doc drafted with supported claims and explicit material
314
+ unknowns. No silent omission, invented approval or invented verification. A
315
+ domain with no scout signal has its coverage and uncertainty represented in the
316
+ relevant draft; it does not force an irrelevant interview or an empty file.
106
317
 
107
318
  ## Phase 4 — Gap interview · gate: BLOCK
108
319
 
109
- Resolve `[CONFIRM-NN]` items with the user. Ask only what the scouts could not answer with HIGH confidence.
110
-
111
- 1. Present the `[CONFIRM-NN]` list grouped by category — gaps the scan could not resolve.
112
- 2. Ask ONE targeted question per item. No compound questions. Do not re-ask anything scouts answered with HIGH confidence.
113
- 3. Per answer: if it resolves the gap, replace the placeholder with content; if the user explicitly defers, keep the placeholder, mark it deferred with the date, and record it in `open-questions.md`; if the answer is vague, challenge it and demand a concrete answer before recording anything.
114
-
115
- Gate: every `[CONFIRM-NN]` has exactly one outcome — resolved (replaced with content) or explicitly deferred (marked and recorded in `open-questions.md`). No item is silently dropped. Do not proceed with unacknowledged gaps.
320
+ First reconcile contradictory reports without picking the highest confidence:
321
+ retain both conflicting citations and request the smallest independent reinspection
322
+ of the disputed source, predicate and snapshot through the
323
+ qualified read-only profile. A changed or missing source snapshot requires
324
+ fresh evidence. If the conflict survives, expose both claims and the precise
325
+ choice requiring a user ruling; do not overwrite either source.
326
+
327
+ Build a bounded relevant question set for the current output and selected task.
328
+ Use one concise interview to batch independent user-owned decisions by category;
329
+ ask each as one targeted choice with its evidence and consequence. Ask only
330
+ missing user-owned decisions, not facts already established by reports or
331
+ existing effective instructions. In particular, do not re-ask an unchanged
332
+ local test convention. A database gap unrelated to a documentation or test
333
+ change remains visible without blocking that work.
334
+
335
+ For each answer, record the actual outcome under the existing question owner:
336
+ resolution with its user authority, or, if the user explicitly defers, a
337
+ deferral with date in
338
+ `open-questions.md`. If unclear, retain the question and ask a focused follow-up;
339
+ no synthesized deferral. An explicitly deferred question is still unresolved:
340
+ never treat a deferral as approval. An unresolved permission, security, scope or
341
+ approval prerequisite blocks dependent work and names the missing authority.
342
+ Unrelated uncertainty does not block an expected-success task that has its
343
+ bounded relevant question set answered.
344
+
345
+ Gate: each material user-owned question has a recorded resolution or actual
346
+ explicit deferral; unresolved prerequisites still stop their dependent work.
347
+ No question or conflicting citation is silently dropped, and independent
348
+ solvable work is not held by an irrelevant domain interview.
116
349
 
117
350
  ## Phase 5 — Project-state write · gate: BLOCK
118
351
 
119
- Write the surviving docs to `<project-root>/.codearbiter/`. Every doc carries actual content — no unresolved placeholder may remain where a value was determined:
352
+ Prepare the five surviving content documents with the installed context writer's typed preview, actual source evidence and file-specific provenance. Review and approve each exact preview through its native `approve-context` reply before receipt-only apply; an approval for one document does not approve another or the final marker. Preserve existing human content and ownership. Every doc carries actual content — no unresolved placeholder may remain where a value was determined:
120
353
 
121
354
  | File | Content |
122
355
  |---|---|
@@ -124,9 +357,10 @@ Write the surviving docs to `<project-root>/.codearbiter/`. Every doc carries ac
124
357
  | `tech-stack.md` | Languages, frameworks, test runner, lint command, build command, coverage command, issue-tracker command (e.g. `gh issue create`). |
125
358
  | `coding-standards.md` | Structural patterns, naming conventions, style rules. |
126
359
  | `security-controls.md` | Thin: auth mechanism, banned crypto primitives, secret-loading stance. Only what a security boundary actually requires. |
127
- | `open-questions.md` | Every deferred `[CONFIRM-NN]` in `CONFIRM-NN: <description>` form. |
128
- | `open-tasks.md` | Create the file with its heading only. **Every task goes in through the board helper, one call per item — `python3 "<plugin-root>/hooks/taskwrite.py" add "<task>"` — never by writing entries into the file directly** (B-18). The helper owns the board schema the SessionStart hook and the statusline parse, so a backlog seeded this way cannot drift from it; and once `open-tasks.md` is enrolled in the protected-state registry, a direct write is refused outright, which would leave a Write-tool instruction here unfollowable. If scouts found no backlog, the heading-only file stands as the stub. |
129
- | `overrides.log` | Empty append-only audit log, created so `/override` has a sink. |
360
+ | `code-map.md` | A coarse concern-to-path map from supported architecture evidence. A known inapplicable domain is explained in its relevant content document rather than given a fabricated map entry. |
361
+ | `open-questions.md` | Every deferred `[CONFIRM-NN]` in `CONFIRM-NN: <description>` form. A valid empty question board remains empty. |
362
+ | `open-tasks.md` | Preserve the existing scaffold and task history. **Every new task goes in through the board helper, one call per item — `python3 "<plugin-root>/hooks/taskwrite.py" add "<task>"` — never by writing entries into the file directly** (B-18). The helper owns the board schema the SessionStart hook and statusline parse. If scouts found no backlog, leave a valid empty board intact; do not invent a task. |
363
+ | `overrides.log` | Preserve its append-only audit header and every existing event. A zero-event header is valid; do not fabricate an override to make it non-empty. |
130
364
  | `release-targets.md` | Conditional, unlike every other row above: written ONLY when Phase 3 drafted it at HIGH confidence (exactly one candidate manifest, exactly one candidate changelog) or Phase 4 resolved its `[CONFIRM-NN]` to a concrete row. Left unwritten otherwise — `/release`'s own back-fill lane (or a later `context-creation` run, once the ambiguity resolves) is the sanctioned way to create it, never a guess made here. **This file is marker-gated protected state; it needs the authoring marker below, unlike every other row in this table.** |
131
365
 
132
366
  **Authoring marker — required for `release-targets.md` only.** That path is enrolled in the protected-state registry as `marker-gated` (hook `H-22`), so a Write against it is refused unless a fresh authoring marker exists. This lane is a sanctioned author of it, so it mints one immediately before the write and removes it immediately after — the same one-pass shape `/release`'s back-fill lane uses:
@@ -146,31 +380,33 @@ Skip both commands entirely when this run is not writing `release-targets.md`
146
380
 
147
381
  If scouts found existing decision records (`docs/decisions/`, `adr/`), summarize them as entries under `.codearbiter/decisions/` in the standard ADR format. If a record cannot be fully parsed, summarize what is known, flag the uncertainty, and note the source path for review.
148
382
 
149
- **Provenance and code-map (small addition, not a Phase 5 rebuild):**
383
+ **Provenance and code-map:**
150
384
 
151
- - Write ONE provenance file per derived doc to `.codearbiter/.provenance/<doc>.json` via `_provenancelib.write_provenance` and `new_record`. Each entry carries: `path` (repo-relative), `hash` (the scout's `git hash-object` oid), `drift_trigger` (from `_provenancelib.classify_source(path)`), and the `claims` array with `lines`, `claim`, and `confidence` drawn from the scout evidence.
152
- - Synthesize `.codearbiter/code-map.md` (concern → path → ≤1-line role) from Scout C (architecture) evidence. Use concern headings (`## <concern>`) and column-0 bullets (`- \`path\` — role`). Keep it coarse — module/concern granularity only, no full file listing.
385
+ - The installed context writer commits each selected document and its v2 `.codearbiter/.provenance/<doc>.json` record together. Bind each claim to current content or membership evidence, its source, owner and actual consumer. An identity acknowledgement does not stand in for semantic review or approval. Never write either side of this pair directly.
386
+ - Synthesize `.codearbiter/code-map.md` (concern → path → ≤1-line role) from architecture evidence. Use concern headings (`## <concern>`) and column-0 bullets (`- \`path\` — role`). Keep it coarse — module/concern granularity only, no full file listing.
153
387
 
154
388
  Do NOT scaffold any cut doc — see `<plugin-root>/includes/cut-docs.md` for the canonical never-scaffold list. Maturity lives in the `stage:` frontmatter of `CONTEXT.md`, not a separate file.
155
389
 
156
- Gate: every surviving doc written; `CONTEXT.md` frontmatter carries `arbiter: enabled` and `stage:`; no resolved value left as a placeholder. Deferred `[CONFIRM-NN]` items are acceptable only in `open-questions.md`.
390
+ Gate: all five content documents and their matching v2 provenance pairs are present; `CONTEXT.md` frontmatter carries `arbiter: enabled` and `stage:`; no resolved value is left as a placeholder. The task/question boards and audit file are present through their owning paths. Valid empty boards and a zero-event audit header pass. Deferred `[CONFIRM-NN]` items are recorded in `open-questions.md`.
157
391
 
158
392
  ## Phase 6 — Initialization lock · gate: BLOCK
159
393
 
160
394
  Lock the project state as initialized and return to normal orchestration:
161
395
 
162
- 1. Write the `<!--INITIALIZED-->` marker into the body of `CONTEXT.md`.
163
- 2. List `.codearbiter/` and display the populated tree.
164
- 3. Confirm each required file is present and non-empty: `CONTEXT.md` (with `arbiter: enabled` frontmatter and the `<!--INITIALIZED-->` body marker), `tech-stack.md`, `coding-standards.md`, `security-controls.md`, `open-questions.md`, `open-tasks.md`, `overrides.log`.
165
- 4. State the return to normal operation: extraction complete, project state initialized and locked, `/ca-feature` available to begin work. Deferred questions live in `open-questions.md`.
396
+ 1. Gather exact SHA-256 identities for the five content documents, their five v2 provenance records, and `open-tasks.md`, `open-questions.md`, `overrides.log`. Submit the closed `finalize` preview through `init-codearbiter.py --context-request FILE` with those 13 path identities. The installed native writer validates each file by its own contract, checks all current source evidence and addressed/deferred questions, and previews the marker plus updated `CONTEXT` provenance. A missing, malformed or changed file blocks without reporting completion.
397
+ 2. Review the exact finalization preview and capture its own host-observed `approve-context` reply. Apply only that receipt through the same request bridge. The writer rechecks all relevant identities under its lock and commits `<!--INITIALIZED-->` in the body of `CONTEXT.md` with the new full-document provenance digest as one transaction. Do not append the marker directly or reuse a content-write receipt.
398
+ 3. List `.codearbiter/` and confirm the committed result and current provenance. State the return to normal operation: extraction complete, project state initialized and locked, `/ca-feature` available to begin work. Deferred questions live in `open-questions.md`.
166
399
 
167
- Gate: `arbiter: enabled` set and `<!--INITIALIZED-->` present in `CONTEXT.md`; every required file present and non-empty. Do not close this skill without confirming both markers are written.
400
+ Gate: the qualified native transaction reports committed, `arbiter: enabled` and the standalone body marker are present, and all required outputs remain valid. Header-only empty boards, justified inapplicable domains and a zero-event audit header satisfy their real contracts. Existing initialized repositories use refresh; never remove their marker to repeat onboarding.
168
401
 
169
402
  ## Hard rules
170
403
 
171
- - MUST NOT write `<!--INITIALIZED-->` while any `[CONFIRM-NN]` is unaddressed — every gap must be resolved or explicitly deferred to `open-questions.md` first.
404
+ - MUST NOT finalize while any `[CONFIRM-NN]` is unaddressed — every gap must be resolved or explicitly deferred to `open-questions.md` first.
172
405
  - MUST NOT resolve a `[CONFIRM-NN]` by guessing — surface the question to the user or defer it.
173
- - MUST NOT proceed past Phase 2 with fewer than six scout reports.
406
+ - MUST NOT proceed past Phase 2 without all six complete logical reports for
407
+ initial or explicitly full onboarding; a scoped refresh needs its declared
408
+ affected assignments and must not claim new full coverage.
409
+ - MUST NOT use a writable role with Bash as a context scout or infer read-only containment from an `agents` capability.
174
410
  - MUST NOT run Phase 2 inline — isolated scout subagents are required for the report-only synthesis boundary.
175
411
  - MUST NOT load raw source into the orchestrator context after Phase 1 — synthesize from scout reports only.
176
412
  - MUST NOT record a scout finding that exposes a secret value — paths and line numbers only.