create-agent-rig 0.9.1 → 0.10.1

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 (235) hide show
  1. package/CHANGELOG.md +462 -3
  2. package/README.md +267 -305
  3. package/package.json +8 -14
  4. package/packages/cli/dist/commands/create.js +56 -88
  5. package/packages/cli/dist/commands/doctor.js +213 -0
  6. package/packages/cli/dist/commands/init.js +111 -50
  7. package/packages/cli/dist/commands/integrations.js +468 -0
  8. package/packages/cli/dist/commands/setup-wizard.js +61 -0
  9. package/packages/cli/dist/commands/uninstall.js +1223 -0
  10. package/packages/cli/dist/commands/upgrade.js +508 -101
  11. package/packages/cli/dist/index.js +658 -47
  12. package/packages/cli/dist/integrations/declaration.js +158 -0
  13. package/packages/cli/dist/integrations/doctor-guards.js +126 -0
  14. package/packages/cli/dist/integrations/doctor-workflow.js +25 -0
  15. package/packages/cli/dist/integrations/mcp-json.js +107 -0
  16. package/packages/cli/dist/integrations/memory-doctor.js +124 -0
  17. package/packages/cli/dist/integrations/registry.js +22 -0
  18. package/packages/cli/dist/integrations/spawn.js +228 -0
  19. package/packages/cli/dist/integrations/spec-kit.js +280 -0
  20. package/packages/cli/dist/integrations/verify.js +193 -0
  21. package/packages/cli/dist/integrations/windows-job.js +275 -0
  22. package/packages/cli/dist/lib/elevated-paths.js +74 -0
  23. package/packages/cli/dist/lib/install-set.js +1 -44
  24. package/packages/cli/dist/lib/manifest.js +64 -5
  25. package/packages/cli/dist/lib/prompts.js +0 -23
  26. package/packages/cli/dist/lib/safe-path.js +193 -2
  27. package/packages/cli/dist/lib/safe-text.js +78 -0
  28. package/packages/cli/dist/lib/substitute.js +1 -52
  29. package/packages/cli/dist/lib/summary.js +5 -5
  30. package/packages/cli/dist/templates.js +4 -14
  31. package/scripts/prepare.mjs +28 -12
  32. package/templates/agent-os/subagent-routing.json +4 -4
  33. package/templates/agent-os/universal/.agents/skills/check-premises/SKILL.md +45 -12
  34. package/templates/agent-os/universal/.agents/skills/loop/SKILL.md +31 -6
  35. package/templates/agent-os/universal/.agents/skills/new-invariant/SKILL.md +5 -5
  36. package/templates/agent-os/universal/.agents/skills/pr-ship/SKILL.md +1 -1
  37. package/templates/agent-os/universal/.agents/skills/worktree-task/SKILL.md +3 -3
  38. package/templates/agent-os/universal/.claude/agents/code-reviewer.md +8 -6
  39. package/templates/agent-os/universal/.claude/agents/implementation-agent.md +41 -0
  40. package/templates/agent-os/universal/.claude/agents/prose-reviewer.md +8 -4
  41. package/templates/agent-os/universal/.claude/agents/security-scanner.md +4 -2
  42. package/templates/agent-os/universal/.claude/agents/test-writer.md +2 -2
  43. package/templates/agent-os/universal/.claude/hooks/gate-stop-dod.mjs +4 -2
  44. package/templates/agent-os/universal/.claude/hooks/inject-rules.mjs +83 -4
  45. package/templates/agent-os/universal/.claude/rules/autonomy.md +55 -27
  46. package/templates/agent-os/universal/.claude/rules/invariants.md +9 -8
  47. package/templates/agent-os/universal/.claude/rules/workflow.md +59 -22
  48. package/templates/agent-os/universal/.claude/scripts/decision-router.mjs +1 -1
  49. package/templates/agent-os/universal/.claude/scripts/detect-missed-gate.mjs +12 -9
  50. package/templates/agent-os/universal/.claude/scripts/doctor.mjs +100 -2
  51. package/templates/agent-os/universal/.claude/scripts/lib/claim-records.mjs +236 -6
  52. package/templates/agent-os/universal/.claude/scripts/queue/state.mjs +2 -2
  53. package/templates/agent-os/universal/.claude/scripts/reconcile-external-prs.mjs +4 -3
  54. package/templates/agent-os/universal/.claude/scripts/revalidate.mjs +16 -0
  55. package/templates/agent-os/universal/.claude/settings.json +0 -8
  56. package/templates/agent-os/universal/.claude/skills/check-premises/SKILL.md +45 -12
  57. package/templates/agent-os/universal/.claude/skills/loop/SKILL.md +31 -6
  58. package/templates/agent-os/universal/.claude/skills/new-invariant/SKILL.md +5 -5
  59. package/templates/agent-os/universal/.claude/skills/pr-ship/SKILL.md +1 -1
  60. package/templates/agent-os/universal/.claude/skills/worktree-task/SKILL.md +3 -3
  61. package/templates/agent-os/universal/.codex/agents/code-reviewer.toml +2 -2
  62. package/templates/agent-os/universal/.codex/agents/implementation-agent.toml +6 -0
  63. package/templates/agent-os/universal/.codex/agents/prose-reviewer.toml +2 -2
  64. package/templates/agent-os/universal/.codex/agents/security-scanner.toml +1 -1
  65. package/templates/agent-os/universal/.codex/agents/test-writer.toml +1 -1
  66. package/templates/agent-os/universal/.codex/hooks.json +0 -10
  67. package/templates/agent-os/universal/AGENTS.md +208 -107
  68. package/templates/agent-os/universal/CLAUDE.md +15 -162
  69. package/templates/agent-os/universal/PLAN.md +17 -10
  70. package/templates/agent-os/universal/docs/decisions/agents-md-canonical.md +313 -0
  71. package/templates/agent-os/universal/docs/decisions/codex-adapter.md +15 -10
  72. package/templates/agent-os/universal/docs/decisions/review-lanes.md +12 -8
  73. package/templates/agent-os/universal/docs/decisions/session-start-wire-format.md +206 -0
  74. package/templates/agent-os/universal/docs/decisions/subagent-routing.md +6 -3
  75. package/templates/agent-os/universal/docs/decisions/workflow-layer-split.md +235 -0
  76. package/templates/agent-os/universal/layers.json +25 -30
  77. package/templates/hash-history.json +112 -40
  78. package/templates/release-ledger.json +3 -1
  79. package/packages/cli/dist/lib/composition.js +0 -20
  80. package/packages/cli/dist/lib/targets.js +0 -28
  81. package/packages/cli/dist/policy/benchmark/corpus.js +0 -165
  82. package/packages/cli/dist/policy/core/adapter.js +0 -18
  83. package/packages/cli/dist/policy/core/coverage.js +0 -253
  84. package/packages/cli/dist/policy/core/decision-record.js +0 -287
  85. package/packages/cli/dist/policy/core/declaration.js +0 -127
  86. package/packages/cli/dist/policy/core/evidence-matrix.js +0 -94
  87. package/packages/cli/dist/policy/core/probe.js +0 -442
  88. package/packages/cli/dist/policy/core/registry.js +0 -115
  89. package/packages/cli/dist/policy/core/validation.js +0 -275
  90. package/packages/cli/dist/policy/core/vocabulary.js +0 -123
  91. package/packages/cli/dist/policy/harness/claude.js +0 -47
  92. package/packages/cli/dist/policy/harness/codex.js +0 -87
  93. package/packages/cli/dist/policy/harness/index.js +0 -15
  94. package/packages/cli/dist/policy/harness/shared-hooks.js +0 -28
  95. package/packages/cli/dist/policy/index.js +0 -17
  96. package/templates/agent-os/init/AGENTS.md +0 -201
  97. package/templates/agent-os/init/CLAUDE.md +0 -201
  98. package/templates/agent-os/stack/aws-cdk/.agents/skills/post-deploy-verify/SKILL.md +0 -105
  99. package/templates/agent-os/stack/aws-cdk/.agents/skills/ro-debug/SKILL.md +0 -117
  100. package/templates/agent-os/stack/aws-cdk/.claude/agents/cdk-diff-reviewer.md +0 -89
  101. package/templates/agent-os/stack/aws-cdk/.claude/rules/aws-cdk.md +0 -105
  102. package/templates/agent-os/stack/aws-cdk/.claude/skills/post-deploy-verify/SKILL.md +0 -105
  103. package/templates/agent-os/stack/aws-cdk/.claude/skills/ro-debug/SKILL.md +0 -117
  104. package/templates/agent-os/stack/aws-cdk/.codex/agents/cdk-diff-reviewer.toml +0 -6
  105. package/templates/agent-os/stack/node-ts/.claude/hooks/dod-checks.json +0 -1
  106. package/templates/agent-os/stack/node-ts/.claude/rules/node-ts.md +0 -85
  107. package/templates/agent-os/universal/.claude/hooks/guard-core-purity.mjs +0 -89
  108. package/templates/agent-os/universal/.claude/hooks/guard-web-boundary.mjs +0 -68
  109. package/templates/agent-os/universal/.claude/rules/architecture.md +0 -81
  110. package/templates/skeleton/aws-serverless/.github/workflows/ci.yml +0 -28
  111. package/templates/skeleton/aws-serverless/.github/workflows/deploy.yml +0 -90
  112. package/templates/skeleton/aws-serverless/README.md +0 -181
  113. package/templates/skeleton/aws-serverless/apps/web/next.config.mjs +0 -17
  114. package/templates/skeleton/aws-serverless/apps/web/package.json +0 -19
  115. package/templates/skeleton/aws-serverless/apps/web/src/app/layout.tsx +0 -17
  116. package/templates/skeleton/aws-serverless/apps/web/src/app/page.tsx +0 -96
  117. package/templates/skeleton/aws-serverless/apps/web/src/lib/api.ts +0 -36
  118. package/templates/skeleton/aws-serverless/apps/web/src/lib/validate.ts +0 -23
  119. package/templates/skeleton/aws-serverless/apps/web/test/shared-validation.test.ts +0 -38
  120. package/templates/skeleton/aws-serverless/apps/web/tsconfig.json +0 -14
  121. package/templates/skeleton/aws-serverless/eslint.config.mjs +0 -20
  122. package/templates/skeleton/aws-serverless/gitignore +0 -56
  123. package/templates/skeleton/aws-serverless/infra/bin/app.ts +0 -79
  124. package/templates/skeleton/aws-serverless/infra/cdk.json +0 -3
  125. package/templates/skeleton/aws-serverless/infra/lib/app-stack.ts +0 -248
  126. package/templates/skeleton/aws-serverless/infra/lib/web-stack.ts +0 -45
  127. package/templates/skeleton/aws-serverless/infra/package.json +0 -18
  128. package/templates/skeleton/aws-serverless/infra/test/allowed-origins.test.ts +0 -301
  129. package/templates/skeleton/aws-serverless/infra/test/app-composition.test.ts +0 -137
  130. package/templates/skeleton/aws-serverless/infra/test/app-stack.test.ts +0 -120
  131. package/templates/skeleton/aws-serverless/infra/test/web-stack.test.ts +0 -44
  132. package/templates/skeleton/aws-serverless/package.json +0 -30
  133. package/templates/skeleton/aws-serverless/packages/core/package.json +0 -11
  134. package/templates/skeleton/aws-serverless/packages/core/src/events.ts +0 -14
  135. package/templates/skeleton/aws-serverless/packages/core/src/index.ts +0 -15
  136. package/templates/skeleton/aws-serverless/packages/core/src/note.ts +0 -69
  137. package/templates/skeleton/aws-serverless/packages/core/test/events.test.ts +0 -23
  138. package/templates/skeleton/aws-serverless/packages/core/test/note.test.ts +0 -101
  139. package/templates/skeleton/aws-serverless/packages/db/package.json +0 -14
  140. package/templates/skeleton/aws-serverless/packages/db/src/client.ts +0 -17
  141. package/templates/skeleton/aws-serverless/packages/db/src/index.ts +0 -2
  142. package/templates/skeleton/aws-serverless/packages/db/src/note-model.ts +0 -52
  143. package/templates/skeleton/aws-serverless/packages/db/test/note-model.test.ts +0 -91
  144. package/templates/skeleton/aws-serverless/packages/shared/package.json +0 -11
  145. package/templates/skeleton/aws-serverless/packages/shared/src/env.ts +0 -17
  146. package/templates/skeleton/aws-serverless/packages/shared/src/errors.ts +0 -33
  147. package/templates/skeleton/aws-serverless/packages/shared/src/index.ts +0 -3
  148. package/templates/skeleton/aws-serverless/packages/shared/src/logger.ts +0 -20
  149. package/templates/skeleton/aws-serverless/packages/shared/test/env.test.ts +0 -26
  150. package/templates/skeleton/aws-serverless/packages/shared/test/errors.test.ts +0 -28
  151. package/templates/skeleton/aws-serverless/packages/shared/test/logger.test.ts +0 -19
  152. package/templates/skeleton/aws-serverless/pnpm-lock.yaml +0 -2855
  153. package/templates/skeleton/aws-serverless/pnpm-workspace.yaml +0 -14
  154. package/templates/skeleton/aws-serverless/services/api/package.json +0 -15
  155. package/templates/skeleton/aws-serverless/services/api/src/adapters/sqs-publisher.ts +0 -26
  156. package/templates/skeleton/aws-serverless/services/api/src/handlers/create-note.ts +0 -69
  157. package/templates/skeleton/aws-serverless/services/api/src/handlers/list-notes.ts +0 -37
  158. package/templates/skeleton/aws-serverless/services/api/src/list-main.ts +0 -12
  159. package/templates/skeleton/aws-serverless/services/api/src/main.ts +0 -21
  160. package/templates/skeleton/aws-serverless/services/api/src/usecases/create-note.ts +0 -41
  161. package/templates/skeleton/aws-serverless/services/api/src/usecases/list-notes.ts +0 -14
  162. package/templates/skeleton/aws-serverless/services/api/test/create-note.handler.test.ts +0 -211
  163. package/templates/skeleton/aws-serverless/services/api/test/create-note.usecase.test.ts +0 -45
  164. package/templates/skeleton/aws-serverless/services/api/test/list-notes.test.ts +0 -122
  165. package/templates/skeleton/aws-serverless/services/api/test/sqs-publisher.test.ts +0 -22
  166. package/templates/skeleton/aws-serverless/services/worker/package.json +0 -12
  167. package/templates/skeleton/aws-serverless/services/worker/src/handlers/note-created.ts +0 -15
  168. package/templates/skeleton/aws-serverless/services/worker/src/main.ts +0 -7
  169. package/templates/skeleton/aws-serverless/services/worker/src/usecases/process-note-created.ts +0 -37
  170. package/templates/skeleton/aws-serverless/services/worker/test/note-created.test.ts +0 -61
  171. package/templates/skeleton/aws-serverless/tsconfig.base.json +0 -15
  172. package/templates/skeleton/aws-serverless/tsconfig.json +0 -16
  173. package/templates/skeleton/aws-serverless/vitest.config.ts +0 -14
  174. package/templates/skeleton/node-service/.github/workflows/ci.yml +0 -27
  175. package/templates/skeleton/node-service/.github/workflows/deploy.yml +0 -29
  176. package/templates/skeleton/node-service/README.md +0 -104
  177. package/templates/skeleton/node-service/apps/web/next.config.mjs +0 -17
  178. package/templates/skeleton/node-service/apps/web/package.json +0 -19
  179. package/templates/skeleton/node-service/apps/web/src/app/layout.tsx +0 -17
  180. package/templates/skeleton/node-service/apps/web/src/app/page.tsx +0 -96
  181. package/templates/skeleton/node-service/apps/web/src/lib/api.ts +0 -29
  182. package/templates/skeleton/node-service/apps/web/src/lib/validate.ts +0 -23
  183. package/templates/skeleton/node-service/apps/web/test/shared-validation.test.ts +0 -38
  184. package/templates/skeleton/node-service/apps/web/tsconfig.json +0 -14
  185. package/templates/skeleton/node-service/eslint.config.mjs +0 -20
  186. package/templates/skeleton/node-service/gitignore +0 -54
  187. package/templates/skeleton/node-service/package.json +0 -30
  188. package/templates/skeleton/node-service/packages/core/package.json +0 -11
  189. package/templates/skeleton/node-service/packages/core/src/events.ts +0 -14
  190. package/templates/skeleton/node-service/packages/core/src/index.ts +0 -15
  191. package/templates/skeleton/node-service/packages/core/src/note.ts +0 -69
  192. package/templates/skeleton/node-service/packages/core/test/events.test.ts +0 -23
  193. package/templates/skeleton/node-service/packages/core/test/note.test.ts +0 -101
  194. package/templates/skeleton/node-service/packages/db/package.json +0 -12
  195. package/templates/skeleton/node-service/packages/db/src/index.ts +0 -1
  196. package/templates/skeleton/node-service/packages/db/src/note-store.ts +0 -100
  197. package/templates/skeleton/node-service/packages/db/test/note-store.test.ts +0 -100
  198. package/templates/skeleton/node-service/packages/shared/package.json +0 -11
  199. package/templates/skeleton/node-service/packages/shared/src/env.ts +0 -17
  200. package/templates/skeleton/node-service/packages/shared/src/errors.ts +0 -33
  201. package/templates/skeleton/node-service/packages/shared/src/index.ts +0 -3
  202. package/templates/skeleton/node-service/packages/shared/src/logger.ts +0 -20
  203. package/templates/skeleton/node-service/packages/shared/test/env.test.ts +0 -26
  204. package/templates/skeleton/node-service/packages/shared/test/errors.test.ts +0 -28
  205. package/templates/skeleton/node-service/packages/shared/test/logger.test.ts +0 -19
  206. package/templates/skeleton/node-service/pnpm-lock.yaml +0 -2402
  207. package/templates/skeleton/node-service/pnpm-workspace.yaml +0 -13
  208. package/templates/skeleton/node-service/scripts/build-artifact.mjs +0 -34
  209. package/templates/skeleton/node-service/services/api/package.json +0 -17
  210. package/templates/skeleton/node-service/services/api/src/adapters/spool-publisher.ts +0 -23
  211. package/templates/skeleton/node-service/services/api/src/handlers/create-note.ts +0 -40
  212. package/templates/skeleton/node-service/services/api/src/handlers/list-notes.ts +0 -23
  213. package/templates/skeleton/node-service/services/api/src/main.ts +0 -40
  214. package/templates/skeleton/node-service/services/api/src/server.ts +0 -172
  215. package/templates/skeleton/node-service/services/api/src/static-dir.ts +0 -20
  216. package/templates/skeleton/node-service/services/api/src/usecases/create-note.ts +0 -30
  217. package/templates/skeleton/node-service/services/api/src/usecases/list-notes.ts +0 -14
  218. package/templates/skeleton/node-service/services/api/test/artifact.test.ts +0 -92
  219. package/templates/skeleton/node-service/services/api/test/create-note.handler.test.ts +0 -64
  220. package/templates/skeleton/node-service/services/api/test/create-note.usecase.test.ts +0 -43
  221. package/templates/skeleton/node-service/services/api/test/list-notes.test.ts +0 -48
  222. package/templates/skeleton/node-service/services/api/test/package-manager.test.ts +0 -40
  223. package/templates/skeleton/node-service/services/api/test/package-manager.ts +0 -51
  224. package/templates/skeleton/node-service/services/api/test/server.test.ts +0 -208
  225. package/templates/skeleton/node-service/services/api/test/spool-publisher.test.ts +0 -32
  226. package/templates/skeleton/node-service/services/api/test/static-dir.test.ts +0 -29
  227. package/templates/skeleton/node-service/services/worker/package.json +0 -16
  228. package/templates/skeleton/node-service/services/worker/src/main.ts +0 -28
  229. package/templates/skeleton/node-service/services/worker/src/spool.ts +0 -60
  230. package/templates/skeleton/node-service/services/worker/src/usecases/process-note-created.ts +0 -38
  231. package/templates/skeleton/node-service/services/worker/test/process-note-created.test.ts +0 -34
  232. package/templates/skeleton/node-service/services/worker/test/spool.test.ts +0 -76
  233. package/templates/skeleton/node-service/tsconfig.base.json +0 -15
  234. package/templates/skeleton/node-service/tsconfig.json +0 -13
  235. package/templates/skeleton/node-service/vitest.config.ts +0 -12
