geneseed 2.1.0 → 3.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 (187) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/DESIGN.md +112 -61
  3. package/QUICKSTART.md +1 -1
  4. package/README.md +24 -14
  5. package/SETUP.md +83 -17
  6. package/SHIPPED.md +5 -4
  7. package/adapters/bob/README.md +3 -3
  8. package/adapters/claude-code/README.md +6 -4
  9. package/adapters/claude-code/skills/geneseed/SKILL.md +10 -6
  10. package/adapters/copilot/README.md +5 -4
  11. package/adapters/opencode/GLOBAL-HARNESS-SPEC.md +11 -6
  12. package/adapters/opencode/HOW-OPENCODE-LOADS.md +1 -1
  13. package/adapters/opencode/README.md +15 -9
  14. package/adapters/opencode/agents/orchestrator.md +1 -1
  15. package/adapters/opencode/plugins/geneseed-context.js +7 -7
  16. package/adapters/opencode/plugins/geneseed-guard.js +6 -6
  17. package/adapters/opencode/workflows/dispatch.js +1 -1
  18. package/bin/geneseed.mjs +72 -6
  19. package/docs/extending.md +164 -55
  20. package/docs/limits.md +4 -4
  21. package/docs/token-footprint.md +15 -4
  22. package/docs/web/authoring.md +1 -1
  23. package/docs/web/claude-hooks.md +2 -2
  24. package/docs/web/collaboration.md +3 -3
  25. package/docs/web/first-session.md +2 -2
  26. package/docs/web/footprint.md +14 -7
  27. package/docs/web/foreman-mode.md +2 -2
  28. package/docs/web/harnesses.md +5 -3
  29. package/docs/web/install-quick.md +1 -1
  30. package/docs/web/model.md +3 -3
  31. package/docs/web/plugin-context.md +2 -2
  32. package/docs/web/plugin-guard.md +3 -3
  33. package/docs/web/plugin-ponytail.md +1 -1
  34. package/docs/web/rules.md +23 -3
  35. package/docs/web/setup-choices.md +20 -7
  36. package/docs/web/themes-author.md +13 -1
  37. package/docs/web-ui.md +36 -12
  38. package/harness.config.json +1 -1
  39. package/js/catalog.mjs +29 -4
  40. package/js/checkout.mjs +24 -1
  41. package/js/cli-table.json +8 -6
  42. package/js/diff.mjs +8 -3
  43. package/js/doctor.mjs +307 -4
  44. package/js/emit.mjs +48 -11
  45. package/js/generate.mjs +39 -5
  46. package/js/hooks.mjs +8 -7
  47. package/js/installs.mjs +101 -4
  48. package/js/inventory.mjs +150 -21
  49. package/js/migrate.mjs +10 -4
  50. package/js/render.mjs +110 -7
  51. package/js/settings.mjs +218 -27
  52. package/js/setup.mjs +95 -5
  53. package/js/status.mjs +45 -4
  54. package/js/tui.mjs +44 -1
  55. package/js/uninstall.mjs +25 -6
  56. package/js/web/actions.mjs +56 -5
  57. package/js/web/api.mjs +95 -16
  58. package/js/web/docs.mjs +33 -5
  59. package/js/web/jobs.mjs +12 -3
  60. package/js/web/server.mjs +6 -0
  61. package/package.json +1 -1
  62. package/src/AGENT.md.tmpl +75 -65
  63. package/src/agents/_template.md +4 -4
  64. package/src/agents/advocate.md +4 -4
  65. package/src/agents/architect.md +2 -2
  66. package/src/agents/developer.md +5 -5
  67. package/src/agents/docs.md +2 -2
  68. package/src/agents/empiricist.md +3 -3
  69. package/src/agents/explorer.md +3 -3
  70. package/src/agents/framer.md +3 -3
  71. package/src/agents/historian.md +3 -3
  72. package/src/agents/operator.md +3 -3
  73. package/src/agents/pragmatist.md +3 -3
  74. package/src/agents/reviewer.md +2 -2
  75. package/src/agents/security.md +2 -2
  76. package/src/agents/skeptic.md +4 -4
  77. package/src/agents/steward.md +3 -3
  78. package/src/agents/tester.md +2 -2
  79. package/src/agents/user-advocate.md +3 -3
  80. package/src/agents/visionary.md +3 -3
  81. package/src/doctrines/README.md +41 -0
  82. package/src/doctrines/craft.md +51 -0
  83. package/src/doctrines/ops.md +61 -0
  84. package/src/doctrines/process.md +87 -0
  85. package/src/doctrines/rigor.md +52 -0
  86. package/src/laws/universal.md +17 -336
  87. package/src/memory/README.md +2 -2
  88. package/src/modes/README.md +2 -2
  89. package/src/modes/foreman.md +1 -1
  90. package/src/notebook/README.md +2 -2
  91. package/src/ontology/universal.md +89 -0
  92. package/src/postures/README.md +3 -3
  93. package/src/postures/artisan.md +3 -3
  94. package/src/postures/assistant.md +1 -1
  95. package/src/postures/expert.md +1 -1
  96. package/src/postures/mentor.md +1 -1
  97. package/src/postures/peer.md +2 -2
  98. package/src/skills/_template.md +2 -2
  99. package/src/skills/brainstorm.md +2 -2
  100. package/src/skills/clarify.md +2 -2
  101. package/src/skills/codebase-design.md +1 -1
  102. package/src/skills/commit.md +5 -5
  103. package/src/skills/council.md +4 -4
  104. package/src/skills/crash-course.md +1 -1
  105. package/src/skills/daydream/SKILL.md +1 -1
  106. package/src/skills/debug.md +2 -2
  107. package/src/skills/decode.md +1 -1
  108. package/src/skills/develop.md +6 -6
  109. package/src/skills/document-project.md +4 -4
  110. package/src/skills/domain-modeling.md +1 -1
  111. package/src/skills/drill.md +1 -1
  112. package/src/skills/feynman.md +1 -1
  113. package/src/skills/forge-mcp.md +3 -3
  114. package/src/skills/fresh-eyes.md +4 -4
  115. package/src/skills/frontend-design.md +1 -1
  116. package/src/skills/gap-detector.md +1 -1
  117. package/src/skills/geneseed-code-review.md +1 -1
  118. package/src/skills/geneseed.md +4 -4
  119. package/src/skills/git-archaeology.md +1 -1
  120. package/src/skills/git-rescue.md +3 -3
  121. package/src/skills/handoff.md +4 -4
  122. package/src/skills/herdr.md +1 -1
  123. package/src/skills/ingest.md +3 -3
  124. package/src/skills/learning-path.md +1 -1
  125. package/src/skills/migrate.md +5 -5
  126. package/src/skills/opencode-theme.md +1 -1
  127. package/src/skills/parallel-agents.md +2 -2
  128. package/src/skills/pipeline.md +2 -2
  129. package/src/skills/plan.md +2 -2
  130. package/src/skills/ponytail.md +1 -1
  131. package/src/skills/profile.md +1 -1
  132. package/src/skills/prose.md +2 -2
  133. package/src/skills/prototype.md +2 -2
  134. package/src/skills/refactor.md +2 -2
  135. package/src/skills/release.md +4 -4
  136. package/src/skills/repo-map.md +5 -5
  137. package/src/skills/research.md +6 -6
  138. package/src/skills/review-response.md +3 -3
  139. package/src/skills/roast-me.md +1 -1
  140. package/src/skills/rule.md +5 -5
  141. package/src/skills/ship.md +3 -3
  142. package/src/skills/tdd.md +2 -2
  143. package/src/skills/tickets.md +1 -1
  144. package/src/skills/wayfinder.md +1 -1
  145. package/src/skills/wiki.md +4 -4
  146. package/src/skills/workflow.md +2 -2
  147. package/themes/README.md +17 -7
  148. package/themes/_TEMPLATE.json +37 -36
  149. package/themes/biker.json +37 -36
  150. package/themes/commentator.json +37 -36
  151. package/themes/cyberpunk.json +37 -36
  152. package/themes/gamer.json +37 -36
  153. package/themes/imperial.json +37 -36
  154. package/themes/joker.json +37 -36
  155. package/themes/marvin.json +37 -36
  156. package/themes/mean.json +37 -36
  157. package/themes/military.json +37 -36
  158. package/themes/neutral.json +37 -36
  159. package/themes/pirate.json +37 -36
  160. package/themes/sports.json +37 -36
  161. package/themes/verstappen.json +37 -36
  162. package/themes/wizard.json +37 -36
  163. package/web/dist/assets/{About-BYXlmbyo.js → About-C0Mk0igT.js} +1 -1
  164. package/web/dist/assets/{Activity-us5MPf4u.js → Activity-C4aJJVXz.js} +1 -1
  165. package/web/dist/assets/{ActivityDetail-CiaQXUk2.js → ActivityDetail-DaQ85za0.js} +1 -1
  166. package/web/dist/assets/{Diff-Bh0qbZ2s.js → Diff-B3tlO2Yj.js} +1 -1
  167. package/web/dist/assets/{Doctor-BIlQME45.js → Doctor-BNC-5Dmo.js} +1 -1
  168. package/web/dist/assets/{Graph-4dYD1dPG.js → Graph-us0T6ZcV.js} +1 -1
  169. package/web/dist/assets/{Harnesses-PzYZ3LOC.js → Harnesses-DAMgyfM_.js} +1 -1
  170. package/web/dist/assets/Laws-rOxegJ75.js +1 -0
  171. package/web/dist/assets/{Library-CjMbksJW.js → Library-KmwrHA1J.js} +1 -1
  172. package/web/dist/assets/{Markdown-Bk81c3aZ.js → Markdown-0eQOVGSF.js} +1 -1
  173. package/web/dist/assets/{Profile-Curui_-j.js → Profile-ZU7WV6Xl.js} +1 -1
  174. package/web/dist/assets/{Rules-Bm283wdv.js → Rules-CtDoPhhf.js} +1 -1
  175. package/web/dist/assets/{Skills-gruqYuhl.js → Skills-BhoOxdkD.js} +1 -1
  176. package/web/dist/assets/{StatusBadge-EiM_FPqv.js → StatusBadge-CGvYVCwa.js} +1 -1
  177. package/web/dist/assets/{Themes-DU99j4Hr.js → Themes-Dr7OOkD7.js} +1 -1
  178. package/web/dist/assets/{activity-0rvQ6Vra.js → activity-B8aq3qtl.js} +1 -1
  179. package/web/dist/assets/index-2wqPDxuN.css +1 -0
  180. package/web/dist/assets/{index-0b2hobOo.js → index-AhMzkdbI.js} +1 -1
  181. package/web/dist/assets/index-CRftEtBX.js +12 -0
  182. package/web/dist/assets/{index-IiGFmCW_.js → index-D0lPN_qW.js} +1 -1
  183. package/web/dist/index.html +2 -2
  184. package/web/src/pages/Laws.jsx +282 -91
  185. package/web/dist/assets/Laws-DtZweXal.js +0 -1
  186. package/web/dist/assets/index-D5VY3TY_.js +0 -12
  187. package/web/dist/assets/index-DUCsDv7z.css +0 -1
