create-agent-rig 0.10.1 → 1.0.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 (39) hide show
  1. package/CHANGELOG.md +116 -4
  2. package/README.md +8 -8
  3. package/package.json +2 -2
  4. package/packages/cli/dist/commands/upgrade.js +22 -9
  5. package/packages/cli/dist/index.js +9 -2
  6. package/templates/agent-os/subagent-routing.json +4 -0
  7. package/templates/agent-os/universal/.agents/skills/diagnose/SKILL.md +43 -0
  8. package/templates/agent-os/universal/.agents/skills/loop/SKILL.md +65 -22
  9. package/templates/agent-os/universal/.agents/skills/plan-slices/SKILL.md +30 -0
  10. package/templates/agent-os/universal/.agents/skills/pr-ship/SKILL.md +1 -1
  11. package/templates/agent-os/universal/.agents/skills/release-propose/SKILL.md +74 -0
  12. package/templates/agent-os/universal/.agents/skills/skill-authoring/SKILL.md +39 -0
  13. package/templates/agent-os/universal/.claude/agents/code-reviewer.md +4 -0
  14. package/templates/agent-os/universal/.claude/agents/failure-diagnostician.md +112 -0
  15. package/templates/agent-os/universal/.claude/hooks/gate-stop-dod.mjs +14 -3
  16. package/templates/agent-os/universal/.claude/hooks/guard-rulebook.mjs +21 -6
  17. package/templates/agent-os/universal/.claude/hooks/lib/edit-input.mjs +13 -3
  18. package/templates/agent-os/universal/.claude/rules/invariants.md +33 -0
  19. package/templates/agent-os/universal/.claude/scripts/lib/verdict.mjs +63 -0
  20. package/templates/agent-os/universal/.claude/scripts/queue/core.mjs +5 -6
  21. package/templates/agent-os/universal/.claude/scripts/queue/github-issues.mjs +71 -14
  22. package/templates/agent-os/universal/.claude/scripts/queue/propose.mjs +139 -0
  23. package/templates/agent-os/universal/.claude/scripts/release-evidence.mjs +188 -0
  24. package/templates/agent-os/universal/.claude/scripts/revalidation-report.mjs +4 -2
  25. package/templates/agent-os/universal/.claude/scripts/unattended-flag.mjs +8 -0
  26. package/templates/agent-os/universal/.claude/skills/diagnose/SKILL.md +43 -0
  27. package/templates/agent-os/universal/.claude/skills/loop/SKILL.md +65 -22
  28. package/templates/agent-os/universal/.claude/skills/plan-slices/SKILL.md +30 -0
  29. package/templates/agent-os/universal/.claude/skills/pr-ship/SKILL.md +1 -1
  30. package/templates/agent-os/universal/.claude/skills/release-propose/SKILL.md +74 -0
  31. package/templates/agent-os/universal/.claude/skills/skill-authoring/SKILL.md +39 -0
  32. package/templates/agent-os/universal/.codex/agents/code-reviewer.toml +1 -1
  33. package/templates/agent-os/universal/.codex/agents/failure-diagnostician.toml +6 -0
  34. package/templates/agent-os/universal/AGENTS.md +6 -4
  35. package/templates/agent-os/universal/docs/decisions/subagent-routing.md +5 -3
  36. package/templates/agent-os/universal/docs/decisions/workflow-layer-split.md +15 -3
  37. package/templates/agent-os/universal/layers.json +12 -0
  38. package/templates/hash-history.json +10 -5
  39. package/templates/release-ledger.json +2 -1
package/CHANGELOG.md CHANGED
@@ -14,12 +14,124 @@ second recorded departure; its own entry states the direction and the reason,
14
14
  and this paragraph deliberately does not restate them — a numbering rule with
15
15
  two copies of its exceptions is the shape 0.8.0 exists to remove.
16
16
 
