geneseed 3.11.0 → 3.13.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 (265) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/README.md +5 -5
  3. package/SHIPPED.md +2 -2
  4. package/adapters/bob/README.md +1 -1
  5. package/adapters/claude-code/README.md +1 -1
  6. package/adapters/openclaude/README.md +1 -1
  7. package/adapters/opencode/README.md +3 -3
  8. package/adapters/opencode/plugins/geneseed-guard.js +157 -2
  9. package/bin/geneseed-cli.mjs +4 -0
  10. package/docs/README.md +41 -22
  11. package/docs/concepts/agents.md +3 -1
  12. package/docs/concepts/collaboration.md +3 -1
  13. package/docs/concepts/exclusions.md +4 -2
  14. package/docs/concepts/footprint.md +3 -1
  15. package/docs/concepts/foreman-mode.md +4 -2
  16. package/docs/concepts/hook-gates.md +61 -0
  17. package/docs/concepts/hooks.md +8 -56
  18. package/docs/concepts/host-matrix.md +38 -0
  19. package/docs/concepts/hosts.md +6 -32
  20. package/docs/concepts/loop-branch.md +66 -0
  21. package/docs/concepts/loop-bricks.md +48 -0
  22. package/docs/concepts/loop-contracts.md +33 -0
  23. package/docs/concepts/loop-gates.md +30 -0
  24. package/docs/concepts/loop-notes.md +43 -0
  25. package/docs/concepts/loop-risk.md +36 -0
  26. package/docs/concepts/loop-templates.md +50 -0
  27. package/docs/concepts/loops.md +73 -0
  28. package/docs/concepts/lsp.md +2 -0
  29. package/docs/concepts/memory.md +3 -1
  30. package/docs/concepts/notebook.md +3 -1
  31. package/docs/concepts/rules.md +4 -2
  32. package/docs/concepts/skills.md +3 -1
  33. package/docs/concepts/themes.md +3 -1
  34. package/docs/extending.md +28 -8
  35. package/docs/guides/autostart.md +3 -1
  36. package/docs/guides/choose-your-setup.md +5 -66
  37. package/docs/guides/headless.md +5 -3
  38. package/docs/guides/install-agent-md.md +37 -0
  39. package/docs/guides/install-bob.md +20 -0
  40. package/docs/guides/install-claude-code.md +22 -0
  41. package/docs/guides/install-clone.md +34 -0
  42. package/docs/guides/install-openclaude.md +25 -0
  43. package/docs/guides/install-opencode.md +35 -0
  44. package/docs/guides/install-scripted.md +21 -0
  45. package/docs/guides/install.md +9 -118
  46. package/docs/guides/loop-finish.md +54 -0
  47. package/docs/guides/loop-running.md +66 -0
  48. package/docs/guides/loop-which-template.md +35 -0
  49. package/docs/guides/mcp-filesystem.md +41 -0
  50. package/docs/guides/mcp-gitlab.md +66 -0
  51. package/docs/guides/mcp-markitdown.md +36 -0
  52. package/docs/guides/mcp.md +8 -137
  53. package/docs/guides/migrate.md +3 -1
  54. package/docs/guides/project-context.md +4 -2
  55. package/docs/guides/read-non-markdown.md +17 -0
  56. package/docs/guides/run-a-loop.md +64 -0
  57. package/docs/guides/run-anywhere.md +2 -0
  58. package/docs/guides/setup-doctrines.md +55 -0
  59. package/docs/guides/setup-footprint.md +48 -0
  60. package/docs/guides/uninstall.md +3 -1
  61. package/docs/guides/upgrade.md +3 -1
  62. package/docs/guides/verify.md +3 -1
  63. package/docs/guides/wiki.md +3 -1
  64. package/docs/guides/worktree.md +3 -1
  65. package/docs/reference/about.md +3 -1
  66. package/docs/reference/cli.md +2 -0
  67. package/docs/reference/env-context.md +40 -0
  68. package/docs/reference/environment.md +10 -59
  69. package/docs/reference/glossary.md +7 -1
  70. package/docs/reference/loop-actions.md +20 -0
  71. package/docs/reference/opencode-plugins.md +14 -116
  72. package/docs/reference/plugin-activity.md +20 -0
  73. package/docs/reference/plugin-context.md +27 -0
  74. package/docs/reference/plugin-guard.md +27 -0
  75. package/docs/reference/plugin-learn.md +27 -0
  76. package/docs/reference/plugin-notify.md +20 -0
  77. package/docs/reference/plugin-ponytail.md +19 -0
  78. package/docs/reference/plugin-workflow.md +25 -0
  79. package/docs/reference/troubleshoot-doctor.md +50 -0
  80. package/docs/reference/troubleshoot-hooks.md +99 -0
  81. package/docs/reference/troubleshoot-install.md +108 -0
  82. package/docs/reference/troubleshoot-tools.md +56 -0
  83. package/docs/reference/troubleshoot-update.md +23 -0
  84. package/docs/reference/troubleshoot-web.md +66 -0
  85. package/docs/reference/troubleshooting.md +13 -337
  86. package/docs/understand/a-day.md +3 -1
  87. package/docs/understand/enforced-vs-asked.md +3 -1
  88. package/docs/understand/harness.md +2 -0
  89. package/docs/understand/machine-bob.md +17 -0
  90. package/docs/understand/machine-claude.md +35 -0
  91. package/docs/understand/machine-opencode.md +36 -0
  92. package/docs/understand/on-your-machine.md +12 -55
  93. package/docs/understand/take-it-out.md +13 -0
  94. package/docs/web-ui.md +36 -5
  95. package/harness.config.json +1 -1
  96. package/js/README.md +32 -2
  97. package/js/build/driver.mjs +14 -8
  98. package/js/build/generate.mjs +10 -6
  99. package/js/build/render.mjs +5 -0
  100. package/js/build/source.mjs +5 -1
  101. package/js/cli-table.json +261 -0
  102. package/js/hosts/gitref.mjs +99 -0
  103. package/js/hosts/hooks.mjs +88 -1
  104. package/js/hosts/installs.mjs +21 -0
  105. package/js/hosts/mcp.mjs +1 -1
  106. package/js/hosts/native.mjs +43 -5
  107. package/js/inspect/checks-authoring.mjs +10 -0
  108. package/js/inspect/checks-build.mjs +28 -0
  109. package/js/inspect/diff.mjs +3 -0
  110. package/js/inspect/doctor.mjs +2 -1
  111. package/js/inspect/inventory.mjs +1 -0
  112. package/js/inspect/status.mjs +1 -1
  113. package/js/loop/catalog.mjs +127 -0
  114. package/js/loop/cli.mjs +173 -0
  115. package/js/loop/graph.mjs +163 -0
  116. package/js/loop/registry.mjs +196 -0
  117. package/js/loop/score.mjs +182 -0
  118. package/js/loop/state.mjs +436 -0
  119. package/js/maintain/migrate.mjs +4 -2
  120. package/js/maintain/setup.mjs +1 -1
  121. package/js/web/actions.mjs +34 -3
  122. package/js/web/api.mjs +51 -2
  123. package/js/web/daemon.mjs +43 -5
  124. package/js/web/docs.mjs +64 -12
  125. package/js/web/handler.mjs +1 -0
  126. package/js/web/jobs.mjs +3 -1
  127. package/js/web/routes.mjs +5 -1
  128. package/js/web/server.mjs +5 -3
  129. package/package.json +1 -1
  130. package/registry.json +14 -0
  131. package/src/AGENT.md.tmpl +2 -0
  132. package/src/agents/explorer.md +2 -2
  133. package/src/agents/researcher.md +3 -3
  134. package/src/bricks/README.md +34 -0
  135. package/src/bricks/_template.md +32 -0
  136. package/src/bricks/adr-challenge.md +20 -0
  137. package/src/bricks/adr-draft.md +15 -0
  138. package/src/bricks/apply.md +17 -0
  139. package/src/bricks/baseline-green.md +17 -0
  140. package/src/bricks/bruno-test.md +16 -0
  141. package/src/bricks/characterize.md +17 -0
  142. package/src/bricks/ci-fix.md +18 -0
  143. package/src/bricks/ci-triage.md +20 -0
  144. package/src/bricks/compat-check.md +16 -0
  145. package/src/bricks/deps-audit.md +14 -0
  146. package/src/bricks/docs-update.md +15 -0
  147. package/src/bricks/done-check.md +16 -0
  148. package/src/bricks/fitness-define.md +22 -0
  149. package/src/bricks/flake-check.md +17 -0
  150. package/src/bricks/flake-repro.md +18 -0
  151. package/src/bricks/identify.md +23 -0
  152. package/src/bricks/lint.md +14 -0
  153. package/src/bricks/migration-plan.md +21 -0
  154. package/src/bricks/mutation-check.md +18 -0
  155. package/src/bricks/plan.md +17 -0
  156. package/src/bricks/red-test.md +16 -0
  157. package/src/bricks/reproduce.md +16 -0
  158. package/src/bricks/review.md +19 -0
  159. package/src/bricks/security-scan.md +17 -0
  160. package/src/bricks/spec.md +18 -0
  161. package/src/bricks/test.md +14 -0
  162. package/src/bricks/upgrade-scout.md +16 -0
  163. package/src/doctrines/process.md +11 -8
  164. package/src/loops/api-endpoint.json +31 -0
  165. package/src/loops/architecture-decision.json +22 -0
  166. package/src/loops/bugfix.json +23 -0
  167. package/src/loops/ci-repair.json +19 -0
  168. package/src/loops/deps-upgrade.json +29 -0
  169. package/src/loops/enforce-architecture-rule.json +28 -0
  170. package/src/loops/feature.json +24 -0
  171. package/src/loops/fix-flaky-tests.json +30 -0
  172. package/src/loops/legacy-refactor.json +26 -0
  173. package/src/loops/legacy-tests.json +29 -0
  174. package/src/loops/refactor.json +24 -0
  175. package/src/loops/remove-dead-code.json +30 -0
  176. package/src/loops/spec-first-feature.json +29 -0
  177. package/src/loops/tdd.json +25 -0
  178. package/src/loops/update-contract.json +33 -0
  179. package/src/skills/brick-forge.md +48 -0
  180. package/src/skills/bruno-collection-generator.md +3 -3
  181. package/src/skills/bruno-test-writer.md +3 -3
  182. package/src/skills/ci-fix.md +3 -3
  183. package/src/skills/consolidate-memory.md +4 -4
  184. package/src/skills/council.md +1 -1
  185. package/src/skills/fresh-eyes.md +1 -1
  186. package/src/skills/geneseed.md +1 -1
  187. package/src/skills/git-archaeology.md +1 -1
  188. package/src/skills/git-rescue.md +4 -3
  189. package/src/skills/handoff.md +1 -1
  190. package/src/skills/herdr.md +1 -1
  191. package/src/skills/learn-mode.md +2 -2
  192. package/src/skills/loop.md +111 -0
  193. package/src/skills/opencode-theme.md +3 -3
  194. package/src/skills/ponytail.md +1 -1
  195. package/src/skills/profile.md +3 -4
  196. package/src/skills/prose.md +2 -3
  197. package/src/skills/quiz.md +1 -1
  198. package/src/skills/react-view-transitions/SKILL.md +1 -1
  199. package/src/skills/react-view-transitions/VENDOR.md +8 -3
  200. package/src/skills/research.md +3 -3
  201. package/src/skills/review-response.md +2 -2
  202. package/src/skills/rule.md +3 -3
  203. package/src/skills/security-audit.md +4 -4
  204. package/src/skills/teach.md +1 -1
  205. package/src/skills/wiki.md +3 -3
  206. package/src/skills/workflow.md +4 -4
  207. package/src/skills/worktree.md +2 -2
  208. package/themes/_TEMPLATE.json +2 -0
  209. package/themes/biker.json +2 -0
  210. package/themes/commentator.json +2 -0
  211. package/themes/cyberpunk.json +2 -0
  212. package/themes/gamer.json +2 -0
  213. package/themes/imperial.json +2 -0
  214. package/themes/joker.json +2 -0
  215. package/themes/marvin.json +2 -0
  216. package/themes/mean.json +2 -0
  217. package/themes/military.json +2 -0
  218. package/themes/neutral.json +2 -0
  219. package/themes/pirate.json +2 -0
  220. package/themes/sports.json +2 -0
  221. package/themes/verstappen.json +2 -0
  222. package/themes/wizard.json +2 -0
  223. package/web/dist/assets/Activity-Ca2Aruu7.js +1 -0
  224. package/web/dist/assets/ActivityDetail-Bo7v4Z_r.js +1 -0
  225. package/web/dist/assets/Dashboard-BuMq46aT.js +2 -0
  226. package/web/dist/assets/Docs-BzccCllG.js +5 -0
  227. package/web/dist/assets/FilterInput-CBcJBQPI.js +1 -0
  228. package/web/dist/assets/GreenhouseView-BCIKcnGG.js +2 -0
  229. package/web/dist/assets/Installs-DMFJvq7s.js +2 -0
  230. package/web/dist/assets/JournalView-o1rmd1_1.js +1 -0
  231. package/web/dist/assets/Laws-BANxq_I_.js +3 -0
  232. package/web/dist/assets/Library-DW4x0fbh.js +1 -0
  233. package/web/dist/assets/Loops-DEBibbBP.js +2 -0
  234. package/web/dist/assets/{Markdown-qjM2_ofS.js → Markdown-CdTX0kLe.js} +14 -14
  235. package/web/dist/assets/OperatorHudView-CLD0fYaA.js +2 -0
  236. package/web/dist/assets/Personal-6uMJvyBG.js +1 -0
  237. package/web/dist/assets/Tabs-BubnyZhF.js +1 -0
  238. package/web/dist/assets/activity-CObqyxkL.js +1 -0
  239. package/web/dist/assets/{api-Dc8f3ca-.js → api-D_ixdyEY.js} +1 -1
  240. package/web/dist/assets/drawable-C_x5xncq.js +1 -0
  241. package/web/dist/assets/index-CMPgezFm.js +2 -0
  242. package/web/dist/assets/index-DMsT4Aa6.css +1 -0
  243. package/web/dist/assets/{react-B9Z_tXRV.js → react-Bbzhmq4v.js} +1 -1
  244. package/web/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
  245. package/web/dist/assets/sections-Dg23Hel5.js +1 -0
  246. package/web/dist/assets/usePoll-BOqeunzF.js +1 -0
  247. package/web/dist/index.html +6 -5
  248. package/web/dist/assets/Activity-C52LEb-2.js +0 -1
  249. package/web/dist/assets/ActivityDetail-CjNLRvXg.js +0 -1
  250. package/web/dist/assets/Dashboard-B6_sSCHi.js +0 -2
  251. package/web/dist/assets/Docs-Dj7BmCSA.js +0 -5
  252. package/web/dist/assets/FilterInput-CVyqmYWM.js +0 -1
  253. package/web/dist/assets/GreenhouseView-BALwjQsA.js +0 -2
  254. package/web/dist/assets/Installs-BbffDQm3.js +0 -2
  255. package/web/dist/assets/JournalView-JpAQ8Hqe.js +0 -1
  256. package/web/dist/assets/Laws-DK7eCWSm.js +0 -3
  257. package/web/dist/assets/Library-CoamHelE.js +0 -1
  258. package/web/dist/assets/OperatorHudView-DVx1HlBx.js +0 -2
  259. package/web/dist/assets/Personal-eaXb1zcj.js +0 -1
  260. package/web/dist/assets/Tabs-BmGtt8E2.js +0 -1
  261. package/web/dist/assets/drawable-Du_PZrQj.js +0 -1
  262. package/web/dist/assets/index-Bz_KMRDH.css +0 -1
  263. package/web/dist/assets/index-CNFH7o55.js +0 -2
  264. package/web/dist/assets/sections-GalMS0Zv.js +0 -1
  265. package/web/dist/assets/usePoll-O0sJEw1Y.js +0 -1