package/SHIPPED.md CHANGED
@@ -20,7 +20,7 @@ historical pointers, not files distributed with the repo.
20
20
  > **On version numbers.** [`harness.config.json`](harness.config.json)'s `version` is a
21
21
  > human-readable label only. The canonical identity of an installed harness is the
22
22
  > **source fingerprint** stamped in `.geneseed-version` (see `geneseed version`), not the
23
- > string. Current label: **2.1.0**.
23
+ > string. Current label: **3.0.0**.
24
24
 
25
25
  > **Spec status audit (2026-06-15).** Every dated spec authored before today was
26
26
  > verified against the source tree and confirmed implemented (code + tests + docs);
@@ -35,7 +35,8 @@ Every row below is present in the tree today; "Spec" links the design record.
35
35
  | Capability | What it is | Spec |
36
36
  | --- | --- | --- |
37
37
  | **Themed generator** | One neutral `src/` → 14 themed bundles via `geneseed-build` (zero dependencies); structure stays theme-independent | [DESIGN.md](DESIGN.md) |
38
- | **Laws / Agents / Skills / Memory / Notebook** | 40 laws, 17 agents, 47 skills, the memory convention, and the agent's sovereign notebook | [notebook](docs/specs/2026-06-11-notebook-sovereign-space.md) · [agent-own-space](docs/specs/2026-06-10-notebook-agent-own-space.md) |
38
+ | **Laws / Agents / Skills / Memory / Notebook** | 9 laws, 17 agents, 47 skills, the memory convention, and the agent's sovereign notebook | [notebook](docs/specs/2026-06-11-notebook-sovereign-space.md) · [agent-own-space](docs/specs/2026-06-10-notebook-agent-own-space.md) |
39
+ | **Three-tier constitution** | The governance surface splits into an always-on **Ontology** (Telos, Evidence, Decisions, Conduct — the Pact absorbed into Telos), the nine always-on **Invariants**, and four toggleable **Doctrine** packs (craft, rigor, ops, process) addressed `<pack> <n>`. Packs are chosen at build time with `--doctrines` or the setup wizard; the whole catalogue ships on disk either way, so a citation into an inactive pack still resolves. Precedence, in order: Ontology + Invariants, then the user's `user-rules.md`, then the active Doctrines, then `PROFILE.md`. `doctor`'s `constitutionProblems` gates pack numbering, the per-rule Principle column, every `{{DOCTRINE}}` citation in `src/`, and the rule that an always-on tier may never cite a toggleable one | [three-tier-constitution](docs/specs/2026-08-19-three-tier-constitution-design.md) |
39
40
  | **`doctor`** | One check: unresolved tokens, dead/non-hermetic links, theme-key parity, authoring gates, rendered-bundle drift | [theme-aware doctor/diff](docs/specs/2026-06-07-theme-aware-doctor-diff.md) |
40
41
  | **`diff` + improvements export** | Deployed-vs-source drift report; export an `improvements.md` back-port | [improvements-export](docs/specs/2026-06-12-improvements-export.md) |
