@arbiterforge/ca-pi 0.18.4 → 0.19.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 (74) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/plugins/ca-pi/CHANGELOG.md +54 -0
  4. package/plugins/ca-pi/COMMANDS.md +2 -2
  5. package/plugins/ca-pi/SKILLS.md +5 -5
  6. package/plugins/ca-pi/SPRINT.md +43 -230
  7. package/plugins/ca-pi/agents/backend-author.md +5 -5
  8. package/plugins/ca-pi/agents/checkpoint-aggregator.md +7 -0
  9. package/plugins/ca-pi/agents/frontend-author.md +5 -5
  10. package/plugins/ca-pi/agents/infra-author.md +6 -7
  11. package/plugins/ca-pi/agents/scout.md +25 -24
  12. package/plugins/ca-pi/arbiter.md +6 -4
  13. package/plugins/ca-pi/generated/command-catalog.json +5 -5
  14. package/plugins/ca-pi/helpers/artifacts/ca-artifact-darwin-amd64 +0 -0
  15. package/plugins/ca-pi/helpers/artifacts/ca-artifact-darwin-arm64 +0 -0
  16. package/plugins/ca-pi/helpers/artifacts/ca-artifact-linux-amd64 +0 -0
  17. package/plugins/ca-pi/helpers/artifacts/ca-artifact-linux-arm64 +0 -0
  18. package/plugins/ca-pi/helpers/artifacts/ca-artifact-windows-amd64.exe +0 -0
  19. package/plugins/ca-pi/helpers/artifacts/ca-artifact-windows-arm64.exe +0 -0
  20. package/plugins/ca-pi/helpers/artifacts/release.json +37 -37
  21. package/plugins/ca-pi/hooks/_approvallib.py +41 -0
  22. package/plugins/ca-pi/hooks/_artifactlib.py +61 -115
  23. package/plugins/ca-pi/hooks/_artifactpromptlib.py +12 -12
  24. package/plugins/ca-pi/hooks/_bashguardlib.py +66 -4
  25. package/plugins/ca-pi/hooks/_contextselectlib.py +38 -35
  26. package/plugins/ca-pi/hooks/_contextwriterlib.py +114 -0
  27. package/plugins/ca-pi/hooks/_host.py +1 -1
  28. package/plugins/ca-pi/hooks/_prerequisitelib.py +35 -0
  29. package/plugins/ca-pi/hooks/_provenancelib.py +107 -1
  30. package/plugins/ca-pi/hooks/_readinjectlib.py +21 -7
  31. package/plugins/ca-pi/hooks/_reconciliationlib.py +167 -2
  32. package/plugins/ca-pi/hooks/_releaselib.py +6 -6
  33. package/plugins/ca-pi/hooks/_sprintapprovallib.py +52 -2
  34. package/plugins/ca-pi/hooks/artifact-reconcile.py +13 -4
  35. package/plugins/ca-pi/hooks/hostapi.py +1 -1
  36. package/plugins/ca-pi/hooks/init-codearbiter.py +34 -5
  37. package/plugins/ca-pi/includes/artifacts-attestation.md +434 -0
  38. package/plugins/ca-pi/includes/artifacts.md +133 -492
  39. package/plugins/ca-pi/includes/author-tdd-workflow.md +32 -21
  40. package/plugins/ca-pi/includes/fresh-verification.md +14 -12
  41. package/plugins/ca-pi/includes/harvest.md +3 -3
  42. package/plugins/ca-pi/includes/reference-map.md +1 -1
  43. package/plugins/ca-pi/includes/routing-table.md +3 -3
  44. package/plugins/ca-pi/includes/sprint-authority.md +6 -1
  45. package/plugins/ca-pi/includes/verification-boundary.md +11 -2
  46. package/plugins/ca-pi/package.json +1 -1
  47. package/plugins/ca-pi/routines/INDEX.md +8 -8
  48. package/plugins/ca-pi/routines/brainstorming/SKILL.md +65 -202
  49. package/plugins/ca-pi/routines/commit-gate/SKILL.md +60 -25
  50. package/plugins/ca-pi/routines/context-check/SKILL.md +89 -53
  51. package/plugins/ca-pi/routines/context-creation/SKILL.md +114 -220
  52. package/plugins/ca-pi/routines/decompose/SKILL.md +139 -167
  53. package/plugins/ca-pi/routines/executing-plans/SKILL.md +38 -136
  54. package/plugins/ca-pi/routines/finishing-a-development-branch/SKILL.md +45 -55
  55. package/plugins/ca-pi/routines/refactor/SKILL.md +27 -12
  56. package/plugins/ca-pi/routines/release/SKILL.md +1 -1
  57. package/plugins/ca-pi/routines/subagent-driven-development/SKILL.md +80 -230
  58. package/plugins/ca-pi/routines/tdd/SKILL.md +115 -228
  59. package/plugins/ca-pi/routines/writing-plans/SKILL.md +104 -174
  60. package/plugins/ca-pi/skills/ca-audit/SKILL.md +2 -2
  61. package/plugins/ca-pi/skills/ca-checkpoint/SKILL.md +1 -1
  62. package/plugins/ca-pi/skills/ca-commit/SKILL.md +60 -25
  63. package/plugins/ca-pi/skills/ca-context-check/SKILL.md +89 -53
  64. package/plugins/ca-pi/skills/ca-create-context/SKILL.md +114 -220
  65. package/plugins/ca-pi/skills/ca-decompose/SKILL.md +139 -167
  66. package/plugins/ca-pi/skills/ca-feature/SKILL.md +21 -38
  67. package/plugins/ca-pi/skills/ca-fix/SKILL.md +15 -9
  68. package/plugins/ca-pi/skills/ca-init/SKILL.md +18 -40
  69. package/plugins/ca-pi/skills/ca-pr/SKILL.md +45 -55
  70. package/plugins/ca-pi/skills/ca-refactor/SKILL.md +27 -12
  71. package/plugins/ca-pi/skills/ca-release/SKILL.md +1 -1
  72. package/plugins/ca-pi/skills/ca-review/SKILL.md +5 -8
  73. package/plugins/ca-pi/skills/ca-sprint/SKILL.md +11 -25
  74. package/plugins/ca-pi/skills/ca-status/SKILL.md +15 -6
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: context-creation
3
- description: Build project context from an existing codebase through isolated scouts, resolve gaps, and preserve initialization gates.
3
+ description: Build source-backed project context through bounded inspection, optional agents, and safe selected writes.
4
4
  argument-hint: (none)