17
+ ## 1.0.0
18
+
19
+ **The harness-configuration contract is frozen.** Nothing here changes what a
20
+ `create` or `init` installs in a way a 0.10.x rig would notice; what changes is
21
+ that the surface those commands present — their flags, their JSON shapes, their
22
+ exit codes, their verdict and outcome vocabularies, the manifest they write —
23
+ is now a contract with a stated deprecation policy, and a test suite that goes
24
+ red when the document and the code disagree. The major number says that, and
25
+ only that: from here, removing or renaming something in that surface is a major
26
+ bump, and adding to it is a minor.
27
+
28
+ The rest of this entry is what the rigs themselves gain, down to the last
29
+ section — which is the changes that stayed in the generator, named there so a
30
+ reader does not go looking for them in a rig.
31
+
32
+ ### The contract
33
+
34
+ What a rig gains here is the promise, not a file: the document and its tests
35
+ live in the generator, and the section at the end of this entry says so.
36
+
37
+ - **The 1.0 public surface is stated, and so is how it may change** — what is
38
+ promised, what is explicitly not, and what a deprecation costs (RP-184).
39
+ - **Seven correspondences keep it honest**, each red when either side drifts:
40
+ the `upgrade` verdict union, the closed set of seven `doctor` check ids, the
41
+ `setup` outcome values, the manifest keys a fresh `init` writes, the
42
+ integrations declaration schema against a real `setup add`, the packed tarball
43
+ carrying no third-party provider payload, and the CI Node matrix against
44
+ `engines.node` (RP-184).
45
+
46
+ ### Added
47
+
48
+ - **`failure-diagnostician`** — a read-only agent that reproduces a red check or
49
+ a claimed defect on the current default branch and answers with one of six
50
+ checked verdicts, so "is this still live?" is measured before work is planned
51
+ on it (RP-195).
52
+ - **`diagnose`** — the Core skill that dispatches it, for a failure whose cause
53
+ is not obvious (RP-195).
54
+ - **`skill-authoring`** — the Core skill for writing a new skill, with
55
+ structural checks over the ones a rig ships (RP-195).
56
+ - **`plan-slices`** — the workflow-layer skill that cuts a large item into
57
+ slices that can each be shipped on their own (RP-195).
58
+ - **`release-propose`**, and the `release-evidence.mjs` it reads through — the
59
+ workflow-layer skill that proposes a release only from repeated,
60
+ pointer-backed evidence, never from one bad run (RP-203).
61
+ - **`queue/propose.mjs`** — one root-safe entry point for filing a triage
62
+ proposal, so a session standing in a subdirectory files into the project's
63
+ real queue rather than a cwd-relative one that does not exist (RP-209).
64
+
65
+ ### Changed
66
+
67
+ - **The gate-round cap defaults to three**, not two — one round to find, one to
68
+ fix, one to confirm (RP-210).
69
+ - **The verdict vocabulary carries the diagnosis words** and an optional
70
+ `classification`, so a diagnostician's answer is checked the same way every
71
+ other gate's is (RP-195).
72
+ - **An escalation names the diagnostician's verdict.** The `loop` skill no
73
+ longer escalates a failure as a bare stop; it carries the checked verdict that
74
+ says whether the failure is live (RP-195).
75
+
76
+ ### Fixed
77
+
78
+ - **The Definition-of-Done gate no longer leaks the run directory into its own
79
+ checks.** `gate-stop-dod` passed `RIG_RUN_DIR` down to every configured
80
+ command, so a project whose tests spawn the queue CLI wrote fixture records
81
+ into the live run's trace (RP-207).
82
+ - **A closed issue can no longer push open work out of the GitHub queue.** The
83
+ adapter asks for open and closed items in separate windows and says so on
84
+ stderr when a window is capped (RP-208).
85
+ - **`upgrade --dry-run` exits 1 where the real run refuses** a symlinked
86
+ manifest, instead of 0 (RP-206).
87
+ - **`guard-rulebook` no longer loses the path an `apply_patch` actually wrote
88
+ to.** When a guarded prefix such as `.claude/hooks` is a junction or symlink
89
+ to a directory inside the same checkout, the resolved spelling no longer
90
+ starts with a protected prefix, and an unattended `apply_patch` through it was
91
+ allowed. Both spellings are now compared. The four Claude edit surfaces were
92
+ never affected, and a junction pointing outside the checkout already failed
93
+ closed (RP-60).
94
+
95
+ ### Rulebook
96
+
97
+ - **The revalidation detection contract is governance input.**
98
+ `.rig/revalidation.json` decides whether preflight stops and what the scope
99
+ fingerprint watches, and an unattended run could rewrite it. It joins the
100
+ protected rulebook set — as the exact file, because `.rig/claims/` must stay
101
+ writable for a SELECT to record its own baseline. The matching elevated-path
102
+ declaration landed in this repository's own rulebook, not in the payload's
103
+ seed (RP-61).
104
+ - **The independent-oracle invariant.** A test of a security, ownership or
105
+ governance mechanism must not derive its expected result from the same
106
+ production mechanism it checks; `code-reviewer` enforces it as a checklist
107
+ item, and the rule says plainly that no hook can (RP-187).
108
+
109
+ ### Generator repository (not a rig-facing change)
110
+
111
+ - `layers.json` is a declared elevated path of this repository. It is the
112
+ manifest `init` installs _from_ — it names the paths of each layer and never
113
+ names itself — so no rig receives it (RP-211).
114
+ - The Memory conformance probe, `scripts/memory-conformance.mjs`, reports a
115
+ buffer overflow as what it is — a killed child — rather than as a child that
116
+ could not start. The script is not packed (RP-206).
117
+ - The 1.0 contract document, `docs/command-contract.md`, and the seven
118
+ correspondence tests that pin it live in this repository; what a rig gains is
119
+ the promise they hold the commands to, not the files (RP-184).
120
+
17
121
  ## 0.10.1
