geneseed 4.32.0 → 5.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 (245) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/DESIGN.md +2 -2
  3. package/README.md +6 -5
  4. package/SHIPPED.md +4 -3
  5. package/adapters/bob/README.md +6 -5
  6. package/adapters/claude-code/README.md +4 -3
  7. package/adapters/claude-code/skills/geneseed/SKILL.md +1 -1
  8. package/adapters/openclaude/README.md +4 -3
  9. package/adapters/opencode/GLOBAL-HARNESS-SPEC.md +3 -1
  10. package/adapters/opencode/HOW-OPENCODE-LOADS.md +2 -1
  11. package/adapters/opencode/README.md +18 -18
  12. package/adapters/opencode/plugins/geneseed-activity.js +57 -1
  13. package/adapters/opencode/plugins/geneseed-context.js +85 -18
  14. package/adapters/opencode/plugins/geneseed-guard.js +437 -76
  15. package/adapters/opencode/plugins/geneseed-learn.js +97 -23
  16. package/bin/geneseed-cli.mjs +17 -25
  17. package/bin/geneseed-hook.mjs +23 -8
  18. package/docs/DESIGN.md +175 -0
  19. package/docs/PRD.md +111 -0
  20. package/docs/README.md +3 -2
  21. package/docs/architecture.md +145 -0
  22. package/docs/concepts/agents.md +1 -1
  23. package/docs/concepts/collaboration.md +1 -1
  24. package/docs/concepts/enforcement-table.md +1 -1
  25. package/docs/concepts/exclusions.md +5 -5
  26. package/docs/concepts/footprint.md +1 -1
  27. package/docs/concepts/foreman-mode.md +2 -2
  28. package/docs/concepts/hooks.md +22 -8
  29. package/docs/concepts/host-matrix.md +2 -2
  30. package/docs/concepts/hosts.md +1 -1
  31. package/docs/concepts/kits.md +3 -1
  32. package/docs/concepts/ownership.md +1 -1
  33. package/docs/concepts/rules.md +15 -2
  34. package/docs/concepts/shared-tier.md +73 -0
  35. package/docs/concepts/skills.md +2 -2
  36. package/docs/concepts/themes.md +1 -1
  37. package/docs/extending.md +13 -12
  38. package/docs/guides/install-claude-code.md +1 -1
  39. package/docs/guides/install-opencode.md +1 -1
  40. package/docs/guides/migrate.md +4 -2
  41. package/docs/guides/project-context.md +2 -2
  42. package/docs/guides/setup-footprint.md +1 -1
  43. package/docs/guides/uninstall.md +2 -1
  44. package/docs/guides/upgrade-to-5.md +116 -0
  45. package/docs/guides/upgrade.md +21 -9
  46. package/docs/guides/wiki.md +3 -3
  47. package/docs/reference/env-context.md +5 -3
  48. package/docs/reference/environment.md +1 -1
  49. package/docs/reference/glossary.md +2 -0
  50. package/docs/reference/opencode-plugins.md +3 -3
  51. package/docs/reference/plugin-activity.md +1 -1
  52. package/docs/reference/plugin-context.md +1 -0
  53. package/docs/reference/plugin-guard.md +14 -6
  54. package/docs/reference/plugin-learn.md +13 -6
  55. package/docs/reference/troubleshoot-hooks.md +3 -3
  56. package/docs/reference/troubleshoot-update.md +14 -0
  57. package/docs/token-footprint.md +4 -3
  58. package/docs/understand/a-day.md +2 -2
  59. package/docs/understand/design-choices-install.md +2 -1
  60. package/docs/understand/enforced-vs-asked.md +1 -1
  61. package/docs/understand/machine-bob.md +2 -0
  62. package/docs/understand/machine-claude.md +7 -5
  63. package/docs/understand/machine-opencode.md +7 -5
  64. package/docs/understand/on-your-machine.md +4 -0
  65. package/docs/understand/take-it-out.md +1 -1
  66. package/docs/web-ui.md +126 -68
  67. package/harness.config.json +1 -1
  68. package/js/README.md +10 -6
  69. package/js/build/args.mjs +10 -8
  70. package/js/build/bundle.mjs +11 -13
  71. package/js/build/driver.mjs +66 -65
  72. package/js/build/emit-claude.mjs +22 -16
  73. package/js/build/emit-common.mjs +4 -5
  74. package/js/build/emit-opencode.mjs +22 -22
  75. package/js/build/fold.mjs +515 -0
  76. package/js/build/generate.mjs +41 -52
  77. package/js/build/render.mjs +115 -29
  78. package/js/build/source.mjs +4 -1
  79. package/js/build/stubs.mjs +70 -9
  80. package/js/build/version.mjs +10 -10
  81. package/js/cli-table.json +23 -83
  82. package/js/hosts/activity.mjs +2 -2
  83. package/js/hosts/geneseed-dir.mjs +1 -1
  84. package/js/hosts/hooks-context.mjs +389 -99
  85. package/js/hosts/hooks-learn.mjs +38 -7
  86. package/js/hosts/hooks-prims.mjs +4 -2
  87. package/js/hosts/hooks.mjs +114 -39
  88. package/js/hosts/hosts.mjs +150 -51
  89. package/js/hosts/installs.mjs +55 -167
  90. package/js/hosts/link.mjs +3 -5
  91. package/js/hosts/mcp.mjs +1 -1
  92. package/js/hosts/memory-files.mjs +219 -17
  93. package/js/hosts/ownership-gate.mjs +1 -1
  94. package/js/hosts/settings.mjs +18 -13
  95. package/js/hosts/shim.mjs +4 -33
  96. package/js/hosts/store-watch.mjs +189 -0
  97. package/js/inspect/checks-authoring.mjs +3 -3
  98. package/js/inspect/checks-build.mjs +45 -18
  99. package/js/inspect/checks-counts.mjs +4 -4
  100. package/js/inspect/checks-repo.mjs +13 -14
  101. package/js/inspect/cost.mjs +24 -2
  102. package/js/inspect/diff.mjs +123 -123
  103. package/js/inspect/doctor.mjs +22 -27
  104. package/js/inspect/excludes.mjs +181 -62
  105. package/js/inspect/inventory.mjs +22 -27
  106. package/js/inspect/registry.mjs +106 -30
  107. package/js/inspect/scan.mjs +5 -5
  108. package/js/inspect/status.mjs +141 -119
  109. package/js/inspect/validate.mjs +22 -24
  110. package/js/lib/fs.mjs +47 -50
  111. package/js/lib/json.mjs +10 -17
  112. package/js/lib/machine-dir.mjs +73 -0
  113. package/js/lib/paths.mjs +22 -33
  114. package/js/lib/proc.mjs +1 -1
  115. package/js/lib/prompt.mjs +19 -27
  116. package/js/lib/text.mjs +8 -12
  117. package/js/lib/udiff.mjs +11 -15
  118. package/js/loop/catalog.mjs +2 -3
  119. package/js/maintain/memory.mjs +17 -17
  120. package/js/maintain/migrate.mjs +79 -89
  121. package/js/maintain/setup.mjs +43 -32
  122. package/js/maintain/uninstall.mjs +43 -61
  123. package/js/maintain/update.mjs +200 -93
  124. package/js/ui/anim.mjs +21 -35
  125. package/js/ui/cli.mjs +36 -58
  126. package/js/ui/menu.mjs +22 -45
  127. package/js/ui/tui.mjs +27 -67
  128. package/js/web/actions.mjs +34 -34
  129. package/js/web/api.mjs +130 -74
  130. package/js/web/catalog.mjs +175 -46
  131. package/js/web/docs.mjs +33 -12
  132. package/js/web/doctor-worker.mjs +14 -0
  133. package/js/web/handler.mjs +14 -5
  134. package/js/web/routes.mjs +17 -19
  135. package/js/web/state.mjs +78 -19
  136. package/js/web/update-check.mjs +25 -10
  137. package/js/web/user-files.mjs +50 -105
  138. package/package.json +7 -4
  139. package/registry.json +48 -55
  140. package/src/AGENT.md.tmpl +13 -14
  141. package/src/agents/_self-improvement.md +1 -1
  142. package/src/agents/_template.md +1 -1
  143. package/src/agents/advocate.md +1 -1
  144. package/src/agents/architect.md +1 -1
  145. package/src/agents/developer.md +1 -1
  146. package/src/agents/devops-engineer.md +1 -1
  147. package/src/agents/docker-expert.md +1 -1
  148. package/src/agents/docs.md +1 -1
  149. package/src/agents/empiricist.md +1 -1
  150. package/src/agents/explorer.md +1 -1
  151. package/src/agents/framer.md +1 -1
  152. package/src/agents/historian.md +1 -1
  153. package/src/agents/kubernetes-specialist.md +1 -1
  154. package/src/agents/memory-curator.md +2 -2
  155. package/src/agents/operator.md +1 -1
  156. package/src/agents/performance.md +1 -1
  157. package/src/agents/pragmatist.md +1 -1
  158. package/src/agents/react-engineer.md +1 -1
  159. package/src/agents/react-reviewer.md +1 -1
  160. package/src/agents/researcher.md +1 -1
  161. package/src/agents/reviewer.md +1 -1
  162. package/src/agents/security.md +1 -1
  163. package/src/agents/skeptic.md +1 -1
  164. package/src/agents/spring-boot-engineer.md +1 -1
  165. package/src/agents/spring-reviewer.md +1 -1
  166. package/src/agents/spring-security.md +1 -1
  167. package/src/agents/steward.md +1 -1
  168. package/src/agents/tester.md +1 -1
  169. package/src/agents/user-advocate.md +1 -1
  170. package/src/agents/visionary.md +1 -1
  171. package/src/memory/README.md +1 -1
  172. package/src/skills/_self-improvement.md +2 -2
  173. package/src/skills/daydream/SKILL.md +2 -2
  174. package/src/skills/daydream/instructions.md +1 -1
  175. package/src/skills/geneseed.md +1 -1
  176. package/src/skills/learn-mode.md +1 -2
  177. package/src/skills/profile.md +2 -2
  178. package/src/skills/rule/approve.md +69 -0
  179. package/src/skills/rule/consolidate.md +3 -3
  180. package/src/skills/rule.md +13 -5
  181. package/src/skills/skill-forge.md +1 -1
  182. package/src/skills/teach.md +29 -12
  183. package/src/skills/wiki.md +1 -1
  184. package/themes/_TEMPLATE.json +1 -2
  185. package/themes/biker.json +1 -2
  186. package/themes/commentator.json +1 -2
  187. package/themes/cyberpunk.json +1 -2
  188. package/themes/gamer.json +1 -2
  189. package/themes/imperial.json +1 -2
  190. package/themes/joker.json +1 -2
  191. package/themes/marvin.json +1 -2
  192. package/themes/mean.json +1 -2
  193. package/themes/military.json +1 -2
  194. package/themes/neutral.json +1 -2
  195. package/themes/pirate.json +1 -2
  196. package/themes/sports.json +1 -2
  197. package/themes/verstappen.json +1 -2
  198. package/themes/wizard.json +1 -2
  199. package/web/dist/assets/Activity-D8G4eClY.js +1 -0
  200. package/web/dist/assets/ActivityDetail-BtOBYk3M.js +1 -0
  201. package/web/dist/assets/AgentGlyph-k6o3gCM1.js +1 -0
  202. package/web/dist/assets/Bonsai-B_y20b3i.js +1 -0
  203. package/web/dist/assets/{CopyButton-C5Li6awl.js → CopyButton-CHQte7Ap.js} +1 -1
  204. package/web/dist/assets/Dashboard-B8uXeJZ_.js +2 -0
  205. package/web/dist/assets/Docs-Dgv_MWfT.js +5 -0
  206. package/web/dist/assets/GreenhouseView-CSzTMSl_.js +1 -0
  207. package/web/dist/assets/Installs-BDk9lqBI.js +3 -0
  208. package/web/dist/assets/JournalView-CvRk1-m5.js +1 -0
  209. package/web/dist/assets/Kits-CoITzxWM.js +1 -0
  210. package/web/dist/assets/Laws-Ctf5r9rE.js +3 -0
  211. package/web/dist/assets/Library-DNwHYVXt.js +3 -0
  212. package/web/dist/assets/{Loops-CzitjxGV.js → Loops-S85PMQ8m.js} +2 -2
  213. package/web/dist/assets/{Markdown-C4S4tTA7.js → Markdown-0ORz7tAc.js} +21 -21
  214. package/web/dist/assets/OperatorHudView-DuGz_sTk.js +1 -0
  215. package/web/dist/assets/Personal-afJNwvRS.js +2 -0
  216. package/web/dist/assets/{RailCats-D5weYPCS.js → RailCats-AW92uhsX.js} +1 -1
  217. package/web/dist/assets/Settings-CGDFz-6j.js +1 -0
  218. package/web/dist/assets/Tabs-1qLrnqmn.js +1 -0
  219. package/web/dist/assets/api-C46vAuqp.js +1 -0
  220. package/web/dist/assets/controls-D4wmg_pl.js +1 -0
  221. package/web/dist/assets/index-COTd4TRZ.js +3 -0
  222. package/web/dist/assets/index-CtorA7uK.css +1 -0
  223. package/web/dist/assets/motion-RlUl1osO.js +1 -0
  224. package/web/dist/assets/{sections-ChwaobfW.js → sections-CtFz7HFH.js} +1 -1
  225. package/web/dist/index.html +5 -5
  226. package/src/skills/quiz.md +0 -44
  227. package/web/dist/assets/Activity-Bjy64wHC.js +0 -1
  228. package/web/dist/assets/ActivityDetail-B0AaipP8.js +0 -1
  229. package/web/dist/assets/Bonsai-CJniRqaH.js +0 -1
  230. package/web/dist/assets/Dashboard-B-6DTmae.js +0 -2
  231. package/web/dist/assets/Docs-LRc30XL9.js +0 -5
  232. package/web/dist/assets/GreenhouseView-CcoYlaWo.js +0 -1
  233. package/web/dist/assets/Installs-dp1epTcE.js +0 -3
  234. package/web/dist/assets/JournalView-nFP4poCf.js +0 -1
  235. package/web/dist/assets/KitApply-DwyZUj57.js +0 -1
  236. package/web/dist/assets/Kits-C0IEdZXe.js +0 -1
  237. package/web/dist/assets/Laws-CkykmQWu.js +0 -3
  238. package/web/dist/assets/Library-Guh9HBZU.js +0 -2
  239. package/web/dist/assets/OperatorHudView-DLGNulIY.js +0 -1
  240. package/web/dist/assets/Personal-BMtberL8.js +0 -2
  241. package/web/dist/assets/Tabs-uYJqfuQt.js +0 -1
  242. package/web/dist/assets/api-BxjLd7Qd.js +0 -1
  243. package/web/dist/assets/index-DA7BiaE5.js +0 -3
  244. package/web/dist/assets/index-dbbDGFDq.css +0 -1
  245. package/web/dist/assets/motion-Bccx3zE8.js +0 -1
