@arbiterforge/ca-pi 0.18.4 → 0.20.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 (80) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/plugins/ca-pi/CHANGELOG.md +63 -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 +44 -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/grader.md +5 -4
  11. package/plugins/ca-pi/agents/infra-author.md +6 -7
  12. package/plugins/ca-pi/agents/scout.md +25 -24
  13. package/plugins/ca-pi/arbiter.md +6 -4
  14. package/plugins/ca-pi/generated/command-catalog.json +5 -5
  15. package/plugins/ca-pi/helpers/artifacts/ca-artifact-darwin-amd64 +0 -0
  16. package/plugins/ca-pi/helpers/artifacts/ca-artifact-darwin-arm64 +0 -0
  17. package/plugins/ca-pi/helpers/artifacts/ca-artifact-linux-amd64 +0 -0
  18. package/plugins/ca-pi/helpers/artifacts/ca-artifact-linux-arm64 +0 -0
  19. package/plugins/ca-pi/helpers/artifacts/ca-artifact-windows-amd64.exe +0 -0
  20. package/plugins/ca-pi/helpers/artifacts/ca-artifact-windows-arm64.exe +0 -0
  21. package/plugins/ca-pi/helpers/artifacts/release.json +37 -37
  22. package/plugins/ca-pi/hooks/_approvallib.py +41 -0
  23. package/plugins/ca-pi/hooks/_artifactlib.py +61 -115
  24. package/plugins/ca-pi/hooks/_artifactpromptlib.py +12 -12
  25. package/plugins/ca-pi/hooks/_bashguardlib.py +66 -4
  26. package/plugins/ca-pi/hooks/_contextselectlib.py +38 -35
  27. package/plugins/ca-pi/hooks/_contextwriterlib.py +114 -0
  28. package/plugins/ca-pi/hooks/_host.py +1 -1
  29. package/plugins/ca-pi/hooks/_prerequisitelib.py +35 -0
  30. package/plugins/ca-pi/hooks/_provenancelib.py +107 -1
  31. package/plugins/ca-pi/hooks/_readinjectlib.py +21 -7
  32. package/plugins/ca-pi/hooks/_reconciliationlib.py +167 -2
  33. package/plugins/ca-pi/hooks/_releaselib.py +6 -6
  34. package/plugins/ca-pi/hooks/_sprintapprovallib.py +52 -2
  35. package/plugins/ca-pi/hooks/artifact-reconcile.py +13 -4
  36. package/plugins/ca-pi/hooks/hostapi.py +1 -1
  37. package/plugins/ca-pi/hooks/init-codearbiter.py +34 -5
  38. package/plugins/ca-pi/includes/artifacts-attestation.md +434 -0
  39. package/plugins/ca-pi/includes/artifacts.md +138 -492
  40. package/plugins/ca-pi/includes/author-tdd-workflow.md +32 -21
  41. package/plugins/ca-pi/includes/fresh-verification.md +14 -12
  42. package/plugins/ca-pi/includes/harvest.md +3 -3
  43. package/plugins/ca-pi/includes/reference-map.md +1 -1
  44. package/plugins/ca-pi/includes/routing-table.md +3 -3
  45. package/plugins/ca-pi/includes/smarts/core.md +93 -17
  46. package/plugins/ca-pi/includes/smarts/lenses.md +115 -0
  47. package/plugins/ca-pi/includes/sprint-authority.md +6 -1
  48. package/plugins/ca-pi/includes/verification-boundary.md +11 -2
  49. package/plugins/ca-pi/package.json +1 -1
  50. package/plugins/ca-pi/routines/INDEX.md +8 -8
  51. package/plugins/ca-pi/routines/brainstorming/SKILL.md +71 -202
  52. package/plugins/ca-pi/routines/commit-gate/SKILL.md +60 -25
  53. package/plugins/ca-pi/routines/context-check/SKILL.md +89 -53
  54. package/plugins/ca-pi/routines/context-creation/SKILL.md +114 -220
  55. package/plugins/ca-pi/routines/debug/SKILL.md +1 -0
  56. package/plugins/ca-pi/routines/decision-variance/references/analysis.md +5 -2
  57. package/plugins/ca-pi/routines/decompose/SKILL.md +139 -167
  58. package/plugins/ca-pi/routines/executing-plans/SKILL.md +38 -136
  59. package/plugins/ca-pi/routines/finishing-a-development-branch/SKILL.md +45 -55
  60. package/plugins/ca-pi/routines/refactor/SKILL.md +33 -12
  61. package/plugins/ca-pi/routines/release/SKILL.md +1 -1
  62. package/plugins/ca-pi/routines/subagent-driven-development/SKILL.md +88 -230
  63. package/plugins/ca-pi/routines/tdd/SKILL.md +115 -228
  64. package/plugins/ca-pi/routines/writing-plans/SKILL.md +112 -174
  65. package/plugins/ca-pi/skills/ca-audit/SKILL.md +2 -2
  66. package/plugins/ca-pi/skills/ca-checkpoint/SKILL.md +1 -1
  67. package/plugins/ca-pi/skills/ca-commit/SKILL.md +60 -25
  68. package/plugins/ca-pi/skills/ca-context-check/SKILL.md +89 -53
  69. package/plugins/ca-pi/skills/ca-create-context/SKILL.md +114 -220
  70. package/plugins/ca-pi/skills/ca-debug/SKILL.md +1 -0
  71. package/plugins/ca-pi/skills/ca-decompose/SKILL.md +139 -167
  72. package/plugins/ca-pi/skills/ca-feature/SKILL.md +28 -38
  73. package/plugins/ca-pi/skills/ca-fix/SKILL.md +21 -9
  74. package/plugins/ca-pi/skills/ca-init/SKILL.md +18 -40
  75. package/plugins/ca-pi/skills/ca-pr/SKILL.md +45 -55
  76. package/plugins/ca-pi/skills/ca-refactor/SKILL.md +33 -12
  77. package/plugins/ca-pi/skills/ca-release/SKILL.md +1 -1
  78. package/plugins/ca-pi/skills/ca-review/SKILL.md +5 -8
  79. package/plugins/ca-pi/skills/ca-sprint/SKILL.md +11 -25
  80. package/plugins/ca-pi/skills/ca-status/SKILL.md +15 -6