18
122
 
19
- **A fixes-only patch on 0.10.0.** Every entry corrects existing behaviour or
20
- states a rule the rulebook already follows; nothing is added to what `create`,
21
- `init` or `upgrade` install beyond the corrected files, and no agent, skill,
22
- hook or routing row is new.
123
+ **A fixes-only patch on 0.10.0, plus one narrowing.** Every other entry
124
+ corrects existing behaviour or states a rule the rulebook already follows;
125
+ nothing is added to what `create`, `init` or `upgrade` install beyond the
126
+ corrected files and the Node floor below, and no agent, skill, hook or routing
127
+ row is new.
128
+
129
+ ### Changed
130
+
131
+ - **The Node floor is raised from `>=20` to `>=22`** (`package.json`'s
132
+ `engines.node`), matching the only runtime every CI lane still tests — Node
133
+ 20 has been end-of-life since April 2026. The CLI still runs unchanged on
134
+ any Node 22 or newer (RP-184).
23
135
 
24
136
  ### Fixed
25
137
 
package/README.md CHANGED
@@ -100,13 +100,13 @@ MCP wiring goes into Claude Code's `.mcp.json` entry by entry, but into Codex's
100
100
 
101
101
  ## What Rig installs
102
102
 
103
- | Area | What you get |
104
- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
105
- | Rules | `AGENTS.md`, `CLAUDE.md` and `.claude/rules/`: autonomy tiers (what an agent may do alone), stop rules, TDD workflow and a Definition of Done |
106
- | Guards | Hooks that refuse bypassing pre-commit, force-pushing a shared branch, destructive `rm`, writing credentials, and ending a session while a configured check is red |
107
- | Agents | `test-writer` and `implementation-agent` for the TDD steps; `code-reviewer`, `security-scanner` and `prose-reviewer` for review — each pinned to a model and effort |
108
- | Skills | `worktree-task`, `new-invariant` and `check-premises` |
109
- | Lifecycle metadata | `.claude/.rig-manifest.json`: which bytes Rig installed |
103
+ | Area | What you get |
104
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
105
+ | Rules | `AGENTS.md`, `CLAUDE.md` and `.claude/rules/`: autonomy tiers (what an agent may do alone), stop rules, TDD workflow and a Definition of Done |
106
+ | Guards | Hooks that refuse bypassing pre-commit, force-pushing a shared branch, destructive `rm`, writing credentials, and ending a session while a configured check is red |
107
+ | Agents | `test-writer` and `implementation-agent` for the TDD steps; `code-reviewer`, `security-scanner` and `prose-reviewer` for review; `failure-diagnostician` to reproduce a failure or a claimed finding — each pinned to a model and effort |
108
+ | Skills | `worktree-task`, `new-invariant`, `check-premises`, `skill-authoring` and `diagnose` |
109
+ | Lifecycle metadata | `.claude/.rig-manifest.json`: which bytes Rig installed |
110
110
 
111
111
  A guard is a check on each edit or command before it runs, not a sandbox. Each
112
112
  one states what it does not catch in its own header — `guard-secret-file`, for
@@ -279,7 +279,7 @@ attempted pre-commit bypass.
279
279
 
280
280
  ## Requirements
281
281
 
282
- - Node ≥ 20. The CLI has no runtime dependencies.
282
+ - Node ≥ 22. The CLI has no runtime dependencies.
283
283
  - Git.
284
284
  - For Spec Kit only: `uv` and `uvx`.
285
285
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-agent-rig",
3
- "version": "0.10.1",
3
+ "version": "1.0.0",
4
4
  "description": "Configure an agent operating system (rules, gates, hooks) for Claude Code and Codex in a new or existing repository — no application scaffolding",
5
5
  "keywords": [
6
6
  "agent",
@@ -29,7 +29,7 @@
29
29
  "CHANGELOG.md"
30
30
  ],
31
31
  "engines": {
32
- "node": ">=20"
32
+ "node": ">=22"
33
33
  },
34
34
  "packageManager": "pnpm@11.16.0",
