create-agent-rig 0.4.0 โ†’ 0.5.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 (105) hide show
  1. package/CHANGELOG.md +207 -8
  2. package/README.md +50 -17
  3. package/package.json +2 -1
  4. package/packages/cli/dist/commands/create.js +8 -3
  5. package/packages/cli/dist/commands/init.js +82 -34
  6. package/packages/cli/dist/commands/upgrade.js +112 -30
  7. package/packages/cli/dist/index.js +38 -14
  8. package/packages/cli/dist/lib/copy-tree.js +35 -6
  9. package/packages/cli/dist/lib/init-settings.js +12 -0
  10. package/packages/cli/dist/lib/install-set.js +6 -8
  11. package/packages/cli/dist/lib/manifest.js +21 -9
  12. package/packages/cli/dist/lib/safe-path.js +30 -0
  13. package/templates/agent-os/init/AGENTS.md +191 -0
  14. package/templates/agent-os/init/CLAUDE.md +61 -9
  15. package/templates/agent-os/stack/aws-cdk/.agents/skills/post-deploy-verify/SKILL.md +98 -0
  16. package/templates/agent-os/stack/aws-cdk/.agents/skills/ro-debug/SKILL.md +117 -0
  17. package/templates/agent-os/stack/aws-cdk/.claude/agents/cdk-diff-reviewer.md +34 -3
  18. package/templates/agent-os/stack/aws-cdk/.claude/rules/aws-cdk.md +1 -1
  19. package/templates/agent-os/stack/aws-cdk/.claude/skills/post-deploy-verify/SKILL.md +34 -0
  20. package/templates/agent-os/stack/aws-cdk/.codex/agents/cdk-diff-reviewer.toml +4 -0
  21. package/templates/agent-os/universal/.agents/skills/check-premises/SKILL.md +233 -0
  22. package/templates/agent-os/universal/.agents/skills/loop/SKILL.md +676 -0
  23. package/templates/agent-os/universal/.agents/skills/new-invariant/SKILL.md +102 -0
  24. package/templates/agent-os/universal/.agents/skills/new-invariant/guard-invariant.example.mjs +78 -0
  25. package/templates/agent-os/universal/.agents/skills/new-invariant/guard-invariant.example.test.mjs +89 -0
  26. package/templates/agent-os/universal/.agents/skills/pr-ship/SKILL.md +338 -0
  27. package/templates/agent-os/universal/.agents/skills/worktree-task/SKILL.md +73 -0
  28. package/templates/agent-os/universal/.claude/agents/code-reviewer.md +33 -1
  29. package/templates/agent-os/universal/.claude/agents/prose-reviewer.md +64 -1
  30. package/templates/agent-os/universal/.claude/agents/security-scanner.md +33 -0
  31. package/templates/agent-os/universal/.claude/hooks/gate-stop-dod.mjs +274 -24
  32. package/templates/agent-os/universal/.claude/hooks/guard-bash.mjs +43 -5
  33. package/templates/agent-os/universal/.claude/hooks/guard-core-purity.mjs +25 -11
  34. package/templates/agent-os/universal/.claude/hooks/guard-secret-file.mjs +180 -0
  35. package/templates/agent-os/universal/.claude/hooks/guard-web-boundary.mjs +32 -13
  36. package/templates/agent-os/universal/.claude/hooks/inject-rules.mjs +175 -7
  37. package/templates/agent-os/universal/.claude/hooks/lib/edit-input.mjs +480 -0
  38. package/templates/agent-os/universal/.claude/rules/autonomy.md +61 -1
  39. package/templates/agent-os/universal/.claude/rules/invariants.md +71 -16
  40. package/templates/agent-os/universal/.claude/rules/workflow.md +55 -5
  41. package/templates/agent-os/universal/.claude/scripts/decision-router.mjs +1242 -0
  42. package/templates/agent-os/universal/.claude/scripts/detect-missed-gate.mjs +65 -2
  43. package/templates/agent-os/universal/.claude/scripts/git-env.mjs +49 -0
  44. package/templates/agent-os/universal/.claude/scripts/lib/secrets.mjs +490 -0
  45. package/templates/agent-os/universal/.claude/scripts/lib/verdict.mjs +433 -0
  46. package/templates/agent-os/universal/.claude/scripts/preflight.mjs +6 -16
  47. package/templates/agent-os/universal/.claude/scripts/queue/checkout.mjs +89 -0
  48. package/templates/agent-os/universal/.claude/scripts/queue/core.mjs +334 -23
  49. package/templates/agent-os/universal/.claude/scripts/queue/gate-rounds.mjs +160 -0
  50. package/templates/agent-os/universal/.claude/scripts/queue/github-issues.mjs +7 -2
  51. package/templates/agent-os/universal/.claude/scripts/queue/index.mjs +413 -8
  52. package/templates/agent-os/universal/.claude/scripts/queue/jira.mjs +75 -13
  53. package/templates/agent-os/universal/.claude/scripts/queue/plan-md.mjs +222 -21
  54. package/templates/agent-os/universal/.claude/scripts/queue/state.mjs +197 -0
  55. package/templates/agent-os/universal/.claude/scripts/run-journal.mjs +435 -0
  56. package/templates/agent-os/universal/.claude/scripts/run-state.mjs +441 -0
  57. package/templates/agent-os/universal/.claude/scripts/verdict.mjs +101 -0
  58. package/templates/agent-os/universal/.claude/settings.json +7 -2
  59. package/templates/agent-os/universal/.claude/skills/check-premises/SKILL.md +115 -7
  60. package/templates/agent-os/universal/.claude/skills/loop/SKILL.md +378 -31
  61. package/templates/agent-os/universal/.claude/skills/pr-ship/SKILL.md +300 -25
  62. package/templates/agent-os/universal/.codex/agents/code-reviewer.toml +4 -0
  63. package/templates/agent-os/universal/.codex/agents/prose-reviewer.toml +4 -0
  64. package/templates/agent-os/universal/.codex/agents/security-scanner.toml +4 -0
  65. package/templates/agent-os/universal/.codex/agents/test-writer.toml +4 -0
  66. package/templates/agent-os/universal/.codex/hooks.json +65 -0
  67. package/templates/agent-os/universal/AGENTS.md +164 -0
  68. package/templates/agent-os/universal/CLAUDE.md +47 -14
  69. package/templates/agent-os/universal/PLAN.md +7 -40
  70. package/templates/agent-os/universal/docs/decisions/closing-a-task.md +98 -0
  71. package/templates/agent-os/universal/docs/decisions/codex-adapter.md +108 -0
  72. package/templates/agent-os/universal/docs/decisions/fail-open-guards.md +43 -0
  73. package/templates/agent-os/universal/docs/decisions/review-lanes.md +72 -0
  74. package/templates/agent-os/universal/docs/decisions/run-directory.md +44 -0
  75. package/templates/agent-os/universal/docs/decisions/spacing-rations-mechanisms.md +125 -0
  76. package/templates/agent-os/universal/docs/decisions/stop-conditions-in-a-file.md +46 -0
  77. package/templates/agent-os/universal/docs/decisions/two-empty-endings.md +62 -0
  78. package/templates/agent-os/universal/journal/README.md +101 -0
  79. package/templates/agent-os/universal/layers.json +36 -2
  80. package/templates/hash-history.json +2 -1
  81. package/templates/skeleton/aws-serverless/.github/workflows/deploy.yml +34 -1
  82. package/templates/skeleton/aws-serverless/README.md +91 -9
  83. package/templates/skeleton/aws-serverless/apps/web/src/lib/api.ts +9 -2
  84. package/templates/skeleton/aws-serverless/gitignore +37 -0
  85. package/templates/skeleton/aws-serverless/infra/bin/app.ts +73 -13
  86. package/templates/skeleton/aws-serverless/infra/lib/app-stack.ts +136 -4
  87. package/templates/skeleton/aws-serverless/infra/lib/web-stack.ts +14 -1
  88. package/templates/skeleton/aws-serverless/infra/test/allowed-origins.test.ts +301 -0
  89. package/templates/skeleton/aws-serverless/infra/test/app-composition.test.ts +137 -0
  90. package/templates/skeleton/aws-serverless/infra/test/app-stack.test.ts +36 -20
  91. package/templates/skeleton/aws-serverless/infra/test/web-stack.test.ts +15 -12
  92. package/templates/skeleton/aws-serverless/services/api/src/handlers/create-note.ts +33 -6
  93. package/templates/skeleton/aws-serverless/services/api/src/handlers/list-notes.ts +18 -5
  94. package/templates/skeleton/aws-serverless/services/api/src/usecases/create-note.ts +11 -0
  95. package/templates/skeleton/aws-serverless/services/api/test/create-note.handler.test.ts +120 -1
  96. package/templates/skeleton/aws-serverless/services/api/test/list-notes.test.ts +72 -1
  97. package/templates/skeleton/node-service/README.md +11 -1
  98. package/templates/skeleton/node-service/gitignore +34 -0
  99. package/templates/skeleton/node-service/packages/db/src/note-store.ts +47 -10
  100. package/templates/skeleton/node-service/packages/db/test/note-store.test.ts +20 -0
  101. package/templates/skeleton/node-service/services/api/src/main.ts +2 -9
  102. package/templates/skeleton/node-service/services/api/src/server.ts +93 -10
  103. package/templates/skeleton/node-service/services/api/src/static-dir.ts +20 -0
  104. package/templates/skeleton/node-service/services/api/test/server.test.ts +98 -13
  105. package/templates/skeleton/node-service/services/api/test/static-dir.test.ts +28 -0
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: check-premises
3
- description: Check a queue item's claims about the code before building on them. Use immediately after taking an item and before the failing test โ€” whenever the item asserts that something exists, is missing, is broken, or works a particular way.
3
+ description: Check claims about the code before building on them, or before shipping them. Use after taking a queue item and before the failing test โ€” whenever the item asserts something exists, is missing, is broken, or works a particular way. Use again before the gate, on the run's own prose, where a behaviour claim nothing backs is UNMEASURED.
4
4
  context: fork