41
42
  | **`status` / `version`** | Headless dashboard + fingerprint verdict (no TUI needed) | [status-command](docs/specs/2026-06-07-status-command.md) · [version-and-uninstall](docs/specs/2026-06-07-version-and-uninstall.md) |
@@ -46,10 +47,10 @@ Every row below is present in the tree today; "Spec" links the design record.
46
47
  | **Per-agent memory** | Each capability agent keeps durable lessons in `memory/agents/<name>.md`: read at dispatch, written back mechanically by `learn` on session/subagent end (OpenCode plugin + claude/bob `SubagentStop`); `learn --consolidate` rebuilds the index | [orchestration-memory-upgrade](docs/specs/2026-07-04-orchestration-memory-upgrade.md) |
47
48
  | **Wiki integration** | Machine-wide knowledge base (`wiki.jsonc`): eager/lazy loading, conventions, protected folders enforced at the tool boundary | [wiki-knowledge-base](docs/specs/2026-06-11-wiki-knowledge-base.md) |
48
49
  | **Collaboration layer** | Negotiated postures (peer/mentor/expert/assistant/artisan, chosen at setup, inlined in AGENT.md), the bidirectional Pact, epistemically-typed memory (`force:` + Bridge rule), and a seed-once `PROFILE.md` identity with a web editor tab and a `profile` skill that interviews the user to draft it | [collaboration-layer](docs/specs/2026-07-12-collaboration-layer.md) |
49
- | **Rule front door** | Both durable stores enter through the `rule` skill's fork (*standing rule, or fact to remember?* — always asked, never inferred): the memory branch elicits the binding `force` and shows the file before writing, the rule branch pressure-tests by reformulation and a mandatory counter-example. Law VI carries the norm on every host; a `rule-gate` PreToolUse hook (Claude, Bob) and a `geneseed-guard` speed bump (OpenCode) hold it at the tool boundary | [rule-front-door](docs/specs/2026-07-30-rule-front-door.md) |
50
+ | **Rule front door** | Both durable stores enter through the `rule` skill's fork (*standing rule, or fact to remember?* — always asked, never inferred): the memory branch elicits the binding `force` and shows the file before writing, the rule branch pressure-tests by reformulation and a mandatory counter-example. Doctrine process 1 carries the norm on every host; a `rule-gate` PreToolUse hook (Claude, Bob) and a `geneseed-guard` speed bump (OpenCode) hold it at the tool boundary | [rule-front-door](docs/specs/2026-07-30-rule-front-door.md) |
50
51
  | **Entity registry** | `registry.json` records a lifecycle status, version, owner and add-date for every agent and skill in the tree (maintainer-side — never rendered into a bundle, so it costs no session context). `doctor` gates it against `src/` in both directions, sweeps everything that ships for credentials, and holds each vendored skill folder to an immutable upstream commit. The status surfaces as a badge in the web catalog, shown only where it deviates from `approved` | [entity-registry](docs/specs/2026-07-31-entity-registry.md) |
51
52
  | **Node runtime + npm package** | The whole harness runs from Node: every command `js/cli-table.json` declares, all four hook verbs, every web-console endpoint (the OS-native folder picker excepted, and declined on purpose) and both generators. Every commit runs the unit suite, `doctor --all` across every theme × host × footprint, and the generator's two self-comparisons, on Linux and Windows both; the frozen emit/cli/web recordings that also gated it retired on 2026-08-17 (`docs/limits.md`). It ships as the zero-dependency `geneseed` package (`geneseed`, `geneseed-hook`, `geneseed-build`), so `npx geneseed setup` needs no clone and nothing else installed; `geneseed migrate` moves an existing checkout install across. Node is the only runtime it asks for: the `token-report` skill's own script is `token_report.mjs`, gated over seeded transcripts for all four hosts, and `daydream` and `herdr` call `node -e` | [npx-distribution](docs/specs/2026-08-06-npx-distribution.md) |
52
- | **Runtime awareness** | MCP discovery, web research, tool-call batching, review discipline baked into the laws | [runtime-awareness](docs/specs/2026-06-07-runtime-awareness-and-review-discipline.md) |
53
+ | **Runtime awareness** | MCP discovery, web research, tool-call batching, review discipline — carried by the doctrine packs (`ops 1` tool discovery, `process 4` read the docs first, `rigor 2`/`rigor 3` honest tests and cover-and-verify), not by the invariants | [runtime-awareness](docs/specs/2026-06-07-runtime-awareness-and-review-discipline.md) |
53
54
  | **Run from anywhere / uninstall** | `link`/`unlink` onto PATH; global uninstall that keeps the memory store | [version-and-uninstall](docs/specs/2026-06-07-version-and-uninstall.md) |
54
55
 
55
56
  ## Workplans (not features)
@@ -65,9 +65,9 @@ project-bypasses-global need. An older Bob install that wrote a stale exclude is
65
65
  ## Hooks — best-effort
66
66
 
67
67
  The `settings.json` hooks use the **Claude dialect** (a `PreToolUse:Bash`
68
- git-gate for Rule XX consent, `SessionStart` context injection, and
69
- `Stop`/`SubagentStop` learn/memory capture — the same three `harness.py`
70
- subcommands the OpenCode plugins drive). Bob's hook execution is **unverified**:
68
+ git-gate for Doctrine process 5 consent — present only when the `process` pack is
69
+ built in — `SessionStart` context injection, and `Stop`/`SubagentStop` learn/memory
70
+ capture, the same `geneseed-hook` subcommands the OpenCode plugins drive). Bob's hook execution is **unverified**:
71
71
  if Bob honours Claude-shaped hooks they fire; if not, they are inert and the
72
72
  harness still works fully through the `AGENTS.md`/`rules` preamble prose. This is
73
73
  the same behaviour-contract parity every non-OpenCode host gets — the mechanism