@@ -1,494 +1,140 @@
1
- # Typed HTML specifications and plans
2
-
3
- Load inside the existing brainstorming, planning, TDD, execution or resume
4
- workflow for new full-lane work or an existing HTML pair.
5
- This leaf adds no slash command, agent, skill registration or persistent model
6
- tool.
7
-
8
- **Default authoring boundary:** new full feature and sprint spec/plan pairs
9
- default to canonical `.html`. Check the installed capability before writing; a
10
- missing, invalid, mismatched or unqualified capability is a STOP and
11
- the workflow must not fall back to Markdown or create any fallback artifact.
12
- Report `CAPABILITY_MISSING` and direct the user to repair or reinstall the pinned
13
- artifact payload before retrying. The payload ships only through the release
14
- channels: Claude Code `/plugin marketplace update codearbiter` then
15
- `/plugin update ca@codearbiter`; Codex the `ca-codex-marketplace` ref; Pi
16
- `pi install npm:@arbiterforge/ca-pi`. A main-branch checkout never carries it. An existing `.md` exact pair remains Markdown
17
- and continues on the legacy path without automatic conversion. The feature
18
- small lane remains an inline mini-spec and creates no artifact. HTML `--farm`
19
- dispatch remains disabled and outside this rollout.
20
-
21
- ## Installed host admission
22
-
23
- Before new full-lane or plan authoring, the bridge checks the exact installed
24
- host's required producers, helpers, reviewer charter where applicable, and
25
- platform-specific hook registrations. `_select_authoring_route` and
26
- `_preflight_plan_authoring` require this read-only preflight in addition to the
27
- native engine capability. `HOST_WORKFLOW_UNAVAILABLE` stops before authoring;
28
- repair the installed package or use a supported host. Never create a fallback
29
- artifact, substitute another package, or mint an authority event to proceed.
30
-
31
- `ArtifactClient.workflow_preflight()` reports only installed resources. It does
32
- not prove host trust, enabled hooks, supported host-version behavior, reviewer
33
- independence, or a completed live workflow. Actual authority producers and their
34
- existing validation remain required. Pi currently fails this admission check;
35
- existing Markdown pairs and the inline small feature lane are unchanged.
36
-
37
- ## Internal execution contract
38
-
39
- The normal qualified package's installation-owned `release.json` pins the native
40
- executable bytes. The stdlib
41
- `hooks/_artifactlib.py` bridge selects only that verified installed payload,
42
- never PATH, an environment-selected binary or a path supplied by the project.
43
- The existing host's governed execution mechanism and permissions remain
44
- applicable. An absent payload or denied invocation is a capability gap to
45
- surface, not permission to bypass the gate.
46
-
47
- Use one operation with JSON on stdin:
48
-
49
- ```text
50
- ca-artifact <operation> --root <project-root> --request -
51
- ```
52
-
53
- Requests carry `protocol: codearbiter.artifact-api/0.1.0`. Query `schema` for the
54
- needed operation or record fragment only; do not preload complete schemas. Return
55
- stdout is a single bounded JSON envelope. Nonzero exits are failures except the
56
- structured `validate` response explicitly reporting `valid: false` (also a gate
57
- failure). Logs/stderr are not artifact content.
58
-
59
- ## Authoring and approval
60
-
61
- New full-lane specs and plans use `.codearbiter/specs/<slug>.html` and
62
- `.codearbiter/plans/<slug>.html`. Create a draft, then use typed `apply` changes;
63
- do not write or regex-edit HTML or its embedded JSON. `record.add` allocates a
64
- stable ID when omitted. Keep criterion IDs from the spec in plan references;
65
- never assign a second criterion ledger. Use `record.update` and explicit
66
- retirement reasons. There is no generic status/approval update.
67
-
68
- Drafts may be incomplete. `validate` with `gate: ready` is required before review.
69
- It checks types, references, scope coverage, contracts and task definitions—not
70
- semantic truth. Retain the existing negative-intent question, adversarial review,
71
- ADR compatibility review, open-question handling, harvest and user/SMARTS gates.
72
- One criterion may need multiple tests. Never invent a condition, oracle, source,
73
- command, result, approval or reviewer to satisfy a required field.
74
-
75
- Before requesting review or approval of a plan, use the private
76
- `_approvallib._preflight_plan_verification(client, identity)` with its current engine identity.
77
- It checks all task verification definitions through complete bounded engine reads
78
- and collects the current source-input snapshot, reporting every unsupported
79
- command and any input-policy failure together. Both ordinary and initial paired
80
- approval arming enforce this check. No declared command, test discovery, or test
81
- module is executed or imported. Proposed test files and names may be absent;
82
- the installed collector still has to support the proposed runner's output format.
83
- Missing package-script definitions cannot establish a runner contract: declare a
84
- supported direct runner or supply the reviewed script definition first. Runtime
85
- executable/workspace binding and fresh named-result evidence remain required.
86
-
87
- `verification_inputs.roots` and `exclude_directories` use exact slash-separated
88
- repository-relative paths. Exclusions are directory paths, not globs or basename
89
- matches and not relative to an individual root. For root `site`, a generated
90
- dependency exclusion is `site/node_modules`, not `node_modules`. Review each
91
- excluded output directory explicitly: the plan's roots and exclusions narrow
92
- the ship set. In a git work tree `.gitignore` already keeps untracked ignored
93
- files out of it; outside git nothing is filtered, so exclude generated
94
- directories explicitly.
95
- An exclusion outside all selected roots is rejected as ineffective. Overlapping
96
- roots cannot reinclude an excluded directory. Roots must exist before execution;
97
- use an existing containing directory for a planned new file so its creation
98
- changes the snapshot. An oversized included file is reported with its path and
99
- the 32 MiB per-file limit; revise the explicit policy rather than increasing the
100
- limit or excluding source/test/governance inputs needed for the task.
101
-
102
- Snapshot input identity is ship-set membership. In a git work tree the members
103
- are the git index entries present on disk, plus untracked non-ignored files
104
- within the plan's roots, minus its excludes. The one fixed exemption is
105
- `.codearbiter/gate-events.log`: it is never counted, whatever the plan says, and
106
- stays tracked as the audit trail; every other `.codearbiter` path still counts.
107
- Outside git, membership is read from the filesystem (`membership: filesystem`);
108
- the root must be the top level of its work tree, so a subdirectory root counts as
109
- outside git. A failed git probe fails closed with `INPUT_MEMBERSHIP_UNAVAILABLE`. An unmerged
110
- git index (conflicted paths) makes a snapshot fail closed until it is resolved.
111
- The manifest format is `codearbiter.verification-inputs/0.2.0`; receipts bound to
112
- a 0.1.0 manifest read as stale. Each evidence object is validated at most once
113
- per operation and scans are bounded; raw reads are reused only up to a 64 MiB
114
- per-operation retained-byte budget, past which an object can be read again, but
115
- validation is never skipped.
116
-
117
- The existing user, SMARTS, reviewer, or verification boundary must first persist
118
- its actual policy-owned workflow event as canonical JSON in the reserved
119
- content-addressed authority-source store. Interactive prompt approval currently
120
- has production host seams in Claude Code and Codex. Pi 1.0.0 exposes an `input`
121
- event, but codeArbiter has no Pi-native authority adapter. Under Pi do not arm this
122
- adapter; the workflow remains blocked until that adapter is
123
- implemented. On Claude Code or Codex, arm the exact current artifact immediately
124
- before asking the approval question:
125
-
126
- ```sh
127
- python "<plugin-root>/hooks/_approvallib.py" arm --root "<project-root>" --artifact-id <artifact-id>
128
- ```
129
-
130
- On Claude Code, when the result carries `ask_envelope`, pass it unchanged as the
131
- entire AskUserQuestion input (no `answers`, `annotations` or other field): the
132
- user approves by clicking its Approve option, and the host-observed selection is
133
- applied with origin `claude:AskUserQuestion:<session>`. Otherwise, or if the
134
- user prefers typing, present the returned `short_reply` (a four-character code
135
- such as `approve K7MQ`); the full `reply` is also accepted, and you
136
- require that exact reply: the hook tolerates surrounding whitespace, invisible characters, a code
137
- fence or quotes and a closing period, but nothing else in the message, and it
138
- reports a mismatch instead of staying silent. The `UserPromptSubmit` hook
139
- rechecks the armed identity, records the full armed reply as the host-observed
140
- policy-owned source, captures its receipt, and applies approval. An ordinary
141
- `yes`, a changed artifact, a wrong or expired code, a reply inside other text, or
142
- a model-authored event does not confer authority. On the next turn, verify `validate` at the `approved`
143
- gate before continuing. If the user declines or the artifact changes, cancel the
144
- exact pending request before arming another one:
145
-
146
- ```sh
147
- python "<plugin-root>/hooks/_approvallib.py" cancel --root "<project-root>" --artifact-id <artifact-id>
148
- ```
149
-
150
- Cancellation records no authority. Other workflow authorities must use their
151
- corresponding host-owned adapters. Legacy `capture` events remain readable for
152
- inventory but are inspection-only: the engine refuses to wrap them in a current
153
- receipt. Current authority requires `capture-observation` over a closed producer
154
- profile and engine-issued evidence context; never create an authority source
155
- merely to satisfy an artifact transition. `approve` checks the resulting receipt
156
- against current ready content. A missing or changed receipt, captured event, or
157
- still-present policy source returns `AUTHORITY_UNVERIFIED`. Receipt format 0.1.0
158
- remains readable for inspection after upgrade but is not authority-bearing; the
159
- applicable policy boundary must produce a fresh 0.2.0 attestation before further
160
- approval, dispatch, acceptance, commit proof, or finalization. This is the
161
- repository's cooperative same-user attestation model, not cryptographic identity
162
- proof or protection from an unrestricted same-user filesystem writer.
163
-
164
- For ordinary sequential planning, create a plan as `draft_preview`, consume existing criterion IDs,
165
- then `plan-bind` to the approved spec and approve the plan through its existing workflow. Initial
166
- combined HTML sprint review uses the explicit paired path below instead of separate approvals.
167
- A normative change invalidates its approval. Rebinding is explicit and preserves
168
- history; it does not waive coverage or permit silent reinterpretation.
169
-
170
- When adversarial review revises a ready initial draft spec after its draft plan exists,
171
- query both current identities. The installed engine's explicit `plan-bind` request with
172
- `binding_mode: draft_preview` requires the plan's existing `expected` CAS and the spec's
173
- `spec_expected` revision/model CAS. It rebinds only that same-ID, same-slug initial pair:
174
- both artifacts must remain unapproved drafts, tasks pending and unevidenced, prerequisites
175
- unsatisfied and unevidenced, and scopes empty. Optional typed plan corrections must leave
176
- both drafts fully ready. The binding remains `draft_preview`; this operation grants no
177
- approval, delegation, prerequisite satisfaction, execution or acceptance. Revalidate both
178
- current drafts, repeat the affected review and arm the exact combined approval afterward.
179
- Inspect the installed operation schema first. An engine without this explicit draft
180
- request reports a capability gap; never edit HTML, recreate the pair, substitute sequential
181
- approval or use ordinary approved-source `plan-bind` to repair it.
182
-
183
- ## Initial sprint pair and delegated methods
184
-
185
- Only when preparing initial combined approval, replaying an observed reply, or revising a task's
186
- method under its existing grant, load `<plugin-root>/includes/sprint-authority.md`. That private
187
- card owns the `arm-sprint` / `resume-sprint` / `smarts` bridge and the native pair/method operations.
188
- Do not bulk-load it for ordinary task reads. Scoring is not consent; the initial observed user reply,
189
- protected scope, real producer, current evidence and existing security/permission gates remain required.
190
-
191
- ## Reading and dispatch
192
-
193
- Use `index`, then `outline`, then symbol-scoped `read`. Exact reads are explicitly
194
- context-incomplete. Execution uses contextual pages; follow every `next_cursor`
195
- until `context_complete: true`, and retain the final context ticket. Cursors bind
196
- both documents and contributing receipts/events. No partial record is silently
197
- returned. A stale cursor/ticket requires a fresh read.
198
-
199
- These cursors and tickets name engine-written, content-addressed cooperative
200
- delivery receipts. They are not authentication secrets and do not claim
201
- resistance to an unrestricted same-user filesystem writer. A digest without its
202
- corresponding engine-written receipt is rejected.
203
-
204
- Before task selection, inspect the plan's exact prerequisite records. If one is
205
- unsatisfied, collect and present the facts needed to judge its requirement; a
206
- verification runner may supply facts but cannot confer prerequisite authority.
207
- On Claude Code or Codex, arm a genuine user-workflow decision for the exact
208
- current approved plan and prerequisite:
209
-
210
- ```sh
211
- python "<plugin-root>/hooks/_prerequisitelib.py" arm --root "<project-root>" --artifact-id <artifact-id> --prerequisite-id <prerequisite-id>
212
- ```
213
-
214
- Show the returned title, requirement, review-packet digest, and `expires_at_utc`
215
- deadline. The request and its reply code expire together 24 hours after arming.
216
- Require the returned `short_reply` (`satisfy-prerequisite <code>`) or the full `reply`, with
217
- the same tolerance and mismatch reporting as approval. The `UserPromptSubmit` hook
218
- durably records that observed decision before publishing its authority source,
219
- captures a prerequisite receipt, and applies the existing prerequisite CAS
220
- operation. Its final nonce is non-secret freshness/correlation data, not a
221
- credential: possession alone confers no authority, and only the exact prompt
222
- observed at the trusted host boundary while the reviewed plan remains current
223
- can satisfy the prerequisite. Wrong nonces or records, stale plan content or
224
- approval, and expired requests confer no authority. A retry after confirmation reuses the same event,
225
- receipt, operation ID, and mutation request; it never reconstructs a decision.
226
- Only an unconfirmed request can be cancelled:
227
-
228
- ```sh
229
- python "<plugin-root>/hooks/_prerequisitelib.py" cancel --root "<project-root>" --artifact-id <artifact-id> --prerequisite-id <prerequisite-id>
230
- ```
231
-
232
- If the plan changes after confirmation, recover the obsolete request instead of
233
- deleting its marker. `supersede` first proves the current identity differs. For
234
- a captured request it also retries the exact operation ID: a committed replay is
235
- accepted, while only an engine `REVISION_CONFLICT` proves the obsolete mutation
236
- did not commit and permits the marker to clear. Published source and receipt
237
- files remain as evidence:
238
-
239
- ```sh
240
- python "<plugin-root>/hooks/_prerequisitelib.py" supersede --root "<project-root>" --artifact-id <artifact-id> --prerequisite-id <prerequisite-id>
241
- ```
242
-
243
- The adapter fixes `authority_kind: user_workflow` and `verdict: satisfied`;
244
- there is no caller-selected authority or bulk-satisfaction path. SMARTS prerequisite satisfaction remains unsupported; the plan-method producer below does not
245
- grant prerequisite, security, backend or publication authority. Pi has no
246
- prerequisite-capture adapter and must remain blocked. Do not infer eligibility from one satisfied prerequisite:
247
- rerun `eligible`, and resolve each remaining record independently against the
248
- new current plan identity.
249
-
250
- `eligible` is authoritative for task selection on the HTML path.
251
- `task-start` checks current spec/plan approval, binding, prerequisites, source
252
- snapshot, dependency evidence and the complete context ticket. Within a checkpoint,
253
- a predecessor in `REVIEW` can provisionally unblock its dependent after fresh
254
- verification and spec review. Across checkpoints, dependencies require accepted
255
- scope evidence. Provisional progress never counts as completion.
256
-
257
- The orchestrator executes the declared verification through its existing governed
258
- execution tool through the installed production authority adapter; it never
259
- constructs a successful workflow event itself. Arm an exact task request first.
260
- Verification and review authority below is supported on Codex and Claude Code.
261
- On Pi, stop at this boundary rather than treating model-authored results as
262
- authority; its installed prompt approval seam does not imply verification or
263
- review support.
264
- Every distinct `cwd` label in the engine context must be mapped once to an exact
265
- linked Git worktree root. Mapped worktrees must share the artifact repository's
266
- Git common directory, and the adapter freezes their filesystem identity, HEAD,
267
- status digest, effective argv, and executable bytes:
268
-
269
- ```sh
270
- python "<plugin-root>/hooks/artifact-authority.py" arm --root "<project-root>" --artifact-id <plan-id> --record-id <task-id> --activity verification --workspace "candidate worktree=<absolute-worktree>" --workspace "baseline-evidence worktree=<absolute-worktree>"
271
- ```
272
-
273
- Use only the mappings actually named by that task; missing or extra labels fail
274
- closed. Run the returned request through one plain governed exec invocation (no
275
- compound shell expression), then publish only after the host's matching
276
- `PostToolUse` has corroborated the wrapper's completed request-bound result:
277
-
278
- ```sh
279
- python "<plugin-root>/hooks/artifact-authority.py" verify --root "<project-root>" --request-id <request-id>
280
- python "<plugin-root>/hooks/artifact-authority.py" publish --root "<project-root>" --request-id <request-id>
281
- ```
282
-
283
- The verifier launches exact engine-declared argv without a shell, supervises the
284
- whole process tree, bounds output, requires exact named outcomes, and rejects
285
- workspace or executable drift. If an attempt is interrupted, use the adapter's
286
- `recover` operation to retain it as failed or abandoned; never rerun an uncertain
287
- attempt under the same request.
288
-
289
- Named Playwright commands require `test --reporter=json`; each required name must
290
- equal a unique native `spec.title`. Named Vitest commands require
291
- `run --reporter=verbose`; use the complete rendered `suite > case` identity after
292
- the filename, not a leaf-name alias. Named unittest commands require `-v` or
293
- `--verbose`. A passing row cannot conceal a duplicate, skip, failure or retry.
294
- Plain exit checks cannot attest named tests.
295
-
296
- Named npm commands support inspectable single-runner scripts, a contained
297
- repository-relative `--prefix`, and arguments forwarded after `--`. A root script
298
- may delegate once through `npm -w <name> run <script>` or
299
- `npm --workspace <name> run <script>` when the name resolves uniquely in an array
300
- of at most 32 explicit, contained workspace directories. The runner binds the root
301
- manifest and every inspected workspace manifest. Globs, linked directories,
302
- multiple workspace selectors and recursive npm delegation are unsupported.
303
- Workspace delegation uses the declared cwd; a non-dot `--prefix` is unsupported
304
- for this shape.
305
- Preserve both npm argument boundaries when adding a reporter: for a root
306
- `test:client` script containing `npm -w @example/client run test`, declare
307
- `npm run test:client -- -- --reporter=verbose` to forward the reporter to Vitest.
308
- The original root command still executes the full script. Compound
309
- scripts and pre/post lifecycle scripts require separately declared direct-runner
310
- commands; retain every check from the original suite when splitting commands.
311
- On Windows, only the qualified standard `npm.cmd` layout is adapted: the runner
312
- pins the wrapper, sibling `node.exe`, sibling `node_modules/npm/bin/npm-cli.js`,
313
- and script manifest. It deliberately selects that sibling CLI rather than the
314
- shim's optional global-prefix redirection. Unknown batch wrappers fail closed.
315
- For workspace delegation, it also pins `npm-prefix.js` and checks that the nested
316
- wrapper uses the same CLI, the default script shell, and no configured Node
317
- options. Local executables shadowing nested npm are rejected.
318
- Direct Node script entrypoints are also pinned. These launch-file bindings do
319
- not establish transitive dependency closure for deliberately excluded inputs.
320
-
321
- New observations use the closed `declared-command/0.3.0` producer profile to
322
- retain collector and launch-file identities plus an engine-produced normalized
323
- completion closure. Raw workspace fingerprints must still match before and
324
- after command execution. Historical `0.1.0` and `0.2.0` bindings retain their
325
- original contracts and cannot be relabelled as newer evidence.
326
-
327
- For `spec_review` or `quality_review`, arm the corresponding activity without
328
- workspace mappings and dispatch the returned `launch_envelope` unchanged to one
329
- fresh host subagent. The bounded prompt names the retained, content-addressed
330
- evidence context instead of embedding its full input manifest. The reviewer
331
- must read that context and inspect its subject, coverage and source inputs.
332
- The adapter verifies the context's canonical bytes and digest before launch and
333
- publication; a missing or changed context blocks authority. Never shorten or
334
- rewrite the returned envelope yourself.
335
- The host hooks bind the exact launch call, child start and
336
- the child's first stop; a pasted or coordinator-authored decision is not review
337
- authority.
338
-
339
- When reviewing completed work that relies on a verification run, linked
340
- worktrees or supporting evidence, explicitly select the completion path. Add
341
- `--completion-receipt <exact-published-receipt>` once per task and
342
- `--supporting-file <absolute-regular-file>` for each supporting document to the
343
- review `arm` command. A task review selects one verification receipt; a scope
344
- review selects the exact receipt for every member. Supporting files require a
345
- receipt selection. The existing review-before-verification path remains
346
- available; it does not satisfy an explicitly requested completion review.
347
-
348
- The native engine validates the selected published verification chain and
349
- derives the worktree mappings from its qualified observation. It retains the
350
- selected identities, worktree closure and supporting bytes in the immutable
351
- context. Supporting material is data for review, not authority. Selection is
352
- explicit: no newest-receipt search, directory import or attachment execution.
353
- At most 16 regular files are admitted, each at most 64 KiB and together at most
354
- 256 KiB; links, reparse indirection, duplicate paths and changed content fail
355
- closed. Read canonical spec and plan artifacts through the native artifact API;
356
- they cannot be imported as supporting files. The generated prompt directs the reviewer to assess performed work
357
- against each criterion, step and `done_when` obligation, using selected evidence
358
- and source references. A consistent plan or an empty diff is insufficient.
359
-
360
- Use the returned `completion_sha256` in the native `task-review` or
361
- `accept-scope` request. The completed review and its exact verification run must
362
- agree; a definition-only review or a different successful run is rejected.
363
- The recorded task selection remains required by downstream freshness and scope
364
- acceptance. Scope review uses validated task completion bindings. If verification
365
- is rerun, obtain and record its completed task review before selecting that run
366
- for scope review; do not infer equivalence between receipts.
367
-
368
- Creating a completion context for a `0.3.0` verification recomputes the normalized
369
- worktree closure bound during that verification. Only validated native outputs
370
- and execution bookkeeping are normalized; their publication must not invalidate
371
- unchanged source. Historical `0.2.0` verification retains its initial exact raw
372
- fingerprint comparison. Later freshness checks allow native task-status and
373
- execution bookkeeping updates in validated canonical artifacts while retaining
374
- their normative content hashes.
375
- Changes to task definitions, other HTML or other governance files still affect
376
- freshness under the normal snapshot policy. The closure covers
377
- tracked working-tree bytes and non-ignored untracked files, not ignored
378
- dependencies or outputs. The completion assessment is still an independent
379
- reviewer's judgment; schema validation does not prove that every file was read
380
- or every conclusion is correct. Preserve the unchanged launch envelope and
381
- genuine host capture throughout this path.
382
- Publish the completed request through the same `publish` command. `task-review`
383
- records the separate verification and spec-review receipts. After every task in
384
- the scope reaches `REVIEW`, reverify against one current source snapshot, run the
385
- combined quality review, and use `accept-scope` once. Do not accept tasks
386
- individually.
387
-
388
- Current Codex native V1 completion reviews retain the full frozen context in
389
- its immutable, content-addressed file and keep only its closed reference in
390
- mutable request state. Loading validates the exact context locator, hash,
391
- canonical bytes and review kind. The native context budget remains 8 MiB;
392
- mutable request state remains bounded at 1 MiB. Before dispatch, the adapter
393
- reserves the exact fixed result identities, six times the 64 KiB decision
394
- budget for canonical JSON escaping, and 32 bounded 256-byte lifecycle slots.
395
- A request without that capacity is refused before child launch. Historical
396
- inline requests retain their existing limits and abandonment-only recovery.
397
-
398
- An ARMED review that never launched can be abandoned through the adapter:
399
-
400
- ```sh
401
- python "<plugin-root>/hooks/artifact-authority.py" recover --root "<project-root>" --request-id <request-id> --disposition abandoned
1
+ # Structured specifications, plans and task state
2
+
3
+ Load for new full-lane work or an existing HTML spec/plan pair. The plan tracks
4
+ the agreed outcome, implementation and checks; it does **not** create a second
5
+ permission system. Follow real user decisions, host security and Git/release
6
+ authorization independently.
7
+
8
+ ## Format and installed writer
9
+
10
+ New full feature and sprint spec/plan pairs default to canonical `.html`.
11
+ Check the installation-pinned native capability **before writing**. If it is
12
+ missing, invalid or denied, report the failed operation. It must not fall back to Markdown
13
+ or claim the artifact was saved. New files are
14
+ `.codearbiter/specs/<slug>.html` and `.codearbiter/plans/<slug>.html`.
15
+ An existing `.md` pair remains Markdown in its original format; do not
16
+ silently convert it or create a shadow ledger. Small-lane features stay inline.
17
+ HTML `--farm` dispatch remains disabled.
18
+
19
+ Use `hooks/_artifactlib.py`, which selects the installation-owned binary by
20
+ its verified manifest, never PATH or a project-selected executable. Native
21
+ `_select_authoring_route` and `_preflight_plan_authoring` select the same-slug
22
+ source/target, check identity and structural validity, then return a draft
23
+ target. They do **not** approve work or launch reviewers. This includes the
24
+ native Pi writer; it does not establish broader installed-host qualification.
25
+
26
+ ## Author and maintain
27
+
28
+ Use native `create` and typed `apply`, not manual HTML/JSON editing. Keep stable
29
+ spec criterion IDs in the plan; use `record.add`/`record.update` and explicit
30
+ retirement reasons. Bind the exact current spec using `plan-bind`.
31
+ Incomplete drafts are valid working state. `validate` with `gate: ready`
32
+ reports missing coverage or structure, not permission to continue already
33
+ authorized work. Do not invent criteria, decisions or test results to pass
34
+ validation. A changed outcome goes to the actual decision owner; in-scope
35
+ methods and task decomposition can be updated with a reason.
36
+
37
+ A spec's SMARTS design rationale is stored in its existing `approach` record, bound
38
+ `decisions` records and one `SEC-SMARTS` section, as defined once in
39
+ `<plugin-root>/includes/smarts/core.md` (Design rationale record); a legacy Markdown spec
40
+ uses its one `## SMARTS design rationale` section instead.
41
+
42
+ Query an operation-specific `schema` only when its request shape is unknown;
43
+ reuse known shapes for subsequent calls instead of querying on every read.
44
+ Do not preload the entire schema. The packaged bridge invokes the verified native
45
+ binary as `ca-artifact <operation> --root <project-root> --request -`
46
+ with one JSON request on stdin; never resolve it from PATH. Requests use
47
+ protocol `codearbiter.artifact-api/0.1.0`; failed writes remain failures.
48
+
49
+ From the workspace root, pass this block on Python 3's stdin (`python -B -
50
+ '<absolute-installed-plugin-root>' '<plan-id>' '<task-id>'`, using your shell's
51
+ multiline stdin syntax and quoting). Use the host's loaded plugin root, not a
52
+ guessed project path. No helper script or directory outside the workspace is
53
+ needed. The client adds the protocol field; its second argument is the helper
54
+ installation, **not** the plugin root. Add `--schema` only when you need the
55
+ operation's request schema instead of the task packet.
56
+
57
+ ```python
58
+ import json
59
+ import sys
60
+ from pathlib import Path
61
+
62
+ plugin = Path(sys.argv[1])
63
+ plan_id, task_id = sys.argv[2:4]
64
+ sys.path.insert(0, str(plugin / "hooks"))
65
+ from _artifactlib import ArtifactClient, helper_installation
66
+
67
+ client = ArtifactClient(Path.cwd(), helper_installation(str(plugin / "hooks/_artifactlib.py")))
68
+ if "--schema" in sys.argv[4:]:
69
+ print(json.dumps(client.call("schema", {"name": "operation", "operation": "task-context"})))
70
+ else:
71
+ identity = client.call("identity", {"artifact_id": plan_id})
72
+ packet = client.call("task-context", {
73
+ "artifact_id": plan_id, "task": task_id,
74
+ "model_sha256": identity["model_sha256"],
75
+ })
76
+ print(json.dumps(packet))
402
77
  ```
403
78
 
404
- The adapter requires no attempt, launch, observation, receipt or prior recovery.
405
- It retains the request and its evidence, creates no receipt, and prohibits
406
- dispatching that request again. This also covers bounded legacy requests whose
407
- inline manifests made them too large for normal dispatch. Launched or captured
408
- requests remain subject to their existing recovery rules. Arm a new request
409
- only after the retained request is terminal.
410
-
411
- An interrupted or `BLOCKED` HTML task never resumes by editing its status. Arm
412
- the installed reconciliation adapter for the exact task or scope, present its
413
- returned `short_reply` (`reconcile <STATE> <code>` for a task, `reconcile <code>`
414
- for a scope; the full `reply` also works), and let `UserPromptSubmit` capture and apply the observed
415
- user decision across repositories:
416
-
417
- ```sh
418
- python "<plugin-root>/hooks/artifact-reconcile.py" --root "<project-root>" --artifact-id <plan-id> --target-id <task-id> --operation task-reconcile --target-state PENDING --reason "<reviewed reason>" --assessment "<reviewed assessment>"
419
- python "<plugin-root>/hooks/artifact-reconcile.py" --root "<project-root>" --artifact-id <plan-id> --target-id <checkpoint-id> --operation scope-reconcile --assessment "<reviewed assessment>"
420
- ```
421
-
422
- Ambiguous armed requests, changed identities, stale inputs, wrong replies, or a
423
- foreign Git repository all fail closed. Re-run `eligible` after reconciliation;
424
- the prompt reply itself is not proof that the lifecycle mutation committed.
425
- If a mutation response is lost, submit the same exact reply again: the adapter
426
- replays its durable operation ID and receipt without recapturing authority. A
427
- request that has not reached mutation can be cancelled with:
428
-
429
- ```sh
430
- python "<plugin-root>/hooks/artifact-reconcile.py" --root "<project-root>" --artifact-id <plan-id> --cancel --prompt "<exact returned reply>"
431
- ```
432
-
433
- If a crash left a complete pending request before its prompt route was
434
- registered, use this command instead. It refuses an active route or any
435
- in-flight mutation:
436
-
437
- ```sh
438
- python "<plugin-root>/hooks/artifact-reconcile.py" --root "<project-root>" --artifact-id <plan-id> --cancel-orphan
439
- ```
440
-
441
- If a durable mutation attempt exists, neither cancellation path can clear it.
442
- Replay the exact stored operation and receipt under the reconciliation lock:
443
-
444
- ```sh
445
- python "<plugin-root>/hooks/artifact-reconcile.py" --root "<project-root>" --artifact-id <plan-id> --recover
446
- ```
447
-
448
- Recovery clears the request only on a committed replay or a closed-set engine
449
- result proving no commit (`REVISION_CONFLICT` or `OPERATION_ROLLED_BACK`). Other
450
- errors retain it for investigation. Re-arm only after cancellation or recovery
451
- succeeds; a committed recovery is not permission to repeat the mutation.
452
-
453
- `IN_PROGRESS` after interruption requires reconciliation, not automatic completion.
454
- `REVIEW` requires fresh evidence. Source changes stale proof; state/branding updates
455
- do not stale their own verification. `task-block` invalidates downstream provisional
456
- states. `scope-reconcile` records a reviewed new baseline after plan edits.
457
-
458
- ## Mutation and recovery
459
-
460
- Every artifact mutation supplies the revision AND model hash last read, plus a
461
- unique operation ID. On conflict, reread and reconsider—never overwrite forcefully.
462
- A response lost after replacement is not evidence that nothing changed. Retry the
463
- same operation ID with identical input, or use `recover` on an uncertain transaction.
464
- Replaying a completed operation returns its original completion fields and a
465
- transaction marked as replayed; use `identity` for the current document identity.
466
- An older journal may return `refresh_required: true` instead. A rolled-back
467
- operation is not success. Keep journal-compatible tooling when restoring code.
468
- A transaction that was rolled back returns `OPERATION_ROLLED_BACK`.
469
-
470
- `repair-preview` identifies an inconsistent generated view. `repair-apply` requires
471
- both original-byte and candidate hashes and retains original bytes; it never
472
- infers semantic edits from human-modified HTML. Export writes a standalone copy
473
- outside canonical directories. Rebranding accepts only validated local assets.
474
-
475
- ## Legacy transition and blocked capabilities
476
-
477
- Legacy Markdown remains readable through the old workflow. Conversion is explicit:
478
- `migration-preview` receives typed spec/plan models and a complete nonoverlapping
479
- line-disposition map for each original file. Review the models and mappings, then
480
- `migration-apply` binds to the exact preview digest and records the review. Both
481
- new artifacts are drafts. Original approval/status prose is not transferred.
482
- Cutover is recoverable as a pair; completed cutovers use `migration-rollback`, which
483
- refuses any intervening candidate edit. Original bytes remain in transaction history.
484
-
485
- **HTML farm dispatch remains disabled and out of scope.** The
486
- engine can derive an immutable base-bound projection, verify it before canary,
487
- permit only `meta.model`/`meta.apiBaseUrl` enrichment, and seal exact execution
488
- bytes plus caller-supplied provider-selection assertions. Those assertions are
489
- auditable correspondence, not authenticated provenance. The shared built dispatcher enforces the checks
490
- before side effects. Keep the HTML `--farm` path disabled until real authority
491
- adapters, native packaged payloads and the fresh frontier/low-tier qualification
492
- matrix all pass; the June 2026 run earns no current credit. Existing legacy farm
493
- behavior is unchanged. Enabling normal premium-path HTML authoring does not count
494
- as farm qualification or authorize farm dispatch.
79
+ ## Read the smallest useful context
80
+
81
+ Use `identity` and `eligible` (advisory scheduling), then `task-context` with
82
+ the current plan `model_sha256` and task ID. Read the task, its referenced
83
+ criteria, dependency states and relevant prerequisite observations. The packet
84
+ has `context_complete: false`; expand only necessary exact symbols via
85
+ `read`/`read-batch` rather than parsing rendered HTML. Recheck identity after
86
+ a changed source or stale cursor. On a packet-size refusal, retrieve complete
87
+ individual records within the supported budget; do not accept truncation.
88
+ If an installed engine lacks `task-context`, use those existing bounded
89
+ symbol reads.
90
+
91
+ A fact or observable prerequisite is checked with ordinary authorized tools;
92
+ record its outcome through the native `prerequisite` **bounded `observation`**
93
+ with `kind: fact`, source and relevant `task_refs`. A decision reflects an
94
+ actual user choice; ask once if material and unresolved. Keep caller-reported
95
+ facts distinct from host-attested proof, and **no certification code** for
96
+ ordinary work. An unscoped prerequisite has unknown applicability, not
97
+ automatic plan-wide blocking or implicit satisfaction. Continue independent
98
+ tasks.
99
+
100
+ ## Implement and report reality
101
+
102
+ Start an eligible pending task with `task-start`; no artifact approval,
103
+ context ticket or reviewer receipt is required. A real check belongs in
104
+ `task-check`: observed argv, relative cwd, outcome (pass/fail/skip/unknown),
105
+ summary, source and origin (`tool_result` or `agent_report`). Supply exit code
106
+ only when actually observed; bind `command_index` only to the exact planned
107
+ invocation. Command-level success is not invented named-test proof. A newer
108
+ failure/unknown cannot be hidden by an older pass.
109
+
110
+ `task-context` reports bounded, declared-path and `shared_inputs` source
111
+ applicability. `scoped_changed` means recheck affected work;
112
+ `scoped_unchanged` is **partial** evidence (`scope_complete: false`), not a
113
+ full dependency graph or verified test. Unsafe or unknown file scope is
114
+ `unassessed`. A presentation edit or new receipt identity alone does not
115
+ require a reviewer rerun.
116
+
117
+ Use receipt-free `task-review` for implementation ready for review.
118
+ Use `accept-scope` with a reason to record a completed implementation batch
119
+ as `DONE`; **DONE is not independently verified or accepted**. Report actual
120
+ checks, failures and unrun verification separately. Review relevant risks;
121
+ do not spawn a reviewer fleet to clear task bookkeeping.
122
+
123
+ ## Resume safely
124
+
125
+ On interruption, inspect the worktree, running workers and committed state
126
+ before changing an `IN_PROGRESS` task. Use `task-reconcile` with the actual
127
+ state and reason; never clear a user `BLOCKED` stop without resolution.
128
+ Every mutation needs the current revision, model hash and a durable unique
129
+ operation ID. After a lost response, **retry the identical request and ID**
130
+ or use native `recover`; never start duplicate work or overwrite conflicts.
131
+ A rolled-back transaction is not success. Use `repair-preview`/`repair-apply`
132
+ only for the native generated-view repair contract, not semantic edits.
133
+
134
+ If saved state or a separately applicable policy genuinely requires strict
135
+ attested proof or older-format recovery, consult only the relevant section of
136
+ `<plugin-root>/includes/artifacts-attestation.md`. The optional reference
137
+ does not authorize ordinary work or replace current host/security rules.
138
+ Never open newer saved state with an incompatible old engine; use a matching
139
+ installed cohort and preserve the journal. After newer edits, forward
140
+ recovery takes precedence over overwriting current work with an old backup.