@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,181 +1,111 @@
1
1
  ---
2
2
  name: writing-plans
3
- description: The spec-to-plan bridge. /feature supplies an approved spec; initial full-lane HTML sprint review may supply a ready draft only through draft_for_pair. Creates the same-format plan with exact paths, tests, dependencies and complete criterion coverage. The initial paired review has no execution authority until one real user reply approves both artifacts. Ordinary sequential planning retains approved-source binding and plan approval.
3
+ description: Turn the selected specification into a maintained implementation plan with clear outcomes, useful tasks, dependencies, and verification steps. Drafting uses the existing authorization and does not require artifact approval codes, reviewer receipts, or a frozen implementation script.
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
7
7
  # writing-plans
8
8
 
9
- ## Authoritative format boundary
10
-
11
- For a new full-lane HTML spec, load `<plugin-root>/includes/artifacts.md` and
12
- use the installed structured-artifact engine for every spec and plan read or
13
- write. The resulting pair is `.codearbiter/specs/<slug>.html` and
14
- `.codearbiter/plans/<slug>.html`. Missing or invalid HTML capability is a STOP
15
- before writing and must not fall back to Markdown. An existing authoritative
16
- Markdown spec continues through the legacy Markdown path without conversion.
17
- HTML `--farm` dispatch remains blocked.
18
-
19
-
20
- Turn an approved spec into an executable plan, or prepare a ready draft plan for initial combined
21
- HTML sprint review. Draft preparation is not execution authority. Routed to by `/feature` (after
22
- spec approval) and `/sprint` under its explicit call mode.
23
-
24
- ## Pre-flight
25
-
26
- Read these, or STOP and surface the gap. Missing specs always block. Ordinary planning requires
27
- approval; only initial full-lane HTML sprint-pair preparation accepts an exact ready draft:
28
-
29
- - The authoritative approved spec selected by `/feature`: for HTML, resolve it
30
- through the installed engine and verify its ready approval and exact identity;
31
- for legacy Markdown, read `<project-root>/.codearbiter/specs/<slug>.md`.
32
- Absent → STOP. Unapproved → STOP except the explicit initial sprint `draft_for_pair` mode,
33
- which verifies ready/current draft identity through the private preflight and never grants execution.
34
- Route a genuine missing prerequisite back to the active caller, not an unrelated feature interview.
35
- - `<project-root>/.codearbiter/CONTEXT.md` — the `stage:` frontmatter (the maturity value) and project context.
36
- - `<project-root>/.codearbiter/tech-stack.md` — file layout, build/test/lint invocations. A verification step cites a real command from here, never a guess.
37
- - `<project-root>/.codearbiter/coding-standards.md` — structure and naming, so a task names the right path.
38
-
39
- **If `--farm` was requested:** check that `FARM_API_KEY` is set in the environment of the Pi parent process. If absent, BLOCK immediately — cite `<plugin-root>/includes/farm.md` for setup instructions. Do not proceed; the farm dispatcher cannot run without an API key. Model selection happens later (at dispatch time in `subagent-driven-development`), so no model research is needed here.
40
-
41
- ## Phase 1 — Criterion extraction · gate: BLOCK
42
-
43
- Lift every acceptance criterion from the spec and retain its stable ID (`AC-01`,
44
- `AC-02`, …). For HTML, obtain criterion records through typed engine reads and
45
- retain their typed IDs; rendered document text is not an authority source. This
46
- list is the coverage ledger for the whole plan — Phase 4 checks the task set
47
- against it.
48
-
49
- A criterion the spec leaves ambiguous is a `[CONFIRM-NN]` against
50
- `<project-root>/.codearbiter/open-questions.md` — surface it, do not invent the intent.
51
-
52
- **Backstop the ledger against the spec's own stated intent, mechanically, before trusting it — this
53
- runs even when `brainstorming` already ran the same check, because a hole that survived Phase 3
54
- survives Phase 4's bijection too, silently** (#566): run `"$PY" "<plugin-root>/hooks/_intentlib.py"
55
- uncovered-intent <spec-path> [--issue-body <scratch-file>]`, where `<spec-path>`
56
- is the authoritative `.html` or legacy `.md` spec selected above —
57
- `<scratch-file>` holds the linked issue's body when one exists (`gh issue view <N> --json body -q
58
- .body > <scratch-file>`, written outside the working tree), omitted when none does. A non-empty
59
- result names an in-scope bullet or an acceptance checkbox the criteria never cited — BLOCK and route
60
- back to `brainstorming` (`<plugin-root>/routines/brainstorming/SKILL.md`) to add the missing criterion or record a `[CONFIRM-NN]`; never paper over a
61
- missing criterion by authoring a task for it here instead. This is the LAST point before a hole gets
62
- laundered through Phase 4's bijection, which only checks the ledger against itself and cannot see
63
- past it.
64
-
65
- Then ask the half this tool cannot mechanize: **if every `AC-NN` passed and nothing else changed,
66
- what would still be broken?** A real answer names a criterion the ledger is missing even though
67
- every scope bullet and checkbox is technically cited — judgment, not mechanizable, and not satisfied
68
- by a rhetorical "nothing." Finding nothing broken is a reportable result, stated in one line, never a
69
- silent skip.
70
-
71
- Gate: every acceptance criterion in the spec captured as a numbered `AC-NN`; the `uncovered_intent`
72
- backstop above returns empty or every finding is resolved; and the negative question has been asked
73
- and answered. A partial ledger does not pass.
74
-
75
- ## Phase 2 — Task decomposition · gate: BLOCK
76
-
77
- Break the work into the smallest honest units. Each **task** is ~2–5 minutes of work and carries:
78
-
79
- - **id** — `T-01`, `T-02`, … stable.
80
- - **path(s)** — the exact file(s) the task touches, resolved against `coding-standards.md`. "Some files" is not a path.
81
- - **verification** — one concrete command or observable that proves the task done (e.g., `<test cmd> -k test_token_expiry passes`, `endpoint returns 401 on missing header`). It cites a real `tech-stack.md` invocation or a directly observable behavior — never "looks right".
82
- - **maps-to** — the `tdd` obligation this verification corresponds to. The verification *maps to* a tdd obligation; it does NOT replace tdd's own gates. `tdd` Phase 1 still derives and Phase 4 still verifies obligations against passing tests.
83
- - **covers** — the `AC-NN`(s) this task advances.
84
-
85
- Split anything that won't fit ~5 minutes or touches unrelated paths. Reject the trap of one
86
- monolithic "implement the feature" task — that defeats the plan.
87
-
88
- Gate: every task has at least one path AND a verification AND a `maps-to`. A task missing any of the
89
- three blocks the plan.
90
-
91
- ## Phase 3 — Order & MVP slice · gate: BLOCK
92
-
93
- Order tasks so each runs only after what it depends on. Flag every dependency explicitly
94
- (`T-07 depends on T-03`). A cycle is a decomposition error — return to Phase 2 and split.
95
-
96
- Group the ordered tasks so the **MVP slice** is identifiable: the minimal contiguous task set that
97
- satisfies the spec's core acceptance criteria and is shippable on its own. Everything past the slice
98
- is incremental.
99
-
100
- Gate: a complete dependency order with no cycle, and an explicitly marked MVP slice.
101
-
102
- ## Phase 4 — Bijection proof & write · gate: BLOCK
103
-
104
- Cross the ledger against the task set, both directions. **This proves the plan and the ledger AGREE
105
- with each other — it does not prove the ledger itself is COMPLETE relative to the spec's stated
106
- intent.** A criterion missing from the ledger entirely was never a candidate for either check below;
107
- that completeness gap is caught earlier, by Phase 1's `uncovered_intent` backstop (and by
108
- `brainstorming` Phase 3 before that) — never re-derived here, and never implied by this phase's name
109
- (#566: a prior version of this gate read "coverage proof", which a bijective check does not earn).
110
-
111
- - Every `AC-NN` is covered by at least one task's `covers`. An uncovered criterion blocks — author the missing task.
112
- - Every task advances at least one `AC-NN`. A task that covers nothing is scope creep — cut it or surface it.
113
-
114
- For an HTML source, pass the selected route, installed client, and the spec
115
- identity just read from the engine through `_preflight_plan_authoring`. Initial full-lane sprint
116
- pair preparation alone sets `draft_for_pair: true`; the ordinary default still requires approval. Only its
117
- returned same-slug `.codearbiter/plans/<slug>.html` target may be created. Create
118
- that plan through the installed structured-artifact engine as `draft_preview`,
119
- using the source spec's exact artifact ID and normative digest. For ordinary sequential planning,
120
- this must be the approved spec's exact artifact ID and normative digest. Populate it only with typed operations
121
- and validate it at the ready gate. Before presenting either ordinary or combined review, call
122
- the private `_approvallib._preflight_plan_verification(client, identity)` with the current engine identity.
123
- It reads every task through bounded engine pages, checks each declared runner's supported
124
- named-outcome format, snapshots current inputs, and rejects identity drift. Resolve the complete
125
- reported set of command/input diagnostics before asking for approval. It does not run commands,
126
- discover or import tests, or require proposed test files and test names to exist. Input roots must
127
- already exist: choose an existing containing directory for files the plan will create. Roots and
128
- excluded directories are exact repository-relative paths, not basenames, globs, or paths relative
129
- to each root; for root `site`, use `site/node_modules`, `site/dist`, and other reviewed output paths.
130
- The ordinary and paired approval adapters repeat this preflight before arming their user reply.
131
- This admission check is not verification evidence; execution still binds actual commands and
132
- requires current named outcomes. For initial combined review, retain `draft_preview` and return
133
- both ready identities to the caller: `sprint-approve` owns the binding and both approvals after one
134
- actual host-observed reply. Do not separately `plan-bind` or approve that pair. On ordinary approved-spec
135
- planning, use `plan-bind` to bind it to the approved spec before plan approval. This path must not create `.codearbiter/plans/<slug>.md`;
136
- that would be a shadow authority.
137
-
138
- For an existing authoritative Markdown source, write
139
- `<project-root>/.codearbiter/plans/<slug>.md` — `<slug>` matching the spec —
140
- with the `AC-NN` ledger, the ordered task table (id · path(s) · verification ·
141
- maps-to · covers · depends-on · **status**, initialized `PENDING`), the marked
142
- MVP slice, and any out-of-scope item tagged inline `[NEEDS-TRIAGE]`.
143
-
144
- The status column is the pipeline's resume ledger: `subagent-driven-development` flips a task to
145
- `ACCEPTED` the moment it accepts it, so an interrupted run (crash, compaction, closed session) is
146
- re-entered by `/feature` at the first non-`ACCEPTED` task instead of restarted from brainstorming.
147
-
148
- Gate: bijection proven between the plan and the ledger — no criterion without a task, no task without
149
- a criterion — and the plan written to disk. This proves the two are mutually consistent, nothing more;
150
- completeness of the ledger itself was Phase 1's gate, not this one. Initial combined-review drafts
151
- return for `arm-sprint`, never execution. Only verified approved spec-and-plan authority clears execution:
152
- `executing-plans` (checkpointed, via `/feature`) or `subagent-driven-development` (autonomous, via
153
- `/sprint`) — each routes every task through `tdd`. The plan never hands off to `tdd` directly.
154
-
155
- ### Phase 4-farm extension (only when `--farm` was requested)
156
-
157
- When `--farm` was requested for a legacy Markdown workflow, after the bijective coverage gate passes and the `.md` plan is written,
158
- produce the farm artifact (`plan.json`) — **one MVP slice at a time** — per
159
- `<plugin-root>/routines/writing-plans/references/farm-plan.md`. Load that leaf and follow it;
160
- it owns the per-task failing-test + schema-valid `plan.json` procedure.
161
-
162
- Gate: all failing tests written and confirmed failing; `plan.json` written and schema-valid. Both
163
- artifacts exist before handing off to `subagent-driven-development` (`<plugin-root>/routines/subagent-driven-development/SKILL.md`).
164
-
165
- ## Hard rules
166
-
167
- - MUST NOT execute or approve work against an absent or unapproved spec. Only explicit initial
168
- full-lane HTML `draft_for_pair` planning accepts a ready draft and must return for combined approval;
169
- other unapproved inputs route back to their actual caller.
170
- - MUST NOT write or parse rendered HTML directly, create a Markdown shadow for
171
- an HTML spec, or bind a plan from a caller-supplied identity.
172
- - MUST NOT emit a task without an exact path AND a concrete verification step.
173
- - MUST NOT let a task's verification stand in for a `tdd` gate — it maps to a tdd obligation, it does not replace one.
174
- - MUST NOT write the plan while any acceptance criterion is uncovered or any task covers nothing.
175
- - MUST NOT guess a verification command — cite `tech-stack.md` or STOP.
176
- - MUST NOT resolve an ambiguous criterion by guessing — raise a `[CONFIRM-NN]`.
177
- - MUST run the `uncovered_intent` backstop and ask the negative-judgment question in Phase 1, and MUST NOT treat Phase 4's bijection proof as a substitute — bijection proves the plan and the ledger agree with each other, never that the ledger is complete (#566).
178
- - MUST NOT emit `plan.json` in `--farm` mode without writing and confirming each failing test first.
179
- - MUST NOT set `meta.model` or `meta.apiBaseUrl` in `plan.json` — these belong to the dispatch step.
180
- - MUST NOT proceed with `--farm` if `FARM_API_KEY` is absent — cite `<plugin-root>/includes/farm.md` and BLOCK.
181
- - MUST, at exit, run the follow-up harvest (`<plugin-root>/includes/harvest.md`) over any `[NEEDS-TRIAGE]` out-of-scope items — batch-confirm promoting them to `open-tasks.md` (work) or `open-questions.md` (decisions) so they don't die in the plan file.
9
+ Produce the plan for the active feature or sprint, then return it to that caller.
10
+ Do not execute implementation from this skill. Use the user's existing direction;
11
+ ask only about a consequential unresolved outcome, not permission to maintain the
12
+ plan. An explicitly requested human checkpoint still belongs to the caller.
13
+
14
+ ## Select the source and representation
15
+
16
+ Load `<plugin-root>/includes/artifacts.md` for artifact I/O. Read the selected
17
+ specification's criterion records and retain its artifact ID and normative digest.
18
+ For HTML, `_preflight_plan_authoring` checks that identity, structural validity,
19
+ and the same-slug target. Create the matching plan as `draft_preview`; use
20
+ `plan-bind` when selecting or refreshing its specification binding. Preserve human
21
+ edits and stable references in the selected representation.
22
+
23
+ Read relevant project context and the build/test commands in
24
+ `<project-root>/.codearbiter/tech-stack.md`; use
25
+ `<project-root>/.codearbiter/coding-standards.md` for applicable conventions.
26
+ Missing optional orientation is not a new permission gate. Identify a genuinely
27
+ missing requirement or command contract instead of guessing it.
28
+
29
+ ## Build useful tasks
30
+
31
+ Start with the specification's intended outcome and criterion IDs. Check coverage
32
+ in both directions: each required criterion has planned work, and each task serves
33
+ the agreed outcome. Agreement between a plan and its criterion list does not
34
+ prove that either captures every part of the user's intent. Inspect relevant
35
+ source and ask what would still be wrong if all listed criteria passed. Record
36
+ actual gaps; do not repeat an interview the caller has already resolved.
37
+
38
+ Each task should describe a coherent unit of work: stable ID, intended result,
39
+ relevant paths, referenced criteria, an implementation approach, dependencies,
40
+ and the appropriate check or observable completion condition. Choose task size
41
+ for useful implementation and review, not a compulsory two-to-five-minute limit.
42
+ A small related change does not need its own author/reviewer lifecycle. Split
43
+ work when it has separate outcomes, dependencies, or independently useful progress.
44
+
45
+ Use real repository commands or an explicitly described observable check. A test
46
+ file or case that this task will create may not exist yet. An unsupported named
47
+ result parser is not a reason to reject the plan or invent test outcomes; a
48
+ command-level result must not be claimed as proof of individual named tests.
49
+ Read relevant command definitions without executing anything merely to author a
50
+ plan. Runner support and actual execution are checked when that check is needed.
51
+
52
+ Separate prerequisites that can be observed from choices only the user can make.
53
+ For typed prerequisites, use `kind: fact` or `kind: decision` and explicit
54
+ `task_refs` for affected tasks. Do not guess that an old unscoped prerequisite
55
+ applies to every task, or narrow a real shared dependency to hide it. Observable
56
+ facts use ordinary authorized tools and the engine's reported-observation path.
57
+ A consequential unresolved choice gets a clear normal-language question, not an
58
+ approval digest or a certification code.
59
+
60
+ For source impact without a repository-wide dependency analysis, record
61
+ `shared_inputs` only where the task genuinely depends on a common source
62
+ interface, fixture, schema or unusual build configuration. These must be
63
+ portable repository-relative paths to actual source, not generated artifact
64
+ state; a directory path includes its bounded descendants. A known shared
65
+ input change should refresh the affected check, not every unrelated review.
66
+ Do not invent references or claim an exhaustive dependency graph; missing
67
+ or unbounded inputs remain honestly `unassessed` in task context.
68
+
69
+ Order tasks by their actual dependencies. Remove cycles by fixing the plan, not
70
+ by pretending a required predecessor is complete. Group meaningful batches with
71
+ clear outcomes; checkpoints organize implementation and do not independently
72
+ create user approval requests. Keep genuinely blocked work visible while allowing
73
+ independent work to proceed. Identify the smallest useful delivery outcome without
74
+ splitting a promised atomic migration or compatibility change across releases.
75
+
76
+ ## Save, inspect, and maintain
77
+
78
+ For HTML, use typed `create` and `apply` operations with current identity and CAS.
79
+ Preserve the specification's criterion IDs, task references, reasons, and history.
80
+ Drafts may be incomplete. Use `validate` with `gate: ready` to discover omissions;
81
+ its diagnostics describe the plan, not whether an already-authorized agent may
82
+ continue useful work. Structural errors or a conflicting write remain actual
83
+ operation failures. Do not fill missing fields with fabricated evidence to make
84
+ validation green.
85
+
86
+ Maintain the plan under existing authorization without extra artifact approvals
87
+ or freezing each method or check as another decision. Update in-scope steps,
88
+ tasks, checks and valid dependencies with a reason; material outcome changes
89
+ go to their actual decision owner.
90
+
91
+ Read back the saved identity and affected symbols. Return the plan location,
92
+ useful next work, actual unresolved choices, and outstanding checks to the active
93
+ caller. Distinguish implemented progress from verified behavior; a plan or a
94
+ `DONE` label is not test, review, or release evidence. Keep unrelated progress
95
+ when correcting the plan, and do not restart brainstorming after an interruption.
96
+
97
+ Existing Markdown retains one ledger and its original representation.
98
+ Never infer a passing check from an old status or duplicate approval prompts.
99
+
100
+ ## Explicit farm requests only
101
+
102
+ For a user-selected Markdown `--farm` workflow, use
103
+ `<plugin-root>/includes/farm.md` and
104
+ `<plugin-root>/routines/writing-plans/references/farm-plan.md`. Preserve the
105
+ requested provider/budget and actual credential boundaries. Do not read
106
+ credential contents or trigger model spending during ordinary authoring.
107
+ HTML farm is disabled; never silently change backends.
108
+
109
+ Retain real out-of-scope follow-ups using `<plugin-root>/includes/harvest.md`
110
+ when relevant. Do not turn routine drafting into an additional audit program,
111
+ mandatory reviewer chain, or repeated approval interview.
@@ -14,14 +14,14 @@ authorized it, and what is still open.* Read-only over every source; its only wr
14
14
  ## Window
15
15
 
16
16
  - `<from-ref> <to-ref>` — two tags/SHAs (e.g. `v1.2.0 v1.3.0`).
17
- - `--since-checkpoint` — from the `last-checkpoint` record to HEAD.
17
+ - `--since-checkpoint` — use `source_commit` and `recorded_at` from the latest checkpoint report under `.codearbiter/checkpoints/` as the commit and UTC time anchors.
18
18
  - `--since <date>` — ISO date to HEAD.
19
19
  - No argument → from the most recent tag to HEAD (no tags → last checkpoint; neither → BLOCK and
20
20
  ask for an explicit window).
21
21
 
22
22
  ## Flow
23
23
 
24
- 1. Resolve the window to a commit range and a time range; both appear in the packet header.
24
+ 1. Resolve the window to a commit range and a time range; both appear in the packet header. For a checkpoint window, select the report with the latest valid `recorded_at`, verify its `source_commit` resolves to a commit and is an ancestor of HEAD, and cite the report. Include its `worktree_dirty` value as a review-scope limitation. Missing or invalid anchors require an explicit ref/date window; never infer one from the report filename or the integer override counter in `last-checkpoint`.
25
25
  2. Gather, citing each source file:
26
26
  - **Commits** — `git log` over the range, grouped by Conventional-Commit type; merge commits
27
27
  listed with their PR reference.
@@ -24,7 +24,7 @@ Periodic sweep of the entire codebase with the reviewer fleet, funneled to a sin
24
24
 
25
25
  2. Route to `dispatching-parallel-agents` (`<plugin-root>/routines/dispatching-parallel-agents/SKILL.md`) with that unit list (read-only batch). It dedupes, then
26
26
  funnels through `finding-triage` → `verdict-aggregator` and returns the single read-only verdict.
27
- 3. After the verdict returns, separately dispatch `checkpoint-aggregator` with that verdict. It writes the dated report to
27
+ 3. After the verdict returns, separately dispatch `checkpoint-aggregator` with that verdict and the reviewed commit from `git rev-parse HEAD`, the UTC review-start time, and whether the reviewed worktree was dirty. Retain these observed values from before the sweep. It writes the dated report to
28
28
  `<project-root>/.codearbiter/checkpoints/YYYY-MM-DD.md`: findings by severity with
29
29
  file:line, and out-of-scope items marked inline `[NEEDS-TRIAGE]`.
30
30
  4. Write the current override **count** to `<project-root>/.codearbiter/last-checkpoint` — the
@@ -20,23 +20,22 @@ Read these, or STOP and surface the gap — never guess a command:
20
20
  - `<project-root>/.codearbiter/tech-stack.md` — test, lint, and secrets-scan invocations. Stop if missing; do not guess.
21
21
  - `<plugin-root>/includes/verification-boundary.md` — the required split between focused local proof and exhaustive exact-head hosted CI.
22
22
  - A git repository must be present and `git status` available.
23
- - The `tdd` skill must have cleared all six phases for any new or modified feature code in the staged set. If `tdd` is incomplete, STOP and surface the gap.
24
- - The discovered authoritative spec/plan pair, when this commit belongs to a
25
- `/feature` or `/sprint` pipeline. For HTML, load
26
- `<plugin-root>/includes/artifacts.md`; use the engine `identity` and `eligible`
27
- results, and treat the exact spec and plan identities plus the acceptance
28
- receipts bound in engine state as the commit proof. Require
29
- `all_accepted_and_current: true` before this gate can commit completed plan
30
- work. The gate must not parse rendered HTML and must not consult a shadow
31
- Markdown ledger. Displayed state, checkboxes, hashes, or caller-supplied
32
- labels cannot substitute for current engine acceptance.
33
-
34
- For that HTML pair, invoke the installed bridge's
35
- `_preflight_current_acceptance` with the exact `_resolve_workflow_pair` result,
36
- the repository-bound client, and the spec/plan IDs returned by the engine. Use
37
- its returned identities and receipts as the proof for this gate. A refusal is a
38
- BLOCK before staging or committing; never construct an equivalent proof from
39
- caller metadata.
23
+ - Read the scoped obligations and observed evidence under `<plugin-root>/routines/tdd/SKILL.md`. Confirmed fixes require regression RED/GREEN; features require current criterion-focused checks; refactors require passing characterization/parity evidence. Apply the relevant coverage and lint requirements. Resolve missing evidence for the staged change using its selected verification approach.
24
+ - The discovered authoritative spec/plan pair, when relevant to this commit. For HTML,
25
+ load `<plugin-root>/includes/artifacts.md` and read the exact spec/plan
26
+ identity, task progress and criteria through typed operations. `eligible`
27
+ gives scheduling advice, **not** authority, verification or a reason to forbid
28
+ committing already-authorized work. `REVIEW` and `DONE` describe work
29
+ progress, not independent checks.
30
+
31
+ A plan may contain unfinished or unverified tasks: list these accurately in
32
+ the commit report and do not claim the whole feature is verified. This gate's
33
+ actual authorization, selected staged diff, applicable test results, secrets,
34
+ security and migration controls still apply. Do not call
35
+ `_preflight_current_acceptance` for ordinary commits or manufacture acceptance
36
+ receipts to replace real test output. A caller requiring an explicit
37
+ receipt-backed *proof claim* may use that separate validator, but it does not
38
+ grant permission to commit.
40
39
 
41
40
  ## Phase 1 — Permission · gate: BLOCK
42
41
 
@@ -75,20 +74,24 @@ Gate: the staged set is type-homogeneous with a single type and scope.
75
74
  Read the test, lint, and secrets-scan commands from `tech-stack.md`, then apply
76
75
  `<plugin-root>/includes/verification-boundary.md`:
77
76
 
78
- - Run the impact-bounded local tests that directly cover the staged paths and obligations. Any failure blocks. Repository-wide and cross-platform suites belong to exact-head hosted CI before merge, not this commit gate.
79
- - Run lint, and the type-check if the project is statically typed. Zero errors.
77
+ - Establish impact-bounded local test results that directly cover the staged paths and obligations. Reuse inspected results while their relevant source, inputs and command match; run missing or affected checks. Any unresolved failure blocks. Repository-wide and cross-platform suites belong to exact-head hosted CI before merge.
78
+ - Establish current lint results, and type-check results if the project is statically typed. Reuse applicable observed results under the same source/input rule. Zero errors.
80
79
  - Run the secrets scan on ALL staged files, regardless of commit type. Any finding blocks.
81
80
  - **Security gates (mandatory routing):** if the staged diff touches crypto/TLS or secret patterns, route it through `crypto-compliance` (`<plugin-root>/routines/crypto-compliance/SKILL.md`) and/or `secret-handling` (`<plugin-root>/routines/secret-handling/SKILL.md`) — they scan against `security-controls.md` and, on pass, record the diff-bound marker `.codearbiter/.markers/security-gate-passed` (via `hooks/security-pass.py`). This is not optional: the PreToolUse commit hook **H-09b/H-10b blocks the commit** until that gate pass is recorded AND covers every sensitive line being committed.
82
81
  - **Migration gate (mandatory routing):** if the staged set contains a database migration (Phase 3 flags it; the detection rule is `_hooklib.is_migration_path` — default migration globs, extendable/narrowable via a `migration-paths` block in `security-controls.md`), dispatch the `migration-reviewer` agent (`<plugin-root>/agents/migration-reviewer.md`). **On a genuine PASS only**, record the content-bound marker `.codearbiter/.markers/migration-gate-passed` by resolving the interpreter once by presence — `PY=python3; { command -v python3 >/dev/null 2>&1 && python3 --version >/dev/null 2>&1; } || PY=python` — never `python3 X || python X`, which reruns X on any nonzero exit (#577) — and running `"$PY" "<plugin-root>/hooks/migration-pass.py"`. This is not optional: the PreToolUse commit hook **H-14 blocks the commit** until the pass is recorded AND covers every migration file being committed (by content digest, no freshness window — an edit to a reviewed migration re-blocks). This closes the bare-`/commit` / small-lane gap from issue #77. On a BLOCK, do not record the pass.
83
82
  - **CI/deploy review (mandatory routing, no marker gate):** if the staged set touches a CI/CD workflow (`_hooklib.is_ci_path` — defaults extendable via a `ci-paths` block in `security-controls.md`) or a deployment/IaC manifest (`_hooklib.is_deploy_path` — `deploy-paths` block), dispatch the `security-reviewer` agent (`<plugin-root>/agents/security-reviewer.md`). This is the enforcement point the advisory `post-write-edit` reminders **H-15/H-16** point to, and it closes the bare-`/commit` / small-lane gap for CI/deploy (the `/review`, `/pr`, `/checkpoint`, and sprint lanes already dispatch it). Unlike crypto/secret/migration there is **no commit-block marker** — a CI workflow runs only once merged and IaC bites only on apply, so a BLOCK-level finding halts the commit via Phase 6 review, but routine CI/deploy edits are not gated per-commit. Act on the findings by severity; do not record a marker.
84
83
 
85
- Record each result (PASS / BLOCK) for the report.
84
+ Required specialized review may reuse an existing review of the same source,
85
+ requirements, findings and verification inputs. Dispatch only missing or affected
86
+ review work. Required security and migration markers must still cover the actual
87
+ staged content; a prior review does not waive their writers or hook checks.
88
+ Record each result (PASS / BLOCK), its source and whether it was reused or run.
86
89
 
87
90
  Gate: the applicable focused tests, lint/type-check, secrets scan, and specialized gates all PASS. Any failure halts the commit until fixed and re-run. This gate does not claim that exhaustive hosted CI has run; `finishing-a-development-branch` proves that separately before merge.
88
91
 
89
92
  ## Phase 5 — Behavioral proof · gate: BLOCK
90
93
 
91
- Apply the shared fresh-run discipline in `<plugin-root>/includes/fresh-verification.md`, with
94
+ Apply the current-evidence rules in `<plugin-root>/includes/fresh-verification.md`, with
92
95
  **the spec's acceptance criterion** as the target — prove the behavior against the spec, not against a
93
96
  self-report.
94
97
 
@@ -97,15 +100,47 @@ self-report.
97
100
  HTML, use the exact criterion and task records returned by symbol-scoped
98
101
  engine `read`; never scrape the rendered document. If none exists, derive the
99
102
  smallest command that exercises the claimed behavior.
100
- - Run it fresh in this phase, read its output and exit code, and confirm the observed behavior matches the spec's acceptance criteria. A mismatch, or an unverifiable claim, blocks.
103
+ - Inspect the applicable output and exit code and confirm the observed behavior matches the spec's acceptance criteria. Reuse the Phase 4 or implementation result when it already proves that criterion on unchanged relevant inputs. Run a separate proving command only when existing evidence is missing, affected or insufficient. A mismatch or unverifiable claim blocks.
101
104
 
102
105
  **Stakes:** a behavioral-proof mismatch means the change does not do what the spec claims — state what would ship broken if this passed ("the retry path never fires; a transient error would hang the caller"), not just "proof mismatch." That gap is exactly what a green-looking suite hides.
103
106
 
104
- Gate: the change is proven to do what it claimed by fresh evidence — command output and exit code read in this phase. A self-reported "it works" does not pass.
107
+ Gate: inspected current command output and exit code prove the claimed behavior. The phase change alone does not require another run. A self-reported "it works" does not pass.
105
108
 
106
109
  ## Phase 5.5 — Provenance auto-heal (conditional)
107
110
 
108
- Compute the heal worklist from the staged set via `_provenancelib.heal_worklist(staged_paths, provenance, current_hashes)` — the subset of staged paths that are `drift_trigger:true` provenance entries whose recorded hash has diverged or is absent. **Empty worklist → skip this phase entirely; most commits pay nothing** (cost guarantee: ordinary commits touching no provenance source do zero re-scout work).
111
+ Partition the loaded records by schema. Select only recorded content paths or
112
+ membership scopes/predicates intersecting staged sources. Commits touching no
113
+ recorded source do no re-scout work. An empty legacy worklist says nothing about v2.
114
+ Include deleted paths and both sides of renames in `staged_paths`, for example
115
+ with `git diff --cached --name-only --no-renames`.
116
+
117
+ **Managed v2 pairs:** acquire one bounded snapshot covering the selected documents'
118
+ recorded dependencies and target preimages. Call `assess_context_provenance` for
119
+ those document IDs with its action-boundary snapshot probe, then reuse that
120
+ snapshot and assessment in
121
+ `_provenancelib.v2_heal_worklist(staged_paths, provenance, snapshot, assessment)`.
122
+ Its `claims` identify the affected document, field, claim and staged source paths;
123
+ they select inspection work, not permission to write. These paths are staged triggers;
124
+ inspect the selected claims' complete recorded evidence before refreshing their fields,
125
+ including any changed unstaged dependency. Preserve uninspected claims and bindings.
126
+ Report `unknown` entries and defer that document's automatic
127
+ update; do not label it fresh or block independent commit work.
128
+
129
+ When inspected claims still hold, prepare an `update` of the selected owned fields
130
+ with unchanged content and current source evidence. When a claim changed, propose
131
+ the bounded content correction for Phase 6 review. Use the typed `context-preview`
132
+ and `context-apply` procedure in
133
+ `<plugin-root>/routines/context-check/SKILL.md`, retaining exact expected pair hashes,
134
+ the returned preview reference/digest and all unselected bytes. Reuse the existing
135
+ maintenance authorization; do not enter a second approval cycle. Native apply
136
+ rechecks the source and pair identities and writes both files together. Read back
137
+ the result. Never pass v2 records to `rebaseline` or write them directly. Stage the
138
+ resulting pair by explicit paths and secrets-scan every newly staged file.
139
+
140
+ **Legacy v1 records:** compute the heal worklist via
141
+ `_provenancelib.heal_worklist(staged_paths, provenance, current_hashes)` — staged
142
+ `drift_trigger:true` entries whose hash diverged or is absent. An empty v1 worklist
143
+ skips only this legacy branch.
109
144
 
110
145
  Non-empty worklist → call `_provenancelib.compute_drift(provenance, current_hashes)` to retain the document/source mapping. For each stale document in that drift report, get its record as `doc_provenance` and call `_provenancelib.changed_scope(doc_provenance, drift)`. Intersect that document's drifted paths with the worklist; skip a document when the intersection is empty. The hash map can omit unstaged paths, so a missing entry outside the worklist must not broaden this commit's re-scout. Confirm that every selected worklist path maps to at least one stale document after this filtering; if a record is malformed or the mapping is incomplete, STOP and report the gap rather than treating the path as fresh.
111
146
 
@@ -217,7 +252,7 @@ Gate: the commit lands and `git status` is clean. Unexpected uncommitted changes
217
252
  - MUST NOT run `git add -A`, `git add .`, or any wildcard staging.
218
253
  - MUST NOT commit while any test is failing, any lint error stands, or any secret is present.
219
254
  - MUST NOT turn exhaustive repository-wide or cross-platform CI into a local prerequisite when the shared `verification-boundary` assigns it to exact-head hosted CI.
220
- - MUST NOT accept a self-reported "it works" — prove the behavior against the spec with a fresh command run (Phase 5) before committing.
255
+ - MUST prove the behavior against the spec with inspected current evidence (Phase 5); a self-reported "it works" is insufficient.
221
256
  - MUST NOT skip, disable, or work around any automated gate.
222
257
  - MUST NOT commit a staged database migration without a recorded migration-review pass — the H-14 hook blocks it until `migration-reviewer` passes and `hooks/migration-pass.py` records the content-bound marker.
223
258
  - MUST NOT `--amend` after a pre-commit hook failure — create a new commit.