geneseed 4.31.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 (272) hide show
  1. package/CHANGELOG.md +107 -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 +220 -18
  14. package/adapters/opencode/plugins/geneseed-guard.js +578 -74
  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 +6 -6
  26. package/docs/concepts/footprint.md +1 -1
  27. package/docs/concepts/foreman-mode.md +2 -2
  28. package/docs/concepts/hook-gates.md +1 -1
  29. package/docs/concepts/hooks.md +27 -11
  30. package/docs/concepts/host-matrix.md +3 -3
  31. package/docs/concepts/hosts.md +1 -1
  32. package/docs/concepts/kits.md +3 -1
  33. package/docs/concepts/loop-bricks.md +1 -1
  34. package/docs/concepts/loop-notes.md +4 -2
  35. package/docs/concepts/loop-templates.md +7 -4
  36. package/docs/concepts/loops.md +3 -0
  37. package/docs/concepts/ownership.md +2 -2
  38. package/docs/concepts/rules.md +15 -2
  39. package/docs/concepts/shared-tier.md +73 -0
  40. package/docs/concepts/skills.md +2 -2
  41. package/docs/concepts/themes.md +1 -1
  42. package/docs/extending.md +13 -12
  43. package/docs/guides/install-claude-code.md +1 -1
  44. package/docs/guides/install-opencode.md +1 -1
  45. package/docs/guides/migrate.md +4 -2
  46. package/docs/guides/project-context.md +2 -2
  47. package/docs/guides/run-a-loop.md +1 -1
  48. package/docs/guides/set-up-ownership.md +1 -1
  49. package/docs/guides/setup-footprint.md +1 -1
  50. package/docs/guides/uninstall.md +2 -1
  51. package/docs/guides/upgrade-to-5.md +116 -0
  52. package/docs/guides/upgrade.md +21 -9
  53. package/docs/guides/wiki.md +3 -3
  54. package/docs/reference/env-context.md +5 -3
  55. package/docs/reference/environment.md +1 -1
  56. package/docs/reference/glossary.md +2 -0
  57. package/docs/reference/loop-actions.md +1 -1
  58. package/docs/reference/opencode-plugins.md +3 -3
  59. package/docs/reference/plugin-activity.md +1 -1
  60. package/docs/reference/plugin-context.md +5 -0
  61. package/docs/reference/plugin-guard.md +14 -6
  62. package/docs/reference/plugin-learn.md +13 -6
  63. package/docs/reference/troubleshoot-hooks.md +3 -3
  64. package/docs/reference/troubleshoot-update.md +14 -0
  65. package/docs/token-footprint.md +4 -3
  66. package/docs/understand/a-day.md +2 -2
  67. package/docs/understand/design-choices-install.md +2 -1
  68. package/docs/understand/enforced-vs-asked.md +4 -3
  69. package/docs/understand/machine-bob.md +3 -1
  70. package/docs/understand/machine-claude.md +7 -5
  71. package/docs/understand/machine-opencode.md +7 -5
  72. package/docs/understand/on-your-machine.md +4 -0
  73. package/docs/understand/take-it-out.md +1 -1
  74. package/docs/web-ui.md +141 -73
  75. package/harness.config.json +1 -1
  76. package/js/README.md +10 -6
  77. package/js/build/args.mjs +10 -8
  78. package/js/build/bundle.mjs +11 -13
  79. package/js/build/driver.mjs +66 -65
  80. package/js/build/emit-claude.mjs +22 -16
  81. package/js/build/emit-common.mjs +4 -5
  82. package/js/build/emit-opencode.mjs +22 -22
  83. package/js/build/fold.mjs +515 -0
  84. package/js/build/generate.mjs +41 -52
  85. package/js/build/render.mjs +115 -29
  86. package/js/build/source.mjs +4 -1
  87. package/js/build/stubs.mjs +70 -9
  88. package/js/build/version.mjs +10 -10
  89. package/js/cli-table.json +23 -83
  90. package/js/hosts/activity.mjs +2 -2
  91. package/js/hosts/geneseed-dir.mjs +1 -1
  92. package/js/hosts/hooks-context.mjs +410 -99
  93. package/js/hosts/hooks-done.mjs +97 -31
  94. package/js/hosts/hooks-learn.mjs +38 -7
  95. package/js/hosts/hooks-prims.mjs +69 -2
  96. package/js/hosts/hooks.mjs +300 -64
  97. package/js/hosts/hosts.mjs +150 -51
  98. package/js/hosts/installs.mjs +55 -167
  99. package/js/hosts/link.mjs +3 -5
  100. package/js/hosts/mcp.mjs +1 -1
  101. package/js/hosts/memory-files.mjs +219 -17
  102. package/js/hosts/ownership-gate.mjs +1 -1
  103. package/js/hosts/settings.mjs +18 -13
  104. package/js/hosts/shim.mjs +4 -33
  105. package/js/hosts/store-watch.mjs +189 -0
  106. package/js/inspect/checks-authoring.mjs +3 -3
  107. package/js/inspect/checks-build.mjs +45 -18
  108. package/js/inspect/checks-counts.mjs +4 -4
  109. package/js/inspect/checks-repo.mjs +13 -14
  110. package/js/inspect/cost.mjs +24 -2
  111. package/js/inspect/diff.mjs +123 -123
  112. package/js/inspect/doctor.mjs +22 -27
  113. package/js/inspect/excludes.mjs +181 -62
  114. package/js/inspect/inventory.mjs +22 -27
  115. package/js/inspect/registry.mjs +106 -30
  116. package/js/inspect/scan.mjs +5 -5
  117. package/js/inspect/status.mjs +141 -119
  118. package/js/inspect/validate.mjs +22 -24
  119. package/js/lib/fs.mjs +47 -50
  120. package/js/lib/json.mjs +10 -17
  121. package/js/lib/machine-dir.mjs +73 -0
  122. package/js/lib/paths.mjs +22 -33
  123. package/js/lib/proc.mjs +1 -1
  124. package/js/lib/prompt.mjs +19 -27
  125. package/js/lib/text.mjs +8 -12
  126. package/js/lib/udiff.mjs +11 -15
  127. package/js/loop/catalog.mjs +2 -3
  128. package/js/loop/state.mjs +15 -5
  129. package/js/maintain/memory.mjs +17 -17
  130. package/js/maintain/migrate.mjs +79 -89
  131. package/js/maintain/setup.mjs +43 -32
  132. package/js/maintain/uninstall.mjs +43 -61
  133. package/js/maintain/update.mjs +200 -93
  134. package/js/ui/anim.mjs +21 -35
  135. package/js/ui/cli.mjs +36 -58
  136. package/js/ui/menu.mjs +22 -45
  137. package/js/ui/tui.mjs +27 -67
  138. package/js/web/actions.mjs +38 -38
  139. package/js/web/api.mjs +132 -76
  140. package/js/web/catalog.mjs +175 -46
  141. package/js/web/docs.mjs +33 -12
  142. package/js/web/doctor-worker.mjs +14 -0
  143. package/js/web/handler.mjs +14 -5
  144. package/js/web/routes.mjs +17 -19
  145. package/js/web/state.mjs +78 -19
  146. package/js/web/update-check.mjs +25 -10
  147. package/js/web/user-files.mjs +50 -105
  148. package/package.json +7 -4
  149. package/registry.json +48 -55
  150. package/src/AGENT.md.tmpl +13 -14
  151. package/src/agents/_self-improvement.md +1 -1
  152. package/src/agents/_template.md +4 -1
  153. package/src/agents/advocate.md +1 -1
  154. package/src/agents/architect.md +1 -1
  155. package/src/agents/developer.md +6 -3
  156. package/src/agents/devops-engineer.md +1 -1
  157. package/src/agents/docker-expert.md +1 -1
  158. package/src/agents/docs.md +1 -1
  159. package/src/agents/empiricist.md +1 -1
  160. package/src/agents/explorer.md +1 -1
  161. package/src/agents/framer.md +1 -1
  162. package/src/agents/historian.md +1 -1
  163. package/src/agents/kubernetes-specialist.md +1 -1
  164. package/src/agents/memory-curator.md +2 -2
  165. package/src/agents/operator.md +1 -1
  166. package/src/agents/performance.md +1 -1
  167. package/src/agents/pragmatist.md +1 -1
  168. package/src/agents/react-engineer.md +1 -1
  169. package/src/agents/react-reviewer.md +1 -1
  170. package/src/agents/researcher.md +1 -1
  171. package/src/agents/reviewer.md +1 -1
  172. package/src/agents/security.md +1 -1
  173. package/src/agents/skeptic.md +1 -1
  174. package/src/agents/spring-boot-engineer.md +1 -1
  175. package/src/agents/spring-reviewer.md +1 -1
  176. package/src/agents/spring-security.md +1 -1
  177. package/src/agents/steward.md +1 -1
  178. package/src/agents/tester.md +5 -2
  179. package/src/agents/user-advocate.md +1 -1
  180. package/src/agents/visionary.md +1 -1
  181. package/src/bricks/apply.md +3 -0
  182. package/src/bricks/test.md +6 -4
  183. package/src/loops/bugfix.json +11 -5
  184. package/src/loops/feature.json +7 -4
  185. package/src/memory/README.md +1 -1
  186. package/src/skills/_self-improvement.md +2 -2
  187. package/src/skills/daydream/SKILL.md +2 -2
  188. package/src/skills/daydream/instructions.md +1 -1
  189. package/src/skills/geneseed.md +1 -1
  190. package/src/skills/learn-mode.md +1 -2
  191. package/src/skills/loop.md +1 -0
  192. package/src/skills/profile.md +2 -2
  193. package/src/skills/rule/approve.md +69 -0
  194. package/src/skills/rule/consolidate.md +3 -3
  195. package/src/skills/rule.md +13 -5
  196. package/src/skills/ship.md +9 -1
  197. package/src/skills/skill-forge.md +1 -1
  198. package/src/skills/teach.md +29 -12
  199. package/src/skills/wiki.md +1 -1
  200. package/themes/_TEMPLATE.json +1 -2
  201. package/themes/biker.json +1 -2
  202. package/themes/commentator.json +1 -2
  203. package/themes/cyberpunk.json +1 -2
  204. package/themes/gamer.json +1 -2
  205. package/themes/imperial.json +1 -2
  206. package/themes/joker.json +1 -2
  207. package/themes/marvin.json +1 -2
  208. package/themes/mean.json +1 -2
  209. package/themes/military.json +1 -2
  210. package/themes/neutral.json +1 -2
  211. package/themes/pirate.json +1 -2
  212. package/themes/sports.json +1 -2
  213. package/themes/verstappen.json +1 -2
  214. package/themes/wizard.json +1 -2
  215. package/web/dist/assets/Activity-D8G4eClY.js +1 -0
  216. package/web/dist/assets/ActivityDetail-BtOBYk3M.js +1 -0
  217. package/web/dist/assets/AgentGlyph-k6o3gCM1.js +1 -0
  218. package/web/dist/assets/Bonsai-B_y20b3i.js +1 -0
  219. package/web/dist/assets/{CopyButton-IXnXzH4Y.js → CopyButton-CHQte7Ap.js} +1 -1
  220. package/web/dist/assets/Dashboard-B8uXeJZ_.js +2 -0
  221. package/web/dist/assets/{DataTable-BWbUx4bY.js → DataTable-b9zTShqJ.js} +1 -1
  222. package/web/dist/assets/Docs-Dgv_MWfT.js +5 -0
  223. package/web/dist/assets/{EmptyState-1sPNleqv.js → EmptyState-CY5Pm2xy.js} +1 -1
  224. package/web/dist/assets/FilterInput-qGKNSlxv.js +1 -0
  225. package/web/dist/assets/GreenhouseView-CSzTMSl_.js +1 -0
  226. package/web/dist/assets/Installs-BDk9lqBI.js +3 -0
  227. package/web/dist/assets/JournalView-CvRk1-m5.js +1 -0
  228. package/web/dist/assets/Kits-CoITzxWM.js +1 -0
  229. package/web/dist/assets/Laws-Ctf5r9rE.js +3 -0
  230. package/web/dist/assets/Library-DNwHYVXt.js +3 -0
  231. package/web/dist/assets/{Loops-C5u7fQOR.js → Loops-S85PMQ8m.js} +2 -2
  232. package/web/dist/assets/Markdown-0ORz7tAc.js +69 -0
  233. package/web/dist/assets/OperatorHudView-DuGz_sTk.js +1 -0
  234. package/web/dist/assets/Personal-afJNwvRS.js +2 -0
  235. package/web/dist/assets/RailCats-AW92uhsX.js +1 -0
  236. package/web/dist/assets/Settings-CGDFz-6j.js +1 -0
  237. package/web/dist/assets/Tabs-1qLrnqmn.js +1 -0
  238. package/web/dist/assets/api-C46vAuqp.js +1 -0
  239. package/web/dist/assets/controls-D4wmg_pl.js +1 -0
  240. package/web/dist/assets/index-COTd4TRZ.js +3 -0
  241. package/web/dist/assets/index-CtorA7uK.css +1 -0
  242. package/web/dist/assets/motion-RlUl1osO.js +1 -0
  243. package/web/dist/assets/react-C1iE8mnY.js +9 -0
  244. package/web/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  245. package/web/dist/assets/{sections-ChwaobfW.js → sections-CtFz7HFH.js} +1 -1
  246. package/web/dist/assets/{usePoll-bDFN-Hr6.js → usePoll-o8ul-Sog.js} +1 -1
  247. package/web/dist/index.html +7 -7
  248. package/src/skills/quiz.md +0 -44
  249. package/web/dist/assets/Activity-B7cFtS00.js +0 -1
  250. package/web/dist/assets/ActivityDetail-C-GbMmuW.js +0 -1
  251. package/web/dist/assets/Bonsai-_YyexVC5.js +0 -1
  252. package/web/dist/assets/Dashboard-sCfEjowQ.js +0 -2
  253. package/web/dist/assets/Docs-w3Y7M5Ts.js +0 -5
  254. package/web/dist/assets/FilterInput-CZREvrjX.js +0 -1
  255. package/web/dist/assets/GreenhouseView-BWWbMKmg.js +0 -1
  256. package/web/dist/assets/Installs-CnkdJ-VA.js +0 -3
  257. package/web/dist/assets/JournalView-C7bPD3fZ.js +0 -1
  258. package/web/dist/assets/KitApply-CQQbnThf.js +0 -1
  259. package/web/dist/assets/Kits-aj07N7mT.js +0 -1
  260. package/web/dist/assets/Laws-DZ38nl_H.js +0 -3
  261. package/web/dist/assets/Library-QCGXPV5h.js +0 -2
  262. package/web/dist/assets/Markdown-DpmmtW2Y.js +0 -65
  263. package/web/dist/assets/OperatorHudView-Blu1lqiZ.js +0 -1
  264. package/web/dist/assets/Personal-ox_MktWO.js +0 -2
  265. package/web/dist/assets/RailCats-BuJD4Jou.js +0 -1
  266. package/web/dist/assets/Tabs-CIPyMAX-.js +0 -1
  267. package/web/dist/assets/api-BxjLd7Qd.js +0 -1
  268. package/web/dist/assets/index-0GCxkY7m.css +0 -1
  269. package/web/dist/assets/index-CzDi9JpF.js +0 -3
  270. package/web/dist/assets/motion-CXaUMNkg.js +0 -1
  271. package/web/dist/assets/react-DlYQp10C.js +0 -9
  272. package/web/dist/assets/rolldown-runtime-hePW80VL.js +0 -1