@@ -51,10 +51,11 @@ import { discoverNames, GATE_SWITCHES, PACK_ORDER, loadKits } from '../build/sou
51
51
  import { exportImprovements } from '../inspect/diff.mjs';
52
52
  import { cmdDoctor } from '../inspect/doctor.mjs';
53
53
  import { setupBuildArgs } from '../build/generate.mjs';
54
+ import { SHARED_TIER_BENEFIT, sharedTierCost, sharedTierFigure } from '../inspect/cost.mjs';
54
55
  import { GLOBAL_MANIFEST, HOSTS, opencodeConfigDir } from '../hosts/hosts.mjs';
55
56
  import {
56
57
  claudeCfg, defaultMode, defaultPosture, defaultTheme, EMIT_HOST_SCOPE, gatesOfDir, installedDefaults,
57
- readJsonMaybe, themeFiles,
58
+ readJsonMaybe, sharedTierOfDir, themeFiles,
58
59
  } from '../hosts/installs.mjs';
59
60
  import { printOut, printErr } from '../lib/fs.mjs';
60
61
  import { which } from '../lib/paths.mjs';
@@ -66,7 +67,7 @@ import { NO_WINDOW } from '../lib/proc.mjs';
66
67
  // the option tables
67
68
  // --------------------------------------------------------------------------------------
