create-agent-rig 0.6.2 → 0.7.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.
- package/CHANGELOG.md +95 -0
- package/package.json +1 -1
- package/templates/agent-os/stack/node-ts/.claude/rules/node-ts.md +2 -3
- package/templates/agent-os/universal/.agents/skills/loop/SKILL.md +117 -80
- package/templates/agent-os/universal/.agents/skills/pr-ship/SKILL.md +19 -12
- package/templates/agent-os/universal/.claude/hooks/block-no-verify.mjs +23 -3
- package/templates/agent-os/universal/.claude/hooks/guard-bash.mjs +65 -7
- package/templates/agent-os/universal/.claude/hooks/guard-core-purity.mjs +2 -2
- package/templates/agent-os/universal/.claude/hooks/guard-web-boundary.mjs +2 -2
- package/templates/agent-os/universal/.claude/hooks/lib/hook-input.mjs +109 -0
- package/templates/agent-os/universal/.claude/rules/invariants.md +19 -0
- package/templates/agent-os/universal/.claude/scripts/lib/claim-records.mjs +800 -0
- package/templates/agent-os/universal/.claude/scripts/lib/revalidation-evidence.mjs +56 -0
- package/templates/agent-os/universal/.claude/scripts/lib/shell-tools.mjs +81 -0
- package/templates/agent-os/universal/.claude/scripts/preflight.mjs +19 -1
- package/templates/agent-os/universal/.claude/scripts/queue/core.mjs +17 -66
- package/templates/agent-os/universal/.claude/scripts/queue/github-issues.mjs +29 -7
- package/templates/agent-os/universal/.claude/scripts/queue/index.mjs +159 -23
- package/templates/agent-os/universal/.claude/scripts/queue/jira.mjs +41 -19
- package/templates/agent-os/universal/.claude/scripts/queue/plan-md.mjs +4 -2
- package/templates/agent-os/universal/.claude/scripts/revalidate.mjs +268 -48
- package/templates/agent-os/universal/.claude/scripts/revalidation-report.mjs +32 -15
- package/templates/agent-os/universal/.claude/scripts/run-state.mjs +180 -37
- package/templates/agent-os/universal/.claude/settings.json +1 -1
- package/templates/agent-os/universal/.claude/skills/loop/SKILL.md +117 -80
- package/templates/agent-os/universal/.claude/skills/pr-ship/SKILL.md +19 -12
- package/templates/agent-os/universal/.codex/hooks.json +1 -1
- package/templates/agent-os/universal/.rig/revalidation.json +10 -0
- package/templates/agent-os/universal/docs/decisions/codex-adapter.md +3 -2
- package/templates/agent-os/universal/docs/decisions/content-blind-revalidation.md +144 -0
- package/templates/agent-os/universal/layers.json +5 -0
- package/templates/hash-history.json +36 -15
- package/templates/release-ledger.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,101 @@ Numbering is ordinary semver — **additive is a minor, a fix is a patch** — s
|
|
|
11
11
|
that "I only take minors" remains a usable policy; 0.3.2 shipped additive
|
|
12
12
|
content as a patch by the owner's call and stays recorded as one.
|
|
13
13
|
|
|
14
|
+
## 0.7.0
|
|
15
|
+
|
|
16
|
+
**A durable claim record under the revalidation 0.6.2 already had, and the
|
|
17
|
+
governance fixes that followed it.** 0.6.2 could already re-check at a
|
|
18
|
+
checkpoint whether the branch about to ship is still the branch the run took
|
|
19
|
+
up. What a newly scaffolded project gains here is the layer under that: a
|
|
20
|
+
content-blind record of what was claimed, so the re-check no longer rests on
|
|
21
|
+
the run's own take-up snapshot. The public CLI is unchanged — no new command,
|
|
22
|
+
no new flag, no new dependency.
|
|
23
|
+
|
|
24
|
+
**Numbered a minor deliberately.** The rule at the top of this file is that
|
|
25
|
+
additive is a minor and a fix is a patch, so that "I only take minors" stays a
|
|
26
|
+
usable policy. **Five** files land in a generated rig that the published 0.6.2
|
|
27
|
+
does not contain — the four listed under Added, plus
|
|
28
|
+
`.claude/scripts/lib/shell-tools.mjs`, the shared shell-tool list the Never-tier
|
|
29
|
+
guards read. One of the five is a config file the project owns. Shipping that as
|
|
30
|
+
a patch is the case the rule exists to prevent.
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **Content-blind revalidation claims.** A run records what it claimed at each
|
|
35
|
+
checkpoint and compares it later without copying the tracker's content, so the
|
|
36
|
+
re-check does not depend on the run remembering correctly. A generated project
|
|
37
|
+
receives `.claude/scripts/lib/claim-records.mjs`,
|
|
38
|
+
`.claude/scripts/lib/revalidation-evidence.mjs`, `.rig/revalidation.json` and
|
|
39
|
+
the decision record `docs/decisions/content-blind-revalidation.md`.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- **The Never-tier guards, and the kill switch they carry, run on every shell
|
|
44
|
+
surface — where before they ran on one.** They were wired under a single tool
|
|
45
|
+
matcher, so a second shell surface reached none of them: a force-push of a shared branch, a filesystem wipe and a
|
|
46
|
+
pre-commit bypass all ran there with the brake armed. The guards now read one
|
|
47
|
+
shared list of shell tools rather than each comparing its own literal, and the
|
|
48
|
+
tests spawn them on every entry in that list instead of checking the wiring
|
|
49
|
+
alone — which is how the gap survived its own test suite.
|
|
50
|
+
|
|
51
|
+
⚠ Running is not the same as covering, and the limit is stated where the list
|
|
52
|
+
is. The rules match a command NAME, so they refuse an operation only in that
|
|
53
|
+
spelling: with the brake armed, `gh pr merge …` is refused on both surfaces
|
|
54
|
+
while `gh.exe pr merge …` and `Remove-Item -Recurse -Force C:\` are not. That
|
|
55
|
+
bound belongs to the rule set rather than to the matcher — the `.exe` spelling
|
|
56
|
+
was allowed on the original surface too — and it is unchanged by this
|
|
57
|
+
release.
|
|
58
|
+
|
|
59
|
+
- **An adapter it cannot read is `UNVERIFIABLE`, not a stack trace.** A
|
|
60
|
+
revalidation whose queue adapter could not be reached exited on a raw Node
|
|
61
|
+
stack trace, which a caller could read as noise rather than as a hold. It now
|
|
62
|
+
takes the same hold path a real drift takes and never returns a pass. The
|
|
63
|
+
reason it prints is withheld whenever it carries userinfo — as a class, not as
|
|
64
|
+
a list of spellings, after two rounds in which each fix closed the form just
|
|
65
|
+
found and left the next one open. A queue configuration that cannot be
|
|
66
|
+
resolved at all is a refusal with a readable message rather than a crash.
|
|
67
|
+
|
|
68
|
+
- **The instruction surface no longer cites this repository's backlog.** The
|
|
69
|
+
`loop` and `pr-ship` skills and the Node/TypeScript stack rule carried ticket
|
|
70
|
+
identifiers, commit SHAs and PR numbers from the tracker that built them —
|
|
71
|
+
provenance a downstream reader cannot open, in artifacts whose only job is to
|
|
72
|
+
instruct. A mechanical check now scans every layer's rules, skills, agent
|
|
73
|
+
specs and top-level instruction files and fails on a backlog identifier,
|
|
74
|
+
without banning those letters repository-wide.
|
|
75
|
+
|
|
76
|
+
⚠ Scoped deliberately, and the scope is not the whole rig. Two of the check's
|
|
77
|
+
exclusions ship: the `.claude/scripts/**` and `.claude/hooks/**` trees, whose
|
|
78
|
+
citations are comments addressed to whoever edits the mechanism rather than
|
|
79
|
+
instructions the agent follows, and `docs/decisions/`, where a record's whole
|
|
80
|
+
job is to say what happened. Together **86 citations across 27 files** still
|
|
81
|
+
arrive with a generated project — 78 in the first pair, 8 in the records.
|
|
82
|
+
Whether they are the same defect is a live question this release does not
|
|
83
|
+
settle.
|
|
84
|
+
|
|
85
|
+
- **Evidence pointers are checked rather than trusted.** A pointer of the form
|
|
86
|
+
`file › "test name"` is what keeps a claim about a mechanism honest; several
|
|
87
|
+
named tests that had been renamed or moved. A check now resolves them, and a
|
|
88
|
+
pointer into a suite a generated project never receives has to say so.
|
|
89
|
+
|
|
90
|
+
⚠ Its coverage is partial and it states that itself: it reads a citation's
|
|
91
|
+
names from the line the file is named on and the two after it, and resolves a
|
|
92
|
+
target by basename, so a test moved to another directory still passes. A green
|
|
93
|
+
run means no citation it read has gone dead — not that every pointer was
|
|
94
|
+
verified.
|
|
95
|
+
|
|
96
|
+
- **The `loop` skill now describes how the run directory actually reaches each
|
|
97
|
+
command.** It had described a directory most of its own commands could not be
|
|
98
|
+
told about, so a reader could journal into one place while a check looked in
|
|
99
|
+
another. The correction is to the skill's text, not to the plumbing: the two
|
|
100
|
+
commands that take it as an argument rather than from the environment are now
|
|
101
|
+
named, and a correspondence check walks every script rather than a list
|
|
102
|
+
somebody maintains.
|
|
103
|
+
|
|
104
|
+
### Documentation
|
|
105
|
+
|
|
106
|
+
- `docs/command-contract.md` records what the CLI promises and which of its
|
|
107
|
+
commands conform today. Generator-only; it does not ship into a rig.
|
|
108
|
+
|
|
14
109
|
## 0.6.2
|
|
15
110
|
|
|
16
111
|
**Patch hardening for the Agent OS shipped by 0.6.1.** This release closes six
|
package/package.json
CHANGED
|
@@ -58,9 +58,8 @@ gh api "repos/{owner}/{repo}/commits/$SHA/check-runs" \
|
|
|
58
58
|
**A head that gets no run at all is a third state, not a slow one.** A
|
|
59
59
|
`pull_request` push can register no workflow run and emit no failure signal —
|
|
60
60
|
the head sits with a scanner only, and the poll above waits forever while the
|
|
61
|
-
previous head's green sits one line up in the same PR
|
|
62
|
-
|
|
63
|
-
registered" apart from "pending" by asking for runs by head, not by PR:
|
|
61
|
+
previous head's green sits one line up in the same PR. Tell "not registered"
|
|
62
|
+
apart from "pending" by asking for runs by head, not by PR:
|
|
64
63
|
|
|
65
64
|
```sh
|
|
66
65
|
gh api "repos/{owner}/{repo}/actions/runs?head_sha=$SHA" \
|
|
@@ -45,7 +45,7 @@ composed file:
|
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
47
|
node .claude/scripts/queue/index.mjs board # the active board and the declared ones
|
|
48
|
-
node .claude/scripts/queue/index.mjs board
|
|
48
|
+
node .claude/scripts/queue/index.mjs board <board-id> # switch this checkout: writes .claude/queue.board
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
The selector is per-checkout runtime state, the same class as
|
|
@@ -79,13 +79,14 @@ state-vs-queue split exists to prevent.
|
|
|
79
79
|
node .claude/scripts/preflight.mjs
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
exported ·
|
|
84
|
-
|
|
82
|
+
Five items are scripted (kill switch absent · `RIG_RUN_DIR` not already
|
|
83
|
+
exported · the versioned revalidation detection contract is supported · local
|
|
84
|
+
default branch matches the remote · the last deploy concluded successfully)
|
|
85
|
+
and the script **prints the ones it did not check, every time**. Paste the block into the journal: a checklist that
|
|
85
86
|
leaves no record cannot tell you it was skipped.
|
|
86
87
|
|
|
87
88
|
Verdicts: **STOP** → do not start, deal with the cause. **CAUTION** → start,
|
|
88
|
-
knowing which ground is soft. **GO** → the scripted
|
|
89
|
+
knowing which ground is soft. **GO** → the scripted five are clean; the rest are
|
|
89
90
|
still yours.
|
|
90
91
|
|
|
91
92
|
**An `unknown` never becomes a `pass`.** A probe that could not run tells you
|
|
@@ -118,9 +119,31 @@ mkdir -p "$RIG_RUN_DIR"
|
|
|
118
119
|
never with a variable the session exported — pinned in the generator's
|
|
119
120
|
`test/template/guard-rulebook.test.ts` (absent in a generated rig) › "only a
|
|
120
121
|
flag arms it — an exported RIG_UNATTENDED=1 with no flag changes nothing" —
|
|
121
|
-
and in some harnesses the export does not even survive to the next Bash call
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
and in some harnesses the export does not even survive to the next Bash call.
|
|
123
|
+
|
|
124
|
+
🔴 **So re-export it in every call that needs it.** `RIG_RUN_DIR` is how the run
|
|
125
|
+
directory reaches the commands that read it from the environment — and two of
|
|
126
|
+
the commands this skill invokes read it from somewhere else instead.
|
|
127
|
+
`unattended-flag.mjs` does not read the variable; it takes the directory as
|
|
128
|
+
`--run-dir`, which is why the call below passes it explicitly.
|
|
129
|
+
`revalidation-report.mjs` does not read it either; it takes `--runs <dir>`.
|
|
130
|
+
For every other command this skill invokes the variable is the whole of it, and
|
|
131
|
+
passing the flag is not a fallback but an unrecognised argument — after which a
|
|
132
|
+
command writes into a run directory nobody declared, or refuses for want of one
|
|
133
|
+
while the caller believes it was told. Modules this skill *imports* rather than
|
|
134
|
+
invokes are a third case again: `run-journal.mjs` and `queue/state.mjs` are
|
|
135
|
+
handed a `runDir` by their caller, which is why §9 lists it among the details
|
|
136
|
+
that must be copied rather than re-derived.
|
|
137
|
+
|
|
138
|
+
`--run-dir` is taken by `unattended-flag.mjs`, and by no other script under
|
|
139
|
+
`.claude/scripts/`. That is measured over the whole tree rather than against a
|
|
140
|
+
list, in both directions, by the generator's
|
|
141
|
+
`test/template/correspondence.test.ts` (absent in a generated rig) › "names
|
|
142
|
+
exactly the commands that take --run-dir, and only those" — so a script anywhere
|
|
143
|
+
in that tree that gains the flag without this sentence gaining its name goes
|
|
144
|
+
red.
|
|
145
|
+
|
|
146
|
+
What a hook CAN see is a file, so the unattended signal is one:
|
|
124
147
|
|
|
125
148
|
```bash
|
|
126
149
|
# at claim time, from the paths the item names (repo-relative prefixes, with
|
|
@@ -141,12 +164,11 @@ rig — › "blocks a hook-config edit with an empty allow-list, naming path, it
|
|
|
141
164
|
|
|
142
165
|
⚠ **The export outlives the run's own calls.** Everything the session spawns
|
|
143
166
|
inherits it — and a test suite that spawns the queue CLI would write fixture
|
|
144
|
-
records into this run's trace
|
|
145
|
-
|
|
146
|
-
to start on a `RIG_RUN_DIR` already exported. The generator's own test harness
|
|
167
|
+
records into this run's trace. So preflight refuses to start on a
|
|
168
|
+
`RIG_RUN_DIR` already exported. The generator's own test harness
|
|
147
169
|
also scrubs the variable before any test file loads — its `test/setup-env.ts`,
|
|
148
|
-
pinned by its `test/template/rig-run-dir-scrub.test.ts`
|
|
149
|
-
variable exported around the whole vitest process" — and **neither file ships
|
|
170
|
+
pinned by its `test/template/rig-run-dir-scrub.test.ts` (absent in a generated
|
|
171
|
+
rig) › "holds with the variable exported around the whole vitest process" — and **neither file ships
|
|
150
172
|
into a generated rig**: here, nothing scrubs it, and a rig's own test setup is
|
|
151
173
|
the place to do the same.
|
|
152
174
|
|
|
@@ -198,12 +220,12 @@ reported by `hygiene` as `owner-mismatch`. It clears the way `trigger-human`
|
|
|
198
220
|
does: a human moves the item or re-marks it. An unmarked item is unconditional.
|
|
199
221
|
Two items of another product once entered this queue as normal spacers and
|
|
200
222
|
escalated `PREMISE FALSE` back to back — a run-level stop spent on work that
|
|
201
|
-
was never this checkout's
|
|
223
|
+
was never this checkout's. Pinned in the generator's
|
|
202
224
|
`test/template/queue-owner.test.ts` — absent in a generated rig — › "holds an
|
|
203
225
|
item whose owner is another repository, with the cause named".
|
|
204
226
|
|
|
205
227
|
🔴 **An item's lifecycle is a label a human wrote, and the loop infers none of
|
|
206
|
-
it
|
|
228
|
+
it**. Four words, read by `lifecycleOf` in `core.mjs` so every adapter
|
|
207
229
|
means the same thing — three of lifecycle, one of scheduling:
|
|
208
230
|
|
|
209
231
|
- `keep-core` — the problem and the responsibility are valid and the item is
|
|
@@ -285,59 +307,72 @@ and the work turns out to touch an elevated path (`CLAUDE.md` →
|
|
|
285
307
|
`elevated-paths`), run the gate anyway, record the verdict on the PR, and treat it
|
|
286
308
|
as this run's elevated item for spacing.
|
|
287
309
|
|
|
288
|
-
**Selection
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
310
|
+
**Selection is the first point of the one revalidation chain.** On the first
|
|
311
|
+
successful SELECT, `next` creates a versioned content-blind baseline at
|
|
312
|
+
`.rig/claims/<item-id>.json` and reports `BASELINE_CREATED`. Add that record to
|
|
313
|
+
the task's branch: a later SELECT, BEFORE_PR or BEFORE_CLOSE refuses an
|
|
314
|
+
untracked record, and a resumed checkpoint with no record is `UNVERIFIABLE`.
|
|
315
|
+
The `scope` fingerprint set is authoritative at SELECT and BEFORE_PR and
|
|
316
|
+
includes workflow state normalised to the state that checkpoint expects;
|
|
317
|
+
`commentary` is observed there but becomes hold-authoritative only at
|
|
318
|
+
BEFORE_CLOSE. Neither set stores title, description or comment bodies.
|
|
319
|
+
For Jira and GitHub issues, the adapter's successful `claim` writes its
|
|
320
|
+
observable `in-progress` transition into that same record as `workflowClaim`.
|
|
321
|
+
Only that durable acknowledgement makes the claimed state expected at a resumed
|
|
322
|
+
SELECT, BEFORE_PR or BEFORE_CLOSE; the same tracker state reached without it is
|
|
323
|
+
external drift and HOLDs. PLAN.md remains `open` because it has no observable
|
|
324
|
+
claim transition. The checkpoint-aware edge is pinned in the generator's
|
|
325
|
+
`test/template/content-blind-revalidation.test.ts` (absent in a generated rig)
|
|
326
|
+
› "keeps a resumed SELECT current after the Jira adapter records its own claim
|
|
327
|
+
transition", › "GitHub claim records the durable transition that makes
|
|
328
|
+
in-progress CURRENT", › "holds claim:scope at resumed SELECT for the same transition
|
|
329
|
+
made outside the adapter", › "accepts an in-progress transition performed by
|
|
330
|
+
the Jira adapter claim operation", and › "holds claim:scope when an external
|
|
331
|
+
actor moves the item to the expected claimed state".
|
|
332
|
+
The durable/evidence boundary and rollback rule are recorded in
|
|
333
|
+
`docs/decisions/content-blind-revalidation.md`.
|
|
334
|
+
|
|
335
|
+
`takeUps` and `updatedAt` remain in run state and in the event's `task` field as
|
|
336
|
+
evidence/compatibility state. They do not decide `CURRENT`, `CHANGED`,
|
|
337
|
+
`CONFLICT` or `UNVERIFIABLE`, do not decide whether a first baseline may be
|
|
338
|
+
created, and never appear as a drift source. The event may still name
|
|
339
|
+
`baseline: this-run | previous-run | null` so older evidence remains readable.
|
|
340
|
+
First sight versus resume comes only from the SELECT events in the current and
|
|
341
|
+
bounded sibling run journals. If those journals cannot prove first sight, a
|
|
342
|
+
missing claim is `UNVERIFIABLE`; an `updatedAt` marker can neither create nor
|
|
343
|
+
withhold the claim. Hitting the sibling entry/read cap makes that proof
|
|
344
|
+
incomplete and therefore fails closed; "not found in the bounded subset" never
|
|
345
|
+
means "never selected".
|
|
346
|
+
|
|
347
|
+
On `CHANGED`, `CONFLICT` or `UNVERIFIABLE`, **re-read before acting**, then
|
|
348
|
+
record what the re-read concluded:
|
|
304
349
|
|
|
305
350
|
```bash
|
|
306
351
|
node .claude/scripts/revalidate.mjs outcome --point SELECT --ticket <item-id> --action-changed <true | false> --note '<what changed, or why it changes nothing>'
|
|
307
352
|
```
|
|
308
353
|
|
|
309
|
-
It appends one `revalidation-outcome` record whose `
|
|
310
|
-
|
|
354
|
+
It appends one typed `revalidation-outcome` record whose `detectionId` names the
|
|
355
|
+
stable detection it resolves (and retains the legacy `answers` sequence), so
|
|
356
|
+
the report can pair the two across harness runs without guessing. The
|
|
311
357
|
note is stored verbatim from argv, so keep it in single quotes: inside double
|
|
312
358
|
quotes the shell expands a backtick or a `$` before the command sees it.
|
|
313
359
|
Nothing forces this record — a `revalidation` event with no matching outcome is
|
|
314
360
|
counted as `unresolved`, which is the honest word for a re-read the run skipped.
|
|
315
361
|
|
|
316
|
-
Under a declared run directory, every selection logs one
|
|
317
|
-
`
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
`
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
re-record the take-up after each write they make — claim, comment, close,
|
|
324
|
-
escalate — so a move made through the adapter is not a hold (AR-140, from the
|
|
325
|
-
journal's RX3/RX4 entry: every BEFORE_PR catch of that run was the run's own
|
|
326
|
-
comment, counted by `revalidation-report.mjs`); a
|
|
327
|
-
comment posted by any other route — a REST call by hand, a connector — still
|
|
328
|
-
moves it like anyone else's, and a `true` can still be self-inflicted that way
|
|
329
|
-
— the re-read decides, which is why the outcome is recorded separately, and a
|
|
330
|
-
hold the re-read overturns is counted as a false hold with its source named.
|
|
331
|
-
Pinned in the generator's `test/template/self-inflicted-marker.test.ts` — absent
|
|
332
|
-
in a generated rig — › "%s leaves the take-up at the marker the write produced",
|
|
333
|
-
an `it.each` over claim, comment, close and escalate. The
|
|
362
|
+
Under a declared run directory, every selection logs one versioned
|
|
363
|
+
`revalidation` detection — the same shape BEFORE_PR and BEFORE_CLOSE write.
|
|
364
|
+
**No-change is always recorded**, one line per selection and no sampling: the
|
|
365
|
+
rule is explicit so the report's `opportunities` is a count and not an estimate.
|
|
366
|
+
The `jira` and `github-issues` adapters still re-record take-ups after their own
|
|
367
|
+
writes for compatibility and attribution evidence; that state is never the
|
|
368
|
+
fingerprint baseline. The
|
|
334
369
|
four-week view is `node .claude/scripts/revalidation-report.mjs --since <date>`,
|
|
335
370
|
over this rig's `.claude/runs/` (or a `--runs <dir>`). The behaviour is pinned in the
|
|
336
|
-
generator's `test/template/
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
371
|
+
generator's `test/template/content-blind-revalidation.test.ts` (absent in a generated rig) › "creates a
|
|
372
|
+
versioned content-blind claim and returns BASELINE_CREATED" and › "defers an
|
|
373
|
+
added comment through SELECT and BEFORE_PR, then holds at BEFORE_CLOSE", plus
|
|
374
|
+
`test/template/revalidation-evidence.test.ts` (absent in a generated rig) › "the journaled events of SELECT,
|
|
375
|
+
BEFORE_PR and BEFORE_CLOSE share exactly the common keys and value types".
|
|
341
376
|
|
|
342
377
|
**Then, before the Red step: `check-premises`.** The item was written by someone
|
|
343
378
|
who was not reading the code at the time, and everything downstream — the failing
|
|
@@ -371,7 +406,7 @@ exits 1 whatever the reviewer said. Save the whole answer to a file under the ru
|
|
|
371
406
|
directory — `$RIG_RUN_DIR/check-premises.md`, one file per gate so two answers
|
|
372
407
|
never overwrite each other — and pass that path (`-` reads stdin instead). The
|
|
373
408
|
same holds for every `<report>` in this skill, as `pr-ship` already does for its
|
|
374
|
-
reviewers
|
|
409
|
+
reviewers. Pinned in the generator's `test/template/loop-report-file.test.ts`
|
|
375
410
|
— absent in a generated rig — › "states that the report is a file the session
|
|
376
411
|
writes from the subagent answer, before the first check".
|
|
377
412
|
|
|
@@ -416,8 +451,8 @@ reviewer verdict, an exhausted gate-round cap, a false premise in the item itsel
|
|
|
416
451
|
|
|
417
452
|
The run-level conditions are in `stopConditionOf` in `core.mjs`, checked in
|
|
418
453
|
severity order: **queue unreadable** · **runtime regression** · **kill switch** ·
|
|
419
|
-
**two escalations in a row** · **budget** · **nothing
|
|
420
|
-
empty**.
|
|
454
|
+
**revalidation hold** · **two escalations in a row** · **budget** · **nothing
|
|
455
|
+
selectable** · **queue empty**.
|
|
421
456
|
|
|
422
457
|
🔴 **Their inputs come from a file, not from your memory — and that is why they
|
|
423
458
|
fire at all.** `escalations` and `lastDeployVerdict` live in
|
|
@@ -567,7 +602,7 @@ inventory of findings** — and this had to be settled, because the two readings
|
|
|
567
602
|
disagreed the first time a stop arrived without an inventory. An exhausted
|
|
568
603
|
gate-round cap names its stage (the gate) and its wall (the branch's rounds are
|
|
569
604
|
spent — the count, not a verdict on whether the fixes were converging, which the
|
|
570
|
-
counter never measured
|
|
605
|
+
counter never measured), while the individual blockers behind it are not persisted anywhere until
|
|
571
606
|
per-round verdicts exist. That is a `documented-stall`: the record locates the wall
|
|
572
607
|
and the next reader knows where to look.
|
|
573
608
|
|
|
@@ -703,10 +738,13 @@ declared in §1. Five things about it are worth knowing before relying on it:
|
|
|
703
738
|
so a stale record cannot read as the current one — which is the whole failure a
|
|
704
739
|
journal exists to prevent.
|
|
705
740
|
- ⚠ **The trace can stop before the run does, and the two failures part ways
|
|
706
|
-
here.**
|
|
707
|
-
broken, a file that will not parse, a run already
|
|
708
|
-
trace, **not** a reason to withhold work the
|
|
709
|
-
selection prints, stderr carries a `run journal:`
|
|
741
|
+
here.** After a durable claim exists, a journal that can no longer accept
|
|
742
|
+
records — a sequence already broken, a file that will not parse, a run already
|
|
743
|
+
marked ended — is a lost trace, **not** by itself a reason to withhold work the
|
|
744
|
+
queue can still hand out: the selection prints, stderr carries a `run journal:`
|
|
745
|
+
line, and the claim still decides drift. Before the first claim, the boundary
|
|
746
|
+
is stricter: an unreadable current or bounded sibling journal means SELECT
|
|
747
|
+
cannot prove first sight, so an absent claim is `UNVERIFIABLE` and exits 2.
|
|
710
748
|
The refusals are the ones where nothing has happened yet and a second fixes
|
|
711
749
|
it, and there are **four**: the declaration is empty, its directory does not
|
|
712
750
|
exist, the path is not a directory, or the journal module is missing. Each
|
|
@@ -793,10 +831,10 @@ node --input-type=module -e '
|
|
|
793
831
|
|
|
794
832
|
A proposal missing any of the four parts is refused rather than filed half-formed.
|
|
795
833
|
|
|
796
|
-
**A finding can say what it measured and what it inferred, as two paired fields
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
was traced to a probe that had touched one hook. So `measured` and `inferred`
|
|
834
|
+
**A finding can say what it measured and what it inferred, as two paired fields.**
|
|
835
|
+
A proposal whose premise was never true had no check at filing, only at take-up
|
|
836
|
+
— one such proposal was filed, promoted and claimed before its platform
|
|
837
|
+
conclusion was traced to a probe that had touched one hook. So `measured` and `inferred`
|
|
800
838
|
are separate, and `validateProposal` refuses an `inferred` that cites a path
|
|
801
839
|
`measured` does not, naming both fields and the path; one field without the
|
|
802
840
|
other is refused too, and neither files as before. The surface is a cited path
|
|
@@ -805,7 +843,7 @@ catches the path-shaped overreach and nothing subtler.
|
|
|
805
843
|
|
|
806
844
|
⚠ **The pair is how a proposal opts into the check, and a proposal filed without
|
|
807
845
|
it is not checked at all** — `validateProposal` keeps the four-part contract, so
|
|
808
|
-
|
|
846
|
+
that shape with neither field still files as it always did. That is the
|
|
809
847
|
stated limit, not an oversight: making the fields mandatory would refuse every
|
|
810
848
|
proposal the three adapters already file, and the loop is the author this rule
|
|
811
849
|
is for. So **every proposal this loop files carries both fields** — the snippet
|
|
@@ -826,7 +864,7 @@ reports one whose cited paths changed since its `asOf` as
|
|
|
826
864
|
one git cannot diff from as `proposal-asof-unanswerable` — never as clean. Two
|
|
827
865
|
proposals in a row once escalated `PREMISE FALSE` because the merge that
|
|
828
866
|
falsified each landed after it was filed, and selection hands out the oldest
|
|
829
|
-
first
|
|
867
|
+
first. The behaviour is pinned in the generator's
|
|
830
868
|
`test/template/proposal-asof.test.ts` — absent in a generated rig — ›
|
|
831
869
|
"names the overtaken one, the unanswerable one, and stays silent on the current one".
|
|
832
870
|
|
|
@@ -843,7 +881,7 @@ the selection query cannot reach. Add the heading — never the Agent queue.
|
|
|
843
881
|
|
|
844
882
|
One adapter needs the second argument the snippet above carries: `jira` requires
|
|
845
883
|
`options.project` and throws rather than filing without it — loudly, so nothing
|
|
846
|
-
is lost, but a call that drops it files nothing
|
|
884
|
+
is lost, but a call that drops it files nothing.
|
|
847
885
|
|
|
848
886
|
🔴 **The loop proposes; the owner patches.** Self-applying a change to its own
|
|
849
887
|
rulebook is how an unattended run drifts irreversibly, and it collides head-on
|
|
@@ -879,20 +917,19 @@ three poisons the only channel by which this project learns.
|
|
|
879
917
|
the very next query.
|
|
880
918
|
- **Closing:** first ask whether the item is still the item you took up — a
|
|
881
919
|
late comment or a status somebody else moved is not published as `Done`
|
|
882
|
-
underneath it
|
|
920
|
+
underneath it:
|
|
883
921
|
|
|
884
922
|
```bash
|
|
885
923
|
node .claude/scripts/revalidate.mjs --point BEFORE_CLOSE --ticket <item-id>
|
|
886
924
|
```
|
|
887
925
|
|
|
888
|
-
It compares the
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
event at `point: BEFORE_CLOSE`, and lists the item's dependants with each
|
|
926
|
+
It compares the tracked claim's `scope` and `commentary` fingerprint sets;
|
|
927
|
+
commentary becomes hold-authoritative only here. Marker/take-up movement is
|
|
928
|
+
retained in evidence but cannot decide drift. A missing claim is
|
|
929
|
+
`UNVERIFIABLE` and stops the close. The adapter's expected claimed state is
|
|
930
|
+
part of the same `claim:scope` comparison rather than a second state-drift
|
|
931
|
+
decision. The check journals one `revalidation` event at `point:
|
|
932
|
+
BEFORE_CLOSE` and lists the item's dependants with each
|
|
896
933
|
one's state re-read for the write-back below — pinned in the generator's
|
|
897
934
|
`test/template/revalidate.test.ts` (absent in a generated rig) › "appends
|
|
898
935
|
exactly one BEFORE_CLOSE revalidation event after the BEFORE_PR one, and does
|
|
@@ -35,7 +35,7 @@ blockers.
|
|
|
35
35
|
flow, and this gate with it, begins when the project has a remote
|
|
36
36
|
(`workflow.md`, "PR flow"). The refusal exists because two rounds were once counted ahead of a
|
|
37
37
|
commit pre-commit then refused, so the counter and the fan-out's verdicts
|
|
38
|
-
named a head that never shipped
|
|
38
|
+
named a head that never shipped — pinned in the generator's
|
|
39
39
|
`test/template/gate-rounds.test.ts` — absent in a generated rig — ›
|
|
40
40
|
"refuses to count a round on a dirty tree, and counts nothing".
|
|
41
41
|
|
|
@@ -57,26 +57,33 @@ blockers.
|
|
|
57
57
|
confidently-wrong reviews. Everything below is scoped to this diff.
|
|
58
58
|
|
|
59
59
|
Then, on the fetched ref, ask whether the branch is still the branch the run
|
|
60
|
-
took up
|
|
60
|
+
took up:
|
|
61
61
|
|
|
62
62
|
```sh
|
|
63
63
|
node .claude/scripts/revalidate.mjs --point BEFORE_PR --ticket <item-id> --base origin/<default>
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
It
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
It runs the existing revalidation chain against the tracked, versioned
|
|
67
|
+
`.rig/claims/<item-id>.json`: the content-blind `scope` fingerprint set is
|
|
68
|
+
authoritative here, while `takeUps` / `updatedAt` remain evidence only. It
|
|
69
|
+
also names what the default branch changed since this branch forked on paths
|
|
70
|
+
the branch touches or a `check-premises` record cited (`main:<path>`). It
|
|
70
71
|
journals one `revalidation` event at `point: BEFORE_PR`; **exit code 2 is a HOLD**, with one blocker per named source: re-read the item, or the default
|
|
71
72
|
branch on that path, record what the re-read concluded —
|
|
72
73
|
`node .claude/scripts/revalidate.mjs outcome --point BEFORE_PR --ticket <item-id> --action-changed <true | false> --note '…'`
|
|
73
74
|
— and come back through step 0. A hold with no outcome is counted by the
|
|
74
|
-
report as a re-read the run skipped.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
report as a re-read the run skipped. A missing, untracked, unreadable or
|
|
76
|
+
unsupported claim is `UNVERIFIABLE`, exits 2, and stops automatic progress;
|
|
77
|
+
so is a tracker whose adapter the command cannot READ, which means the
|
|
78
|
+
question was never put rather than that the claim record is unreadable.
|
|
79
|
+
Neither is ever read as a pass. Exit 1 is the command refusing (unknown
|
|
80
|
+
point, no ticket, a base that is not a revision, or a queue config that does
|
|
81
|
+
not resolve): fix the call or the config — the message says which. Its limits are its own header's; the
|
|
82
|
+
cited-path set is a labelled assumption, not a recorded fact. Pinned in the
|
|
83
|
+
generator's `test/template/revalidate.test.ts` (absent in a generated rig) ›
|
|
84
|
+
"continues when only updatedAt moved and still reports the marker evidence"
|
|
85
|
+
and `test/template/content-blind-revalidation.test.ts` › "refuses a deleted
|
|
86
|
+
tracked claim in a fresh run without take-up markers".
|
|
80
87
|
2. **Route the diff before you spend on it.** This gate always ran its most
|
|
81
88
|
expensive path, so a typo fix in a README bought the same fan-out as a
|
|
82
89
|
rewrite of the storage layer. The dispatcher decides which lane the change
|
|
@@ -12,13 +12,33 @@
|
|
|
12
12
|
// to tokenise: it owns exactly one invariant and stays readable because of it
|
|
13
13
|
// (see .claude/rules/invariants.md, "One invariant per hook"). Use a file rather
|
|
14
14
|
// than a heredoc, or quote the example.
|
|
15
|
-
import { readHookInput } from './lib/hook-input.mjs';
|
|
15
|
+
import { readHookInput, refusalText, shellCommandOf } from './lib/hook-input.mjs';
|
|
16
|
+
import { SHELL_TOOLS } from '../scripts/lib/shell-tools.mjs';
|
|
16
17
|
|
|
17
18
|
function main() {
|
|
18
19
|
const input = readHookInput();
|
|
19
20
|
if (input === null) return 0;
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
// One list, not a literal: this hook was launched for every shell surface
|
|
22
|
+
// and then excused itself from all but Bash, so the pre-commit gate stayed
|
|
23
|
+
// bypassable on the other one.
|
|
24
|
+
if (!SHELL_TOOLS.includes(input.tool_name)) return 0;
|
|
25
|
+
// Three outcomes, from the one shared contract (RP-80). `String(argv)` used
|
|
26
|
+
// to stand here, and it did not merely fail to read an array — it produced a
|
|
27
|
+
// plausible-looking string: `["git","commit","--no-verify"]` became
|
|
28
|
+
// `git,commit,--no-verify`, where the tokeniser below never splits on a comma,
|
|
29
|
+
// so the one flag this hook exists to refuse was silently absent. A guard that
|
|
30
|
+
// converts what it cannot read into something it can is worse than one that
|
|
31
|
+
// refuses, because it reports a check it did not perform.
|
|
32
|
+
const parsed = shellCommandOf(input);
|
|
33
|
+
if (parsed.kind === 'unreadable') {
|
|
34
|
+
process.stderr.write(`${refusalText(parsed)}\n`);
|
|
35
|
+
return 2;
|
|
36
|
+
}
|
|
37
|
+
// Positive test, not a list of the others: a member added later must not
|
|
38
|
+
// reach `raw.replace(…)` below with `undefined`, which throws, exits 1, and
|
|
39
|
+
// is read as allow.
|
|
40
|
+
if (parsed.kind !== 'string') return 0;
|
|
41
|
+
const raw = parsed.command;
|
|
22
42
|
|
|
23
43
|
// Strip quoted segments first: a commit message that merely MENTIONS a
|
|
24
44
|
// forbidden flag is prose, not a bypass. Only unquoted flags count.
|