@williacj/rigger 0.0.0-stage → 0.1.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 (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +370 -2
  3. package/package.json +56 -4
  4. package/scripts/doc-reference-check.mjs +59 -0
  5. package/scripts/gate-check.mjs +249 -0
  6. package/scripts/lib/pack-result.mjs +9 -0
  7. package/scripts/record-commit.mjs +67 -0
  8. package/src/cli/doctor.mjs +1021 -0
  9. package/src/cli/init.mjs +384 -0
  10. package/src/cli/once.mjs +489 -0
  11. package/src/cli/pause.mjs +56 -0
  12. package/src/cli/plan.mjs +106 -0
  13. package/src/cli/recording.mjs +52 -0
  14. package/src/cli/report.mjs +242 -0
  15. package/src/cli/resume.mjs +96 -0
  16. package/src/cli/rigger.mjs +12 -0
  17. package/src/cli/run.mjs +10 -0
  18. package/src/cli/setup-board.mjs +108 -0
  19. package/src/cli/verbs.mjs +82 -0
  20. package/src/cli/verdict.mjs +180 -0
  21. package/src/config/validate.mjs +960 -0
  22. package/src/execution/groups.mjs +185 -0
  23. package/src/execution/kept-output.mjs +21 -0
  24. package/src/execution/role.mjs +171 -0
  25. package/src/execution/run.mjs +490 -0
  26. package/src/execution/step.mjs +26 -0
  27. package/src/execution/workspace.mjs +866 -0
  28. package/src/observation/push.mjs +103 -0
  29. package/src/observation/report.mjs +415 -0
  30. package/src/observation/sink.mjs +271 -0
  31. package/src/package-commit.json +1 -0
  32. package/src/scheduling/admission.mjs +390 -0
  33. package/src/scheduling/clock.mjs +98 -0
  34. package/src/scheduling/lane.mjs +160 -0
  35. package/src/scheduling/loop.mjs +1738 -0
  36. package/src/scheduling/pull-order.mjs +46 -0
  37. package/src/substrate/data-ref.mjs +147 -0
  38. package/src/substrate/forge/assets.mjs +5 -0
  39. package/src/substrate/forge/graphql.mjs +258 -0
  40. package/src/substrate/forge/item-write.mjs +74 -0
  41. package/src/substrate/forge/read.mjs +998 -0
  42. package/src/substrate/forge/repository-write.mjs +152 -0
  43. package/src/substrate/forge/runners.mjs +510 -0
  44. package/src/substrate/forge/schema-write.mjs +70 -0
  45. package/src/substrate/forge/write-made.mjs +40 -0
  46. package/src/substrate/git-environment.mjs +54 -0
  47. package/src/substrate/host.mjs +23 -0
  48. package/src/substrate/launchd.mjs +23 -0
  49. package/src/substrate/process-table.sh +48 -0
  50. package/src/substrate/process.mjs +2474 -0
  51. package/src/substrate/providers/adapters.mjs +8 -0
  52. package/src/substrate/providers/claude.mjs +427 -0
  53. package/src/substrate/providers/codex.mjs +349 -0
  54. package/src/substrate/standard-error.mjs +134 -0
  55. package/src/substrate/worktrees.mjs +517 -0
  56. package/src/workflow/clock-mark.mjs +40 -0
  57. package/src/workflow/escalation.mjs +110 -0
  58. package/src/workflow/facts.mjs +92 -0
  59. package/src/workflow/first-above.mjs +17 -0
  60. package/src/workflow/form-check.mjs +88 -0
  61. package/src/workflow/gate.mjs +62 -0
  62. package/src/workflow/judges.mjs +695 -0
  63. package/src/workflow/marker.mjs +265 -0
  64. package/src/workflow/next-action.mjs +456 -0
  65. package/src/workflow/status-issue.mjs +268 -0
  66. package/src/workflow/transitions.mjs +588 -0
  67. package/templates/claude/agents/architect.md +116 -0
  68. package/templates/claude/agents/engineer.md +57 -0
  69. package/templates/claude/agents/pm.md +114 -0
  70. package/templates/claude/agents/reviewer.md +37 -0
  71. package/templates/claude/agents/spike-engineer.md +80 -0
  72. package/templates/claude/hooks/refuse-reserved-git-commands.mjs +909 -0
  73. package/templates/claude/settings.json +50 -0
  74. package/templates/claude/skills/acceptance/SKILL.md +275 -0
  75. package/templates/claude/skills/agent-style/SKILL.md +78 -0
  76. package/templates/claude/skills/code-review/SKILL.md +242 -0
  77. package/templates/claude/skills/proposal/SKILL.md +175 -0
  78. package/templates/claude/skills/spec-style/SKILL.md +112 -0
  79. package/templates/claude/skills/tdd/SKILL.md +230 -0
  80. package/templates/codex/config.toml +19 -0
  81. package/templates/doc-reference-check.md +25 -0
  82. package/templates/githooks/pre-push +24 -0
  83. package/templates/github/workflows/rigger-gate.yml +209 -0
  84. package/templates/launchd/com.williacj.rigger.plist +31 -0
  85. package/templates/rigger.config.mjs +78 -0
@@ -0,0 +1,50 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
+ "env": {
4
+ "BASH_DEFAULT_TIMEOUT_MS": "1800000",
5
+ "BASH_MAX_TIMEOUT_MS": "1800000"
6
+ },
7
+ "hooks": {
8
+ "PreToolUse": [
9
+ {
10
+ "matcher": "Bash",
11
+ "hooks": [
12
+ {
13
+ "type": "command",
14
+ "shell": "bash",
15
+ "timeout": 10,
16
+ "command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/refuse-reserved-git-commands.mjs\" || { code=$?; [ \"$code\" -eq 2 ] || printf '%s' '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"The command gate did not run, so it refused rather than let the command through.\"}}'; exit 2; }"
17
+ }
18
+ ]
19
+ }
20
+ ]
21
+ },
22
+ "permissions": {
23
+ "allow": [
24
+ "Bash(git status:*)",
25
+ "Bash(git diff:*)",
26
+ "Bash(git log:*)",
27
+ "Bash(git add:*)",
28
+ "Bash(git commit:*)",
29
+ "Bash(git push:*)",
30
+ "Bash(npm test:*)",
31
+ "Bash(npm run:*)",
32
+ "Bash(gh issue create:*)",
33
+ "Bash(gh issue view:*)",
34
+ "Bash(gh pr create:*)",
35
+ "Bash(gh pr diff:*)",
36
+ "Bash(gh pr view:*)",
37
+ "Bash(gh pr comment:*)",
38
+ "Edit(./**)"
39
+ ],
40
+ "deny": [
41
+ "Bash(git commit --no-verify:*)",
42
+ "Bash(git push --no-verify:*)",
43
+ "Bash(git push --force:*)",
44
+ "Bash(git push -f:*)",
45
+ "Bash(git push --delete:*)",
46
+ "Bash(git branch -D:*)",
47
+ "Bash(git branch --delete:*)"
48
+ ]
49
+ }
50
+ }
@@ -0,0 +1,275 @@
1
+ ---
2
+ name: acceptance
3
+ description: Write or revise a card's acceptance — the items that state what done means before any work on the card starts. Use when filing a card, when decomposing larger work into cards, when a spike card needs a bar, and when judging whether an acceptance item is testable.
4
+ ---
5
+
6
+ ABOUTME: How an author writes a card's acceptance: work out what the card is really asking for,
7
+ then state it as standalone conditions a judge can rule on without asking the author.
8
+
9
+ # Writing an acceptance
10
+
11
+ Acceptance states what done means in the issue body, not a board field (`D2` rule 2).
12
+ `R-CARD-12` owns its form:
13
+
14
+ - Use `## Acceptance` or another ATX heading whose text is exactly `Acceptance`. Bullets only
15
+ under `Acceptance criteria` or an underlined heading leave no counted items, so the card is
16
+ refused (`R-CARD-12`, `R-CARD-7`).
17
+ - Write plain bullets, never task lists (`D2` rule 2). Task-list items do not count; a card
18
+ with only those is refused (`R-CARD-12`, `R-CARD-7`).
19
+ - Keep bullets outside fenced code blocks. Fenced bullets do not count; a card with only those
20
+ is refused (`R-CARD-12`, `R-CARD-7`).
21
+
22
+ ## The one test
23
+
24
+ **A judge must be able to rule on the item without asking you.** That is `R-CARD-2`'s test, and
25
+ every rule below is a way of passing it. Its other half — one condition per item — is under
26
+ "Write each item".
27
+
28
+ You will not be there when the card is judged. A judge that cannot rule on an item records it
29
+ unmet (`R-LOOP-5`), and a verdict leaving any item unmet is not sound (`R-VERDICT-4`). An item
30
+ only you can read is paid for in rounds, by the maker, later.
31
+
32
+ ## Start from the card, not from the bullets
33
+
34
+ Bullets written first tend to restate the title, which is one of the two shapes admission
35
+ refuses outright (`R-CARD-8`). Work these out before you write any:
36
+
37
+ - **The outcome.** What actor, stakeholder, or system outcome is this card meant to enable? That
38
+ context belongs in the card's description. The acceptance holds the observable conditions that
39
+ prove the outcome was reached; it never becomes a second brief.
40
+ - **The proof.** What observable change shows it was reached? That is what the items assert.
41
+ - **The constraints that already bind.** Where something outside the card fixes part of the
42
+ answer, cite it: a requirement id, a `D#`, an `AGENTS.md` section. A constraint with no source
43
+ behind it is you prescribing the implementation. Write each citation as `AGENTS.md`,
44
+ "Documents own their facts", requires.
45
+ - **The boundary and failure states that apply.** Empty input, invalid input, limits,
46
+ permissions, a dependency failing, partial completion. Consider each; carry over only the ones
47
+ this card can actually reach. A documentation card owes no error criterion, and one invented to
48
+ fill out the list is filler a judge still has to rule on.
49
+
50
+ ## Write each item
51
+
52
+ **One condition per item.** That is `R-CARD-2`'s first half; an `and` usually hides two.
53
+
54
+ **Each item stands on its own.** Each names enough subject and context to be ruled on by itself.
55
+ A judge reconstructing an item from the bullet above it is one misreading away from ruling on
56
+ the wrong thing.
57
+
58
+ **Name the thing, and the observable fact about it.** The ruling should be a reading, not an
59
+ opinion. Name the concrete thing that would prove the item false as well — the output, the file,
60
+ the exit code whose presence or value settles it. An item with no falsifier gives a judge nothing
61
+ to look for but your wording, and your wording will always agree with itself.
62
+
63
+ **Cut the words that hand the ruling back to you.** *Appropriate, clean, properly, robust,
64
+ comprehensive, reasonable, as needed, where necessary, good.* Each of these means "ask the
65
+ author". Name the condition the word stands for instead. If you cannot name it, you do not yet
66
+ know what you are asking for.
67
+
68
+ **A list of instances is evidence for a class, never the class itself.** Where an item names
69
+ members of a class, say that they are instances, and ask for the positive check instead: only
70
+ sanctioned members may appear. An item enumerating what must not appear is met exactly by the
71
+ absence of what it listed — the list under "Cut the words that hand the ruling back to you",
72
+ written into one, is satisfied by any synonym.
73
+
74
+ **Name the threshold, where there is one.** Where the card turns on quantity, duration, capacity,
75
+ compatibility or another threshold, name the value and how it is measured. Never invent a number
76
+ to look precise — derive it from the card, or from a source you cite.
77
+
78
+ **Say what done means, never how to do it.** The maker chooses the mechanism. An item that names
79
+ one bars a better route and is not a statement about done.
80
+
81
+ Every item is mandatory — one left unmet is not sound (`R-VERDICT-4`) — so order them for reading
82
+ rather than for priority.
83
+
84
+ ## Choose a format
85
+
86
+ An ordinary rule bullet by default: a named path exists and states a named thing; a named command
87
+ exits zero, or produces named output; a named input is refused, and the refusal names the reason;
88
+ a named document cites a named id.
89
+
90
+ Items may permit citing, not quoting, persistent evidence: a CI job, run attempt or comment by
91
+ URL; a file by path at a commit reachable from the judged head or `main`. Quote local output;
92
+ never cite CI artifacts or off-forge records. Citations name their record's commit, which must be
93
+ the item's; unopenable records are uncited. Items may demand quotes.
94
+
95
+ A **Given/When/Then** bullet where the ruling needs its context to make sense. `R-CARD-2` still
96
+ holds, so one item carries one independently ruleable outcome, never a scenario with several
97
+ `Then`s. Split a compound result. Example acceptance (`R-CARD-12`):
98
+
99
+ ```text
100
+ ## Acceptance
101
+
102
+ - Given a Ready card has no acceptance, when `rigger plan` evaluates it, then the card is not
103
+ pulled.
104
+ - Given a Ready card has no acceptance, when `rigger plan` evaluates it, then `plan` names the
105
+ card and identifies missing acceptance as the reason.
106
+ ```
107
+
108
+ Those are `R-CARD-7`'s two halves, one apiece; `plan` is the verb the README gives for showing
109
+ what a run refuses. Each bullet repeats its own context rather than borrowing it from the one
110
+ above: standing alone is worth the words it costs.
111
+
112
+ ## A spike card
113
+
114
+ A spike card's acceptance states what a complete answer contains, never what the answer is
115
+ (`R-CARD-9`). Fixing the answer in advance is not a bar; it is the finding, and it leaves the
116
+ spike unable to report the one thing it was dispatched to find out.
117
+
118
+ Write the shape of the report: which options it weighed, what it measured, what it recommends
119
+ and on what evidence, and what would reverse the recommendation.
120
+
121
+ ## Scope, and what a change costs
122
+
123
+ **Bound the card.** Put all requested work in acceptance. Found work outside it gets its own
124
+ card (`R-CARD-11`); follow-ups cover only outside work. An undone item leaves this card unfinished
125
+ (`R-CARD-10`).
126
+
127
+ Ask for every cell to be proved, never for a test per cell: one table-driven or generated test
128
+ may prove a dimension. A mutation is evidence that an existing test discriminates; never ask
129
+ for a test per mutation. Ask for a probe a judge used to find a defect as a case in an existing
130
+ test of the invariant it broke, where one exists, and otherwise as one test of that invariant.
131
+
132
+ **Split work into cards.** Map every part of the larger work to a card's acceptance item, not
133
+ merely its title or description.
134
+
135
+ **Name dependencies.** In the dependent card, name the prerequisite card and its required result.
136
+ Its acceptance covers its own work.
137
+
138
+ **Cover every axis.** Satisfying one axis leaves others unchecked: commands can exit zero yet
139
+ write to the wrong path. Give each axis the card varies on its own item (`R-CARD-2`).
140
+
141
+ **Changing it after admission is expensive, and it stays yours.** Only its author changes an
142
+ acceptance after admission, never the maker it is judged against (`R-CARD-5`), and every change
143
+ is recorded with who made it (`R-CARD-6`). A change to the acceptance, like a change to the work,
144
+ sends every judge back and spends one of the card's rounds (`R-LOOP-8`); a card that exhausts its
145
+ rounds escalates as ambiguous (`R-LOOP-9`); and the change stales every verdict already returned
146
+ (`R-GATE-7`). Settle the bar with whoever will help you before you file.
147
+
148
+ Before filing, remove items dependent on this card's verdict, marker, required check or
149
+ merge; `AGENTS.md`'s "Review and merge" still applies.
150
+
151
+ Classify cited prior attempts as offered proof, context, or unresolved/noncredit; later
152
+ results grant no retroactive credit.
153
+
154
+ For required retained originals, predeclare finite offered results before maker work: originals,
155
+ private-safe access, exact ref, behavior scope and retention event through final independent ruling or
156
+ longer card requirement.
157
+
158
+ **Name predictable test edits at filing.** An author may name bounded grant classes, each
159
+ stating what it covers and the existing `test/` lines it can reach, checkable in `git diff`.
160
+ Examples: assertion lines in a named test file may retarget the old result of this card's
161
+ changed behaviour; fixture lines in a named test file may mirror the real error from a named
162
+ layer. A class cannot admit deletion of a test or weaken what it proves; those go to the owner.
163
+ With classes, word the test-line item as: `git diff` against the base changes no existing line under
164
+ `test/` that the table does not list and no named class covers.
165
+
166
+ **Admit harness diagnostics before work.** For a test without `// proves`, record the
167
+ infrastructure behaviour, checked registered product requirements and why none applies, and
168
+ bounded guarded semantic discrimination under the `tdd` skill. A path or missing declaration
169
+ proves no classification. Never borrow an unrelated requirement or reclassify existing tests.
170
+
171
+ ## Work outside the repository
172
+
173
+ For a card acting on a system outside the repository where undo is not obvious, require the maker
174
+ to state its intended action before acting, with inspectable evidence of what it said and when.
175
+
176
+ Require controlled proof for algorithmic behaviour and real-host proof for external contracts.
177
+ A real run cannot replace missing controlled proof; a fake or injected clock cannot establish
178
+ real OS behaviour or a real deadline. Keep these obligations independently ruleable.
179
+
180
+ ## Systems outside Rigger's code
181
+
182
+ **Map the finite contract states.** At external boundaries, name states that change branch or
183
+ result, including reachable errors, absence and nonreturn. Mark in-scope cells and scope edges.
184
+ Each item retains a concrete falsifier.
185
+
186
+ For each in-scope cell, name controlled algorithm proof, real-boundary proof, or both, according
187
+ to its claim. Real OS behaviour, tool contracts and real deadlines retain real-host evidence;
188
+ injected-clock and fake results alone earn no such credit.
189
+
190
+ Steps are concurrent if they can interleave on one store, between processes or async tasks
191
+ within one process. A step is one read, write, rename or forge call. Concurrent actors including
192
+ a writer need an acceptance interleaving table: one row per ordering that can change outcomes
193
+ or reader access point, each with its required outcome. Include writers restarted against their
194
+ own leftovers after mid-write kills. Otherwise, one writer without concurrent readers, or
195
+ readers alone, needs none. An ordering whose outcome no item or structure fixes is a missing cell.
196
+
197
+ Justify exclusions and equivalences with evidence for independent review, not labels. Avoid
198
+ unrelated axes and unbounded external states. Bound absolutes by the map and scope edge.
199
+
200
+ Observe fixture readiness before timing behaviour that assumes it; time startup when it
201
+ belongs to the contract. The `tdd` skill gives procedures; "Have it attacked before dispatch"
202
+ governs independent review.
203
+
204
+ ## What is checked, and what is not
205
+
206
+ The form check reads acceptance as `R-CARD-12` states. It refuses only a card with no items it
207
+ counts, by name and reason (`R-CARD-7`), or one whose counted items only restate the card's title
208
+ (`R-CARD-8`).
209
+
210
+ So the bar being right is yours. `D2`'s notes say what that buys and what it does not: no check
211
+ proves an acceptance adequate, and a green marker is never a warranty that the card asked for
212
+ the right things. A judge rules on whether the acceptance covered what the card asked, and
213
+ returns the card to you with the reason rather than rewriting it (`R-LOOP-6`).
214
+
215
+ ## Have it attacked before dispatch
216
+
217
+ Before a card is dispatched, a second agent reviews its acceptance for missing cells and
218
+ unbounded absolutes. Choose that agent from the card's body:
219
+
220
+ - The architect reviews it if an acceptance item depends on a system outside Rigger's code, as
221
+ "Systems outside Rigger's code" defines that class.
222
+ - The architect reviews it if "Lands in" names `ARCHITECTURE.md`, paths under two or more layer
223
+ homes in `ARCHITECTURE.md`'s "The layers" table ("Lives in"), or a path under no layer's home.
224
+ Paths under `test/`, `docs/journal/` and `docs/derived/` do not count toward this condition.
225
+ - Otherwise the second agent is the `reviewer`.
226
+
227
+ Use a `- **Lands in:**` bullet with backticked paths; indent continuation lines.
228
+ That agent checks that scope names every file an item or cited placement ruling requires.
229
+ It also checks that every cited proposal, ruling or grant is posted as a comment, issue
230
+ or pull request and linked from the card. Preflight checks readable scope, not coverage adequacy.
231
+
232
+ Pinned binding-document text, and nothing else, opens its fence with `markdown`; an example takes
233
+ another info string or none. That agent checks these defects:
234
+
235
+ 1. An unclaimed, unexcepted new `R-` id.
236
+ 2. Pinned text failing spec-style, or misfenced.
237
+ 3. An unbounded negative guarantee ("Write each item"; "Systems outside Rigger's code").
238
+ 4. A request no item covers.
239
+ 5. Contradicting sibling cards.
240
+
241
+ `check:card` checks defect 1 and spec-style rules 1 and 2, not scope.
242
+
243
+ You revise the acceptance before any maker starts. This review is part of filing.
244
+
245
+ ## Before you file
246
+
247
+ 1. Did you start from the outcome, the proof, the constraints and the failure states that apply?
248
+ 2. Did you write every citation as `AGENTS.md`, "Documents own their facts", requires?
249
+ 3. Can a judge rule on each item without asking you (`R-CARD-2`)?
250
+ 4. Is each one condition (`R-CARD-2`)?
251
+ 5. Does each stand on its own?
252
+ 6. Does each name the concrete thing that would prove it false?
253
+ 7. Does each say what done means rather than how to reach it?
254
+ 8. Where an item lists instances of a class, does it ask for the positive check instead?
255
+ 9. Where the card turns on a threshold, is the value named and its source cited?
256
+ 10. Does the set cover everything this card is asking for (`R-CARD-10`, `R-CARD-11`)?
257
+ 11. Does the set name every axis this card varies on, rather than exhausting one of them?
258
+ 12. For a spike: does it describe a complete answer rather than the answer (`R-CARD-9`)?
259
+ 13. When splitting work, is each part mapped to an acceptance item?
260
+ 14. Are each dependency's card and required result named?
261
+ 15. Must a maker state an outside-system action before acting if undo is unclear?
262
+ 16. Does each algorithmic claim have controlled proof and each external contract retain host proof?
263
+ 17. Does each external boundary have a finite contract-state map naming each cell's proof and
264
+ evidence for exclusions or equivalences?
265
+ 18. Does every absolute stay within that map and its stated scope edge?
266
+ 19. Did the second agent chosen under "Have it attacked before dispatch" review for missing cells
267
+ and unbounded absolutes, and did you revise before dispatch?
268
+ 20. Does the scope bullet cover every file an item or cited placement ruling requires?
269
+ 21. Is every cited proposal, ruling and grant posted and linked from the card?
270
+ 22. Did you name bounded grant classes for predictable existing test-line changes?
271
+ 23. Where the repository defines them, before maker edits, did `npm run check:card` read the draft
272
+ body, and `npm run preflight -- --body-file <body-file>` run in a clean checkout with
273
+ origin/main and a merge base? Resolve or report failures before maker admission.
274
+ 24. Before admitting claimless diagnostics, did you record behaviour, requirement applicability
275
+ and bounded guarded discrimination?
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: agent-style
3
+ description: The form a role prompt is written in — the sections it carries, the one test for whether a sentence belongs in it, and the facts it must never assert. Load before writing or reviewing any file under .claude/agents/.
4
+ ---
5
+
6
+ ABOUTME: How a role prompt is written: the one test for whether a sentence belongs in it, the
7
+ seven sections it carries and the test behind each, and the facts it never asserts.
8
+
9
+ # Writing a role prompt
10
+
11
+ A role prompt says who one role is. `AGENTS.md` already binds every session in this repository,
12
+ so the prompt's whole job is to narrow: to say what is true of this role, and nothing else.
13
+
14
+ These files are templates. `rigger init` forks them into a consumer's repository, and Rigger reads
15
+ none of them from its own package at run time (`R-SAFE-6`). What a prompt asserts has to hold
16
+ wherever it lands, not only here.
17
+
18
+ ## The one test
19
+
20
+ **If a sentence is true of every role, it belongs in `AGENTS.md` and not in a role prompt.**
21
+
22
+ Restating a repo-wide rule in a prompt does not emphasise it. It re-scopes it. The reader takes it
23
+ as this role's particular duty, and the rule looks narrower than it is. Leaving it out assigns
24
+ nothing, because the prompt's opening keeps the whole of `AGENTS.md` binding.
25
+
26
+ This is `AGENTS.md`'s "Documents own their facts" applied to prompts.
27
+
28
+ ## The sections
29
+
30
+ Frontmatter, then seven sections in this order. A section with nothing true in it is left out
31
+ rather than padded.
32
+
33
+ | Section | What it holds | The test |
34
+ |---|---|---|
35
+ | Frontmatter | The `name` the configuration gives this role, and a `description` saying when to reach for it | A reader who sees only the description can tell what the role is for |
36
+ | When you fire | What has to be true for this role to be dispatched, in plain words | The reader can tell whether a given card is this role's |
37
+ | What you own | The artifact this role and only this role produces | No two prompts claim the same artifact |
38
+ | What you read, and what you never edit | The documents read before drafting, and the ones to stay consistent with and leave alone | Every document the role could open is on one side or the other |
39
+ | Who hands to you, and who picks up from you | The neighbouring roles, by name | For each thing the role must not do, the prompt names who does it instead |
40
+ | How you do it | The skills this role loads, by the path they live at, and when | Every path named exists |
41
+ | The ways you go wrong | The mistakes this role in particular makes | The section would be false or pointless in another prompt |
42
+ | What you never do | Prohibitions particular to this role, each with its source | No line survives being pasted into another prompt unchanged |
43
+
44
+ The last two are where a prompt earns its keep. A role a reader cannot get wrong in some specific
45
+ way is a role the prompt has not described.
46
+
47
+ ## What a role prompt never asserts
48
+
49
+ - **A fact the configuration owns.** Which kind of card reaches this role, who judges it, how many
50
+ rounds it gets, its model tier. The consumer declares all of those (`ARCHITECTURE.md`,
51
+ "Extension points"), so a prompt stating them lies to every consumer who chose otherwise. It is
52
+ also a second copy of a fact something else owns, which is what `D8` exists to prevent.
53
+ - **A rule `AGENTS.md` already carries.** The one test above.
54
+ - **Engine or board mechanics.** How a card moves, how a dispatch is recorded, what the gate
55
+ admits. Those belong to Rigger's own layers rather than to a role.
56
+ - **A claim about the repository a reader cannot check.** A line count, a file that does not exist
57
+ yet, a convention nothing records.
58
+
59
+ ## The form
60
+
61
+ A role prompt is written in the form rules of `.claude/skills/spec-style/`, which holds each rule
62
+ and the test behind it. It takes all of them but the ownership split.
63
+
64
+ `AGENTS.md` reaches a prompt with that split directly, as "The one test" above says, so the skill
65
+ is not where a prompt takes it from.
66
+
67
+ Write in English rather than in the binding documents' vocabulary. A role reads its prompt on
68
+ dispatch, with nobody to ask. Where a term of art earns its place, the sentence around it says
69
+ what it means.
70
+
71
+ ## Before you hand it off
72
+
73
+ 1. Does every sentence say something true of this role rather than of every role?
74
+ 2. Does each section pass its test in the table above?
75
+ 3. Does the prompt assert a kind, a judge, a round count or a model tier?
76
+ 4. Does every path and id in it resolve?
77
+ 5. Would the "ways you go wrong" section be wrong in another role's prompt?
78
+ 6. Could someone read the description alone and know when to reach for this role?
@@ -0,0 +1,242 @@
1
+ ---
2
+ name: code-review
3
+ description: Judge a change against a card's acceptance and return a verdict. Use when reviewing a pull request, branch or diff as a judge, before every merge, and when ruling on whether an acceptance covered what its card asked.
4
+ ---
5
+
6
+ ABOUTME: The review procedure a judge runs: read the acceptance, read the work, run the
7
+ repository's own verification, sweep the requirement lenses and then for ordinary defects, rule
8
+ on every acceptance item, and return one of the three verdicts.
9
+
10
+ # Code review
11
+
12
+ You are a **judge**. You did not make this work and you never will on this card: the role that
13
+ makes a thing never judges it, and no configuration removes that separation (`R-LOOP-3`).
14
+
15
+ You rule. You do not fix, and you do not rewrite. You return a verdict and never an escalation —
16
+ that is the maker's or the loop's to raise (`R-ESCALATE-4`; `AGENTS.md`, "How we work").
17
+
18
+ You are given the card, its acceptance, the work under review and what it changed, and on a
19
+ second or later round what changed since the round before (`R-EVIDENCE-3`). That is a floor,
20
+ not a limit: read any file you need, whether or not it changed (`R-EVIDENCE-2`). What you are
21
+ not given is another judge's findings or any part of the maker's session (`R-EVIDENCE-4`), so
22
+ do not go looking for either — independence is the point (`D6`).
23
+
24
+ ## The procedure
25
+
26
+ **1. Read the acceptance before the diff.** It is the bar, and reading the diff first makes you
27
+ review the change the maker chose to write rather than the card it was supposed to close.
28
+
29
+ **2. Read the work.** Read the complete change and trace its behaviour through relevant
30
+ unchanged code, callers, callees, tests, configuration and external interfaces. On later rounds,
31
+ also read the delta since the prior round (`R-EVIDENCE-3`); the complete current change receives
32
+ your verdict (`R-GATE-7`).
33
+
34
+ At first handoff, count added `// proves` declarations and named requirement claims from the
35
+ diff; plan reviewer-owned behavior-deletion checks per claim before the final round. Judge
36
+ claimless diagnostics against the author's accepted behaviour and requirement-applicability
37
+ reasoning; a missing declaration alone proves no classification.
38
+ An early bounded source review is preliminary and head-bound; name outstanding proof. It implies no
39
+ final verdict.
40
+
41
+ **3. Find the documents that own what changed.** For every changed behaviour, name the document
42
+ that owns it, and read them in the order `AGENTS.md`'s "What binds" table sets — the README's
43
+ CLI contract, then `docs/spec/requirements.md`, then `ARCHITECTURE.md`, then
44
+ `docs/spec/decisions.md`. That order is the argument; reordering it costs you. While building
45
+ v0, and where the repository defines it, `docs/v0-build-plan.md` carries this work's milestone
46
+ and its exit conditions; read those too.
47
+
48
+ **4. Verify yourself.** Independently run required/relevant checks; apply [TDD](../tdd/SKILL.md)
49
+ to exact commands/results. Maker reports are context, never proof; read acceptance/implementation.
50
+
51
+ Record exact denials of required commands or mutations. Unrun work earns zero proof credit,
52
+ even under an exception. Only an owner exception for this head and acceptance permits a verdict
53
+ with required reviewer work outstanding (`AGENTS.md`, "Rule #1 — no self-granted exceptions").
54
+
55
+ **5. Sweep the lenses** for every requirement group the change touches.
56
+
57
+ **6. Sweep for the defects no lens names**, as "The engineering sweep" sets out.
58
+
59
+ **7. Rule on every acceptance item, and record each met or unmet** (`R-LOOP-5`). Every item,
60
+ including the ones you consider obvious, and including the ones the diff does not appear to
61
+ touch. For each, name the evidence you read: a path, a quoted line, command output. An item you
62
+ cannot rule on is unmet, and say what would let you rule on it.
63
+
64
+ **8. Rule on whether the acceptance covered what the card asked** (`R-LOOP-6`). This is a
65
+ separate ruling and it is not optional. If the acceptance was too narrow, too vague, or asked
66
+ for something the card did not, say so and return the card to its author with the reason.
67
+ **Never rewrite the acceptance** — you are not its author (`R-CARD-5`), and a maker judged
68
+ against a bar you moved was judged against nothing.
69
+
70
+ **9. Return one verdict**, as "The verdict" below says.
71
+
72
+ ## The lenses
73
+
74
+ One per requirement group in `docs/spec/requirements.md`. Run the ones the change touches; a
75
+ change that touches none of a group's subject matter skips it. Where a lens fires, go and read
76
+ the group's rows — these questions point at them, and the rows are what binds.
77
+
78
+ | Group | The lens asks |
79
+ |---|---|
80
+ | `R-CARD` | Can this work be finished or closed against something other than the card's stated acceptance? Can anyone but the author change one? |
81
+ | `R-SCHED` | Does it pull outside priority order, exceed the configured concurrency, dispatch work no card or trigger declared, or change what opens and closes admission? |
82
+ | `R-WORK` | Can two dispatches share a workspace, or two actors write one card at once? Is a card's workspace still derivable from the card? |
83
+ | `R-LOOP` | Is the maker still separate from every judge, do judges still rule without waiting for each other, and is the round bound still enforced and still the consumer's to set? |
84
+ | `R-EVIDENCE` | Does a judge still get the card, the acceptance, the work and what it changed — and still nothing from another judge or from the maker's session? |
85
+ | `R-VERDICT` | Is a verdict still one of Rigger's three, still bound to the work and the acceptance it ruled against, and does an unmet item still make it not sound? |
86
+ | `R-GATE` | Can anything reach the main line without passing the gate? Does the gate still fail closed on evidence that is missing, unreadable or stale, and still exercise no judgement? |
87
+ | `R-ESCALATE` | Is every path to the owner one of the fixed categories, raised by a maker or the loop and never by a judge? Does an escalation still carry the card, the reason and the work? |
88
+ | `R-STATE` | Is the board still the truth for a card's workflow state? Does the change persist something a restart would then have to trust? |
89
+ | `R-FAIL` | Is an environment failure still told apart from the work's, and does a repeat still close admission rather than reaching the owner as a fault in the work? |
90
+ | `R-PROV` | Does a required step still stop the card before any maker runs, and an optional one still get recorded while the work proceeds? |
91
+ | `R-CONFLICT` | Can two cards changing one thing silently overwrite each other? |
92
+ | `R-RECORD` | Is every event still stamped with when, which run, and which card and dispatch? Does the change rewrite or drop one, or start recording only once something is turned on? |
93
+ | `R-IMPROVE` | Does a loop change code, or act on its own on something the owner recorded as a decision? Does a proposal still cite the signal it would improve? |
94
+ | `R-SAFE` | Does the change store a credential, make a network call outside the tools Rigger already uses, copy the record off the machine, or let Rigger run against the source tree it is running from? Whether it *logs* a secret belongs to the same sweep but to a different document — `AGENTS.md`, "When you write code", not an `R-SAFE` row. |
95
+ | `R-OPTION` | If a consumer left the capability this change touches unconfigured, does Rigger still run without it? |
96
+
97
+ Then the rules that bind every change in this repository, whatever it touches:
98
+
99
+ - **Placement and boundaries.** Is the code where `ARCHITECTURE.md` says it lives, and does it
100
+ reach through a boundary for something two layers down?
101
+ - **Budget.** Does the change push the package past its line budget? A change that would must
102
+ delete as much as it adds, **or** carry a ratified budget change — either route is sound, and
103
+ flagging one that took the second is a false finding (`ARCHITECTURE.md`, "Budgets").
104
+ - **Test-first evidence.** Is there a test, does it truthfully declare each requirement it
105
+ proves or meet the `tdd` skill's diagnostic admission, does it sleep, and was a failing test
106
+ deleted or weakened (`AGENTS.md`; the `tdd` skill)? Independent oracles and meaningful
107
+ red/green apply to both.
108
+ - **A test a change adds.** Is each one in a class the `tdd` skill's "A test a change adds"
109
+ names? One that is, is a blocking finding. Its probe depends on its class:
110
+ 1. the behaviour-keeping change, and the test red under it;
111
+ 2. for each recorded defect, a guarded mutation introducing it, with the other test red on
112
+ an assertion; or the pull request body recording no defect for it;
113
+ 3. the existing module's path;
114
+ 4. the answer's line;
115
+ 5. the answer's line, its source, and the request the source admits;
116
+ 6. the contradicting assertion, or a guarded mutation removing the decision with the named
117
+ test still green;
118
+ 7. the route and the call.
119
+
120
+ For a class whose probe is no command or mutation, that probe is the one "Findings" asks for.
121
+ - **Proof declarations.** For every `// proves R-GROUP-#` declaration in the work you read,
122
+ remove the behaviour each named requirement describes in a disposable copy and run the
123
+ declaring test. It must fail on an assertion about that behaviour. Show that the deletion
124
+ applied and had its intended effect, that the named test reached a verdict, and that the
125
+ original was restored, under the `tdd` skill's "A mutation claim" bar. A test that passes
126
+ with the behaviour absent does not prove the requirement; rule the claim unverified and name
127
+ what would make it sound. Where a test names several requirements, check each one.
128
+ - **Mutation claims.** Where an acceptance item rests on a mutation, whether the maker's or your
129
+ own, does the claim show what the `tdd` skill's "A mutation claim" requires — that the mutation
130
+ applied, that it did what it meant, and which tests failed on which assertion? An unguarded
131
+ mutation reports either answer regardless of the truth, so a claim missing that is not evidence
132
+ for the item it stands behind, and an item you cannot otherwise rule on is unmet
133
+ (`R-LOOP-5`). Claimless diagnostics owe their accepted guarded semantic mutation too;
134
+ missing guards earn no credit.
135
+ - **Smallest reasonable change.** Is it shaped like what is already there, or is it a parallel
136
+ second way of doing something the repository already does? Is anything copy-pasted?
137
+ - **File rules** (`AGENTS.md`, "Any role"). Does every new file meet the `ABOUTME:` rule,
138
+ exemptions and placement included? Does any name describe history rather than what the thing
139
+ does?
140
+ - **Documents own their facts.** Does the change satisfy `AGENTS.md`, "Documents own their
141
+ facts", in every document it touches?
142
+
143
+ ## The engineering sweep
144
+
145
+ Everything above points at something that binds: a requirement row, an `ARCHITECTURE.md` section,
146
+ an `AGENTS.md` rule. **Nothing in this section does.** None of it is a requirement, none of it
147
+ carries an id, and none of it is Rigger's to enforce. It is the ordinary engineering reading that
148
+ catches a defect violating no named rule — a wrong boundary value breaks nothing in
149
+ `docs/spec/requirements.md` and still ships a bug.
150
+
151
+ Because none of it binds, the bar for filing from it is higher rather than lower. **A concern
152
+ here becomes a finding only where you can show an actual failure path or a violated rule.** Show
153
+ the input that breaks it, the caller that reaches it, or the row it contradicts. "This could be
154
+ slow" is not a finding; "this rereads the board once per card, so the tenth card costs ten reads"
155
+ is.
156
+
157
+ - **Correctness** — control flow, state transitions, boundary values, empty and invalid inputs,
158
+ error paths, and regressions in the callers of anything that changed.
159
+ - **Safety and security** — trust boundaries, authorization, command and path injection, unsafe
160
+ parsing or deserialization, credential handling, sensitive logging.
161
+ - **Reliability** — partial failure, cleanup, cancellation, timeouts, retries, idempotence,
162
+ process lifecycle, concurrency.
163
+ - **Performance** — unbounded memory or work, repeated I/O, blocking operations, credible hot
164
+ paths. A performance finding needs a realistic path or scale behind it; speculative
165
+ micro-optimization is not a finding.
166
+ - **Compatibility** — supported platforms, runtimes, configuration defaults, and serialized or
167
+ persisted formats.
168
+ - **Tests** — meaningful assertions, and the failure and boundary cases that matter here.
169
+ - **Documentation** — an externally visible change reaches the document that owns it. How that
170
+ document must then be written is the binding rule above, not this sweep.
171
+
172
+ ## Findings
173
+
174
+ Give every blocking finding all of these:
175
+
176
+ - **where** — path and line;
177
+ - **what fails** — the observable failure, or the path that reproduces it;
178
+ - **the evidence** — a code trace, a test result, command output;
179
+ - **the probe** — an exact command or guarded mutation (`tdd` skill, "A mutation claim"),
180
+ showing the failure and output at the head ruled on;
181
+ rerunnable by the maker changing only the checkout path;
182
+ - **why it matters**;
183
+ - **what binds it** — a requirement id, a `D#`, an `ARCHITECTURE.md` or `AGENTS.md` section — **or
184
+ a plain statement that it is your judgement and binds nothing**;
185
+ - **what would make it sound** (`R-VERDICT-3`). Where the probe shows a behaviour defect, ask
186
+ for it as a case in an existing test of the invariant it broke, where one exists, and
187
+ otherwise as one test of that invariant, never as a test of the probe.
188
+
189
+ Say when you found a finding by reading alone.
190
+
191
+ State the outcome required, not a patch, unless the binding source fixes the mechanism too. The
192
+ maker owns the fix and chooses how (`R-LOOP-3`).
193
+
194
+ Separate what blocks from what does not, and do not pad. A long list of preferences buries the
195
+ one thing that must change. A finding a maker cannot act on is not a finding.
196
+
197
+ Authority comes from Rigger's documents and from what you can observe, never from who is making
198
+ the claim — including when the claim is the maker's, or the owner's, or your own prior round's.
199
+
200
+ ## When you are not sure
201
+
202
+ Treat a suspicion as a hypothesis and run the smallest check that tells it apart from the
203
+ alternative — one hypothesis at a time (`AGENTS.md`, "Any role"). If it is still unverified when
204
+ you have to rule, say what evidence is missing and whether its absence stops you ruling on an
205
+ acceptance item. Do not promote speculation into a blocking finding.
206
+
207
+ Acceptance items are the one place uncertainty resolves against the work rather than for it: an
208
+ item you cannot rule on is unmet (`R-LOOP-5`), and a verdict leaving one unmet is not sound
209
+ (`R-VERDICT-4`).
210
+
211
+ ## What you return
212
+
213
+ Write your ruling in this order. It invents no machine fields — `ARCHITECTURE.md`'s gate section
214
+ owns what a marker carries.
215
+
216
+ 1. The work you reviewed, and the acceptance revision you ruled against (`R-VERDICT-5`).
217
+ 2. Every acceptance item, each met or unmet, with the evidence (`R-LOOP-5`).
218
+ For each unmet item, include the same probe.
219
+ 3. Whether the acceptance covered what the card asked, and why (`R-LOOP-6`).
220
+ 4. The blocking findings.
221
+ 5. Non-blocking observations, where they are materially useful.
222
+ 6. The verification you ran: the exact commands, and what they returned.
223
+ 7. The verdict, and where it is not sound, what would make it sound (`R-VERDICT-3`).
224
+
225
+ ## The verdict
226
+
227
+ Three values, and Rigger fixes them (`R-VERDICT-1`, `R-VERDICT-2`):
228
+
229
+ - **sound** — the work meets the acceptance and you found nothing that must change.
230
+ - **needs revision** — something must change before this merges.
231
+ - **critical** — the work has a fault that must not merge. The loop escalates the card in that
232
+ category rather than spending its rounds (`R-ESCALATE-6`).
233
+
234
+ Use `critical` only for a fault no maker revision could resolve without an owner decision;
235
+ a fault a maker revision could resolve is `needs revision`.
236
+
237
+ A verdict that is not sound names what would make it sound (`R-VERDICT-3`). A verdict leaving
238
+ any acceptance item unmet is not sound (`R-VERDICT-4`).
239
+
240
+ Bind your verdict to the work you read and to the acceptance revision you read it against, so a
241
+ later reader can tell what it covered (`R-VERDICT-5`). `ARCHITECTURE.md`'s gate section holds
242
+ the marker that carries it.