@@ -14,8 +14,10 @@ bin/geneseed-hook.mjs …` — so at user scope they would fire and fail in ever
14
14
  repo that doesn't vendor the harness. A generated global install wires
15
15
  absolute-path hooks instead — `geneseed setup` does that for you.) It:
16
16
 
17
- - on **PreToolUse** (matcher `Bash`), runs `harness git-gate` — a tool-boundary
18
- backstop for Rule XX (*consent before every commit and push*). The hook inspects the
17
+ - on **PreToolUse** (matcher `Bash`), **on an install that built the `process` pack in**,
18
+ runs `harness git-gate` — the tool-boundary half of Doctrine process 5 (*consent before
19
+ every commit and push*). Drop that pack and this hook is not written at all; the
20
+ invariant-territory refusals (`rm -rf`, force-push) stay in every build. The hook inspects
19
21
  command and, when it runs a `git commit` or `git push` (bare, flagged, `-C <path>`,
20
22
  or chained like `git add . && git commit … && git push`), returns
21
23
  `permissionDecision: "ask"` so Claude Code **prompts on every such call**. Crucially
@@ -31,7 +33,7 @@ absolute-path hooks instead — `geneseed setup` does that for you.) It:
31
33
  doesn't recognise as a commit/push, so over-matching the tool surface is harmless.
32
34
  - on **SessionStart** (`startup`/`clear` only — a fresh context), prints `AGENT.md`
33
35
  so the harness is in context from the first turn, then runs `harness context` to
34
- **inject the project context** directly into the session — so Rule XVIII is enforced
36
+ **inject the project context** directly into the session — so the project-context load is
35
37
  by the hook, not left to the agent to remember (lazy entries are only listed). On
36
38
  **`resume`** it runs `harness context` *without* re-`cat`ting `AGENT.md`: the resumed
37
39
  conversation already carries the harness, so re-injecting the static file each resume
@@ -59,7 +61,7 @@ absolute-path hooks instead — `geneseed setup` does that for you.) It:
59
61
  Adjust the paths if your harness bundle is not at the repository root. On Windows
60
62
  the commands are identical (`node bin/geneseed-hook.mjs …`).
61
63
 
62
- Why inject rather than instruct? Rule XVIII tells the agent to read the project
64
+ Why inject rather than instruct? The constitution tells the agent to read the project
63
65
  context at startup, but startup rituals are exactly what agents skip. The
64
66
  `harness context` hook removes the choice: the eager files' contents land in
65
67
  context before the first turn regardless of agent discipline. On tools without
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: geneseed
3
- description: "Interact with a deployed Geneseed harness from any repo — locate the install, read its laws/agents/skills/memory/notebook by name, run status/doctor/diff, distill memory with learn, and manage the local web UI. Use when the user mentions Geneseed, AGENT.md, the harness, an agent operating system, or asks you to inspect, refresh, or read from the deployed bundle."
3
+ description: "Interact with a deployed Geneseed harness from any repo — locate the install, read its ontology/rules/doctrines/agents/skills/memory/notebook by name, run status/doctor/diff, distill memory with learn, and manage the local web UI. Use when the user mentions Geneseed, AGENT.md, the harness, an agent operating system, or asks you to inspect, refresh, or read from the deployed bundle."
4
4
  ---
5
5
 
6
6
  # geneseed — agent skill
7
7
 
8
- Geneseed is a portable AI-agent harness deployed once and used everywhere. This skill lets you talk to whichever deployment is in scope from any repo: read the canonical files (laws, agents, skills, memory, notebook), probe state (status, version, doctor, diff), distill durable memory, and drive the local web UI. The harness is theme-independent in structure — directory and section names are always plain English — so the paths below are stable across themes.
8
+ Geneseed is a portable AI-agent harness deployed once and used everywhere. This skill lets you talk to whichever deployment is in scope from any repo: read the canonical files (the three constitution tiers, agents, skills, memory, notebook), probe state (status, version, doctor, diff), distill durable memory, and drive the local web UI. The harness is theme-independent in structure — directory and section names are always plain English — so the paths below are stable across themes.
9
9
 
10
10
  ## Find the deployed harness before doing anything
11
11
 
@@ -19,7 +19,9 @@ Pick the first that resolves; remember the path for the rest of the session.
19
19
 
20
20
  If none resolve, the user does not have Geneseed deployed here — say so and stop. Do not run `setup`, `build`, or `upgrade` on your own to "fix" this; that is a user decision.
21
21
 
22
- A live harness root contains: `AGENT.md`, `agents/<name>.md`, `skills/<name>/SKILL.md`, `memory/MEMORY.md`, `notebook/NOTEBOOK.md`, `themes/`, and (on OpenCode) `plugins/`, `workflows/`, `opencode.jsonc`, `wiki.jsonc`. Laws live as numbered sections inside `AGENT.md`, not as separate files in the deployed bundle — read them from `AGENT.md` directly.
22
+ A live harness root contains: `AGENT.md`, `ontology/universal.md`, `laws/universal.md`, `doctrines/<pack>.md`, `agents/<name>.md`, `skills/<name>/SKILL.md`, `memory/MEMORY.md`, `notebook/NOTEBOOK.md`, `themes/`, and (on OpenCode) `plugins/`, `workflows/`, `opencode.jsonc`, `wiki.jsonc`.
23
+
24
+ The constitution is **three tiers**: an always-on **Ontology** (four prose sections — Telos, Evidence, Decisions, Conduct), nine always-on **Rules** numbered I–IX, and the **Doctrines** — practice packs (`craft`, `rigor`, `ops`, `process`) chosen per install at build time. `AGENT.md` carries all three inline (whole at the `full` footprint, heading-plus-first-line at `lean`), *and* the complete text ships as files beside it. All four pack files ship even when a pack was not built in, so a citation into an inactive pack still resolves on disk — which is why a question about a rule is answered from the tier file, never only from `AGENT.md`.
23
25
 
24
26
  ## Read-only verbs (safe, no confirmation needed)
25
27
 
@@ -32,11 +34,13 @@ A live harness root contains: `AGENT.md`, `agents/<name>.md`, `skills/<name>/SKI
32
34
  - **Read a specific piece** — read the file directly:
33
35
  - Agent by name: `<harness>/agents/<name>.md`
34
36
  - Skill by name: `<harness>/skills/<name>/SKILL.md`
35
- - Law by number: section `## N. …` inside `<harness>/AGENT.md`
37
+ - Ontology section by name: `<harness>/ontology/universal.md` — `#### Telos` / `Evidence` / `Decisions` / `Conduct` (theme-independent names)
38
+ - Rule by numeral I–IX: `<harness>/laws/universal.md` — heading `### <Rule-noun> <ROMAN> — <title>`
39
+ - Doctrine rule by pack and number: `<harness>/doctrines/<pack>.md` — heading `### <Doctrine-noun> <pack> <n> — <title>`
36
40
  - Memory fact: `<harness>/memory/<file>.md`; index at `MEMORY.md`
37
41
  - Notebook entry: `<harness>/notebook/<file>.md`; index at `NOTEBOOK.md`
38
42
 
39
- When the user asks "what does the X skill say" or "what's law VI", read the file directly — do not summarise from memory.
43
+ When the user asks "what does the X skill say", "what's Rule VI" or "what does Doctrine process 5 say", read the file directly — do not summarise from memory.
40
44
 
41
45
  ## Side-effecting verbs (confirm with the user first)
42
46
 
@@ -59,7 +63,7 @@ If the user asks for any of these, run them as requested. Do not run them as a s
59
63
  ## Common patterns
60
64
 
61
65
  - **"What harness do I have here?"** — `geneseed status` (if launcher on PATH); else resolve via the fallback list and report theme, install mode, path, and version.
62
- - **"What does the `<X>` skill / agent / law say?"** — read the file directly. For laws, grep `AGENT.md` for `## N\.` or `Law N`.
66
+ - **"What does the `<X>` skill / agent / rule say?"** — read the file directly. A Rule is `### <Rule-noun> <ROMAN> —` in `laws/universal.md`; a doctrine rule is `### <Doctrine-noun> <pack> <n> —` in `doctrines/<pack>.md`; an ontology section is `#### <Name>` in `ontology/universal.md`. The tier noun is themed, the address never is.
63
67
  - **"Show me what's drifted in my install."** — `geneseed diff`. Offer to write the output to a file (`--out`) if it's long.
