geneseed 6.0.3 → 6.0.4

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 (75) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/DESIGN.md +1 -1
  3. package/SHIPPED.md +1 -1
  4. package/adapters/opencode/plugins/geneseed-context.js +0 -42
  5. package/adapters/opencode/plugins/geneseed-learn.js +13 -4
  6. package/bin/geneseed-hook.mjs +5 -0
  7. package/docs/concepts/hooks.md +6 -6
  8. package/docs/guides/install-scripted.md +1 -1
  9. package/docs/reference/env-context.md +2 -1
  10. package/docs/reference/plugin-activity.md +1 -1
  11. package/docs/reference/profiles.md +1 -0
  12. package/docs/understand/a-day.md +1 -1
  13. package/docs/understand/machine-claude.md +1 -1
  14. package/docs/web-ui.md +2 -2
  15. package/harness.config.json +1 -1
  16. package/js/build/args.mjs +4 -3
  17. package/js/build/driver.mjs +8 -8
  18. package/js/build/emit-claude.mjs +59 -4
  19. package/js/build/generate.mjs +11 -2
  20. package/js/build/profile.mjs +10 -5
  21. package/js/build/render.mjs +3 -1
  22. package/js/build/source.mjs +12 -1
  23. package/js/cli-table.json +37 -0
  24. package/js/hosts/hooks-context.mjs +1 -56
  25. package/js/hosts/hooks-learn.mjs +435 -55
  26. package/js/hosts/installs.mjs +22 -2
  27. package/js/hosts/memory-files.mjs +89 -6
  28. package/js/hosts/native.mjs +23 -1
  29. package/js/hosts/settings.mjs +77 -4
  30. package/js/inspect/diff.mjs +3 -1
  31. package/js/inspect/doctor.mjs +37 -3
  32. package/js/inspect/status.mjs +38 -5
  33. package/js/inspect/validate.mjs +1 -1
  34. package/js/lib/proc.mjs +36 -0
  35. package/js/maintain/profiles.mjs +15 -4
  36. package/js/maintain/setup.mjs +31 -7
  37. package/js/maintain/update.mjs +1 -1
  38. package/js/web/actions.mjs +5 -3
  39. package/js/web/api.mjs +2 -2
  40. package/js/web/profiles-api.mjs +2 -2
  41. package/js/web/state.mjs +13 -2
  42. package/package.json +1 -1
  43. package/src/AGENT.md.tmpl +1 -1
  44. package/src/agents/memory-curator.md +3 -0
  45. package/src/doctrines/process.md +2 -2
  46. package/src/memory/README.md +24 -4
  47. package/src/skills/rule.md +9 -5
  48. package/web/dist/assets/{Activity-IAxWF2wK.js → Activity-BsMFA5Aa.js} +1 -1
  49. package/web/dist/assets/{ActivityDetail-CtC2DLvh.js → ActivityDetail-C66n3oul.js} +1 -1
  50. package/web/dist/assets/{Bonsai-BoKo68Kw.js → Bonsai-BCd-qt7W.js} +1 -1
  51. package/web/dist/assets/{CopyButton-C0VTiqmb.js → CopyButton-Dpl0PFja.js} +1 -1
  52. package/web/dist/assets/{Dashboard-CRGCp2cV.js → Dashboard-CQxdiv7F.js} +2 -2
  53. package/web/dist/assets/{Docs-DwOwzaD6.js → Docs-D0XlXuiA.js} +1 -1
  54. package/web/dist/assets/{Factories-DxHD2T-1.js → Factories-CPVBoWoA.js} +1 -1
  55. package/web/dist/assets/{GreenhouseView-D5VOmhmR.js → GreenhouseView-C_2auUA8.js} +1 -1
  56. package/web/dist/assets/Installs-CXqjmqms.js +3 -0
  57. package/web/dist/assets/{JournalView-gUSGysTm.js → JournalView-S-igd-Nv.js} +1 -1
  58. package/web/dist/assets/{Kits-DYQvykZ0.js → Kits-K6mu91rm.js} +1 -1
  59. package/web/dist/assets/{Laws-UVk0uojS.js → Laws-j5vKNwLT.js} +1 -1
  60. package/web/dist/assets/{LibRows-CwK63kjB.js → LibRows-1yTY0Kwn.js} +1 -1
  61. package/web/dist/assets/{Library-DdzyrwUK.js → Library-BQZnFdWs.js} +1 -1
  62. package/web/dist/assets/{Loops-yHga7xdr.js → Loops-B5DgxpLm.js} +1 -1
  63. package/web/dist/assets/Models-C-4Y4jvx.js +1 -0
  64. package/web/dist/assets/{OperatorHudView-D1lQF-ZY.js → OperatorHudView-_8NBAvkd.js} +1 -1
  65. package/web/dist/assets/Personal-Bf7zHDc6.js +2 -0
  66. package/web/dist/assets/{Settings-Brgec4M0.js → Settings-BTrA6MXv.js} +1 -1
  67. package/web/dist/assets/{Tabs-BHjxciOL.js → Tabs-BDhZImxa.js} +1 -1
  68. package/web/dist/assets/controls-CREglcUF.js +1 -0
  69. package/web/dist/assets/{index-BfyZCNu7.css → index-9iBqq7i2.css} +1 -1
  70. package/web/dist/assets/{index-BILaKHbH.js → index-BiKWWv7Z.js} +3 -3
  71. package/web/dist/index.html +2 -2
  72. package/web/dist/assets/Installs-B5hFSUeN.js +0 -3
  73. package/web/dist/assets/Models-DAgkQ4CE.js +0 -1
  74. package/web/dist/assets/Personal-DjhIfa9v.js +0 -2
  75. package/web/dist/assets/controls-CK7qHA8H.js +0 -1