5
5
  ---
6
6
 
@@ -40,226 +40,106 @@ absent ones; an initialized, malformed or conflicting scaffold requires review.
40
40
  Never clear the directory, reset a marker, or replace an existing task board,
41
41
  question board or append-only audit record to make a retry pass.
42
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.
43
+ For each content document, compare the current document and provenance pair.
44
+ Missing, v1 or mismatched provenance is incomplete evidence, not proof that the
45
+ human document is disposable. Use explicit `adopt` for supported missing/v1
46
+ pairs and `update` for managed v2 pairs; preserve existing content and history.
47
+ Inspect the previous operation ID and native transaction before retrying a write
48
+ whose response was lost. Retry the identical request and operation ID, or use
49
+ native `recover` for a pending transaction. A committed result is read back and
50
+ retained. A changed human file, unknown journal or stale expected identity
51
+ requires a fresh bounded preview; never overwrite it to make a retry pass.
52
+ Resume independent outputs without claiming all documents commit atomically.
55
53
 
56
54
  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.
55
+ `CONTEXT` provenance is a committed outcome; retain it and route to normal
56
+ operation. Otherwise inspect all 13 required output identities and prepare the
57
+ native finalization preview. Recover an uncertain earlier finalization first.
58
+ Never append the marker by hand. Initialized projects use selected refresh,
59
+ with their marker and history retained.
64
60
 
65
61
  ## Phase 1 — Pre-flight confirmation · gate: BLOCK
66
62
 
67
- Confirm the repository is a brownfield codebase safe for scout-based extraction:
63
+ Confirm the repository is a brownfield codebase ready for bounded source inspection:
68
64
 
69
65
  1. Confirm `<!--INITIALIZED-->` is absent from `CONTEXT.md`.
70
66
  2. Confirm meaningful source code is present beyond the excluded set.
71
67
  3. Identify the primary source directories (`src/`, `backend/`, `frontend/`, `lib/`, `app/`, or equivalent).
72
68
 
73
- State the finding to the user: existing source detected, beginning scout-based extraction.
69
+ State the finding to the user: existing source detected, beginning bounded source inspection.
74
70
 
75
71
  Gate: `<!--INITIALIZED-->` absent AND meaningful source present. If the marker is present, stop and route to normal operation. If no meaningful source exists, stop and route to `decompose`. Neither condition met → do not proceed.
76
72
 
