geneseed 6.0.1 → 6.0.3
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.
- package/CHANGELOG.md +20 -0
- package/SHIPPED.md +1 -1
- package/adapters/opencode/plugins/geneseed-context.js +53 -10
- package/adapters/opencode/plugins/geneseed-learn.js +11 -4
- package/docs/concepts/agents.md +2 -2
- package/docs/web-ui.md +25 -0
- package/harness.config.json +1 -1
- package/js/README.md +2 -1
- package/js/build/bundle.mjs +2 -11
- package/js/build/emit-claude.mjs +2 -2
- package/js/build/emit-opencode.mjs +4 -2
- package/js/build/fold.mjs +3 -20
- package/js/build/source.mjs +1 -1
- package/js/build/stubs.mjs +42 -5
- package/js/cli-table.json +1 -1
- package/js/hosts/hooks-context.mjs +65 -9
- package/js/hosts/memory-files.mjs +166 -13
- package/js/hosts/native.mjs +48 -27
- package/js/hosts/opencode.mjs +3 -2
- package/js/inspect/checks-build.mjs +2 -2
- package/js/inspect/doctor.mjs +2 -0
- package/js/inspect/status.mjs +4 -1
- package/js/maintain/memory.mjs +2 -2
- package/js/web/agent-models-api.mjs +52 -17
- package/js/web/api.mjs +3 -0
- package/js/web/catalog.mjs +5 -3
- package/js/web/model-catalog.mjs +324 -0
- package/js/web/routes.mjs +5 -3
- package/package.json +1 -1
- package/src/agents/memory-curator.md +1 -1
- package/src/memory/README.md +24 -5
- package/src/skills/rule/approve.md +3 -1
- package/src/skills/rule/consolidate.md +1 -1
- package/web/dist/assets/ActiveLoops-paFbiZyt.js +1 -0
- package/web/dist/assets/Activity-IAxWF2wK.js +1 -0
- package/web/dist/assets/ActivityDetail-CtC2DLvh.js +1 -0
- package/web/dist/assets/{Bonsai-8NtlFrPO.js → Bonsai-BoKo68Kw.js} +1 -1
- package/web/dist/assets/{CopyButton-BHqKgdjJ.js → CopyButton-C0VTiqmb.js} +1 -1
- package/web/dist/assets/Dashboard-CRGCp2cV.js +2 -0
- package/web/dist/assets/{Docs-C1jzrFnD.js → Docs-DwOwzaD6.js} +2 -2
- package/web/dist/assets/Factories-DxHD2T-1.js +1 -0
- package/web/dist/assets/{GreenhouseView-ofAQ-V5h.js → GreenhouseView-D5VOmhmR.js} +1 -1
- package/web/dist/assets/Installs-B5hFSUeN.js +3 -0
- package/web/dist/assets/JournalView-gUSGysTm.js +1 -0
- package/web/dist/assets/{Kits-P4xspDuN.js → Kits-DYQvykZ0.js} +1 -1
- package/web/dist/assets/Laws-UVk0uojS.js +4 -0
- package/web/dist/assets/{LibRows-CGO25X3D.js → LibRows-CwK63kjB.js} +1 -1
- package/web/dist/assets/Library-DdzyrwUK.js +3 -0
- package/web/dist/assets/Loops-yHga7xdr.js +2 -0
- package/web/dist/assets/Models-DAgkQ4CE.js +1 -0
- package/web/dist/assets/{OperatorHudView-Cc8mlViW.js → OperatorHudView-D1lQF-ZY.js} +1 -1
- package/web/dist/assets/Personal-DjhIfa9v.js +2 -0
- package/web/dist/assets/Settings-Brgec4M0.js +1 -0
- package/web/dist/assets/Tabs-BHjxciOL.js +1 -0
- package/web/dist/assets/api-C8nMUU1i.js +1 -0
- package/web/dist/assets/index-BILaKHbH.js +6 -0
- package/web/dist/assets/index-BfyZCNu7.css +1 -0
- package/web/dist/assets/router-1EhRJy1C.js +1 -0
- package/web/dist/assets/useLocalStorage-54tkqXN7.js +1 -0
- package/web/dist/index.html +5 -3
- package/web/dist/assets/ActiveLoops-6p44eD86.js +0 -1
- package/web/dist/assets/Activity-CIgrq5R1.js +0 -1
- package/web/dist/assets/ActivityDetail-Brqv1u4f.js +0 -1
- package/web/dist/assets/Dashboard-CoveJ_-U.js +0 -2
- package/web/dist/assets/Factories-D5pLnt5S.js +0 -1
- package/web/dist/assets/Installs-DpWgyT5j.js +0 -3
- package/web/dist/assets/JournalView-CsuN3_B-.js +0 -1
- package/web/dist/assets/Laws-DK3OwGDl.js +0 -4
- package/web/dist/assets/Library-e-94YED6.js +0 -3
- package/web/dist/assets/Loops-C9DSBj-A.js +0 -2
- package/web/dist/assets/Personal-DVh2jYPO.js +0 -2
- package/web/dist/assets/Settings-CknBI-Fx.js +0 -1
- package/web/dist/assets/Tabs-C30JrkJH.js +0 -1
- package/web/dist/assets/api-DxwG8y94.js +0 -1
- package/web/dist/assets/index-CUJ8AaAF.css +0 -1
- package/web/dist/assets/index-MB7E-va_.js +0 -6
- package/web/dist/assets/usePoll-D5c_qIFZ.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,26 @@ label. For the capability ↔ spec map, see [SHIPPED.md](SHIPPED.md).
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [6.0.3] — 2026-11-18
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **View levels in the web console: Essentials, Standard and Power.** A new browser starts on Essentials: Overview, Library (Skills, Agents), Installs (Hosts, Doctor), Personal (Rules, Profile), Docs and Settings. Standard adds Kits, Activity, Constitution, Memory and install profiles; Power shows everything, Models, Loops, Factories, the Wiki and Setup files and the Danger zone included. Switch it in the Appearance popover or in *Settings › Machine*; the choice is this browser's alone. A hidden part keeps working: a link, a bookmark or a search result still opens it with a "This is a Power view" banner, search tags such results with their level, and the rail foot names running loops and factory runs the level hides. One table, `web/src/lib/tiers.js`, decides every level.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Memory: a top-level file whose name is all capitals (`ARCHIVE-INDEX.md`, `README.md`, `MEMORY.md`) is a store document, not a fact: it leaves the index, `learn`'s list and the curation count. The next emit also moves the machine tier's flat `MEMORY.md` to the topic map, drafts the standing rules that index loaded (`user-rules.draft.md`, loaded until you decide them), and the curation nudge no longer fires on topic size.
|
|
20
|
+
|
|
21
|
+
## [6.0.2] — 2026-11-18
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- **A Models page, and tier routing on OpenCode and OpenClaude.** *Build → Models* sets which model each sub-agent runs on, for every Claude Code, OpenCode and OpenClaude install: the routing switch, the standard and light tier models, and a pin per agent, picked from the models that install can use (your own providers first, then the models.dev ones you have a key for, then local Ollama or LM Studio). A company setup with a private URL and in-house model names works without any catalogue, and an OpenClaude install on the same endpoint offers the same names. The page never reads or sends an API key. `--tiers auto` now writes `model: provider/model` on OpenCode and `model:` on OpenClaude for the tiers your `tiers` map names; neither has a default model, so nothing changes until you pick one. With `--tiers off` every agent file is byte-identical.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- The Installs panel no longer has the *Model tiers* switch and editor, and the Library no longer has the pin field: each shows one line (routing, pins, the model an agent runs on) with a link to the Models page.
|
|
30
|
+
|
|
11
31
|
## [6.0.1] — 2026-11-18
|
|
12
32
|
|
|
13
33
|
### Added
|
package/SHIPPED.md
CHANGED
|
@@ -20,7 +20,7 @@ historical references, not files distributed with the repo.
|
|
|
20
20
|
> **On version numbers.** [`harness.config.json`](harness.config.json)'s `version` is a
|
|
21
21
|
> human-readable label only. The canonical identity of an installed harness is the
|
|
22
22
|
> **source fingerprint** stamped in `.geneseed-version` (see `geneseed version`), not the
|
|
23
|
-
> string. Current label: **6.0.
|
|
23
|
+
> string. Current label: **6.0.3**.
|
|
24
24
|
|
|
25
25
|
## Capabilities
|
|
26
26
|
|
|
@@ -330,36 +330,79 @@ async function sessionFiles(dir) {
|
|
|
330
330
|
const found = []
|
|
331
331
|
if (!dir) return found
|
|
332
332
|
const tier = await tierFor(dir)
|
|
333
|
-
const entry = (rel, abs, text, label) => {
|
|
334
|
-
const
|
|
335
|
-
found.push({ rel, abs, label, text:
|
|
333
|
+
const entry = (rel, abs, text, label, slot = "") => {
|
|
334
|
+
const extra = rel === "memory/MEMORY.md" ? [memoryNudge(text), slot].filter(Boolean) : []
|
|
335
|
+
found.push({ rel, abs, label, text: [text, ...extra].join("\n") })
|
|
336
336
|
}
|
|
337
337
|
for (const rel of SESSION_FILES) {
|
|
338
338
|
const abs = path.join(dir, rel)
|
|
339
339
|
const host = await sessionText(abs)
|
|
340
340
|
const sharedAbs = tier && rel !== "notebook/NOTEBOOK.md" ? path.join(machineDir(), rel) : null
|
|
341
341
|
const shared = sharedAbs ? await sessionText(sharedAbs) : null
|
|
342
|
-
if (shared !== null && !(host !== null && rel === "PROFILE.md"))
|
|
342
|
+
if (shared !== null && !(host !== null && rel === "PROFILE.md")) {
|
|
343
|
+
entry(rel, sharedAbs, shared, "shared")
|
|
344
|
+
}
|
|
343
345
|
if (host !== null) entry(rel, abs, host, shared === null ? "" : "host: opencode")
|
|
346
|
+
// The bridge slot is its own entry right after the rules, as in the hook (BRIDGE_REL there).
|
|
347
|
+
if (rel === "user-rules.md" && tier) {
|
|
348
|
+
const slot = await bridgeSlot()
|
|
349
|
+
if (slot) found.push({ rel: "user-rules.draft.md", abs: path.join(machineDir(), "user-rules.draft.md"), label: "shared", text: slot })
|
|
350
|
+
}
|
|
344
351
|
}
|
|
345
352
|
return found
|
|
346
353
|
}
|
|
347
354
|
|
|
348
|
-
// The memory map's curation nudge: same rule
|
|
355
|
+
// The memory map's curation nudge: same rule and text as memoryNudge in
|
|
349
356
|
// js/hosts/hooks-context.mjs (tests/unit/claude.test.mjs gates the copy). Read off the map's
|
|
350
|
-
// own counts; a
|
|
357
|
+
// own counts; only a fact filed under misc fires it, never the size of a topic (D23).
|
|
351
358
|
const MAP_COUNT_RE = /^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
+ "to dispatch the memory-curator agent to merge, re-topic and archive this store."
|
|
359
|
+
const CURATE_NUDGE = "[memory] Facts sit in misc: offer the user to dispatch the memory-curator agent "
|
|
360
|
+
+ "to re-topic and archive them."
|
|
355
361
|
function memoryNudge(map) {
|
|
356
362
|
for (const line of map.split("\n")) {
|
|
357
363
|
const m = MAP_COUNT_RE.exec(line.trim())
|
|
358
|
-
if (m &&
|
|
364
|
+
if (m && m[1] === "misc") return CURATE_NUDGE
|
|
359
365
|
}
|
|
360
366
|
return ""
|
|
361
367
|
}
|
|
362
368
|
|
|
369
|
+
// The bridge slot (D31), a hand twin of bridgeSlot in js/hosts/hooks-context.mjs (same constants,
|
|
370
|
+
// same text; tests/unit/claude.test.mjs holds the two equal on one store): the facts a migration
|
|
371
|
+
// drafted as standing rules keep loading, as an entry of their own after user-rules.md, until their draft is decided.
|
|
372
|
+
const BRIDGE_CAP = 1800
|
|
373
|
+
const BRIDGE_FACT_MAX = 300
|
|
374
|
+
const BRIDGE_HEAD = "[memory] Standing rules from your old index, drafted in user-rules.draft.md and "
|
|
375
|
+
+ "loaded until you decide them:"
|
|
376
|
+
const BRIDGE_SLUG_RE = /^[^/\\.\u0000-\u001f][^/\\\u0000-\u001f]*$/
|
|
377
|
+
async function bridgeSlot() {
|
|
378
|
+
let items
|
|
379
|
+
try { ({ items } = JSON.parse(await fs.readFile(path.join(machineDir(), ".fold-state.json"), "utf8"))) } catch { return "" }
|
|
380
|
+
// The hook counts a line as its characters plus a terminator of two (+1 per inner break).
|
|
381
|
+
const cost = (s) => s.length + (s.match(/\n/g) || []).length + 2
|
|
382
|
+
const lines = []
|
|
383
|
+
for (const row of Object.values(items ?? {})) {
|
|
384
|
+
if (row?.state !== "pending" || row.host !== "memory" || typeof row.fact !== "string" || !BRIDGE_SLUG_RE.test(row.fact)) continue
|
|
385
|
+
let text
|
|
386
|
+
try { text = (await fs.readFile(path.join(machineDir(), "memory", `${row.fact}.md`), "utf8")).replace(/\r\n/g, "\n") } catch { continue }
|
|
387
|
+
const m = /^\s*---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/.exec(text)
|
|
388
|
+
const desc = m ? (m[1].split("\n").map((l) => /^\s*description\s*:(.*)$/.exec(l)).find(Boolean)?.[1] ?? "").trim().replace(/^"+|"+$/g, "") : ""
|
|
389
|
+
const rule = ((m ? m[2] : text).trim() || desc).replace(/\s+/g, " ")
|
|
390
|
+
lines.push(`- ${row.fact}: ${rule.length > BRIDGE_FACT_MAX ? `${rule.slice(0, BRIDGE_FACT_MAX)}…` : rule}`)
|
|
391
|
+
}
|
|
392
|
+
if (!lines.length) return ""
|
|
393
|
+
const tail = (n) => `- … ${n} more drafted rule${n === 1 ? "" : "s"} not shown (read them in memory/)`
|
|
394
|
+
const room = BRIDGE_CAP - cost(BRIDGE_HEAD)
|
|
395
|
+
const kept = []
|
|
396
|
+
let used = 0
|
|
397
|
+
for (const [i, l] of lines.entries()) {
|
|
398
|
+
const t = tail(lines.length - i)
|
|
399
|
+
if (used + cost(l) + (i < lines.length - 1 ? cost(t) : 0) > room) { kept.push(t); break }
|
|
400
|
+
kept.push(l)
|
|
401
|
+
used += cost(l)
|
|
402
|
+
}
|
|
403
|
+
return [BRIDGE_HEAD, ...kept].join("\n")
|
|
404
|
+
}
|
|
405
|
+
|
|
363
406
|
async function readJson(p) {
|
|
364
407
|
try { return JSON.parse(await fs.readFile(p, "utf8")) } catch { return null }
|
|
365
408
|
}
|
|
@@ -900,9 +900,11 @@ function envModel() {
|
|
|
900
900
|
// Stems that name the store's own files, never a fact: `MEMORY` is the index, so a model
|
|
901
901
|
// that emitted `name: MEMORY` would overwrite it.
|
|
902
902
|
const RESERVED_STEMS = new Set(["memory", "readme"])
|
|
903
|
+
// A twin of isReservedStem in js/hosts/memory-files.mjs (D2): a stem written wholly in capitals is a store document too.
|
|
904
|
+
const isReservedStem = (stem) => RESERVED_STEMS.has(stem.toLowerCase()) || (stem === stem.toUpperCase() && stem !== stem.toLowerCase())
|
|
903
905
|
|
|
904
906
|
async function existingSlugs(memDir) {
|
|
905
|
-
return new Set((await listMd(memDir)).map((f) => f.slice(0, -3)).filter((s) => !
|
|
907
|
+
return new Set((await listMd(memDir)).map((f) => f.slice(0, -3)).filter((s) => !isReservedStem(s)))
|
|
906
908
|
}
|
|
907
909
|
|
|
908
910
|
// The stored facts' lines are capped at MAX_STORED_CHARS, a twin of buildLearnPrompt in
|
|
@@ -988,7 +990,7 @@ async function writeMemories(output, memDir, existing) {
|
|
|
988
990
|
const name = (fm.name || "").trim()
|
|
989
991
|
const key = name.toLowerCase()
|
|
990
992
|
const action = (fm.action || "").trim().toLowerCase() || "create"
|
|
991
|
-
if (!MEMORY_SLUG_RE.test(name) ||
|
|
993
|
+
if (!MEMORY_SLUG_RE.test(name) || isReservedStem(name) || done.has(key)) continue
|
|
992
994
|
const slug = stored.get(key)
|
|
993
995
|
if (slug && action !== "create" && (await hasForce(memDir, slug))) continue
|
|
994
996
|
const body = stripAction(chunk).replace(/\n+$/, "") + "\n"
|
|
@@ -1053,7 +1055,7 @@ async function readFacts(memDir) {
|
|
|
1053
1055
|
const facts = new Map()
|
|
1054
1056
|
for (const f of await listMd(memDir)) {
|
|
1055
1057
|
const slug = f.slice(0, -3)
|
|
1056
|
-
if (
|
|
1058
|
+
if (isReservedStem(slug)) continue
|
|
1057
1059
|
let fm
|
|
1058
1060
|
try { fm = parseFrontmatter((await fs.readFile(path.join(memDir, f), "utf8")).replace(/\r\n/g, "\n")) } catch { continue }
|
|
1059
1061
|
facts.set(slug, { desc: (fm.description || "").trim(), topic: topicOf(fm) })
|
|
@@ -1072,7 +1074,9 @@ async function rebuildIndex(memDir, fresh = new Set()) {
|
|
|
1072
1074
|
}
|
|
1073
1075
|
}
|
|
1074
1076
|
const byTopic = new Map()
|
|
1077
|
+
const known = new Set()
|
|
1075
1078
|
for (const [slug, { desc, topic }] of await readFacts(memDir)) {
|
|
1079
|
+
known.add(slug.toLowerCase())
|
|
1076
1080
|
const o = fresh.has(slug) ? null : old.get(slug)
|
|
1077
1081
|
const line = o ? `- [${o.title}](../${slug}.md)${o.rest}` : `- [${slug}](../${slug}.md)` + (desc ? ` — ${desc}` : "")
|
|
1078
1082
|
if (!byTopic.has(topic)) byTopic.set(topic, [])
|
|
@@ -1090,9 +1094,12 @@ async function rebuildIndex(memDir, fresh = new Set()) {
|
|
|
1090
1094
|
mapLines.push(`- [${topic}](topics/${topic}.md) — ${lines.length} fact${lines.length === 1 ? "" : "s"}`)
|
|
1091
1095
|
}
|
|
1092
1096
|
const index = path.join(memDir, "MEMORY.md")
|
|
1097
|
+
// A flat pointer is dropped unless it names a store document (D4): a fact's has moved into its topic file.
|
|
1098
|
+
const documents = new Set((await listMd(memDir)).map((f) => f.slice(0, -3).toLowerCase()).filter((s) => !known.has(s)))
|
|
1093
1099
|
const carried = ((await readLines(index)) ?? []).filter((l) => {
|
|
1094
1100
|
const t = l.trim()
|
|
1095
|
-
|
|
1101
|
+
const flat = FACT_LINE_RE.exec(t)
|
|
1102
|
+
return t && t !== MEMORY_SEED.trim() && t !== MAP_HINT && !MAP_LINE_RE.test(t) && !(flat && !documents.has(flat[2].toLowerCase()))
|
|
1096
1103
|
})
|
|
1097
1104
|
const body = [...(mapLines.length ? ["", MAP_HINT, "", ...mapLines] : []), ...(carried.length ? ["", ...carried] : [])]
|
|
1098
1105
|
await writeIfChanged(index, body.length ? MEMORY_SEED + body.join("\n") + "\n" : MEMORY_SEED)
|
package/docs/concepts/agents.md
CHANGED
|
@@ -42,11 +42,11 @@ In [foreman mode](foreman-mode.md) the session hands each task that would block
|
|
|
42
42
|
|
|
43
43
|
Each agent source names a tier on a line of its own, `<!-- tier: strong|light -->`; an unmarked agent is `standard`. `strong` is the judgement seats (`reviewer`, `security`, `architect`, `performance`, and the kit seats `react-reviewer`, `spring-reviewer`, `spring-security`), `light` is the read-only seats (`explorer`, `researcher` and the ten council debaters), and the rest are `standard`. The line never reaches an install.
|
|
44
44
|
|
|
45
|
-
By default nothing changes: every agent runs on your session model. A build with `--tiers auto` (recorded in the install, kept by `rebuild-all`) makes a **Claude Code** install write `model: sonnet` for `standard` agents and `model: haiku` for `light` ones; `strong` agents write no line and inherit.
|
|
45
|
+
By default nothing changes: every agent runs on your session model. A build with `--tiers auto` (recorded in the install, kept by `rebuild-all`) makes a **Claude Code** install write `model: sonnet` for `standard` agents and `model: haiku` for `light` ones; `strong` agents write no line and inherit. **OpenCode** (`model: provider/model`, a `#variant` suffix kept as written) and **OpenClaude** route too, but have no default model: a tier routes only once your `tiers` map names a model for it, because OpenCode has no alias and OpenClaude's `sonnet` and `haiku` mean the parent model on a provider that is not Anthropic. Bob takes no per-agent model and inherits.
|
|
46
46
|
|
|
47
47
|
Two settings of yours steer it, both in `agent-overrides.json`. A `tiers` map renames the models (`{ "tiers": { "standard": "opus", "light": "claude-haiku-4-5" } }`; an empty value means inherit), and an `agents.<name>.model` pin beats its tier, a stronger model included. The build always writes the alias. On Bedrock or Vertex, Claude Code maps an alias through `ANTHROPIC_DEFAULT_SONNET_MODEL` or `ANTHROPIC_DEFAULT_HAIKU_MODEL`; without it, it uses its built-in model id, which may not exist in your cloud project. With `CLAUDE_CODE_USE_BEDROCK` or `CLAUDE_CODE_USE_VERTEX` set and the variable missing, `geneseed doctor` tells you to pin it.
|
|
48
48
|
|
|
49
|
-
The web console sets all of this
|
|
49
|
+
The web console sets all of this on its **Build → Models** page, for any Claude Code, OpenCode or OpenClaude install. It has the routing switch (`off` or `auto`), the two tier models, and one row per agent with the model it runs on, why, and a pin. A picker lists the models the install can use: Claude Code's aliases (filtered by `availableModels`); on OpenCode your own providers from `opencode.json` or `opencode.jsonc` first (a company gateway with in-house model names works with no models.dev cache), then the models.dev providers you have a key or login for, then Ollama or LM Studio if one runs on this machine; on OpenClaude the active provider's model, the models of an OpenCode provider on the same endpoint, local runtimes and your `agentModels` routes. It never reads or sends an API key and calls no endpoint that needs one. A model you type is saved as written and marked *not detected* when nothing lists it. The page edits `agent-overrides.json` key by key (a file that does not parse is refused); the model is written into the agent files at emit, so a save takes effect at the next rebuild, which the page offers and which also applies the routing. The Installs panel and the Library show one line each and link to the page.
|
|
50
50
|
|
|
51
51
|
### Agents learn too
|
|
52
52
|
|
package/docs/web-ui.md
CHANGED
|
@@ -223,6 +223,31 @@ output**. **Full log** shows the raw output unchanged, for the picked run only.
|
|
|
223
223
|
`web/src/lib/runPhases.js`, and the prefixes it knows are listed at its top. On a narrow
|
|
224
224
|
screen the run list stacks above the detail.
|
|
225
225
|
|
|
226
|
+
## View levels
|
|
227
|
+
|
|
228
|
+
The console shows three view levels. A level shows every part at or below its own, so each level holds the one before it.
|
|
229
|
+
|
|
230
|
+
- **Essentials** — the default. The pages most readers need to see and fix their harness.
|
|
231
|
+
- **Standard** — adds the pages and tabs for kits, activity, laws, memory and profiles.
|
|
232
|
+
- **Power** — adds everything else. That is models, loops, factories, the notebook, local edits, the wiki, setup files and the danger zone.
|
|
233
|
+
|
|
234
|
+
| Part | Level |
|
|
235
|
+
| --- | --- |
|
|
236
|
+
| Pages: Overview, Library, Installs, Personal, Docs, Settings | Essentials |
|
|
237
|
+
| Tabs: Personal / Rules and Profile; Installs / Hosts and Doctor | Essentials |
|
|
238
|
+
| Library sections: Skills and Agents | Essentials |
|
|
239
|
+
| Settings sections: Machine, Server and About | Essentials |
|
|
240
|
+
| Pages: Kits, Activity, Constitution | Standard |
|
|
241
|
+
| Tabs: Personal / Memory; Installs / Profiles | Standard |
|
|
242
|
+
| Pages: Models, Loops, Factories | Power |
|
|
243
|
+
| Tabs: Loops (all three); Factories (both); Personal / Notebook; Installs / Local edits | Power |
|
|
244
|
+
| Library sections: Wiki and Setup files | Power |
|
|
245
|
+
| Settings section: Danger zone | Power |
|
|
246
|
+
|
|
247
|
+
Change the level in the **Appearance** popover in the topbar, or in **Settings › Machine**. The choice is kept in this browser.
|
|
248
|
+
|
|
249
|
+
A hidden part is not off. It keeps working, and a link, a bookmark or a search result still opens it. A page above your level opens with a banner that names the level it needs. The search results mark such a page with that level. The foot of the rail names a running loop or factory that your level hides. This way you do not lose track of it. The Overview "New here?" card also says which view is on, until you choose Power.
|
|
250
|
+
|
|
226
251
|
## Views
|
|
227
252
|
|
|
228
253
|
### Dashboard
|
package/harness.config.json
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
"_comment": "version is a human-readable release label only; the canonical identity of an installed harness is the source fingerprint stamped in .geneseed-version (see `harness version`), not this string.",
|
|
3
3
|
"theme": "neutral",
|
|
4
4
|
"product": "Geneseed",
|
|
5
|
-
"version": "6.0.
|
|
5
|
+
"version": "6.0.3"
|
|
6
6
|
}
|
package/js/README.md
CHANGED
|
@@ -282,7 +282,8 @@ the deployed harness as JSON.
|
|
|
282
282
|
| `api.mjs` | The dashboard and settings reads: overview, recent, themes, setup, doctor, diff, installs, excludes, loops |
|
|
283
283
|
| `update-check.mjs` | Is a newer release on npm? Answers from memory, refreshes in the background (a day when it got an answer, an hour when it did not), `null` on any failure, never asked under `node --test` |
|
|
284
284
|
| `gates-api.mjs` | `GET /api/gates`: gate asks per rule per day over 30 days, read off every installed harness's `notebook/gates.jsonl` (the Overview's sparklines) |
|
|
285
|
-
| `agent-models-api.mjs` | `GET`/`POST /api/agent-models`: one Claude Code
|
|
285
|
+
| `agent-models-api.mjs` | `GET`/`POST /api/agent-models`: one install's (Claude Code, OpenCode or OpenClaude) `tiers` map and per-agent model pins in `agent-overrides.json` (merged key by key, a file that does not parse is refused), with each agent's tier and the model it resolves to (`agentModel`, the emit's own precedence) and the install's model list |
|
|
286
|
+
| `model-catalog.mjs` | The models one install can run, per host: Claude aliases, OpenCode custom providers then the models.dev cache then loopback Ollama/LM Studio probes, OpenClaude's profile, same-endpoint OpenCode providers and routes. Files and loopback only; never a key value (a test pins it) |
|
|
286
287
|
| `usage-api.mjs` | `GET /api/usage`: the 30-day skill and agent call counts across every installed harness, the never-fired list, a fleet-wide `names` list (per-name 30-day counts, installs, daily series, last day seen), and skips lines older than 90 days in each `notebook/usage.jsonl` |
|
|
287
288
|
| `profiles-api.mjs` | The Profiles tab: `GET /api/profiles` (both sources, the installs that follow each, an apply preview) and the `profile-apply` / `profile-save` jobs, which run the CLI's own verb |
|
|
288
289
|
| `user-files.mjs` | The fingerprint-guarded editors for `user-rules.md` (incl. memory promotion) and `PROFILE.md`, read and write |
|
package/js/build/bundle.mjs
CHANGED
|
@@ -13,13 +13,12 @@
|
|
|
13
13
|
import path from 'node:path';
|
|
14
14
|
import { VERSION_MARKER } from '../hosts/hosts.mjs';
|
|
15
15
|
import { BUNDLE_FILES_KEY, bundleFiles, ownedWithin } from '../hosts/owned.mjs';
|
|
16
|
-
import { migrateMemoryIndex } from '../hosts/memory-files.mjs';
|
|
17
16
|
import { copyFile, isFile, readText, writeText } from '../lib/fs.mjs';
|
|
18
17
|
import { jsonDumpsIndent, parseJson, formatReprAscii, isTruthy } from '../lib/json.mjs';
|
|
19
18
|
import { OWNED_SRC_DIRS, SRC_DIRS_MARKER, TMPL_SPEC_RE } from './emit-common.mjs';
|
|
20
19
|
import { SRC_DIR_TOKENS, renderAll } from './render.mjs';
|
|
21
20
|
import {
|
|
22
|
-
ensureBundleGitignore, ensureContextStub,
|
|
21
|
+
ensureBundleGitignore, ensureContextStub, ensureMemoryStore, ensureNotebookIndex,
|
|
23
22
|
ensureProfileStub, ensureRulesStub, ensureWikiStub,
|
|
24
23
|
} from './stubs.mjs';
|
|
25
24
|
import { retiredSkillNames, skillLabels } from './retired-skills.mjs';
|
|
@@ -29,15 +28,7 @@ import {
|
|
|
29
28
|
existsSync, mkdirSync, readdirSync, renameSync, rmdirSync, unlinkSync,
|
|
30
29
|
} from 'node:fs';
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
* Seed the memory index, then move a flat one to topics — the pair every emit runs on its
|
|
34
|
-
* memory store, in that order. Here and not in `js/hosts/memory-files.mjs`: `stubs.mjs`
|
|
35
|
-
* imports that module, so the reverse import would be a cycle.
|
|
36
|
-
*/
|
|
37
|
-
export function ensureMemoryStore(memDir) {
|
|
38
|
-
ensureMemoryIndex(memDir);
|
|
39
|
-
migrateMemoryIndex(memDir);
|
|
40
|
-
}
|
|
31
|
+
export { ensureMemoryStore };
|
|
41
32
|
|
|
42
33
|
// ---------------------------------------------------------------------------
|
|
43
34
|
// Source completeness
|
package/js/build/emit-claude.mjs
CHANGED
|
@@ -138,8 +138,8 @@ export function emitClaudeRender(cfg, job) {
|
|
|
138
138
|
items, path.join(cfgDir, 'agents'), path.join(cfgDir, 'skills'),
|
|
139
139
|
loadAgentOverrides(cfgDir),
|
|
140
140
|
{ host: 'claude', bobDialect: isBob, oldOwned, cfg: cfgDir, src: cfg.src, skillDirOf, claim,
|
|
141
|
-
// Claude Code
|
|
142
|
-
tiers: cfg.tiers === 'auto' &&
|
|
141
|
+
// Claude Code and OpenClaude route by tier (2026-11-18 D1); Bob's agents take no model.
|
|
142
|
+
tiers: cfg.tiers === 'auto' && !isBob ? { map: loadTierMap(cfgDir), env: process.env, host } : null });
|
|
143
143
|
for (const p of written) owned.push(relPosix(cfgDir, p));
|
|
144
144
|
|
|
145
145
|
// Bob host-compat O2/R1: an alias, or a genuinely user-only skill (unverified
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
import { bundleFiles } from '../hosts/owned.mjs';
|
|
11
11
|
import { VERSION_MARKER } from '../hosts/hosts.mjs';
|
|
12
|
-
import { claimer, loadAgentOverrides, writeNativeLayer } from '../hosts/native.mjs';
|
|
12
|
+
import { claimer, loadAgentOverrides, loadTierMap, writeNativeLayer } from '../hosts/native.mjs';
|
|
13
13
|
import {
|
|
14
14
|
copyPlugins, copyWorkflows, ensureAgentOverridesStub, writeColorThemes, writeCommandLayer,
|
|
15
15
|
writeAliasCommands, writePonytailCommand, writePrimaryAgent, writeTheme,
|
|
@@ -66,7 +66,9 @@ function opencodeLayer(cfg, items, themeName, theme, dir, owned, opts) {
|
|
|
66
66
|
|
|
67
67
|
const { nAgents, nSkills, written, userOnlySkills } = writeNativeLayer(
|
|
68
68
|
items, path.join(dir, 'agents'), path.join(dir, 'skills'), overrides,
|
|
69
|
-
{ host: 'opencode', theme, src: cfg.src, claim
|
|
69
|
+
{ host: 'opencode', theme, src: cfg.src, claim,
|
|
70
|
+
// `--tiers auto`: a tier routes once the user's `tiers` map names a model for it (no default).
|
|
71
|
+
tiers: cfg.tiers === 'auto' ? { map: loadTierMap(overridesDir), env: process.env, host: 'opencode' } : null });
|
|
70
72
|
for (const p of written) owned.push(relPosix(dir, p));
|
|
71
73
|
|
|
72
74
|
const primary = writePrimaryAgent(cfg, path.join(dir, 'agents'), overrides, claim);
|
package/js/build/fold.mjs
CHANGED
|
@@ -27,8 +27,8 @@ import path from 'node:path';
|
|
|
27
27
|
import { EXCLUDES_FILE, isCanonical } from '../hosts/hosts.mjs';
|
|
28
28
|
import { LINE_BREAK, listDir, splitLines } from '../hosts/hooks-prims.mjs';
|
|
29
29
|
import {
|
|
30
|
-
archiveStore, consolidateMemory, draftChoiceHead, draftRuleHead, existingSlugs, indexNotes,
|
|
31
|
-
readFoldState,
|
|
30
|
+
archiveStore, consolidateMemory, draftChoiceHead, draftItem, draftRuleHead, existingSlugs, indexNotes, itemKey,
|
|
31
|
+
MEMORY_SEED, parseRules, readFoldState,
|
|
32
32
|
} from '../hosts/memory-files.mjs';
|
|
33
33
|
import { foldExcludes } from '../inspect/excludes.mjs';
|
|
34
34
|
import { recordOwnWrites } from '../hosts/store-watch.mjs';
|
|
@@ -49,7 +49,6 @@ export const isWholeFileSeed = (bytes) => WHOLE_FILE_SEEDS.has(seedHash(bytes));
|
|
|
49
49
|
|
|
50
50
|
/** A folded store keeps these: the re-seed restores them, and their text never says "not folded". */
|
|
51
51
|
const STORE_KEEPS = ['README.md', '.gitignore', '.own-writes.json'];
|
|
52
|
-
const DRAFT_HEAD = '# User rules — draft\n\nNot active. The rule Rite or the console applies decisions.\n';
|
|
53
52
|
|
|
54
53
|
/**
|
|
55
54
|
* Claim `dest` with the finished bytes, or throw EEXIST: a rename would replace a file another
|
|
@@ -297,23 +296,7 @@ function foldNotes(cfgDir, ctx) {
|
|
|
297
296
|
}
|
|
298
297
|
}
|
|
299
298
|
|
|
300
|
-
export
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* A block in the draft and a C7 record. The key names the host too, so two hosts holding the same
|
|
304
|
-
* text are two decisions. Draft first: a stop between the writes leaves a block the next run
|
|
305
|
-
* recognises, not a lost one.
|
|
306
|
-
*/
|
|
307
|
-
function draftItem(kind, key, block, tally, { host, shared, dryRun, report }) {
|
|
308
|
-
const state = readFoldState(shared);
|
|
309
|
-
if (state.items[key]) return;
|
|
310
|
-
report[tally] += 1;
|
|
311
|
-
if (dryRun) return;
|
|
312
|
-
const text = existsSync(shared.draft) ? readText(shared.draft) : DRAFT_HEAD;
|
|
313
|
-
if (!text.includes(`sha256: ${key}`)) writeTextAtomic(shared.draft, `${text}\n${block}`);
|
|
314
|
-
state.items[key] = { kind, host, state: 'pending' };
|
|
315
|
-
writeTextAtomic(shared.foldState, `${jsonDumpsIndent(state)}\n`);
|
|
316
|
-
}
|
|
299
|
+
export { itemKey };
|
|
317
300
|
|
|
318
301
|
/** A pointer in the draft, never a copy (C9): each host's differing file gets its own decision. */
|
|
319
302
|
function draftChoice(kind, hostFile, sharedFile, bytes, ctx) {
|
package/js/build/source.mjs
CHANGED
|
@@ -580,7 +580,7 @@ export const ALIASES_RE = /^<!--[ \t]*aliases:[ \t]*(.+?)[ \t]*-->[ \t]*\r?$/m;
|
|
|
580
580
|
* `--tiers auto|off`: the sub-agent model tiers (spec `2026-11-17-subagent-model-tiers.md`).
|
|
581
581
|
* An agent source names its tier on a line of its own, `<!-- tier: strong|light -->`; no marker
|
|
582
582
|
* is `standard`, the default. `strong` runs on the parent's model, `light` on a cheaper one,
|
|
583
|
-
* and what each tier means on a host is that host's emit (
|
|
583
|
+
* and what each tier means on a host is that host's emit (`tierModel`, with the per-host defaults in `TIER_DEFAULTS`).
|
|
584
584
|
*
|
|
585
585
|
* THE LINE IS STRIPPED FROM EVERY OUTPUT, WHOLE (`splitTier`): it sits directly above
|
|
586
586
|
* `## When to dispatch`, so removing the line leaves the text a build rendered before the marker
|
package/js/build/stubs.mjs
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* Every stub is a literal here and an `ensure*` beside it, and the pairing is the contract:
|
|
6
6
|
* the writer checks first and returns without writing when the file exists, because these are
|
|
7
7
|
* the USER's files from the moment they exist. One exception: an emit also calls
|
|
8
|
-
* `migrateMemoryIndex` on the memory store,
|
|
9
|
-
* `topics/` files) into the two-level index once, losslessly,
|
|
10
|
-
* the session-start budget.
|
|
8
|
+
* `migrateMemoryIndex` on the memory store (an install's, and the machine tier's since D1), which
|
|
9
|
+
* rewrites a FLAT MEMORY.md (and its `topics/` files) into the two-level index once, losslessly,
|
|
10
|
+
* because a flat index overruns the session-start budget. On the tier it first drafts the standing
|
|
11
|
+
* rules that index loaded (D31, `ensureTierMemory`). Fact files are never touched. A stub body is bytes a recorded
|
|
11
12
|
* corpus compares — changing one is a product change, not a tidy-up.
|
|
12
13
|
*/
|
|
13
14
|
import path from 'node:path';
|
|
@@ -16,7 +17,8 @@ import { isDir } from '../lib/fs.mjs';
|
|
|
16
17
|
import { jsonDumpsIndent } from '../lib/json.mjs';
|
|
17
18
|
import { NOTES_DIRS, WIKI_NAMES, renderedSharedRoot, sharedPaths } from '../lib/machine-dir.mjs';
|
|
18
19
|
import { EXCLUDES_FILE, isCanonical } from '../hosts/hosts.mjs';
|
|
19
|
-
import {
|
|
20
|
+
import { recordOwnWrites } from '../hosts/store-watch.mjs';
|
|
21
|
+
import { MEMORY_SEED, alwaysOnCandidates, draftAlwaysOn, holdsFlatFacts, migrateMemoryIndex } from '../hosts/memory-files.mjs';
|
|
20
22
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
21
23
|
|
|
22
24
|
// ---------------------------------------------------------------------------
|
|
@@ -325,7 +327,7 @@ export function ensureSharedTier() {
|
|
|
325
327
|
const tier = sharedPaths();
|
|
326
328
|
mkdirSync(tier.memory, { recursive: true });
|
|
327
329
|
for (const sub of NOTES_DIRS) mkdirSync(path.join(tier.notes, sub), { recursive: true });
|
|
328
|
-
|
|
330
|
+
ensureTierMemory(tier);
|
|
329
331
|
ensureRulesStub(tier.root);
|
|
330
332
|
ensureProfileStub(tier.root);
|
|
331
333
|
ensureWikiStub(tier.root);
|
|
@@ -338,6 +340,31 @@ export function ensureSharedTier() {
|
|
|
338
340
|
}
|
|
339
341
|
}
|
|
340
342
|
|
|
343
|
+
/**
|
|
344
|
+
* The tier's memory store, brought to the shape an install store gets (D1): the seed, then a flat
|
|
345
|
+
* index moved to the topic map. The tier's was only seeded, so a hand-written flat index stayed flat
|
|
346
|
+
* and overran the session budget (F17). The standing rules a flat index loaded at every session are
|
|
347
|
+
* drafted FIRST (D31): the migration erases the index they were found in, and a draft written twice
|
|
348
|
+
* is a no-op, so a stop between the two steps is finished by the next emit. A failure here is
|
|
349
|
+
* a warning and never the tier's: the files stay as they are, and the next emit retries. The writes
|
|
350
|
+
* are logged as Geneseed's own, as the fold's are, so an open session's change report does not name
|
|
351
|
+
* the index and the draft this emit rewrote as changes nobody approved.
|
|
352
|
+
*/
|
|
353
|
+
function ensureTierMemory(tier) {
|
|
354
|
+
try {
|
|
355
|
+
// Logged only when there is something to migrate: a seed or a topic map writes nothing, and a
|
|
356
|
+
// log entry for a no-op would make a second emit differ from the first.
|
|
357
|
+
const migrate = () => {
|
|
358
|
+
draftAlwaysOn(tier, alwaysOnCandidates(tier.memory));
|
|
359
|
+
ensureMemoryStore(tier.memory);
|
|
360
|
+
};
|
|
361
|
+
if (holdsFlatFacts(tier.memory)) recordOwnWrites(tier.root, migrate); else migrate();
|
|
362
|
+
} catch (e) {
|
|
363
|
+
process.stderr.write(`[geneseed] WARN could not migrate the shared memory index: ${e.message}; `
|
|
364
|
+
+ 'the next emit retries\n');
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
341
368
|
/**
|
|
342
369
|
* The root a global emit renders. Rendering and creating are two decisions: every global emit
|
|
343
370
|
* renders the same path, and only a canonical one creates the tier. null, so relative paths, only
|
|
@@ -367,6 +394,16 @@ export const ensureMemoryIndex = storeIndexWriter('MEMORY.md', MEMORY_INDEX);
|
|
|
367
394
|
/** `_build_render.ensure_notebook_index`. */
|
|
368
395
|
export const ensureNotebookIndex = storeIndexWriter('NOTEBOOK.md', NOTEBOOK_INDEX);
|
|
369
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Seed the memory index, then move a flat one to topics — the pair every emit runs on its memory
|
|
399
|
+
* store, in that order, on an install's and on the tier's alike. Here, beside the seed it calls:
|
|
400
|
+
* `bundle.mjs` re-exports it for the emitters, and `memory-files.mjs` cannot import this file.
|
|
401
|
+
*/
|
|
402
|
+
export function ensureMemoryStore(memDir) {
|
|
403
|
+
ensureMemoryIndex(memDir);
|
|
404
|
+
migrateMemoryIndex(memDir);
|
|
405
|
+
}
|
|
406
|
+
|
|
370
407
|
/**
|
|
371
408
|
* The seeds of the files the session-start injection reads (`SESSION_FILES` in
|
|
372
409
|
* `js/hosts/hooks.mjs`, and its twin in the OpenCode context plugin). Both carry the SHA-256
|
package/js/cli-table.json
CHANGED
|
@@ -256,7 +256,7 @@
|
|
|
256
256
|
],
|
|
257
257
|
"dest": "tiers",
|
|
258
258
|
"metavar": null,
|
|
259
|
-
"help": "route sub-agents to a cheaper model by tier: auto|off (default: off). With auto, a Claude Code install writes model: sonnet for standard agents and model: haiku for light ones (read-only seats); strong agents inherit your session model. A per-agent pin in agent-overrides.json wins, and its tiers map renames the two models.
|
|
259
|
+
"help": "route sub-agents to a cheaper model by tier: auto|off (default: off). With auto, a Claude Code install writes model: sonnet for standard agents and model: haiku for light ones (read-only seats); strong agents inherit your session model. A per-agent pin in agent-overrides.json wins, and its tiers map renames the two models. OpenCode and OpenClaude route too, but only the tiers the map names a model for (no default); Bob records it and writes nothing",
|
|
260
260
|
"choices": null,
|
|
261
261
|
"default": null,
|
|
262
262
|
"required": false,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from './hosts.mjs';
|
|
17
17
|
import { isFile, isDir, sortPaths, listDir } from './hooks-prims.mjs';
|
|
18
18
|
import { gitRootOf } from './gitref.mjs';
|
|
19
|
+
import { frontmatter } from './memory-files.mjs';
|
|
19
20
|
import { doneLine } from './done-checks.mjs';
|
|
20
21
|
import { ownershipLine } from './ownership-gate.mjs';
|
|
21
22
|
|
|
@@ -178,26 +179,77 @@ export { SESSION_FILES, SEED_SHA256 };
|
|
|
178
179
|
|
|
179
180
|
// A topic line of the memory map (`js/hosts/memory-files.mjs` writes it) and its fact count.
|
|
180
181
|
const MAP_COUNT_RE = /^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
+ 'to dispatch the memory-curator agent to merge, re-topic and archive this store.';
|
|
185
|
-
export { CURATE_TOPIC_MAX, CURATE_NUDGE };
|
|
182
|
+
const CURATE_NUDGE = '[memory] Facts sit in misc: offer the user to dispatch the memory-curator agent '
|
|
183
|
+
+ 'to re-topic and archive them.';
|
|
184
|
+
export { CURATE_NUDGE };
|
|
186
185
|
|
|
187
186
|
/**
|
|
188
187
|
* The one-line curation nudge for a memory map, or ''. Read off the map's own counts, so it
|
|
189
|
-
* costs no extra file read on the hook path.
|
|
190
|
-
*
|
|
188
|
+
* costs no extra file read on the hook path. The one trigger is a fact filed under `misc`, which a
|
|
189
|
+
* curation pass clears. The size of a topic no longer fires it (D23): a migrated store files by
|
|
190
|
+
* `type`, so a 500-fact store holds topics of about 125 facts on its first day, and a user who did
|
|
191
|
+
* nothing would be nagged at once; search is the way into a large topic. A store document is never
|
|
192
|
+
* `misc` (`isReservedStem`), so `ARCHIVE-INDEX.md` cannot raise it either.
|
|
191
193
|
* The OpenCode context plugin carries the same rule (parity gated in tests/unit/claude.test.mjs).
|
|
192
194
|
*/
|
|
193
195
|
export function memoryNudge(map) {
|
|
194
196
|
for (const line of map.split('\n')) {
|
|
195
197
|
const m = MAP_COUNT_RE.exec(line.trim());
|
|
196
|
-
if (m &&
|
|
198
|
+
if (m && m[1] === 'misc') return CURATE_NUDGE;
|
|
197
199
|
}
|
|
198
200
|
return '';
|
|
199
201
|
}
|
|
200
202
|
|
|
203
|
+
// The bridge slot (D31): the facts a migration drafted as standing rules keep loading, in this much
|
|
204
|
+
// room, until their draft is decided (an entry of its own after user-rules.md: see BRIDGE_REL).
|
|
205
|
+
// 1 800 is about the 3 072 characters memory used to get, less what the map now takes; a fact is cut
|
|
206
|
+
// at BRIDGE_FACT_MAX and the rest are counted.
|
|
207
|
+
// The OpenCode context plugin carries the same constants (parity gated in tests/unit/claude.test.mjs).
|
|
208
|
+
const BRIDGE_CAP = 1800;
|
|
209
|
+
const BRIDGE_FACT_MAX = 300;
|
|
210
|
+
const BRIDGE_HEAD = '[memory] Standing rules from your old index, drafted in user-rules.draft.md and '
|
|
211
|
+
+ 'loaded until you decide them:';
|
|
212
|
+
// A slug is a file name the ledger holds: data, so no path may ride in it.
|
|
213
|
+
const BRIDGE_SLUG_RE = /^[^/\\.\u0000-\u001f][^/\\\u0000-\u001f]*$/;
|
|
214
|
+
|
|
215
|
+
// THE SLOT IS ITS OWN SESSION ENTRY, right after `user-rules.md`, and `renderPayload` budgets it as a
|
|
216
|
+
// rule. As a tail of the memory map it was the first thing the budget cut, or went whole with the map
|
|
217
|
+
// when the rules, profile and wiki left the 4th file no room: an undecided standing rule would then
|
|
218
|
+
// stop loading silently, which is what the bridge exists to prevent. As a rule it answers only to the
|
|
219
|
+
// rules' own size, so the profile and the wiki cannot push it out. Its rel names the draft it comes
|
|
220
|
+
// from; `rel === 'user-rules.md'` consumers (a sub-agent's rules, the console) do not see it.
|
|
221
|
+
export const BRIDGE_REL = 'user-rules.draft.md';
|
|
222
|
+
function bridgeAbs() {
|
|
223
|
+
try { return sharedPaths().draft; } catch { return BRIDGE_REL; }
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The slot's text for the tier's pending memory drafts, or ''. A draft the user has decided is not
|
|
228
|
+
* `pending` in the ledger, so it leaves on its own. A fact that is gone, or unreadable, is skipped.
|
|
229
|
+
* Both the ledger row and the file are the user's data, and nothing here writes either.
|
|
230
|
+
*/
|
|
231
|
+
export function bridgeSlot() {
|
|
232
|
+
let tier;
|
|
233
|
+
let items;
|
|
234
|
+
try {
|
|
235
|
+
tier = sharedPaths();
|
|
236
|
+
({ items } = JSON.parse(readFileSync(tier.foldState, 'utf8')));
|
|
237
|
+
} catch { return ''; }
|
|
238
|
+
const lines = [];
|
|
239
|
+
for (const row of Object.values(items ?? {})) {
|
|
240
|
+
if (row?.state !== 'pending' || row.host !== 'memory' || typeof row.fact !== 'string'
|
|
241
|
+
|| !BRIDGE_SLUG_RE.test(row.fact)) continue;
|
|
242
|
+
let text;
|
|
243
|
+
try { text = readFileSync(path.join(tier.memory, `${row.fact}.md`), 'utf8').replace(/\r\n/g, '\n'); } catch { continue; }
|
|
244
|
+
const [fm, body] = frontmatter(text);
|
|
245
|
+
const rule = (body.trim() || (fm.get('description') ?? '')).replace(/\s+/g, ' ');
|
|
246
|
+
lines.push(`- ${row.fact}: ${rule.length > BRIDGE_FACT_MAX ? `${rule.slice(0, BRIDGE_FACT_MAX)}…` : rule}`);
|
|
247
|
+
}
|
|
248
|
+
if (!lines.length) return '';
|
|
249
|
+
const tail = (n) => `- … ${n} more drafted rule${n === 1 ? '' : 's'} not shown (read them in memory/)`;
|
|
250
|
+
return [BRIDGE_HEAD, ...fitLines(lines, BRIDGE_CAP - cost(BRIDGE_HEAD), tail)].join('\n');
|
|
251
|
+
}
|
|
252
|
+
|
|
201
253
|
// The one context line for a project that names no runtime; the OpenCode context plugin carries
|
|
202
254
|
// the same text (tests/plugins/context_done.test.mjs holds the two equal).
|
|
203
255
|
const FLOOR_LINE = 'Runtime floor: package.json declares no engines — name the supported runtime before you '
|
|
@@ -451,6 +503,10 @@ export function sessionFiles(hookRoot, host = null, carrier = installCarrier(hoo
|
|
|
451
503
|
found.push(sessionEntry(rel, sharedAbs, shared, 'shared'));
|
|
452
504
|
}
|
|
453
505
|
if (own !== null) found.push(sessionEntry(rel, hostAbs, own, shared === null ? '' : `host: ${host || 'claude'}`));
|
|
506
|
+
if (rel === 'user-rules.md' && tier && rels.includes('memory/MEMORY.md')) {
|
|
507
|
+
const slot = bridgeSlot();
|
|
508
|
+
if (slot) found.push({ rel: BRIDGE_REL, abs: bridgeAbs(), label: 'shared', text: slot });
|
|
509
|
+
}
|
|
454
510
|
}
|
|
455
511
|
return found.filter(Boolean);
|
|
456
512
|
}
|
|
@@ -722,7 +778,7 @@ function renderPayload({ heads, session, eager, lazy, source, root, title = SESS
|
|
|
722
778
|
const left = [];
|
|
723
779
|
for (const s of session) {
|
|
724
780
|
const head = `----- ${s.rel}${s.label ? ` (${s.label})` : ''} -----`;
|
|
725
|
-
const rules = s.rel === 'user-rules.md';
|
|
781
|
+
const rules = s.rel === 'user-rules.md' || s.rel === BRIDGE_REL;
|
|
726
782
|
const room = budget - LAZY_RESERVE - (rules ? rulesSpent : spent) - cost(head) - cost('');
|
|
727
783
|
const where = `${s.abs} on demand`;
|
|
728
784
|
if (room <= 0) {
|