64
68
  - **"Distill what we did today into memory."** — confirm scope, then `geneseed learn`. Afterwards, `git status` inside the harness dir to show what landed.
65
69
  - **"Open the dashboard / web UI."** — `geneseed web start`. Tell the user the URL it printed and that it binds to localhost only.
@@ -43,12 +43,12 @@ page is mostly about *what it does not automate* and why the harness still holds
43
43
  Copilot has **no `settings.json` and no lifecycle-hook mechanism**, so the whole
44
44
  settings/hooks/excludes stage is skipped. Concretely, Copilot does **not** get:
45
45
 
46
- - **automated context injection** — Rule XVIII's project-context load falls back
46
+ - **automated context injection** — the project-context load falls back
47
47
  to the preamble instructing the agent to read the docs itself;
48
48
  - **automated memory / learn write-back** — no `Stop`/`SubagentStop` hook; the
49
49
  memory convention rides the preamble's instructions (the agent writes its own
50
50
  memories) rather than a session-end distiller;
51
- - **the git-gate consent backstop** — Rule XX (*consent before every commit and
51
+ - **the git-gate consent backstop** — Doctrine process 5 (*consent before every commit and
52
52
  push*) is enforced by the **preamble prose only**, not at the tool boundary.
53
53
  There is no hook to force the prompt;
54
54
  - **sovereign-repo excludes** — Copilot documents no exclude/shadow mechanism
@@ -58,8 +58,9 @@ settings/hooks/excludes stage is skipped. Concretely, Copilot does **not** get:
58
58
  installs already exist.
59
59
 
60
60
  None of this is a build gap — it is Copilot's ceiling. The harness still applies
61
- in full: every Rule, agent, and skill is present; only the *automation* of a few
62
- Rules degrades to instruction-only. This is behaviour-contract parity, the same
61
+ in full: the Ontology, every Rule, every doctrine rule the install built in, and
62
+ every agent and skill are present; only the *automation* of a few of them degrades
63
+ to instruction-only. This is behaviour-contract parity, the same
63
64
  principle every non-OpenCode host follows.
64
65
 
65
66
  ## MCP
@@ -190,7 +190,7 @@ enforcement paths read the same. Adds a machine marker (first line) for §4.
190
190
 
191
191
  ```
192
192
  <!-- geneseed-context:v2 -->
193
- === PROJECT CONTEXT — binding for this repo per Law XVIII ===
193
+ === PROJECT CONTEXT — binding for this repo ===
194
194
 
195
195
  ----- <path> — <description> -----
196
196
  <full file contents, trailing newlines stripped>
@@ -204,7 +204,7 @@ enforcement paths read the same. Adds a machine marker (first line) for §4.
204
204
  - [demoted: README.md exceeded 16 KB — read on demand]
205
205
  ```
206
206
 
207
- - Header keeps the exact `=== PROJECT CONTEXT … Law XVIII ===` wording.
207
+ - Header keeps the exact `=== PROJECT CONTEXT — binding for this repo ===` wording.
208
208
  - A `MISSING` eager file emits `[context] MISSING eager file: <err>` inline (as today).
209
209
  - The `<!-- geneseed-context:v2 -->` marker is the idempotency sentinel.
210
210
 
@@ -269,12 +269,17 @@ exactly one copy and the setup guide (§10) removes project copies. Document thi
269
269
 
270
270
  ---
271
271
 
272
- ## 8. Fallback Law (for tools without the plugin)
272
+ ## 8. Fallback rule (for tools without the plugin)
273
273
 
274
- Add to the universal laws so non-OpenCode tools and uncovered repos still get
275
- project context — the *instruction* tier behind the *injection* tier:
274
+ ⚠ HISTORICAL. This was written when the corpus was a flat, open-ended list of laws.
275
+ It is not one now: the invariants are a closed set of nine, and project-context
276
+ discovery is one of the two old laws absorbed into AGENT.md's own **§9 Context**
277
+ section, which every build carries as prose. Nothing an adapter spec writes is
278
+ added to the invariants. The text below survives as the *instruction* tier behind
279
+ the *injection* tier, and `{{DOCTRINE}} process 4` (Read the Docs First) is its
280
+ nearest live citation:
276
281
 
277
- > **Law (Project Context Discovery).** When project context has not already been
282
+ > **Rule (Project Context Discovery).** When project context has not already been
278
283
  > injected, before substantive work read the repo's agent-directed rules and entry
279
284
  > docs — `AGENTS.md`/`AGENT.md`/`CLAUDE.md`, root `README.md`, and any `.harness/`
280
285
  > manifest — and treat `docs/`, `adr/`, and architecture notes as lazy: consult
@@ -30,7 +30,7 @@ rules. It accepts:
30
30
  - globs (`"laws/*.md"`),
31
31
  - URLs.
32
32
 
33
- Geneseed points it at the bundle's **`AGENT.md`** (which inlines the laws). That is
33
+ Geneseed points it at the bundle's **`AGENT.md`** (which inlines all three constitution tiers — the Ontology, the nine Rules and the active doctrine packs; at the default `lean` footprint the rules are heading-plus-first-line, with the complete text in `ontology/`, `laws/` and `doctrines/` beside it). That is
34
34
  all you need there — the rest of the harness is loaded by the plugins below.
35
35
 
36
36
  ## 3. Plugins — event-driven JS/TS
@@ -181,7 +181,7 @@ docs with an `eager`/`lazy` split. The
181
181
  On `session.created` it **auto-discovers the current repo's docs by convention**
182
182
  and injects the `eager` ones into the session via a no-reply prompt
183
183
  (`session.prompt({ noReply: true })`) — so they're in context before your first
184
- turn, enforcing **Law XVIII** by injection, not agent discipline. This is what lets
184
+ turn, enforcing the project-context load by injection, not agent discipline. This is what lets
185
185
  the harness live entirely in the global config dir with zero per-repo files.
186
186
 
187
187
  - **Eager** (injected in full, budget-capped): root `AGENTS.md`/`AGENT.md`/
@@ -200,11 +200,11 @@ the harness live entirely in the global config dir with zero per-repo files.
200
200
  hard guarantee is still a single install: OpenCode dedups plugins by npm
201
201
  name+version only, so two local copies both load.)
202
202
  - **Survives compaction:** on the experimental `session.compacting` hook it re-pushes
203
- the eager docs into the compaction context, so the project context (Law XVIII)
203
+ the eager docs into the compaction context, so the project context
204
204
  persists when a long session is summarised. The `AGENT.md` rules already survive —
205
205
  they load via `instructions`, not the conversation — so only the injected project
206
206
  context needs re-pushing.
207
- - **Machine wiki (AGENT.md §7):** the same block carries a `MACHINE WIKI` segment
207
+ - **Machine wiki (AGENT.md §8):** the same block carries a `MACHINE WIKI` segment
208
208
  for the user's own knowledge base(s) — typically an Obsidian vault — declared in