77
- ## Phase 2 — Scout dispatch · gate: BLOCK
78
-
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.
210
- Each reads only its assigned slice:
211
-
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`.
213
- - **Scout B — Infrastructure.** Read CI/CD config (`.github/workflows/`, `.gitlab-ci.yml`, `Jenkinsfile`, `.circleci/config.yml`), `Dockerfile*`, `docker-compose*.yml`, `Makefile`, `*.tf`, IaC. Report CI/CD platform, build/test/lint commands, deployment targets, environment names, containerization, IaC tool.
214
- - **Scout C — Architecture.** Read the source tree (names and structure only), entry points (`main.ts`, `index.ts`, `app.py`, `server.go`), and imports in entry points only. Report component list, entry points, module boundaries, architectural pattern, public interfaces.
215
- - **Scout D — Security posture.** Read auth files (`auth*`, `middleware*`, `guard*`, `jwt*`, `session*`, `oauth*`), crypto import lines, secret-loading sites (`process.env`, `os.environ`, vault/KMS call sites — paths and line numbers only, never values), `.env.example` (never `.env`). Report auth mechanism, crypto libraries, secret-loading patterns (paths + lines, no values), vault/KMS integration, hardcoded-secret risk files (paths only).
216
- - **Scout E — Testing.** Read test files and test config (`vitest.config.*`, `jest.config.*`, `pytest.ini`, Makefile test flags), coverage config. Report test framework, runner command, coverage tool, coverage thresholds in config, naming convention, approximate test count by type, fixtures.
217
- - **Scout F — Data model.** Read migration files (`migrations/`, `drizzle/`, `alembic/`, `db/migrate/`), schema definitions (`schema.ts`, `*.prisma`, `*.sql`, `models/`), ORM config, DB connection config (keys only, never credentials). Report database type, ORM/query builder, entity names, migration tool, approximate entity count, multi-tenancy patterns.
218
-
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.
220
-
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.
73
+ ## Phase 2 — Bounded inspection
74
+
75
+ Use direct bounded inspection or optional scoped agents, whichever reduces
76
+ repeated reading for this repository. Cover six logical categories for initial
77
+ or explicitly full work; a scoped refresh inspects only the selected affected
78
+ categories and retains prior coverage separately. Six categories do not require
79
+ six agents or parallel execution. Start with paths and targeted searches, then
80
+ read only the source needed to support the current claims. Keep actual host
81
+ permissions, excluded paths and secret-handling rules in force. Do not run
82
+ repository scripts merely because a manifest declares them.
83
+
84
+ When delegation helps, give each agent a finite path/category assignment,
85
+ current source identity, output limit and stopping condition. Respect the host's
86
+ actual concurrency and tool limits. Retain failed, partial and conflicting
87
+ reports; narrow an oversized assignment instead of truncating it or repeatedly
88
+ relaunching unchanged work. Direct inspection may resolve missing coverage or
89
+ check a contested claim. A role label or a read-only instruction is not evidence
90
+ of containment or independent verification. Describe the tools and boundaries
91
+ actually observed, without claiming a trusted sandbox from an agent name.
92
+ A separately required containment policy still applies to its own scope; a
93
+ repository-only profile fixture does not impose that policy on ordinary work.
94
+
95
+ The categories are:
96
+
97
+ - **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`.
98
+ - **B — Infrastructure.** Read CI/CD config (`.github/workflows/`, `.gitlab-ci.yml`, `Jenkinsfile`, `.circleci/config.yml`), `Dockerfile*`, `docker-compose*.yml`, `Makefile`, `*.tf`, IaC. Report CI/CD platform, build/test/lint commands, deployment targets, environment names, containerization, IaC tool.
99
+ - **C — Architecture.** Read the source tree (names and structure only), entry points (`main.ts`, `index.ts`, `app.py`, `server.go`), and imports in entry points only. Report component list, entry points, module boundaries, architectural pattern, public interfaces.
100
+ - **D — Security posture.** Read auth files (`auth*`, `middleware*`, `guard*`, `jwt*`, `session*`, `oauth*`), crypto import lines, secret-loading sites (`process.env`, `os.environ`, vault/KMS call sites — paths and line numbers only, never values), `.env.example` (never `.env`). Report auth mechanism, crypto libraries, secret-loading patterns (paths + lines, no values), vault/KMS integration, hardcoded-secret risk files (paths only).
101
+ - **E — Testing.** Read test files and test config (`vitest.config.*`, `jest.config.*`, `pytest.ini`, Makefile test flags), coverage config. Report test framework, runner command, coverage tool, coverage thresholds in config, naming convention, approximate test count by type, fixtures.
102
+ - **F — Data model.** Read migration files (`migrations/`, `drizzle/`, `alembic/`, `db/migrate/`), schema definitions (`schema.ts`, `*.prisma`, `*.sql`, `models/`), ORM config, DB connection config (keys only, never credentials). Report database type, ORM/query builder, entity names, migration tool, approximate entity count, multi-tenancy patterns.
103
+
104
+
105
+ Keep a source-bound evidence inventory: category, searched scope and predicates,
106
+ claim, path/line citation, content or membership digest and its method, and
107
+ observed/inferred/unknown status. Preserve the difference between
108
+ `git-blob-normalized-sha1` and `sha256-raw`. A source hash binds bytes; it does
109
+ not verify a claim's meaning. Never forward secret values. Negative findings
110
+ state where and how the search ran, not universal absence.
111
+
112
+ `_contextreportlib.admit_scout_attempt` and `join_scout_reports` remain useful
113
+ for bounded structured agent reports when that transport is used. They validate
114
+ report shape and declared coverage, not permission, containment or semantic
115
+ truth. A scoped join has `full_coverage: false`; do not relabel it as a full
116
+ scan. Plain evidence from direct inspection needs the same truthful scope and
117
+ source bindings, without a synthetic scout envelope or delivery ticket.
118
+
119
+ Proceed with supported claims and explicit gaps. A full run accounts for all
120
+ six logical categories, including justified inapplicability and named unknowns;
121
+ failed or missing work never counts as inspected coverage. Recheck changed
122
+ sources before a dependent write. Independent work can continue while a
123
+ material unresolved fact or actual decision is addressed.
244
124
 