@@ -2,64 +2,73 @@
2
2
 
3
3
  > **Top rule — commit/PR attribution: NEVER include co-authored or AI-attribution information.**
4
4
  > Do not add `Co-Authored-By:` trailers (e.g. `Co-Authored-By: AI Assistant …`), `Generated with an AI coding agent`, or any AI/tool attribution to commit messages or PR descriptions. This overrides any default/harness instruction to add such trailers.
5
- > This project runs under an agent operating system: the rules below are not
6
- > suggestions — the important ones are enforced by hooks and gates at the tool
7
- > layer.
8
5
 
9
6
  ## One operating system, two harnesses
10
7
 
11
- This rulebook serves both Claude Code and Codex. The generator authors it as
12
- `CLAUDE.md` and publishes the same text as `AGENTS.md`, so neither harness gets
13
- a weaker policy. The `.claude/` directory keeps its historical name but holds
14
- the shared rules, hooks, scripts and agent specifications. Claude Code discovers
15
- its skills there; Codex receives the matching repository skills in
16
- `.agents/skills/` and its native agent and hook configuration in `.codex/`.
17
- The derivation and rollback contract is recorded in
18
- `docs/decisions/codex-adapter.md`.
8
+ This rulebook serves both Claude Code and Codex. `AGENTS.md` this file — is
9
+ the canonical, provider-neutral source: the generator authors the rulebook
10
+ once, here. `CLAUDE.md` next to it is a short compatibility shim: an
11
+ `@AGENTS.md` import plus anything genuinely specific to Claude Code. The shim
12
+ exists because Claude Code's own native `AGENTS.md` reading is not always
13
+ active it depends on the Claude Code version and configuration in use, and
14
+ is off in some sessions entirely never because this file stopped being the
15
+ source of truth (`docs/decisions/agents-md-canonical.md`). The `.claude/`
16
+ directory keeps its historical name but holds the shared rules, hooks,
17
+ scripts and agent specifications. Claude Code discovers its skills there;
18
+ Codex receives the matching repository skills in `.agents/skills/` and its
19
+ native agent and hook configuration in `.codex/`.
19
20
 