5
5
  allowed-tools: Read, Grep, Glob, Bash
6
- argument-hint: <the queue item's text>
6
+ argument-hint: <the queue item's text, or the diff and prose to check>
7
7
  ---
8
8
 
9
9
  A queue item is a **claim about the code**, written by someone who was not
@@ -11,8 +11,33 @@ reading the code at the time. "The retry path swallows the error", "there is no
11
11
  validation on that field", "the worker never gets the second message" โ€” each of
12
12
  those is a premise, and the work that follows is only worth doing if it is true.
13
13
 
14
- This skill checks the premises. It runs **after selection, before the Red step**,
15
- and it produces one of three verdicts. It writes nothing.
14
+ This skill checks the premises. It writes nothing, and it has **two entry points**.
15
+
16
+ | entry point | the claims are | the code is | verdicts |
17
+ | --- | --- | --- | --- |
18
+ | after selection, **before the Red step** | the queue item's, about code it did not read | the repository | `PREMISES HOLD` / `PREMISE FALSE` / `UNVERIFIABLE` |
19
+ | after the work, **before the gate** | your own, in the rulebook prose the diff touches โ€” and in the PR description if one exists yet | your diff | `PREMISES HOLD` / `UNVERIFIABLE` / `UNMEASURED` |
20
+
21
+ ๐Ÿ”ด **Why the second one exists.** A claim you wrote about a mechanism you did not run
22
+ is cheap to write and expensive to find: `prose-reviewer` reaches it only after loading
23
+ the whole diff, and the fix is an edit to one sentence. Same machinery, same question โ€” *is this claim true?* โ€” pointed
24
+ at the text the run wrote instead of the text it was handed.
25
+
26
+ The rest of this skill is written for the first entry point. The second one runs the
27
+ same four steps with the diff as the code, and ยง4 carries what is different.
28
+
29
+ **What "rulebook prose" means here is not a new list** โ€” it is the set
30
+ `.claude/rules/workflow.md` already uses for the `prose-reviewer` trigger: a rule
31
+ file, a skill, an agent spec, a decision record, `CLAUDE.md`, the README. Where a
32
+ rulebook file exists twice (a template source and a generated copy), check the
33
+ **source**; the copy is composed from it. A comment in a test or a hook is in scope
34
+ too when it asserts behaviour โ€” the file it lives in does not change what a claim is.
35
+
36
+ ๐Ÿ”ด **`PREMISE FALSE` belongs to the first entry point only.** At the second one the
37
+ claims are your own and the remedy is an edit, so a false one is not an escalation:
38
+ it is `UNMEASURED`'s neighbour โ€” delete or correct the sentence and carry on. Reading
39
+ it as the escalation `loop` ยง6 defines would send a finished branch back to the queue
40
+ over one sentence.
16
41
 