245
125
  ## Phase 3 — Synthesis · gate: BLOCK
246
126
 
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
127
+ Draft the five content documents from current inspection evidence and any
128
+ agent reports. For initial or explicitly full onboarding, account for all six
129
+ logical domains; a scoped refresh changes only its
250
130
  declared affected domains and makes no new full-coverage claim. Map source to
251
131
  destination:
252
132
 
253
- | Scout source | Destination |
133
+ | Evidence category | Destination |
254
134
  |---|---|
255
135
  | Stack, infrastructure/commands, tests/verification | `tech-stack.md` |
256
- | Architecture/source ownership, tests/structure | `coding-standards.md` |
136
+ | Architecture/source ownership, tests/structure | `coding-standards.md` and `code-map.md` |
257
137
  | Security boundaries | `security-controls.md` (thin) |
258
138
  | Stack/release candidates | `.codearbiter/release-targets.md` when supported |
259
139
  | All applicable domains | `CONTEXT.md` (project identity, purpose, scope, NOT-building) |
260
140
 
261
141
  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.
142
+ (or a specific retention reason), with its citation and source snapshot.
263
143
  Separate observed, inferred, proposed and approved content. Keep command
264
144
  declarations inert, with their actual cwd and declared/verified state: never convert a package script into a passed verification. Keep unsupported fields
265
145
  unknown; make no blanket security claim from absence. Confidence describes
@@ -277,13 +157,12 @@ without manufacturing a local decision. If an upstream rule conflicts with a
277
157
  local constraint, keep both citations for Phase 4 and do not silently displace
278
158
  either. There is no new task or ADR from an observed pattern.
279
159
 
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
160
+ Distinguish evidence availability from category outcome. Record `observed`,
161
+ `not_applicable`, `not_found_in_scope`, `not_inspected` or `ambiguous` with its
162
+ scope and reason; failed or oversized reports are gaps, not evidence of absence.
163
+ A `not_found_in_scope` records its searched scope and predicates; it does not
164
+ prove universal absence. In a small static project with known tests and
165
+ justified no-storage evidence, ask no database question for a scoped test
287
166
  change. Keep partial-domain uncertainty visible, but ask the user only if a
288
167
  missing decision affects the current output or selected task.
289
168
 
@@ -312,15 +191,15 @@ latest-eligible: true
312
191
 
313
192
  Gate: every surviving doc drafted with supported claims and explicit material
314
193
  unknowns. No silent omission, invented approval or invented verification. A
315
- domain with no scout signal has its coverage and uncertainty represented in the
194
+ domain with no observed evidence has its coverage and uncertainty represented in the
316
195
  relevant draft; it does not force an irrelevant interview or an empty file.
317
196
 
318
197
  ## Phase 4 — Gap interview · gate: BLOCK
319
198
 
320
199
  First reconcile contradictory reports without picking the highest confidence:
321
200
  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
201
+ of the disputed source, predicate and snapshot using direct inspection or an
202
+ independent agent when useful. A changed or missing source snapshot requires
324
203
  fresh evidence. If the conflict survives, expose both claims and the precise
325
204
  choice requiring a user ruling; do not overwrite either source.
326
205
 
@@ -349,7 +228,7 @@ solvable work is not held by an irrelevant domain interview.
349
228
 