@@ -1,96 +1,79 @@
1
1
  /**
2
- * `harness status` and `harness version` — `rituals/_harness_status.py`, and the parts of
3
- * four other modules those two reach.
2
+ * `harness status` and `harness version`, and the parts of four other modules those two
3
+ * reach.
4
4
  *
5
- * WHAT THE CLOSURE ACTUALLY IS, MEASURED. An `ast` walk over `rituals/` puts `status` at 527
6
- * LOC across 7 modules with 17 `build.*` names, which is what carried it through two phases
7
- * as "the cheap half at 159 LOC". Both numbers are wrong in opposite directions, and the
8
- * second one is the interesting one: a closure walk counts what the CALLEE computes, and
9
- * `_status_data` consumes a fraction of it.
5
+ * The panel consumes only a fraction of what the modules it calls compute:
10
6
  *
11
- * * `_tui_inventory` returns every agent and skill with its one-line purpose, full
12
- * rendered body, source path and lifecycle badge, and every law with its title, body
13
- * and governance class. `_status_data` reads three `len()`s off it. So `SKILL_CLASS`,
14
- * `LAW_CLASS`, `ENTITY_STATUSES`, `load_registry`, `entity_status` and
15
- * `build._first_blockquote` — the taxonomy P7 owns, ~111 LOC — are in the walk and are
16
- * not in this file. `inventoryCounts` is the counting half and says so.
17
- * * `_installed_defaults` detects theme, emit, posture, mode and footprint. The panel
18
- * prints theme and emit. `_posture_of_dir`/`_mode_of_dir` are therefore not part of the
19
- * value it returns, and `status/posture-and-mode-in-the-carrier-change-nothing` is the
20
- * cell that says the omission is invisible rather than assuming it. **P5f ported those
21
- * two detectors and did NOT change this** — `rebuild-all` calls them per install root,
22
- * not through `_installed_defaults`, so the cell above is still a positive control over
23
- * an unchanged omission rather than a claim that has quietly gone stale.
24
- * * `_footprint_of_dir` is reached from here, and it is the exception that names the rule:
25
- * its return value is not consumed by the panel either, but an unrecognised marker makes
26
- * it WARN on stderr, and stderr is a compared column. A closure pruned by what the
27
- * caller consumes drops a function whose whole contribution is a side effect.
28
- * * `_memory_facts` builds a record per fact through `_frontmatter`; the panel counts
29
- * them. `memoryFactCount` is the count, and `frontmatter` stays where it is.
7
+ * * `tuiInventory` returns every agent and skill with its purpose, rendered body, source
8
+ * path and lifecycle badge, and every law with its title, body and governance class.
9
+ * The panel reads three `length`s off it, and `inventoryCounts` is that counting half.
10
+ * * `installedDefaults` detects theme, emit, posture, mode and footprint. The panel
11
+ * prints theme and emit, and `status/posture-and-mode-in-the-carrier-change-nothing` is
12
+ * the cell that says the omission is invisible rather than assuming it.
13
+ * * `footprintOfDir` is reached from here though the panel does not consume its return
14
+ * value: an unrecognised marker makes it WARN on stderr, and stderr is a compared
15
+ * column. Pruning by what the caller consumes would drop a function whose whole
16
+ * contribution is a side effect.
17
+ * * `factCount` counts the memory facts; `frontmatter` stays where it is.
30
18
  *
31
- * WHERE THE DETECTORS WENT. `themeOfDir`, `footprintOfDir`, `installedDefaults`,
32
- * `manifestIsClaude` and the configured defaults were written here in P5d because `status`
33
- * was their only caller. `js/hosts/installs.mjs` owns them since P5f, when `diff` and `rebuild-all`
34
- * became the second and third. Nothing about them changed in the move — the 166-cell
35
- * acceptance matrix is what licensed attempting it, `status`'s own eleven cells among them.
19
+ * `themeOfDir`, `footprintOfDir`, `installedDefaults`, `manifestIsClaude` and the configured
20
+ * defaults live in `js/hosts/installs.mjs`, shared with `diff` and `rebuild-all`.
36
21
  *
37
- * WHAT NO CELL CAN REACH, and where it is gated instead. The former Python matrix's
38
- * status/version section carried the long form; the short form is that ROOT is not
39
- * redirectable across a process boundary, so three things here are unreachable from any
40
- * cell: `versionVerdict`'s "up to date" (needs a marker holding a fingerprint no cell can
41
- * know), `accentFor`'s cyan fallback (an unknown theme is refused upstream by
42
- * `effectiveTheme`), and the whole ANSI half of `statusLines` (`_color_enabled` is
43
- * `sys.stdout.isatty()`, and every harness captures stdout through a pipe). All three are
44
- * PURE FUNCTIONS of their arguments, so the former Python suite gated all three as a corpus
45
- * instead — a third answer to the colour question, which had been posed as a choice between
46
- * shipping it ungated and not shipping it. That corpus is gone: `tests/unit/lifecycle.test.mjs`
47
- * now calls `versionVerdict` and both halves of `statusLines` directly, and nothing pins
48
- * `accentFor`'s fallback.
22
+ * WHAT NO CELL CAN REACH, and where it is gated instead. ROOT is not redirectable across a
23
+ * process boundary, so three things here are unreachable from any cell: `versionVerdict`'s
24
+ * "in sync" (needs a marker holding a fingerprint no cell can know), `accentFor`'s cyan
25
+ * fallback (an unknown theme is refused upstream by `effectiveTheme`), and the whole ANSI
26
+ * half of `statusLines` (`colorEnabled` reads `process.stdout.isTTY`, and every harness
27
+ * captures stdout through a pipe). All three are PURE FUNCTIONS of their arguments:
28
+ * `tests/unit/lifecycle.test.mjs` calls `versionVerdict` and both halves of `statusLines`
29
+ * directly, and nothing pins `accentFor`'s fallback.
49
30
  *
50
- * `manifestIsClaude` was a FOURTH until wave 2 of the P0/P1 review: it is only reached for
51
- * a candidate with no known host, and `ROOT/"Harness"` was ordered ahead of the sandbox's
52
- * own. Both ROOT-relative bundle candidates are gone from this walk and from
53
- * `installedDefaults`, so the only no-known-host candidate left is `cwd/"Harness"`, which
54
- * is inside the sandbox. It is reachable now; no cell seeds a manifest without an emit
55
- * marker, so it is gated only by the direct calls in `tests/unit/claude.test.mjs`, and that is
56
- * a gap rather than a wall.
31
+ * `manifestIsClaude` is only reached for a candidate with no known host, and the only such
32
+ * candidate is `cwd/"Harness"`, which is inside the sandbox. No cell seeds a manifest
33
+ * without an emit marker, so it is gated only by the direct calls in
34
+ * `tests/unit/claude.test.mjs`, and that is a gap rather than a wall.
57
35
  */