package/docs/web-ui.md CHANGED
@@ -51,7 +51,7 @@ The left rail mirrors the harness's own shape:
51
51
  | Group | Views |
52
52
  | --- | --- |
53
53
  | *(ungrouped)* | Dashboard |
54
- | **📖 Codex** | Constitution · Rules · Profile · Skills · Agents · Library · Docs |
54
+ | **📖 Codex** | Constitution · Rules · Profile · Skills · Agents · Library · Loops · Docs |
55
55
  | **🩺 Care** | Activity · Changes · Doctor |
56
56
  | **🎨 Setup** | Harness · Settings |
57
57
 
@@ -111,16 +111,47 @@ streams the output of background jobs and keeps their history across reloads.
111
111
  **Promote to rule** control turns a recurring lesson into a trial rule in
112
112
  `user-rules.md` — provenance recorded, the source fact deleted so it isn't loaded
113
113
  twice — landing you on the Rules page.
114
+ - **Loops** (`#/loops`) — the loop catalogue `geneseed loop` runs from, read-only, laid out
115
+ like the Library: a rail of sections (**Templates**, **Bricks**, **Active**, each with its
116
+ count; `#/loops/<section>/<item>` opens an entry), with the selected section's groups
117
+ nested under it in the rail (template categories, brick origins, run statuses — pick one to
118
+ narrow the list), a filterable list, and a reader.
119
+ **Templates** are grouped by their `category` (architecture, tests, development,
120
+ refactoring, day-to-day, then *Other*), a *human gate* pill on any that stops for you. The
121
+ reader draws the selected template as a ring: the iteration turning clockwise from its head,
122
+ each inner retry loop hung outside on its head node, the ⛨ *validate* gate the engine adds
123
+ before the first mutate step, setup entering from the left and `done → close` leaving from
124
+ the head; its `rules` follow, then a compact row per brick (effect, agent or skill, outcomes,
125
+ human gate), and clicking a node scrolls to and lights its row. A graph a ring cannot draw
126
+ cleanly (more than eight iteration steps, a node in more than three loops) falls back to
127
+ left-to-right boxes. **Bricks** are grouped by origin (project / global / shipped), pilled
128
+ for *mutate*, *human gate*, what they override and *unavailable*; the reader shows the
129
+ frontmatter facts (outcomes as pills, availability with its reason), then the body rendered as
130
+ markdown, with a **View source** toggle for the file as parsed, frontmatter and all. Templates and
131
+ Bricks read `GET /api/loops`, resolved from the selected install's root, so a project
132
+ install shows its `.geneseed/` bricks and templates. **Active** is every loop
133
+ `geneseed loop init` registered on this machine (`GET /api/loops/active`, polled every
134
+ 5 s), grouped awaiting, running, done/stopped, finished/unreadable; the reader shows its
135
+ branch, `iteration N / max`, current node and a preset picker (`POST /api/loops/preset`,
136
+ the page's only write), what an awaiting loop waits on (launch / declared / actual / a
137
+ human gate, with its node) — the answer is given in the agent's session, never here — and
138
+ its ring with the current node filled, with its iteration history under it.
114
139
  - **Profile** (`#/profile`) — `PROFILE.md` beside the deployed AGENT.md: who you are and