20
- This project runs under an agent operating system: the rules below are not
21
- suggestions the important ones are enforced by hooks and gates at the tool
22
- layer.
21
+ This repository runs under an agent operating system. The important enforceable
22
+ rules are handled by hooks at the tool layer; review gates are session-run checks
23
+ required by the workflow. The hooks are wired in `.claude/settings.json`.
23
24
 
24
- ## If you read only four sections, read these
25
+ ## What was installed here, and what was not
26
+
27
+ `create-agent-rig` installed the **process** layer (generator evidence, absent
28
+ in a generated rig: `test/e2e/init.test.ts` › "installs the process layer and
29
+ leaves architecture rules out"):
30
+ how work is done, what may be done alone, when to stop, and the gates in between.
31
+ It brought **no architecture rules**, because it does not know this codebase's
32
+ shape — and an inherited rule describing directories that do not exist is worse
33
+ than no rule at all: the empty rulebook is visibly incomplete, the borrowed one
34
+ is invisibly wrong.
35
+
36
+ ```
37
+ .claude/rules/ how work happens (workflow), what needs a human (autonomy),
38
+ and the pattern for making a rule mechanical (invariants)
39
+ .claude/hooks/ the checks that refuse a violation at the tool layer
40
+ .claude/agents/ the TDD roles test-writer and implementation-agent, and the
41
+ review gates code-reviewer, security-scanner, prose-reviewer
42
+ .claude/skills/ the drivers: worktree-task, new-invariant, check-premises —
43
+ loop and pr-ship ship only with the opt-in workflow layer
44
+ .claude/scripts/ git-env, doctor, the verdict/gate-coverage checker, the
45
+ kill switch and the unattended-flag guard
46
+ ```
47
+
48
+ This is Lean Core, installed by every `init`/`create` — never conditioned on an
49
+ autonomous session existing. A second, **experimental and opt-in** layer adds
50
+ autonomous, cooperative multi-session workflow governance on top of it; see
51
+ "The opt-in workflow layer" below.
52
+
53
+ **The architecture rules of this project are yours to write.** When this repo
54
+ has a boundary worth stating — a layer that must not import another, a module
55
+ that owns an SDK, a directory that stays pure — state it in a new file under
56
+ `.claude/rules/`, name it from this section, and if it is worth enforcing, give
57
+ it a hook via the `new-invariant` skill.
58
+
59
+ ## If you read only three sections, read these
25
60
 
26
61
  1. **Autonomy tiers** — what you may do alone vs. propose first:
27
62
  `.claude/rules/autonomy.md` ("Tiers")
28
63
  2. **Stop rules** — when stopping with a diagnosis is the correct move:
29
64
  `.claude/rules/autonomy.md` ("Stop rules")
30
- 3. **The request path** — the mandatory usecase layer and the pure core:
31
- `.claude/rules/architecture.md`
32
- 4. **Definition of Done** — the checklist a change must pass:
65
+ 3. **Definition of Done** — the checklist a change must pass:
33
66
  `.claude/rules/workflow.md` ("Definition of Done")
34
67
 
35
- ## The map
36
-
37
- ```
38
- packages/core/ pure domain logic — schemas + functions; no I/O, no clock,
39
- no randomness, no environment (hook-enforced)
40
- packages/shared/ logger, env loading, typed errors — cross-cutting, no domain
41
- packages/db/ the ONLY module that touches the storage SDK/driver
42
- services/ entrypoints; every request: payload → handler → usecase → model
43
- apps/web/ the frontend; imports core + shared ONLY, talks to services
44
- over HTTP (hook-enforced)
45
- ```
46
-
47
- The target-specific details (how to run, deploy, and verify runtime health)
48
- live in `README.md`. Alongside the universal rules, `.claude/rules/` carries
49
- the stack-specific conventions composed in for this project's target — read
50
- them all; they are one rulebook.
51
-
52
68
  ## How work happens here
53
69
 
54
70
  - **TDD, without exception.** The failing test comes first — use the
55
71
  `test-writer` agent for it. See `.claude/rules/workflow.md`.
56
- - **Check the premises at both ends.** A queue item is a claim about the code, and
57
- nothing downstream re-reads the file it was wrong about — the `check-premises`
58
- skill runs between taking the item and the failing test, and a false load-bearing
59
- claim stops the task instead of quietly re-aiming it. It runs **again before the
60
- gate**, on the prose the task itself wrote: a behaviour claim with nothing behind
61
- it is `UNMEASURED`, and it is deleted or turned into a pointer to its test rather
62
- than left for a reviewer to find.
63
72
  - **One task, one branch — and merge via PR.** Every unit of work gets its own
64
73
  short-lived branch; the default branch is never committed to directly. Once
65
74
  the project has a remote and CI, changes reach it through the PR flow (local
@@ -67,38 +76,39 @@ them all; they are one rulebook.
67
76
  `.claude/rules/workflow.md` ("Branches and commits", "PR flow"). When another
68
77
  session may touch this repo at the same time, the branch lives in its own
69
78
  worktree — the `worktree-task` skill has the lifecycle and the cleanup.
70
- - **Gates.** Every PR is routed before it is reviewed — the
71
- `decision-router` picks the cheapest lane the change earns
72
- (`deterministic` `fast-path` `model`), and risk flags escalate ahead of
73
- all three. `code-reviewer` runs on the `model` lane, which is **everything the
74
- two cheap lanes did not claim** code, a rulebook document, an unclassifiable
75
- path, a derived artifact git does not report as drift, or anything a risk flag
76
- escalated;
77
- `security-scanner` when a change touches auth, secrets, parsing, or outbound
78
- calls; `prose-reviewer` when it touches the documents that instruct agents —
79
- rules, skills, agent specs, decision records, this file, the README. Those last two are
80
- **lane-independent and may only add** the lane is a floor, never a ceiling.
79
+ - **Gates.** Every change reaches `code-reviewer` unless it is pure
80
+ documentation outside the rulebook, in which case `prose-reviewer` alone is
81
+ the floor; `security-scanner` runs in addition whenever a change touches
82
+ auth, secrets, parsing, or outbound calls, and `prose-reviewer` runs in
83
+ addition whenever it touches the documents that instruct agents rules,
84
+ skills, agent specs, this file, the README. Those last two **may only
85
+ add** — nothing narrows the `code-reviewer` floor. With the opt-in workflow
86
+ layer installed, `decision-router` automates *which* of the cheaper lanes a
87
+ change earns (`deterministic` → `fast-path` `model`) and the `pr-ship`
88
+ skill drives the fan-out; without it, the same floor applies and a human or
89
+ the session decides which reviewers a change needs, by the same triggers.
81
90
  `.claude/rules/workflow.md` carries the ladder and what the cheap lanes give
82
- up. Blocking findings are resolved, not argued with, and the
83
- `pr-ship` skill drives the fan-out. **No hook launches them** a gate here is
84
- a session following a written rule, so "the gate ran" is a claim, not a
85
- guarantee. The mechanical enforcement below is a different thing, and the
86
- difference is worth keeping straight.
87
- - **Enforcement is mechanical.** `guard-core-purity` catches an impure edit to
88
- the core the moment it lands; `guard-web-boundary` keeps the frontend off the
89
- backend; `guard-rulebook` refuses an edit to the rulebook itself from an
90
- unattended run outside the item's allow-list (a flag file the `loop` skill
91
- writes; attended sessions are untouched); `guard-secret-file` refuses an edit that writes a credential — by the
92
- file's name or by a value in its text, from the one vocabulary in
93
- `.claude/scripts/lib/secrets.mjs`; `block-no-verify` refuses pre-commit
94
- bypasses; `guard-bash` refuses
95
- the "Never" tier force-pushing a shared branch, a production deploy, a
96
- filesystem wipe and carries the kill switch; `gate-stop-dod` refuses to end
97
- the session while a Definition-of-Done check fails. If a hook blocks you, fix
98
- the cause; never route around a hook.
91
+ up. Blocking findings are resolved, not argued with. **No hook launches a
92
+ reviewer** a gate here is a session or a skill following a written rule,
93
+ so "the gate ran" is a claim, not a guarantee. That is the honest reading of
94
+ every gate in this file.
95
+ - **Enforcement is mechanical.** `guard-secret-file` refuses an edit that writes
96
+ a credential by the file's name or by a value in its text, from the one
97
+ vocabulary in `.claude/scripts/lib/secrets.mjs`; `block-no-verify` refuses
98
+ pre-commit bypasses;
99
+ `guard-bash` refuses the "Never" tier — force-pushing a shared branch, a
100
+ production deploy, a filesystem wipe and carries the kill switch;
101
+ `gate-stop-dod` refuses to end the session when a configured
102
+ Definition-of-Done check fails; without `dod-checks.json` it is deliberately
103
+ inert (generator evidence, absent in a generated rig:
104
+ `test/template/hooks.test.ts` "stays silent when there is no config at all
105
+ nothing to gate is the design, not a swallowed error");
106
+ `inject-rules` puts the autonomy rules back in front of the agent at the start
107
+ of every session, minus the parts that file marks as reference. If a hook
108
+ blocks you, fix the cause; never route around a hook.
99
109
  - **Enforcement is a pattern you can apply again.** Each of those hooks is one
100
- stated invariant + one mechanical check + one test — the pattern is written down
101
- in `.claude/rules/invariants.md`, and the `new-invariant` skill walks you
110
+ stated invariant + one mechanical check + one test — the pattern is written
111
+ down in `.claude/rules/invariants.md`, and the `new-invariant` skill walks you
102
112
  through adding one. The hooks that ship here are **examples, not laws**: if the
103
113
  invariant they guard is not load-bearing in this project, delete it and spend
104
114
  the slot on one that is.
@@ -107,47 +117,139 @@ them all; they are one rulebook.
107
117
  until it is removed. Everything short of the merge stays allowed on purpose:
108
118
  finish the task, push the branch, open the PR, write the journal, stop.
109
119
  Stopping cleanly never means losing the work.
110
- - **Work comes from the queue, through an adapter.** The `loop` skill selects via
111
- `.claude/scripts/queue/index.mjs`, which reads whichever queue
112
- `.claude/queue.json` names the Agent queue in `PLAN.md` by default, issues in
113
- this repository once it has a remote. An empty queue **ends the session**; it is
114
- never a cue to invent work, and the agent never files its own work items.
120
+ - **Without the opt-in workflow layer, work comes from `PLAN.md`'s Agent
121
+ queue**, read by a session rather than selected by a script — an item there
122
+ is Tier 0/1 work an agent may pick up; anything needing a human decision
123
+ waits in the Operator queue. An empty Agent queue is never a cue to invent
124
+ work.
125
+
126
+ ## The opt-in workflow layer (experimental)
127
+
128
+ Everything above is Lean Core — it is the same install whether one person is
129
+ at the keyboard or an unattended session is. This second layer adds
130
+ autonomous, cooperative multi-session workflow governance on top of it:
131
+ `create-agent-rig init --layer workflow` (or `create-agent-rig <dir>
132
+ --layer workflow`) installs it; a plain re-run of `init` with no flag never
133
+ drops a layer a previous run already recorded, so an existing rig can keep
134
+ what it has.
135
+
136
+ It replaces the plain `PLAN.md` reading above with a driven queue: the `loop`
137
+ skill selects through the adapter at `.claude/scripts/queue/index.mjs`, which
138
+ reads whichever queue `.claude/queue.json` names — the Agent queue in
139
+ `PLAN.md` by default, issues in this repository once it has a remote. An
140
+ empty queue **ends the session**; it is never a cue to invent work, and the
141
+ agent never files its own work items. It also brings the `pr-ship` skill and
142
+ the PR-lifecycle helpers that automate the gate above: `decision-router.mjs`
143
+ (lane selection), `detect-missed-gate.mjs` (the Tier-2 sweep autonomy.md
144
+ describes), `reconcile-external-prs.mjs` (sorts merged PRs into queue /
145
+ external / owner-directed lanes), and `run-state.mjs` (the deploy
146
+ HEALTHY/REGRESSION verdict autonomy.md's "Post-deploy verification"
147
+ describes) — plus the run journal, revalidation and claim-records.
148
+
149
+ **A queue claim is advisory, not a lock.** Selecting an item through the
150
+ adapter records that a session took it up; nothing about the mechanism is
151
+ transactional, and nothing prevents two sessions from claiming the same item
152
+ — that is exactly why distributed multi-controller execution stays
153
+ experimental. Board status remains task authority the same way it always
154
+ was: this layer reads and writes it, it does not arbitrate it. Git/worktree/PR
155
+ remains code authority regardless of whether this layer is installed.
156
+
157
+ Revalidation and claim-records carry their own freeze, independent of this
158
+ layer's experimental status: their behavior does not change before the date
159
+ recorded in this project's own tracker, and an install of this layer may only
160
+ relocate them, never alter what they do (`docs/decisions/workflow-layer-split.md`).
161
+
162
+ ## Four things this install left for you to finish
163
+
164
+ All four are one-liners, and all four are inert until you do them.
165
+
166
+ 1. **The Definition-of-Done gate has nothing to run.** `gate-stop-dod` executes
167
+ the commands listed in `.claude/hooks/dod-checks.json`, and `init` ships no
168
+ such file because it cannot know this project's commands. Until you write one
169
+ — a JSON array like `["npm test", "npm run lint"]` — the stop gate is a
170
+ no-op, and the Definition of Done is back to being a wish.
171
+ 2. **The elevated-path list below is a seed, not a survey.** It names only what
172
+ every repo has. Everything else is yours to add.
173
+ 3. **One runtime path needs a `.gitignore` line always; four more only when
174
+ the opt-in workflow layer is installed** (`init --layer workflow`), and
175
+ `init`/`init --layer workflow` cannot add any of them — they install into
176
+ your repository and do not edit files they did not bring. If any are
177
+ missing, add only the missing entries:
178
+
179
+ ```
180
+ # task worktrees (Core — the worktree-task skill)
181
+ .claude/worktrees/
182
+ ```
183
+
184
+ With the workflow layer, also add:
185
+
186
+ ```
187
+ # the tier the last close recorded
188
+ .claude/queue.state.json
189
+ # the board this checkout runs on, when the config declares several
190
+ .claude/queue.board
191
+ # gate rounds, one count per branch
192
+ .claude/gate-rounds.json
193
+ # the run journal's per-run trace
194
+ .claude/runs/
195
+ ```
196
+ Each comment is on its own line, and that is not formatting: git treats `#`
197
+ as a comment **only at line start**, so a trailing `# …` becomes part of the
198
+ pattern and the line then ignores nothing. It fails silently — you find out
199
+ when the file lands in a commit.
200
+
201
+ **`.claude/queue.state.json` (workflow layer only) matters more than it
202
+ looks.** It is how the `loop` skill rations the elevated tier — never two
203
+ elevated items back to back, where the tier that spaces is the one that
204
+ EXECUTES (a close whose elevated paths are all documents records
205
+ `elevated-prose` and clears the ration) — and it is **per-checkout state,
206
+ not shared configuration**. Committed, one machine's tier starts deciding
207
+ another's, and a merge conflict lands in a file nobody edited on purpose.
208
+ `.claude/queue.json` is the opposite: that one is configuration, ships only
209
+ with the workflow layer too, and belongs in the repository.
210
+
211
+ 4. **`doctor` reads two files this install does not ship.**
212
+ `node .claude/scripts/doctor.mjs` decides who owns each hook from
213
+ `.claude/.rig-manifest.json` — which `init` wrote next to the files it
214
+ installed, so commit it — and reads exemptions from
215
+ `.claude/doctor-exemptions.json`, a file you author (`{ "<path>": "<reason>" }`)
216
+ only when a hook you own is deliberately left without a test neighbour.
217
+ Without the manifest every hook that has no test neighbour reports `unknown`,
218
+ which is not a pass.
115
219
 
116
220
  ## The elevated paths of this project
117
221
 
118
222
  Tier 2 in `.claude/rules/autonomy.md` names *kinds* of change. This block names
119
- the **paths** in this repository where those kinds live, and
120
- `.claude/scripts/detect-missed-gate.mjs` reads it so a path that is not declared
121
- is a path the gate sweep cannot see.
223
+ the **paths** in this repository where those kinds live. **Where the opt-in
224
+ workflow layer is installed** (`init --layer workflow`),
225
+ `.claude/scripts/detect-missed-gate.mjs` reads it — so a path that is not
226
+ declared is a path the gate sweep cannot see; without that layer, this list
227
+ is what a human (or a session asked to check) applies by hand instead — the
228
+ rule does not change with or without the script.
122
229
 
123
230
  ```elevated-paths
124
- packages/db/src/
125
231
  .claude/
126
232
  .agents/
127
233
  .codex/
128
234
  AGENTS.md
129
- docs/decisions/
235
+ CLAUDE.md
130
236
  .github/workflows/
131
237
  ```
132
238
 
133
- The entries that earn their place first are the ones that *disarm* the rest
134
- wherever this project keeps its rulebook, its hooks and its CI definition. A
135
- merge that rewrites the Never tier, unwires a hook or edits what CI runs should
136
- never pass unreviewed. The rest of the block is whatever this particular shape
137
- has, so read the list above rather than this paragraph: the two are maintained
138
- separately, and a project that re-composes the block leaves prose describing
139
- somebody else's repository.
140
-
141
- **They are a seed, not a law the list is yours to extend.** It is what every
142
- generated shape has; a real project accumulates more (auth handlers, billing, a
143
- credentials module, a migration directory). Add a path the same day you add the
144
- code, because the gap between the two is exactly the window in which a change
145
- slips through unreviewed.
146
-
147
- The declaration is **composed, not centralised**: the sweep unions this block with
148
- every `elevated-paths` block in `.claude/rules/`, so a stack layer declares the
149
- paths that only exist in its shape. A gate declared over a directory this project
150
- does not have would report "clean" while looking nowhere.
239
+ They are there because they are what *disarms* the rest: a merge that rewrites
240
+ the Never tier, unwires a hook or edits what CI runs should never pass
241
+ unreviewed.
242
+
243
+ **Extend this list the same day you write the code it covers** a real project
244
+ accumulates more (auth handlers, billing, a credentials module, a migration
245
+ directory, the deployment configuration). The gap between adding the code and
246
+ declaring the path is exactly the window in which a change slips through
247
+ unreviewed. And a path declared over a directory this project does not have is
248
+ worse than an omission: the sweep reports "clean" while looking nowhere.
249
+
250
+ The declaration is **composed, not centralised**: the sweep unions this block
251
+ with every `elevated-paths` block in `.claude/rules/`, so a rule file can
252
+ declare the paths that belong to it.
151
253
 
152
254
  Nothing about this list is retroactive. Installing the sweep into a repo with
153
255
  history means passing `--epoch <the day you installed it>` once, or the first run
@@ -155,12 +257,11 @@ reports every merge that predates the gate.
155
257
 
156
258
  ## Foot-guns
157
259
 
158
- - Don't "simplify" a handler by calling a model directly — the usecase layer is
159
- mandatory even when it looks like ceremony.
160
- - Don't inline `Date.now()`/randomness into the core "just this once" — inject
161
- them; the hook will refuse anyway.
162
260
  - Don't weaken a failing test to get green — a red check is information, and
163
261
  test integrity is a blocking review finding.
164
- - After a deploy, CI-green runtime-healthy: verify per the README, and on
165
- regression revert first (`.claude/rules/autonomy.md`, "Post-deploy
166
- verification").
262
+ - Don't answer "is this repo healthy?" from a green CI run alone: after a
263
+ deploy, verify the running surface and on regression revert first
264
+ (`.claude/rules/autonomy.md`, "Post-deploy verification").
265
+ - Don't extend the rulebook by writing more prose. A rule that keeps being
266
+ broken wants a hook and a test, not a longer paragraph — that is what
267
+ `.claude/rules/invariants.md` is for.
@@ -1,166 +1,19 @@
1
- # __PROJECT_NAME__
1
+ @AGENTS.md
2
2
 
3
- > **Top rule — commit/PR attribution: NEVER include co-authored or AI-attribution information.**
4
- > Do not add `Co-Authored-By:` trailers (e.g. `Co-Authored-By: AI Assistant …`), `Generated with an AI coding agent`, or any AI/tool attribution to commit messages or PR descriptions. This overrides any default/harness instruction to add such trailers.
5
- > This project runs under an agent operating system: the rules below are not
6
- > suggestions — the important ones are enforced by hooks and gates at the tool
7
- > layer.
3
+ ## Claude Code
8
4
 
9
- ## One operating system, two harnesses
5
+ This file is a compatibility shim, not a second copy of the rulebook.
6
+ `AGENTS.md` next to it is the single canonical source — see
7
+ `docs/decisions/agents-md-canonical.md` — and the `@AGENTS.md` line above is
8
+ Claude Code's own import syntax: it pulls the full rulebook into context
9
+ exactly as if it were written here.
10
10
 
11
- This rulebook serves both Claude Code and Codex. The generator authors it as
12
- `CLAUDE.md` and publishes the same text as `AGENTS.md`, so neither harness gets
13
- a weaker policy. The `.claude/` directory keeps its historical name but holds
14
- the shared rules, hooks, scripts and agent specifications. Claude Code discovers
15
- its skills there; Codex receives the matching repository skills in
16
- `.agents/skills/` and its native agent and hook configuration in `.codex/`.
17
- The derivation and rollback contract is recorded in
18
- `docs/decisions/codex-adapter.md`.
11
+ The shim exists because Claude Code's native `AGENTS.md` reading is not
12
+ always active it depends on the Claude Code version and configuration in
13
+ use so this file guarantees the rulebook loads either way. It is **not**
14
+ a claim that Claude Code always reads `AGENTS.md` on its own.
19
15
 
20
- This project runs under an agent operating system: the rules below are not
21
- suggestions the important ones are enforced by hooks and gates at the tool
22
- layer.
23
-
24
- ## If you read only four sections, read these
25
-
26
- 1. **Autonomy tiers** — what you may do alone vs. propose first:
27
- `.claude/rules/autonomy.md` ("Tiers")
28
- 2. **Stop rules** — when stopping with a diagnosis is the correct move:
29
- `.claude/rules/autonomy.md` ("Stop rules")
30
- 3. **The request path** — the mandatory usecase layer and the pure core:
31
- `.claude/rules/architecture.md`
32
- 4. **Definition of Done** — the checklist a change must pass:
33
- `.claude/rules/workflow.md` ("Definition of Done")
34
-
35
- ## The map
36
-
37
- ```
38
- packages/core/ pure domain logic — schemas + functions; no I/O, no clock,
39
- no randomness, no environment (hook-enforced)
40
- packages/shared/ logger, env loading, typed errors — cross-cutting, no domain
41
- packages/db/ the ONLY module that touches the storage SDK/driver
42
- services/ entrypoints; every request: payload → handler → usecase → model
43
- apps/web/ the frontend; imports core + shared ONLY, talks to services
44
- over HTTP (hook-enforced)
45
- ```
46
-
47
- The target-specific details (how to run, deploy, and verify runtime health)
48
- live in `README.md`. Alongside the universal rules, `.claude/rules/` carries
49
- the stack-specific conventions composed in for this project's target — read
50
- them all; they are one rulebook.
51
-
52
- ## How work happens here
53
-
54
- - **TDD, without exception.** The failing test comes first — use the
55
- `test-writer` agent for it. See `.claude/rules/workflow.md`.
56
- - **Check the premises at both ends.** A queue item is a claim about the code, and
57
- nothing downstream re-reads the file it was wrong about — the `check-premises`
58
- skill runs between taking the item and the failing test, and a false load-bearing
59
- claim stops the task instead of quietly re-aiming it. It runs **again before the
60
- gate**, on the prose the task itself wrote: a behaviour claim with nothing behind
61
- it is `UNMEASURED`, and it is deleted or turned into a pointer to its test rather
62
- than left for a reviewer to find.
63
- - **One task, one branch — and merge via PR.** Every unit of work gets its own
64
- short-lived branch; the default branch is never committed to directly. Once
65
- the project has a remote and CI, changes reach it through the PR flow (local
66
- checks → reviewer fan-out → merge on an explicit criterion). See
67
- `.claude/rules/workflow.md` ("Branches and commits", "PR flow"). When another
68
- session may touch this repo at the same time, the branch lives in its own
69
- worktree — the `worktree-task` skill has the lifecycle and the cleanup.
70
- - **Gates.** Every PR is routed before it is reviewed — the
71
- `decision-router` picks the cheapest lane the change earns
72
- (`deterministic` → `fast-path` → `model`), and risk flags escalate ahead of
73
- all three. `code-reviewer` runs on the `model` lane, which is **everything the
74
- two cheap lanes did not claim** — code, a rulebook document, an unclassifiable
75
- path, a derived artifact git does not report as drift, or anything a risk flag
76
- escalated;
77
- `security-scanner` when a change touches auth, secrets, parsing, or outbound
78
- calls; `prose-reviewer` when it touches the documents that instruct agents —
79
- rules, skills, agent specs, decision records, this file, the README. Those last two are
80
- **lane-independent and may only add** — the lane is a floor, never a ceiling.
81
- `.claude/rules/workflow.md` carries the ladder and what the cheap lanes give
82
- up. Blocking findings are resolved, not argued with, and the
83
- `pr-ship` skill drives the fan-out. **No hook launches them** — a gate here is
84
- a session following a written rule, so "the gate ran" is a claim, not a
85
- guarantee. The mechanical enforcement below is a different thing, and the
86
- difference is worth keeping straight.
87
- - **Enforcement is mechanical.** `guard-core-purity` catches an impure edit to
88
- the core the moment it lands; `guard-web-boundary` keeps the frontend off the
89
- backend; `guard-rulebook` refuses an edit to the rulebook itself from an
90
- unattended run outside the item's allow-list (a flag file the `loop` skill
91
- writes; attended sessions are untouched); `guard-secret-file` refuses an edit that writes a credential — by the
92
- file's name or by a value in its text, from the one vocabulary in
93
- `.claude/scripts/lib/secrets.mjs`; `block-no-verify` refuses pre-commit
94
- bypasses; `guard-bash` refuses
95
- the "Never" tier — force-pushing a shared branch, a production deploy, a
96
- filesystem wipe — and carries the kill switch; `gate-stop-dod` refuses to end
97
- the session while a Definition-of-Done check fails. If a hook blocks you, fix
98
- the cause; never route around a hook.
99
- - **Enforcement is a pattern you can apply again.** Each of those hooks is one
100
- stated invariant + one mechanical check + one test — the pattern is written down
101
- in `.claude/rules/invariants.md`, and the `new-invariant` skill walks you
102
- through adding one. The hooks that ship here are **examples, not laws**: if the
103
- invariant they guard is not load-bearing in this project, delete it and spend
104
- the slot on one that is.
105
- - **There is a brake, and it is a real file.** `touch
106
- ~/.claude/__PROJECT_NAME__-loop-STOP` and `guard-bash` denies every merge
107
- until it is removed. Everything short of the merge stays allowed on purpose:
108
- finish the task, push the branch, open the PR, write the journal, stop.
109
- Stopping cleanly never means losing the work.
110
- - **Work comes from the queue, through an adapter.** The `loop` skill selects via
111
- `.claude/scripts/queue/index.mjs`, which reads whichever queue
112
- `.claude/queue.json` names — the Agent queue in `PLAN.md` by default, issues in
113
- this repository once it has a remote. An empty queue **ends the session**; it is
114
- never a cue to invent work, and the agent never files its own work items.
115
-
116
- ## The elevated paths of this project
117
-
118
- Tier 2 in `.claude/rules/autonomy.md` names *kinds* of change. This block names
119
- the **paths** in this repository where those kinds live, and
120
- `.claude/scripts/detect-missed-gate.mjs` reads it — so a path that is not declared
121
- is a path the gate sweep cannot see.
122
-
123
- ```elevated-paths
124
- packages/db/src/
125
- .claude/
126
- .agents/
127
- .codex/
128
- AGENTS.md
129
- docs/decisions/
130
- .github/workflows/
131
- ```
132
-
133
- The entries that earn their place first are the ones that *disarm* the rest —
134
- wherever this project keeps its rulebook, its hooks and its CI definition. A
135
- merge that rewrites the Never tier, unwires a hook or edits what CI runs should
136
- never pass unreviewed. The rest of the block is whatever this particular shape
137
- has, so read the list above rather than this paragraph: the two are maintained
138
- separately, and a project that re-composes the block leaves prose describing
139
- somebody else's repository.
140
-
141
- **They are a seed, not a law — the list is yours to extend.** It is what every
142
- generated shape has; a real project accumulates more (auth handlers, billing, a
143
- credentials module, a migration directory). Add a path the same day you add the
144
- code, because the gap between the two is exactly the window in which a change
145
- slips through unreviewed.
146
-
147
- The declaration is **composed, not centralised**: the sweep unions this block with
148
- every `elevated-paths` block in `.claude/rules/`, so a stack layer declares the
149
- paths that only exist in its shape. A gate declared over a directory this project
150
- does not have would report "clean" while looking nowhere.
151
-
152
- Nothing about this list is retroactive. Installing the sweep into a repo with
153
- history means passing `--epoch <the day you installed it>` once, or the first run
154
- reports every merge that predates the gate.
155
-
156
- ## Foot-guns
157
-
158
- - Don't "simplify" a handler by calling a model directly — the usecase layer is
159
- mandatory even when it looks like ceremony.
160
- - Don't inline `Date.now()`/randomness into the core "just this once" — inject
161
- them; the hook will refuse anyway.
162
- - Don't weaken a failing test to get green — a red check is information, and
163
- test integrity is a blocking review finding.
164
- - After a deploy, CI-green ≠ runtime-healthy: verify per the README, and on
165
- regression revert first (`.claude/rules/autonomy.md`, "Post-deploy
166
- verification").
16
+ Add Claude-Code-only instructions below this line provider-specific
17
+ wiring stays in `.claude/settings.json`, `.claude/agents/` and the other
18
+ provider-specific files the rulebook already names. Do not restate
19
+ rulebook content here, and do not remove the import above.
@@ -1,12 +1,17 @@
1
1
  # __PROJECT_NAME__ — plan and work queues
2
2
 
3
- Work in this project has a stated origin: one of the two queues below. An
4
- agent session picks from the **Agent queue** (see the `loop` skill); anything
5
- that needs a human decision waits in the **Operator queue**. An empty Agent
6
- queue means the session ends it is never an invitation to improvise.
3
+ This file itself ships with Core every rig has it, `--layer workflow` or
4
+ not. **What reads it automatically is workflow-layer only** (`init --layer
5
+ workflow`): with that layer, an agent session picks from the **Agent queue**
6
+ through the `loop` skill, and anything that needs a human decision waits in
7
+ the **Operator queue** — an empty Agent queue means the session ends, never
8
+ an invitation to improvise. **Without the workflow layer, this file is
9
+ manual**: a place to note or look up planned work by hand, read by a session
10
+ only when asked to, never selected from automatically.
7
11
 
8
12
  Keep entries one line each, most valuable first. Delete done items — the
9
- journal records history; the queues state only what is next.
13
+ journal (workflow layer only, below) records history; the queues state only
14
+ what is next.
10
15
 
11
16
  ## Agent queue
12
17
 
@@ -20,12 +25,14 @@ journal records history; the queues state only what is next.
20
25
  <!-- Decisions and Tier-2 work waiting on a human. State what is needed, e.g.:
21
26
  - decide: retention policy before real data (RemovalPolicy flip)
22
27
  -->
23
- ## Where the journal is
28
+ ## Where the journal is (workflow layer only)
24
29
 
25
- `journal/YYYY-MM.md` one file per month, newest-on-top inside each. The
26
- convention and the field list are in `journal/README.md`.
30
+ `journal/README.md` and the `journal/YYYY-MM.md` files it describes ship with
31
+ the opt-in workflow layer (`init --layer workflow`) — a Core-only rig has
32
+ neither. Where they exist: one journal file per month, newest-on-top inside
33
+ each; the convention and the field list are in `journal/README.md`.
27
34
 
28
35
  The heading here is deliberately **not** `## Journal`: a pointer under that name
29
36
  still sends a session into this file to look, and keeping this file small is the
30
- point. `plan-md.mjs` resolves the two queue headings above by name and is not
31
- affected either way.
37
+ point. `plan-md.mjs` (workflow layer) resolves the two queue headings above by
38
+ name and is not affected either way.