geneseed 5.3.0 → 5.4.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 (198) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +23 -20
  3. package/SHIPPED.md +7 -7
  4. package/adapters/bob/README.md +31 -18
  5. package/adapters/claude-code/README.md +27 -22
  6. package/adapters/openclaude/README.md +18 -8
  7. package/adapters/opencode/HOW-OPENCODE-LOADS.md +8 -3
  8. package/adapters/opencode/README.md +3 -2
  9. package/adapters/opencode/plugins/geneseed-activity.js +20 -21
  10. package/adapters/opencode/plugins/geneseed-context.js +175 -62
  11. package/adapters/opencode/plugins/geneseed-guard.js +419 -205
  12. package/adapters/opencode/plugins/geneseed-workflow.js +3 -2
  13. package/adapters/opencode/workflows/_runtime.js +3 -2
  14. package/bin/geneseed-cli.mjs +7 -0
  15. package/bin/geneseed-hook.mjs +59 -11
  16. package/docs/PRD.md +1 -1
  17. package/docs/README.md +1 -0
  18. package/docs/concepts/agents.md +1 -1
  19. package/docs/concepts/collaboration.md +2 -2
  20. package/docs/concepts/enforcement-table.md +5 -2
  21. package/docs/concepts/exclusions.md +18 -4
  22. package/docs/concepts/footprint.md +11 -1
  23. package/docs/concepts/foreman-mode.md +1 -1
  24. package/docs/concepts/hook-gates.md +5 -5
  25. package/docs/concepts/hooks.md +4 -3
  26. package/docs/concepts/host-matrix.md +24 -6
  27. package/docs/concepts/kits.md +12 -2
  28. package/docs/concepts/loop-bricks.md +3 -3
  29. package/docs/concepts/loops.md +6 -4
  30. package/docs/concepts/ownership.md +1 -1
  31. package/docs/concepts/rules.md +2 -2
  32. package/docs/concepts/skills.md +1 -1
  33. package/docs/design-history.md +8 -0
  34. package/docs/extending.md +112 -35
  35. package/docs/guides/auto-merge.md +100 -0
  36. package/docs/guides/choose-your-setup.md +1 -1
  37. package/docs/guides/headless.md +1 -1
  38. package/docs/guides/install-bob.md +2 -2
  39. package/docs/guides/install-clone.md +1 -1
  40. package/docs/guides/install-openclaude.md +1 -1
  41. package/docs/guides/install.md +1 -1
  42. package/docs/guides/loop-finish.md +3 -3
  43. package/docs/guides/loop-running.md +4 -4
  44. package/docs/guides/project-context.md +1 -1
  45. package/docs/guides/run-a-factory.md +2 -2
  46. package/docs/guides/setup-doctrines.md +2 -2
  47. package/docs/guides/setup-footprint.md +1 -1
  48. package/docs/guides/uninstall.md +3 -3
  49. package/docs/guides/upgrade.md +1 -1
  50. package/docs/guides/verify.md +12 -0
  51. package/docs/guides/worktree.md +1 -1
  52. package/docs/reference/environment.md +5 -2
  53. package/docs/reference/plugin-activity.md +1 -1
  54. package/docs/reference/plugin-guard.md +1 -1
  55. package/docs/reference/plugin-learn.md +1 -1
  56. package/docs/reference/plugin-workflow.md +1 -1
  57. package/docs/reference/troubleshoot-doctor.md +2 -2
  58. package/docs/reference/troubleshoot-hooks.md +2 -2
  59. package/docs/reference/troubleshoot-install.md +3 -3
  60. package/docs/reference/troubleshoot-tools.md +1 -1
  61. package/docs/token-footprint.md +68 -4
  62. package/docs/understand/design-choices-hosts.md +1 -1
  63. package/docs/understand/design-choices-shape.md +1 -0
  64. package/docs/understand/enforced-vs-asked.md +2 -2
  65. package/docs/understand/machine-bob.md +1 -1
  66. package/docs/understand/machine-claude.md +2 -2
  67. package/docs/understand/on-your-machine.md +1 -1
  68. package/docs/web-ui.md +10 -5
  69. package/harness.config.json +1 -1
  70. package/js/README.md +5 -3
  71. package/js/build/args.mjs +13 -2
  72. package/js/build/driver.mjs +34 -7
  73. package/js/build/emit-claude.mjs +9 -5
  74. package/js/build/emit-opencode.mjs +13 -9
  75. package/js/build/generate.mjs +10 -165
  76. package/js/build/profile.mjs +318 -0
  77. package/js/build/render.mjs +81 -3
  78. package/js/build/retired-skills.mjs +60 -13
  79. package/js/build/source.mjs +15 -1
  80. package/js/build/stubs.mjs +4 -1
  81. package/js/cli-table.json +48 -3
  82. package/js/hosts/done-checks.mjs +6 -0
  83. package/js/hosts/geneseed-dir.mjs +3 -2
  84. package/js/hosts/gitref.mjs +5 -3
  85. package/js/hosts/hook-tap.mjs +104 -0
  86. package/js/hosts/hooks-context.mjs +4 -2
  87. package/js/hosts/hooks-done.mjs +345 -55
  88. package/js/hosts/hooks-learn.mjs +51 -19
  89. package/js/hosts/hooks-prims.mjs +5 -3
  90. package/js/hosts/hooks.mjs +172 -19
  91. package/js/hosts/hosts.mjs +80 -12
  92. package/js/hosts/installs.mjs +26 -1
  93. package/js/hosts/native.mjs +33 -7
  94. package/js/hosts/owned.mjs +7 -6
  95. package/js/hosts/ownership-gate.mjs +14 -1
  96. package/js/hosts/settings.mjs +273 -105
  97. package/js/hosts/shim.mjs +4 -4
  98. package/js/hosts/usage.mjs +9 -3
  99. package/js/inspect/checks-constitution.mjs +32 -0
  100. package/js/inspect/checks-probe.mjs +66 -5
  101. package/js/inspect/checks-repo.mjs +196 -2
  102. package/js/inspect/cost.mjs +34 -2
  103. package/js/inspect/diff.mjs +21 -3
  104. package/js/inspect/doctor.mjs +6 -1
  105. package/js/inspect/inventory.mjs +1 -1
  106. package/js/lib/machine-dir.mjs +1 -1
  107. package/js/lib/node-floor.mjs +46 -6
  108. package/js/maintain/setup.mjs +5 -1
  109. package/js/maintain/uninstall.mjs +42 -16
  110. package/js/maintain/update.mjs +4 -2
  111. package/js/web/actions.mjs +17 -12
  112. package/js/web/api.mjs +7 -2
  113. package/package.json +1 -1
  114. package/registry.json +14 -0
  115. package/src/AGENT.md.tmpl +15 -17
  116. package/src/bricks/pr-open.md +3 -2
  117. package/src/doctrines/ops.md +2 -2
  118. package/src/doctrines/process.md +40 -36
  119. package/src/factories/analysis-to-build.json +1 -1
  120. package/src/factories/bug-report-to-fix.json +1 -1
  121. package/src/factories/issue-to-pr.json +1 -1
  122. package/src/kits/terminal-tools/rules.md +10 -0
  123. package/src/kits/terminal-tools.json +13 -0
  124. package/src/licenses/herdr.txt +201 -0
  125. package/src/modes/foreman.md +6 -3
  126. package/src/skills/_self-improvement.md +9 -7
  127. package/src/skills/commit.md +17 -17
  128. package/src/skills/debug/ci.md +1 -1
  129. package/src/skills/dependencies.md +3 -3
  130. package/src/skills/document-project.md +3 -2
  131. package/src/skills/factory.md +13 -4
  132. package/src/skills/geneseed.md +4 -2
  133. package/src/skills/git-history.md +5 -7
  134. package/src/skills/herdr.md +135 -0
  135. package/src/skills/loop.md +3 -2
  136. package/src/skills/opencode-cli.md +84 -0
  137. package/src/skills/pipeline.md +1 -1
  138. package/src/skills/release.md +5 -8
  139. package/src/skills/review-response.md +4 -2
  140. package/src/skills/rule.md +27 -1
  141. package/src/skills/ship.md +54 -7
  142. package/src/skills/worktree.md +2 -2
  143. package/src/upstreams.json +7 -0
  144. package/themes/_TEMPLATE.json +2 -0
  145. package/themes/biker.json +2 -0
  146. package/themes/commentator.json +2 -0
  147. package/themes/cyberpunk.json +2 -0
  148. package/themes/gamer.json +2 -0
  149. package/themes/imperial.json +2 -0
  150. package/themes/joker.json +2 -0
  151. package/themes/marvin.json +2 -0
  152. package/themes/mean.json +2 -0
  153. package/themes/military.json +2 -0
  154. package/themes/neutral.json +2 -0
  155. package/themes/pirate.json +2 -0
  156. package/themes/sports.json +2 -0
  157. package/themes/verstappen.json +2 -0
  158. package/themes/wizard.json +2 -0
  159. package/web/dist/assets/Activity-D2kOc3yi.js +1 -0
  160. package/web/dist/assets/ActivityDetail-By3xOr21.js +1 -0
  161. package/web/dist/assets/{Bonsai-Bfpb6W-1.js → Bonsai-CBWDTBA4.js} +1 -1
  162. package/web/dist/assets/{CopyButton-ByIntFtB.js → CopyButton-BVbpriMB.js} +1 -1
  163. package/web/dist/assets/Dashboard-CIJLPHM9.js +2 -0
  164. package/web/dist/assets/{Docs-DvlMJhpu.js → Docs-CiRRIELs.js} +3 -3
  165. package/web/dist/assets/Factories-DhyK0O8d.js +1 -0
  166. package/web/dist/assets/GreenhouseView-DW3PgTPy.js +1 -0
  167. package/web/dist/assets/Installs-B6nlo-Ly.js +3 -0
  168. package/web/dist/assets/JournalView-O65qEWfp.js +1 -0
  169. package/web/dist/assets/Kits-C5U-yT6Z.js +1 -0
  170. package/web/dist/assets/Laws-CuTw_XNf.js +4 -0
  171. package/web/dist/assets/{LibRows-DEHjIoD-.js → LibRows-D6-CVa3K.js} +1 -1
  172. package/web/dist/assets/Library-CzPlerd6.js +3 -0
  173. package/web/dist/assets/Loops-CqNF_-nS.js +2 -0
  174. package/web/dist/assets/Markdown-CxkA7940.js +71 -0
  175. package/web/dist/assets/OperatorHudView-BNr8K5qj.js +1 -0
  176. package/web/dist/assets/Personal-DeDb9e8O.js +2 -0
  177. package/web/dist/assets/Settings-B8MPN_AD.js +1 -0
  178. package/web/dist/assets/{Tabs-CWeQTADL.js → Tabs-DJzAez4h.js} +1 -1
  179. package/web/dist/assets/index-BL3P-9Rg.js +6 -0
  180. package/web/dist/assets/{index-CsAZq0BQ.css → index-CRWqKxfY.css} +1 -1
  181. package/web/dist/index.html +2 -2
  182. package/adapters/claude-code/settings.json +0 -52
  183. package/web/dist/assets/Activity-CqJiquEq.js +0 -1
  184. package/web/dist/assets/ActivityDetail-BSzevynX.js +0 -1
  185. package/web/dist/assets/Dashboard-DBOEi9lQ.js +0 -2
  186. package/web/dist/assets/Factories-Bpvv7L2H.js +0 -1
  187. package/web/dist/assets/GreenhouseView-GpBsYn50.js +0 -1
  188. package/web/dist/assets/Installs-BlGmVrFK.js +0 -3
  189. package/web/dist/assets/JournalView-iLuLrOxE.js +0 -1
  190. package/web/dist/assets/Kits-DRwpxC-J.js +0 -1
  191. package/web/dist/assets/Laws-CZkiNOWQ.js +0 -4
  192. package/web/dist/assets/Library-B4K-1iNF.js +0 -3
  193. package/web/dist/assets/Loops-BWSzaW8E.js +0 -2
  194. package/web/dist/assets/Markdown-0ORz7tAc.js +0 -69
  195. package/web/dist/assets/OperatorHudView-BAXwCEvY.js +0 -1
  196. package/web/dist/assets/Personal-Bp9nV4GR.js +0 -2
  197. package/web/dist/assets/Settings-CWWuaIp-.js +0 -1
  198. package/web/dist/assets/index-How7SzDZ.js +0 -6