115
140
  how you like to work. Opens rendered; **Edit** is a whole-file editor. The save carries
116
141
  the fingerprint it loaded — if an agent session changed the file first, your edit stays
117
142
  on screen and a second Save replaces the newer version.
118
143
  - **Skills** (`#/skills`) and **Agents** (`#/agents`) — the deployed catalogue, each entry
119
- with its purpose line and full spec.
144
+ with its purpose line and full spec. While Skills is selected, its skill types sit nested
145
+ under it in the rail, each with its count, above a thin bar of their shares; pick one to
146
+ narrow the list.
120
147
  - **Docs** (`#/docs`) — rendered documentation: markdown pages, concept pages, a CLI
121
- reference (generated from the harness argument parser), and a glossary, grouped into
122
- Get started / Core concepts / How-to / MCP servers / Plugins / Reference / Deeper. Filtered
123
- for one host family (OpenCode, or Claude Code — which Bob and OpenClaude share); with no
148
+ reference (generated from the harness argument parser), and a glossary, in the Library's
149
+ three panes: the parts (Understand / Guides / Concepts / Reference) with their page counts,
150
+ the open part's sections nested under it in the rail (pick one to narrow the list), the
151
+ part's pages under their sections with a filter, and the page with its breadcrumb,
152
+ outline and Previous / Next within the section. Filtered for one host (OpenCode, Claude
153
+ Code, Bob or OpenClaude; Claude-family pages show to all three Claude-engine hosts, a page
154
+ tagged with a list of hosts only to those); with no
124
155
  choice stored it follows the deployed install.