58
36
  import { existsSync, readdirSync, readFileSync } from 'node:fs';
59
37
  import path from 'node:path';
60
38
 
61
39
  import { GATE_SWITCHES, THEMES, ROOT, loadKits, makeCfg } from '../build/source.mjs';
62
40
  import { tuiInventory } from './inventory.mjs';
41
+ import { sourceGeneration } from '../build/render.mjs';
63
42
  import { readVersion, sourceFingerprint } from '../build/version.mjs';
64
43
  import {
65
44
  claudeConfigDir, bobConfigDir, openclaudeConfigDir, opencodeConfigDir, opencodeShadowedInstall,
66
45
  isHostGlobalDir, resolvePath, resolveMemoryDir, sovereignBypass, CLAUDE_STYLE, GATE_LEDGER, ADVISORY_VERB, HOSTS,
67
46
  } from '../hosts/hosts.mjs';
68
- // P5f moved the install DETECTORS out of this file — `diff` renders its expected copy in the
69
- // deployed theme and footprint, and `rebuild-all` re-emits in the deployed everything, so
70
- // three verbs now read them.
47
+ // The install DETECTORS live in `js/hosts/installs.mjs` — `diff` renders its expected copy in
48
+ // the deployed theme and footprint, and `rebuild-all` re-emits in the deployed everything, so
49
+ // three verbs read them.
71
50
  import {
72
- defaultTheme, hookShellProblems, installedDefaults, installTargets, installsReferencingShim,
73
- legacyProcessCarrierOfDir, openclaudeDualHarnessRoots, readJsonMaybe, readMaybe,
51
+ claudeCfg, defaultTheme, hookShellProblems, installedDefaults, installState, installTargets,
52
+ installsReferencingShim, openclaudeDualHarnessRoots, themeOfDir, readJsonMaybe, readMaybe,
74
53
  } from '../hosts/installs.mjs';
