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
@@ -1,6 +1,5 @@
1
1
  /**
2
- * How a DEPLOYED install is recognised — `_harness_setup`'s detection half and
3
- * `_harness_mcp`'s registry-reading half, which are one subject in two Python files.
2
+ * How a DEPLOYED install is recognised — the detection half and the registry-reading half, one subject.
4
3
  *
5
4
  * EXTRACTED IN P5f, and by the same arithmetic that produced `js/hosts/hosts.mjs` and
6
5
  * `js/build/source.mjs`: this is the third verb-set to need it. P5d wrote `themeOfDir` and
@@ -29,7 +28,7 @@
29
28
  * That sentence was FALSE until wave 2 of the P0/P1 review: `installedDefaults` walked
30
29
  * `ROOT / "Harness"` and `ROOT.parent / "Harness"`, so on a checkout carrying a built
31
30
  * bundle every cell that seeded no emit marker read this developer's own install — four
32
- * web cells recorded it. Both candidates are gone (the argument is in the Python), and the
31
+ * web cells recorded it. Both candidates are gone, and the
33
32
  * claim is now true rather than aspirational.
34
33
  */
35
34
  import { existsSync, readdirSync } from 'node:fs';
@@ -39,8 +38,8 @@ import {
39
38
  CONFIG, GATE_SWITCHES, PACK_ORDER, RETIRED_KIT_IDS, THEMES, discoverNames, loadKits, resolveSkillNames,
40
39
  } from '../build/source.mjs';
41
40
  import {
42
- CLAUDE_STYLE, DISABLED_STASH, GLOBAL_MANIFEST, HOSTS, isHostGlobalDir, liveRecordedHooks,
43
- resolvePath,
41
+ CARRIERS, CLAUDE_STYLE, DISABLED_STASH, GLOBAL_MANIFEST, HOSTS, SHARED_TIER_RE, carriersFor, isHostGlobalDir,
42
+ liveRecordedHooks, resolvePath,
44
43
  } from './hosts.mjs';
45
44
  import { registryRoots } from '../inspect/registry.mjs';
46
45
  import { printErr, readText, isFile, isDir } from '../lib/fs.mjs';
@@ -48,6 +47,8 @@ import { formatRepr, isDict } from '../lib/json.mjs';
48
47
  import { comparePaths } from '../lib/paths.mjs';
49
48
  import { claudeHookShell, hookShimPath } from './shim.mjs';
50
49
 
50
+ export { carriersFor };
51
+
51
52
  /**
52
53
  * `Path.read_text(encoding="utf-8")`, or null where Python raises OSError.
53
54
  *
@@ -73,16 +74,14 @@ export function readJsonMaybe(p) {
73
74
  try { return JSON.parse(txt); } catch { return null; }
74
75
  }
75
76
 
76
- // ---- the configured defaults (`_harness_setup._default_*`) --------------------------------
77
+ // ---- the configured defaults ---------------------------------------------------------
77
78
 
78
79
  /**
79
- * `_harness_setup._default_theme` / `_default_posture` / `_default_mode`.
80
- *
81
80
  * One reader for three keys where the Python has three near-identical functions. The fallback
82
81
  * differs per key and is the argument, so nothing is shared that is not actually the same:
83
82
  * each is `harness.config.json`'s value or a literal, with an unreadable or non-JSON file
84
83
  * falling through to the literal. NOT `configDefaults()` from the driver, which warns on a
85
- * corrupt file — these three are silent, as their Python originals are.
84
+ * corrupt file — these three are silent.
86
85
  */