17
42
  ## Why it sits here and not in review
18
43
 
@@ -62,6 +87,10 @@ Read the code. Not the tests, not the docs, not another queue item โ€” those are
62
87
  claims too. Each verified premise gets a `file:line` citation; a premise you
63
88
  believe but cannot cite is not verified, it is remembered.
64
89
 
90
+ At the **second** entry point this inverts for one case: a test is exactly what backs
91
+ a behaviour claim, so reading it is the point. The rule above is about not letting a
92
+ test's *name* stand in for what the code does; ยง4 says which artifacts count.
93
+
65
94
  ## 4. The verdict
66
95
 
67
96
  | Verdict | When | What happens next |
@@ -69,6 +98,50 @@ believe but cannot cite is not verified, it is remembered.
69
98
  | `PREMISES HOLD` | every load-bearing claim checked out, or there were none | proceed to the Red step |
70
99
  | `PREMISE FALSE` | a load-bearing claim is contradicted by the code | **stop and report** |
71
100
  | `UNVERIFIABLE` | a load-bearing claim could not be decided from the code | report it as unverifiable, name what would decide it, and proceed only under a **labelled assumption** |
101
+ | `UNMEASURED` | **second entry point only:** a sentence you wrote asserts behaviour, and nothing you can point at backs it | **delete the sentence, or turn it into a pointer to the test that proves it** โ€” before the gate |
102
+
103
+ ๐Ÿ”ด **The edit belongs to the calling session, not to this skill.** It reports; the
104
+ caller performs the exit before the gate. (The rule is the one at the top of this
105
+ file โ€” it writes nothing โ€” not a property of its tool grant.)
106
+
107
+ ๐Ÿ”ด **`UNMEASURED` has exactly two exits, and "reword it" is not one of them.** A
108
+ behaviour claim is either backed or it is not; softening the wording keeps an
109
+ unbacked claim in a document agents follow literally. So either the sentence goes,
110
+ or it becomes `see guard-invariant.example.test.mjs โ€บ "blocks the violation, and the
111
+ reason names what to do instead"` โ€” the test's whole name, in a file this project
112
+ carries, so one grep lands on it. `invariants.md` ("State the limits") states the norm this verdict
113
+ enforces.
114
+
115
+ **Two questions, and they have different answers โ€” conflating them is how an unbacked
116
+ sentence survives this check.**
117
+
118
+ *Is the claim founded?* A test you can name, a command whose output is in front of
119
+ you, or a citation to code that does the thing. What does not count: the queue item
120
+ said so (the item is a claim too โ€” that is what the first entry point is for), it was
121
+ true of the previous design, or it is obviously right.
122
+
123
+ *May it stay in the file as written?* Only the two forms `invariants.md` requires โ€”
124
+ **generated** from what it describes, or a **pointer** to the test. A command's output
125
+ is not one of them: you saw it, the reader cannot, so a sentence resting on it is still
126
+ `UNMEASURED` however sure you are. Point at the test that runs that command, or say
127
+ something the reader can check.
128
+
129
+ โš  **A measurement of this project's own history fits none of the three**, and that is
130
+ a real gap rather than an oversight: the run that produced it is not in the repository,
131
+ and a journal entry does not travel with a rulebook that ships. So a figure about past
132
+ runs belongs in the journal and **not** in a file other projects receive โ€” where it
133
+ would arrive with no backing at all.
134
+
135
+ A sentence is qualitative when it names **no quantity a reader could check** โ€” not a
136
+ count, not a share, not a duration. "This has happened here before" qualifies; "this
137
+ happened twice last month" does not, and moves to the journal.
138
+
139
+ That is not a third exit from `UNMEASURED`. The two exits apply to **the sentence in
140
+ front of you**: it goes, or it becomes a pointer. Writing a different sentence โ€” one
141
+ that claims no measurement, and so needs none โ€” is the first exit followed by an
142
+ unrelated edit, not a softened version of the same claim. `invariants.md` has a
143
+ worked instance: "Both have happened here, in the same file, within one review
144
+ cycle." No figure, no measurement claimed, and it ships.
72
145
 