@@ -194,12 +194,16 @@ export function agentDescription(text) {
194
194
  return withWhen(firstBlockquote(text), dispatchOf(text));
195
195
  }
196
196
 
197
- /** Purpose + ` Use when: ` + the first sentence of `trig`, capped — see `skillDescription`. */
197
+ /**
198
+ * Purpose + ` Use when: ` + the first sentence of `trig`, capped — see `skillDescription`.
199
+ * A `;` ends the cut clause as a `.` does, but the clause is the END of the description, so it
200
+ * is written as a `.`: a trailing `;` reads as text that was cut short.
201
+ */
198
202
  function withWhen(desc, trig) {
199
203
  if (!trig) return desc;
200
204
  const first = trig.match(/^.*?[.;](?=\s|$)/);
201
205
  const full = `${desc} Use when: ${first ? first[0] : trig}`;
202
- if (full.length <= DESCRIPTION_CAP) return full;
206
+ if (full.length <= DESCRIPTION_CAP) return full.replace(/;$/, '.');
203
207
  const cut = full.slice(0, DESCRIPTION_CAP);
204
208
  const end = Math.max(cut.lastIndexOf('. '), cut.lastIndexOf('; '));
205
209
  return end > desc.length ? cut.slice(0, end + 1) : cut.replace(/\s+\S*$/, '') + '…';
@@ -356,21 +360,30 @@ const WEBFETCH_MARKER = '<!-- webfetch: allow -->';
356
360
 
357
361
  /**
358
362
  * `_build_emit._claude_agent_frontmatter`. A read-only spec gets a `disallowedTools` DENYLIST;
359
- * each opt-in marker takes its tool back off the list. Order is emit order: WebFetch before
360
- * Bash keeps the unmarked line byte-identical to what it was before the webfetch marker existed.
363
+ * each opt-in marker takes its tools back off the list. Order is emit order.
364
+ *
365
+ * `Agent` and `Task` (the same tool, new name and old) are denied to EVERY read-only agent and
366
+ * no marker lifts them: a read-only agent that can dispatch can spawn a writer, and the denylist
367
+ * of the child, not the parent's, is what that writer runs under. The specs already say a seat
368
+ * dispatches no sub-agents; this is the boundary under the sentence.
369
+ *
370
+ * STILL OPEN: an MCP tool that writes (`mcp__github__push_files`, a database server). A denylist
371
+ * cannot name tools it has never seen, so a read-only agent in a session with such a server can
372
+ * still write through it, until this becomes an allowlist (`tools:`).
361
373
  */
362
374
  function claudeAgentFrontmatter(stem, text, overrides) {
363
375
  const fm = [`name: ${stem}`, `description: ${jsonDumps(agentDescription(text))}`];
364
376
  const ov = agentOverride(overrides, stem);
365
377
  if (isTruthy(ov.model)) fm.push(`model: ${formatValue(ov.model)}`);
366
378
  if (isReadonly(text)) {
367
- const list = ['Write', 'Edit', 'NotebookEdit'];
379
+ const list = ['Write', 'Edit', 'NotebookEdit', 'Agent', 'Task'];
368
380
  if (!text.includes(WEBFETCH_MARKER)) list.push('WebFetch');
369
381
  // Bash AND PowerShell: docs `tools-reference.md` says denying Bash turns PowerShell off
370
382
  // only for settings rules and `--disallowedTools` — agent frontmatter is not named there,
371
383
  // so a "read-only" agent on Windows could still run shell commands via PowerShell
372
- // (Claude verdict R1). The one opt-in marker lifts both together.
373
- if (!text.includes(BASH_MARKER)) list.push('Bash', 'PowerShell');
384
+ // (Claude verdict R1). Monitor is the third shell: it runs a `command` in the background.
385
+ // The one opt-in marker lifts all three together.
386
+ if (!text.includes(BASH_MARKER)) list.push('Bash', 'PowerShell', 'Monitor');
374
387
  fm.push(`disallowedTools: ${list.join(', ')}`);
375
388
  }
376
389
  return fm;
@@ -577,6 +590,19 @@ export function claimer(oldOwned, cfg, manifestExisted = true, oldHashes = {}, f
577
590
  };
578
591
  claim.editRefused = editRefused;
579
592
  claim.kept = kept;
593
+ // The manifest's next `kept_hashes` (spec 2026-11-13 §1), read once every writer has claimed.
594
+ // A rel refused for an edit NOW records the hash its last write left (`oldHashes`). From the
595
+ // next emit on it is no longer in `owned`, so the claim refuses it as pre-existing and it lands
596
+ // in `kept`, not `editRefused`: the entry the previous manifest held is carried forward. A rel
597
+ // claimed again (restored, deleted, `--force`) or no longer shipped is in neither set, and drops.
598
+ claim.keptHashes = (oldKeptHashes = {}) => {
599
+ const out = {};
600
+ for (const rel of editRefused) if (Object.hasOwn(oldHashes, rel)) out[rel] = oldHashes[rel];
601
+ for (const rel of kept) {
602
+ if (!Object.hasOwn(out, rel) && Object.hasOwn(oldKeptHashes, rel)) out[rel] = oldKeptHashes[rel];
603
+ }
604
+ return out;
605
+ };
580
606
  // Did the previous emit write `dest`? Read by `writeNativeLayer` for a skill's side files.
581
607
  claim.owned = (dest) => oldSet !== null && cfg != null && oldSet.has(relPosix(cfg, dest));
582
608
  return claim;
@@ -176,9 +176,9 @@ export function hashesOf(doc) {
176
176
  * An OpenCode manifest's `skill_denies` — the `permission.skill` denies Geneseed itself added
177
177
  * (`opencodeLayer` records them; a deny the user wrote, even on a Geneseed skill, is never in
178
178
  * it) — or `[]` when the manifest, or the key, is absent or malformed, which sweeps nothing.
179
- * Unlike the `permission.bash` gates (left in place at uninstall, which fails closed — see
180
- * `reconcileOpencodePermission`), a skill-visibility deny is reversible: once uninstalled there
181
- * is no skill left to hide, and the name is the user's to reuse. One home because rebuild's
179
+ * A skill-visibility deny is reversible: once uninstalled there is no skill left to hide, and
180
+ * the name is the user's to reuse — uninstall takes the recorded ones back, as it does the
181
+ * recorded `permission.bash` gates (`recordedGates`). One home because rebuild's
182
182
  * deny sweep and uninstall must agree on what Geneseed owns.
183
183
  */
184
184
  export function recordedDenies(doc) {
@@ -202,9 +202,10 @@ export function recordedEdit(doc) {
202
202
 
203
203
  /**
204
204
  * An OpenCode manifest's `bash_gates` — the `permission.bash` keys Geneseed itself added, which
205
- * a later build may take back once their rule is off (`reconcileOpencodePermission`). Absent or
206
- * malformed reads as nothing owned, like `recordedDenies`: a manifest from before 5.2.0 has no
207
- * such key, so its gates stay until `--prune-gates` or a hand edit.
205
+ * a later build may take back once their rule is off (`reconcileOpencodePermission`) and an
206
+ * uninstall takes back outright (`unmergeOpencodeJson`). Absent or malformed reads as nothing
207
+ * owned, like `recordedDenies`: a manifest from before 5.2.0 has no such key, so its gates stay
208
+ * until `--prune-gates` or a hand edit.
208
209
  */
209
210
  export function recordedGates(doc) {
210
211
  const g = doc && doc.bash_gates;
@@ -17,7 +17,9 @@
17
17
  * and become a gate-error ask on every write in every repo; any surprise is a defer.
18
18
  *
19
19
  * The OpenCode guard (`adapters/opencode/plugins/geneseed-guard.js`, `ownershipBlock`) is this
20
- * file's twin and cannot import it — keep the two in step.
20
+ * file's twin and cannot import it. Its constants are copied from here by `tests/twins.mjs`
21
+ * (the two marked blocks and three one-line constants); the function reads another payload
22
+ * and is kept in step by hand.
21
23
  */
22
24
  import { appendFileSync, mkdirSync, readFileSync, readdirSync } from 'node:fs';
23
25
  import os from 'node:os';
@@ -26,6 +28,10 @@ import { withoutBlocks } from '../lib/managed-block.mjs';
26
28
  import { normcase } from '../lib/paths.mjs';
27
29
  import { gitRootOf, mainWorktreeOf } from './gitref.mjs';
28
30
 
31
+ // ---- ownership shape twin: BEGIN — adapters/opencode/plugins/geneseed-guard.js and
32
+ // geneseed-context.js carry everything down to the END marker verbatim (node tests/twins.mjs
33
+ // --write keeps it), and the one-line `WRITE_NAME_RE`, `safeStem` and `DECLINED_RE` below too.
34
+
29
35
  // D5: the build manifests that make a git root an "application". Exact names, plus two families.
30
36
  const MANIFESTS = new Set(['package.json', 'pom.xml', 'pyproject.toml', 'go.mod', 'Cargo.toml',
31
37
  'composer.json', 'Gemfile']);
@@ -36,6 +42,8 @@ const isManifest = (n) => MANIFESTS.has(n) || n.startsWith('build.gradle') || n.
36
42
  // sits after the `\r`.
37
43
  const SECTION_RE = /^## Ownership[ \t]*\r?$/m;
38
44
 
45
+ // ---- ownership shape twin: END
46
+
39
47
  // Write-shaped tool names (Bob's `tool-gate` also routes reads here: `read_file` carries a path).
40
48
  export const WRITE_NAME_RE = /write|edit|diff|replace|insert|move|rename|delete|remove|trash|copy/i;
41
49
 
@@ -51,6 +59,9 @@ function userTag() {
51
59
  try { return safeStem(os.userInfo().username); } catch { return 'user'; }
52
60
  }
53
61
 
62
+ // ---- ownership text twin: BEGIN — adapters/opencode/plugins/geneseed-guard.js carries everything
63
+ // down to the END marker verbatim (node tests/twins.mjs --write keeps it).
64
+
54
65
  const TAIL = 'Opt out per repo: `## Ownership` with `mode: off` in the root `AGENTS.md`; per '
55
66
  + 'install: rebuild with `--no-ownership-gate`. Offer the full documentation '
56
67
  + '(`/document-project`) as yes / later. Stop and ask the developer now; re-issue the write only '
@@ -68,6 +79,8 @@ const REASON_NO_SECTION = 'Geneseed (Ownership) — this application\'s `AGENTS.
68
79
  + '`## Ownership` section. Before writing, ask the developer: add the Ownership section now '
69
80
  + `(ownership skill); ${SKIP}? ${TAIL}`;
70
81
 
82
+ // ---- ownership text twin: END
83
+
71
84
  // D2: the developer's durable, personal, per-repo decline, in `.geneseed/ownership.md`. It holds
72
85
  // until the line is deleted or the setup runs (which removes it); a `## Ownership` section in
73
86
  // `AGENTS.md`, on or off, outranks it. The OpenCode twins (geneseed-guard.js,