125
156
 
126
157
  ### 🩺 Care
@@ -2,5 +2,5 @@
2
2
  "_comment": "version is a human-readable release label only; the canonical identity of an installed harness is the source fingerprint stamped in .geneseed-version (see `harness version`), not this string.",
3
3
  "theme": "neutral",
4
4
  "product": "Geneseed",
5
- "version": "3.11.0"
5
+ "version": "3.13.0"
6
6
  }
package/js/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `js/` — the module map
2
2
 
3
- Fifty-seven modules in seven folders. This page is the address book: **what each one owns**, and
3
+ Sixty-one modules in eight folders. This page is the address book: **what each one owns**, and
4
4
  **which file to open first** for a given task. It is not documentation of behaviour — every module
5
5
  has a docblock for that, and the docblock is the thing to read before editing.
6
6
 
@@ -20,6 +20,7 @@ js/build/ src/ + themes/ → rendered text → a bundle → a per-host
20
20
  js/hosts/ where it stops being a renderer and touches the machine
21
21
  js/inspect/ the read-only half: doctor, status, diff, validate, catalog
22
22
  js/lib/ primitives, every one a deliberate divergence from the Node default
23
+ js/loop/ `geneseed loop` — the state machine over LOOP.md, and what it steps through
23
24
  js/maintain/ lifecycle verbs that change an install that already exists
24
25
  js/ui/ what it prints at a terminal
25
26
  js/web/ the `geneseed web` console
@@ -68,10 +69,11 @@ user co-owns, and the hook verbs those emitted configs then run.
68
69
  |---|---|
69
70
  | `hosts.mjs` | The four host config dirs (opencode/claude/bob/openclaude), plus `resolvePath`/`expanduser` |
70
71
  | `hooks.mjs` | The verbs the emitted hooks run every session: `context`, `git-gate`, `rule-gate`, `tool-gate` (the two gates fused, for Bob), `learn`. `--host` picks the verdict dialect |
72
+ | `gitref.mjs` | fs/path-only: `gitRootOf`, `gitDirOf`, `currentBranch`, `loopLaunched` — read straight off `.git`, never spawn git. Shared by `hooks.mjs`'s git-gate and `js/loop/cli.mjs`'s commit-message writer |
71
73
  | `settings.mjs` | Merges into user-owned `settings.json`/`opencode.json`; owns the hook shim and the managed blocks |
72
74
  | `native.mjs` | Capability specs → host-native subagents and skills. The impure half of the emit |
73
75
  | `opencode.mjs` | OpenCode-only extras: colour themes, primary agent, `/commands`, plugins, overrides stub |
74
- | `installs.mjs` | Detects deployed installs and reads back their theme, footprint, posture and mode |
76
+ | `installs.mjs` | Detects deployed installs and reads back their theme, footprint, posture, mode and loop trust preset |
75
77
  | `mcp.mjs` | MCP server presets, the per-host `mcpServers` config read/write, and toggle state |
76
78
  | `link.mjs` | `geneseed link`/`unlink` — the PATH shim, and the only Windows USER-Path registry edit |
77
79
 
@@ -125,6 +127,34 @@ float `1.0` into one double, and that value gets written into a user's file. Do
125
127
  library for `udiff.mjs`: it is not Myers, ties resolve to the earliest match. Every function in
126
128
  `paths.mjs` branches on `process.platform`, so green on one OS proves nothing about the other.
127
129
 