35
35
  "scripts": {
@@ -719,6 +719,27 @@ export async function planUpgrade(repoDir, options = {}) {
719
719
  },
720
720
  };
721
721
  }
722
+ /**
723
+ * The complete write set `applyUpgrade` will touch — every `update`/`new`
724
+ * action plus the manifest itself — each resolved with {@link writableOnDisk}
725
+ * so a symlinked (or otherwise unsafe) destination is refused before any
726
+ * write happens. Exported so `--dry-run` (in `index.ts`) can run the exact
727
+ * same check and refuse with the exact same message wherever the real run
728
+ * would: one implementation, read by both call sites, rather than a second
729
+ * copy that could drift from it.
730
+ */
731
+ export async function preflightWritable(repoDir, plan) {
732
+ const destinations = new Map();
733
+ for (const rel of [
734
+ ...plan.actions
735
+ .filter(({ verdict }) => verdict === 'update' || verdict === 'new')
736
+ .map(({ rel }) => rel),
737
+ MANIFEST_REL,
738
+ ]) {
739
+ destinations.set(rel, await writableOnDisk(repoDir, rel));
740
+ }
741
+ return destinations;
742
+ }
722
743
  /**
723
744
  * Write the plan: the `update` and `new` files, then the manifest. Everything
724
745
  * else in the plan is a sentence for a human, not an edit.
@@ -742,15 +763,7 @@ export async function applyUpgrade(repoDir, plan, options = {}) {
742
763
  // any file. Then re-check each destination after mkdir and immediately before
743
764
  // writeFile, so both pre-existing and newly-visible symlink components are
744
765
  // refused.
745
- const destinations = new Map();
746
- for (const rel of [
747
- ...plan.actions
748
- .filter(({ verdict }) => verdict === 'update' || verdict === 'new')
749
- .map(({ rel }) => rel),
750
- MANIFEST_REL,
751
- ]) {
752
- destinations.set(rel, await writableOnDisk(repoDir, rel));
753
- }
766
+ const destinations = await preflightWritable(repoDir, plan);
754
767
  for (const action of plan.actions) {
755
768
  if (action.verdict !== 'update' && action.verdict !== 'new')
756
769
  continue;
@@ -7,7 +7,7 @@ import { InitError, initFileContents, initProject, planInit } from './commands/i
7
7
  import { INTEGRATIONS_VERBS, runIntegrationsCommand } from './commands/integrations.js';
8
8
  import { runSetupWizard } from './commands/setup-wizard.js';
9
9
  import { execFileRunner, setupSubsystems } from './commands/setup.js';
10
- import { AGENTS_MD_RESCUE, UpgradeError, applyUpgrade, planUpgrade } from './commands/upgrade.js';
10
+ import { AGENTS_MD_RESCUE, UpgradeError, applyUpgrade, planUpgrade, preflightWritable, } from './commands/upgrade.js';
11
11
  import { CHANGED_SINCE_PLANNING_REASON, UninstallError, applyUninstall, isUnverifiedReason, planUninstall, protectedFileReason, } from './commands/uninstall.js';
12
12
  import { makePalette } from './lib/colors.js';
13
13
  import { readManifest, sha256 } from './lib/manifest.js';
@@ -500,7 +500,14 @@ async function runUpgrade(rawArgs) {
500
500
  if (notice !== null)
501
501
  process.stdout.write(notice);
502
502
  // The same exit the real run gives: `applyUpgrade` refuses this status.
503
- return plan.agentsRescue.holdBack && plan.agentsRescue.status === 'unsafe' ? 1 : 0;
503
+ if (plan.agentsRescue.holdBack && plan.agentsRescue.status === 'unsafe')
504
+ return 1;
505
+ // Same preflight `applyUpgrade` runs before writing anything (a symlinked
506
+ // manifest or destination, RP-206): thrown here, an `UpgradeError`
507
+ // propagates to `main()`'s own catch below exactly as it does for the
508
+ // real run, so both modes report the identical message and exit 1.
509
+ await preflightWritable(cwd, plan);
510
+ return 0;
504
511
  }
505
512
  // The plan above is the review step, so it has to be answered before
506
513
  // anything is written. On a terminal that is a question; off one it is a
@@ -27,6 +27,10 @@
27
27
  "security-scanner": {
28
28
  "claude": { "model": "claude-opus-5", "effort": "high" },
29
29
  "codex": { "model": "gpt-5.6-sol", "effort": "high" }
30
+ },
31
+ "failure-diagnostician": {
32
+ "claude": { "model": "claude-opus-5", "effort": "high" },
33
+ "codex": { "model": "gpt-5.6-sol", "effort": "high" }
30
34
  }
31
35
  }
32
36
  }
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: diagnose
3
+ description: Use when a check is red or a run crashed and the cause is not obvious, or when a claimed defect or historical finding needs confirming before work is planned on it.
4
+ allowed-tools: Read, Grep, Glob, Bash, Task
5
+ ---
6
+
7
+ # Diagnose before you fix
8
+
9
+ Stop guessing. A red check or a crashed run is never a thing to retry until
10
+ it goes green — that stop rule is already stated in
11
+ `.claude/rules/autonomy.md` ("Flaky ≠ retry"); this skill does not restate
12
+ it.
13
+
14
+ ## Hand it to `failure-diagnostician`
15
+
16
+ Give the agent what it needs to reproduce, verbatim:
17
+
18
+ - for a failure — the exact failure output, the command that produced it,
19
+ and the commit or branch where it failed;
20
+ - for a claim — the claim's own text, and where it came from (a queue item,
21
+ a review comment, a prior finding).
22
+
23
+ Dispatch `failure-diagnostician`. Its method is its own —
24
+ `.claude/agents/failure-diagnostician.md` — not repeated here.
25
+
26
+ ## Check the answer, then act on the word
27
+
28
+ Save its report to a file and run exactly:
29
+
30
+ ```sh
31
+ node .claude/scripts/verdict.mjs check <report> failure-diagnostician
32
+ ```
33
+
34
+ Exit 1 means it did not answer — that is no diagnosis, not a word to act on.
35
+
36
+ | Verdict | Action |
37
+ | --- | --- |
38
+ | `ROOT_CAUSE` / `STILL_LIVE` | the failing test first, through `test-writer` — the Red step in `.claude/rules/workflow.md` |
39
+ | `INCONCLUSIVE` / `INSUFFICIENT_EVIDENCE` | stop; escalate in the format `.claude/rules/autonomy.md` ("Escalation format") sets, carrying the verdict's blockers as what would decide the question |
40
+ | `ALREADY_FIXED` / `OBSOLETE` | close the item, citing the verdict's `evidence` |
41
+
42
+ This is a Core skill: it dispatches no opt-in-workflow-layer machinery, and
43
+ routes on the word alone.
@@ -420,7 +420,11 @@ who was not reading the code at the time, and everything downstream — the fail
420
420
  test, the implementation, the reviewer comparing diff to item — inherits its
421
421
  claims rather than checking them. On `PREMISE FALSE` the item is escalated (§6),
422
422
  not repaired in place: a run that silently re-aims its own task has authored work
423
- for itself, which is the one thing this loop does not do (§8).
423
+ for itself, which is the one thing this loop does not do (§8). A claim
424
+ `check-premises` cannot settle by reading — a claimed defect or a historical
425
+ finding that needs reproducing on the current default branch, not just re-reading — goes to
426
+ `failure-diagnostician` in claim mode instead, never to an unnamed built-in
427
+ subagent.
424
428
 
425
429
  🔴 **And again at the other end, before `pr-ship`: `check-premises` on the prose the
426
430
  task itself wrote** — the rulebook prose the diff touches (the skill defines that set,
@@ -703,7 +707,23 @@ Both then follow the same three steps:
703
707
  its clauses: what was *observed* (verbatim errors, not summaries), and the
704
708
  single question whose answer unblocks the work. So: what fails, what was tried, the
705
709
  current hypothesis, and links to the PR and the failing run where they exist
706
- — a premise stop has neither, and its citation stands in for both. **Name the outcome
710
+ — a premise stop has neither, and its citation stands in for both.
711
+ **For a red check or an unexplained failure, the current hypothesis is the
712
+ diagnostician's parsed verdict**: dispatch `failure-diagnostician` with the
713
+ verbatim failure, save its answer to a file under the run directory, and
714
+ check it —
715
+
716
+ ```sh
717
+ node .claude/scripts/verdict.mjs check <report> failure-diagnostician
718
+ ```
719
+
720
+ — then carry the parsed verdict (word, `classification`, blockers,
721
+ evidence) as the hypothesis instead of writing the diagnosis from scratch,
722
+ with the verbatim failure output still in the comment beside it, covering
723
+ the "observed" clause the list above already names. A `PREMISE FALSE` or
724
+ exhausted-cap stop keeps the diagnosis the paragraph above already
725
+ describes (what the item claimed, or the round count).
726
+ **Name the outcome
707
727
  state in the same comment** — `incomplete` if the diagnosis cannot say **where** it
708
728
  stopped (§5: a thin diagnosis that still locates the wall is a `documented-stall`).
709
729
  Writing `incomplete` on your own task is uncomfortable and
@@ -847,29 +867,52 @@ four things, and a proposal missing any of them is not ready to file:
847
867
  3. the change, concretely enough to diff;
848
868
  4. how the next run would prove it worked — the observation that would differ.
849
869
 
850
- Filing is the adapter's `proposeTriage`, which the CLI deliberately does **not**
851
- expose — `index.mjs` never writes to the QUEUE (`next`, `list`, `hygiene` only), so
852
- that no accidental invocation can change what the next run is handed. Its one
853
- write is to the run journal above, and only into a directory the run declared —
854
- a trace of the selection, never a change to it. Call `proposeTriage` directly:
870
+ Filing is the adapter's `proposeTriage`, reached through the one root-safe entry
871
+ point `.claude/scripts/queue/propose.mjs` — never a relative `import()` typed by
872
+ hand, which breaks the moment the session is standing in a subdirectory
873
+ (`ERR_MODULE_NOT_FOUND` from the import, then an `ENOENT` from a cwd-relative
874
+ `PLAN.md` that is not there). The CLI (`index.mjs`) still deliberately does
875
+ **not** expose this — it never writes to the QUEUE (`next`, `list`, `hygiene`
876
+ only), so that no accidental invocation can change what the next run is
877
+ handed. `propose.mjs` resolves its config from its own location, exactly as
878
+ `index.mjs` does, so the proposal lands in the project's real PLAN.md (or
879
+ tracker) and the active board's own options travel with it rather than being
880
+ typed by hand. Write the proposal to a file under the run directory, then run
881
+ the script:
855
882
 
856
883
  ```bash
857
884
  node --input-type=module -e '
858
- const a = await import("./.claude/scripts/queue/plan-md.mjs"); // or github-issues / jira
859
- console.log(await a.proposeTriage({
860
- finding: "<the journal line it came from>",
861
- part: "<skill | agent | hook | rule | AGENTS.md | CLAUDE.md | workflow>",
862
- change: "<concretely enough to diff>",
863
- proof: "<the observation that would differ next run>",
864
- // a pair: what the probe touched, and what is concluded from it. The
865
- // mechanism accepts a proposal without them; this procedure does not.
866
- measured: "<the paths the probe actually exercised>",
867
- inferred: "<the conclusion, citing only surfaces named in measured>",
868
- }, { project: "<KEY>" })); // jira only — the ACTIVE board's key: `queue/index.mjs board --json` → options.project;
869
- // plan-md and github-issues take no second argument
885
+ const fs = await import("node:fs/promises");
886
+ await fs.writeFile(
887
+ `${process.env.RIG_RUN_DIR}/proposal.json`,
888
+ JSON.stringify({
889
+ finding: "<the journal line it came from>",
890
+ part: "<skill | agent | hook | rule | AGENTS.md | CLAUDE.md | workflow>",
891
+ change: "<concretely enough to diff>",
892
+ proof: "<the observation that would differ next run>",
893
+ // a pair: what the probe touched, and what is concluded from it. The
894
+ // mechanism accepts a proposal without them; this procedure does not.
895
+ measured: "<the paths the probe actually exercised>",
896
+ inferred: "<the conclusion, citing only surfaces named in measured>",
897
+ }),
898
+ );
870
899
  '
900
+ # Root-anchored so the same command works whether the session is standing
901
+ # at the repo root or in a subdirectory. Pinned in the generator's
902
+ # test/template/loop-report-file.test.ts (absent in a generated rig) ›
903
+ # "files when the documented command line runs, unmodified, from a project
904
+ # subdirectory".
905
+ node "$(git rev-parse --show-toplevel)/.claude/scripts/queue/propose.mjs" --file "$RIG_RUN_DIR/proposal.json"
871
906
  ```
872
907
 
908
+ The result prints as one JSON line on stdout, and — because `RIG_RUN_DIR` is
909
+ declared — the same result is also recorded as a `proposal` event in the run
910
+ journal, so a failed filing is journalled as a failure instead of silently
911
+ going nowhere. Pinned in the generator's `test/template/queue-propose.test.ts`
912
+ (absent in a generated rig) › "files a proposal with a multiline finding from
913
+ a project subdirectory, into the project-root PLAN.md" and › "journals a
914
+ proposal event with ok: true on a successful filing under RIG_RUN_DIR".
915
+
873
916
  A proposal missing any of the four parts is refused rather than filed half-formed.
874
917
 
875
918
  **A finding can say what it measured and what it inferred, as two paired fields.**
@@ -920,9 +963,9 @@ rather than a step in the procedure: `plan-md` returns it when the plan file has
920
963
  no `## Operator queue` heading, because a proposal then has nowhere to land that
921
964
  the selection query cannot reach. Add the heading — never the Agent queue.
922
965
 
923
- One adapter needs the second argument the snippet above carries: `jira` requires
924
- `options.project` and throws rather than filing without it — loudly, so nothing
925
- is lost, but a call that drops it files nothing.
966
+ `jira` still requires `options.project`, and still throws rather than filing
967
+ without it — loudly, so nothing is lost — and there is no
968
+ second argument left to hand-copy.
926
969
 
927
970
  🔴 **The loop proposes; the owner patches.** Self-applying a change to its own
928
971
  rulebook is how an unattended run drifts irreversibly, and it collides head-on
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: plan-slices
3
+ description: Use when a task cannot be verified as one reviewable PR and splits into slices that are each independently verifiable on their own. Ships only with the opt-in workflow layer.
4
+ allowed-tools: Read, Grep, Glob, Write, Edit
5
+ ---
6
+
7
+ # Splitting a task into slices
8
+
9
+ This applies when a task's change cannot be reviewed and verified as one PR,
10
+ and decomposes into slices that are each independently verifiable — each
11
+ slice stands on its own claim about behaviour, checked by its own test.
12
+
13
+ Do not trigger it mechanically based on file or module count: a change
14
+ that touches many files but makes one verifiable claim stays one PR, and a
15
+ change touching few files but making several independent claims still
16
+ splits.
17
+
18
+ There is no planner role dispatched for this — the session writes the slice
19
+ plan directly. For each slice, record:
20
+
21
+ - the outcome the slice delivers, stated as a claim a test can check;
22
+ - its own failing test, written by `test-writer` in the ordinary Red step;
23
+ - the elevated paths it touches, if any (`AGENTS.md`'s elevated-paths block);
24
+ - where it sits in the slice order, and what it depends on.
25
+
26
+ Each slice then ships as its own PR through the ordinary flow —
27
+ `.claude/rules/workflow.md` has the TDD cycle and the PR flow in full; this
28
+ skill does not restate them.
29
+
30
+ This skill ships only with the opt-in workflow layer.
@@ -39,7 +39,7 @@ blockers.
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
 
42
- The cap is **2 by default**, and no shipped `.claude/queue.json` carries the key
42
+ The cap is **3 by default**, and no shipped `.claude/queue.json` carries the key
43
43
  — the default lives in `core.mjs` as `DEFAULT_MAX_GATE_ROUNDS`. A project that
44
44
  wants a different cap sets `options.maxGateRounds` there, which in a rig whose
45
45
  `queue.json` is composed means changing what composes it, not editing the file.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: release-propose
3
+ description: Use to turn repeated evidence from `release-evidence.mjs` into a bounded candidate-release proposal for the owner to decide. Ships only with the opt-in workflow layer.
4
+ allowed-tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ # Proposing a release from repeated pain
8
+
9
+ ## 1. What this is not
10
+
11
+ The loop's own §7 improvement proposals are per-run fixes, filed and read one
12
+ run at a time. This skill is different: a release-level proposal, built from
13
+ evidence that recurred across more than one run, addressed to the owner —
14
+ never to the queue, and never approved by the skill itself.
15
+
16
+ ## 2. Gather
17
+
18
+ Run exactly:
19
+
20
+ ```sh
21
+ node "$(git rev-parse --show-toplevel)/.claude/scripts/release-evidence.mjs" --since <date> --json
22
+ ```
23
+
24
+ Read its `verdict`, `groups` and `why`. Optionally read
25
+ `revalidation-report.mjs --json` the same way, the triage proposals already
26
+ on file, and the tracker — cite every one of these by pointer (run id, file,
27
+ seq, or ticket id), never from memory.
28
+
29
+ ## 3. Measured vs. inferred
30
+
31
+ A number in the proposal is `measured` only when it came straight out of
32
+ `release-evidence.mjs`'s JSON or a cited line of a run/ticket. Every other
33
+ number or claim is labelled `inferred`, or `UNVERIFIED` when nothing backs it
34
+ at all — never stated as if it were measured.
35
+
36
+ ## 4. Routing
37
+
38
+ - `GATHER_MORE_EVIDENCE` — gather-more-evidence: name what evidence would decide it, file nothing, and stop — never build a candidate release out of anecdotes.
39
+ - `REPEATED_PAIN` — write the proposal (§5) and hand it off (§6).
40
+
41
+ ## 5. Proposal template
42
+
43
+ Write these headings, in order, into `$RIG_RUN_DIR/release-proposal.md`:
44
+
45
+ - **Observed repeated pain** — the repeated groups, each with its pointers
46
+ - **Candidate release** — the bounded scope this pain justifies
47
+ - **Why now**
48
+ - **Why not the alternatives** — including a required "Do nothing" row
49
+ - **Dependencies** — proven only; nothing inferred here
50
+ - **Scope / non-goals**
51
+ - **Complexity** — small, medium or large, plus the maintenance burden it adds
52
+ - **Evidence gaps** — what is still `inferred` or `UNVERIFIED`
53
+ - **Upstream capability check** — could a native plugin, connector, MCP
54
+ server, CLI or provider feature do this instead: sufficient, insufficient
55
+ or rejected, and why
56
+ - **Owner decision** — approve, reject or gather-more-evidence; left blank
57
+ for the owner to fill in, never pre-filled by this skill
58
+
59
+ ## 6. Hand-off
60
+
61
+ - Write the proposal to `$RIG_RUN_DIR/release-proposal.md`.
62
+ - File exactly ONE triage item, pointing at it:
63
+ `node "$(git rev-parse --show-toplevel)/.claude/scripts/queue/propose.mjs" --file <proposal.json>`
64
+ — finding = the repeated-pain groups by pointer; part = `"release"`;
65
+ change = `"candidate release: <one line>"`; proof = what the owner would
66
+ observe if the release lands.
67
+ - A triage item filed this way is unselectable by the queue on its own;
68
+ promotion out of triage into selectable work is the owner's act, never
69
+ this skill's.
70
+ - This skill never files a ticket in the selectable queue, never opens a
71
+ GitHub issue directly, and never edits PLAN.md's Agent queue: the Agent
72
+ queue is not something this skill touches, under any verdict.
73
+
74
+ This skill ships only with the opt-in workflow layer.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: skill-authoring
3
+ description: Use when authoring or editing a skill in this rig — a new SKILL.md under .claude/skills/, or a change to an existing one.
4
+ allowed-tools: Read, Grep, Glob
5
+ ---
6
+
7
+ # Authoring a skill
8
+
9
+ No check in this rig runs on a skill you write here — the rules below are
10
+ applied by the author, and by a reviewer reading this file, never by a
11
+ mechanism. On the skills this rig itself ships, the generator's own
12
+ `test/template/skill-authoring.test.ts` (absent in a generated rig) checks
13
+ only the first rule, that a `description` is present, and that the skills and
14
+ roles a skill names by name exist.
15
+
16
+ - **The frontmatter `name` equals the directory name.** A skill loaded from
17
+ `.claude/skills/foo/` is named `foo`, not something else.
18
+ - **The `description` says when to use the skill**, not just what it does.
19
+ - **Keep it short, and point at existing rules or scripts rather than
20
+ restating them.** A skill that copies a rule's wording is a second copy
21
+ that goes stale the day the rule changes; link to `.claude/rules/` or a
22
+ script instead.
23
+ - **Every sentence describing how a mechanism behaves either points at the
24
+ test that proves it, or is deleted.** `.claude/rules/invariants.md`,
25
+ "State the limits — and test them", is the norm; the form is `see <file>
26
+ (absent in a generated rig) › "<exact test name>"`.
27
+ - **A mention of a workflow-layer skill or script in a Core document is
28
+ qualified "opt-in workflow layer"** — `loop` and `pr-ship` are examples,
29
+ not this skill's own concern.
30
+ - **Both copies ship and must stay identical**: the Claude skill under
31
+ `.claude/skills/` and the Codex repository skill under `.agents/skills/`.
32
+ That mirror is checked in `test/template/codex.test.ts` (absent in a
33
+ generated rig) › "publishes every shared skill through the Codex
34
+ repository skill location" — not repeated here.
35
+
36
+ ## Out of scope
37
+
38
+ This is guidance to apply by reading, not an evaluator: the skill itself has
39
+ no procedure and checks nothing.
@@ -38,6 +38,10 @@ references, and you classify every finding as **blocking** or **advisory**.
38
38
  rulebook already refuses that evidence elsewhere (`.claude/rules/autonomy.md`).
39
39
  "Item not supplied, item 6 not checked" is a useful line in a report; a
40
40
  guess dressed as a verdict is worse than the silence it replaces.
41
+ 7. **Independent oracle** — a test of a security, ownership or governance
42
+ mechanism whose expected result is derived from the same production
43
+ mechanism it checks. See the independent-oracle invariant in
44
+ `.claude/rules/invariants.md`.
41
45
 
42
46
  ## Advisory findings
43
47