@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,209 +1,78 @@
1
1
  ---
2
2
  name: brainstorming
3
- description: The Socratic spec-refinement front of /feature, and the planning front of /sprint. Routed to BEFORE any code — it turns a one-line idea into a concrete spec with testable criteria, ready for initial combined sprint review or explicit sequential approval. Five gated phases — frame, shape, refine, write, review-and-approve. No implementation before an approved spec; the caller retains required planning, execution and delivery ordering. Each acceptance criterion becomes one tdd Phase 1 obligation.
3
+ description: Refine feature and sprint intent into a useful specification. Capture scope, observable criteria and material choices without repeated artifact approval ceremonies.
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
7
7
  # brainstorming
8
8
 
9
- ## Structured-artifact boundary
10
-
11
- For new full-lane work or an existing HTML spec/plan, load
12
- `<plugin-root>/includes/artifacts.md` before artifact I/O. Before Phase 1, call
13
- `_select_authoring_route` with the trusted project root, slug, invoking workflow,
14
- and selected lane; use only its returned mode, format, and paths. For a selected
15
- HTML route it checks the
16
- installed capability before writing; missing or invalid HTML capability is a
17
- STOP and the workflow must not fall back to Markdown. Its typed
18
- ID, binding, readiness, receipt, contextual-read and scope-state rules replace
19
- legacy Markdown parsing and direct status-cell edits for that pipeline. Keep all
20
- other workflow gates, including human checkpoints, unchanged. Existing `.md`
21
- artifacts remain on their legacy path. New full-lane specs use the installed
22
- structured-artifact engine and default to canonical `.html`. HTML `--farm`
23
- dispatch remains blocked.
24
-
25
-
26
- Refine the idea before it touches code. Routed to by `/feature` and `/sprint` as their specification step.
27
-
28
- ## Caller scope and authority
29
-
30
- Read the active caller's workflow, selected lane, scope and existing delegation before refining.
31
- Initial sprint planning is not an approved sprint: this skill does not grant its own delegation.
32
- A full-lane feature requires `writing-plans` after spec approval. Initial HTML sprint planning instead
33
- returns a ready draft identity for the combined spec/plan review before either is approved; a
34
- subordinate specification step returns its result to the existing caller. Preserve direct handoffs when they
35
- satisfy that caller's ordering, not an unconditional terminal route to implementation.
36
-
37
- A sprint may contain several related features under one coherent goal. Keep their boundaries and
38
- criteria explicit without converting the sprint into repeated feature interviews. Parameter and
39
- method choices follow safety-core; material product decisions and missing authority are not inferred.
40
- No new registered surface, runtime state or copied procedure is needed for this call contract.
41
-
42
- ## Pre-flight
43
-
44
- Read these, or STOP and surface the gap — never guess scope or stack:
45
-
46
- - `<project-root>/.codearbiter/CONTEXT.md` — the `stage:` frontmatter (the maturity value), domain vocabulary, and what the project is NOT building.
47
- - `<project-root>/.codearbiter/tech-stack.md` — the stack the feature must fit; rule out incompatible designs early.
48
- - `<project-root>/.codearbiter/open-questions.md` — existing `[CONFIRM-NN]` items; new ones number sequentially from here.
49
-
50
- **Recorded intent — fail-soft, exempt from the read-or-STOP rule above (ADR-0025).** Also
51
- consult, when present: the `decisions/` index (titles via `decision-log.md` or the filename
52
- listing — load a full ADR body only when its subject touches this feature) and
53
- `plans/02-phased-build-plan.md`'s section headings (plus `plans/01-architecture-breakdown.md`
54
- when the feature touches component boundaries or integrations). Index-first, never a bulk read.
55
- A missing file or directory here is NOT a gap to surface and never a STOP: record
56
- `intent: silent — no decomposition record` in the running notes and proceed.
57
-
58
- Scope-sized and light. NOT decompose's whole-project six-layer interview — five phases for the
59
- caller's feature or coherent sprint. Depth scales with that scope, not the ceremony. The deliberately
60
- inline small-feature lane remains owned by `/feature`; do not manufacture an HTML pair for it.
61
-
62
- ## Phase 1 — Frame the problem · gate: BLOCK
63
-
64
- Take the one-line idea and pin its boundaries before designing or asking anything:
65
-
66
- - State the problem in one sentence — the concrete pain, not the proposed solution.
67
- - Name the user or caller who feels it, and what "done" looks like to them.
68
- - Name what this feature explicitly does NOT do — the boundary that keeps scope honest.
69
- - Check the framing against `CONTEXT.md`: it never contradicts the NOT-building list or redefines domain vocabulary. A contradiction is a conflict — surface it, do not reconcile it silently.
70
- - Check the framing against the recorded intent (pre-flight, when present): an idea that resurrects a capability `plans/02` records as deferred, or that duplicates a backlog item, is a fork to ask — lead with the recorded deferral rationale and your recommendation; never proceed on it silently (ADR-0025).
71
- - **Respect the caller's unit of work.** For a feature, split unrelated independently shippable
72
- concerns before refining them; record the selected piece and its exclusions. For a sprint, retain
73
- related features within the stated sprint goal and identify their separable criteria and dependencies
74
- for planning. Do not force one new user interview per feature or silently absorb unrelated work.
75
- Ask only when the intended scope or necessary product decision remains unresolved.
76
-
77
- Gate: problem, caller, and out-of-scope boundary stated and consistent with `CONTEXT.md`; the unit is
78
- the caller's selected feature or coherent sprint, with unrelated scope explicitly excluded.
79
-
80
- ## Phase 2 — Shape the approach · gate: BLOCK
81
-
82
- Before drilling into details, establish WHICH design the details belong to:
83
-
84
- - Propose the genuine candidate approaches — usually two or three — each with its real trade-off stated (`X gives you A but costs B`). Recommend exactly one, with the reasoning that picks it. The user rules on material product decisions during initial feature or sprint planning; within an already-approved sprint, its existing delegated decision rules apply and the choice is logged. A recommendation made before approval does not authorize execution.
85
- - **Never manufacture alternatives.** When only one sane approach exists, say so and say why — a padded list of straw options is noise wearing the costume of rigor, and it trains the reader to skim the one section that matters.
86
- - **Check each candidate against accepted ADRs** (the pre-flight index; ADR-0025). A contradicting candidate is surfaced WITH the ADR citation, never silently dropped — and it may not be recommended except paired with a supersession fork via `/adr`. When the contradicting candidate is the only sane approach, that IS the fork: present it (the user rules under `/feature`; under `/sprint` this surfaces at the interactive Phase 1 gate, where the user is present to rule).
87
- - Apply the isolation lens to the recommended shape while it is still soft: can each part be understood without reading its internals, and can its internals change without breaking its consumers? A design that fails this here fails it again in review, after the code exists.
88
- - Apply the YAGNI lens: strike anything the Phase 1 problem statement does not demand. A capability the caller never asked for is scope creep with a head start.
89
-
90
- Gate: one approach selected under the caller's existing authority and recorded with its trade-off;
91
- nothing in it exceeds the stated problem. Selection during initial planning is not execution authority.
92
-
93
- ## Phase 3 — Socratic refinement loop · gate: BLOCK
94
-
95
- Turn the chosen approach concrete. The discipline is decide-or-ask, never drift:
96
-
97
- - **Choose methods; ask missing decisions.** Select reversible parameters and implementation methods
98
- within safety-core's decision-authority limits; multiple reasonable methods alone do not require a
99
- user choice. Record material decisions in the running notes and the spec's **Decided parameters**.
100
- Use the existing delegated decision rules only where the approved sprint covers the choice. A
101
- missing product decision, unresolved `[CONFIRM-NN]`, scope expansion or irreversible operation is
102
- not a method choice: ask the actual question with its recommendation and counter-consideration.
103
- - **Batch what is independent.** Forks whose answers do not depend on each other are asked together, not serialized into rounds. One round of three real questions beats three rounds of one.
104
- - Run every answer through three lenses:
105
- - **Vague language** — make the required outcome observable: "fast", "secure" and "scalable"
106
- need acceptance boundaries. Only unresolved product requirements or missing user-owned decisions
107
- become `[CONFIRM-NN]`; a reversible implementation detail deliberately left to planning within
108
- the agreed constraints is not an unanswered user question. Do not invent unknowns to fill a template.
109
- - **Hidden complexity** — name what the user assumes is easy but is hard: state, concurrency, edge cases, failure modes, validation, idempotency, migration of existing data. Surface it now or it surfaces in `tdd`.
110
- - **Trade-off forcing** — identify the actual choice and its counter-consideration. Apply the caller's existing authority: ask material user-owned decisions, or choose and log an authorized delegated method. Never hide a choice or widen delegation.
111
- - **The loop has a breaker.** When refinement stops converging, stop repeating the same question or
112
- hypothesis. Reuse an applicable recorded ruling; within delegation, diagnose and choose a different
113
- evidence-supported method. A genuine unresolved user decision or rule conflict is surfaced once
114
- through its owner, never guessed or treated as permission. Do not manufacture `[CONFIRM-NN]` for
115
- the agent's internal choice of method.
116
- - **Closure is a checklist, not a feeling.** The reasons to stop asking that do not count, each with why:
117
- - *"The feature is simple enough."* — Simplicity shortens the spec; it does not waive it. The five-sentence spec still names its criteria.
118
- - *"I've asked enough questions."* — Question fatigue is not an exit condition. The exit is the Phase 5 review passing.
119
- - *"The user seems eager to move on."* — Eagerness is a signal to compress the asking (decide more parameters, batch harder), never to skip an unresolved fork.
120
- - *"We can settle it during implementation."* — Missing acceptance requirements cannot be deferred
121
- as implementation freedom. Record genuine user-owned unknowns; retain method selection within
122
- the existing planning and delegated-execution contract.
123
-
124
- Record every genuinely-unresolved user-owned requirement or decision as `[CONFIRM-NN]` in `<project-root>/.codearbiter/open-questions.md`, numbered sequentially. A finding that belongs to a different feature or a future scope gets an inline `[NEEDS-TRIAGE]` marker in the notes — never route it to a ticket.
125
-
126
- **Before closing this loop, check the criteria decided so far against their own stated intent, not merely against each other** (#566: `writing-plans` Phase 4 proves BIJECTION between a plan's tasks and the `AC-NN` ledger — every criterion has a task, every task has a criterion — and that proves the two AGREE, never that the ledger itself is COMPLETE. A criterion missed by both sides passes that check cleanly; catching the miss belongs here, at the source, before Phase 4 writes anything to freeze it in place.) Assemble a scratch file outside the working tree (`mktemp`) shaped like the spec sections Phase 4 is about to write — a `## Scope` heading over the Phase 1 framing, and an `## Acceptance criteria` heading over every criterion decided in this phase's running notes so far — and, when this feature traces to a GitHub issue, its body into a second scratch file (`gh issue view <N> --json body -q .body > <scratch-file>`; omitted when there is no linked issue). Run `"$PY" "<plugin-root>/hooks/_intentlib.py" uncovered-intent <scope-and-criteria-file> [--issue-body <scratch-file>]`. A non-empty result names an in-scope bullet or an issue acceptance checkbox no criterion's text cites — add the missing criterion now, or record it as a `[CONFIRM-NN]` if it is genuinely undecided, never carry it forward uncited. This mechanical pass is the CHEAP half; it catches only an uncited bullet or checkbox.
127
-
128
- Then ask the half it cannot mechanize, explicitly, as its own step: **if every criterion decided so far passed and nothing else changed, what would still be broken?** A real answer names a criterion the ledger is still missing even though every scope bullet and checkbox is technically cited — a bullet reading "fix all three contaminated skills" against criteria for two of the three passes the citation check above cleanly, and only this question catches it. Finding nothing broken is a reportable result, stated in one line, never a silent skip.
129
-
130
- Gate: every vague term made concrete; every material choice resolved under the caller's authority or recorded as a genuine `[CONFIRM-NN]`; every parameter decision recorded in the running notes that seed Phase 4's **Decided parameters** section; no unresolved user-owned acceptance requirement outside a `[CONFIRM-NN]`; the `uncovered_intent` backstop returns empty or every finding is resolved; and the negative question above has been asked and answered, not merely named. A blocking `[CONFIRM-NN]` that gates the spec's core stops the loop — surface it and STOP.
131
-
132
- ## Phase 4 — Write the spec · gate: BLOCK
133
-
134
- Create or revise the agreed spec at the route-selected spec path, in its selected format.
135
- New full-lane work uses `<project-root>/.codearbiter/specs/<slug>.html` through the installed
136
- structured-artifact engine; do not write HTML or its embedded model directly. An existing `.md`
137
- spec stays on its exact legacy path; never create a counterpart or implicitly convert it.
138
- The spec holds:
139
-
140
- - **Problem** — the Phase 1 framing in final form.
141
- - **Approach** — the Phase 2 choice and the trade-off that picked it, in two or three sentences.
142
- - **Scope** — what is in, and the explicit out-of-scope boundary.
143
- - **Decided parameters** — the parameter-level choices made in Phase 3, each in one line, so the approval reads them instead of discovering them in code review.
144
- - **Acceptance criteria** — a numbered list, each criterion concrete and testable: a specific input, the observable output, the boundary or failure behavior. Each criterion is verifiable by one or more focused tests. "It works well" is not a criterion. These become `tdd` Phase 1 obligations — one obligation per criterion, so an untestable criterion is a defect to fix here, not in `tdd`.
145
- - **Open questions** — every `[CONFIRM-NN]` raised, cross-referenced to `open-questions.md`.
146
- - **Governs** *(optional)* — a spec-header line `**Governs:** <comma-separated globs>` that enrolls the approved spec in file-scoped just-in-time context injection: on a Read of any file matching one of the listed globs, a pointer to this spec is surfaced to the agent (tier 3 of the file→knowledge map). Adding the line is sufficient to enroll; no other change required.
147
-
148
- Gate: the spec file exists on disk under `specs/`, with at least one acceptance criterion and every criterion individually testable.
149
-
150
- ## Phase 5 — Review, approval & handoff · gate: STOP
151
-
152
- The spec earns its approval; it is not waved through. Two passes over the FILE as written, then the stop:
153
-
154
- 1. **Mechanical self-review** — one pass, correct through the selected format's owning writer, no re-review: no placeholder text (`TBD`, `???`, an unfilled section); no criterion that contradicts the scope; nothing that crosses the `CONTEXT.md` NOT-building boundary; no criterion that contradicts an accepted ADR or `plans/01`'s recorded component boundaries (ADR-0025); every criterion still testable by one or more focused tests after the edits; the vague-language lens applied to the spec's own prose.
155
- 2. **Adversarial pass** — build the strongest case AGAINST the design before the user reads it: the failure mode most likely to be real, the criterion most likely to be wrong, the assumption that would invalidate the approach if false. Present what survives WITH the spec at approval — the user rules on a challenged design, not a defended one. Finding nothing is a reportable result, stated in one line, not a silent skip.
156
- 3. **Approval:**
157
- - **Under `/feature`** — present the spec and the adversarial findings, and request explicit user approval. Iterate on the file in place until the user approves. A blocking `[CONFIRM-NN]` must be resolved by the user before approval — never auto-resolve it.
158
- - **Initial `/sprint` planning** — prepare the ready draft spec and adversarial findings for
159
- explicit user approval with its complete draft plan at the caller's one initial review gate.
160
- For HTML, return the current draft identity to `writing-plans` in `draft_for_pair` mode;
161
- the combined `arm-sprint` / `sprint-approve` path in `<plugin-root>/includes/artifacts.md`
162
- observes the exact returned reply and binds/approves both documents atomically. Do not separately approve
163
- the spec, synthesize a SMARTS receipt, or execute draft tasks. Do not reinterpret one generic reply
164
- as approval of either artifact or delegation. Autonomy begins only after the
165
- caller's spec AND plan approval requirement is met. A legacy Markdown caller retains its
166
- recorded approval mechanism; there is no implicit conversion.
167
-
168
- - **Within an already-approved sprint** — use its existing delegation only for an in-scope choice.
169
- For HTML, a supported policy-owned adapter must supply the actual event and engine receipt;
170
- follow `<plugin-root>/includes/artifacts.md`. A SMARTS score or log entry is not an approval receipt.
171
- The private `smarts-apply` producer covers only existing plan-method steps under an explicit
172
- paired user grant; it cannot approve a specification amendment or widen its protected scope.
173
- Use only a qualified production producer for the requested authority and host; do not invent a capture event
174
- or reuse inspection-only evidence. A missing producer is not delegation: retain the pending state and use
175
- only the existing supported authority path. The native engine's presence does not qualify a host adapter.
176
- Blocking `[CONFIRM-NN]` decisions are never auto-approved in either phase.
177
-
178
- **Continuation follows the caller.** For a full-lane feature or sprint with approved spec authority,
179
- return the approved spec identity and review outcome to its planning step; for initial HTML sprint
180
- review, return the ready draft identity without execution authority. Either may forward directly to
181
- `writing-plans` (`<plugin-root>/routines/writing-plans/SKILL.md`) when that is the caller's declared
182
- next step. Do not skip required plan creation, binding or approval by jumping to `tdd`. A subordinate
183
- invocation returns to the named checkpoint in its caller instead of launching another full workflow.
184
- The inline small feature route belongs to `/feature` and can reach `tdd` without invoking this full-lane
185
- specification procedure. Neither path grants commit, PR, merge or publication authority.
186
-
187
- Gate: both review passes completed against the authoritative file, adversarial findings presented,
188
- and no unresolved blocking `[CONFIRM-NN]`. Require actual approval verified before execution.
189
- Only initial combined HTML review may return a ready unapproved draft to its constrained planner.
190
- The next operation obeys the active caller's sequence and authority.
191
-
192
- ## Hard rules
193
-
194
- - MUST NOT write implementation code or route to `tdd` before the spec is on disk under `specs/` AND approved.
195
- - MUST preserve the caller's feature or coherent sprint boundary; unrelated scope is split or excluded, not silently absorbed.
196
- - MUST NOT manufacture alternatives in Phase 2 — when one sane approach exists, say so and why.
197
- - MUST NOT write an acceptance criterion that cannot be verified by one or more focused tests.
198
- - MUST record material parameter choices; ask genuine missing user decisions in full, not internal method-selection questions already covered by delegation.
199
- - MUST stop a non-converging refinement strategy; reuse recorded rulings or authorized diagnosis rather than repeat an answered question. Genuine conflicts still route to their owner.
200
- - MUST run the `uncovered_intent` mechanical backstop and ask the negative-judgment question ("if every criterion passed and nothing else changed, what would still be broken?") before closing Phase 3 — bijective coverage in `writing-plans` proves the plan and the ledger agree with each other, never that the ledger is complete (#566).
201
- - MUST run the Phase 5 mechanical self-review and adversarial pass against the file as written, and present the adversarial findings at approval.
202
- - MUST NOT resolve a `[CONFIRM-NN]` by guessing — surface it and record it in `open-questions.md`.
203
- - MUST NOT auto-approve a spec carrying a blocking `[CONFIRM-NN]`, even under `/sprint` — it escalates to the user.
204
- - MUST NOT contradict the NOT-building list or redefine domain vocabulary in `CONTEXT.md` — a contradiction is a conflict to surface, not reconcile.
205
- - MUST NOT run decompose's six-layer whole-project interview or force a coherent sprint through repeated one-feature interviews.
206
- - MUST NOT use SMARTS to approve the initial sprint; record delegated decisions in the existing audit trail and verify actual authority for the selected artifact format.
207
- - MUST, at exit, run the follow-up harvest (`<plugin-root>/includes/harvest.md`) in the active caller's mode:
208
- batch-confirm interactive work; use autonomous promotion only under existing delegation. A blocking
209
- decision is never promoted into authority or silently demoted to a follow-up.
9
+ Refine the agreed outcome before implementation. This is intent clarification and specification authoring, not a second permission system. The feature or sprint request is the initial authorization; ask about consequential choices not already answered, not whether an artifact may exist.
10
+
11
+ ## Format and caller
12
+
13
+ For artifact I/O, load `<plugin-root>/includes/artifacts.md` and select the source with `_select_authoring_route`. Retain that source identity through specification authoring.
14
+
15
+ The calling feature or sprint owns scope and the next step. A sprint may include several related features under one coherent goal. A small inline feature remains the caller's mini-spec lane. Specification authoring itself does not grant commit, publication, override, provider spending, or irreversible-operation authority.
16
+
17
+ Use relevant CONTEXT.md, tech-stack.md and security-controls.md when present. Read an existing open-questions document and relevant ADR/plan headings index-first. Missing optional historical indices are not blockers. Preserve real decisions while distinguishing an accepted decision from implemented or released behavior.
18
+
19
+ ## Recorded intent and consequential conflicts
20
+
21
+ Use an index-first recorded-intent read to avoid asking about settled choices.
22
+ This pre-flight is exempt from the read-or-STOP rule when optional project
23
+ history is absent: **intent: silent — no decomposition record**. Do not
24
+ manufacture a plan or an approval to fill that gap.
25
+
26
+ If a proposed solution resurrects a capability `plans/02` records as deferred,
27
+ identify the original reason and any stated re-evaluation trigger, then fork to ask
28
+ only when the *outcome* would materially change. An explicit current owner steer
29
+ can settle that fork; an ordinary implementation detail cannot silently reverse
30
+ a recorded deferral.
31
+
32
+ A candidate that contradicts an accepted ADR must be **surfaced WITH the ADR
33
+ citation, never silently dropped**. A recommended outcome change is paired with
34
+ a supersession fork via `/adr` instead of pretending the old decision never
35
+ existed. If the contradiction is the only sane approach, that IS the fork:
36
+ show the choice and consequence to the owner once, respecting an already
37
+ recorded superseding instruction. A referenced ADR is not a new permission
38
+ token for safe, in-scope investigation or implementation.
39
+
40
+ ## Phase 1 - Frame
41
+
42
+ State the problem, observable result, intended scope and explicit exclusions. Respect what the user already requested. If a record conflicts with new intent, identify the material decision and which work it affects; do not automatically create another approval round for ordinary method choices.
43
+
44
+ ## Phase 2 - Select a viable approach
45
+
46
+ Consider genuine trade-offs where they matter, recommend a suitable approach and explain why. Do not manufacture straw alternatives. Reversible implementation methods remain agent-owned within the agreed outcome. Ask for a user ruling on an unresolved, consequential product choice, not on every viable implementation detail.
47
+
48
+ **Never manufacture alternatives.** When only one sane approach exists, say so in one line and say why; that path runs no SMARTS comparison and adds no SMARTS table.
49
+
50
+ **SMARTS on a material choice.** Only when two or more materially plausible approaches exist, run a SMARTS comparison per `<plugin-root>/includes/smarts/core.md` inline before recommending one. Bound it to the context-envelope dimensions that could differentiate the approaches, mark missing evidence `Unknown` with its missing observation, and surface a decision-critical `Unknown` before selecting. If every candidate carries one, pause the selection until the missing observation is resolved or the user rules. The comparison dispatches no grader or scout, performs no bulk read of `plans/` or `decisions/`, and loads `<plugin-root>/includes/smarts/lenses.md` only when a verdict turns on a consideration the core summaries do not settle. Name cost, schedule, team-skill, vendor or stakeholder constraints alongside the result; they never become a seventh lens. Apply the core's priority order when lenses conflict; a tie without explicit priority evidence goes to the user. An explicit request for a full SMARTS read changes only the presentation depth — the full option-by-option table — with no new command and no change to decision authority.
51
+
52
+ **Record the rationale.** When the comparison ran, write the decisive lenses, any `Unknown` with its missing observation, the non-SMARTS constraints and the selection reason into the spec's `SEC-SMARTS` section, or the `## SMARTS design rationale` section of a Markdown spec. A single-approach choice records only its one-line statement there.
53
+
54
+ Review applicable ADRs and explicit exclusions. A real conflicting architecture decision goes to its owner. Mentioning a protected file does not by itself restart the entire feature interview.
55
+
56
+ ## Phase 3 - Make acceptance observable
57
+
58
+ Turn intended scope into specific criteria: input or trigger, expected behavior, and relevant failure/boundary condition. Check integration risks and ask: **if every criterion passed, what would still be broken?** For meaningful behavior changes, plan one or more focused tests against the actual obligation; do not create tests solely to clear an artifact gate. For complex or issue-backed work, a bounded `_intentlib.py uncovered-intent` inspection can catch uncited requirements. It is not a mandatory permission gate for every small change.
59
+
60
+ Choose sensible defaults and record material parameters. Do not create CONFIRM placeholders for normal method choices. A consequential unresolved requirement warrants one clear user question; independent work may proceed if that decision affects only part of the plan. Do not repeatedly ask the same question merely because an artifact was revised.
61
+
62
+ ## Phase 4 - Write the spec
63
+
64
+ Create or update the route-selected spec with: problem, chosen approach and rationale, included/excluded scope, meaningful parameters, observable acceptance criteria, and actual open decisions. For HTML use typed `create` and `apply`, stable criterion IDs, current CAS, and symbol-scoped readback; never edit embedded HTML/JSON directly. Existing Markdown remains on the legacy path without automatic conversion. Do not invent a command, test, source, approval or result.
65
+
66
+ Drafts may be incomplete. `validate` with `gate: ready` identifies missing coverage and structure. Diagnostics help complete the plan; they are not a reason to prohibit independent authorized investigation. A conflicting write or structural failure still prevents claiming the artifact was saved. A ready spec is not proof of implementation.
67
+
68
+ ## Phase 5 - Self-review and handoff
69
+
70
+ Read back the saved specification. Check consistency, alignment with the user's request, exclusions, and ability to verify: no criterion that contradicts an accepted ADR without an explicitly resolved, source-visible owner decision. Identify a plausible failure mode or say none was found. Proportion the review to risk rather than mandating an adversarial committee.
71
+
72
+ For full-lane feature or sprint work, return the selected spec identity, normative digest, criteria, and genuinely open decisions directly to `writing-plans` (`<plugin-root>/routines/writing-plans/SKILL.md`). The caller maintains its ordering; do not skip a useful plan to reach implementation. An existing spec should resume at its actual unfinished step, not restart an interview.
73
+
74
+ **Do not demand separate spec approval or `arm-sprint`/`sprint-approve` merely to progress.** An explicitly requested human review pause and real user-owned decisions still apply. Historical paired approval, producer capture or SMARTS grant remains historical; do not fabricate a receipt. In-scope method updates during work are typed plan maintenance, not another permission interview.
75
+
76
+ ## Hard boundaries
77
+
78
+ Never broaden the requested outcome, ignore a genuine host denial or user stop, manufacture verification evidence, silently change representation, or claim a saved/verified state without observing it. Preserve source integrity and independently applicable security controls. Avoid interviews for already-answered or agent-owned choices.
@@ -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.