geneseed 4.32.0 → 5.0.1
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 +101 -0
- package/DESIGN.md +2 -2
- package/README.md +6 -5
- package/SHIPPED.md +4 -3
- package/adapters/bob/README.md +6 -5
- package/adapters/claude-code/README.md +4 -3
- package/adapters/claude-code/skills/geneseed/SKILL.md +1 -1
- package/adapters/openclaude/README.md +4 -3
- package/adapters/opencode/GLOBAL-HARNESS-SPEC.md +3 -1
- package/adapters/opencode/HOW-OPENCODE-LOADS.md +2 -1
- package/adapters/opencode/README.md +18 -18
- package/adapters/opencode/plugins/geneseed-activity.js +57 -1
- package/adapters/opencode/plugins/geneseed-context.js +85 -18
- package/adapters/opencode/plugins/geneseed-guard.js +437 -76
- package/adapters/opencode/plugins/geneseed-learn.js +97 -23
- package/bin/geneseed-cli.mjs +17 -25
- package/bin/geneseed-hook.mjs +23 -8
- package/docs/DESIGN.md +175 -0
- package/docs/PRD.md +111 -0
- package/docs/README.md +3 -2
- package/docs/architecture.md +145 -0
- package/docs/concepts/agents.md +1 -1
- package/docs/concepts/collaboration.md +1 -1
- package/docs/concepts/enforcement-table.md +1 -1
- package/docs/concepts/exclusions.md +5 -5
- package/docs/concepts/footprint.md +1 -1
- package/docs/concepts/foreman-mode.md +2 -2
- package/docs/concepts/hooks.md +22 -8
- package/docs/concepts/host-matrix.md +2 -2
- package/docs/concepts/hosts.md +1 -1
- package/docs/concepts/kits.md +3 -1
- package/docs/concepts/ownership.md +1 -1
- package/docs/concepts/rules.md +15 -2
- package/docs/concepts/shared-tier.md +73 -0
- package/docs/concepts/skills.md +2 -2
- package/docs/concepts/themes.md +1 -1
- package/docs/extending.md +13 -12
- package/docs/guides/install-claude-code.md +1 -1
- package/docs/guides/install-opencode.md +1 -1
- package/docs/guides/migrate.md +8 -4
- package/docs/guides/project-context.md +2 -2
- package/docs/guides/setup-footprint.md +1 -1
- package/docs/guides/uninstall.md +2 -1
- package/docs/guides/upgrade-to-5.md +118 -0
- package/docs/guides/upgrade.md +21 -9
- package/docs/guides/wiki.md +3 -3
- package/docs/reference/env-context.md +5 -3
- package/docs/reference/environment.md +1 -1
- package/docs/reference/glossary.md +2 -0
- package/docs/reference/opencode-plugins.md +3 -3
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/plugin-context.md +1 -0
- package/docs/reference/plugin-guard.md +14 -6
- package/docs/reference/plugin-learn.md +13 -6
- package/docs/reference/troubleshoot-hooks.md +3 -3
- package/docs/reference/troubleshoot-update.md +14 -0
- package/docs/token-footprint.md +4 -3
- package/docs/understand/a-day.md +2 -2
- package/docs/understand/design-choices-install.md +2 -1
- package/docs/understand/enforced-vs-asked.md +1 -1
- package/docs/understand/machine-bob.md +2 -0
- package/docs/understand/machine-claude.md +7 -5
- package/docs/understand/machine-opencode.md +7 -5
- package/docs/understand/on-your-machine.md +4 -0
- package/docs/understand/take-it-out.md +1 -1
- package/docs/web-ui.md +135 -70
- package/harness.config.json +1 -1
- package/js/README.md +12 -7
- package/js/build/args.mjs +10 -8
- package/js/build/bundle.mjs +11 -13
- package/js/build/driver.mjs +66 -65
- package/js/build/emit-claude.mjs +22 -16
- package/js/build/emit-common.mjs +4 -5
- package/js/build/emit-opencode.mjs +22 -22
- package/js/build/fold.mjs +515 -0
- package/js/build/generate.mjs +41 -52
- package/js/build/render.mjs +115 -29
- package/js/build/rule-decide.mjs +273 -0
- package/js/build/source.mjs +4 -1
- package/js/build/stubs.mjs +70 -9
- package/js/build/version.mjs +10 -10
- package/js/cli-table.json +23 -83
- package/js/hosts/activity.mjs +2 -2
- package/js/hosts/geneseed-dir.mjs +1 -1
- package/js/hosts/hooks-context.mjs +389 -99
- package/js/hosts/hooks-learn.mjs +38 -7
- package/js/hosts/hooks-prims.mjs +4 -2
- package/js/hosts/hooks.mjs +114 -39
- package/js/hosts/hosts.mjs +150 -51
- package/js/hosts/installs.mjs +59 -171
- package/js/hosts/link.mjs +3 -5
- package/js/hosts/mcp.mjs +1 -1
- package/js/hosts/memory-files.mjs +219 -17
- package/js/hosts/ownership-gate.mjs +1 -1
- package/js/hosts/settings.mjs +18 -13
- package/js/hosts/shim.mjs +4 -33
- package/js/hosts/store-watch.mjs +191 -0
- package/js/inspect/checks-authoring.mjs +3 -3
- package/js/inspect/checks-build.mjs +45 -18
- package/js/inspect/checks-counts.mjs +4 -4
- package/js/inspect/checks-repo.mjs +13 -14
- package/js/inspect/cost.mjs +24 -2
- package/js/inspect/diff.mjs +123 -123
- package/js/inspect/doctor.mjs +22 -27
- package/js/inspect/excludes.mjs +181 -62
- package/js/inspect/inventory.mjs +22 -27
- package/js/inspect/registry.mjs +110 -32
- package/js/inspect/scan.mjs +5 -5
- package/js/inspect/status.mjs +141 -119
- package/js/inspect/validate.mjs +22 -24
- package/js/lib/fs.mjs +47 -50
- package/js/lib/json.mjs +10 -17
- package/js/lib/machine-dir.mjs +73 -0
- package/js/lib/paths.mjs +35 -33
- package/js/lib/proc.mjs +1 -1
- package/js/lib/prompt.mjs +19 -27
- package/js/lib/text.mjs +8 -12
- package/js/lib/udiff.mjs +11 -15
- package/js/loop/catalog.mjs +2 -3
- package/js/maintain/memory.mjs +17 -17
- package/js/maintain/migrate.mjs +120 -92
- package/js/maintain/setup.mjs +43 -32
- package/js/maintain/uninstall.mjs +43 -61
- package/js/maintain/update.mjs +200 -93
- package/js/ui/anim.mjs +21 -35
- package/js/ui/cli.mjs +36 -58
- package/js/ui/menu.mjs +22 -45
- package/js/ui/tui.mjs +27 -67
- package/js/web/actions.mjs +34 -34
- package/js/web/api.mjs +142 -79
- package/js/web/catalog.mjs +175 -46
- package/js/web/docs.mjs +33 -12
- package/js/web/doctor-worker.mjs +14 -0
- package/js/web/handler.mjs +16 -5
- package/js/web/routes.mjs +24 -22
- package/js/web/state.mjs +78 -19
- package/js/web/update-check.mjs +27 -12
- package/js/web/user-files.mjs +76 -104
- package/package.json +7 -4
- package/registry.json +48 -55
- package/src/AGENT.md.tmpl +13 -14
- package/src/agents/_self-improvement.md +1 -1
- package/src/agents/_template.md +1 -1
- package/src/agents/advocate.md +1 -1
- package/src/agents/architect.md +1 -1
- package/src/agents/developer.md +1 -1
- package/src/agents/devops-engineer.md +1 -1
- package/src/agents/docker-expert.md +1 -1
- package/src/agents/docs.md +1 -1
- package/src/agents/empiricist.md +1 -1
- package/src/agents/explorer.md +1 -1
- package/src/agents/framer.md +1 -1
- package/src/agents/historian.md +1 -1
- package/src/agents/kubernetes-specialist.md +1 -1
- package/src/agents/memory-curator.md +2 -2
- package/src/agents/operator.md +1 -1
- package/src/agents/performance.md +1 -1
- package/src/agents/pragmatist.md +1 -1
- package/src/agents/react-engineer.md +1 -1
- package/src/agents/react-reviewer.md +1 -1
- package/src/agents/researcher.md +1 -1
- package/src/agents/reviewer.md +1 -1
- package/src/agents/security.md +1 -1
- package/src/agents/skeptic.md +1 -1
- package/src/agents/spring-boot-engineer.md +1 -1
- package/src/agents/spring-reviewer.md +1 -1
- package/src/agents/spring-security.md +1 -1
- package/src/agents/steward.md +1 -1
- package/src/agents/tester.md +1 -1
- package/src/agents/user-advocate.md +1 -1
- package/src/agents/visionary.md +1 -1
- package/src/memory/README.md +1 -1
- package/src/skills/_self-improvement.md +2 -2
- package/src/skills/daydream/SKILL.md +2 -2
- package/src/skills/daydream/instructions.md +1 -1
- package/src/skills/geneseed.md +1 -1
- package/src/skills/learn-mode.md +1 -2
- package/src/skills/profile.md +2 -2
- package/src/skills/rule/approve.md +75 -0
- package/src/skills/rule/consolidate.md +3 -3
- package/src/skills/rule.md +14 -5
- package/src/skills/skill-forge.md +1 -1
- package/src/skills/teach.md +29 -12
- package/src/skills/wiki.md +1 -1
- package/themes/_TEMPLATE.json +1 -2
- package/themes/biker.json +1 -2
- package/themes/commentator.json +1 -2
- package/themes/cyberpunk.json +1 -2
- package/themes/gamer.json +1 -2
- package/themes/imperial.json +1 -2
- package/themes/joker.json +1 -2
- package/themes/marvin.json +1 -2
- package/themes/mean.json +1 -2
- package/themes/military.json +1 -2
- package/themes/neutral.json +1 -2
- package/themes/pirate.json +1 -2
- package/themes/sports.json +1 -2
- package/themes/verstappen.json +1 -2
- package/themes/wizard.json +1 -2
- package/web/dist/assets/Activity-Ci4PZco3.js +1 -0
- package/web/dist/assets/ActivityDetail-C8hroCND.js +1 -0
- package/web/dist/assets/AgentGlyph-k6o3gCM1.js +1 -0
- package/web/dist/assets/Bonsai-C1iBAt4v.js +1 -0
- package/web/dist/assets/{CopyButton-C5Li6awl.js → CopyButton-DJ3a4N88.js} +1 -1
- package/web/dist/assets/Dashboard-C_On4KXw.js +2 -0
- package/web/dist/assets/Docs-Kffdg5uV.js +5 -0
- package/web/dist/assets/GreenhouseView-k56_cBSF.js +1 -0
- package/web/dist/assets/Installs-DtEKLC9h.js +3 -0
- package/web/dist/assets/JournalView-RQnk5l7I.js +1 -0
- package/web/dist/assets/Kits-CXkEBpnf.js +1 -0
- package/web/dist/assets/Laws-DhhIVqmh.js +3 -0
- package/web/dist/assets/Library-CAUiEoJo.js +3 -0
- package/web/dist/assets/{Loops-CzitjxGV.js → Loops-LKD8mF4E.js} +2 -2
- package/web/dist/assets/{Markdown-C4S4tTA7.js → Markdown-0ORz7tAc.js} +21 -21
- package/web/dist/assets/OperatorHudView-CM5jNPwL.js +1 -0
- package/web/dist/assets/Personal-B6Uoly3C.js +2 -0
- package/web/dist/assets/{RailCats-D5weYPCS.js → RailCats-DQxxYBEP.js} +1 -1
- package/web/dist/assets/Settings-BTe6-wda.js +1 -0
- package/web/dist/assets/Tabs-CbdDWTp_.js +1 -0
- package/web/dist/assets/api-D_r0Jtla.js +1 -0
- package/web/dist/assets/controls-D4wmg_pl.js +1 -0
- package/web/dist/assets/index-HfGmYXab.js +3 -0
- package/web/dist/assets/index-ao3M-Fhm.css +1 -0
- package/web/dist/assets/motion-RlUl1osO.js +1 -0
- package/web/dist/assets/{sections-ChwaobfW.js → sections-CtFz7HFH.js} +1 -1
- package/web/dist/index.html +5 -5
- package/src/skills/quiz.md +0 -44
- package/web/dist/assets/Activity-Bjy64wHC.js +0 -1
- package/web/dist/assets/ActivityDetail-B0AaipP8.js +0 -1
- package/web/dist/assets/Bonsai-CJniRqaH.js +0 -1
- package/web/dist/assets/Dashboard-B-6DTmae.js +0 -2
- package/web/dist/assets/Docs-LRc30XL9.js +0 -5
- package/web/dist/assets/GreenhouseView-CcoYlaWo.js +0 -1
- package/web/dist/assets/Installs-dp1epTcE.js +0 -3
- package/web/dist/assets/JournalView-nFP4poCf.js +0 -1
- package/web/dist/assets/KitApply-DwyZUj57.js +0 -1
- package/web/dist/assets/Kits-C0IEdZXe.js +0 -1
- package/web/dist/assets/Laws-CkykmQWu.js +0 -3
- package/web/dist/assets/Library-Guh9HBZU.js +0 -2
- package/web/dist/assets/OperatorHudView-DLGNulIY.js +0 -1
- package/web/dist/assets/Personal-BMtberL8.js +0 -2
- package/web/dist/assets/Tabs-uYJqfuQt.js +0 -1
- package/web/dist/assets/api-BxjLd7Qd.js +0 -1
- package/web/dist/assets/index-DA7BiaE5.js +0 -3
- package/web/dist/assets/index-dbbDGFDq.css +0 -1
- package/web/dist/assets/motion-Bccx3zE8.js +0 -1
package/js/web/user-files.mjs
CHANGED
|
@@ -10,16 +10,17 @@
|
|
|
10
10
|
import { createHash } from 'node:crypto';
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
|
|
13
|
+
import { RETIRED_RULES_FILE, decideItem, decisionState, draftItems, CHOICE_DECISIONS, RULE_DECISIONS } from '../build/rule-decide.mjs';
|
|
13
14
|
import { PROFILE_STUB } from '../build/stubs.mjs';
|
|
14
15
|
import { readMaybe } from '../hosts/installs.mjs';
|
|
15
|
-
import {
|
|
16
|
+
import { splitLines } from '../hosts/hooks-prims.mjs';
|
|
17
|
+
import { frontmatter, isRuleEdge, parseRules, readFoldState } from '../hosts/memory-files.mjs';
|
|
16
18
|
import { writeText, isFile, isDir } from '../lib/fs.mjs';
|
|
17
19
|
import { formatRepr, isTruthy } from '../lib/json.mjs';
|
|
18
20
|
import { WHITESPACE, codePointLength, stripWhitespace } from '../lib/text.mjs';
|
|
19
|
-
import { splitLines } from '../lib/udiff.mjs';
|
|
20
21
|
import { isFactName } from '../maintain/memory.mjs';
|
|
21
22
|
import { apiMemoryDelete, bget, strOr } from './actions.mjs';
|
|
22
|
-
import { BadRequest, NotFound, memoryDir } from './catalog.mjs';
|
|
23
|
+
import { BadRequest, NotFound, memoryDir, tierOf } from './catalog.mjs';
|
|
23
24
|
|
|
24
25
|
/** Splits on runs of `WHITESPACE` (not `\s`), dropping empty strings. */
|
|
25
26
|
const splitWords = (s) => s.split(new RegExp(`[${WHITESPACE}]+`)).filter(Boolean);
|
|
@@ -59,122 +60,73 @@ const fpMatches = (got, want) => typeof got === 'string' && got === want;
|
|
|
59
60
|
// ---- user rules (user-rules.md) ----------------------------------------------------------
|
|
60
61
|
|
|
61
62
|
export const RULES_FILE = 'user-rules.md';
|
|
62
|
-
|
|
63
|
+
/** The folder of the two hand-written files: the tier for a global install, else the bundle. */
|
|
64
|
+
const userDir = (state, tier = tierOf(state)) => tier?.root ?? state.target;
|
|
65
|
+
const rulesPath = (state, tier) => path.join(userDir(state, tier), RULES_FILE);
|
|
63
66
|
|
|
64
67
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* file, which is where a non-breaking space actually turns up. `\S` is its complement for
|
|
70
|
-
* the same reason.
|
|
71
|
-
*
|
|
72
|
-
* `\d` IS LEFT ASCII, and that is a declared divergence rather than an oversight, unlike
|
|
73
|
-
* `ruleFields` below which uses `\p{Nd}`. No theme seeds a non-ASCII rule id, no build
|
|
74
|
-
* writes one, and the web editor cannot produce one either — it writes `R<n>` itself from
|
|
75
|
-
* `max(ids) + 1`. Widening this to match would only move the gap one line down, to whatever
|
|
76
|
-
* parses the captured digits back into a number.
|
|
77
|
-
*/
|
|
78
|
-
const RULE_HEAD_RE = new RegExp(
|
|
79
|
-
`^##[${WHITESPACE}]+R(\\d+)[${WHITESPACE}]*[—–-]+[${WHITESPACE}]*`
|
|
80
|
-
+ `([^${WHITESPACE}].*?)[${WHITESPACE}]*$`,
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* A line `parseRules` reads as the edge of a rule: `## ` ends the current block, and a
|
|
85
|
-
* `RULE_HEAD_RE` line opens one (a non-breaking space after `##` does the second, not the first).
|
|
86
|
-
* ONE predicate for both the parser and `ruleFields`, so a body the writer accepts can never
|
|
87
|
-
* split or forge a rule when read back.
|
|
68
|
+
* The blocks the fold left in `<tier>/user-rules.draft.md`, in file order (`draftItems`). A block
|
|
69
|
+
* the ledger already holds as decided is left over from a stopped write, so it is not pending; a
|
|
70
|
+
* block with no row, or a ledger that does not parse, still shows. Empty for a project install and
|
|
71
|
+
* for a missing draft. `apiRulesDecide` below decides one.
|
|
88
72
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const at = part.indexOf(':');
|
|
103
|
-
if (at < 0) continue; // `partition` with no separator — not a pair
|
|
104
|
-
const key = stripWhitespace(part.slice(0, at)).toLowerCase().replaceAll(' ', '_');
|
|
105
|
-
if (['scope', 'source', 'trial_until'].includes(key)) {
|
|
106
|
-
meta[key] = stripWhitespace(part.slice(at + 1));
|
|
107
|
-
}
|
|
73
|
+
function ruleDrafts(tier) {
|
|
74
|
+
if (tier === null) return [];
|
|
75
|
+
let ledger = {};
|
|
76
|
+
try { ledger = readFoldState(tier).items; } catch { /* shows all */ }
|
|
77
|
+
const decided = ({ key }) => {
|
|
78
|
+
const row = Object.hasOwn(ledger, key ?? '') ? ledger[key] : null;
|
|
79
|
+
return row != null && row.state !== 'pending';
|
|
80
|
+
};
|
|
81
|
+
// A bad draft is one row on the page, never a failed page: the rules below it still edit.
|
|
82
|
+
try {
|
|
83
|
+
return draftItems(tier).filter((d) => !decided(d));
|
|
84
|
+
} catch (e) {
|
|
85
|
+
return [{ title: 'The draft could not be read', host: null, body: String(e?.message ?? e), decisions: [] }];
|
|
108
86
|
}
|
|
109
|
-
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The fingerprint a decision must send back: `''` where there is no tier, or no draft to read. */
|
|
90
|
+
function draftFingerprint(tier) {
|
|
91
|
+
try { return tier === null ? '' : fingerprint(decisionState(tier)); } catch { return ''; }
|
|
110
92
|
}
|
|
111
93
|
|
|
112
94
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* Every rule carries its `start`/`end` LINE INDICES, which is what lets `apiRulesMutate`
|
|
116
|
-
* splice exactly one block and leave every other byte of the user's file — prose,
|
|
117
|
-
* formatting, hand-written sections — untouched.
|
|
118
|
-
* @returns {[Array<{id: number, start: number, end: number} & Record<string, any>>, string[]]}
|
|
95
|
+
* The estimate of what a text costs in the context, each turn. CODE POINTS, not `String.length`
|
|
96
|
+
* (UTF-16 units): an emoji in a rule body would otherwise put it off.
|
|
119
97
|
*/
|
|
120
|
-
|
|
121
|
-
const lines = splitLines(text);
|
|
122
|
-
const rules = [];
|
|
123
|
-
const warnings = [];
|
|
124
|
-
const seen = new Set();
|
|
125
|
-
for (let idx = 0; idx < lines.length; idx += 1) {
|
|
126
|
-
const m = RULE_HEAD_RE.exec(lines[idx]);
|
|
127
|
-
if (!m) continue;
|
|
128
|
-
let end = lines.length;
|
|
129
|
-
for (let j = idx + 1; j < lines.length; j += 1) {
|
|
130
|
-
if (isRuleEdge(lines[j])) { end = j; break; }
|
|
131
|
-
}
|
|
132
|
-
const rid = Number(m[1]);
|
|
133
|
-
if (seen.has(rid)) warnings.push(`duplicate rule id R${rid}`);
|
|
134
|
-
seen.add(rid);
|
|
135
|
-
let k = idx + 1;
|
|
136
|
-
while (k < end && !stripWhitespace(lines[k])) k += 1;
|
|
137
|
-
const meta = k < end ? parseRuleMeta(lines[k]) : {};
|
|
138
|
-
if (Object.keys(meta).length) k += 1;
|
|
139
|
-
rules.push({
|
|
140
|
-
id: rid,
|
|
141
|
-
title: m[2],
|
|
142
|
-
scope: Object.hasOwn(meta, 'scope') ? meta.scope : 'project',
|
|
143
|
-
source: Object.hasOwn(meta, 'source') ? meta.source : '',
|
|
144
|
-
trial_until: Object.hasOwn(meta, 'trial_until') ? meta.trial_until : '',
|
|
145
|
-
body: stripWhitespace(lines.slice(k, end).join('\n')),
|
|
146
|
-
start: idx,
|
|
147
|
-
end,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
return [rules, warnings];
|
|
151
|
-
}
|
|
98
|
+
const tokensOf = (text) => Math.floor(codePointLength(text) / 4);
|
|
152
99
|
|
|
153
100
|
export function apiRules(state) {
|
|
154
|
-
const
|
|
101
|
+
const tier = tierOf(state);
|
|
102
|
+
const p = rulesPath(state, tier);
|
|
103
|
+
const shared = tier !== null;
|
|
104
|
+
const drafts = ruleDrafts(tier);
|
|
155
105
|
if (!isFile(p)) {
|
|
156
|
-
return { exists: false, path: p, rules: [], warnings: [], fingerprint: '',
|
|
157
|
-
stats: { rules: 0, lines: 0, tokens: 0
|
|
106
|
+
return { exists: false, path: p, rules: [], warnings: [], fingerprint: '', shared, drafts,
|
|
107
|
+
draft_fingerprint: draftFingerprint(tier), stats: { rules: 0, lines: 0, tokens: 0 } };
|
|
158
108
|
}
|
|
159
109
|
const text = readMaybe(p) ?? '';
|
|
160
110
|
const [rules, warnings] = parseRules(text);
|
|
161
111
|
const today = todayIso();
|
|
112
|
+
const lines = splitLines(text);
|
|
162
113
|
const out = rules.map((r) => ({
|
|
163
114
|
id: r.id, title: r.title, scope: r.scope, source: r.source,
|
|
164
115
|
trial_until: r.trial_until,
|
|
165
116
|
status: r.trial_until ? 'trial' : 'active',
|
|
166
117
|
overdue: Boolean(r.trial_until) && r.trial_until < today,
|
|
167
118
|
body: r.body,
|
|
119
|
+
// The rule's whole block, heading and metadata too: that is what the agent reads.
|
|
120
|
+
tokens: tokensOf(stripWhitespace(lines.slice(r.start, r.end).join('\n'))),
|
|
168
121
|
}));
|
|
169
|
-
return { exists: true, path: p, rules: out, warnings, fingerprint: fingerprint(text),
|
|
170
|
-
|
|
171
|
-
//
|
|
172
|
-
stats: { rules: rules.length, lines:
|
|
173
|
-
tokens: Math.floor(codePointLength(text) / 4), ...RULES_BUDGET } };
|
|
122
|
+
return { exists: true, path: p, rules: out, warnings, fingerprint: fingerprint(text), shared, drafts,
|
|
123
|
+
draft_fingerprint: draftFingerprint(tier),
|
|
124
|
+
// The whole file, so it holds its header too: more than the rules' own tokens added up.
|
|
125
|
+
stats: { rules: rules.length, lines: lines.length, tokens: tokensOf(text) } };
|
|
174
126
|
}
|
|
175
127
|
|
|
176
|
-
function rulesRead(state) {
|
|
177
|
-
const p = rulesPath(state);
|
|
128
|
+
function rulesRead(state, tier) {
|
|
129
|
+
const p = rulesPath(state, tier);
|
|
178
130
|
return [p, isFile(p) ? (readMaybe(p) ?? '') : ''];
|
|
179
131
|
}
|
|
180
132
|
|
|
@@ -189,7 +141,7 @@ function ruleBlock(rid, title, scope, source, trialUntil, body) {
|
|
|
189
141
|
* Validate and normalise a rule's writable fields. Throws `BadRequest` (→ the shell's 400,
|
|
190
142
|
* carrying the message) on an unusable rule.
|
|
191
143
|
*
|
|
192
|
-
* `\p{Nd}` here and not `\d`, unlike `RULE_HEAD_RE`
|
|
144
|
+
* `\p{Nd}` here and not `\d`, unlike `RULE_HEAD_RE` in ../hosts/memory-files.mjs: this is a pure predicate over a
|
|
193
145
|
* string that stays a string, so accepting any Unicode decimal digit costs nothing and
|
|
194
146
|
* needs no numeric parse afterward.
|
|
195
147
|
*
|
|
@@ -244,7 +196,6 @@ function ruleId(v) {
|
|
|
244
196
|
* mistake; it exists so a retire never loses the text. Like user-rules.md it is the user's: no
|
|
245
197
|
* install manifest claims it, so no uninstall deletes it.
|
|
246
198
|
*/
|
|
247
|
-
export const RETIRED_RULES_FILE = 'user-rules-retired.md';
|
|
248
199
|
const RETIRED_HEADER = '# Retired rules — not in force, never loaded into any session.\n';
|
|
249
200
|
const isBlank = (line) => !stripWhitespace(line);
|
|
250
201
|
|
|
@@ -263,14 +214,15 @@ export function apiRulesMutate(state, body) {
|
|
|
263
214
|
if (op !== 'add' && op !== 'update' && op !== 'delete') {
|
|
264
215
|
throw new NotFound(`rules op ${formatRepr(op)}`);
|
|
265
216
|
}
|
|
266
|
-
const
|
|
217
|
+
const tier = tierOf(state);
|
|
218
|
+
const [p, original] = rulesRead(state, tier);
|
|
267
219
|
let text = original;
|
|
268
220
|
if (!fpMatches(bget(body, 'fingerprint', ''), fingerprint(text))) {
|
|
269
221
|
return { ok: false, error: 'conflict',
|
|
270
222
|
detail: 'user-rules.md changed since you loaded it — reloading' };
|
|
271
223
|
}
|
|
272
224
|
const [rules] = parseRules(text);
|
|
273
|
-
const retiredPath = path.join(state
|
|
225
|
+
const retiredPath = path.join(userDir(state, tier), RETIRED_RULES_FILE);
|
|
274
226
|
let rid;
|
|
275
227
|
let next;
|
|
276
228
|
if (op === 'add') {
|
|
@@ -311,6 +263,24 @@ export function apiRulesMutate(state, body) {
|
|
|
311
263
|
return { ok: true, op, id: rid, fingerprint: fingerprint(next) };
|
|
312
264
|
}
|
|
313
265
|
|
|
266
|
+
/**
|
|
267
|
+
* One decision on a drafted item (`decideItem`). The fingerprint covers the draft, the shared rules
|
|
268
|
+
* and both files of each `Choose` block, so a click on what the page showed never lands on what an
|
|
269
|
+
* agent session or a fold wrote since: `ok: false`, 409, and the page reloads.
|
|
270
|
+
*/
|
|
271
|
+
export function apiRulesDecide(state, body) {
|
|
272
|
+
const decision = bget(body, 'decision');
|
|
273
|
+
if (![...RULE_DECISIONS, ...CHOICE_DECISIONS].includes(decision)) {
|
|
274
|
+
throw new BadRequest(`unknown decision ${formatRepr(decision)}`);
|
|
275
|
+
}
|
|
276
|
+
const tier = tierOf(state);
|
|
277
|
+
if (tier === null) throw new NotFound('shared tier');
|
|
278
|
+
if (!fpMatches(bget(body, 'fingerprint', ''), draftFingerprint(tier))) {
|
|
279
|
+
return { ok: false, error: 'conflict', detail: 'The draft changed since you loaded it.' };
|
|
280
|
+
}
|
|
281
|
+
return decideItem(tier, strOr(bget(body, 'key')), decision);
|
|
282
|
+
}
|
|
283
|
+
|
|
314
284
|
/**
|
|
315
285
|
* One memory fact promoted into a trial rule. The provenance line and the month of
|
|
316
286
|
* probation are the rule this endpoint owns, and both are DATES read from the real clock —
|
|
@@ -348,19 +318,21 @@ export function apiRulesPromote(state, body) {
|
|
|
348
318
|
|
|
349
319
|
// ---- PROFILE.md --------------------------------------------------------------------------
|
|
350
320
|
|
|
351
|
-
/**
|
|
321
|
+
/** In `userDir`: the tier for a global install, else beside the deployed AGENT.md. */
|
|
352
322
|
export const PROFILE_FILE = 'PROFILE.md';
|
|
353
|
-
const profilePath = (state) => path.join(state
|
|
323
|
+
const profilePath = (state, tier) => path.join(userDir(state, tier), PROFILE_FILE);
|
|
354
324
|
|
|
355
325
|
export function apiProfile(state) {
|
|
356
|
-
const
|
|
357
|
-
|
|
326
|
+
const tier = tierOf(state);
|
|
327
|
+
const p = profilePath(state, tier);
|
|
328
|
+
const shared = tier !== null;
|
|
329
|
+
if (!isFile(p)) return { exists: false, path: p, text: '', fingerprint: '', shared };
|
|
358
330
|
const text = readMaybe(p) ?? '';
|
|
359
331
|
// `seeded`: the file is still the template the build wrote once and never touched since.
|
|
360
332
|
// `readMaybe` normalises line endings, so a CRLF copy (the emit writes the platform's, and
|
|
361
333
|
// an editor may re-save either way) still compares equal to the LF literal.
|
|
362
334
|
const seeded = text === PROFILE_STUB;
|
|
363
|
-
return { exists: true, path: p, text, fingerprint: fingerprint(text), seeded };
|
|
335
|
+
return { exists: true, path: p, text, fingerprint: fingerprint(text), seeded, shared };
|
|
364
336
|
}
|
|
365
337
|
|
|
366
338
|
/** The whole file, fingerprint-guarded like the rules above. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"//": "Every field here is argued and gated in tests/unit/package_manifest.test.mjs. `files`, `bin` and `engines` each have a test that fails when reality drifts from this file; `version` mirrors harness.config.json and is gated too. Read that docblock before editing this one.",
|
|
2
|
+
"//": "Every field here is argued and gated in tests/unit/package_manifest.test.mjs. `files`, `bin`, `exports` and `engines` each have a test that fails when reality drifts from this file; `version` mirrors harness.config.json and is gated too. Read that docblock before editing this one.",
|
|
3
3
|
"name": "geneseed",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.1",
|
|
5
5
|
"description": "A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"ai",
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
"geneseed-hook": "bin/geneseed-hook.mjs",
|
|
32
32
|
"geneseed-build": "bin/build-driver.mjs"
|
|
33
33
|
},
|
|
34
|
+
"exports": {
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
34
37
|
"files": [
|
|
35
38
|
"bin/",
|
|
36
39
|
"js/",
|
|
@@ -65,7 +68,7 @@
|
|
|
65
68
|
"typescript": "^5.9.3"
|
|
66
69
|
},
|
|
67
70
|
"scripts": {
|
|
68
|
-
"lint": "eslint js bin tests adapters fuzz",
|
|
69
|
-
"typecheck": "tsc -p ."
|
|
71
|
+
"lint": "eslint --cache --cache-location node_modules/.cache/eslint/ js bin tests adapters fuzz",
|
|
72
|
+
"typecheck": "tsc -p . --incremental --tsBuildInfoFile node_modules/.cache/tsc/tsbuildinfo"
|
|
70
73
|
}
|
|
71
74
|
}
|
package/registry.json
CHANGED
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"last_verified": ""
|
|
24
24
|
},
|
|
25
25
|
"agents/devops-engineer": {
|
|
26
|
-
"status": "
|
|
26
|
+
"status": "approved",
|
|
27
27
|
"version": "1.0.0",
|
|
28
28
|
"owner": "Guillaume Lemer",
|
|
29
29
|
"added": "2026-10-20",
|
|
30
|
-
"last_verified": ""
|
|
30
|
+
"last_verified": "2026-11-06"
|
|
31
31
|
},
|
|
32
32
|
"agents/docker-expert": {
|
|
33
|
-
"status": "
|
|
33
|
+
"status": "approved",
|
|
34
34
|
"version": "1.0.0",
|
|
35
35
|
"owner": "Guillaume Lemer",
|
|
36
36
|
"added": "2026-10-20",
|
|
37
|
-
"last_verified": ""
|
|
37
|
+
"last_verified": "2026-11-06"
|
|
38
38
|
},
|
|
39
39
|
"agents/docs": {
|
|
40
40
|
"status": "approved",
|
|
@@ -72,18 +72,18 @@
|
|
|
72
72
|
"last_verified": ""
|
|
73
73
|
},
|
|
74
74
|
"agents/kubernetes-specialist": {
|
|
75
|
-
"status": "
|
|
75
|
+
"status": "approved",
|
|
76
76
|
"version": "1.0.0",
|
|
77
77
|
"owner": "Guillaume Lemer",
|
|
78
78
|
"added": "2026-10-20",
|
|
79
|
-
"last_verified": ""
|
|
79
|
+
"last_verified": "2026-11-06"
|
|
80
80
|
},
|
|
81
81
|
"agents/memory-curator": {
|
|
82
|
-
"status": "
|
|
82
|
+
"status": "approved",
|
|
83
83
|
"version": "1.0.0",
|
|
84
84
|
"owner": "Guillaume Lemer",
|
|
85
85
|
"added": "2026-10-16",
|
|
86
|
-
"last_verified": ""
|
|
86
|
+
"last_verified": "2026-11-06"
|
|
87
87
|
},
|
|
88
88
|
"agents/operator": {
|
|
89
89
|
"status": "approved",
|
|
@@ -100,18 +100,18 @@
|
|
|
100
100
|
"last_verified": ""
|
|
101
101
|
},
|
|
102
102
|
"agents/react-engineer": {
|
|
103
|
-
"status": "
|
|
103
|
+
"status": "approved",
|
|
104
104
|
"version": "1.0.0",
|
|
105
105
|
"owner": "Guillaume Lemer",
|
|
106
106
|
"added": "2026-10-21",
|
|
107
|
-
"last_verified": ""
|
|
107
|
+
"last_verified": "2026-11-06"
|
|
108
108
|
},
|
|
109
109
|
"agents/react-reviewer": {
|
|
110
|
-
"status": "
|
|
110
|
+
"status": "approved",
|
|
111
111
|
"version": "1.0.0",
|
|
112
112
|
"owner": "Guillaume Lemer",
|
|
113
113
|
"added": "2026-10-21",
|
|
114
|
-
"last_verified": ""
|
|
114
|
+
"last_verified": "2026-11-06"
|
|
115
115
|
},
|
|
116
116
|
"agents/researcher": {
|
|
117
117
|
"status": "approved",
|
|
@@ -128,11 +128,11 @@
|
|
|
128
128
|
"last_verified": ""
|
|
129
129
|
},
|
|
130
130
|
"agents/performance": {
|
|
131
|
-
"status": "
|
|
131
|
+
"status": "approved",
|
|
132
132
|
"version": "1.0.0",
|
|
133
133
|
"owner": "Guillaume Lemer",
|
|
134
134
|
"added": "2026-10-14",
|
|
135
|
-
"last_verified": ""
|
|
135
|
+
"last_verified": "2026-11-06"
|
|
136
136
|
},
|
|
137
137
|
"agents/security": {
|
|
138
138
|
"status": "approved",
|
|
@@ -149,25 +149,25 @@
|
|
|
149
149
|
"last_verified": ""
|
|
150
150
|
},
|
|
151
151
|
"agents/spring-boot-engineer": {
|
|
152
|
-
"status": "
|
|
152
|
+
"status": "approved",
|
|
153
153
|
"version": "1.0.0",
|
|
154
154
|
"owner": "Guillaume Lemer",
|
|
155
155
|
"added": "2026-10-20",
|
|
156
|
-
"last_verified": ""
|
|
156
|
+
"last_verified": "2026-11-06"
|
|
157
157
|
},
|
|
158
158
|
"agents/spring-reviewer": {
|
|
159
|
-
"status": "
|
|
159
|
+
"status": "approved",
|
|
160
160
|
"version": "1.0.0",
|
|
161
161
|
"owner": "Guillaume Lemer",
|
|
162
162
|
"added": "2026-10-20",
|
|
163
|
-
"last_verified": ""
|
|
163
|
+
"last_verified": "2026-11-06"
|
|
164
164
|
},
|
|
165
165
|
"agents/spring-security": {
|
|
166
|
-
"status": "
|
|
166
|
+
"status": "approved",
|
|
167
167
|
"version": "1.0.0",
|
|
168
168
|
"owner": "Guillaume Lemer",
|
|
169
169
|
"added": "2026-10-20",
|
|
170
|
-
"last_verified": ""
|
|
170
|
+
"last_verified": "2026-11-06"
|
|
171
171
|
},
|
|
172
172
|
"agents/steward": {
|
|
173
173
|
"status": "approved",
|
|
@@ -198,11 +198,11 @@
|
|
|
198
198
|
"last_verified": ""
|
|
199
199
|
},
|
|
200
200
|
"skills/adhd": {
|
|
201
|
-
"status": "
|
|
201
|
+
"status": "approved",
|
|
202
202
|
"version": "1.0.0",
|
|
203
203
|
"owner": "Guillaume Lemer",
|
|
204
204
|
"added": "2026-10-29",
|
|
205
|
-
"last_verified": ""
|
|
205
|
+
"last_verified": "2026-11-06"
|
|
206
206
|
},
|
|
207
207
|
"skills/brainstorm": {
|
|
208
208
|
"status": "approved",
|
|
@@ -212,18 +212,18 @@
|
|
|
212
212
|
"last_verified": "2026-09-06"
|
|
213
213
|
},
|
|
214
214
|
"skills/brick-forge": {
|
|
215
|
-
"status": "
|
|
215
|
+
"status": "approved",
|
|
216
216
|
"version": "0.1.0",
|
|
217
217
|
"owner": "Guillaume Lemer",
|
|
218
218
|
"added": "2026-10-03",
|
|
219
|
-
"last_verified": ""
|
|
219
|
+
"last_verified": "2026-11-06"
|
|
220
220
|
},
|
|
221
221
|
"skills/bruno": {
|
|
222
|
-
"status": "
|
|
222
|
+
"status": "approved",
|
|
223
223
|
"version": "1.0.0",
|
|
224
224
|
"owner": "Guillaume Lemer",
|
|
225
225
|
"added": "2026-10-08",
|
|
226
|
-
"last_verified": ""
|
|
226
|
+
"last_verified": "2026-11-06"
|
|
227
227
|
},
|
|
228
228
|
"skills/codebase-design": {
|
|
229
229
|
"status": "approved",
|
|
@@ -261,11 +261,11 @@
|
|
|
261
261
|
"last_verified": "2026-09-06"
|
|
262
262
|
},
|
|
263
263
|
"skills/deck": {
|
|
264
|
-
"status": "
|
|
264
|
+
"status": "approved",
|
|
265
265
|
"version": "1.0.0",
|
|
266
266
|
"owner": "Guillaume Lemer",
|
|
267
267
|
"added": "2026-10-16",
|
|
268
|
-
"last_verified": ""
|
|
268
|
+
"last_verified": "2026-11-06"
|
|
269
269
|
},
|
|
270
270
|
"skills/dependencies": {
|
|
271
271
|
"status": "approved",
|
|
@@ -282,11 +282,11 @@
|
|
|
282
282
|
"last_verified": "2026-09-06"
|
|
283
283
|
},
|
|
284
284
|
"skills/diagram-design": {
|
|
285
|
-
"status": "
|
|
285
|
+
"status": "approved",
|
|
286
286
|
"version": "1.0.0",
|
|
287
287
|
"owner": "Guillaume Lemer",
|
|
288
288
|
"added": "2026-10-29",
|
|
289
|
-
"last_verified": ""
|
|
289
|
+
"last_verified": "2026-11-06"
|
|
290
290
|
},
|
|
291
291
|
"skills/document-project": {
|
|
292
292
|
"status": "approved",
|
|
@@ -359,25 +359,25 @@
|
|
|
359
359
|
"last_verified": "2026-09-06"
|
|
360
360
|
},
|
|
361
361
|
"skills/learn-mode": {
|
|
362
|
-
"status": "
|
|
362
|
+
"status": "approved",
|
|
363
363
|
"version": "1.0.0",
|
|
364
364
|
"owner": "Guillaume Lemer",
|
|
365
365
|
"added": "2026-10-02",
|
|
366
|
-
"last_verified": ""
|
|
366
|
+
"last_verified": "2026-11-06"
|
|
367
367
|
},
|
|
368
368
|
"skills/loop": {
|
|
369
|
-
"status": "
|
|
369
|
+
"status": "approved",
|
|
370
370
|
"version": "0.1.0",
|
|
371
371
|
"owner": "Guillaume Lemer",
|
|
372
372
|
"added": "2026-10-03",
|
|
373
|
-
"last_verified": ""
|
|
373
|
+
"last_verified": "2026-11-06"
|
|
374
374
|
},
|
|
375
375
|
"skills/ownership": {
|
|
376
|
-
"status": "
|
|
376
|
+
"status": "approved",
|
|
377
377
|
"version": "1.0.0",
|
|
378
378
|
"owner": "Guillaume Lemer",
|
|
379
379
|
"added": "2026-10-26",
|
|
380
|
-
"last_verified": ""
|
|
380
|
+
"last_verified": "2026-11-06"
|
|
381
381
|
},
|
|
382
382
|
"skills/parallel-agents": {
|
|
383
383
|
"status": "approved",
|
|
@@ -428,26 +428,19 @@
|
|
|
428
428
|
"added": "2026-07-13",
|
|
429
429
|
"last_verified": "2026-09-06"
|
|
430
430
|
},
|
|
431
|
-
"skills/quiz": {
|
|
432
|
-
"status": "experimental",
|
|
433
|
-
"version": "1.0.0",
|
|
434
|
-
"owner": "Guillaume Lemer",
|
|
435
|
-
"added": "2026-09-06",
|
|
436
|
-
"last_verified": ""
|
|
437
|
-
},
|
|
438
431
|
"skills/react": {
|
|
439
|
-
"status": "
|
|
432
|
+
"status": "approved",
|
|
440
433
|
"version": "1.0.0",
|
|
441
434
|
"owner": "Guillaume Lemer",
|
|
442
435
|
"added": "2026-10-21",
|
|
443
|
-
"last_verified": ""
|
|
436
|
+
"last_verified": "2026-11-06"
|
|
444
437
|
},
|
|
445
438
|
"skills/react-testing": {
|
|
446
|
-
"status": "
|
|
439
|
+
"status": "approved",
|
|
447
440
|
"version": "1.0.0",
|
|
448
441
|
"owner": "Guillaume Lemer",
|
|
449
442
|
"added": "2026-10-21",
|
|
450
|
-
"last_verified": ""
|
|
443
|
+
"last_verified": "2026-11-06"
|
|
451
444
|
},
|
|
452
445
|
"skills/react-view-transitions": {
|
|
453
446
|
"status": "approved",
|
|
@@ -520,32 +513,32 @@
|
|
|
520
513
|
"last_verified": "2026-10-13"
|
|
521
514
|
},
|
|
522
515
|
"skills/spring-boot": {
|
|
523
|
-
"status": "
|
|
516
|
+
"status": "approved",
|
|
524
517
|
"version": "1.0.0",
|
|
525
518
|
"owner": "Guillaume Lemer",
|
|
526
519
|
"added": "2026-10-20",
|
|
527
|
-
"last_verified": ""
|
|
520
|
+
"last_verified": "2026-11-06"
|
|
528
521
|
},
|
|
529
522
|
"skills/spring-data-jpa": {
|
|
530
|
-
"status": "
|
|
523
|
+
"status": "approved",
|
|
531
524
|
"version": "1.0.0",
|
|
532
525
|
"owner": "Guillaume Lemer",
|
|
533
526
|
"added": "2026-10-20",
|
|
534
|
-
"last_verified": ""
|
|
527
|
+
"last_verified": "2026-11-06"
|
|
535
528
|
},
|
|
536
529
|
"skills/spring-testing": {
|
|
537
|
-
"status": "
|
|
530
|
+
"status": "approved",
|
|
538
531
|
"version": "1.0.0",
|
|
539
532
|
"owner": "Guillaume Lemer",
|
|
540
533
|
"added": "2026-10-20",
|
|
541
|
-
"last_verified": ""
|
|
534
|
+
"last_verified": "2026-11-06"
|
|
542
535
|
},
|
|
543
536
|
"skills/teach": {
|
|
544
|
-
"status": "
|
|
537
|
+
"status": "approved",
|
|
545
538
|
"version": "1.0.0",
|
|
546
539
|
"owner": "Guillaume Lemer",
|
|
547
540
|
"added": "2026-09-06",
|
|
548
|
-
"last_verified": ""
|
|
541
|
+
"last_verified": "2026-11-06"
|
|
549
542
|
},
|
|
550
543
|
"skills/token-report": {
|
|
551
544
|
"status": "approved",
|