209
209
  `wiki.jsonc` (`$GENESEED_WIKI` → `$GENESEED_HARNESS/wiki.jsonc` → beside the
210
210
  install). Per wiki: eager entries inject in full, lazy entries list, and the
@@ -381,7 +381,7 @@ behaviour** — nothing changes the machine's current agent/model unless you opt
381
381
  - **Runtime guard plugin** (`geneseed-guard.js`, installed with the others). Enforces
382
382
  the safety Laws at the tool boundary: **blocks** writes to private-key/credential
383
383
  files (Law I), catastrophic shell like `rm -rf /` (Law IV), and any mutation under
384
- a declared wiki's `protected` folders (AGENT.md §7, from `wiki.jsonc`); **warns** on
384
+ a declared wiki's `protected` folders (AGENT.md §8, from `wiki.jsonc`); **warns** on
385
385
  `.env` writes and force-push. `GENESEED_GUARD=off` disables it, `=warn` downgrades
386
386
  blocks to warnings.
387
387
  - **Invisible context injection** (the default). The context plugin delivers via
@@ -390,10 +390,15 @@ behaviour** — nothing changes the machine's current agent/model unless you opt
390
390
  auto-falls back to the visible `session.created` message. `GENESEED_CONTEXT_VISIBLE=1`
391
391
  forces the visible block (legacy `GENESEED_CONTEXT_TRANSFORM=0/off` does the same).
392
392
  - **Default permissions.** A fresh `opencode.json` gets a minimal policy that **asks**
393
- before `rm -rf *` and **every `git commit` and `git push`** (the host-level backstop
394
- for the consent-before-commit/push Rule — the agent never records or shares code
395
- unprompted, on any branch; force-push is also called out explicitly). Added only when
396
- you have no `permission` key — an existing policy is never touched. Routine local work
393
+ before `rm -rf *` and a force-push — those are **Rule IV**'s territory and are in every
394
+ build — and, **on an install that built the `process` pack in**, before every
395
+ `git commit` and `git push` (the host-level backstop for **Doctrine process 5**: the
396
+ agent never records or shares code unprompted, on any branch). Build with
397
+ `--doctrines` leaving `process` out and those two entries are simply not written.
398
+ The whole block is added only when you have no `permission` key; an existing policy is
399
+ reconciled key by key — Geneseed adds back what a returning pack wants and **never
400
+ removes** an entry, because it cannot tell its own from one you typed, so a pack-off
401
+ rebuild leaves a `git commit*` you already have in place and reports it instead. Routine local work
397
402
  (edits, builds, tests) is unaffected; to allow frictionless commits/pushes, set