68
69
 
69
- /** `_harness_setup.THEME_BLURBS`. A theme without one shows its bare name. */
70
+ /** A theme without one shows its bare name. */
70
71
  const THEME_BLURBS = {
71
72
  neutral: 'plain professional voice',
72
73
  imperial: 'Warhammer 40k',
@@ -78,7 +79,6 @@ const THEME_BLURBS = {
78
79
  sports: 'play-by-play commentator',
79
80
  };
80
81
 
81
- /** `_harness_setup.POSTURE_BLURBS`. */
82
82
  const POSTURE_BLURBS = {
83
83
  peer: 'candid equal — dense, challenges, no flattery (default)',
84
84
  mentor: 'explains the why, checks understanding',
@@ -87,7 +87,6 @@ const POSTURE_BLURBS = {
87
87
  artisan: 'peer with toolsmith reflexes — terminal-first',
88
88
  };
89
89
 
90
- /** `_harness_setup.MODE_BLURBS`. */
91
90
  const MODE_BLURBS = {
92
91
  direct: 'the agent works every task itself, turn by turn (default)',
93
92
  foreman: 'triages tasks, hands blocking work to task workers',
@@ -112,8 +111,6 @@ const DOCTRINE_BLURBS = {
112
111
  };
113
112
 
114
113
  /**
115
- * `_harness_setup._theme_options`.
116
- *
117
114
  * The sort key is `(name != "neutral", name)`, which floats `neutral` to the top and leaves
118
115
  * the rest alphabetical — a boolean sorts False before True in Python, and `false < true` is
119
116
  * the same order once both are numbers here. `themeFiles()` is already name-sorted, so the
@@ -133,13 +130,11 @@ export function themeOptions() {
133
130
  return opts.length ? opts : [['neutral', THEME_BLURBS.neutral]];
134
131
  }
135
132
 
136
- /** `_harness_setup._posture_options`. */
137
- export function postureOptions() {
133
+ function postureOptions() {
138
134
  return discoverNames('postures', 'peer').map((n) => [n, POSTURE_BLURBS[n] ?? '']);
139
135
  }
140
136
 
141
- /** `_harness_setup._mode_options`. */
142
- export function modeOptions() {
137
+ function modeOptions() {
143
138
  return discoverNames('modes', 'direct').map((n) => [n, MODE_BLURBS[n] ?? '']);
144
139
  }
145
140
 
@@ -158,8 +153,6 @@ export function doctrineOptions() {
158
153
  }
159
154
 
160
155
  /**
161
- * `_harness_setup.EMIT_OPTIONS`.
162
- *
163
156
  * Exported since P6b: `/api/themes` returns the same nine as its `emits` list, and a copy
164
157
  * of a table under test silently stops being the table under test.
165
158
  */
@@ -177,7 +170,6 @@ export const EMIT_OPTIONS = [
177
170
  ['openclaude', 'Per-repo .openclaude/ (CLAUDE.md, agents, skills, hooks) for OpenClaude, committed into one repository.'],
178
171
  ];
179
172
 
180
- /** `_harness_setup.FOOTPRINT_OPTIONS`. */
181
173
  const FOOTPRINT_OPTIONS = [
182
174
  ['lean', 'Lean — terse rule lines + a pointer to the full laws file (default, lighter context).'],
183
175
  ['full', 'Full — every law\'s complete text inlined in AGENT.md.'],
@@ -248,7 +240,23 @@ export function askKits(deployed = null, kits = null) {
248
240
  }
249
241
 
250
242
  /**
251
- * `_harness_setup._collect_setup_lines` — the six questions, the plan, the confirm.
243
+ * The shared-tier question, for a PROJECT install only (D11: a global install owns the tier).
244
+ * The default is what the target install already says, so holding Enter keeps it; the trade is
245
+ * printed above the question, with this machine's own token figure in place of the example.
246
+ */
247
+ function askSharedTier(emit, root) {
248
+ const [host] = EMIT_HOST_SCOPE.get(emit) ?? [];
249
+ let on = false;
250
+ try { on = sharedTierOfDir(resolveOut(root || '.'), host); } catch { /* unreadable: off */ }
251
+ const figure = sharedTierFigure();
252
+ printOut(`\nShared tier — Benefit: ${SHARED_TIER_BENEFIT}\n Cost: ${sharedTierCost(figure ?? '0')}\n`);
253
+ return askChoice('Shared tier for this project',
254
+ [['no', 'this project reads only its own harness'], ['yes', 'also read your machine-wide tier']],
255
+ on ? 'yes' : 'no') === 'yes';
256
+ }
257
+
258
+ /**
259
+ * The six questions, the plan, the confirm.
252
260
  *
253
261
  * Returns the selection, or null when the confirm is declined. Every default is the
254
262
  * DEPLOYED value first (`installedDefaults`) and the CONFIGURED one second, which is why
@@ -294,12 +302,14 @@ export function collectSetupLines(kitMap = null) {
294
302
  inst.footprint || 'lean');
295
303
  let out = null;
296
304
  let root = null;
305
+ let sharedTier = false;
297
306
  // Every PROJECT emit needs the repo root — claude/bob/openclaude included: without `--out`
298
307
  // their CLAUDE.md/.claude land in the generator's default ./Harness, where the host never
299
308
  // looks.
300
309
  if (['opencode', 'claude', 'bob', 'openclaude'].includes(emit)) {
301
310
  root = ask('Repo root to install into', '.');
302
311
  out = root;
312
+ sharedTier = askSharedTier(emit, root);
303
313
  } else if (emit === 'files') {
304
314
  out = ask('Output dir for the bundle', 'Harness');
305
315
  }
@@ -326,13 +336,13 @@ export function collectSetupLines(kitMap = null) {
326
336
  const gated = Object.values(gates).some((on) => on === false);
327
337
  printOut(`\nAbout to run: geneseed build ${
328
338
  setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines, allPacks,
329
- excludeRules, undefined, excludeSkills, gates, kits).join(' ')}\n`);
339
+ excludeRules, undefined, excludeSkills, gates, kits, sharedTier).join(' ')}\n`);
330
340
  if (!confirm('Proceed?', true)) return null;
331
341
  // The key only when there is something to carry, so a selection that excludes no skill and
332
342
  // switches off no gate is the same object it was before either existed.
333
343
  return {
334
344
  theme, posture, mode, doctrines, excludeRules, ...(excludeSkills ? { excludeSkills } : {}),
335
- ...(gated ? { gates } : {}), ...(kits ? { kits } : {}),
345
+ ...(gated ? { gates } : {}), ...(kits ? { kits } : {}), ...(sharedTier ? { sharedTier } : {}),
336
346
  emit, out, root, footprint,
337
347
  };
338
348
  }
@@ -342,7 +352,7 @@ export function collectSetupLines(kitMap = null) {
342
352
  // --------------------------------------------------------------------------------------
343
353
 
344
354
  /**
345
- * `_harness_setup._java_major_ok` — does a `java -version` banner name a major >= minimum?
355
+ * Does a `java -version` banner name a major >= minimum?
346
356
  *
347
357
  * `21.0.2` gives 21 and the legacy `1.8.0` gives 1, which is never >= 21 — that asymmetry is
348
358
  * the whole function. `\p{Nd}` rather than `[0-9]` because Python's `\d` matches any Unicode
@@ -358,7 +368,7 @@ export function javaMajorOk(versionOutput, minimum = 21) {
358
368
  }
359
369
 
360
370
  /**
361
- * `_harness_setup._lsp_prereqs` — `(label, present, hint)` for what OpenCode cannot install
371
+ * `(label, present, hint)` for what OpenCode cannot install
362
372
  * for itself. Today that is a JDK 21+ for `jdtls`; the JS-runtime servers self-download.
363
373
  *
364
374
  * THE SECOND SPAWN ON THIS ENTRY POINT, and the reason `ALLOWED_SPAWNS` in
@@ -373,13 +383,8 @@ export function lspPrereqs() {
373
383
  let ok = false;
374
384
  if (java) {
375
385
  try {
376
- // `capture_output=True, text=True` — the banner goes to STDERR on every JVM, which is
377
- // why the Python reads `.stderr` and not `.stdout`.
378
- // `NO_WINDOW` on BOTH sides as of this commit. The reference reached for a bare
379
- // `subprocess.run` here rather than `_harness_core.run`, so the flag was missing from
380
- // the Python too and the java probe flashed a console from the web's setup action —
381
- // a defect the two implementations SHARED, which is exactly what a cross-
382
- // implementation comparison cannot report. Fixed in `_harness_setup.py` beside this.
386
+ // The banner goes to STDERR on every JVM, which is why this reads `.stderr`.
387
+ // `NO_WINDOW` so the java probe does not flash a console from the web's setup action.
383
388
  const out = spawnSync(java, ['-version'], { encoding: 'utf8', ...NO_WINDOW }).stderr;
384
389
  ok = javaMajorOk(out ?? '');
385
390
  } catch { ok = false; }
@@ -424,7 +429,7 @@ function emitFacts(emit, out) {
424
429
  }
425
430
 
426
431
  /**
427
- * `_harness_setup._setup_summary_lines` — the post-build report as `[kind, text]` rows,
432
+ * The post-build report as `[kind, text]` rows,
428
433
  * `kind` being ok | warn | info.
429
434
  *
430
435
  * `ok` is the build's own success, so the first row is the only one that can say "build
@@ -463,7 +468,7 @@ export function setupSummaryLines(theme, emit, out, root, ok) {
463
468
  lines.push(['warn', `a global install exists at ${cfg} — OpenCode loads THAT, `
464
469
  + `not this build; re-run with 'opencode-global' to change it`]);
465
470
  }
466
- } catch { /* as the Python's bare `except Exception` */ }
471
+ } catch { /* best effort */ }
467
472
  // LSP prereqs, for the OpenCode emits alone — they are the ones that get `"lsp": true`.
468
473
  if (ok && emit.startsWith('opencode')) {
469
474
  for (const [label, present, hint] of lspPrereqs()) {
@@ -484,7 +489,7 @@ export function setupSummaryLines(theme, emit, out, root, ok) {
484
489
  // --------------------------------------------------------------------------------------
485
490
 
486
491
  /**
487
- * `_harness_setup._setup_lines` — gather, export drift, build, summarise, offer the doctor.
492
+ * Gather, export drift, build, summarise, offer the doctor.
488
493
  *
489
494
  * THE BUILD IS AN IMPORT, NOT A SPAWN, for the reason P5e established for `harness build`:
490
495
  * the Python needs a second process because `build.py` is a different PROGRAM, and here the
@@ -517,6 +522,7 @@ export function setupLines() {
517
522
  const {
518
523
  theme, emit, out, root, footprint = 'lean', posture = 'peer', mode = 'direct',
519
524
  doctrines = null, excludeRules = null, excludeSkills = null, gates = {}, kits = null,
525
+ sharedTier = false,
520
526
  } = sel;
521
527
  if (emit === 'opencode-global') {
522
528
  // The build below overwrites the deployed global harness, which may carry hand edits (or
@@ -535,7 +541,7 @@ export function setupLines() {
535
541
  // runs must carry the pack selection the plan line just previewed, or the wizard would print
536
542
  // one command and run another.
537
543
  const argv = setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines,
538
- doctrineOptions().map(([n]) => n), excludeRules, undefined, excludeSkills, gates, kits);
544
+ doctrineOptions().map(([n]) => n), excludeRules, undefined, excludeSkills, gates, kits, sharedTier);
539
545
  printOut(`Running: geneseed build ${argv.join(' ')}\n`);
540
546
  const rc = driverMain(argv);
541
547
  if (rc !== 0) {
@@ -556,13 +562,18 @@ export function setupLines() {
556
562
  }
557
563
 
558
564
  /**
559
- * `_harness_setup.cmd_setup` — the TTY gate, then the wizard.
565
+ * The TTY gate, then the wizard.
560
566
  *
561
567
  * The refusal is the whole of what a cell can observe (see the module header) and it is the
562
568
  * only part of this file the acceptance matrix compares. `process.stdin.isTTY` is `undefined`
563
569
  * off a terminal rather than `false`, which is why it is negated rather than compared.
564
570
  */
565
- export function cmdSetup() {
571
+ export async function cmdSetup() {
572
+ const refusal = (await import('./update.mjs')).gateRefusal();
573
+ if (refusal) {
574
+ printErr(`[setup] not started: ${refusal}\n`);
575
+ return 1;
576
+ }
566
577
  if (!process.stdin.isTTY) {
567
578
  printErr('[setup] needs an interactive terminal. Non-interactive? e.g.:\n'
568
579
  + ' geneseed build --emit opencode-global --theme neutral\n');
@@ -661,7 +672,7 @@ function listDir(dir) {
661
672
  * search covers PATH and the usual per-user places, not every folder an installer may pick.
662
673
  * `false` is the user choosing to stop.
663
674
  */
664
- export function toolsReport(tools = hostTools()) {
675
+ function toolsReport(tools = hostTools()) {
665
676
  printOut('AI coding tools on this machine:\n');
666
677
  for (const [label, present, url, where] of tools) {
667
678
  if (!present) printOut(` -- ${label} not found — install: ${url}\n`);
@@ -31,7 +31,7 @@
31
31
  * the caller — `api_install_toggle` — and P6i ports it, so the pair arrives in the module
32
32
  * whose thirteen private helpers it shares (`pruneAncestors`, `settingsFile`, `claudeMdPath`,
33
33
  * `managedOf`, `ownedOf`, `installAgentEntry`, `unmergeOpencodeJson`, `rmtreeQuiet`, …),
34
- * exactly as `_harness_mcp.py` keeps them in one file. Deactivate is `_uninstall_global` with
34
+ * in one file. Deactivate is `_uninstall_global` with
35
35
  * `move` where it has `unlink`, plus an inverse; splitting them would have duplicated the
36
36
  * owned-file walk and the ancestor prune a fourth time.
37
37
  *
@@ -68,6 +68,8 @@ import {
68
68
  } from '../hosts/settings.mjs';
69
69
  import { printOut, printErr, readText, writeText, isFile, isDir, isOsError } from '../lib/fs.mjs';
70
70
  import { indexOfDeepEqual, isDict, jsonDumps, deepEquals } from '../lib/json.mjs';
71
+ import { sharedPaths } from '../lib/machine-dir.mjs';
72
+ import { archiveStore } from '../hosts/memory-files.mjs';
71
73
  import { comparePaths, isAbsolutePath } from '../lib/paths.mjs';
72
74
 
73
75
  const hostSpec = (host) => HOSTS.find((h) => h.host === host);
@@ -102,7 +104,7 @@ function rmtreeQuiet(p) {
102
104
 
103
105
  /** `Path.unlink()` inside a `try: ... except OSError: pass`. */
104
106
  function unlinkQuiet(p) {
105
- try { unlinkSync(p); } catch { /* as the Python's bare except OSError */ }
107
+ try { unlinkSync(p); } catch { /* best effort */ }
106
108
  }
107
109
 
108
110
  /**
@@ -114,7 +116,7 @@ function unlinkQuiet(p) {
114
116
  * file that could not be removed, and the whole matrix came back INCOMPLETE.
115
117
  */
116
118
  function rmdirQuiet(p) {
117
- try { rmdirSync(p); } catch { /* as the Python's except OSError */ }
119
+ try { rmdirSync(p); } catch { /* best effort */ }
118
120
  }
119
121
 
120
122
  /** `not any(d.iterdir())` — and False for a path that is not a readable directory. */
@@ -148,7 +150,7 @@ function pruneAncestors(start, stop) {
148
150
  * The manifest's `owned` list, unlinked one by one with the ancestor prune, returning
149
151
  * `[removed, failed, kept]`.
150
152
  *
151
- * The third copy of this loop in `_harness_mcp.py` and the reason it is one function here:
153
+ * One function because three callers share this loop:
152
154
  * `_uninstall_global` (rooted at the target), `_claude_uninstall` (rooted at the cfg dir) and
153
155
  * `_opencode_project_uninstall` (rooted at `.opencode/`, and the only one that PREFIXES its
154
156
  * failure strings) differ in the root and in the label, which are the two arguments. The
@@ -225,7 +227,7 @@ const REVERSAL_MARKERS = [GLOBAL_MANIFEST, '.geneseed-theme', '.geneseed-emit',
225
227
  '.geneseed-footprint', VERSION_MARKER];
226
228
 
227
229
  /**
228
- * `_harness_mcp._unmerge_opencode_json` — drop one `instructions` entry, leave every other
230
+ * Drop one `instructions` entry, leave every other
229
231
  * key intact.
230
232
  *
231
233
  * `denyNames`, Task 4 (O-1): the denies this install's manifest records writing
@@ -286,35 +288,7 @@ export function unmergeOpencodeJson(p, entry, denyNames = [], edit = null) {
286
288
  return true;
287
289
  }
288
290
 
289
- /**
290
- * `_harness_mcp._archive_store` — move a runtime store aside to a sibling
291
- * `archived-<name>/<timestamp>/`.
292
- *
293
- * NEVER a delete. Memory is the one thing in this system a user cannot rebuild, so the
294
- * destructive verb's most destructive option is still a move; `_archive_memory` is the same
295
- * function with `memory` hardcoded and is not ported separately because the only caller that
296
- * reaches it (`_uninstall_global(archive_memory=True)`) is called with `False` by
297
- * `_install_uninstall`, which is the CLI's only path in.
298
- *
299
- * `renameSync` rather than a copy-then-delete: the destination is a SIBLING of the source, so
300
- * it is the same device by construction and `shutil.move`'s cross-device fallback has nothing
301
- * to do. ponytail: rename, and the day a store can live on another volume this needs the
302
- * copy path back.
303
- */
304
- export function archiveStore(store) {
305
- // `toLocaleString('sv-SE')` — LOCAL time, matching the old hand-rolled stamp
306
- // (`getHours()`/`getMinutes()`/`getSeconds()` are all local-time getters, unlike
307
- // `toISOString()`'s UTC). sv-SE's default format is already zero-padded
308
- // "YYYY-MM-DD HH:MM:SS"; stripping the punctuation and reinserting one dash reproduces
309
- // the exact `YYYYMMDD-HHMMSS` shape the padStart version built by hand.
310
- const stamp = new Date().toLocaleString('sv-SE').replace(/\D/g, '').replace(/^(\d{8})/, '$1-');
311
- const dest = path.join(path.dirname(store), `archived-${path.basename(store)}`, stamp);
312
- mkdirSync(path.dirname(dest), { recursive: true });
313
- renameSync(store, dest);
314
- return dest;
315
- }
316
-
317
- /** `_harness_mcp._claude_md_path` — where the manifest says the managed block lives. */
291
+ /** Where the manifest says the managed block lives. */
318
292
  function claudeMdPath(cfg, managed) {
319
293
  const rel = ((managed && managed.claude_md) || {}).rel || 'CLAUDE.md';
320
294
  return resolvePath(path.join(cfg, rel));
@@ -331,7 +305,7 @@ function ownedOf(man) {
331
305
  }
332
306
 
333
307
  /**
334
- * `_harness_mcp._claude_uninstall` — reverse a Claude-style install at `cfg`.
308
+ * Reverse a Claude-style install at `cfg`.
335
309
  *
336
310
  * The survivors gate is the part worth reading twice. A locked owned file must NOT take the
337
311
  * manifest and markers with it: the manifest is this install's only qualifying signal
@@ -366,7 +340,7 @@ export function claudeUninstall(cfg, archiveMemory, force = false) {
366
340
  }
367
341
 
368
342
  /**
369
- * `_harness_mcp._uninstall_global` — reverse a global install at `target` via its manifest.
343
+ * Reverse a global install at `target` via its manifest.
370
344
  *
371
345
  * Host-aware at the top, and that dispatch is the whole reason a Claude/Bob/OpenClaude global
372
346
  * install and an OpenCode one can share one entry point: the Claude family has no
@@ -395,7 +369,7 @@ export function uninstallGlobal(target, archiveMemory, host = 'opencode', force
395
369
  }
396
370
 
397
371
  /**
398
- * `_harness_mcp._install_agent_entry` — the `instructions` entry to drop.
372
+ * The `instructions` entry to drop.
399
373
  *
400
374
  * A global install wires the ABSOLUTE posix path; a project install wires the relative
401
375
  * `…/AGENT.md` the emit recorded, read back off the live config so a bundle sub-dir layout
@@ -428,7 +402,7 @@ export function installAgentEntryOf(instr) {
428
402
  }
429
403
 
430
404
  /**
431
- * `_harness_mcp._opencode_project_uninstall` — reverse a per-repo OpenCode emit.
405
+ * Reverse a per-repo OpenCode emit.
432
406
  *
433
407
  * Two shapes, and which one runs is decided by the manifest's PRESENCE. With one,
434
408
  * `.opencode/` is unlinked file by file so a hand-added agent or plugin under it survives;
@@ -480,7 +454,7 @@ function opencodeProjectUninstall(root, force = false) {
480
454
  return result;
481
455
  }
482
456
 
483
- /** `_harness_mcp._install_data_dir` — where the manifest and the runtime stores live. */
457
+ /** Where the manifest and the runtime stores live. */
484
458
  function installDataDir(root, host = 'opencode', scope = 'global') {
485
459
  if (scope === 'project' && CLAUDE_STYLE.includes(host)) {
486
460
  return path.join(root, hostSpec(host).projectMarker);
@@ -489,7 +463,7 @@ function installDataDir(root, host = 'opencode', scope = 'global') {
489
463
  }
490
464
 
491
465
  /**
492
- * `_harness_mcp._owned_dirs_for` — the dirs the reversal was supposed to have emptied.
466
+ * The dirs the reversal was supposed to have emptied.
493
467
  *
494
468
  * EXISTENCE is the retry signal, not emptiness: the reversals only `rmdir` a directory they
495
469
  * found empty, so a survivor here means either a locked file inside it or the `rmdir` itself
@@ -508,7 +482,7 @@ export function ownedDirsFor(root, host, scope, data) {
508
482
  }
509
483
 
510
484
  /**
511
- * `_harness_mcp._install_uninstall` — permanently remove the install at `root`, then de-list
485
+ * Permanently remove the install at `root`, then de-list
512
486
  * it. Every op is best-effort and idempotent, so a partly-removed install can be retried.
513
487
  *
514
488
  * STEP 3 IS THE ONE WITH THE ARGUMENT IN IT. The ROOT markers are what the registry
@@ -670,7 +644,7 @@ function reconcileRootMarkers(root, host, scope) {
670
644
  }
671
645
 
672
646
  /**
673
- * `_harness_mcp._project_qualifies` — does `root` carry a REAL Geneseed project install?
647
+ * Does `root` carry a REAL Geneseed project install?
674
648
  *
675
649
  * The marker dir exists, is not the host's global seen from its parent (`isHostGlobalDir`, the
676
650
  * `installTargets` aliasing guard — the default `~/.claude` too, under `$CLAUDE_CONFIG_DIR`),
@@ -684,14 +658,14 @@ export function projectQualifies(root, host) {
684
658
  if (!isDir(cfg)) return false;
685
659
  try {
686
660
  if (isHostGlobalDir(host, cfg)) return false;
687
- } catch { /* as the Python's bare `except Exception: pass` */ }
661
+ } catch { /* best effort */ }
688
662
  if (isFile(path.join(cfg, GLOBAL_MANIFEST))) return true;
689
663
  const hs = emitHostScopeOf(root);
690
664
  return Boolean(hs) && hs[0] === host && hs[1] === 'project';
691
665
  }
692
666
 
693
667
  /**
694
- * `_harness_mcp._uninstall_resolve` — (host, scope, root), or null.
668
+ * (host, scope, root), or null.
695
669
  *
696
670
  * Precedence, most-specific first, and the ORDER of the first two is the subtle one: `~/.claude`
697
671
  * is NAMED like a project marker and is the global install, never `claude:project` rooted at
@@ -740,7 +714,7 @@ export function uninstallResolve(targetArg) {
740
714
  }
741
715
 
742
716
  /**
743
- * `_harness_mcp._surviving_project_installs` — the PROJECT installs still on record.
717
+ * The PROJECT installs still on record.
744
718
  *
745
719
  * A global uninstall never cascades: each project install is self-contained, its hook
746
720
  * commands invoke the shared checkout by absolute path rather than anything under the global
@@ -752,13 +726,13 @@ function survivingProjectInstalls(removedRoot) {
752
726
  const out = [];
753
727
  for (const [host, scope, root] of registeredTargets()) {
754
728
  if (scope !== 'project') continue;
755
- try { if (resolvePath(root) === rroot) continue; } catch { /* as the Python's except OSError */ }
729
+ try { if (resolvePath(root) === rroot) continue; } catch { /* best effort */ }
756
730
  out.push([host, scope, root]);
757
731
  }
758
732
  return out;
759
733
  }
760
734
 
761
- /** `_harness_mcp._print_surviving_project_inventory` — informational, never a cascade. */
735
+ /** Informational, never a cascade. */
762
736
  function printSurvivingProjectInventory(removedRoot) {
763
737
  const survivors = survivingProjectInstalls(removedRoot);
764
738
  if (!survivors.length) return;
@@ -771,7 +745,7 @@ function printSurvivingProjectInventory(removedRoot) {
771
745
  }
772
746
 
773
747
  /**
774
- * `_harness_mcp._print_other_host_hits` — one message per ADDITIONAL host at the same root.
748
+ * One message per ADDITIONAL host at the same root.
775
749
  *
776
750
  * A repo can carry `.opencode/`, `.claude/` and `.bob/` side by side and `uninstall` only ever
777
751
  * removes the one it resolved to, so a repeat run needs to know there is more to do.
@@ -785,9 +759,18 @@ function printOtherHostHits(root, removedHost) {
785
759
  }
786
760
  }
787
761
 
762
+ /** D8: where the tier lives, and that no uninstall touches it. Silent when there is none. */
763
+ function printSharedTier() {
764
+ try {
765
+ const { root } = sharedPaths();
766
+ if (isDir(root)) {
767
+ printOut(`[uninstall] the shared tier at ${root} is never touched, even by the last host; `
768
+ + 'delete it by hand if you want it gone.\n');
769
+ }
770
+ } catch { /* no home directory: no tier to name */ }
771
+ }
772
+
788
773
  /**
789
- * `_harness_mcp.cmd_uninstall`.
790
- *
791
774
  * The printing is the loud half and the deletions are the quiet one; the cells gate both. The
792
775
  * inventory at the end is informational in the strict sense — a global uninstall never
793
776
  * touches a project install, and saying so is the only thing those two branches do.
@@ -832,6 +815,7 @@ export function cmdUninstall(args) {
832
815
  }
833
816
  printOut('[uninstall] memory/ and notebook/ are kept in place (never deleted here)'
834
817
  + (stores.length ? ' — --archive-memory sets both aside.' : '.') + '\n');
818
+ if (scope === 'global') printSharedTier();
835
819
  if (stores.length && args.archiveMemory) {
836
820
  printOut(`[uninstall] ${stores.join(' + ')}: will be ARCHIVED to a sibling `
837
821
  + 'archived-<name>/<timestamp>/ (never deleted)\n');
@@ -887,7 +871,7 @@ export function cmdUninstall(args) {
887
871
  // directory) has no successor.
888
872
 
889
873
  /**
890
- * `_harness_mcp._move_tree` — move a file or dir, refusing an existing destination.
874
+ * Move a file or dir, refusing an existing destination.
891
875
  *
892
876
  * THE REFUSAL IS THE CONTRACT, not a safety net: the stash is what a reactivate restores
893
877
  * FROM, so silently overwriting a destination would destroy the only copy of whatever was
@@ -914,7 +898,7 @@ function moveTree(src, dst) {
914
898
  }
915
899
 
916
900
  /**
917
- * `_harness_mcp._stashed_kind` — which kind of install a stash holds, from its CONTENTS.
901
+ * Which kind of install a stash holds, from its CONTENTS.
918
902
  *
919
903
  * There is no recorded tag, on purpose. A project stash carries `.opencode/`; a global one
920
904
  * carries the moved owned files. `null` for an empty or missing stash.
@@ -927,7 +911,7 @@ function stashedKind(root) {
927
911
  }
928
912
 
929
913
  /**
930
- * `_harness_mcp._install_relive` — the disabled install's CONTENT was re-created live.
914
+ * The disabled install's CONTENT was re-created live.
931
915
  *
932
916
  * The user ran `build`/`upgrade` while disabled. The live signal is KIND-SPECIFIC and the
933
917
  * stashed kind is what picks it: a global deactivate moves AGENT.md aside (leaving the
@@ -939,7 +923,7 @@ function installRelive(root) {
939
923
  return isFile(path.join(root, 'AGENT.md'));
940
924
  }
941
925
 
942
- /** `_harness_mcp._install_move_list` — the rels to move aside, `ownedWithin`-guarded. */
926
+ /** The rels to move aside, `ownedWithin`-guarded. */
943
927
  function installMoveList(root, kind) {
944
928
  let rels;
945
929
  if (kind === 'project') {
@@ -951,7 +935,7 @@ function installMoveList(root, kind) {
951
935
  }
952
936
 
953
937
  /**
954
- * `_harness_mcp._install_readd_entry` — put back JUST the AGENT.md `instructions` entry.
938
+ * Put back JUST the AGENT.md `instructions` entry.
955
939
  *
956
940
  * Deliberately a minimal inline re-add rather than the emit's own merge, whose side effects
957
941
  * (adding `permission` and `lsp: true` when absent) would clobber values the user may have
@@ -1069,7 +1053,7 @@ function restoreAll(stash, base, skip = null) {
1069
1053
  }
1070
1054
 
1071
1055
  /**
1072
- * `_harness_mcp._install_deactivate` — turn an OpenCode install off without deleting a byte.
1056
+ * Turn an OpenCode install off without deleting a byte.
1073
1057
  *
1074
1058
  * The config edit is the LAST step and the only non-move mutation, so a move failure rolls
1075
1059
  * back cleanly with the `instructions` entry still intact. The prune climbs from each moved
@@ -1103,7 +1087,7 @@ export function installDeactivate(root, host = 'opencode', scope = 'global') {
1103
1087
  return { ok: true, kind, moved: done.length };
1104
1088
  }
1105
1089
 
1106
- /** `_harness_mcp._install_reactivate` — the inverse. */
1090
+ /** The inverse. */
1107
1091
  export function installReactivate(root, host = 'opencode', scope = 'global') {
1108
1092
  if (CLAUDE_STYLE.includes(host)) return claudeReactivate(root, scope, host);
1109
1093
  if (installState(root) !== 'disabled') {
@@ -1140,7 +1124,7 @@ export function installReactivate(root, host = 'opencode', scope = 'global') {
1140
1124
  // each independently.
1141
1125
 
1142
1126
  /**
1143
- * `_harness_mcp._clean_host_stash` — drop this host's stash and the parent if it empties.
1127
+ * Drop this host's stash and the parent if it empties.
1144
1128
  *
1145
1129
  * So 'disabled' never lingers as an empty marker, and a same-root other-host stash is left
1146
1130
  * standing.
@@ -1152,7 +1136,7 @@ function cleanHostStash(cfg, host = 'claude') {
1152
1136
  }
1153
1137
 
1154
1138
  /**
1155
- * `_harness_mcp._remerge_claude_hooks` — re-merge the canonical hooks and RECORD the claims.
1139
+ * Re-merge the canonical hooks and RECORD the claims.
1156
1140
  *
1157
1141
  * Threading the manifest's recorded claims through is what prunes stale groups; writing the
1158
1142
  * resulting set back is what keeps a group re-added after an interpreter or checkout move
@@ -1203,7 +1187,6 @@ function remergeClaudeHooks(cfg, root = cfg, host = 'claude') {
1203
1187
  }
1204
1188
  }
1205
1189
 
1206
- /** `_harness_mcp._claude_deactivate`. */
1207
1190
  function claudeDeactivate(root, scope = 'global', host = 'claude') {
1208
1191
  const cfg = claudeCfg(root, scope, host);
1209
1192
  // `installState` dispatches Claude-style hosts to `claudeState(root, scope, host)`, which
@@ -1239,7 +1222,6 @@ function claudeDeactivate(root, scope = 'global', host = 'claude') {
1239
1222
  return { ok: true, kind: host, moved: done.length };
1240
1223
  }
1241
1224
 
1242
- /** `_harness_mcp._claude_reactivate`. */
1243
1225
  function claudeReactivate(root, scope = 'global', host = 'claude') {
1244
1226
  const cfg = claudeCfg(root, scope, host);
1245
1227
  if (installState(root, host, scope) !== 'disabled') {