@@ -11,14 +11,14 @@
11
11
  import { existsSync } from 'node:fs';
12
12
  import path from 'node:path';
13
13
 
14
- import { DEFAULT_CONTEXT_WINDOW, DEFAULT_TIERS, GATE_SWITCHES, PACK_ORDER, loadKits } from './source.mjs';
14
+ import { DEFAULT_CONTEXT_WINDOW, DEFAULT_LEARN, DEFAULT_TIERS, GATE_SWITCHES, PACK_ORDER, loadKits } from './source.mjs';
15
15
  import { migrateSuperpowersKit } from '../maintain/kit-migration.mjs';
16
16
  import { DEFAULT_PRESET } from '../loop/score.mjs';
17
17
  import { CLAUDE_STYLE, GLOBAL_MANIFEST, HOSTS } from '../hosts/hosts.mjs';
18
18
  import {
19
19
  EMIT_FOR, EMIT_HOST_SCOPE, contextWindowOfDir, defaultMode, defaultPosture, defaultTheme, doctrinesForBuild,
20
20
  emitHostScopeOf, excludedRulesOfDir, excludedSkillsOfDir, footprintOfDir, kitAwareOfDir, kitsOfDir, sharedTierOfDir,
21
- gatesOfDir, installState, modeOfDir, postureOfDir, readMaybe, themeOfDir, tiersOfDir, trustOfDir,
21
+ gatesOfDir, installState, learnOfDir, modeOfDir, postureOfDir, readMaybe, themeOfDir, tiersOfDir, trustOfDir,
22
22
  } from '../hosts/installs.mjs';
23
23
 
