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
@@ -28,7 +28,8 @@
28
28
  //
29
29
  // MACHINE WIKI (AGENT.md §8): the same block also carries the user's own knowledge
30
30
  // base(s) — typically an Obsidian vault — declared once per machine in `geneseed-wiki.jsonc`
31
- // ($GENESEED_WIKI -> $GENESEED_HARNESS/geneseed-wiki.jsonc -> beside this plugin's install).
31
+ // ($GENESEED_WIKI -> $GENESEED_HARNESS/geneseed-wiki.jsonc -> beside this plugin's install ->
32
+ // the machine tier).
32
33
  // Each wiki's eager entries inject in full and lazy entries list, drawing on the
33
34
  // SAME budgets as the project context; its conventions/inbox/protected metadata is
34
35
  // surfaced so the agent knows the house rules before writing. No wiki manifest, or an
@@ -116,8 +117,13 @@ async function mainWorktreeOf(dir) {
116
117
  async function sovereignBypass(cwd) {
117
118
  try {
118
119
  const cfg = path.dirname(PLUGIN_DIR) // plugins/ sits directly in <cfg>
119
- const raw = await fs.readFile(path.join(cfg, "excludes.json"), "utf8")
120
- const entries = (JSON.parse(raw).excludes) || []
120
+ const listOf = async (file) => {
121
+ try { const l = JSON.parse(await fs.readFile(file, "utf8")).excludes; return Array.isArray(l) ? l : [] } catch { return [] }
122
+ }
123
+ const entries = await listOf(path.join(cfg, "excludes.json"))
124
+ // Shared list (<machineDir>/excludes.json): a GLOBAL install adds it, a project install never does.
125
+ const shared = await listOf(path.join(machineDir(), "excludes.json"))
126
+ if (shared.length && await readsTier(cfg)) entries.push(...shared)
121
127
  const here = norm(cwd || process.cwd())
122
128
  const main = await mainWorktreeOf(cwd || process.cwd())
123
129
  const heres = main ? [here, norm(main)] : [here]
@@ -214,8 +220,9 @@ async function isDir(p) {
214
220
  // tests/unit/claude.test.mjs gates both copies against SESSION_SEEDS in js/build/stubs.mjs.
215
221
  // context.json is not here: it is a manifest, honoured by resolveSource. geneseed-wiki.jsonc
216
222
  // is not here either: the MACHINE WIKI block below already renders it in full.
217
- const SESSION_FILES = ["user-rules.md", "PROFILE.md", "memory/MEMORY.md", "anamnesis/MEMORY.md",
218
- "notebook/NOTEBOOK.md"]
223
+ const SESSION_FILES = ["user-rules.md", "PROFILE.md", "memory/MEMORY.md", "notebook/NOTEBOOK.md"]
224
+ // The wiki manifest's names, newest first: WIKI_NAMES in js/lib/machine-dir.mjs.
225
+ const WIKI_NAMES = ["geneseed-wiki.jsonc", "wiki.jsonc", "wiki.json"]
219
226
  const SEED_SHA256 = new Set([
220
227
  "5c2e92fb1acde041e02d9ebf158460d8ff7a07cbc2b447859631604610130721", // user-rules.md
221
228
  "29e012c3c4349ea62a9082cbd04bb25599a0ec280d62c33f6e10742809471816", // PROFILE.md
@@ -238,18 +245,72 @@ async function harnessDir() {
238
245
  return null
239
246
  }
240
247
 
241
- // Session files present under the harness dir and changed from their seed: [{ rel, abs, text }].
248
+ // The machine tier: machineDir() in js/lib/machine-dir.mjs, which a plugin cannot import.
249
+ function machineDir() {
250
+ return path.join(process.env.XDG_CONFIG_HOME || path.join(homedir(), ".config"), "geneseed")
251
+ }
252
+
253
+ // Only a global install reads the tier: its .geneseed-emit names a -global emit, or it is the host's config dir.
254
+ // The host's own config dir counts as global too, whatever its marker says (the hook's
255
+ // isHostGlobalDir accepts both): OPENCODE_CONFIG_DIR, else <XDG config>/opencode.
256
+ const hostConfigDir = () => process.env.OPENCODE_CONFIG_DIR || path.join(process.env.XDG_CONFIG_HOME || path.join(homedir(), ".config"), "opencode")
257
+ async function isHostConfigDir(dir) {
258
+ const real = async (d) => { const r = await fs.realpath(path.resolve(d)).catch(() => path.resolve(d)); return process.platform === "win32" ? r.toLowerCase() : r }
259
+ return (await real(dir)) === (await real(hostConfigDir()))
260
+ }
261
+
262
+ async function readsTier(dir) {
263
+ try { if ((await fs.readFile(path.join(dir, ".geneseed-emit"), "utf8")).trim().endsWith("-global")) return true } catch { /* no marker */ }
264
+ return isHostConfigDir(dir)
265
+ }
266
+
267
+ // A PROJECT install with `Shared tier: on` in its AGENT.md reads the tier too (the hook's projectReadsTier),
268
+ // unless a global OpenCode install exists: its plugin loads beside this one and already injects it, so a
269
+ // second tier here would be a double. The global install's marker is <config dir>/.geneseed-emit.
270
+ async function projectReadsTier(dir) {
271
+ try {
272
+ if (!/^Shared tier:[ \t]*on[ \t]*\r?$/m.test(await fs.readFile(path.join(dir, "AGENT.md"), "utf8"))) return false
273
+ return !(await isFile(path.join(hostConfigDir(), ".geneseed-emit")))
274
+ } catch { return false }
275
+ }
276
+ async function tierFor(dir) { return (await readsTier(dir)) || (await projectReadsTier(dir)) }
277
+
278
+ // The fold's pending items, the twin of js/hosts/hooks-context.mjs `draftLine`: same line, same count.
279
+ async function draftLine() {
280
+ try {
281
+ const { items } = JSON.parse(await fs.readFile(path.join(machineDir(), ".fold-state.json"), "utf8"))
282
+ const n = Object.values(items ?? {}).filter((i) => i?.state === "pending").length
283
+ return n ? `[drafts] ${n} drafted item${n === 1 ? "" : "s"} in user-rules.draft.md wait${n === 1 ? "s" : ""} for the user's decision (the rule skill).` : null
284
+ } catch { return null }
285
+ }
286
+
287
+ // A session file's text, CRLF-folded and trimmed; null when missing, unreadable or still its seed.
288
+ async function sessionText(abs) {
289
+ let text
290
+ try { text = (await fs.readFile(abs, "utf8")).replace(/\r\n/g, "\n") } catch { return null }
291
+ if (SEED_SHA256.has(createHash("sha256").update(text).digest("hex"))) return null
292
+ return text.replace(/\n+$/, "")
293
+ }
294
+
295
+ // Session files in force for the harness dir, changed from their seed: [{ rel, abs, text, label }],
296
+ // one per layer. A global install reads the tier first, then its own host layer; the notebook stays
297
+ // per host. PROFILE.md is whole, so a non-seed host copy replaces the shared one. The others
298
+ // concatenate. The (shared) and (host: …) labels appear only when the tier has a say in that file.
242
299
  async function sessionFiles(dir) {
243
300
  const found = []
244
301
  if (!dir) return found
302
+ const tier = await tierFor(dir)
303
+ const entry = (rel, abs, text, label) => {
304
+ const nudge = rel === "memory/MEMORY.md" ? memoryNudge(text) : ""
305
+ found.push({ rel, abs, label, text: nudge ? `${text}\n${nudge}` : text })
306
+ }
245
307
  for (const rel of SESSION_FILES) {
246
308
  const abs = path.join(dir, rel)
247
- let text
248
- try { text = (await fs.readFile(abs, "utf8")).replace(/\r\n/g, "\n") } catch { continue }
249
- if (SEED_SHA256.has(createHash("sha256").update(text).digest("hex"))) continue
250
- text = text.replace(/\n+$/, "")
251
- const nudge = rel.endsWith("MEMORY.md") ? memoryNudge(text) : ""
252
- found.push({ rel, abs, text: nudge ? `${text}\n${nudge}` : text })
309
+ const host = await sessionText(abs)
310
+ const sharedAbs = tier && rel !== "notebook/NOTEBOOK.md" ? path.join(machineDir(), rel) : null
311
+ const shared = sharedAbs ? await sessionText(sharedAbs) : null
312
+ if (shared !== null && !(host !== null && rel === "PROFILE.md")) entry(rel, sharedAbs, shared, "shared")
313
+ if (host !== null) entry(rel, abs, host, shared === null ? "" : "host: opencode")
253
314
  }
254
315
  return found
255
316
  }
@@ -610,6 +671,7 @@ async function resolveSource(root, harness = null) {
610
671
  // 1. $GENESEED_WIKI explicit manifest path
611
672
  // 2. $GENESEED_HARNESS/geneseed-wiki.jsonc pinned install dir
612
673
  // 3. <plugin dir>/../geneseed-wiki.jsonc auto-locate: beside the installed AGENT.md
674
+ // 4. <machine dir>/geneseed-wiki.jsonc global install only, when 2 and 3 are absent or a seed
613
675
  async function resolveWikiFile() {
614
676
  const explicit = process.env.GENESEED_WIKI
615
677
  if (explicit && (await isFile(explicit))) return explicit
@@ -620,14 +682,18 @@ async function resolveWikiFile() {
620
682
  const harness = await harnessDir()
621
683
  if (harness) bases.push(harness)
622
684
  bases.push(path.resolve(PLUGIN_DIR, ".."))
685
+ let host = null
623
686
  for (const base of bases) {
624
- // wiki.jsonc and wiki.json are the legacy names from earlier seeds — still honoured.
625
- for (const name of ["geneseed-wiki.jsonc", "wiki.jsonc", "wiki.json"]) {
687
+ for (const name of WIKI_NAMES) {
626
688
  const p = path.join(base, name)
627
- if (await isFile(p)) return p
689
+ if (!host && (await isFile(p))) host = p
628
690
  }
629
691
  }
630
- return null
692
+ if (harness && (await tierFor(harness)) && (!host || (await sessionText(host)) === null)) {
693
+ const shared = path.join(machineDir(), WIKI_NAMES[0])
694
+ if ((await sessionText(shared)) !== null) return shared
695
+ }
696
+ return host
631
697
  }
632
698
 
633
699
  // Walk a vault folder for .md notes — like the project walk, but dot-folders are
@@ -806,7 +872,7 @@ async function buildBlock(sets, wikis = [], commands = [], session = [], done =
806
872
  const ses = []
807
873
  for (const s of session) {
808
874
  const size = Buffer.byteLength(s.text, "utf8")
809
- ses.push(`----- ${s.rel} -----`)
875
+ ses.push(`----- ${s.rel}${s.label ? ` (${s.label})` : ""} -----`)
810
876
  if (size > EAGER_FILE_KB * 1024) {
811
877
  ses.push(`[demoted: ${s.rel} exceeded ${EAGER_FILE_KB} KB — read ${s.abs} on demand]`, "")
812
878
  continue
@@ -860,7 +926,8 @@ async function resolveBlock(root, judged = true) {
860
926
  const done = (await doneGateOff()) ? null : await doneLine(root, judged).catch(() => null)
861
927
  const owned = (await ownershipGateOff()) ? null : await ownershipLine(root).catch(() => null)
862
928
  const floor = await runtimeFloorLine(root).catch(() => null)
863
- const heads = [done, owned, floor].filter(Boolean).join("\n") || null
929
+ const drafts = harness && (await tierFor(harness)) ? await draftLine() : null
930
+ const heads = [done, owned, floor, drafts].filter(Boolean).join("\n") || null
864
931
  return { block: await buildBlock(sets, wikis, commands, await sessionFiles(harness), heads), src }
865
932
  }
866
933