398
403
  `"git commit*"` / `"git push*"` to `"allow"` in your own `permission.bash` map. (Note:
399
404
  OpenCode lets a user pick "always allow" for the session, which makes the gate
@@ -521,7 +526,8 @@ install `jsonc-parser` yourself — you lose OCX's dependency management and
521
526
  auto-updates, and you own the upgrade-by-re-copy. Prefer the OCX path.
522
527
 
523
528
  **Consent note.** `worktree_delete` auto-commits before removal. The harness's
524
- consent-before-commit Rule is enforced for *shell* `git commit` via `opencode.json`
529
+ consent-before-commit rule (**Doctrine process 5**, when the `process` pack is built in)
530
+ is enforced for *shell* `git commit` via `opencode.json`
525
531
  permissions, but this plugin commits through its own tool path — so review what it
526
532
  will commit before invoking delete, or keep the worktree and commit yourself.
527
533
 
@@ -21,5 +21,5 @@ yourself: decompose into independent subtasks, route each to the single owning s
21
21
  above, and converge the results yourself. Prefer the saved `dispatch` workflow when the
22
22
  `workflow` tool is available; otherwise follow the parallel-agents Skill. Every handoff
23
23
  carries an envelope — the subtask goal, the inputs the agent needs, its output contract —
24
- and the constraints travel with it: subagents never commit or push (Law XX stays with
24
+ and the constraints travel with it: subagents never commit or push (Doctrine process 5 stays
25
25
  you), and an unfulfilled contract comes back as a stated gap, never invented content.
@@ -1,6 +1,6 @@
1
1
  // Geneseed — OpenCode project-context plugin (v2, convention-glob).
2
2
  //
3
- // Enforces Law XVIII ("Load the Project Context") by INJECTION, not instruction:
3
+ // Enforces the project-context rule ("Load the Project Context") by INJECTION, not instruction:
4
4
  // on `session.created` it puts the repo's documentation in context before your
5
5
  // first turn, rather than trusting the agent to read it. v2 removes the need for a
6
6
  // committed `context.json` — it AUTO-DISCOVERS the current repo's docs by
@@ -26,7 +26,7 @@
26
26
  // $GENESEED_MODEL), so the agent reasons within its real limits. The model line
27
27
  // is added per request, outside the cached block; unknown -> omitted.
28
28
  //
29
- // MACHINE WIKI (AGENT.md §7): the same block also carries the user's own knowledge
29
+ // MACHINE WIKI (AGENT.md §8): the same block also carries the user's own knowledge
30
30
  // base(s) — typically an Obsidian vault — declared once per machine in `wiki.jsonc`
31
31
  // ($GENESEED_WIKI -> $GENESEED_HARNESS/wiki.jsonc -> beside this plugin's install).
32
32
  // Each wiki's eager entries inject in full and lazy entries list, drawing on the
@@ -484,7 +484,7 @@ async function resolveSource(root) {
484
484
 
485
485
  // ---- machine wiki (wiki.jsonc) --------------------------------------------------
486
486
  // The user's own knowledge base(s) — typically an Obsidian vault — declared once per
487
- // machine, not per repo (AGENT.md §7). Same injection mechanics as project context,
487
+ // machine, not per repo (AGENT.md §8). Same injection mechanics as project context,
488
488
  // different scope. Resolution (first match wins, mirroring the learn plugin):
489
489
  // 1. $GENESEED_WIKI explicit manifest path
490
490
  // 2. $GENESEED_HARNESS/wiki.jsonc pinned install dir
@@ -675,8 +675,8 @@ async function buildBlock(sets, wikis = [], commands = []) {
675
675
 
676
676
  if (!proj.length && !wik.length) return null
677
677
  const out = [MARKER]
678
- if (proj.length) out.push("=== PROJECT CONTEXT — binding for this repo per Law XVIII ===", "", ...proj)
679
- if (wik.length) out.push("=== MACHINE WIKI — the user's knowledge base, binding per AGENT.md §7 ===", "", ...wik)
678
+ if (proj.length) out.push("=== PROJECT CONTEXT — binding for this repo ===", "", ...proj)
679
+ if (wik.length) out.push("=== MACHINE WIKI — the user's knowledge base, binding per AGENT.md §8 ===", "", ...wik)
680
680
  return { text: out.join("\n"), injected: state.injected, lazy: state.lazy, kb: kb(state.spent) }
681
681
  }
682
682
 
@@ -820,8 +820,8 @@ export const GeneseedContext = async (ctx) => {
820
820
  // Survive compaction. The visible injection above is a conversation message, so
821
821
  // OpenCode summarises it away when a long session compacts (the AGENT.md rules
822
822
  // persist — they load via opencode.json `instructions`, not the conversation).
823
- // Re-push the eager docs into the compaction context so the project context —
824
- // Law XVIII — outlives the summary. Only needed when delivery is visible
823
+ // Re-push the eager docs into the compaction context so the project context
824
+ // outlives the summary. Only needed when delivery is visible
825
825
  // (forced or fallback); the transform re-sends per request. Experimental
826
826
  // OpenCode hook; if it is absent in a build this key is simply never called.
827
827
  "experimental.session.compacting": async (_input, output) => {
@@ -4,9 +4,9 @@
4
4
  // "enforce by injection, don't just instruct" stance as the context plugin:
5
5
  // - Law I (Sealed Secrets): block writes to private-key / credential files.
6
6
  // - Law IV (Deletion Is Deliberate): block catastrophic shell commands.
7
- // - Law VI (rule vs memory): speed-bump the first write to user-rules.md or a
7
+ // - Doctrine process 1 (rule vs memory): speed-bump the first write to user-rules.md
8
8
  // memory file — that choice belongs to the user, via the rule skill.
9
- // - Wiki (AGENT.md §7): block mutations under a declared wiki's `protected`
9
+ // - Wiki (AGENT.md §8): block mutations under a declared wiki's `protected`
10
10
  // folders — the user's knowledge base sets its own no-go zones in wiki.jsonc.
11
11
  // High-confidence patterns only, so legitimate work is never caught. Borderline cases
12
12
  // (.env edits, force-push) are WARNED, not blocked.
@@ -114,7 +114,7 @@ const WRITE_TOOLS = ["write", "edit", "patch", "create", "save", "insert", "repl
114
114
  const SHELL_TOOLS = ["bash", "shell", "exec", "command", "terminal", "run"]
115
115
  const hasAny = (name, parts) => parts.some((s) => name.includes(s))
116
116
 
117
- // ---- protected wiki folders (AGENT.md §7) --------------------------------------
117
+ // ---- protected wiki folders (AGENT.md §8) --------------------------------------
118
118
  // wiki.jsonc (the machine-level knowledge-base manifest) may list `protected` folders
119
119
  // per wiki. Mutating anything under one is denied. Same resolution chain as the
120
120
  // context plugin: $GENESEED_WIKI -> $GENESEED_HARNESS/wiki.jsonc -> beside the install.
@@ -207,7 +207,7 @@ async function protectedPrefixes() {
207
207
  return prefixes
208
208
  }
209
209
 
210
- // ---- the rule / memory stores (Law VI) -----------------------------------------
210
+ // ---- the rule / memory stores (Doctrine process 1) -----------------------------
211
211
  // Whether something the user wants kept is a standing rule or a durable fact is THEIR
212
212
  // call, settled through the rule skill. `tool.execute.before` can only allow or throw —
213
213
  // it has no "ask the user" tier like the Claude/Bob rule-gate hook —
@@ -257,7 +257,7 @@ export const GeneseedGuard = async () => {
257
257
  if (store && !RULE_STORE_BUMPED.has(p)) {
258
258
  RULE_STORE_BUMPED.add(p)
259
259
  deny(`writing to ${store} — a standing rule, or a fact to remember? That ` +
260
- `choice is the user's (Law VI). Settle it through the rule skill, ` +
260
+ `choice is the user's (Doctrine process 1). Settle it through the rule skill, ` +
261
261
  `then re-issue this write`)
262
262
  return
263
263
  }
@@ -268,7 +268,7 @@ export const GeneseedGuard = async () => {
268
268
  const abs = (path.isAbsolute(p) ? p : path.resolve(p)).replace(/\\/g, "/").toLowerCase()
269
269
  const hit = (await protectedPrefixes()).find(
270
270
  (x) => abs.startsWith(x.prefix) || abs === x.prefix.slice(0, -1))
271
- if (hit) { deny(`mutation in protected wiki folder — ${hit.label} (AGENT.md §7)`); return }
271
+ if (hit) { deny(`mutation in protected wiki folder — ${hit.label} (AGENT.md §8)`); return }
272
272
  }
273
273
  }
274
274
  // NOT else-if: a compound tool name (e.g. exec_and_save) can match both
@@ -3,7 +3,7 @@
3
3
  //
4
4
  // The model-driven fallback is the parallel-agents skill; this runs the same
5
5
  // shape on rails: the script, not the model, enforces routing and the handoff
6
- // envelope (context in, output contract back, no commits — Law XX stays with
6
+ // envelope (context in, output contract back, no commits — Doctrine process 5 stays with
7
7
  // the caller).
8
8
  //
9
9
  // args: { goal: string, context?: string, agents?: string[] }
package/bin/geneseed.mjs CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  // P5d moved these out of this file for the reason P5c moved the host resolvers: `harness
53
53
  // status` renders to count, so `bin/geneseed-cli.mjs` needs the same checkout paths and the
54
54
  // same cfg. golden.py's 259 cells all build one, which is what made the move safe.
55
- import { ROOT, CONFIG, THEMES, discoverNames, makeCfg } from '../js/checkout.mjs';
55
+ import { ROOT, CONFIG, THEMES, discoverNames, makeCfg, PACK_ORDER } from '../js/checkout.mjs';
56
56
 
57
57
  // P5f moved these, for the same arithmetic a third time: `harness rebuild-all` reads the
58
58
  // registry to find every install it must re-emit, and a CLI verb may not reach into a driver
@@ -122,7 +122,9 @@ export function resolveOut(raw) {
122
122
  * byte-for-byte by `tests/golden.py` (:316).
123
123
  */
124
124
  function configDefaults() {
125
- const d = { theme: 'neutral', posture: 'peer', mode: 'direct' };
125
+ const d = {
126
+ theme: 'neutral', posture: 'peer', mode: 'direct', doctrines: [...PACK_ORDER],
127
+ };
126
128
  if (!existsSync(CONFIG)) return d;
127
129
  try {
128
130
  const data = JSON.parse(readFileSync(CONFIG, 'utf8'));
@@ -130,6 +132,20 @@ function configDefaults() {
130
132
  if (data.theme !== undefined) d.theme = data.theme;
131
133
  if (data.posture !== undefined) d.posture = data.posture;
132
134
  if (data.mode !== undefined) d.mode = data.mode;
135
+ // `doctrines` is the only config key that is a LIST, so it is the only one that can be
136
+ // the right type and still nonsense. A bad value warns and falls back to all packs
137
+ // rather than dying: this file is hand-editable, and a typo here must not brick every
138
+ // rebuild of an install whose AGENT.md is otherwise fine. `[]` is a legitimate value
139
+ // (no packs) and must survive the check — hence an explicit Array test, not truthiness.
140
+ if (data.doctrines !== undefined) {
141
+ const known = discoverNames('doctrines', PACK_ORDER[0]);
142
+ if (Array.isArray(data.doctrines) && data.doctrines.every((x) => known.includes(x))) {
143
+ d.doctrines = PACK_ORDER.filter((p) => data.doctrines.includes(p));
144
+ } else {
145
+ process.stderr.write(`[geneseed] WARN: ${path.basename(CONFIG)} "doctrines" is not a `
146
+ + 'list of known pack names — using all packs.\n');
147
+ }
148
+ }
133
149
  }
134
150
  } catch {
135
151
  process.stderr.write(`[geneseed] WARN: ${path.basename(CONFIG)} is unreadable — `
@@ -146,6 +162,7 @@ function configDefaults() {
146
162
  */
147
163
  const VALUED = {
148
164
  '--theme': 'theme', '--posture': 'posture', '--mode': 'mode',
165
+ '--doctrines': 'doctrines',
149
166
  '--out': 'out', '--target': 'out', '--emit': 'emit',
150
167
  '--footprint': 'footprint', '--root': 'root',
151
168
  };
@@ -160,6 +177,13 @@ const FLAGS = {
160
177
  * A function and not a constant because two of the four read the checkout: `discoverNames`
161
178
  * scans `postures/` and `modes/`, so the answer depends on the source tree this driver is
162
179
  * standing in and cannot be frozen at import.
180
+ *
181
+ * `--doctrines` is DELIBERATELY not a fifth row. Every consumer of this table treats an
182
+ * entry as one value drawn from a closed list — `choice` refuses anything else, and
183
+ * `usage`'s metavar prints the list as the whole legal surface. `--doctrines` takes a comma
184
+ * LIST plus the sentinel `none`, so a row here would have refused `craft,rigor` outright and
185
+ * advertised a metavar that lies. It is validated by `parseDoctrines` instead and prints the
186
+ * plain `DOCTRINES` metavar, exactly as `--theme` (also open-ended) already does.
163
187
  */
164
188
  function choicesFor() {
165
189
  return {
@@ -170,6 +194,33 @@ function choicesFor() {
170
194
  };
171
195
  }
172
196
 
197
+ /**
198
+ * `--doctrines craft,rigor` / `--doctrines none` -> the cfg's pack array.
199
+ *
200
+ * Normalised into `PACK_ORDER` rather than kept in the order typed, which also dedupes: the
201
+ * rendered `Active packs:` line is a MARKER a later reader parses back out of a deployed
202
+ * carrier, and a marker whose contents depend on argument order is one that compares unequal
203
+ * to itself. Validation is against DISCOVERY, not `PACK_ORDER`, so the refusal names the
204
+ * packs the checkout actually has; a discovered pack missing from `PACK_ORDER` is a
205
+ * different fault and `js/render.mjs` refuses the whole build for it.
206
+ */
207
+ function parseDoctrines(value) {
208
+ const s = value.trim();
209
+ const known = discoverNames('doctrines', PACK_ORDER[0]);
210
+ if (s === 'none') return [];
211
+ const names = s.split(',').map((x) => x.trim()).filter(Boolean);
212
+ if (!names.length) {
213
+ die(2, "argument --doctrines: expected a comma-separated list of packs, or 'none'");
214
+ }
215
+ for (const n of names) {
216
+ if (!known.includes(n)) {
217
+ die(2, `argument --doctrines: invalid choice: '${n}' (choose from `
218
+ + `${known.map((c) => `'${c}'`).join(', ')}, or 'none')`);
219
+ }
220
+ }
221
+ return PACK_ORDER.filter((p) => names.includes(p));
222
+ }
223
+
173
224
  /**
174
225
  * `-h/--help` — the flag argparse handed the reference for free and this hand-rolled parser
175
226
  * did not, so the two entry points disagreed: the reference printed usage and exited 0 while
@@ -212,6 +263,7 @@ function usage() {
212
263
  function parseArgs(argv, defaults) {
213
264
  const args = {
214
265
  theme: defaults.theme, posture: defaults.posture, mode: defaults.mode,
266
+ doctrines: defaults.doctrines,
215
267
  out: 'Harness', emit: 'files', footprint: 'lean', root: null,
216
268
  syncThemes: false, validateOnly: false, verbose: false,
217
269
  };
@@ -241,6 +293,9 @@ function parseArgs(argv, defaults) {
241
293
  }
242
294
  const choices = choicesFor();
243
295
  for (const flag of Object.keys(choices)) choice(flag, args[VALUED[flag]], choices[flag]);
296
+ // Only when the flag was actually PASSED is this a string; left at its default it is
297
+ // already the array `configDefaults` built, and re-parsing an array would stringify it.
298
+ if (typeof args.doctrines === 'string') args.doctrines = parseDoctrines(args.doctrines);
244
299
  return args;
245
300
  }
246
301
 
@@ -897,9 +952,14 @@ const PROJECT_EMITS = {
897
952
  opencode: emitOpencode,
898
953
  };
899
954
 
900
- export function emitProjectInto(host, { theme, out, root, footprint = 'full' }) {
955
+ export function emitProjectInto(host, { theme, out, root, footprint = 'full', doctrines = null }) {
901
956
  const emit = PROJECT_EMITS[host];
902
- return withPyNewlines(() => emit(makeCfg(), { theme, footprint, root }, out));
957
+ // `doctrines` rides the same rail posture and mode ride into `emitGlobalInto`, and for the
958
+ // same reason: a drift reader that renders `expected` at the DEFAULT pack set reports the
959
+ // whole doctrines section as edited on every narrowed install. `null` means "no opinion" and
960
+ // `makeCfg` renders all four, which is what every validation caller wants.
961
+ return withPyNewlines(() => emit(makeCfg(doctrines ? { doctrines } : {}),
962
+ { theme, footprint, root }, out));
903
963
  }
904
964
 
905
965
  /**
@@ -917,7 +977,7 @@ export function buildInto({ theme, out, footprint = 'lean' }) {
917
977
  }
918
978
 
919
979
  export function emitGlobalInto(host, {
920
- theme, out, cfgDir, footprint, posture = null, mode = null,
980
+ theme, out, cfgDir, footprint, posture = null, mode = null, doctrines = null,
921
981
  }) {
922
982
  // `build.HOSTS.get(host, build.HOSTS["opencode"])` — an unknown host falls back rather than
923
983
  // raising, because the host comes from a marker file a user can edit.
@@ -935,7 +995,13 @@ export function emitGlobalInto(host, {
935
995
  // that chose a register — the same scar the footprint left in `diffCollect`, one axis over.
936
996
  return withPyNewlines(
937
997
  () => emit(
938
- makeCfg({ posture: posture || 'peer', mode: mode || 'direct' }),
998
+ // THE PACK SELECTION RIDES THE SAME RAIL, with one difference: `doctrinesOfDir` answers
999
+ // `null` for "no marker / undetectable", and that must render at ALL packs rather than
1000
+ // at `[]`, so the key is OMITTED instead of passed through — `makeCfg`'s own default is
1001
+ // the fail-closed answer and an explicit `doctrines: null` would not reach it.
1002
+ makeCfg({
1003
+ posture: posture || 'peer', mode: mode || 'direct', ...(doctrines ? { doctrines } : {}),
1004
+ }),
939
1005
  { theme, footprint, root: null, cfgDir }, out,
940
1006
  ),
941
1007
  );