24
24
  /**
@@ -57,7 +57,7 @@ import {
57
57
  export function setupBuildArgs(theme, emit, out = null, root = null, footprint = 'lean',
58
58
  posture = 'peer', mode = 'direct', doctrines = null, allPacks = PACK_ORDER,
59
59
  excludeRules = null, trust = DEFAULT_PRESET, excludeSkills = null, gates = {}, kits = null, sharedTier = false,
60
- contextWindow = DEFAULT_CONTEXT_WINDOW, tiers = DEFAULT_TIERS) {
60
+ contextWindow = DEFAULT_CONTEXT_WINDOW, tiers = DEFAULT_TIERS, learn = DEFAULT_LEARN) {
61
61
  const argv = ['--theme', theme, '--emit', emit];
62
62
  if (!emit.endsWith('-global')) {
63
63
  if (out) argv.push('--out', out);
@@ -101,6 +101,8 @@ export function setupBuildArgs(theme, emit, out = null, root = null, footprint =
101
101
  // The tier routing elides at its default, like the context window: only `auto` speaks, last, so
102
102
  // every argv with the routing off stays the bytes it was before the flag existed.
103
103
  if (tiers && tiers !== DEFAULT_TIERS) argv.push('--tiers', tiers);
104
+ // The learn model elides at its default (`light`) the same way: only a non-default value speaks, after the tiers.
105
+ if (learn && learn !== DEFAULT_LEARN) argv.push('--learn', learn);
104
106
  return argv;
105
107
  }
106
108
 
@@ -163,9 +165,11 @@ export function installProfile(host, scope, root, notify = null) {
163
165
  const contextWindow = contextWindowOfDir(root, host);
164
166
  // `Model tiers: auto` stays auto: a rebuild that forgot it would put every agent back on the parent's model.
165
167
  const tiers = tiersOfDir(root, host);
168
+ // `Learn model: off` stays off: a rebuild that forgot it would turn learning back on at the default.
169
+ const learn = learnOfDir(root, host);
166
170
  const out = scope === 'global' ? null : root;
167
171
  const argv = setupBuildArgs(theme, emit, out, out, footprint, posture, mode, doctrines,
168
- PACK_ORDER, excludeRules, trust, excludeSkills, gates, kits, sharedTier, contextWindow, tiers);
172
+ PACK_ORDER, excludeRules, trust, excludeSkills, gates, kits, sharedTier, contextWindow, tiers, learn);
169
173
  // A GLOBAL ROW NAMES ITS OWN DIR. `root` came from the host's config-dir resolver, which
170
174
  // honours env overrides (`OPENCODE_CONFIG_DIR`, `CLAUDE_CONFIG_DIR`…); without the flag the
171
175
  // same argv run from a shell lacking that variable re-emits into the DEFAULT dir — a second
@@ -174,7 +178,7 @@ export function installProfile(host, scope, root, notify = null) {
174
178
  return {
175
179
  host, scope, root, state: installState(root, host, scope),
176
180
  emit, theme, footprint, posture, mode, trust, doctrines, excludeRules, excludeSkills,
177
- kits, sharedTier, contextWindow, tiers, ...gates, argv,
181
+ kits, sharedTier, contextWindow, tiers, learn, ...gates, argv,
178
182
  };
179
183
  }
180
184
 
@@ -220,6 +224,7 @@ const GUARDED = [
220
224
  { name: 'context-window', given: 'contextWindow', flag: '--context-window',
221
225
  now: (a) => a.contextWindow ?? DEFAULT_CONTEXT_WINDOW, was: (p) => p.contextWindow },
222
226
  { name: 'tiers', given: 'tiers', flag: '--tiers', now: (a) => a.tiers ?? DEFAULT_TIERS, was: (p) => p.tiers },
227
+ { name: 'learn', given: 'learn', flag: '--learn', now: (a) => a.learn ?? DEFAULT_LEARN, was: (p) => p.learn },
223
228
  // A switch reads as its flag says. `--no-deletion-gate` given is `deletion-gate: off`;
224
229
  // `--strict-consent` (the one switch whose flag adds asks, so it is not `--no-*`) given is
225
230
  // `strict-consent: on`. Either way the flag given means the switch's key is `false`.
@@ -37,7 +37,7 @@ import { normcase, comparePaths } from '../lib/paths.mjs';
37
37
  import {
38
38
  CREDIT_RE, GATE_SWITCHES, PACK_ORDER, WORKFLOW_PROVIDER_HEADING, kitMembers, linkTargetOf, loadKits, readPackText, resolveCredits, resolveRuleIds, ruleCanon, titleKey, upstreamOf,
39
39
  } from './source.mjs';
40
- import { CONTEXT_WINDOW_MARKER, DEFAULT_CONTEXT_WINDOW, DEFAULT_TIERS, TIERS_MARKER, splitTier } from './source.mjs';
40
+ import { CONTEXT_WINDOW_MARKER, DEFAULT_CONTEXT_WINDOW, DEFAULT_LEARN, DEFAULT_TIERS, LEARN_MARKER, TIERS_MARKER, splitTier } from './source.mjs';
41
41
  import { SHARED_TIER_LINE } from '../hosts/hosts.mjs';
42
42
  import { PROJECT_NOTES_DIR } from '../hosts/spec-feedback.mjs';
43
43
  import { PORTABLE_MACHINE_DIR } from '../lib/machine-dir.mjs';
@@ -774,6 +774,8 @@ export function effectiveTheme(cfg, themeName, {
774
774
  ? `\n${CONTEXT_WINDOW_MARKER}: ${cfg.contextWindow}\n` : '';
775
775
  // `--tiers`, under the same contract (`tiersOfDir` reads it): a line only off the default.
776
776
  theme.TIERS_LINE = cfg.tiers && cfg.tiers !== DEFAULT_TIERS ? `\n${TIERS_MARKER}: ${cfg.tiers}\n` : '';
777
+ // `--learn`, under the same contract (`learnOfDir` reads it): a line only off the default (`light`).
778
+ theme.LEARN_LINE = cfg.learn && cfg.learn !== DEFAULT_LEARN ? `\n${LEARN_MARKER}: ${cfg.learn}\n` : '';
777
779
  // The gate switches (`GATE_SWITCHES`: Laws I, III, IV), under the same contract: a line is
778
780
  // written only when its gate is OFF, so a default build stays byte-identical and a missing
779
781
  // line reads back as armed (`gatesOfDir`). The OpenCode plugins read these lines at load, so
@@ -594,6 +594,15 @@ export const TIERS_CHOICES = Object.freeze(['auto', 'off']);
594
594
  export const DEFAULT_TIERS = 'off';
595
595
  /** The carrier marker, written only when the value is not the default (the kits line's contract). */
