@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.
- package/LICENSE +21 -0
- package/README.md +370 -2
- package/package.json +56 -4
- package/scripts/doc-reference-check.mjs +59 -0
- package/scripts/gate-check.mjs +249 -0
- package/scripts/lib/pack-result.mjs +9 -0
- package/scripts/record-commit.mjs +67 -0
- package/src/cli/doctor.mjs +1021 -0
- package/src/cli/init.mjs +384 -0
- package/src/cli/once.mjs +489 -0
- package/src/cli/pause.mjs +56 -0
- package/src/cli/plan.mjs +106 -0
- package/src/cli/recording.mjs +52 -0
- package/src/cli/report.mjs +242 -0
- package/src/cli/resume.mjs +96 -0
- package/src/cli/rigger.mjs +12 -0
- package/src/cli/run.mjs +10 -0
- package/src/cli/setup-board.mjs +108 -0
- package/src/cli/verbs.mjs +82 -0
- package/src/cli/verdict.mjs +180 -0
- package/src/config/validate.mjs +960 -0
- package/src/execution/groups.mjs +185 -0
- package/src/execution/kept-output.mjs +21 -0
- package/src/execution/role.mjs +171 -0
- package/src/execution/run.mjs +490 -0
- package/src/execution/step.mjs +26 -0
- package/src/execution/workspace.mjs +866 -0
- package/src/observation/push.mjs +103 -0
- package/src/observation/report.mjs +415 -0
- package/src/observation/sink.mjs +271 -0
- package/src/package-commit.json +1 -0
- package/src/scheduling/admission.mjs +390 -0
- package/src/scheduling/clock.mjs +98 -0
- package/src/scheduling/lane.mjs +160 -0
- package/src/scheduling/loop.mjs +1738 -0
- package/src/scheduling/pull-order.mjs +46 -0
- package/src/substrate/data-ref.mjs +147 -0
- package/src/substrate/forge/assets.mjs +5 -0
- package/src/substrate/forge/graphql.mjs +258 -0
- package/src/substrate/forge/item-write.mjs +74 -0
- package/src/substrate/forge/read.mjs +998 -0
- package/src/substrate/forge/repository-write.mjs +152 -0
- package/src/substrate/forge/runners.mjs +510 -0
- package/src/substrate/forge/schema-write.mjs +70 -0
- package/src/substrate/forge/write-made.mjs +40 -0
- package/src/substrate/git-environment.mjs +54 -0
- package/src/substrate/host.mjs +23 -0
- package/src/substrate/launchd.mjs +23 -0
- package/src/substrate/process-table.sh +48 -0
- package/src/substrate/process.mjs +2474 -0
- package/src/substrate/providers/adapters.mjs +8 -0
- package/src/substrate/providers/claude.mjs +427 -0
- package/src/substrate/providers/codex.mjs +349 -0
- package/src/substrate/standard-error.mjs +134 -0
- package/src/substrate/worktrees.mjs +517 -0
- package/src/workflow/clock-mark.mjs +40 -0
- package/src/workflow/escalation.mjs +110 -0
- package/src/workflow/facts.mjs +92 -0
- package/src/workflow/first-above.mjs +17 -0
- package/src/workflow/form-check.mjs +88 -0
- package/src/workflow/gate.mjs +62 -0
- package/src/workflow/judges.mjs +695 -0
- package/src/workflow/marker.mjs +265 -0
- package/src/workflow/next-action.mjs +456 -0
- package/src/workflow/status-issue.mjs +268 -0
- package/src/workflow/transitions.mjs +588 -0
- package/templates/claude/agents/architect.md +116 -0
- package/templates/claude/agents/engineer.md +57 -0
- package/templates/claude/agents/pm.md +114 -0
- package/templates/claude/agents/reviewer.md +37 -0
- package/templates/claude/agents/spike-engineer.md +80 -0
- package/templates/claude/hooks/refuse-reserved-git-commands.mjs +909 -0
- package/templates/claude/settings.json +50 -0
- package/templates/claude/skills/acceptance/SKILL.md +275 -0
- package/templates/claude/skills/agent-style/SKILL.md +78 -0
- package/templates/claude/skills/code-review/SKILL.md +242 -0
- package/templates/claude/skills/proposal/SKILL.md +175 -0
- package/templates/claude/skills/spec-style/SKILL.md +112 -0
- package/templates/claude/skills/tdd/SKILL.md +230 -0
- package/templates/codex/config.toml +19 -0
- package/templates/doc-reference-check.md +25 -0
- package/templates/githooks/pre-push +24 -0
- package/templates/github/workflows/rigger-gate.yml +209 -0
- package/templates/launchd/com.williacj.rigger.plist +31 -0
- package/templates/rigger.config.mjs +78 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: proposal
|
|
3
|
+
description: Turn a fuzzy need into a proposal the owner can ratify — the problem and its evidence, the rows that follow, what is out of scope, and what stays unresolved. Load before drafting any delta to docs/spec/, and before asking the owner for what you are missing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
ABOUTME: How a role gets from "I want X" to a proposal: what to establish before drafting a row,
|
|
7
|
+
how to tell a requirement from a decision from a structure, and what the argument around the rows
|
|
8
|
+
has to carry.
|
|
9
|
+
|
|
10
|
+
# Writing a proposal
|
|
11
|
+
|
|
12
|
+
`AGENTS.md`, "When you write a decision or a requirement", says which deltas are proposals. The
|
|
13
|
+
rows are a proposal's payload; the proposal is the argument that earns them. It travels as the
|
|
14
|
+
pull request body, and the owner ratifies from it.
|
|
15
|
+
|
|
16
|
+
`.claude/skills/spec-style/` holds the form a row is written in. This skill holds what has to be
|
|
17
|
+
true before you write one.
|
|
18
|
+
|
|
19
|
+
## The one test
|
|
20
|
+
|
|
21
|
+
**The owner must be able to ratify without reconstructing your reasoning.** They know the need
|
|
22
|
+
they voiced. They do not know what you found, what you ruled out, or what you assumed. Anything
|
|
23
|
+
that moved you and is not written down is lost.
|
|
24
|
+
|
|
25
|
+
## Establish these before you draft
|
|
26
|
+
|
|
27
|
+
Draft no row until you can answer all four. Where the answer is neither in the repository nor in
|
|
28
|
+
the card, ask the owner and wait for the reply.
|
|
29
|
+
|
|
30
|
+
- **The problem, in observable terms.** What goes wrong today, to whom, and how often. "Rigger has
|
|
31
|
+
no X" names a missing feature, not a problem. You have it when you can say what the absence costs
|
|
32
|
+
someone, without naming the thing you want to add.
|
|
33
|
+
- **The evidence.** What actually happened: a run that failed, a card that escalated, a document
|
|
34
|
+
contradicting another, a command with no verb behind it. You have it when you can cite where each
|
|
35
|
+
piece lives. Where you cannot, the problem is a preference, and the proposal says so in those
|
|
36
|
+
words.
|
|
37
|
+
- **What is already settled.** Read the preamble of `docs/spec/requirements.md`, then the rows,
|
|
38
|
+
then `docs/spec/requirements-retired.md`, then `docs/spec/decisions.md`. You have it when you can
|
|
39
|
+
name the rows that come nearest the need and say what each leaves unanswered. A need the register
|
|
40
|
+
already answers is a reading error rather than a delta. A need a ratified decision forecloses
|
|
41
|
+
escalates as `recorded-decision` instead (`.claude/agents/pm.md`, "What you read, and what you
|
|
42
|
+
never edit").
|
|
43
|
+
- **The boundary.** What this need does not include. You have it when you can name three things a
|
|
44
|
+
reader would expect the proposal to cover and will not find in it. Knowing it now is what stops
|
|
45
|
+
the proposal growing while you draft.
|
|
46
|
+
|
|
47
|
+
## Sort what you have into three piles
|
|
48
|
+
|
|
49
|
+
Ask what each thing is a statement about: what Rigger must do, what was chosen among the ways to
|
|
50
|
+
do it, or where the code lives. Three answers, three documents.
|
|
51
|
+
|
|
52
|
+
- **A requirement** — what must be true of Rigger, in the sense the preamble of
|
|
53
|
+
`docs/spec/requirements.md` gives the word. It lands in that file.
|
|
54
|
+
- **A decision** — a choice among the structures that satisfy the requirements, with what would
|
|
55
|
+
reverse it. It lands in `docs/spec/decisions.md`. A structural choice is the architect's
|
|
56
|
+
(`D18` rule 2), so a PM drafting one has left its lane.
|
|
57
|
+
- **A structure** — a layer, a module, an extension point. It lands in `ARCHITECTURE.md`, and the
|
|
58
|
+
architect proposes every delta there while the owner ratifies it (`D18` rule 1).
|
|
59
|
+
`.claude/agents/pm.md` forbids the PM to edit that file: name the layer the delta lands in, say
|
|
60
|
+
why the requirement needs it, and leave the delta to the architect.
|
|
61
|
+
|
|
62
|
+
Something you cannot place is a finding, not a coin toss. Write it into the proposal as an open
|
|
63
|
+
question, name the two piles it sits between, and say what would settle it. Placing it by guess is
|
|
64
|
+
failure mode 2 in `.claude/agents/pm.md`.
|
|
65
|
+
|
|
66
|
+
## Write each row
|
|
67
|
+
|
|
68
|
+
The preamble of `docs/spec/requirements.md` is the authority on ids and on what the two columns
|
|
69
|
+
mean. Read it there. What the proposal owes beyond it:
|
|
70
|
+
|
|
71
|
+
- **Fill both columns.**
|
|
72
|
+
- **Name the test you expect to claim the row.** A judge enforces the test obligation for each new
|
|
73
|
+
requirement (`D17` rules 1 and 7). Where no test exists yet, `checked
|
|
74
|
+
by` is `nothing yet`, and the proposal names the card that closes it.
|
|
75
|
+
- **Write it so a judge can rule on it.** `.claude/skills/acceptance/`, under "Write each item",
|
|
76
|
+
holds the rule and the words it bars. A row is read the same way an acceptance item is, by
|
|
77
|
+
someone who cannot ask you, and it fails the same way.
|
|
78
|
+
- **State its limit.** Each row you propose states the edge past which it does not hold, or rests
|
|
79
|
+
on a table of the dimensions it depends on, each combination marked in or out of scope.
|
|
80
|
+
`.claude/skills/acceptance/`, under "Systems outside Rigger's code", holds that table's form.
|
|
81
|
+
A ratified row's table lives in `docs/spec/requirements.md`, under its group, directly after
|
|
82
|
+
that group's row table. Head it with the row's id, for example
|
|
83
|
+
`### R-TABLEEXAMPLE-1 — Example states`. The row cites its own id and that heading.
|
|
84
|
+
|
|
85
|
+
**A proposal never lands in either register.** Every row in `docs/spec/requirements.md` and every
|
|
86
|
+
entry in `docs/spec/decisions.md` binds, so yours waits in the pull request until the owner
|
|
87
|
+
ratifies it (each register's preamble). Write it as it will read once ratified, and let the pull
|
|
88
|
+
request body say it is a proposal.
|
|
89
|
+
|
|
90
|
+
## Run every check you specify
|
|
91
|
+
|
|
92
|
+
A check a proposal names — a lint, a grep, the rule a gate would apply — is a claim about data
|
|
93
|
+
that already exists. `AGENTS.md`, "How we work", has you read the current code before
|
|
94
|
+
recommending a change to it, and a specified check is that same claim in executable form.
|
|
95
|
+
|
|
96
|
+
- **Run it against the files it would run on**, before it reaches the draft.
|
|
97
|
+
- **Write down what it returns today**: how many entries it passes, how many it fails, and which
|
|
98
|
+
ones. A check whose present result the proposal leaves out is one the owner cannot ratify,
|
|
99
|
+
because a clean run and an unrun check read the same on the page.
|
|
100
|
+
- **Where the run fails something a register's preamble permits, the check is wrong.** Correct it,
|
|
101
|
+
or propose the row that makes the register match it.
|
|
102
|
+
|
|
103
|
+
An observation about what the binding documents currently say is the same claim, and takes the
|
|
104
|
+
same run. An unrun check reads as a finding, and the owner ratifies it as one.
|
|
105
|
+
|
|
106
|
+
## What the argument carries
|
|
107
|
+
|
|
108
|
+
Scale each to the delta. A one-row proposal wants a paragraph per heading; a proposal that reshapes
|
|
109
|
+
a group wants more. Leave a heading out where it holds nothing, rather than padding it.
|
|
110
|
+
|
|
111
|
+
1. **The problem, and its evidence.** From above. This is the section that does the work.
|
|
112
|
+
2. **What must be true, and why it follows.** The rows, each tied to the part of the problem it
|
|
113
|
+
answers. A row nothing in the problem reaches is scope you added.
|
|
114
|
+
3. **What it rests on.** The decision being recorded, if any, and what would reverse it. Where an
|
|
115
|
+
existing `D#` already settles it, cite that instead.
|
|
116
|
+
4. **What it changes underneath.** The layer or extension point the rows land in, named, and the
|
|
117
|
+
`README.md` verb the rows imply where the CLI contract carries none. A signal for the owner,
|
|
118
|
+
never a reason to soften a row.
|
|
119
|
+
5. **Out of scope.** The boundary you established, written down: three to five things a reader
|
|
120
|
+
would expect and will not find, each with its reason. Deferred, better as its own card,
|
|
121
|
+
foreclosed by a decision, or not yet evidenced.
|
|
122
|
+
6. **What it costs.** What gets harder, slower or impossible once the owner ratifies this. A
|
|
123
|
+
proposal with no cost has not been examined.
|
|
124
|
+
7. **Open questions.** Each marked blocking or non-blocking, and each addressed to whoever resolves
|
|
125
|
+
it.
|
|
126
|
+
|
|
127
|
+
## Draw the shape where the subject has one
|
|
128
|
+
|
|
129
|
+
Where the need has a shape — a card moving between states, a sequence crossing roles, a boundary
|
|
130
|
+
being redrawn — draw it. `.claude/skills/spec-style/` rule 4 asks for structure that matches the
|
|
131
|
+
meaning, and prose is not always the matching structure.
|
|
132
|
+
|
|
133
|
+
- **Mermaid in a fenced block**, not ASCII art. It renders for the owner, reads as plain text to a
|
|
134
|
+
role on dispatch, and diffs a line at a time.
|
|
135
|
+
- **The diagram argues for the rows, and is never where a row comes from.** Draw it, then read it
|
|
136
|
+
back and write what it shows as rows. A fact surviving only in the picture never reached the
|
|
137
|
+
register, and the register is what binds.
|
|
138
|
+
- **Label what it depicts** — current state, proposed state, or the difference between them.
|
|
139
|
+
|
|
140
|
+
This section governs the proposal and not the register. Whether the registers under `docs/spec/`
|
|
141
|
+
carry diagrams of their own is a separate question, and this skill does not settle it.
|
|
142
|
+
|
|
143
|
+
## Mark every gap where it appears
|
|
144
|
+
|
|
145
|
+
Two kinds, both marked inline at the sentence they affect, never collected at the end where the
|
|
146
|
+
reader meets them too late.
|
|
147
|
+
|
|
148
|
+
- **An assumption** — plausible, unvalidated, and you drafted on it. Name what would falsify it.
|
|
149
|
+
- **An open question** — unknown, and it needs discovery or the owner. Name who resolves it.
|
|
150
|
+
|
|
151
|
+
An unmarked gap reads as a fact. The maker builds against what the row says, not against what you
|
|
152
|
+
meant. An assumption you left unmarked therefore reaches them as an instruction, which is failure
|
|
153
|
+
mode 1 in `.claude/agents/pm.md`.
|
|
154
|
+
|
|
155
|
+
## Before you hand it off
|
|
156
|
+
|
|
157
|
+
1. Does the problem section say what goes wrong today, to whom, and how often?
|
|
158
|
+
2. Does a citation sit under each piece of evidence?
|
|
159
|
+
3. Does every row trace to a part of the problem the draft states?
|
|
160
|
+
4. Is every row observable from outside, naming no mechanism?
|
|
161
|
+
5. Does every row carry `made true by`, `checked by`, and the test you expect to claim it?
|
|
162
|
+
6. Do every proposed row and every proposed decision sit in the pull request, each written as it
|
|
163
|
+
will read once ratified?
|
|
164
|
+
7. Does every check or observation the draft specifies carry what it returns today?
|
|
165
|
+
8. Does the draft name the structural delta rather than writing it?
|
|
166
|
+
9. Where the subject has a shape, is it drawn, and does every fact in the drawing also appear in a
|
|
167
|
+
row?
|
|
168
|
+
10. Is every gap marked inline, an assumption with what would falsify it or an open question with
|
|
169
|
+
who resolves it?
|
|
170
|
+
11. Does out of scope name what a reader would expect and not find, each with its reason?
|
|
171
|
+
12. Does the draft say what ratifying it costs?
|
|
172
|
+
13. Does anything in the draft change what a ratified decision means?
|
|
173
|
+
14. Does every row state its limit, or rest on a table of the dimensions it depends on? If it has
|
|
174
|
+
a table, does that table live under its group directly after the row table in
|
|
175
|
+
`docs/spec/requirements.md`?
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-style
|
|
3
|
+
description: The register Rigger's binding documents are written in — five form rules for any diff touching README.md, ARCHITECTURE.md or docs/spec/. In docs/spec/, the lint reads the live decisions and requirements registers; retired registers keep their historical text. Load before drafting or reviewing one. Form only — it never licenses a change to what a ratified clause means. For allocating, amending and retiring ids, read the register's own preamble.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
ABOUTME: The five form rules Rigger's binding documents are written under, and the test behind
|
|
7
|
+
each, for anyone drafting or reviewing a delta to them.
|
|
8
|
+
|
|
9
|
+
# The Rigger register
|
|
10
|
+
|
|
11
|
+
Five rules. They constrain **form only**. Content is never negotiable: every bound, exception and
|
|
12
|
+
gate survives an edit made under them. Where form and meaning pull apart, keep the meaning and
|
|
13
|
+
flag the sentence.
|
|
14
|
+
|
|
15
|
+
They describe how the binding documents are already written, so that a delta written under them
|
|
16
|
+
reads like what is already there. That is the whole of the job — a reader should not be able to
|
|
17
|
+
pick your row out of the ones around it.
|
|
18
|
+
|
|
19
|
+
## The five rules
|
|
20
|
+
|
|
21
|
+
### 1. One term per concept
|
|
22
|
+
|
|
23
|
+
Rigger's vocabulary is small, and keeping it small is what stops a reader wondering whether two
|
|
24
|
+
words name two mechanisms. A card is **escalated** — never bubbled, parked or forwarded. A role
|
|
25
|
+
is **dispatched**. A judge returns a **verdict**, never an approval or a sign-off. Name a new
|
|
26
|
+
concept once, then reuse the name.
|
|
27
|
+
|
|
28
|
+
The converse binds as hard: where two words already name two things, never collapse them. A
|
|
29
|
+
**judge** is the slot in the loop that returns a verdict; a **reviewer** is one of the roles that
|
|
30
|
+
can fill it (`ARCHITECTURE.md`, `judges: ['reviewer']`). Editing either into the other destroys a
|
|
31
|
+
distinction the configuration depends on.
|
|
32
|
+
|
|
33
|
+
### 2. Sentences of about 25 words, and never past 40
|
|
34
|
+
|
|
35
|
+
Split a compound. Use an em-dash aside sparingly, and never nested. A sentence carrying an
|
|
36
|
+
ordered sequence wants to be a list — that is rule 4.
|
|
37
|
+
|
|
38
|
+
The ceiling is not a preference about prose. A requirement is a thing a judge rules on and a
|
|
39
|
+
maker builds against, and a 40-word sentence hides its own conditions.
|
|
40
|
+
|
|
41
|
+
### 3. Active voice, actor named
|
|
42
|
+
|
|
43
|
+
The engine, the gate, the maker, the judge, the owner, the consumer, the role. Passive only where
|
|
44
|
+
the actor is genuinely unknown, or genuinely does not matter.
|
|
45
|
+
|
|
46
|
+
Where authority is the subject — who may merge, who may ratify, who may withdraw a row — an
|
|
47
|
+
ambiguous "it" is a defect rather than a style choice. `docs/spec/requirements.md` splits `made
|
|
48
|
+
true by` from `checked by` for this reason: two actors, two columns, nothing left to infer.
|
|
49
|
+
|
|
50
|
+
### 4. Structure that matches the meaning
|
|
51
|
+
|
|
52
|
+
A sequence of more than three steps, or a rule with three or more conditions, becomes a numbered
|
|
53
|
+
or bulleted list. State the discriminating test before the list it governs, so that a reader
|
|
54
|
+
knows what they are sorting by before they start sorting.
|
|
55
|
+
|
|
56
|
+
`docs/spec/requirements.md`'s `checked by` passage is one exemplar: it says the two columns differ
|
|
57
|
+
and why, then gives the five forms as a numbered list. `docs/spec/decisions.md`'s **Deferred, and
|
|
58
|
+
what returns it** tables are the other — one row per deferred thing, one column for the evidence
|
|
59
|
+
that returns it, and no prose carrying what the table holds better.
|
|
60
|
+
|
|
61
|
+
A register table cannot hold a list, so there a rule with three or more conditions takes a lead
|
|
62
|
+
row, then continuation rows each holding one condition. `docs/spec/requirements.md`'s `R-GATE-4`
|
|
63
|
+
to `R-GATE-8` are the exemplar. The split is by condition, never inside one definition: a
|
|
64
|
+
continuation row that defines one term may hold that term's several parts.
|
|
65
|
+
|
|
66
|
+
A structure that neither a list nor a table carries — a set of things and the relations between
|
|
67
|
+
them — becomes a diagram. `docs/spec/decisions.md`'s `D15` holds when a diagram is admitted, what
|
|
68
|
+
it owns in each venue, and the one form it takes. `ARCHITECTURE.md`'s layer map is the exemplar.
|
|
69
|
+
|
|
70
|
+
### 5. Own it, refer to it, or cut it
|
|
71
|
+
|
|
72
|
+
`AGENTS.md`'s "Documents own their facts" splits every sentence three ways.
|
|
73
|
+
|
|
74
|
+
1. **It states a fact the document owns.** A fact another document owns fails this branch.
|
|
75
|
+
2. **It refers to a fact another document owns.** A passage that names a source and restates what
|
|
76
|
+
it says fails, however short the restatement.
|
|
77
|
+
3. **It is cut.** A sentence that owns nothing and refers to nothing is cut. Shortening it is no
|
|
78
|
+
answer to this rule.
|
|
79
|
+
|
|
80
|
+
A term for a concept is one the binding documents already use for that concept, or one the
|
|
81
|
+
sentence introducing it defines. A term that is neither fails.
|
|
82
|
+
|
|
83
|
+
`AGENTS.md`, under "Write to be acted on", governs how the sentence that survives is written.
|
|
84
|
+
|
|
85
|
+
## What this skill is not
|
|
86
|
+
|
|
87
|
+
- **Not a rewrite licence.** Never improve a ratified clause's meaning while restyling it. Where
|
|
88
|
+
a rule here and a clause's meaning conflict, keep the meaning and say so in the proposal.
|
|
89
|
+
- **Not the register's mechanics.** Allocating, amending, retiring and ratifying an id belong to
|
|
90
|
+
each register's preamble, which is the authority; `AGENTS.md`'s "When you write a decision or a
|
|
91
|
+
requirement" states what proposing one obliges you to do. Read the preamble of the file you are
|
|
92
|
+
changing before you draft.
|
|
93
|
+
- **Not all of it lintable.** Where the repository defines it, `scripts/spec-style-lint.mjs`
|
|
94
|
+
reads rules 1 and 2 off this file and applies them to `README.md`, `ARCHITECTURE.md`,
|
|
95
|
+
`docs/spec/decisions.md`, and `docs/spec/requirements.md`. It reads every prose paragraph and
|
|
96
|
+
every table cell, and skips fenced code and the retired registers, whose historical text is
|
|
97
|
+
kept. A ruled-out term is a finding, and so is a sentence past the ceiling. Rules 3 and 4 ask
|
|
98
|
+
whether an actor matters and whether a structure fits its meaning. Those are judgments, so
|
|
99
|
+
they hold because an author applies them and a reviewer reads for them. Rule 5 asks who owns
|
|
100
|
+
a fact, and holds the same way. The lint's `--hints` option gives advisory hints for rules 4
|
|
101
|
+
and 5, which hold by judgment still.
|
|
102
|
+
|
|
103
|
+
## Before you hand it off
|
|
104
|
+
|
|
105
|
+
1. Does every concept use the binding documents' existing word, and does every existing
|
|
106
|
+
distinction survive?
|
|
107
|
+
2. Is any sentence past 40 words? Are most nearer 25 than 35?
|
|
108
|
+
3. Does every sentence about authority name its actor?
|
|
109
|
+
4. Is anything ordered or conditional still buried in prose?
|
|
110
|
+
5. Does any passage restate what a source it names already says, or introduce a term nothing
|
|
111
|
+
here defines?
|
|
112
|
+
6. Did you change what a ratified clause means? That is a proposal, not a restyle.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Write code test-first — a failing test, the minimal code that passes it, then refactor while green. Use before the first test body of any change to source, for every bug fix, when claiming that a mutation shows a test discriminates, and when deciding what a test must declare about the requirement it proves.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
ABOUTME: The failing-test-first loop this repository requires, what counts as a real red, what
|
|
7
|
+
makes a test worth keeping, what a mutation claim must show before it is evidence, what a test
|
|
8
|
+
declares about the requirement it proves, and the rules on sleeps, deleted tests and spikes.
|
|
9
|
+
|
|
10
|
+
# Test-driven development
|
|
11
|
+
|
|
12
|
+
`AGENTS.md`'s "When you write code" section requires this loop. This skill is how to run it.
|
|
13
|
+
|
|
14
|
+
`AGENTS.md`, "Before you start", governs the state of the suite before you begin work.
|
|
15
|
+
|
|
16
|
+
## The loop
|
|
17
|
+
|
|
18
|
+
**Red.** Write one failing test for the next smallest piece of behaviour, and run it. Watch it
|
|
19
|
+
fail, and read the failure. A test that has never failed has proved nothing — it may be
|
|
20
|
+
asserting on the wrong thing, or on nothing.
|
|
21
|
+
|
|
22
|
+
Red counts only when the test you meant to write ran, or reached the compile-time check
|
|
23
|
+
you meant it to reach, and failed because the behaviour you asked for is missing or wrong. A
|
|
24
|
+
syntax error, a broken fixture, a missing dependency or an unrelated failure is not red: it is a
|
|
25
|
+
test you have not managed to run yet. Clear it, then get the failure you meant.
|
|
26
|
+
|
|
27
|
+
**Green.** Write the minimal code that makes it pass, then rerun that same target and watch it
|
|
28
|
+
pass. Minimal is not a style note: anything beyond what the test demands is code no test asked
|
|
29
|
+
for. Put it where `ARCHITECTURE.md` says it lives (`AGENTS.md`, "When you write code").
|
|
30
|
+
|
|
31
|
+
**Refactor.** Improve the code while the suite stays green, rerunning the affected tests after
|
|
32
|
+
each step. Extract rather than copy-paste, by the Rule of Three (`AGENTS.md`, "Any role"). Follow
|
|
33
|
+
`AGENTS.md`, "Before you start", for deterministic verification before commit and host evidence
|
|
34
|
+
before handoff; a focused pass alone does not meet those obligations.
|
|
35
|
+
|
|
36
|
+
Then the next test, and one slice at a time: finish red, green and refactor for one behaviour
|
|
37
|
+
before writing the next test. Never batch the tests and then batch the implementation —
|
|
38
|
+
test-first means one test ahead of the code, not the whole suite ahead of it. Small steps, often:
|
|
39
|
+
the loop's value is the failure you saw, and a large step throws it away.
|
|
40
|
+
|
|
41
|
+
## A test worth keeping
|
|
42
|
+
|
|
43
|
+
The core below implements `AGENTS.md`, "When you write code"; the worked example is craft.
|
|
44
|
+
|
|
45
|
+
**Name the break before the body.** State the observable behaviour and plausible defect the test
|
|
46
|
+
must catch. Test the narrowest stable public or architectural boundary. Private call counts and
|
|
47
|
+
source layout are not behaviour unless the contract makes them so.
|
|
48
|
+
|
|
49
|
+
**Derive the expected value independently.** Use the requirement, a worked example or a checked
|
|
50
|
+
literal, never the production algorithm or its helpers. Failing first cannot expose an oracle
|
|
51
|
+
that later agrees with the implementation by construction.
|
|
52
|
+
|
|
53
|
+
**Derive doubles independently too.** Use observed responses or documented collaborator
|
|
54
|
+
contracts, never the assertion's expected value. Record that source where the double is defined.
|
|
55
|
+
|
|
56
|
+
**Separate algorithm and host proof.** Inject clocks to force algorithmic timing decisions.
|
|
57
|
+
Retain real-host checks for changed wiring, tool/OS contracts and real deadlines. A logical clock
|
|
58
|
+
cannot prove an OS deadline. Identify any boundary left unproved; a fake pass earns no host credit.
|
|
59
|
+
|
|
60
|
+
**Establish the premise.** Observe fixture readiness with a condition before starting the
|
|
61
|
+
behaviour's timer when readiness is its premise. Keep startup within the bound when startup
|
|
62
|
+
itself is the contract. A readiness failure is not a failure of behaviour never exercised.
|
|
63
|
+
|
|
64
|
+
**Keep the authority live.** Where a tool decides a fact (`D16`), assert the relation between
|
|
65
|
+
its answer and the code's, rather than pinning today's answer. Where the repository defines it,
|
|
66
|
+
`test/package-budget.test.mjs` is a worked example: a fixed answer documents today; asking the
|
|
67
|
+
tool catches a changed authority.
|
|
68
|
+
|
|
69
|
+
## A test a change adds
|
|
70
|
+
|
|
71
|
+
A test a change adds is a top-level test whose file and title the head holds more times than
|
|
72
|
+
the merge base of the head with `main` does, overall or in the host tier. Before handoff, check
|
|
73
|
+
each one against these classes, and record in the pull request body the defect each one catches.
|
|
74
|
+
A test in any class is unhealthy.
|
|
75
|
+
|
|
76
|
+
1. **Implementation.** An assertion's result can change under a change that keeps every
|
|
77
|
+
behaviour the card, a requirement or the test's title names. That change may be to the code,
|
|
78
|
+
to its layout or line positions, or to state the head does not fix, such as another ref.
|
|
79
|
+
2. **Redundancy.** The pull request records no defect for it, or each defect it records is
|
|
80
|
+
also caught by another test the change adds, or by another test in its file. A test the
|
|
81
|
+
change adds may be removed before merge.
|
|
82
|
+
3. **A fake not shared.** It adds a double for a boundary that a module under `test/`, usable
|
|
83
|
+
from the test's tier at the head, already doubles, instead of extending that module.
|
|
84
|
+
4. **A fake without its source.** An answer the change adds to or changes in a double records
|
|
85
|
+
no source where the double is defined: a recaptured unedited answer naming its command, or
|
|
86
|
+
a cited documented contract.
|
|
87
|
+
5. **A fake leaving its source.** A double the change adds or changes answers a request its
|
|
88
|
+
recorded source admits differently, in form or value, or refuses a continuation, cursor or
|
|
89
|
+
state it has itself advertised.
|
|
90
|
+
6. **A host claim untrue.** Its `D29` rule 11 declaration fails in any of these ways:
|
|
91
|
+
- its reason is not what its assertions claim (`D29` rule 2);
|
|
92
|
+
- the test arms a timer with a delay above zero itself, without naming a real deadline
|
|
93
|
+
(`D29` rule 11);
|
|
94
|
+
- the deterministic test it names stays green with that decision removed;
|
|
95
|
+
- its claim to depend on no decision is untrue.
|
|
96
|
+
7. **Real time.** In the deterministic tier, its outcome depends on real elapsed time,
|
|
97
|
+
scheduling or load where an injected clock or a seam could carry it (`AGENTS.md`, "When you
|
|
98
|
+
write code"). The class covers a route the deterministic runner and the added-timer steps at
|
|
99
|
+
the head do not refuse. A test added to a file on `D30`'s conversion list may still read the real
|
|
100
|
+
clock (`D30` rule 2), so this class does not bind its clock reads.
|
|
101
|
+
|
|
102
|
+
## A mutation claim
|
|
103
|
+
|
|
104
|
+
Deleting a line, flipping a condition or breaking a value and watching a test red is how you
|
|
105
|
+
learn whether that test discriminates. Acceptance items in this repository have already been
|
|
106
|
+
settled on such a claim, which makes the claim evidence — and **a mutation is evidence only once
|
|
107
|
+
it is shown to have applied.** An unguarded mutation reports either answer regardless of the
|
|
108
|
+
truth, and neither way it lies is visible in the output.
|
|
109
|
+
|
|
110
|
+
- **A mutation that did not apply** runs the unmodified code and reports green. Read as a result
|
|
111
|
+
it says the test does not discriminate, which is the opposite of the truth, invented.
|
|
112
|
+
- **A mutation that stops the run reaching a verdict** — a file it broke, an import that now
|
|
113
|
+
throws, a loop that never ends — is booked by `node --test` as one failing test named after the
|
|
114
|
+
file. Read as a result it says the test discriminates, when nothing was tested at all.
|
|
115
|
+
|
|
116
|
+
A green suite after a mutation that never landed looks exactly like a green suite after one that
|
|
117
|
+
landed uncaught, and a run that never reached a verdict looks exactly like a test failing for the
|
|
118
|
+
reason you wanted. So show all of these, for each mutation, before saying what it proved:
|
|
119
|
+
|
|
120
|
+
1. **The anchor was there.** The pattern you replaced occurred the number of times you expected.
|
|
121
|
+
Zero occurrences is a write that changed nothing and a run that reports green. An anchor from
|
|
122
|
+
an earlier round goes stale when a neighbouring edit rewraps the line it spans, even where the
|
|
123
|
+
rule it names is unchanged. Resolve its whitespace against the file's bytes, which covers the
|
|
124
|
+
rewrap and the line ending together.
|
|
125
|
+
2. **The replacement landed.** Read the bytes back off disk rather than trusting the edit, and
|
|
126
|
+
have `git diff` show them.
|
|
127
|
+
3. **The mutant still runs.** The run reached a verdict on the tests you aimed at: it reported
|
|
128
|
+
the number of tests that target normally reports, and what it names are tests rather than the
|
|
129
|
+
file. `node --check` is a cheap pre-filter and not this check — a mutant that parses and loads
|
|
130
|
+
can still hang or end the test process another way, and the runner then books the whole file
|
|
131
|
+
as one failing test, named after the file with no assertion under it. That is the same output
|
|
132
|
+
a discriminating red has, so the count is what tells them apart.
|
|
133
|
+
4. **The mutation did what it meant.** Read the mutated value or behaviour back and say what it
|
|
134
|
+
now is. A diff proves an edit, never an effect: a replacement can land, parse, and mutate
|
|
135
|
+
something other than what you meant.
|
|
136
|
+
5. **The report names the tests and the assertions.** Which tests failed, and on which
|
|
137
|
+
assertion. A pass or fail count is the weakest signal there is, because both failures above
|
|
138
|
+
produce a plausible one, and reading the messages is what tells *redded for the right reason*
|
|
139
|
+
from *redded at all*.
|
|
140
|
+
6. **The original is back.** Restored byte-exact, with `git status` for the file clean, before
|
|
141
|
+
the next mutation and before any commit.
|
|
142
|
+
7. **A failed guard exits non-zero.** A guard that reports a result it could not vouch for is
|
|
143
|
+
itself the defect.
|
|
144
|
+
|
|
145
|
+
Where the repository defines it, attach `npm run mutation:receipt` output to each mutation claim.
|
|
146
|
+
|
|
147
|
+
One mutation removes one behaviour. Batching several reports the union and hides the gap.
|
|
148
|
+
|
|
149
|
+
Where the repository defines it, `test/verify-mac-containment` guards its bounded Mac claims:
|
|
150
|
+
anchors, readback/diff, named assertion verdicts without cancellation, observed effects,
|
|
151
|
+
restoration and retained artifacts. Those mechanics do not decide whether a mutation represents
|
|
152
|
+
the right semantic fault or covers the claim. The judge still evaluates that scope.
|
|
153
|
+
`test/mutation-claim.test.mjs` checks the stated bar, not its use.
|
|
154
|
+
|
|
155
|
+
Preserve byte-complete private command/ref/provenance originals outside
|
|
156
|
+
test/suite/mutation/scratch/temp roots through retention event; reopen after command/fixture
|
|
157
|
+
teardown before citation. Unreadable originals mean missing evidence despite paths/digests.
|
|
158
|
+
Record actual child exits separately from shell/transport/tool status; missing/ambiguous exits
|
|
159
|
+
earn no credit. Preserve child expressions: direct argv/literal scripts. Cross-stream causal order
|
|
160
|
+
needs synchronization or ordered observation, never concatenation.
|
|
161
|
+
|
|
162
|
+
## A bug fix
|
|
163
|
+
|
|
164
|
+
Reproduce the bug as a test first (`AGENTS.md`, "When you write code"), watch it fail for the
|
|
165
|
+
reason you think it fails, and only then fix it. If the test passes before you touch the code,
|
|
166
|
+
you have not reproduced the bug and you do not yet know what it is.
|
|
167
|
+
|
|
168
|
+
Root cause only (`AGENTS.md`, "Any role"). Where a fix did not work, revert it before testing
|
|
169
|
+
the next hypothesis.
|
|
170
|
+
|
|
171
|
+
## Never delete a failing test
|
|
172
|
+
|
|
173
|
+
A failing test is a claim that something is wrong. Deleting it deletes the claim, not the fault.
|
|
174
|
+
Fix the code, or raise the test with the owner (`AGENTS.md`). The same holds for weakening an
|
|
175
|
+
assertion until it passes.
|
|
176
|
+
|
|
177
|
+
With explicit prior owner authorization, remove a redundant live body only with an inspectable
|
|
178
|
+
mapping from each protected behaviour to controlled replacement proof and retained real-boundary
|
|
179
|
+
coverage. Removed host proof without replacement remains unmet. A failing test's claim must
|
|
180
|
+
still be resolved; calling it redundant does not resolve it.
|
|
181
|
+
|
|
182
|
+
## No sleeps
|
|
183
|
+
|
|
184
|
+
`AGENTS.md`, "When you write code", bars a sleep in a test. A sleep is either too short, and
|
|
185
|
+
the test is flaky, or too long, and the suite is slow — and it is usually both on different
|
|
186
|
+
machines. If a component needs the time, it takes a clock.
|
|
187
|
+
|
|
188
|
+
Prefer fast and deterministic, and log clearly enough that the failure message alone says what
|
|
189
|
+
broke.
|
|
190
|
+
|
|
191
|
+
## What a test declares
|
|
192
|
+
|
|
193
|
+
Tests proving product requirements declare them. `docs/derived/test-matrix.md` is
|
|
194
|
+
generated from declarations, never hand-edited (`D8`). New requirements need claiming tests
|
|
195
|
+
(`D17` rule 1), enforced by judges (`D17` rule 7), not automated checks. Older requirements
|
|
196
|
+
without claims are counted gaps, not build failures; `D17` governs when they close.
|
|
197
|
+
|
|
198
|
+
A harness diagnostic may omit `// proves` only under author acceptance naming its infrastructure
|
|
199
|
+
behaviour, why checked registered product requirements describe none of its assertions, and a
|
|
200
|
+
bounded semantic mutation discriminating the defect. Neither its path, helper nor missing
|
|
201
|
+
declaration establishes classification. Never borrow an unrelated requirement for a declaration.
|
|
202
|
+
It still owes an independent oracle, meaningful red/green and guarded diagnostic mutation evidence
|
|
203
|
+
under "A mutation claim"; declarations retain every proof obligation. Omission adds no
|
|
204
|
+
matrix claim.
|
|
205
|
+
|
|
206
|
+
A declaration is a `// proves R-GROUP-#` comment on the line directly above the test it speaks
|
|
207
|
+
for, naming as many ids as that test proves, separated by commas. Where the repository defines
|
|
208
|
+
them, `npm run matrix` rebuilds the matrix and `npm run matrix:check` refuses a stale one, so work
|
|
209
|
+
regenerates and commits it with its declarations. A declaration naming an id
|
|
210
|
+
`docs/spec/requirements.md` does not hold is refused by name, and so is one standing above no
|
|
211
|
+
test — a call that is commented out is not a test.
|
|
212
|
+
|
|
213
|
+
Where the repository defines it, the block comment above `declarationsIn` in
|
|
214
|
+
`scripts/build-test-matrix.mjs` lists the source shapes the scan claims nothing for, the ones it
|
|
215
|
+
refuses by file and line, and the one it wrongly claims. `test/build-test-matrix.test.mjs` holds
|
|
216
|
+
the parser cases.
|
|
217
|
+
|
|
218
|
+
So when you add a requirement, the test that claims it is part of the same work. Where your card
|
|
219
|
+
is what makes an older requirement true, its test closes that requirement's counted gap in the
|
|
220
|
+
same work (`D17` rule 6). Name each requirement a test actually proves; the diagnostic admission
|
|
221
|
+
above never reclassifies existing tests or waives those obligations.
|
|
222
|
+
|
|
223
|
+
Tests do not count toward the package line budget (`ARCHITECTURE.md`, "Budgets"). That is no
|
|
224
|
+
licence to write more of them: every test costs execution time and maintenance, so each one
|
|
225
|
+
still has to protect a concrete behaviour.
|
|
226
|
+
|
|
227
|
+
## Spikes
|
|
228
|
+
|
|
229
|
+
A spike card is exempt from this loop (`AGENTS.md`, "When you write code"). What the spike
|
|
230
|
+
produces is the report its acceptance describes, not the code that got there.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ABOUTME: Codex's declaration for this repository: the sandbox and network a Codex session Rigger
|
|
2
|
+
# dispatches runs under, and the tools and connectors it may use. Rigger's Codex adapter copies it
|
|
3
|
+
# into each dispatch's own Codex home as that home's config.toml, where Codex reads it untrusted.
|
|
4
|
+
|
|
5
|
+
# A session writes in its working directory and in each directory a judge reaches (`--add-dir`),
|
|
6
|
+
# which Codex ignores under `read-only`. The temporary directories are left out. In their place the
|
|
7
|
+
# adapter adds one temporary directory in the dispatch's own scratch directory and points `TMPDIR`
|
|
8
|
+
# and `TMPPREFIX` at it (O93), so nothing outside those roots is writable.
|
|
9
|
+
sandbox_mode = "workspace-write"
|
|
10
|
+
|
|
11
|
+
[sandbox_workspace_write]
|
|
12
|
+
# On, so `gh pr comment` and the rest of `gh` can reach the forge from the sandbox.
|
|
13
|
+
network_access = true
|
|
14
|
+
exclude_tmpdir_env_var = true
|
|
15
|
+
exclude_slash_tmp = true
|
|
16
|
+
|
|
17
|
+
# The MCP servers a session may use, each as an `[mcp_servers.<name>]` table. None is declared, so a
|
|
18
|
+
# session has none. Plugins and connected apps are off for every Rigger session, whatever this file
|
|
19
|
+
# says, because the adapter passes `--disable plugins` and `--disable apps`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!-- ABOUTME: Shows a consumer how to run the packaged document reference resolver in its own checks. -->
|
|
2
|
+
|
|
3
|
+
# Document reference check
|
|
4
|
+
|
|
5
|
+
Install `@williacj/rigger` in the repository whose documents you want to check. Add
|
|
6
|
+
`doc-references.json` at that repository's root. Its `documents` object maps each document path,
|
|
7
|
+
relative to that root, to `strict` or `soft`. A strict finding fails the check; a soft finding is
|
|
8
|
+
reported without failing it. For example:
|
|
9
|
+
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"documents": { "docs/decisions.md": "strict" },
|
|
13
|
+
"exempt": { "paths": {} }
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Add this script to that repository's `package.json`:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
"check:references": "node ./node_modules/@williacj/rigger/scripts/doc-reference-check.mjs ."
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Run `npm run check:references` from the repository root in its own checks, after `npm ci`. The
|
|
24
|
+
`.` argument makes the installed resolver read that repository's `doc-references.json` and
|
|
25
|
+
documents. Without it, the resolver reads the package it was installed from.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# ABOUTME: Refuses pushes to the remote's default branch, or all pushes when it is unknown.
|
|
3
|
+
|
|
4
|
+
set -u
|
|
5
|
+
|
|
6
|
+
remote=$1
|
|
7
|
+
refuse_unknown() {
|
|
8
|
+
printf 'refused: the default branch for remote %s is unknown; run git remote set-head <remote> -a.\n' "$remote" >&2
|
|
9
|
+
exit 1
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
default_ref=$(git symbolic-ref -q "refs/remotes/$remote/HEAD") || refuse_unknown
|
|
13
|
+
prefix="refs/remotes/$remote/"
|
|
14
|
+
case $default_ref in
|
|
15
|
+
"$prefix"*) default_branch=${default_ref#"$prefix"} ;;
|
|
16
|
+
*) refuse_unknown ;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
while read -r local_ref local_sha remote_ref remote_sha; do
|
|
20
|
+
if [ "$remote_ref" = "refs/heads/$default_branch" ]; then
|
|
21
|
+
printf 'refused: a push to the default branch %s is not allowed.\n' "$default_branch" >&2
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
done
|