73
146
  ๐Ÿ”ด **On `PREMISE FALSE` the answer is stop and report โ€” never quietly work around
74
147
  the false premise by building something adjacent that seems useful.** Write what
@@ -81,6 +154,40 @@ branch named after a task that does not exist.
81
154
  so the assumption travels in the open, in the item and in the PR description,
82
155
  where the next reader can see which part of the work rests on it.
83
156
 
157
+ ### The verdict block
158
+
159
+ Report in prose for the caller, then end with **exactly one** fenced `json` block
160
+ of this shape, and nothing after it. The word is spaced in prose and one token
161
+ inside the block; both forms are the contract.
162
+
163
+ ```json
164
+ {
165
+ "gate": "check-premises",
166
+ "verdict": "PREMISE_FALSE",
167
+ "blockers": [
168
+ {
169
+ "file": "packages/core/src/note.ts",
170
+ "line": 17,
171
+ "rule": "the item claims the schema does not reject an empty title",
172
+ "note": "it does, here โ€” the reported bug is a caller that skips the validator"
173
+ }
174
+ ],
175
+ "advisories": [],
176
+ "evidence": ["read the validator and both call sites"]
177
+ }
178
+ ```
179
+
180
+ - `verdict` is `PREMISES_HOLD`, `PREMISE_FALSE`, `UNVERIFIABLE` or `UNMEASURED`
181
+ โ€” this skill returns no other word, and none of the reviewers' words.
182
+ - One blocker per premise that did not hold, per claim that could not be decided,
183
+ or per unbacked sentence โ€” `rule` is the claim itself, `note` is what the code
184
+ actually says, and `file`/`line` is the citation ยง3 requires.
185
+ - `PREMISES_HOLD` carries an empty `blockers` list; the other three name at
186
+ least one. A stop verdict without one is not an answer the caller can act on,
187
+ and the caller is what checks: the `loop` skill runs
188
+ `node .claude/scripts/verdict.mjs check <report> check-premises` on what you
189
+ return. Nothing in this skill runs it โ€” this skill writes nothing at all.
190
+
84
191
  ## Examples โ€” the three shapes this actually catches
85
192
 
86
193
  **The thing already exists.** Item: "the payload schema does not reject an empty
@@ -110,9 +217,10 @@ is invisible to every gate downstream.
110
217
  about runtime behaviour ("this times out in production"), about intent, or
111
218
  about a system this repository does not contain is `UNVERIFIABLE` here, not
112
219
  false โ€” say so rather than guessing.
113
- - **It is one pass, before the work.** A premise that becomes false while the
114
- task runs (a merge lands, a dependency moves) is a staleness stop rule
115
- (`.claude/rules/autonomy.md`), not this skill.
220
+ - **Each entry point is one pass, at its own end of the task.** A premise that goes
221
+ false *between* them โ€” a merge lands, a dependency moves โ€” is a staleness stop rule
222
+ (`.claude/rules/autonomy.md`), not this skill. Neither pass watches the other's
223
+ claims.
116
224
  - **It has no opinion on whether the task is worth doing.** True premises and a
117
225
  pointless task is a perfectly consistent state, and it belongs to whoever fills
118
226
  the queue.