130
+ ## `js/loop/` — the loop engine
131
+
132
+ `geneseed loop` — a state machine over a brick graph, persisted as a JSON block in `LOOP.md` at
133
+ the git root. The model only ever runs the node it is handed and reports an outcome; every
134
+ transition, score and stop is computed here.
135
+
136
+ | module | owns |
137
+ |---|---|
138
+ | `graph.mjs` | `checkGraph` — the rules a loop graph must satisfy before a node runs: nodes name real bricks, edges cover every outcome, `$close` is reachable, every cycle is inside a declared loop |
139
+ | `score.mjs` | The risk arithmetic: `WEIGHTS`, `PRESETS`, `declaredRisk`/`actualRisk`/`decide`, `parseNumstat`. Pure — no import but node builtins |
140
+ | `catalog.mjs` | `loadCatalog` — bricks and loop templates from shipped/global/project origins, later overrides earlier BY NAME |
141
+ | `state.mjs` | The engine itself: `initState`, `nextStep`, `scoreDeclared`/`scoreDiff`, `recordOutcome`, `decideAwaiting`, `renderLoopFile`/`parseLoopFile` |
142
+ | `cli.mjs` | `geneseed loop check\|init\|next\|score\|record\|decide` — the only face either a model or a human reaches this engine through |
143
+ | `registry.mjs` | `loops.json` under XDG — the launched-loop identity list `loop init` records into and the Active tab's `activeLoops`/`setLoopPreset` read and rewrite |
144
+
145
+ **Before editing:** `score.mjs` is imported by the build driver (the `--trust` choices), so it must
146
+ stay free of every import but node builtins and `graph.mjs`. `state.mjs` excludes `LOOP.md` itself
147
+ (and its own atomic-write sibling, `LOOP.md.tmp`) from every score and every read-brick porcelain
148
+ check — it is the engine's own bookkeeping, never part of the work being scored. Every LOOP.md
149
+ write goes through `state.mjs`'s `writeLoopFile`, never a bare `writeText`, so a killed process
150
+ cannot leave a torn file. `cli.mjs` may not spawn: git output is piped in on stdin by the model,
151
+ never read by this entry. `registry.mjs` swallows its own errors on `recordLoop`/`activeLoops` on
152
+ purpose, like `js/inspect/registry.mjs` — a registry hiccup must never fail `loop init` or a
153
+ read — but `setLoopPreset` does not: a preset change the caller asked for must be reported when it
154
+ fails. `activeLoops` saves the registry back only when the kept set actually changed (a pruned
155
+ root, a loop newly seen finished or seen running again) — a routine poll from the Active tab must
156
+ never be a write.
157
+
128
158
  ## `js/maintain/` — lifecycle
129
159
 
130
160
  Verbs that change an install that already exists, as opposed to rendering one.