350
229
  ## Phase 5 — Project-state write · gate: BLOCK
351
230
 
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:
231
+ Prepare the five content documents with the installed writer's `context-preview`, actual source evidence and file-specific provenance. Inspect the proposed diff and source bindings, then use `context-apply` with `preview_ref` and `preview_sha256` under the existing authorization. No document approval receipt or qualified agent profile is required. Preserve existing human content and ownership; review uncertain or consequential claims independently when useful, without treating a review label as proof. Every doc carries actual content — no unresolved placeholder may remain where a value was determined:
353
232
 
354
233
  | File | Content |
355
234
  |---|---|
@@ -376,13 +255,15 @@ Write the file, then:
376
255
  rm -f "$(git rev-parse --show-toplevel)/.codearbiter/.markers/release-targets-authoring"
377
256
  ```
378
257
 
379
- Skip both commands entirely when this run is not writing `release-targets.md` — a marker minted for a write that never happens is a 30-minute window nothing needed. No other file in the table above is enrolled, so none of them take a marker.
258
+ Skip both commands when this run is not writing `release-targets.md`. No other
259
+ table entry uses this release-target marker; content documents use the native
260
+ paired writer, and task/question/audit history retains its existing owners.
380
261
 
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.
262
+ If inspection finds existing decision records (`docs/decisions/`, `adr/`), reference their source and actual status. Do not create local ADRs or infer acceptance from their existence. Keep an unparseable record as a cited uncertainty; a new local decision belongs to its actual owner.
382
263
 
383
264
  **Provenance and code-map:**
384
265
 
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.
266
+ - 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 an actual user decision. Never write either side of this pair directly.
386
267
  - 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.
387
268
 
388
269
  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.
@@ -393,22 +274,35 @@ Gate: all five content documents and their matching v2 provenance pairs are pres
393
274
 
394
275
  Lock the project state as initialized and return to normal orchestration:
395
276
 
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`.
399
-
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.
277
+ 1. Run `python3 "<plugin-root>/hooks/init-codearbiter.py" --root "<project-root>" --context-finalize`.
278
+ The bridge binds the five content documents, their five v2 provenance records,
279
+ and `open-tasks.md`, `open-questions.md`, `overrides.log` to their exact identities.
280
+ Native `context-finalize-preview` validates those 13 outputs and their current
281
+ source bindings before proposing the marker and updated provenance.
282
+ 2. Inspect that preview and apply its `preview_ref` and `preview_sha256` through
283
+ the same bridge. The writer rechecks current identities under its lock and
284
+ commits the marker and matching `CONTEXT` provenance together. No separate
285
+ approval reply is needed. A stale, malformed or missing input remains a
286
+ precise refusal; do not append the marker or bypass the writer.
287
+ 3. Read back the committed files. Report which categories were inspected,
288
+ remaining unknowns, documents changed and actual checks. The marker records
289
+ completed population; it is not a certification of semantic truth, host
290
+ enforcement or test success. Return to normal authorized work.
291
+
292
+ Completion: the native transaction reports committed, the activation flag and
293
+ standalone body marker are present, and the required outputs remain valid.
294
+ Valid empty boards and a zero-event audit header satisfy their real contracts.
295
+ Existing initialized repositories use refresh; never remove their marker to
296
+ repeat onboarding.
401
297
 
402
298
  ## Hard rules
403
299
 
404
300
  - MUST NOT finalize while any `[CONFIRM-NN]` is unaddressed — every gap must be resolved or explicitly deferred to `open-questions.md` first.
405
301
  - MUST NOT resolve a `[CONFIRM-NN]` by guessing — surface the question to the user or defer it.
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.
410
- - MUST NOT run Phase 2 inline — isolated scout subagents are required for the report-only synthesis boundary.
411
- - MUST NOT load raw source into the orchestrator context after Phase 1 — synthesize from scout reports only.
302
+ - Account for all six logical categories on initial or explicitly full work;
303
+ scoped refresh covers its selected categories without claiming a new full scan.
304
+ - Do not claim host containment, independent review or verified semantics from
305
+ an agent label, report shape, source digest or artifact write.
412
306
  - MUST NOT record a scout finding that exposes a secret value — paths and line numbers only.
413
307
  - MUST NOT scaffold a cut doc — see `<plugin-root>/includes/cut-docs.md` for the canonical never-scaffold list. Maturity is the `stage:` frontmatter number in `CONTEXT.md`.
414
308
  - MUST NOT run when `CONTEXT.md` already carries `<!--INITIALIZED-->` — stop and route to normal operation.