596
596
  export const TIERS_MARKER = 'Model tiers';
597
+ /**
598
+ * `--learn off|light|standard|session`: the model memory learning distils with (spec
599
+ * `2026-11-18-learn-model-row.md`, D1-D3, D11). `light`/`standard` name a sub-agent tier and resolve
600
+ * through `tierModel` (`learnModel`); `session` is the chat's own model; `off` distils nothing.
601
+ * The default is `light` (D2), so the marker line is written only off it, like the tiers line.
602
+ */
603
+ export const LEARN_CHOICES = Object.freeze(['off', 'light', 'standard', 'session']);
604
+ export const DEFAULT_LEARN = 'light';
605
+ export const LEARN_MARKER = 'Learn model';
597
606
  /** `{ text, tier }`: the spec without its tier line, and the tier it named (`standard` when none). */
598
607
  export function splitTier(text) {
599
608
  const m = TIER_MARKER_RE.exec(text);
@@ -768,7 +777,7 @@ export const CONTEXT_WINDOW_MARKER = 'Context window';
768
777
  export function makeCfg({
769
778
  posture = 'peer', mode = 'direct', trust = DEFAULT_PRESET, doctrines = PACK_ORDER,
770
779
  excludeRules = [], excludeSkills = [], kits = [], sharedTier = /** @type {boolean | string} */ (false),
771
- contextWindow = DEFAULT_CONTEXT_WINDOW, tiers = DEFAULT_TIERS, pruneGates = false, force = false, ...switches
780
+ contextWindow = DEFAULT_CONTEXT_WINDOW, tiers = DEFAULT_TIERS, learn = DEFAULT_LEARN, pruneGates = false, force = false, ...switches
772
781
  } = {}) {
773
782
  return {
774
783
  root: ROOT,
@@ -804,6 +813,8 @@ export function makeCfg({
804
813
  contextWindow: Object.hasOwn(CONTEXT_WINDOWS, contextWindow) ? contextWindow : DEFAULT_CONTEXT_WINDOW,
805
814
  // `--tiers auto|off`: only a literal `auto` turns the tier routing on; anything else is off.
806
815
  tiers: tiers === 'auto' ? 'auto' : DEFAULT_TIERS,
816
+ // `--learn off|light|standard|session`: anything unknown is the default.
817
+ learn: LEARN_CHOICES.includes(learn) ? learn : DEFAULT_LEARN,
807
818
  // `--force`, for this one build: only a literal `true` forces. Never an axis of the install.
808
819
  force: force === true,
809
820
  // The gate switches (`GATE_SWITCHES`: `secretsGate`, `doneGate`, `deletionGate`), each armed
package/js/cli-table.json CHANGED
@@ -265,6 +265,21 @@
265
265
  "type": null,
266
266
  "hidden": false
267
267
  },
268
+ {
269
+ "names": [
270
+ "--learn"
271
+ ],
272
+ "dest": "learn",
273
+ "metavar": null,
274
+ "help": "the model memory learning distils with: off|light|standard|session (default: light). light and standard use the sub-agent tier of that name (a Claude Code install: haiku or sonnet; elsewhere only a model the tiers map names, else the session model); session uses the chat's own model; off distils nothing. Recorded per install and kept by rebuild-all; it takes effect on hosts in later changes",
275
+ "choices": null,
276
+ "default": null,
277
+ "required": false,
278
+ "nargs": null,
279
+ "is_flag": false,
280
+ "type": null,
281
+ "hidden": false
282
+ },
268
283
  {
269
284
  "names": [
270
285
  "--out"
@@ -1218,6 +1233,28 @@
1218
1233
  ],
1219
1234
  "mutex": []
1220
1235
  },
1236
+ {
1237
+ "name": "learn-worker",
1238
+ "help": "the detached distil: run the job file a PreCompact/SessionEnd `learn` hook wrote (<machine dir>/cache/learn-jobs/job-*.json, nowhere else), with the model command from this process's own $GENESEED_LLM and a store of the machine tier or an install, then delete it. Started by `learn`, never wired in settings; prints nothing and always exits 0",
1239
+ "description": "",
1240
+ "positionals": [
1241
+ {
1242
+ "names": [],
1243
+ "dest": "file",
1244
+ "metavar": null,
1245
+ "help": "the job file `learn` wrote",
1246
+ "choices": null,
1247
+ "default": null,
1248
+ "required": false,
1249
+ "nargs": "?",
1250
+ "is_flag": false,
1251
+ "type": null,
1252
+ "hidden": false
1253
+ }
1254
+ ],
1255
+ "options": [],
1256
+ "mutex": []
1257
+ },
1221
1258
  {
1222
1259
  "name": "link",
1223
1260
  "help": "put `geneseed` on PATH so it runs from any directory",
@@ -16,7 +16,6 @@ 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';
20
19
  import { doneLine } from './done-checks.mjs';
21
20
  import { ownershipLine } from './ownership-gate.mjs';
22
21
 
@@ -200,56 +199,6 @@ export function memoryNudge(map) {
200
199
  return '';
201
200
  }
202
201
 
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
-
253
202
  // The one context line for a project that names no runtime; the OpenCode context plugin carries
254
203
  // the same text (tests/plugins/context_done.test.mjs holds the two equal).
255
204
  const FLOOR_LINE = 'Runtime floor: package.json declares no engines — name the supported runtime before you '
@@ -503,10 +452,6 @@ export function sessionFiles(hookRoot, host = null, carrier = installCarrier(hoo
503
452
  found.push(sessionEntry(rel, sharedAbs, shared, 'shared'));
504
453
  }
505
454
  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
- }
510
455
  }
511
456
  return found.filter(Boolean);
512
457
  }
@@ -778,7 +723,7 @@ function renderPayload({ heads, session, eager, lazy, source, root, title = SESS
778
723
  const left = [];
779
724
  for (const s of session) {
780
725
  const head = `----- ${s.rel}${s.label ? ` (${s.label})` : ''} -----`;
781
- const rules = s.rel === 'user-rules.md' || s.rel === BRIDGE_REL;
726
+ const rules = s.rel === 'user-rules.md';
782
727
  const room = budget - LAZY_RESERVE - (rules ? rulesSpent : spent) - cost(head) - cost('');
783
728
  const where = `${s.abs} on demand`;
784
729
  if (room <= 0) {