@@ -65,6 +65,9 @@ import {
65
65
  // registry to find every install it must re-emit, and a CLI verb may not reach into a driver
66
66
  // for a reader. See js/inspect/registry.mjs.
67
67
  import { registryRecord, registryRoots } from '../inspect/registry.mjs';
68
+ // The loop engine's trust presets — the `--trust` choices. `score.mjs` imports nothing, which is
69
+ // what lets it sit inside this driver's total `child_process` ban.
70
+ import { DEFAULT_PRESET, PRESETS } from '../loop/score.mjs';
68
71
 
69
72
  // P2. `--sync-themes` crossed into its own module rather than into this file: it is 90 lines
70
73
  // of textual surgery over committed files with a corpus of its own, and it is the half of the
@@ -111,8 +114,8 @@ export function resolveOut(raw) {
111
114
  */
112
115
  function configDefaults() {
113
116
  const d = {
114
- theme: 'neutral', posture: 'peer', mode: 'direct', doctrines: [...PACK_ORDER],
115
- excludeRules: [],
117
+ theme: 'neutral', posture: 'peer', mode: 'direct', trust: DEFAULT_PRESET,
118
+ doctrines: [...PACK_ORDER], excludeRules: [],
116
119
  };
117
120
  if (!existsSync(CONFIG)) return d;
118
121
  try {
@@ -163,7 +166,7 @@ function configDefaults() {
163
166
  * flag is added to one and not the other, and nothing downstream would say so.
164
167
  */
165
168
  const VALUED = {
166
- '--theme': 'theme', '--posture': 'posture', '--mode': 'mode',
169
+ '--theme': 'theme', '--posture': 'posture', '--mode': 'mode', '--trust': 'trust',
167
170
  '--doctrines': 'doctrines', '--exclude-rules': 'excludeRules',
168
171
  '--out': 'out', '--target': 'out', '--emit': 'emit',
169
172
  '--footprint': 'footprint', '--root': 'root', '--config-dir': 'cfgDir',
@@ -194,13 +197,13 @@ const FLAG_BY_NAME = Object.fromEntries(
194
197
  );
195
198
 
196
199
  /**
197
- * The four flags `choice` validates, as ONE table for the same anti-drift reason.
200
+ * The five flags `choice` validates, as ONE table for the same anti-drift reason.
198
201
  *
199
- * A function and not a constant because two of the four read the checkout: `discoverNames`
202
+ * A function and not a constant because two of the five read the checkout: `discoverNames`
200
203
  * scans `postures/` and `modes/`, so the answer depends on the source tree this driver is
201
204
  * standing in and cannot be frozen at import.
202
205
  *
203
- * `--doctrines` is DELIBERATELY not a fifth row. Every consumer of this table treats an
206
+ * `--doctrines` is DELIBERATELY not a sixth row. Every consumer of this table treats an
204
207
  * entry as one value drawn from a closed list — `choice` refuses anything else, and
205
208
  * `usage`'s metavar prints the list as the whole legal surface. `--doctrines` takes a comma
206
209
  * LIST plus the sentinel `none`, so a row here would have refused `craft,rigor` outright and
@@ -213,6 +216,7 @@ function choicesFor() {
213
216
  '--footprint': ['lean', 'full'],
214
217
  '--posture': discoverNames('postures', 'peer'),
215
218
  '--mode': discoverNames('modes', 'direct'),
219
+ '--trust': Object.keys(PRESETS),
216
220
  };
217
221
  }
218
222
 
@@ -340,6 +344,7 @@ function usage() {
340
344
  function parseArgs(argv, defaults) {
341
345
  const args = {
342
346
  theme: defaults.theme, posture: defaults.posture, mode: defaults.mode,
347
+ trust: defaults.trust,
343
348
  doctrines: defaults.doctrines,
344
349
  excludeRules: defaults.excludeRules,
345
350
  out: 'Harness', emit: 'files', footprint: 'lean', root: null,
@@ -1035,7 +1040,7 @@ export function buildInto({ theme, out, footprint = 'lean' }) {
1035
1040
  }
1036
1041
 
1037
1042
  export function emitGlobalInto(host, {
1038
- theme, out, cfgDir, footprint, posture = null, mode = null, doctrines = null,
1043
+ theme, out, cfgDir, footprint, posture = null, mode = null, doctrines = null, trust = null,
1039
1044
  }) {
1040
1045
  // `build.HOSTS.get(host, build.HOSTS["opencode"])` — an unknown host falls back rather than
1041
1046
  // raising, because the host comes from a marker file a user can edit.
@@ -1058,7 +1063,8 @@ export function emitGlobalInto(host, {
1058
1063
  // at `[]`, so the key is OMITTED instead of passed through — `makeCfg`'s own default is
1059
1064
  // the fail-closed answer and an explicit `doctrines: null` would not reach it.
1060
1065
  makeCfg({
1061
- posture: posture || 'peer', mode: mode || 'direct', ...(doctrines ? { doctrines } : {}),
1066
+ posture: posture || 'peer', mode: mode || 'direct', trust: trust || DEFAULT_PRESET,
1067
+ ...(doctrines ? { doctrines } : {}),
1062
1068
  }),
1063
1069
  { theme, footprint, root: null, cfgDir }, out,
1064
1070
  ),
@@ -34,11 +34,12 @@ import path from 'node:path';
34
34
 
35
35
  import { main as driverMain } from './driver.mjs';
36
36
  import { makeCfg, PACK_ORDER } from './source.mjs';
37
+ import { DEFAULT_PRESET } from '../loop/score.mjs';
37
38
  import { opencodeConfigDir, resolvePath } from '../hosts/hosts.mjs';
38
39
  import {
39
40
  EMIT_HOST_SCOPE, defaultMode, defaultPosture, defaultTheme, doctrinesForBuild,
40
41
  excludedRulesOfDir, footprintOfDir, installState, installTargets, modeOfDir, postureOfDir,
41
- readMaybe, themeOfDir,
42
+ readMaybe, themeOfDir, trustOfDir,
42
43
  } from '../hosts/installs.mjs';
43
44
  import { colorThemeFiles, colorThemeJson, PALETTE_ROLES } from '../hosts/opencode.mjs';
44
45
  import { renderAll } from './render.mjs';
@@ -93,7 +94,7 @@ function sysExit(msg) {
93
94
  */
94
95
  const BUILD_FORWARD = [
95
96
  ['theme', '--theme'], ['emit', '--emit'], ['footprint', '--footprint'],
96
- ['posture', '--posture'], ['mode', '--mode'], ['doctrines', '--doctrines'],
97
+ ['posture', '--posture'], ['mode', '--mode'], ['trust', '--trust'], ['doctrines', '--doctrines'],
97
98
  ['excludeRules', '--exclude-rules'], ['out', '--out'], ['root', '--root'],
98
99
  ['configDir', '--config-dir'],
99
100
  ];
@@ -114,7 +115,7 @@ export function cmdBuild(args) {
114
115
  * The elision rules are not symmetric and the Python says why: `footprint` is ALWAYS passed,
115
116
  * because omitting it when it matched the generator's default silently coupled the answer to
116
117
  * whatever that default happened to be — the moment the default moved, picking the old one
117
- * produced the new one. `posture` and `mode` still elide at theirs, and neither has moved.
118
+ * produced the new one. `posture`, `mode` and `trust` still elide at theirs, and none has moved.
118
119
  *
119
120
  * ⚠ `doctrines` DOES NOT ELIDE, AND THAT IS THE SAFETY DECISION, NOT A STYLE ONE. It used to
120
121
  * elide on the full set, by analogy with posture and mode — but those two compare against a
@@ -137,7 +138,7 @@ export function cmdBuild(args) {
137
138
  */
138
139
  export function setupBuildArgs(theme, emit, out = null, root = null, footprint = 'lean',
139
140
  posture = 'peer', mode = 'direct', doctrines = null, allPacks = PACK_ORDER,
140
- excludeRules = null) {
141
+ excludeRules = null, trust = DEFAULT_PRESET) {
141
142
  const argv = ['--theme', theme, '--emit', emit];
142
143
  if (!emit.endsWith('-global')) {
143
144
  if (out) argv.push('--out', out);
@@ -146,6 +147,7 @@ export function setupBuildArgs(theme, emit, out = null, root = null, footprint =
146
147
  if (footprint) argv.push('--footprint', footprint);
147
148
  if (posture && posture !== 'peer') argv.push('--posture', posture);
148
149
  if (mode && mode !== 'direct') argv.push('--mode', mode);
150
+ if (trust && trust !== DEFAULT_PRESET) argv.push('--trust', trust);
149
151
  if (Array.isArray(doctrines)) {
150
152
  // Emitted in `allPacks` order, not the order handed in: a caller may legitimately pass an
151
153
  // unsorted list, and the flag has to be canonical for the same reason the driver
@@ -199,6 +201,8 @@ export function installProfile(host, scope, root) {
199
201
  const footprint = footprintOfDir(root);
200
202
  const posture = postureOfDir(root) || defaultPosture();
201
203
  const mode = modeOfDir(root) || defaultMode();
204
+ // Read off the deployed loop skill; no config fallback — `DEFAULT_PRESET` is the engine's.
205
+ const trust = trustOfDir(root) || DEFAULT_PRESET;
202
206
  // A rebuild that defaulted the pack selection would re-emit an install into a constitution
203
207
  // its owner did not choose — and in one direction that is not merely surprising: dropping
204
208
  // the process pack takes the commit/push consent RULES out of AGENT.md while
@@ -213,7 +217,7 @@ export function installProfile(host, scope, root) {
213
217
  const excludeRules = excludedRulesOfDir(root);
214
218
  const out = scope === 'global' ? null : root;
215
219
  const argv = setupBuildArgs(theme, emit, out, out, footprint, posture, mode, doctrines,
216
- PACK_ORDER, excludeRules);
220
+ PACK_ORDER, excludeRules, trust);
217
221
  // A GLOBAL ROW NAMES ITS OWN DIR. `root` came from the host's config-dir resolver, which
218
222
  // honours env overrides (`OPENCODE_CONFIG_DIR`, `CLAUDE_CONFIG_DIR`…); without the flag the
219
223
  // same argv run from a shell lacking that variable re-emits into the DEFAULT dir — a second
@@ -221,7 +225,7 @@ export function installProfile(host, scope, root) {
221
225
  if (scope === 'global') argv.push('--config-dir', root);
222
226
  return {
223
227
  host, scope, root, state: installState(root, host, scope),
224
- emit, theme, footprint, posture, mode, doctrines, excludeRules, argv,
228
+ emit, theme, footprint, posture, mode, trust, doctrines, excludeRules, argv,
225
229
  };
226
230
  }
227
231
 
@@ -35,6 +35,7 @@ import { parseJson } from '../lib/json.mjs';
35
35
  import { normcase, comparePaths } from '../lib/paths.mjs';
36
36
  // `js/build/source.mjs` imports nothing but node builtins, so this direction cannot cycle.
37
37
  import { PACK_ORDER, readPackText, resolveRuleIds } from './source.mjs';
38
+ import { DEFAULT_PRESET } from '../loop/score.mjs';
38
39
 
39
40
  /** Document STRUCTURE is theme-INDEPENDENT — mirrors `_build_render.STRUCTURE`. */
40
41
  export const STRUCTURE = {
@@ -391,6 +392,10 @@ export function effectiveTheme(cfg, themeName, { footprint = 'full', lawsPrefix
391
392
  const theme = { ...loadTheme(cfg, themeName), ...(cfg.structure ?? STRUCTURE) };
392
393
  theme.POSTURE_BODY = registerBody(cfg, theme, 'postures', cfg.posture ?? 'peer', 'peer');
393
394
  theme.MODE_BODY = registerBody(cfg, theme, 'modes', cfg.mode ?? 'direct', 'direct');
395
+ // The loop skill's default trust preset (`--trust`), raw for `--preset` and capitalised for
396
+ // the `Default trust preset: **<Label>**` line `trustOfDir` reads back off an install.
397
+ theme.TRUST = cfg.trust ?? DEFAULT_PRESET;
398
+ theme.TRUST_LABEL = theme.TRUST[0].toUpperCase() + theme.TRUST.slice(1);
394
399
  // The doctrines pair is threaded, not read off `cfg`: `footprint` is a per-RENDER value
395
400
  // (`renderAll`'s option, and the same cfg renders both ways in one process), so parking it
396
401
  // on cfg would make the terse/full choice sticky across calls. An options object rather
@@ -26,6 +26,7 @@
26
26
  */
27
27
  import { readdirSync, readFileSync, statSync } from 'node:fs';
28
28
  import path from 'node:path';
29
+ import { DEFAULT_PRESET } from '../loop/score.mjs';
29
30
 
30
31
  /**
31
32
  * One doctrine pack file used to be read three times per render — the survives gate and the
@@ -256,7 +257,8 @@ export function knownRuleIds() {
256
257
  * `PACK_ORDER` for the whole process.
257
258
  */
258
259
  export function makeCfg({
259
- posture = 'peer', mode = 'direct', doctrines = PACK_ORDER, excludeRules = [],
260
+ posture = 'peer', mode = 'direct', trust = DEFAULT_PRESET, doctrines = PACK_ORDER,
261
+ excludeRules = [],
260
262
  } = {}) {
261
263
  return {
262
264
  root: ROOT,
@@ -268,6 +270,8 @@ export function makeCfg({
268
270
  workflowSrc: WORKFLOW_SRC,
269
271
  posture,
270
272
  mode,
273
+ // The loop skill's default preset (`--trust`); the skill is its only reader.
274
+ trust,
271
275
  doctrines: Array.isArray(doctrines) ? [...doctrines] : [...PACK_ORDER],
272
276
  // ⚠ THE SECOND DOCTRINE AXIS, AND ITS DEFAULT IS THE OPPOSITE WAY ROUND. `doctrines`
273
277
  // defaults to EVERYTHING because an unknown selection must bind the most; `excludeRules`
package/js/cli-table.json CHANGED
@@ -133,6 +133,21 @@
133
133
  "type": null,
134
134
  "hidden": false
135
135
  },
136
+ {
137
+ "names": [
138
+ "--trust"
139
+ ],
140
+ "dest": "trust",
141
+ "metavar": null,
142
+ "help": "default loop trust preset: how much a loop may do before it stops to ask (default balanced)",
143
+ "choices": null,
144
+ "default": null,
145
+ "required": false,
146
+ "nargs": null,
147
+ "is_flag": false,
148
+ "type": null,
149
+ "hidden": false
150
+ },
136
151
  {
137
152
  "names": [
138
153
  "--doctrines"
@@ -623,6 +638,252 @@
623
638
  "options": [],
624
639
  "mutex": []
625
640
  },
641
+ {
642
+ "name": "loop",
643
+ "help": "run a loop: check graphs, start one in LOOP.md, and step its state machine (next/score/record/decide)",
644
+ "description": "",
645
+ "positionals": [
646
+ {
647
+ "names": [],
648
+ "dest": "action",
649
+ "metavar": null,
650
+ "help": "",
651
+ "choices": [
652
+ "check",
653
+ "init",
654
+ "next",
655
+ "score",
656
+ "record",
657
+ "decide"
658
+ ],
659
+ "default": null,
660
+ "required": true,
661
+ "nargs": null,
662
+ "is_flag": false,
663
+ "type": null,
664
+ "hidden": false
665
+ }
666
+ ],
667
+ "options": [
668
+ {
669
+ "names": ["--graph"],
670
+ "dest": "graph",
671
+ "metavar": null,
672
+ "help": "a loop template name or a .json graph file",
673
+ "choices": null,
674
+ "default": null,
675
+ "required": false,
676
+ "nargs": null,
677
+ "is_flag": false,
678
+ "type": null,
679
+ "hidden": false
680
+ },
681
+ {
682
+ "names": ["--brick"],
683
+ "dest": "brick",
684
+ "metavar": null,
685
+ "help": "check one brick file instead of the whole catalogue",
686
+ "choices": null,
687
+ "default": null,
688
+ "required": false,
689
+ "nargs": null,
690
+ "is_flag": false,
691
+ "type": null,
692
+ "hidden": false
693
+ },
694
+ {
695
+ "names": ["--title"],
696
+ "dest": "title",
697
+ "metavar": null,
698
+ "help": "the loop's title, written into LOOP.md",
699
+ "choices": null,
700
+ "default": null,
701
+ "required": false,
702
+ "nargs": null,
703
+ "is_flag": false,
704
+ "type": null,
705
+ "hidden": false
706
+ },
707
+ {
708
+ "names": ["--requirement"],
709
+ "dest": "requirement",
710
+ "metavar": null,
711
+ "help": "the requirement the loop exists to satisfy",
712
+ "choices": null,
713
+ "default": null,
714
+ "required": false,
715
+ "nargs": null,
716
+ "is_flag": false,
717
+ "type": null,
718
+ "hidden": false
719
+ },
720
+ {
721
+ "names": ["--preset"],
722
+ "dest": "preset",
723
+ "metavar": null,
724
+ "help": "the risk preset to run under (default: balanced)",
725
+ "choices": [
726
+ "prudent",
727
+ "balanced",
728
+ "aggressive"
729
+ ],
730
+ "default": null,
731
+ "required": false,
732
+ "nargs": null,
733
+ "is_flag": false,
734
+ "type": null,
735
+ "hidden": false
736
+ },
737
+ {
738
+ "names": ["--contracts"],
739
+ "dest": "contracts",
740
+ "metavar": null,
741
+ "help": "comma-separated contract globs appended to the template's own (init)",
742
+ "choices": null,
743
+ "default": null,
744
+ "required": false,
745
+ "nargs": null,
746
+ "is_flag": false,
747
+ "type": null,
748
+ "hidden": false
749
+ },
750
+ {
751
+ "names": ["--declared"],
752
+ "dest": "declared",
753
+ "metavar": null,
754
+ "help": "score the card just declared, before it runs",
755
+ "choices": null,
756
+ "default": false,
757
+ "required": false,
758
+ "nargs": "0",
759
+ "is_flag": true,
760
+ "type": null,
761
+ "hidden": false
762
+ },
763
+ {
764
+ "names": ["--diff"],
765
+ "dest": "diff",
766
+ "metavar": null,
767
+ "help": "score the actual diff, read as numstat on stdin",
768
+ "choices": null,
769
+ "default": false,
770
+ "required": false,
771
+ "nargs": "0",
772
+ "is_flag": true,
773
+ "type": null,
774
+ "hidden": false
775
+ },
776
+ {
777
+ "names": ["--actions"],
778
+ "dest": "actions",
779
+ "metavar": null,
780
+ "help": "comma-separated declared action kinds (new-file, logic, api, ...)",
781
+ "choices": null,
782
+ "default": null,
783
+ "required": false,
784
+ "nargs": null,
785
+ "is_flag": false,
786
+ "type": null,
787
+ "hidden": false
788
+ },
789
+ {
790
+ "names": ["--write-set"],
791
+ "dest": "write_set",
792
+ "metavar": null,
793
+ "help": "comma-separated files the declared card expects to touch",
794
+ "choices": null,
795
+ "default": null,
796
+ "required": false,
797
+ "nargs": null,
798
+ "is_flag": false,
799
+ "type": null,
800
+ "hidden": false
801
+ },
802
+ {
803
+ "names": ["--intent"],
804
+ "dest": "intent",
805
+ "metavar": null,
806
+ "help": "a short label for what the declared card is doing",
807
+ "choices": null,
808
+ "default": null,
809
+ "required": false,
810
+ "nargs": null,
811
+ "is_flag": false,
812
+ "type": null,
813
+ "hidden": false
814
+ },
815
+ {
816
+ "names": ["--outcome"],
817
+ "dest": "outcome",
818
+ "metavar": null,
819
+ "help": "the brick's reported outcome, one of its declared outcomes",
820
+ "choices": null,
821
+ "default": null,
822
+ "required": false,
823
+ "nargs": null,
824
+ "is_flag": false,
825
+ "type": null,
826
+ "hidden": false
827
+ },
828
+ {
829
+ "names": ["--card"],
830
+ "dest": "card",
831
+ "metavar": null,
832
+ "help": "a JSON card to record alongside the outcome",
833
+ "choices": null,
834
+ "default": null,
835
+ "required": false,
836
+ "nargs": null,
837
+ "is_flag": false,
838
+ "type": null,
839
+ "hidden": false
840
+ },
841
+ {
842
+ "names": ["--verdict"],
843
+ "dest": "verdict",
844
+ "metavar": null,
845
+ "help": "the user's answer to an awaiting validation",
846
+ "choices": [
847
+ "ok",
848
+ "no",
849
+ "amend"
850
+ ],
851
+ "default": null,
852
+ "required": false,
853
+ "nargs": null,
854
+ "is_flag": false,
855
+ "type": null,
856
+ "hidden": false
857
+ },
858
+ {
859
+ "names": ["--note"],
860
+ "dest": "note",
861
+ "metavar": null,
862
+ "help": "a note attached to a record or a decide verdict, written into LOOP.md so it survives the unit",
863
+ "choices": null,
864
+ "default": null,
865
+ "required": false,
866
+ "nargs": null,
867
+ "is_flag": false,
868
+ "type": null,
869
+ "hidden": false
870
+ },
871
+ {
872
+ "names": ["--note-file"],
873
+ "dest": "note_file",
874
+ "metavar": null,
875
+ "help": "record's note read from this file instead of the command line (CRLF folded, trimmed) — for a multi-line note or one that mentions git commit/push",
876
+ "choices": null,
877
+ "default": null,
878
+ "required": false,
879
+ "nargs": null,
880
+ "is_flag": false,
881
+ "type": null,
882
+ "hidden": false
883
+ }
884
+ ],
885
+ "mutex": []
886
+ },
626
887
  {
627
888
  "name": "mcp",
628
889
  "help": "list the MCP servers wired into each active install, and the presets available to add",