87
86
  function configuredDefault(key, fallback) {
88
87
  if (existsSync(CONFIG)) {
@@ -130,7 +129,7 @@ export function themeFiles(dir = THEMES) {
130
129
  .map((n) => path.join(dir, n)).sort(comparePaths);
131
130
  }
132
131
 
133
- /** `_harness_setup._theme_from_agent` — match a theme's unique LOADED_SIGIL in a carrier. */
132
+ /** Match a theme's unique LOADED_SIGIL in a carrier. */
134
133
  function themeFromAgent(agentMd) {
135
134
  const text = readMaybe(agentMd);
136
135
  if (text === null) return null;
@@ -142,56 +141,6 @@ function themeFromAgent(agentMd) {
142
141
  return null;
143
142
  }
144
143
 
145
- /**
146
- * `_harness_setup.CARRIERS` — the Python's four root-level carriers, plus one JS-only addition.
147
- *
148
- * A shared table rather than three copies of the same list: `_theme_of_dir`,
149
- * `_posture_of_dir` and `_mode_of_dir` each walk it, and the order is observable (the first
150
- * carrier that answers wins). `rules/geneseed.md` is spelled with `path.join` at each use
151
- * because the Python writes `d / "rules" / "geneseed.md"` for that one entry.
152
- *
153
- * `.openclaude/CLAUDE.md` is NOT in the Python — OpenClaude didn't exist yet — and it is half
154
- * of the fix for host-compat verdict B1 (the other half is `carriersFor`, below).
155
- * OpenClaude's own per-repo carrier is `carrierInLayer` (see `CLAUDE_SHAPED.openclaude` in
156
- * `js/build/driver.mjs`, and the `HOSTS` column of the same name): it sits at
157
- * `<repo>/.openclaude/CLAUDE.md`, and the root `CLAUDE.md` is deliberately left untouched so a
158
- * Claude Code install can share the repo.
159
- *
160
- * ⚠ THIS LIST STAYS HOST-AGNOSTIC ON PURPOSE — it is only `firstCarrier`'s FALLBACK for a
161
- * caller with no host to narrow by (none of this module's exported `*OfDir` readers is one;
162
- * see `carriersFor`). A caller that DOES have a host must pass it, or in a repo sharing two
163
- * carriers that answer the same probe — only root `CLAUDE.md` today, between `claude` and
164
- * `openclaude`'s global scope — this host-agnostic order decides for both of them, which was
165
- * exactly B1's failure mode reversed: reading `.openclaude/CLAUDE.md` unconditionally made
166
- * `claude`'s OWN read-back answer OpenClaude's settings in a shared repo.
167
- */
168
- const CARRIERS = [
169
- 'AGENT.md', path.join('.openclaude', 'CLAUDE.md'), 'CLAUDE.md',
170
- path.join('rules', 'geneseed.md'), 'AGENTS.md',
171
- ];
172
-
173
- /**
174
- * `host`'s own carrier path(s), narrowed off the single `HOSTS` table — `carrierInLayer` and
175
- * `projectMarker`/`agentFile` — rather than a second hand-rolled host→carrier map.
176
- *
177
- * ONE HOST, ONE ANSWER, EXCEPT BOB. `carrierInLayer` true (OpenClaude only) tries the nested
178
- * per-repo path FIRST and the bare `agentFile` SECOND, because the same column name means two
179
- * different locations depending on scope: `<repo>/.openclaude/CLAUDE.md` for a project
180
- * install, `<cfgDir>/CLAUDE.md` for a global one (see `CLAUDE_SHAPED.openclaude-global`,
181
- * which has no `carrierInLayer`). Bob is the one host with a second, differently-NAMED
182
- * carrier — `rules/geneseed.md` at global scope, because Bob never auto-loads a global
183
- * `AGENTS.md` (`CLAUDE_SHAPED['bob-global']`'s summary says so) — which `HOSTS` has no column
184
- * for and this hard-codes, same as the un-narrowed `CARRIERS` above always did.
185
- */
186
- export function carriersFor(host) {
187
- const row = HOSTS.find((h) => h.host === host);
188
- if (!row) return CARRIERS;
189
- if (host === 'bob') return [path.join('rules', 'geneseed.md'), row.agentFile];
190
- return row.carrierInLayer
191
- ? [path.join(row.projectMarker, row.agentFile), row.agentFile]
192
- : [row.agentFile];
193
- }
194
-
195
144
  /**
196
145
  * The scan `themeOfDir`, `leadOfDir`, `doctrinesOfDir` and `excludedRulesOfDir` each wrote
197
146
  * out: try each carrier in order, first answer wins. `probe(carrierPath)` returns
@@ -239,7 +188,7 @@ function firstCarrier(d, probe, fallback = null, host = null) {
239
188
  const THEME_NAME_RE = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
240
189
 
241
190
  /**
242
- * `_harness_setup._theme_of_dir` — the marker, else the sigil in one of five carriers.
191
+ * The marker, else the sigil in one of five carriers.
243
192
  *
244
193
  * The marker's value becomes `<themes>/<name>.json` in `loadTheme`, so a path in it
245
194
  * (`../harness.config`) loaded any `.json` as a theme. A value that is not a plain name falls
@@ -277,12 +226,9 @@ export function themeOfDir(d, host = null) {
277
226
  return firstCarrier(d, (carrierPath) => themeFromAgent(carrierPath) || undefined, null, host);
278
227
  }
279
228
 
280
- /** `_harness_setup.FOOTPRINTS`. */
281
229
  const FOOTPRINTS = ['lean', 'full'];
282
230
 
283
231
  /**
284
- * `_harness_setup._footprint_of_dir`.
285
- *
286
232
  * `status` reads no footprint row at all; the WARN is why this function is ported there, and
287
233
  * `diff` and `rebuild-all` read the RETURN value as well. An unrecognised marker is reported
288
234
  * rather than swallowed (Rule V, *Surface Failures* — VII before the three-tier renumber, and
@@ -303,7 +249,7 @@ export function footprintOfDir(d) {
303
249
  }
304
250
 
305
251
  /**
306
- * `_harness_setup._posture_of_dir` / `_mode_of_dir` — CONTENT-detected, not markered.
252
+ * CONTENT-detected, not markered.
307
253
  *
308
254
  * The inlined `## Posture` / `## Mode` section opens with a distinctive `**<Name>**` lead, so
309
255
  * a deployed install carries its register in the prose and needs no extra marker file. The
@@ -364,80 +310,6 @@ export function trustOfDir(d, host = null) {
364
310
  /** The `Active packs:` marker line the template emits, in one of the five carriers. */
365
311
  const ACTIVE_PACKS_RE = /^Active packs:[ \t]*(.+?)[ \t]*$/m;
366
312
 
367
- /**
368
- * A carrier rendered BEFORE the comms pack existed — the pre-4.0.0 address migration's one
369
- * detector, kept only to WARN now.
370
- *
371
- * The comms pack took `process 7` (reference codes) out of process, and `process 8` (one
372
- * writer per file) was renumbered to `process 7`. An install built before that names
373
- * `process` in its marker and not `comms`, and so does a later install whose owner turned
374
- * comms OFF — the marker alone cannot tell them apart. The carrier text can: a pre-comms
375
- * process pack had eight rules, so wherever it was active the carrier renders a
376
- * `process 8` heading, and wherever that rule was excluded the `Excluded rules:` line names
377
- * it. No current carrier can say `process 8` — the pack has seven rules and nothing cites
378
- * an eighth.
379
- *
380
- * 4.0.0 RETIRED THE AUTO-MIGRATION THIS DROVE (see `warnLegacyProcessCarrier` below): it used
381
- * to add `comms` and re-address `process 7`/`process 8` on sight, silently, which is exactly
382
- * backward the day the process pack ever regains an eighth rule for an unrelated reason —
383
- * this sniff would then fire on a CURRENT carrier and rewrite data nobody asked rewritten. A
384
- * false positive that only prints a loud warning and reads the carrier as written is safe to
385
- * keep; a false positive that mutates data was not. See CHANGELOG "Removed" (4.0.0) for the
386
- * upgrade instruction this now points installs at.
387
- */
388
- const legacyProcessCarrier = (text) => /\bprocess 8\b/.test(text);
389
-
390
- /**
391
- * The loud half of retiring the migration: one stderr line pointing a pre-comms install at
392
- * `geneseed setup`, instead of the silent rewrite `doctrinesOfDir`/`excludedRulesOfDir` used
393
- * to perform on the same detection. Never thrown — both are read-only introspection called by
394
- * `uninstall`, `diff`, `validate` and the web console, none of which should become
395
- * un-runnable against an install that merely needs a rebuild.
396
- *
397
- * NEVER `geneseed rebuild-all` — that is the exact command `rebuildAll` (`js/build/generate.mjs`)
398
- * now REFUSES to run against a legacy carrier (see `legacyProcessCarrierOfDir` there), because
399
- * running it is what caused the permanent data loss this fix round exists to stop. Pointing the
400
- * warning at the one command that is guaranteed to do nothing here would be a second silent
401
- * misread wearing a loud one's clothes.
402
- *
403
- * DEDUPED ONCE PER PROCESS — `doctor`/`validate`/`uninstall` read the same install's carrier
404
- * more than once per run, and a line per read drowns the one thing the owner needs to act on.
405
- * `resetLegacyProcessCarrierWarning` (below) exists only so tests can see the line fire more
406
- * than once in one process; nothing else should call it.
407
- */
408
- let warnedLegacyProcessCarrier = false;
409
- function warnLegacyProcessCarrier() {
410
- if (warnedLegacyProcessCarrier) return;
411
- warnedLegacyProcessCarrier = true;
412
- printErr('[geneseed] WARN: this install predates the comms pack (3.7.0, 2026-09-27) — its '
413
- + "carrier still names 'process 8'. The automatic migration (adding comms, re-addressing "
414
- + 'process 7/process 8) was removed in 4.0.0; the carrier is now read as written. Run '
415
- + '`geneseed setup` once to rebuild this install on the current rule addresses.\n');
416
- }
417
-
418
- /** Test-only: undo the dedup above so a test can see the warning fire again. */
419
- export function resetLegacyProcessCarrierWarning() {
420
- warnedLegacyProcessCarrier = false;
421
- }
422
-
423
- /**
424
- * Whether ANY of `d`'s own carriers still shows the pre-comms signature — the one question
425
- * `rebuildAll`, `upgrade` (which shells into it) and `migrate` must ask BEFORE calling
426
- * `installProfile`/`driverMain` on an install, now that `doctrinesOfDir`/`excludedRulesOfDir`
427
- * no longer rewrite it for them. Re-emitting a legacy carrier through the current template
428
- * does not raise an error — it just writes a fresh `Active packs:` line that silently drops
429
- * `comms` and leaves `process 7`/`process 8` unaddressed, permanently, with no further carrier
430
- * text left afterward for THIS function to ever detect again. Checking before the write is the
431
- * only point where the loss is still preventable.
432
- */
433
- export function legacyProcessCarrierOfDir(d, host = null) {
434
- return firstCarrier(d, (carrierPath) => {
435
- const text = readMaybe(carrierPath);
436
- if (text === null) return undefined;
437
- return legacyProcessCarrier(text) || undefined;
438
- }, false, host) === true;
439
- }
440
-
441
313
  /**
442
314
  * The doctrine packs a DEPLOYED install carries — the third register read back off disk,
443
315
  * beside `postureOfDir` and `modeOfDir`, and the first that is a SET.
@@ -478,12 +350,6 @@ export function doctrinesOfDir(d, host = null) {
478
350
  if (m[1] === 'none') return [];
479
351
  const named = m[1].split(',').map((s) => s.trim());
480
352
  if (!named.every((n) => PACK_ORDER.includes(n))) return null;
481
- // RETIRED MIGRATION (4.0.0): a pre-comms install used to gain `comms` here so it kept the
482
- // codes rule it carried inside `process`. That rewrite is gone — the carrier is read as
483
- // written, and the owner is warned loudly instead, once per read.
484
- if (named.includes('process') && !named.includes('comms') && legacyProcessCarrier(text)) {
485
- warnLegacyProcessCarrier();
486
- }
487
353
  return PACK_ORDER.filter((pk) => named.includes(pk));
488
354
  }, null, host);
489
355
  }
@@ -547,11 +413,6 @@ export function excludedRulesOfDir(d, host = null) {
547
413
  ? `${parts[0]}.${Number(parts[1])}` : null;
548
414
  });
549
415
  if (!ids.every(Boolean)) return [];
550
- // RETIRED MIGRATION (4.0.0): a pre-comms carrier used to have its old addresses
551
- // (`process.7` -> `comms.1`, `process.8` -> `process.7`) remapped here, once, so
552
- // `process 8` could not chain onward. That rewrite is gone — the addresses are returned
553
- // exactly as named, and the owner is warned loudly instead of having them silently moved.
554
- if (legacyProcessCarrier(text)) warnLegacyProcessCarrier();
555
416
  return [...new Set(ids)].sort();
556
417
  }, [], host);
557
418
  }
@@ -612,6 +473,20 @@ export function kitsOfDir(d, host = null, notify = null) {
612
473
  }, [], host);
613
474
  }
614
475
 
476
+
477
+ /**
478
+ * Whether a DEPLOYED install reads the shared tier (`--shared-tier on`), read back so `rebuild-all`,
479
+ * `upgrade`, `diff`, the wizard and the console re-render it. A missing line is `false`: the default
480
+ * is off, and the marker is only ever written when on (the skills line's contract).
481
+ */
482
+ export function sharedTierOfDir(d, host = null) {
483
+ return firstCarrier(d, (carrierPath) => {
484
+ const text = readMaybe(carrierPath);
485
+ if (text === null) return undefined;
486
+ return SHARED_TIER_RE.test(text) || undefined;
487
+ }, false, host);
488
+ }
489
+
615
490
  /**
616
491
  * Whether a DEPLOYED install keeps one law's hook gate armed — `true` (armed) or `false` (its
617
492
  * `<marker>: off` line, written by a build with that gate's `--no-*-gate` flag; `GATE_SWITCHES`).
@@ -636,16 +511,15 @@ export function gatesOfDir(d, host = null) {
636
511
  return Object.fromEntries(GATE_SWITCHES.map((g) => [g.key, gateOfDir(d, g.marker, host)]));
637
512
  }
638
513
 
639
- // ---- what host a deployed dir belongs to (`_harness_mcp`) ---------------------------------
514
+ // ---- what host a deployed dir belongs to ---------------------------------------------
640
515
 
641
- /** `_harness_mcp._claude_read_manifest`. */
642
516
  export function claudeReadManifest(cfgDir) {
643
517
  const data = readJsonMaybe(path.join(cfgDir, GLOBAL_MANIFEST));
644
518
  return isDict(data) ? data : {};
645
519
  }
646
520
 
647
521
  /**
648
- * `_harness_mcp._manifest_is_claude` — keyed on the `managed` MAP, not on `claude_md`: a Bob
522
+ * Keyed on the `managed` MAP, not on `claude_md`: a Bob
649
523
  * global emit ships no AGENTS.md and records no `claude_md`, and still needs the
650
524
  * Claude-style reversal.
651
525
  */
@@ -653,15 +527,29 @@ export function manifestIsClaude(cfgDir) {
653
527
  return isDict(claudeReadManifest(cfgDir).managed);
654
528
  }
655
529
 
530
+ /** The tier root a carrier renders: the absolute `user-rules.md` of its session-start line. */
531
+ const RENDERED_RULES_RE = /`((?:[A-Za-z]:)?\/[^`\n]*)\/user-rules\.md`/;
532
+
533
+ /**
534
+ * What `dir`'s carriers say of the tier: their text, and the root they render. null is relative;
535
+ * undefined is no carrier to ask (it was deleted), so the emit decides as it would for a new install.
536
+ * Every re-render of a deployed install takes this root, like its theme and footprint: a failed
537
+ * tier creation leaves it relative, and a reference rendered absolute would be drift no rebuild clears.
538
+ */
539
+ export function renderedTier(dir, host) {
540
+ const text = ['AGENT.md', ...carriersFor(host)].map((c) => readMaybe(path.join(dir, c)) ?? '').join('\n');
541
+ return { text, root: text.includes('user-rules.md') ? RENDERED_RULES_RE.exec(text)?.[1] ?? null : undefined };
542
+ }
543
+
656
544
  /**
657
- * `_harness_mcp._EMIT_HOST_SCOPE` — a marker's emit name fixes (host, scope). Derived from
545
+ * A marker's emit name fixes (host, scope). Derived from
658
546
  * `HOSTS`, whose emit names are `<host>` and `<host>-global`, so a new host is one row there.
659
547
  */
660
548
  export const EMIT_HOST_SCOPE = new Map(HOSTS.flatMap(({ host }) => [
661
549
  [host, [host, 'project']], [`${host}-global`, [host, 'global']],
662
550
  ]));
663
551
 
664
- /** `_harness_mcp._emit_host_scope_of` — `root`'s own marker, resolved, or null. */
552
+ /** `root`'s own marker, resolved, or null. */
665
553
  export function emitHostScopeOf(root) {
666
554
  const emit = readMaybe(path.join(root, '.geneseed-emit'));
667
555
  if (emit === null) return null;
@@ -669,7 +557,7 @@ export function emitHostScopeOf(root) {
669
557
  }
670
558
 
671
559
  /**
672
- * `_harness_mcp._claude_cfg` — where a Claude-STYLE install keeps its manifest.
560
+ * Where a Claude-STYLE install keeps its manifest.
673
561
  *
674
562
  * The config dir itself for a global install; `<repo>/<project_marker>` for a project one.
675
563
  * Host-aware so Bob and OpenClaude ride the whole Claude lifecycle with only the subdir
@@ -681,21 +569,20 @@ export function claudeCfg(root, scope, host = 'claude') {
681
569
  return path.join(root, spec ? spec.projectMarker : '.claude');
682
570
  }
683
571
 
684
- /** `_harness_mcp._claude_state`. */
685
572
  function claudeState(root, scope = 'global', host = 'claude') {
686
573
  const cfg = claudeCfg(root, scope, host);
687
574
  if (isDir(path.join(cfg, DISABLED_STASH, host))) return 'disabled';
688
575
  return existsSync(path.join(cfg, GLOBAL_MANIFEST)) ? 'active' : 'absent';
689
576
  }
690
577
 
691
- /** `_harness_mcp._install_kind` — 'global' | 'project' | null. */
578
+ /** 'global' | 'project' | null. */
692
579
  export function installKind(root) {
693
580
  if (existsSync(path.join(root, GLOBAL_MANIFEST))) return 'global';
694
581
  if (isDir(path.join(root, '.opencode'))) return 'project';
695
582
  return null;
696
583
  }
697
584
 
698
- /** `_harness_mcp._install_state` — 'active' | 'disabled' | 'absent'. */
585
+ /** 'active' | 'disabled' | 'absent'. */
699
586
  export function installState(root, host = 'opencode', scope = 'global') {
700
587
  if (CLAUDE_STYLE.includes(host)) return claudeState(root, scope, host);
701
588
  if (isDir(path.join(root, DISABLED_STASH))) return 'disabled';
@@ -729,7 +616,7 @@ export function openclaudeDualHarnessRoots() {
729
616
  return [...roots].filter(openclaudeDualHarnessRoot).sort(comparePaths);
730
617
  }
731
618
 
732
- /** `_harness_mcp._registered_targets` — (host, scope, root) for every registered root. */
619
+ /** (host, scope, root) for every registered root. */
733
620
  export function registeredTargets() {
734
621
  const out = [];
735
622
  for (const root of registryRoots()) {
@@ -740,7 +627,7 @@ export function registeredTargets() {
740
627
  }
741
628
 
742
629
  /**
743
- * `_harness_mcp._install_targets` — every (host, scope, root) an install may live at,
630
+ * Every (host, scope, root) an install may live at,
744
631
  * most-local first.
745
632
  *
746
633
  * De-duplicated on the (host, RESOLVED path) pair, which is three behaviours in one rule: a
@@ -764,7 +651,7 @@ export function installTargets() {
764
651
  try {
765
652
  const spec = HOSTS.find((h) => h.host === host);
766
653
  if (isHostGlobalDir(host, path.join(root, spec.projectMarker))) return;
767
- } catch { /* as the Python's bare `except Exception: pass` */ }
654
+ } catch { /* best-effort */ }
768
655
  }
769
656
  const key = `${host}\0${resolvePath(root)}`;
770
657
  if (!seen.has(key)) { seen.add(key); out.push([host, scope, root]); }
@@ -859,10 +746,10 @@ export function installsReferencingShim(shimPath = hookShimPath(), targets = ins
859
746
  return out;
860
747
  }
861
748
 
862
- // ---- what this machine installed (`_harness_setup._installed_defaults`) --------------------
749
+ // ---- what this machine installed -----------------------------------------------------
863
750
 
864
751
  /**
865
- * `_harness_setup._installed_defaults` — eight keys: `theme`, `posture`, `mode`, `emit`,
752
+ * Eight keys: `theme`, `posture`, `mode`, `emit`,
866
753
  * `footprint`, `doctrines`, `excludeRules`, `excludeSkills`. NOT the gate switches: a walk
867
754
  * across every install on the machine would carry one host's `off` into another's re-run, and
868
755
  * for a gate that disarms a boundary its owner never switched off — `setup` reads them off the
@@ -888,14 +775,14 @@ export function installsReferencingShim(shimPath = hookShimPath(), targets = ins
888
775
  export function installedDefaults() {
889
776
  const found = {
890
777
  theme: null, posture: null, mode: null, emit: null, footprint: null, doctrines: null,
891
- excludeRules: null, excludeSkills: null, kits: null,
778
+ excludeRules: null, excludeSkills: null, kits: null, sharedTier: false,
892
779
  };
893
780
  const candidates = [];
894
781
  for (const { host, configDir } of HOSTS) {
895
- try { candidates.push([configDir(), `${host}-global`]); } catch { /* as the Python */ }
782
+ try { candidates.push([configDir(), `${host}-global`]); } catch { /* best-effort */ }
896
783
  }
897
784
  // One cwd-relative bundle candidate — `ROOT / "Harness"` and `ROOT.parent / "Harness"`
898
- // left with the Python's, see `_harness_setup._installed_defaults` for the argument.
785
+ // left out, for the reason given on this function.
899
786
  candidates.push([path.join(process.cwd(), 'Harness'), null]);
900
787
  for (const [base, knownEmit] of candidates) {
901
788
  if (found.emit === null) {
@@ -937,6 +824,7 @@ export function installedDefaults() {
937
824
  if (!found.kits?.length) {
938
825
  try { found.kits = kitsOfDir(base); } catch { found.kits = []; }
939
826
  }
827
+ if (!found.sharedTier) found.sharedTier = sharedTierOfDir(base);
940
828
  }
941
829
  return found;
942
830
  }
package/js/hosts/link.mjs CHANGED
@@ -160,7 +160,6 @@ function offerShellPath(dir) {
160
160
  return true;
161
161
  }
162
162
 
163
- /** `_harness_lifecycle._win_bin_dir`. */
164
163
  function winBinDir() {
165
164
  // `os.environ.get(...) or str(Path.home())` — an EMPTY LOCALAPPDATA falls back too,
166
165
  // which `??` would not do.
@@ -169,7 +168,7 @@ function winBinDir() {
169
168
  }
170
169
 
171
170
  /**
172
- * `_harness_lifecycle._win_user_path_script` — the PowerShell one-liner, built but not run.
171
+ * The PowerShell one-liner, built but not run.
173
172
  *
174
173
  * Every quoting hazard in this verb is in this string, which is why it is a separate
175
174
  * function: `''` is PowerShell's single-quote escape, the `;` split drops
@@ -201,7 +200,7 @@ export function winUserPathScript(action, directory) {
201
200
  }
202
201
 
203
202
  /**
204
- * `_harness_lifecycle._win_user_path` — the spawn, and the sixth row of `_ALLOWED_SPAWNS`.
203
+ * The spawn, and the sixth row of `_ALLOWED_SPAWNS`.
205
204
  *
206
205
  * There is no in-process equivalent: the persistent USER Path lives in the registry
207
206
  * (`HKCU\Environment`), not in this process's environment, and Node has no registry API.
@@ -265,7 +264,7 @@ function isOurLauncher(f) {
265
264
  return existsSync(f) && (readMaybe(f) ?? '').includes(SHIM_MARKER);
266
265
  }
267
266
 
268
- /** `_harness_lifecycle.cmd_link` — put `geneseed` on PATH so it runs from any directory. */
267
+ /** Put `geneseed` on PATH so it runs from any directory. */
269
268
  export function cmdLink(args) {
270
269
  const here = ROOT;
271
270
  if (IS_WIN) {
@@ -347,7 +346,6 @@ export function cmdLink(args) {
347
346
  return 0;
348
347
  }
349
348
 
350
- /** `_harness_lifecycle.cmd_unlink`. */
351
349
  export function cmdUnlink() {
352
350
  if (IS_WIN) {
353
351
  const bindir = winBinDir();
package/js/hosts/mcp.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * MCP server state and config reading — `rituals/_harness_mcp.py`'s MCP block, minus its writers.
2
+ * MCP server state and config reading, minus its writers.
3
3
  *
4
4
  * READ-ONLY BY DECISION (2026-10). Which MCP servers an install wires depends on the user and on
5
5
  * the host, so Geneseed shows what each config already holds and where that file lives, and the