75
54
  import { installProfile, rebuildCommand } from '../build/generate.mjs';
76
55
  import { isDoctorNote } from './scan.mjs';
56
+ import { pendingDrafts } from '../hosts/hooks-context.mjs';
57
+ import { factCount } from '../hosts/memory-files.mjs';
58
+ import { lastStoreReport } from '../hosts/store-watch.mjs';
77
59
  import { hookShimPath, shimDead } from '../hosts/shim.mjs';
78
60
  import { printOut } from '../lib/fs.mjs';
61
+ import { readDefaultInstall, sharedPaths } from '../lib/machine-dir.mjs';
62
+ import { normcase } from '../lib/paths.mjs';
63
+ import { renamedFilesIn } from '../build/stubs.mjs';
79
64
  import { codePointLength, padEndToWidth } from '../lib/text.mjs';
80
65
 
81
66
  // ---- version ---------------------------------------------------------------------------
82
67
 
83
- /** `_harness_status._version_verdict`. */
84
68
  export function versionVerdict(installed, current) {
85
69
  if (installed === null || installed === undefined) {
86
70
  return 'no Geneseed install detected to compare';
87
71
  }
88
- if (installed === current) return 'up to date with this source';
72
+ if (installed === current) return 'in sync with this source';
89
73
  return 'installed build differs from the current source — run '
90
74
  + '`./geneseed update` (or rebuild) to apply it';
91
75
  }
92
76
 
93
- /** `_harness_status.cmd_version`. */
94
77
  export function cmdVersion(args) {
95
78
  const cfg = makeCfg();
96
79
  const current = sourceFingerprint(cfg);
@@ -100,7 +83,7 @@ export function cmdVersion(args) {
100
83
  let installed = readVersion(target);
101
84
  if (installed === null) {
102
85
  // A claude/bob/openclaude-only machine must not report "no install detected". The bundle
103
- // candidates are cwd-relative only — see the Python for why `ROOT / "Harness"` left.
86
+ // candidates are cwd-relative only: a ROOT-relative one would sit outside the sandbox.
104
87
  for (const base of [claudeConfigDir(), bobConfigDir(), openclaudeConfigDir(),
105
88
  path.join(process.cwd(), 'Harness'), process.cwd()]) {
106
89
  const v = readVersion(base);
@@ -117,21 +100,25 @@ export function cmdVersion(args) {
117
100
  // ---- what the panel counts ---------------------------------------------------------------
118
101
 
119
102
  /**
120
- * `_harness_tui._tui_inventory`, reduced to the three counts `_status_data` reads off it.
103
+ * `tuiInventory`, reduced to the three counts `statusData` reads off it.
121
104
  *
122
- * THREE `length`s OFF THE REAL WALK SINCE P6c, and the change is the point. P5d shipped a
123
- * counting-only twin — the bodies, purposes, source paths and taxonomy classes were P7's,
124
- * and porting them to produce three integers would have been absurd — with a docblock
125
- * warning that the two must not become two classifiers. `api_catalog` consumes exactly the
126
- * fields the count threw away, so P6c is the phase that would have made them two. It did
127
- * not: `tuiInventory` in `js/inspect/inventory.mjs` is the one walk, this is three `length`s off
128
- * it, and the eleven `status` cells and the catalog cells now gate the same classifier
105
+ * THREE `length`s OFF THE REAL WALK, so there are not two classifiers: the catalog consumes
106
+ * exactly the fields the count throws away. `tuiInventory` in `js/inspect/inventory.mjs` is
107
+ * the one walk, and the eleven `status` cells and the catalog cells gate the same classifier
129
108
  * from opposite ends.
130
109
  */
131
- export function inventoryCounts(themeName, doctrines = null) {
110
+ export function inventoryCounts(themeName, doctrines = null, cfg = makeCfg()) {
111
+ // Counted once per source generation (render.mjs says how the stamp sees an edit), because the
112
+ // console's `/api/setup` asks after every page load. The key is every other input of the count;
113
+ // `harness.config.json` is rendered from and sits outside the stamp.
114
+ const generation = sourceGeneration(cfg);
115
+ generation.counts ??= new Map();
116
+ const key = JSON.stringify([themeName, doctrines, readMaybe(cfg.config)]);
117
+ const known = generation.counts.get(key);
118
+ if (known) return known;
132
119
  const inv = tuiInventory(themeName, doctrines);
133
120
  const on = inv.doctrines.filter((p) => p.active);
134
- return {
121
+ const counts = {
135
122
  agents: inv.agents.length,
136
123
  skills: inv.skills.length,
137
124
  laws: inv.laws.length,
@@ -146,28 +133,23 @@ export function inventoryCounts(themeName, doctrines = null) {
146
133
  packsTotal: inv.doctrines.length,
147
134
  doctrineRules: on.reduce((n, p) => n + p.rules.length, 0),
148
135
  };
136
+ generation.counts.set(key, counts);
137
+ return counts;
149
138
  }
150
139
 
151
140
  /**
152
- * `_harness_tui_views._memory_facts`, reduced to its length.
153
- *
154
- * A path `glob("*.md")` matches but `read_text` cannot read — a DIRECTORY called `notes.md`
155
- * is the reachable case — is skipped, not counted and not fatal.
141
+ * The themed `anamnesis/` stores an older install left behind: a non-empty one in a host config
142
+ * dir, `./Harness` or the machine dir. No resolver reads one any more (M1), so its facts are
143
+ * invisible until copied into `memory/`. Never looks at cwd itself: Terra's `Anamnesis/` vault
144
+ * is not a store.
156
145
  */
157
- export function memoryFactCount(mdir) {
158
- let names;
159
- try { names = readdirSync(mdir); } catch { return 0; }
160
- let n = 0;
161
- for (const name of names.filter((x) => x.endsWith('.md')).sort()) {
162
- const stem = name.slice(0, -3);
163
- if (['memory', 'readme'].includes(stem.toLowerCase())) continue;
164
- if (readMaybe(path.join(mdir, name)) === null) continue;
165
- n += 1;
166
- }
167
- return n;
146
+ export function anamnesisLeftovers(dirs) {
147
+ return dirs.map((d) => path.join(d, 'anamnesis')).filter((p) => {
148
+ try { return readdirSync(p).length > 0; } catch { return false; }
149
+ });
168
150
  }
169
151
 
170
- /** `_harness_tui_draw._accent_for` — the ACCENT a theme declares, default cyan. */
152
+ /** The ACCENT a theme declares, default cyan. */
171
153
  export function accentFor(theme) {
172
154
  const doc = readJsonMaybe(path.join(THEMES, `${theme}.json`));
173
155
  if (!doc || typeof doc !== 'object') return 'cyan';
@@ -238,7 +220,6 @@ export function gateSummary(cfgDirs, platform = process.platform) {
238
220
  };
239
221
  }
240
222
 
241
- /** `_harness_status._status_data`. */
242
223
  /**
243
224
  * Spec R6: the member files of every kit NOT on in this install that are still on disk — the ones
244
225
  * `pruneOwned` kept because their owner edited them — as `{ kit: [rel, ...] }`, or `null` when
@@ -273,36 +254,73 @@ export function keptKitFiles(host, scope, root, active) {
273
254
  return Object.keys(kept).length ? kept : null;
274
255
  }
275
256
 
257
+ /**
258
+ * The `[host, scope, root]` of `targets` the user chose as the default, or null: no pick, or a pick
259
+ * that no longer names an ACTIVE install (removed, disabled, or not seen from here). A stale pick
260
+ * stays on disk and works again if that install comes back.
261
+ *
262
+ * Here and not in `js/web/state.mjs`, whose `defaultView` is the other reader: `status` may not
263
+ * load the web tree. `targets` is scanned only when a pick exists.
264
+ */
265
+ export function pickedInstall(targets = null) {
266
+ const want = readDefaultInstall();
267
+ if (want === null) return null;
268
+ const folded = normcase(resolvePath(want.path));
269
+ return (targets ?? installTargets()).find(([host, scope, root]) => {
270
+ try {
271
+ return host === want.host && normcase(resolvePath(root)) === folded
272
+ && installState(root, host, scope) === 'active';
273
+ } catch { return false; }
274
+ }) ?? null;
275
+ }
276
+
277
+ /** The emit name of a `[host, scope]`, the inverse of `EMIT_HOST_SCOPE`. */
278
+ export const emitOf = (host, scope) => (scope === 'global' ? `${host}-global` : host);
279
+
280
+ /** A picked install's own voice. OpenClaude keeps a project's sigil in its data dir alone. */
281
+ function pickedTheme([host, scope, root]) {
282
+ return themeOfDir(root, host)
283
+ || (CLAUDE_STYLE.includes(host) ? themeOfDir(claudeCfg(root, scope, host), host) : null);
284
+ }
285
+
276
286
  export function statusData() {
277
287
  const inst = installedDefaults();
278
- const theme = inst.theme || defaultTheme();
288
+ // The `install` and `theme` lines name the install the console defaults to, when one was chosen.
289
+ // Nothing else does: `agent_md` below is a health row, and a preference must not hide it.
290
+ const picked = pickedInstall();
291
+ const emit = picked ? emitOf(picked[0], picked[1]) : inst.emit;
292
+ const theme = (picked && pickedTheme(picked)) || inst.theme || defaultTheme();
279
293
  const mdir = resolveMemoryDir(null);
280
294
  // `inst.doctrines` is what the machine's carriers say — `null` when none of them does, which
281
295
  // `tuiInventory` reads as every pack, the same resolution `doctrinesForBuild` gives unknown.
282
296
  // This is a DISPLAY read: nothing here decides what a build emits.
283
- const inv = inventoryCounts(theme, inst.doctrines);
297
+ const cfg = makeCfg();
298
+ const inv = inventoryCounts(theme, inst.doctrines, cfg);
284
299
  let cfgDir = null;
285
300
  try { cfgDir = opencodeConfigDir(); } catch { cfgDir = null; }
286
- const sourceFp = sourceFingerprint(makeCfg());
301
+ const sourceFp = sourceFingerprint(cfg);
287
302
  let installedFp = null;
288
303
  let verTarget = null;
289
304
  const otherCfg = [];
290
305
  for (const fn of [claudeConfigDir, bobConfigDir, openclaudeConfigDir]) {
291
306
  try { otherCfg.push(fn()); } catch { /* a missing host dir must not sink status */ }
292
307
  }
308
+ const hostDirs = [...(cfgDir ? [cfgDir] : []), ...otherCfg, path.join(process.cwd(), 'Harness')];
293
309
  // Same walk as `cmdVersion`'s fallback, and cwd-relative for the same reason.
294
- const candidates = [...(cfgDir ? [cfgDir] : []), ...otherCfg,
295
- path.join(process.cwd(), 'Harness'), process.cwd()];
296
- for (const base of candidates) {
310
+ for (const base of [...hostDirs, process.cwd()]) {
297
311
  const v = readVersion(base);
298
312
  if (v) { installedFp = v; verTarget = base; break; }
299
313
  }
314
+ const scanned = [...hostDirs];
315
+ try { scanned.push(sharedPaths().root); } catch { /* no home dir: no tier to scan */ }
316
+ const leftover = anamnesisLeftovers(scanned);
317
+ const renamed = renamedFilesIn(scanned);
300
318
  const agentMd = (inst.emit === 'opencode-global' && cfgDir)
301
319
  ? path.join(cfgDir, 'AGENT.md') : null;
302
320
  return {
303
321
  theme,
304
322
  accent: accentFor(theme),
305
- emit: inst.emit || '—',
323
+ emit: emit || '—',
306
324
  agents: inv.agents,
307
325
  skills: inv.skills,
308
326
  laws: inv.laws,
@@ -316,7 +334,9 @@ export function statusData() {
316
334
  packs_total: inv.packsTotal,
317
335
  doctrine_rules: inv.doctrineRules,
318
336
  memory_dir: mdir ? String(mdir) : null,
319
- facts: mdir ? memoryFactCount(mdir) : 0,
337
+ facts: mdir ? factCount(mdir) ?? 0 : 0,
338
+ ...(leftover.length ? { anamnesis_leftover: leftover } : {}),
339
+ ...(renamed.length ? { renamed_files: renamed } : {}),
320
340
  source_fp: sourceFp,
321
341
  installed_fp: installedFp,
322
342
  version_target: verTarget ? String(verTarget) : null,
@@ -324,15 +344,13 @@ export function statusData() {
324
344
  agent_md: agentMd ? String(agentMd) : null,
325
345
  agent_md_present: Boolean(agentMd && existsSync(agentMd)),
326
346
  gates: gateSummary([...(cfgDir ? [cfgDir] : []), ...otherCfg]),
347
+ drafts_pending: pendingDrafts(),
348
+ store_report: lastStoreReport(),
327
349
  opencode_shadow: opencodeShadowedInstall(),
328
350
  openclaude_dual_harness: openclaudeDualHarnessRoots(),
329
351
  // EVERY install, not just the one `installedDefaults` settles on — and read through the
330
352
  // same `installProfile` `rebuild-all` uses, so the settings shown are the ones a rebuild
331
- // keeps. `rebuild` is the pasteable command an agent edits one flag of — EXCEPT for a
332
- // pre-comms carrier, where `p.argv` already carries the under-specified read-back
333
- // (`doctrinesOfDir`/`excludedRulesOfDir` no longer migrate it) and pasting it would cause
334
- // the exact permanent loss `rebuild-all`/`migrate`/the web console now refuse to cause, with
335
- // no guard left to stop an agent or owner from running it by hand. A broken install must not
353
+ // keeps. `rebuild` is the pasteable command an agent edits one flag of. A broken install must not
336
354
  // sink the panel, so it is reported rather than thrown. `absent` slots are filtered out
337
355
  // here: an absent slot has no settings, so a row of defaults for it reads as an install that
338
356
  // does not exist — noise in the panel and misinformation in `--json`.
@@ -341,9 +359,7 @@ export function statusData() {
341
359
  const p = installProfile(host, scope, root);
342
360
  // Only when something is kept, so `--json` without kits stays the bytes it was.
343
361
  const kept = keptKitFiles(host, scope, root, p.kits);
344
- const rebuild = legacyProcessCarrierOfDir(root, host)
345
- ? "geneseed setup # pre-comms carrier (names 'process 8') — run setup for this install, not a rebuild"
346
- : rebuildCommand(p.argv);
362
+ const rebuild = rebuildCommand(p.argv);
347
363
  return { ...p, ...(kept ? { keptKitFiles: kept } : {}), rebuild };
348
364
  } catch (e) {
349
365
  return { host, scope, root, state: 'unreadable', error: String(e?.message ?? e) };
@@ -352,17 +368,16 @@ export function statusData() {
352
368
  };
353
369
  }
354
370
 
355
- /** `_harness_status._ANSI_CODES`. */
356
371
  const ANSI_CODES = {
357
372
  red: '31', green: '32', yellow: '33', blue: '34', magenta: '35', cyan: '36', white: '37',
358
373
  };
359
374
 
360
375
  /**
361
- * `_harness_status._color_enabled`.
376
+ * Whether to colour the panel.
362
377
  *
363
378
  * `process.stdout.isTTY` is `undefined` rather than `false` off a terminal, so the Boolean
364
- * is not optional. The three terms are Python's, in Python's order — and because `and`
365
- * short-circuits on the first, NO_COLOR and TERM are never read through a pipe, which is
379
+ * is not optional. Because `&&` short-circuits on the first term, NO_COLOR and TERM are
380
+ * never read through a pipe, which is
366
381
  * why `golden.cell_env` clearing them is insurance rather than a fix.
367
382
  */
368
383
  function colorEnabled() {
@@ -371,12 +386,11 @@ function colorEnabled() {
371
386
  }
372
387
 
373
388
  /**
374
- * `_harness_status._status_lines` — pure, returns the lines.
389
+ * Pure, returns the lines.
375
390
  *
376
- * `_TUI_ASCII` is read from the environment at CALL time here where Python reads it at
377
- * import time (`_harness_tui_draw:12`). Same value for a process that runs one verb and
378
- * exits; spelled this way because a module-level constant in a file the corpus gate imports
379
- * would freeze at whatever the test runner's environment was.
391
+ * `_TUI_ASCII` is read from the environment at CALL time, not import time. Same value for a
392
+ * process that runs one verb and exits; spelled this way because a module-level constant in
393
+ * a file the tests import would freeze at whatever the test runner's environment was.
380
394
  */
381
395
  export function statusLines(d, color = false) {
382
396
  const asc = Boolean(process.env.GENESEED_TUI_ASCII);
@@ -387,7 +401,7 @@ export function statusLines(d, color = false) {
387
401
  const badge = asc ? '*' : '◆';
388
402
  const emdash = asc ? '-' : '—';
389
403
 
390
- const up = d.version_verdict.includes('up to date');
404
+ const up = d.version_verdict.includes('in sync');
391
405
  const noneInst = d.installed_fp === null || d.installed_fp === undefined;
392
406
  const mark = up ? (asc ? 'OK' : '✓') : (noneInst ? (asc ? '-' : '·') : '!');
393
407
  const vcode = up ? '32' : (noneInst ? '2' : '33');
@@ -398,14 +412,14 @@ export function statusLines(d, color = false) {
398
412
  ['components', `${d.agents} agents ${DOT} ${d.skills} skills ${DOT} ${d.laws} laws`],
399
413
  ['memory', `${d.memory_dir || '(not found)'} `
400
414
  + `(${d.facts} fact${d.facts === 1 ? '' : 's'})`],
415
+ ...(d.renamed_files ? d.renamed_files.map((r) => ['renamed', `${r.file} ${DOT} old name still read: it is ${r.now} now; a rebuild renames it`]) : []),
416
+ ...(d.anamnesis_leftover ? [['leftover', `${d.anamnesis_leftover.join(', ')} ${DOT} no longer read: copy its facts into memory/`]] : []),
401
417
  ['version', `${d.installed_fp || '(none)'} ${DOT} source ${d.source_fp}`],
402
418
  ];
403
- // ⚠ A ROW, NOT A WIDER `components` LINE. When this landed, `statusLines` had 30 recorded
404
- // cases per platform in the former Python suite's corpus, every one holding the box's exact
405
- // bytes — including `17 agents · 47 skills · 37 laws` — and no recorder left to re-bless them.
406
- // Touching `components` would have moved all 30; adding a row would too, since the box width
407
- // is measured over `rows`. So the row is CONDITIONAL on a key those arguments did not carry,
408
- // exactly as `agent_md` below already is. The corpus is gone; a caller without the key still
419
+ // ⚠ A ROW, NOT A WIDER `components` LINE. Touching `components` would move every box's
420
+ // exact bytes; adding a row would too, since the box width
421
+ // is measured over `rows`. So the row is CONDITIONAL on a key some arguments do not carry,
422
+ // exactly as `agent_md` below already is. A caller without the key still
409
423
  // gets the box it got before.
410
424
  //
411
425
  // It carries the two tiers `components` cannot: `components` counts the invariants as
@@ -435,6 +449,13 @@ export function statusLines(d, color = false) {
435
449
  rows.push(['gates', `${armed} ${DOT} ${g.total} ask${g.total === 1 ? '' : 's'}`
436
450
  + (byRule ? ` (${byRule})` : '')]);
437
451
  }
452
+ if (d.drafts_pending) {
453
+ rows.push(['drafts', `${d.drafts_pending} in user-rules.draft.md wait${d.drafts_pending === 1 ? 's' : ''} for your decision`]);
454
+ }
455
+ if (d.store_report) {
456
+ rows.push(['changes', `${d.store_report.files.length} rule or memory file(s) changed outside a session's approved writes, `
457
+ + `last on ${String(d.store_report.at).slice(0, 10)}`]);
458
+ }
438
459
  // Conditional: null on every machine that has not set `OPENCODE_CONFIG_DIR` over an old install.
439
460
  if (d.opencode_shadow) {
440
461
  rows.push(['opencode', `ALSO LOADED: a second Geneseed install in ${d.opencode_shadow} (OpenCode `
@@ -460,6 +481,7 @@ export function statusLines(d, color = false) {
460
481
  rows.push([`${p.host}:${p.scope}`, [p.state, p.theme, p.footprint, `${p.posture}/${p.mode}/${p.trust}`,
461
482
  packs, excl, ...(p.excludeSkills?.length ? [`skills off: ${p.excludeSkills.join(',')}`] : []),
462
483
  ...(p.kits?.length ? [`kits: ${p.kits.join(',')}`] : []),
484
+ ...(p.sharedTier ? ['shared tier: on'] : []),
463
485
  // Each elided when armed. The law's text still binds; only its tool-boundary gate is off.
464
486
  ...GATE_SWITCHES.filter((g) => p[g.key] === false)
465
487
  .map((g) => `${g.marker.toLowerCase()}: off${g.law ? ` (Law ${g.law} text still binds)` : ''}`)]
@@ -492,7 +514,7 @@ export function statusLines(d, color = false) {
492
514
  }
493
515
 
494
516
  /**
495
- * `_harness_status.cmd_status` — and `--json`, the machine face of the same payload. An agent
517
+ * And `--json`, the machine face of the same payload. An agent
496
518
  * reading the panel had to scrape box-drawing; the object below is what the panel is drawn
497
519
  * FROM, so the two cannot disagree.
498
520
  */
@@ -11,7 +11,7 @@ import { buildInto, emitGlobalInto, emitProjectInto } from '../build/driver.mjs'
11
11
  import { GATE_SWITCHES } from '../build/source.mjs';
12
12
  import { resolvePath } from '../hosts/hosts.mjs';
13
13
  import {
14
- doctrinesOfDir, excludedRulesOfDir, gatesOfDir, modeOfDir, postureOfDir,
14
+ EMIT_HOST_SCOPE, doctrinesOfDir, excludedRulesOfDir, gatesOfDir, modeOfDir, postureOfDir,
15
15
  } from '../hosts/installs.mjs';
16
16
  import { validateIsVendored } from '../hosts/native.mjs';
17
17
  import { printOut, printErr } from '../lib/fs.mjs';
@@ -34,7 +34,7 @@ export const VALIDATE_USAGE = [
34
34
  'usage: geneseed validate [-h] [--theme THEME] [--emit EMIT] [--out OUT] [--root ROOT]',
35
35
  ' [--footprint {lean,full}] [--posture POSTURE] [--mode MODE]',
36
36
  ' [--trust TRUST] [--doctrines DOCTRINES] [--exclude-rules RULES]',
37
- ' [--exclude-skills SKILLS] [--kits KITS] [--no-secrets-gate]',
37
+ ' [--exclude-skills SKILLS] [--kits KITS] [--shared-tier on|off] [--no-secrets-gate]',
38
38
  ' [--no-done-gate] [--no-deletion-gate] [-v]',
39
39
  '',
40
40
  "Render and emit into a throwaway sandbox, run the doctor's checks, and write nothing real.",
@@ -44,11 +44,11 @@ export const VALIDATE_USAGE = [
44
44
  ].join('\n');
45
45
 
46
46
  /**
47
- * `subprocess.run(..., capture_output=True, text=True)` around an IN-PROCESS call.
47
+ * Capture the streams of an IN-PROCESS call.
48
48
  *
49
- * The reference shells to `harness.py doctor`; this calls `cmdDoctor` directly, and the
50
- * difference has to be undone in one place: a child's `capture_output` hands the parent
51
- * UNIVERSAL-NEWLINE text, so `r.stdout` holds `\n` on Windows even though the child wrote
49
+ * This calls `cmdDoctor` directly rather than a child, and the
50
+ * difference has to be undone in one place: a child's captured output is
51
+ * UNIVERSAL-NEWLINE text, holding `\n` on Windows even though the child wrote
52
52
  * `\r\n`. `printOut` inside `cmdDoctor` writes `\r\n`. Without the fold, the `.strip()` below
53
53
  * would leave every interior line CRLF and the re-print would double the translation.
54
54
  */
@@ -88,7 +88,7 @@ function captureStreams(fn) {
88
88
  * `buildInto` are used rather than `driverMain(['--emit', …])`: the driver writes
89
89
  * `.geneseed-emit`/`.geneseed-footprint` and records an install-registry row AFTER the
90
90
  * dispatch, so routing through it would register a temp directory that is deleted a
91
- * millisecond later. The reference calls the emit functions directly for the same reason.
91
+ * millisecond later.
92
92
  *
93
93
  * THE EMIT'S OWN STDOUT IS NOT SWALLOWED. `globalEmitProblems` above wraps its call in
94
94
  * `swallowStdout` and this deliberately does not: `_validate_only` has no `redirect_stdout`,
@@ -130,7 +130,7 @@ export function cmdValidate(args) {
130
130
  const opts = {
131
131
  theme: args.theme, footprint: args.footprint, posture: args.posture, mode: args.mode,
132
132
  trust: args.trust, doctrines: args.doctrines, excludeRules: args.excludeRules,
133
- excludeSkills: args.excludeSkills, kits: args.kits,
133
+ excludeSkills: args.excludeSkills, kits: args.kits, sharedTier: args.sharedTier === 'on',
134
134
  ...Object.fromEntries(GATE_SWITCHES.map((g) => [g.key, args[g.arg] ? false : null])),
135
135
  };
136
136
  let scanDirs;
@@ -147,16 +147,12 @@ export function cmdValidate(args) {
147
147
  scanDirs = [root];
148
148
  }
149
149
  } catch (e) {
150
- // `except SystemExit as e` — a DELIBERATE refusal from the render (an unknown theme,
151
- // an incomplete source), interpolated as `{e}`.
150
+ // A DELIBERATE refusal from the render (an unknown theme, an incomplete source).
152
151
  //
153
- // THE EXIT CODE AND NOT THE MESSAGE, measured rather than assumed: the reference's
154
- // render half is ALREADY this port. `_build_render.build` calls `_build_core.run_node`,
155
- // which ends `raise SystemExit(res.get("exit", 1))` — an INTEGER — so every refusal
156
- // that crosses the seam arrives here as `SystemExit(1)` and `str(e)` is `'1'`, not the
157
- // sentence `load_theme` wrote on stderr on the way out. A port that printed `e.message`
158
- // says `unknown theme 'x'` where the reference says `1`. The former Python
159
- // cross-implementation corpus is what found it; nothing else could.
152
+ // THE EXIT CODE AND NOT THE MESSAGE: every refusal that crosses the seam arrives
153
+ // here as an INTEGER exit code, not the sentence `loadTheme` wrote on stderr on the
154
+ // way out, and the printed line is part of the verb's output. Printing `e.message`
155
+ // would say `unknown theme 'x'` where the output says `1`.
160
156
  if (e && e.exitCode !== undefined) {
161
157
  printOut(`[validate-only] render/emit FAILED for theme '${args.theme}' `
162
158
  + `emit '${emit}': ${e.exitCode}\n`);
@@ -172,11 +168,13 @@ export function cmdValidate(args) {
172
168
  // READ BACK OFF THE RENDER, not echoed from `args`: this line is the proof the axes reached
173
169
  // the sandbox, which an echo of the flags would print just as happily if they had not.
174
170
  const at = scanDirs[0];
175
- const packs = doctrinesOfDir(at);
176
- const excluded = excludedRulesOfDir(at);
177
- const gates = gatesOfDir(at);
178
- printOut(`[validate-only] rendered at posture=${postureOfDir(at) ?? '?'} `
179
- + `mode=${modeOfDir(at) ?? '?'} packs=${packs ? packs.join(',') || 'none' : '?'} `
171
+ // The emit names the host whose carrier carries these lines; `files` has none to name.
172
+ const host = EMIT_HOST_SCOPE.get(emit)?.[0] ?? null;
173
+ const packs = doctrinesOfDir(at, host);
174
+ const excluded = excludedRulesOfDir(at, host);
175
+ const gates = gatesOfDir(at, host);
176
+ printOut(`[validate-only] rendered at posture=${postureOfDir(at, host) ?? '?'} `
177
+ + `mode=${modeOfDir(at, host) ?? '?'} packs=${packs ? packs.join(',') || 'none' : '?'} `
180
178
  + `excluded=${excluded.map((id) => id.replace('.', ' ')).join(', ') || 'none'}`
181
179
  // Each elided when armed, so an armed dry run prints the line it always did.
182
180
  + `${GATE_SWITCHES.filter((g) => gates[g.key] === false)
@@ -202,8 +200,8 @@ export function cmdValidate(args) {
202
200
 
203
201
  // The source-tree-wide checks (theme parity, authoring gates, AGENT.md table parity,
204
202
  // colour themes) do not depend on --out/--root/--emit at all and already live fully tested
205
- // in the doctor, so they run through it rather than being re-derived. The reference SHELLS
206
- // to `harness.py doctor --theme T --no-bundle`; one process is what this port has.
203
+ // in the doctor, so they run through it rather than being re-derived. One process: the
204
+ // doctor runs in-process with the theme and no bundle.
207
205
  const doctor = captureStreams(() => cmdDoctor({ theme: args.theme, noBundle: true }));
208
206
  if (stripWhitespace(doctor.out)) printOut(`${stripWhitespace(doctor.out)}\n`);
209
207
  if (stripWhitespace(doctor.err)) printErr(`${stripWhitespace(doctor.err)}\n`);