geneseed 5.3.1 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +102 -0
- package/README.md +51 -18
- package/SHIPPED.md +7 -7
- package/adapters/bob/README.md +12 -1
- package/adapters/opencode/README.md +5 -3
- package/adapters/opencode/plugins/geneseed-context.js +77 -10
- package/adapters/opencode/plugins/geneseed-guard.js +106 -22
- package/adapters/opencode/plugins/geneseed-learn.js +641 -6
- package/bin/geneseed-cli.mjs +10 -0
- package/bin/geneseed-hook.mjs +5 -4
- package/docs/PRD.md +1 -1
- package/docs/README.md +1 -0
- package/docs/concepts/agents.md +14 -2
- package/docs/concepts/collaboration.md +2 -2
- package/docs/concepts/enforcement-table.md +5 -2
- package/docs/concepts/exclusions.md +16 -2
- package/docs/concepts/footprint.md +1 -1
- package/docs/concepts/foreman-mode.md +23 -4
- package/docs/concepts/hook-gates.md +4 -4
- package/docs/concepts/hooks.md +25 -7
- package/docs/concepts/host-matrix.md +4 -4
- package/docs/concepts/hosts.md +1 -1
- package/docs/concepts/kits.md +12 -2
- package/docs/concepts/loop-bricks.md +3 -3
- package/docs/concepts/loops.md +6 -4
- package/docs/concepts/ownership.md +1 -1
- package/docs/concepts/rules.md +2 -2
- package/docs/concepts/shared-tier.md +1 -1
- package/docs/concepts/skills.md +21 -1
- package/docs/concepts/themes.md +1 -1
- package/docs/extending.md +73 -29
- package/docs/guides/auto-merge.md +100 -0
- package/docs/guides/choose-your-setup.md +1 -1
- package/docs/guides/headless.md +1 -1
- package/docs/guides/install-clone.md +19 -1
- package/docs/guides/install-scripted.md +8 -2
- package/docs/guides/install.md +20 -2
- package/docs/guides/loop-finish.md +3 -3
- package/docs/guides/loop-running.md +4 -4
- package/docs/guides/project-context.md +1 -1
- package/docs/guides/run-a-factory.md +2 -2
- package/docs/guides/setup-doctrines.md +2 -2
- package/docs/guides/setup-footprint.md +1 -1
- package/docs/guides/uninstall.md +3 -3
- package/docs/guides/upgrade.md +2 -2
- package/docs/guides/worktree.md +1 -1
- package/docs/reference/env-context.md +1 -1
- package/docs/reference/environment.md +4 -2
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/plugin-guard.md +1 -1
- package/docs/reference/plugin-learn.md +5 -1
- package/docs/reference/plugin-workflow.md +1 -1
- package/docs/reference/profiles.md +142 -0
- package/docs/reference/troubleshoot-doctor.md +1 -1
- package/docs/reference/troubleshoot-hooks.md +2 -2
- package/docs/reference/troubleshoot-install.md +3 -3
- package/docs/reference/troubleshoot-tools.md +1 -1
- package/docs/token-footprint.md +11 -6
- package/docs/understand/design-choices-engineering.md +1 -1
- package/docs/understand/enforced-vs-asked.md +1 -1
- package/docs/understand/machine-claude.md +2 -2
- package/docs/understand/on-your-machine.md +1 -1
- package/docs/web-ui.md +8 -6
- package/harness.config.json +1 -1
- package/js/README.md +11 -3
- package/js/build/args.mjs +16 -4
- package/js/build/catalog.mjs +11 -1
- package/js/build/driver.mjs +74 -16
- package/js/build/emit-claude.mjs +32 -5
- package/js/build/emit-opencode.mjs +16 -9
- package/js/build/export.mjs +1 -1
- package/js/build/generate.mjs +12 -157
- package/js/build/notes-migrate.mjs +99 -0
- package/js/build/profile.mjs +326 -0
- package/js/build/render.mjs +110 -8
- package/js/build/retired-skills.mjs +60 -13
- package/js/build/source.mjs +100 -3
- package/js/build/stubs.mjs +4 -1
- package/js/cli-table.json +212 -7
- package/js/hosts/agent-runs.mjs +205 -0
- package/js/hosts/done-checks.mjs +3 -1
- package/js/hosts/hooks-done.mjs +428 -63
- package/js/hosts/hooks-learn.mjs +89 -3
- package/js/hosts/hooks-prims.mjs +44 -4
- package/js/hosts/hooks.mjs +159 -9
- package/js/hosts/hosts.mjs +10 -0
- package/js/hosts/installs.mjs +44 -2
- package/js/hosts/link.mjs +45 -10
- package/js/hosts/native.mjs +61 -7
- package/js/hosts/opencode.mjs +1 -1
- package/js/hosts/settings.mjs +101 -3
- package/js/hosts/spec-feedback.mjs +538 -0
- package/js/hosts/usage.mjs +67 -8
- package/js/inspect/agent-scores.mjs +118 -0
- package/js/inspect/checks-authoring.mjs +2 -1
- package/js/inspect/checks-build.mjs +20 -4
- package/js/inspect/checks-constitution.mjs +32 -0
- package/js/inspect/checks-repo.mjs +27 -2
- package/js/inspect/cost.mjs +6 -5
- package/js/inspect/diff.mjs +46 -8
- package/js/inspect/doctor.mjs +4 -0
- package/js/inspect/inventory.mjs +1 -1
- package/js/inspect/status.mjs +3 -1
- package/js/inspect/validate.mjs +1 -0
- package/js/lib/machine-dir.mjs +8 -0
- package/js/lib/paths.mjs +4 -1
- package/js/maintain/profile-scope.mjs +145 -0
- package/js/maintain/profiles.mjs +486 -0
- package/js/maintain/setup.mjs +413 -15
- package/js/maintain/uninstall.mjs +4 -1
- package/js/maintain/update.mjs +4 -2
- package/js/web/actions.mjs +44 -41
- package/js/web/api.mjs +13 -3
- package/js/web/handler.mjs +8 -0
- package/js/web/jobs.mjs +5 -4
- package/js/web/profiles-api.mjs +201 -0
- package/js/web/routes.mjs +5 -0
- package/package.json +2 -1
- package/profiles/guillaume-claude-global.json +16 -0
- package/profiles/starter.json +14 -0
- package/registry.json +14 -0
- package/src/AGENT.md.tmpl +16 -18
- package/src/agents/_self-improvement.md +15 -7
- package/src/agents/_template.md +4 -2
- package/src/agents/advocate.md +1 -1
- package/src/agents/architect.md +1 -1
- package/src/agents/developer.md +10 -3
- 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 +4 -2
- 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 +1 -1
- 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 +10 -3
- 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 +4 -2
- package/src/agents/user-advocate.md +1 -1
- package/src/agents/visionary.md +1 -1
- package/src/bricks/pr-open.md +3 -2
- package/src/doctrines/ops.md +2 -2
- package/src/doctrines/process.md +40 -36
- package/src/factories/analysis-to-build.json +1 -1
- package/src/factories/bug-report-to-fix.json +1 -1
- package/src/factories/issue-to-pr.json +1 -1
- package/src/kits/terminal-tools/rules.md +10 -0
- package/src/kits/terminal-tools.json +13 -0
- package/src/licenses/herdr.txt +201 -0
- package/src/memory/README.md +12 -2
- package/src/modes/foreman.md +25 -9
- package/src/skill-descriptions.json +63 -0
- package/src/skills/_self-improvement.md +42 -24
- package/src/skills/_template.md +3 -1
- package/src/skills/brainstorm.md +35 -22
- package/src/skills/commit.md +17 -17
- package/src/skills/daydream/VENDOR.md +6 -0
- package/src/skills/debug/ci.md +1 -1
- package/src/skills/dependencies.md +3 -3
- package/src/skills/diagram-design/VENDOR.md +4 -0
- package/src/skills/document-project.md +3 -2
- package/src/skills/explain-changes/VENDOR.md +5 -1
- package/src/skills/factory.md +13 -4
- package/src/skills/geneseed.md +4 -2
- package/src/skills/git-history.md +5 -7
- package/src/skills/herdr.md +135 -0
- package/src/skills/loop.md +3 -2
- package/src/skills/opencode-cli.md +84 -0
- package/src/skills/parallel-agents.md +11 -0
- package/src/skills/pipeline.md +3 -3
- package/src/skills/plan.md +5 -4
- package/src/skills/react-view-transitions/VENDOR.md +7 -1
- package/src/skills/release.md +11 -9
- package/src/skills/review-response.md +4 -2
- package/src/skills/rule/approve.md +2 -1
- package/src/skills/rule.md +27 -1
- package/src/skills/ship.md +54 -7
- package/src/skills/skill-forge.md +5 -3
- package/src/skills/token-report/VENDOR.md +5 -1
- package/src/skills/worktree.md +2 -2
- package/src/upstreams.json +9 -2
- package/themes/README.md +3 -1
- package/themes/_TEMPLATE.json +2 -0
- package/themes/biker.json +2 -0
- package/themes/commentator.json +2 -0
- package/themes/cyberpunk.json +2 -0
- package/themes/gamer.json +2 -0
- package/themes/imperial.json +2 -0
- package/themes/joker.json +2 -0
- package/themes/marvin.json +2 -0
- package/themes/mean.json +2 -0
- package/themes/military.json +2 -0
- package/themes/neutral.json +2 -0
- package/themes/pirate.json +2 -0
- package/themes/sports.json +2 -0
- package/themes/verstappen.json +2 -0
- package/themes/wizard.json +2 -0
- package/web/dist/assets/{ActiveLoops-BJJN3P-V.js → ActiveLoops-DOJCPPPc.js} +1 -1
- package/web/dist/assets/Activity-LKsDzsnK.js +1 -0
- package/web/dist/assets/ActivityDetail-DhwTfPm6.js +1 -0
- package/web/dist/assets/{Bonsai-BBl4XXqs.js → Bonsai-CePMLrpr.js} +1 -1
- package/web/dist/assets/{CopyButton-Beven8yn.js → CopyButton-CuoaJ6k7.js} +1 -1
- package/web/dist/assets/Dashboard-D1VKuvLe.js +2 -0
- package/web/dist/assets/Docs-CUrHJKaU.js +5 -0
- package/web/dist/assets/Factories-Ci1XfmSy.js +1 -0
- package/web/dist/assets/{GreenhouseView-Bce212qd.js → GreenhouseView-CNfH2lPK.js} +1 -1
- package/web/dist/assets/Installs-ZHQZM1iS.js +3 -0
- package/web/dist/assets/{JournalView-CV4omyww.js → JournalView-CMsWahkS.js} +1 -1
- package/web/dist/assets/Kits-CkliyK0n.js +1 -0
- package/web/dist/assets/Laws-hh4O3HZ4.js +4 -0
- package/web/dist/assets/{LibRows-Dag1s0ZX.js → LibRows-Brv0Hmkr.js} +1 -1
- package/web/dist/assets/Library-BYmiLjJr.js +3 -0
- package/web/dist/assets/Loops-ytm-xJ68.js +2 -0
- package/web/dist/assets/{OperatorHudView-JmYY1pBR.js → OperatorHudView-KaqCx_HP.js} +1 -1
- package/web/dist/assets/Personal-CmcnRKYE.js +2 -0
- package/web/dist/assets/Settings-tUrpdOfq.js +1 -0
- package/web/dist/assets/{Tabs-8zsyEPSK.js → Tabs-CD7etcGD.js} +1 -1
- package/web/dist/assets/api-CZ-x0iWG.js +1 -0
- package/web/dist/assets/{controls-D4wmg_pl.js → controls-CK7qHA8H.js} +1 -1
- package/web/dist/assets/{index-CRWqKxfY.css → index-Ba_Kg3Af.css} +1 -1
- package/web/dist/assets/index-COKbhFNo.js +6 -0
- package/web/dist/index.html +3 -3
- package/web/dist/assets/Activity-WQ3ykgxU.js +0 -1
- package/web/dist/assets/ActivityDetail-7rt04SkS.js +0 -1
- package/web/dist/assets/Dashboard-BgLArtgu.js +0 -2
- package/web/dist/assets/Docs-B5aHp86J.js +0 -5
- package/web/dist/assets/Factories-BjqzXAw8.js +0 -1
- package/web/dist/assets/Installs-B1OsrHXF.js +0 -3
- package/web/dist/assets/Kits-CW1e7xNa.js +0 -1
- package/web/dist/assets/Laws-1Ckf1lbs.js +0 -4
- package/web/dist/assets/Library-B3FuFLel.js +0 -3
- package/web/dist/assets/Loops-CwqgnLNw.js +0 -2
- package/web/dist/assets/Personal-DKLgLa7Z.js +0 -2
- package/web/dist/assets/Settings-BwErnh-R.js +0 -1
- package/web/dist/assets/api-DLDVY3K-.js +0 -1
- package/web/dist/assets/index-Ce6qF2nG.js +0 -6
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `geneseed catalog agents --scores` — the read side of the agent outcome ledger
|
|
3
|
+
* (js/hosts/agent-runs.mjs writes it). One table per active install that holds a ledger: a row per
|
|
4
|
+
* agent and spec hash, so the runs before a spec edit and the runs after it are two rows to compare.
|
|
5
|
+
*
|
|
6
|
+
* READ-ONLY. A hook may append at any moment, so the file is never rewritten here; a garbage line
|
|
7
|
+
* is skipped, never fatal.
|
|
8
|
+
*
|
|
9
|
+
* WHAT A COLUMN MEANS, and what it cannot mean. UNBLOCKED is `never blocked / judged`, over the
|
|
10
|
+
* runs the done gate judged (`done: "ended"`): the gate's return cannot tell a pass from an
|
|
11
|
+
* advisory or a spent cap (agent-runs.mjs header), so this is not a pass rate. REFUSED and TOOLS
|
|
12
|
+
* are means per run over the runs that carry a count, with that count in brackets, and `-` below
|
|
13
|
+
* MEAN_FLOOR such runs; FEEDBACK is the spec-feedback lines the reports carried, summed; REPORTS is
|
|
14
|
+
* the runs that ended with a report. SINCE and LAST are the first and last day a row was seen.
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
|
|
19
|
+
import { CLAUDE_STYLE, HOSTS } from '../hosts/hosts.mjs';
|
|
20
|
+
import { installState, installTargets } from '../hosts/installs.mjs';
|
|
21
|
+
import { RUNS_LEDGER, USAGE_OFF } from '../hosts/usage.mjs';
|
|
22
|
+
import { printErr, printOut } from '../lib/fs.mjs';
|
|
23
|
+
import { padEndToWidth } from '../lib/text.mjs';
|
|
24
|
+
|
|
25
|
+
const isCount = (n) => Number.isInteger(n) && n >= 0;
|
|
26
|
+
|
|
27
|
+
/** The ledger's well-formed lines, in file order. A missing file is no runs. */
|
|
28
|
+
export function readRuns(file) {
|
|
29
|
+
let raw;
|
|
30
|
+
try { raw = readFileSync(file, 'utf8'); } catch { return []; }
|
|
31
|
+
const out = [];
|
|
32
|
+
for (const line of raw.split('\n')) {
|
|
33
|
+
let e;
|
|
34
|
+
try { e = JSON.parse(line); } catch { continue; }
|
|
35
|
+
if (!e || typeof e !== 'object' || typeof e.ts !== 'string' || typeof e.agent !== 'string') continue;
|
|
36
|
+
out.push(e);
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* One row per agent and spec, agents in name order and each agent's specs in the order first seen
|
|
43
|
+
* (so an agent's rows read oldest spec first). Sums, not means: `scoreLines` divides.
|
|
44
|
+
*/
|
|
45
|
+
export function scoreRows(entries) {
|
|
46
|
+
const rows = new Map();
|
|
47
|
+
for (const e of entries) {
|
|
48
|
+
const spec = typeof e.spec === 'string' ? e.spec : null;
|
|
49
|
+
const key = `${e.agent}\u0000${spec}`;
|
|
50
|
+
let r = rows.get(key);
|
|
51
|
+
if (!r) {
|
|
52
|
+
rows.set(key, r = { agent: e.agent, spec, runs: 0, judged: 0, unblocked: 0, refused: 0, refusedRuns: 0,
|
|
53
|
+
tools: 0, toolRuns: 0, feedback: 0, reports: 0, since: e.ts, last: e.ts, order: rows.size });
|
|
54
|
+
}
|
|
55
|
+
r.runs += 1;
|
|
56
|
+
if (e.done === 'ended') {
|
|
57
|
+
r.judged += 1;
|
|
58
|
+
if (e.blocks === 0) r.unblocked += 1;
|
|
59
|
+
}
|
|
60
|
+
if (isCount(e.refused)) { r.refused += e.refused; r.refusedRuns += 1; }
|
|
61
|
+
if (isCount(e.tools)) { r.tools += e.tools; r.toolRuns += 1; }
|
|
62
|
+
if (isCount(e.feedback)) r.feedback += e.feedback;
|
|
63
|
+
if (e.report === true) r.reports += 1;
|
|
64
|
+
if (e.ts < r.since) r.since = e.ts;
|
|
65
|
+
if (e.ts > r.last) r.last = e.ts;
|
|
66
|
+
}
|
|
67
|
+
return [...rows.values()].sort((a, b) => (a.agent < b.agent ? -1 : a.agent > b.agent ? 1 : a.order - b.order));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Below this many counted runs a mean says nothing, so it prints `-`. */
|
|
71
|
+
export const MEAN_FLOOR = 3;
|
|
72
|
+
const mean = (sum, n) => (n >= MEAN_FLOOR ? `${(Math.round((sum / n) * 10) / 10).toFixed(1)} (${n})` : '-');
|
|
73
|
+
|
|
74
|
+
/** The table as lines: a header, then one line per row, columns padded to their widest cell. */
|
|
75
|
+
export function scoreLines(rows) {
|
|
76
|
+
const head = ['AGENT', 'SPEC', 'RUNS', 'UNBLOCKED', 'REFUSED', 'TOOLS', 'FEEDBACK', 'REPORTS', 'SINCE', 'LAST'];
|
|
77
|
+
const cells = rows.map((r) => [r.agent, r.spec ?? '-', String(r.runs),
|
|
78
|
+
r.judged ? `${r.unblocked}/${r.judged}` : '-',
|
|
79
|
+
mean(r.refused, r.refusedRuns), mean(r.tools, r.toolRuns), String(r.feedback),
|
|
80
|
+
`${r.reports}/${r.runs}`, r.since, r.last]);
|
|
81
|
+
const widths = head.map((h, i) => Math.max(h.length, ...cells.map((c) => c[i].length)));
|
|
82
|
+
const line = (c) => c.map((v, i) => (i === c.length - 1 ? v : padEndToWidth(v, widths[i]))).join(' ').trimEnd();
|
|
83
|
+
return [line(head), ...cells.map(line)];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The folders an install's ledger may sit in: the Claude-style project's marker folder, else the
|
|
88
|
+
* root. For OpenCode also `<root>/.opencode`, a LEGACY read: a project install's learn plugin
|
|
89
|
+
* wrote there (its `<plugins>/..`) until it learned `notebookHome`, and now writes `<root>/notebook`
|
|
90
|
+
* like every other ledger. Kept so the runs recorded before that still show.
|
|
91
|
+
*/
|
|
92
|
+
function ledgerDirs(host, scope, root) {
|
|
93
|
+
if (scope === 'project' && CLAUDE_STYLE.includes(host)) return [path.join(root, HOSTS.find((h) => h.host === host).projectMarker)];
|
|
94
|
+
return host === 'opencode' ? [root, path.join(root, '.opencode')] : [root];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The verb. `targets` is `installTargets()`'s shape, `[host, scope, root]`; a test passes its own. */
|
|
98
|
+
export function cmdAgentScores(targets = installTargets()) {
|
|
99
|
+
const active = targets.filter(([host, scope, root]) => installState(root, host, scope) === 'active');
|
|
100
|
+
if (!active.length) {
|
|
101
|
+
printErr('[scores] no active Geneseed install found. Run `geneseed setup` first.\n');
|
|
102
|
+
return 1;
|
|
103
|
+
}
|
|
104
|
+
let shown = 0;
|
|
105
|
+
for (const [host, scope, root] of active) {
|
|
106
|
+
for (const dir of ledgerDirs(host, scope, root)) {
|
|
107
|
+
const file = path.join(dir, RUNS_LEDGER);
|
|
108
|
+
const rows = scoreRows(readRuns(file));
|
|
109
|
+
if (!rows.length) continue;
|
|
110
|
+
shown += 1;
|
|
111
|
+
const off = process.env.GENESEED_NO_USAGE || existsSync(path.join(dir, USAGE_OFF)) ? ' (recording is off)' : '';
|
|
112
|
+
printOut(`[scores] ${host} ${scope}: ${file}${off}\n`);
|
|
113
|
+
for (const l of scoreLines(rows)) printOut(` ${l}\n`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (!shown) printOut(`[scores] no agent runs recorded yet (${RUNS_LEDGER.split(path.sep).join('/')} in each install).\n`);
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
@@ -21,7 +21,7 @@ import { blankCodeSpans } from '../lib/text.mjs';
|
|
|
21
21
|
import { which } from '../lib/paths.mjs';
|
|
22
22
|
import { NO_WINDOW } from '../lib/proc.mjs';
|
|
23
23
|
import {
|
|
24
|
-
aliasProblems, creditProblems, folderSkillProblems, registryProblems, secretProblems, sideFileProblems,
|
|
24
|
+
aliasProblems, catalogueLineProblems, creditProblems, folderSkillProblems, registryProblems, secretProblems, sideFileProblems,
|
|
25
25
|
vendorPinProblems,
|
|
26
26
|
} from './checks-repo.mjs';
|
|
27
27
|
import { constitutionProblems, leanBlockProblems } from './checks-constitution.mjs';
|
|
@@ -203,6 +203,7 @@ export function authoringProblems() {
|
|
|
203
203
|
problems.push(...vendorPinProblems());
|
|
204
204
|
problems.push(...folderSkillProblems());
|
|
205
205
|
problems.push(...aliasProblems());
|
|
206
|
+
problems.push(...catalogueLineProblems());
|
|
206
207
|
problems.push(...creditProblems());
|
|
207
208
|
problems.push(...sideFileProblems());
|
|
208
209
|
problems.push(...constitutionProblems());
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
import { stripCapabilityLinks } from '../build/emit-common.mjs';
|
|
11
11
|
import { STRUCTURE, renderAll } from '../build/render.mjs';
|
|
12
|
-
import { CONFIG, CREDIT_RE, makeCfg } from '../build/source.mjs';
|
|
12
|
+
import { CONFIG, CREDIT_RE, DESCRIPTION_LIMIT, makeCfg } from '../build/source.mjs';
|
|
13
13
|
import { CLAUDE_STYLE, HOSTS, hostCatalogsNatively, resolvePath } from '../hosts/hosts.mjs';
|
|
14
14
|
import { EMIT_HOST_SCOPE, footprintOfDir, readMaybe, renderedTier, themeFiles } from '../hosts/installs.mjs';
|
|
15
15
|
import { isVendoredPath } from '../hosts/native.mjs';
|
|
@@ -74,7 +74,14 @@ export function checkBuild(themeName, out, isVendored = isVendoredPath) {
|
|
|
74
74
|
for (const md of rglob(outAbs)) {
|
|
75
75
|
if (!md.endsWith('.md') || !isFile(md)) continue;
|
|
76
76
|
const rel = path.relative(outAbs, md);
|
|
77
|
-
if (isVendored(rel))
|
|
77
|
+
if (isVendored(rel)) {
|
|
78
|
+
// Upstream docs are exempt, but a vendored SKILL.md's description is ours (the catalogue
|
|
79
|
+
// line `vendoredWithCatalogueLine` writes) and is listed like any other skill's.
|
|
80
|
+
if (path.basename(rel) === 'SKILL.md') {
|
|
81
|
+
for (const p of descriptionProblems(readText(md), rel)) problems.push(`[${themeName}] ${p}`);
|
|
82
|
+
}
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
78
85
|
const text = readText(md);
|
|
79
86
|
// Sorted per file: `doctorCollect` re-sorts everything anyway, but `validate` prints these
|
|
80
87
|
// in the order they come back.
|
|
@@ -102,10 +109,16 @@ export function checkBuild(themeName, out, isVendored = isVendoredPath) {
|
|
|
102
109
|
* the spec warns degrades discovery, since the text is injected into the system prompt.
|
|
103
110
|
* The pronoun arm reads only the `Use when:` half, and skips quoted user phrases ("teach me
|
|
104
111
|
* X" is what the user types, not the description's voice): the purpose half is the theme's
|
|
105
|
-
* persona copy ("Make your own OpenCode theme"), authored per theme on purpose.
|
|
112
|
+
* persona copy ("Make your own OpenCode theme"), authored per theme on purpose. A skill's
|
|
113
|
+
* catalogue line (`src/skill-descriptions.json`) has no `Use when:` and no persona half: the
|
|
114
|
+
* pronoun arm reads all of it.
|
|
115
|
+
* A fourth arm, for a skill's `SKILL.md` only: the description is at most `DESCRIPTION_LIMIT`
|
|
116
|
+
* characters. The model's skill listing has a budget, and the host drops the descriptions of
|
|
117
|
+
* the least-used skills when it overruns; agents are listed apart and keep their own length.
|
|
106
118
|
* Files without frontmatter (every bundle `.md`, AGENT.md) carry no description and pass.
|
|
107
119
|
*/
|
|
108
120
|
const DESC_LINE_RE = /^---\n(?:.*\n)*?description: (".*")\n(?:.*\n)*?---\n/;
|
|
121
|
+
const SKILL_FILE_RE = /(?:^|[\\/])skills[\\/][^\\/]+[\\/]SKILL\.md$/;
|
|
109
122
|
export function descriptionProblems(text, rel) {
|
|
110
123
|
const m = text.match(DESC_LINE_RE);
|
|
111
124
|
if (!m) return [];
|
|
@@ -113,7 +126,10 @@ export function descriptionProblems(text, rel) {
|
|
|
113
126
|
const problems = [];
|
|
114
127
|
if (desc.endsWith('…')) problems.push(`description cut mid-sentence in ${rel} — shorten the first trigger sentence`);
|
|
115
128
|
if (/<\/?[A-Za-z][^>]*>/.test(desc)) problems.push(`description carries an XML-like tag in ${rel}`);
|
|
116
|
-
|
|
129
|
+
if (SKILL_FILE_RE.test(rel) && desc.length > DESCRIPTION_LIMIT) {
|
|
130
|
+
problems.push(`description is ${desc.length} characters in ${rel}, over ${DESCRIPTION_LIMIT} — shorten its line in src/skill-descriptions.json`);
|
|
131
|
+
}
|
|
132
|
+
const when = desc.includes(' Use when: ') ? desc.split(' Use when: ')[1] : desc;
|
|
117
133
|
if (/\b(I|I'm|me|my|you|you're|your)\b/i.test(when.replace(/"[^"]*"|\bI\/O\b/g, ''))) {
|
|
118
134
|
problems.push(`description's "Use when" is not in the third person in ${rel}`);
|
|
119
135
|
}
|
|
@@ -98,6 +98,37 @@ const BARE_CITE_RE = /\{\{LAW\}\}\s+[IVXLCDM]+\b|\{\{DOCTRINE\}\}\s+[a-z]+\s+\d+
|
|
|
98
98
|
// legal everywhere, including in an invariant that points at the tier as a whole.
|
|
99
99
|
const DOCTRINE_TOKEN_RE = /\{\{DOCTRINE(?:\}\}|:)/;
|
|
100
100
|
|
|
101
|
+
// The sources the carrier inlines, where an excluded rule's citations are removed at render. A
|
|
102
|
+
// kit's rules file is inlined too (`kitsBody`); the rest of a kit folder ships beside it.
|
|
103
|
+
const CARRIER_SOURCE_RE = /^(?:AGENT\.md\.tmpl$|modes\/|postures\/|doctrines\/|kits\/[^/]+\/rules\.md$)/;
|
|
104
|
+
const PAREN_RE = /\(([^()]*)\)/g;
|
|
105
|
+
const CITE_TOKEN_RE = /\{\{(?:LAW|DOCTRINE):[^}]*\}\}/g;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* A parenthetical in a carrier source that cites a doctrine rule holds citations only.
|
|
109
|
+
*
|
|
110
|
+
* ⚠ THIS IS WHAT MAKES D3 SAFE TO RENDER. An excluded rule is off, so `dropExcludedCitations`
|
|
111
|
+
* (`js/build/render.mjs`) removes its citations from the carrier — but only a group made of
|
|
112
|
+
* citations alone, because only then does the sentence still read with the group gone.
|
|
113
|
+
* `(*Consent Before Push* stays with you)` would survive the render and keep invoking a rule the
|
|
114
|
+
* install switched off. A prose mention outside parentheses is fine: it describes, it binds
|
|
115
|
+
* nothing. Doctrine citations only, because a law cannot be excluded.
|
|
116
|
+
* @param {string} rel path under src/, posix
|
|
117
|
+
* @param {string} text the raw source
|
|
118
|
+
*/
|
|
119
|
+
export function citationGroupProblems(rel, text) {
|
|
120
|
+
if (!CARRIER_SOURCE_RE.test(rel)) return [];
|
|
121
|
+
const problems = [];
|
|
122
|
+
for (const [whole, inner] of text.matchAll(PAREN_RE)) {
|
|
123
|
+
if (!inner.includes('{{DOCTRINE:')) continue;
|
|
124
|
+
if (!inner.replace(CITE_TOKEN_RE, '').replace(/[,\s]/g, '')) continue;
|
|
125
|
+
problems.push(`[authoring] ${rel} mixes a doctrine citation with other words in '${whole.replace(/\s+/g, ' ')}'`
|
|
126
|
+
+ ' — an excluded rule\'s citation is removed from the carrier only when its parentheses hold'
|
|
127
|
+
+ ' citations alone; move the words outside: "…, so X ({{DOCTRINE:<id>}})"');
|
|
128
|
+
}
|
|
129
|
+
return problems;
|
|
130
|
+
}
|
|
131
|
+
|
|
101
132
|
/**
|
|
102
133
|
* The rules the hooks enforce at the tool boundary, and the address each is bound to there. The
|
|
103
134
|
* hook path cannot afford to read the canon on every tool call, so its gate-ledger keys
|
|
@@ -284,6 +315,7 @@ export function constitutionProblems() {
|
|
|
284
315
|
+ 'reference a toggleable one, or a pack-off build ships a rule pointing at text '
|
|
285
316
|
+ 'that is not there. State the point directly instead');
|
|
286
317
|
}
|
|
318
|
+
problems.push(...citationGroupProblems(rel, text));
|
|
287
319
|
for (const [bare] of text.matchAll(BARE_CITE_RE)) {
|
|
288
320
|
problems.push(`[authoring] ${rel} cites '${bare.replace(/\s+/g, ' ')}' by number — numbers are `
|
|
289
321
|
+ 'positional and move when the canon does; cite {{LAW:<id>}} / {{DOCTRINE:<id>}}');
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import {
|
|
13
|
-
ALIASES_RE, CREDIT_RE, PLUGIN_SRC, RETIRED_SKILL_IDS, ROOT, SRC, THEMES,
|
|
14
|
-
knownSkillIds, upstreams,
|
|
13
|
+
ALIASES_RE, CREDIT_RE, DESCRIPTION_LIMIT, PLUGIN_SRC, RETIRED_SKILL_IDS, ROOT, SRC, THEMES,
|
|
14
|
+
WORKFLOW_SRC, aliasesOf, knownSkillIds, skillDescriptions, upstreams,
|
|
15
15
|
} from '../build/source.mjs';
|
|
16
16
|
import { HOSTS } from '../hosts/hosts.mjs';
|
|
17
17
|
import { installTargets, installsReferencingShim } from '../hosts/installs.mjs';
|
|
@@ -345,6 +345,31 @@ export function creditProblems(src = SRC) {
|
|
|
345
345
|
return problems;
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
/**
|
|
349
|
+
* The doctor's arm of `src/skill-descriptions.json`, the one home of every skill's
|
|
350
|
+
* model-visible `description:` (`skillDescriptions`, `skillDescription`). Every skill id —
|
|
351
|
+
* flat, folder or vendored, kits included — has exactly one line, each line names a skill, and
|
|
352
|
+
* none is over `DESCRIPTION_LIMIT`: a skill with no line falls back to purpose + trigger, which
|
|
353
|
+
* ran to 320 characters, and a stale key is a line nobody reads. `checkBuild`'s
|
|
354
|
+
* `descriptionProblems` holds the emitted file to the same limit.
|
|
355
|
+
*/
|
|
356
|
+
export function catalogueLineProblems(src = SRC, lines = skillDescriptions(src)) {
|
|
357
|
+
const problems = [];
|
|
358
|
+
const known = knownSkillIds(src);
|
|
359
|
+
const where = 'src/skill-descriptions.json';
|
|
360
|
+
for (const id of known) {
|
|
361
|
+
if (!Object.hasOwn(lines, id)) problems.push(`[authoring] skill '${id}' has no line in ${where}`);
|
|
362
|
+
}
|
|
363
|
+
for (const [id, line] of Object.entries(lines)) {
|
|
364
|
+
if (!known.includes(id)) problems.push(`[authoring] ${where} has a line for '${id}', which is no skill`);
|
|
365
|
+
else if (typeof line !== 'string' || !line.trim()) problems.push(`[authoring] ${where}: '${id}' is empty`);
|
|
366
|
+
else if (line.length > DESCRIPTION_LIMIT) {
|
|
367
|
+
problems.push(`[authoring] ${where}: '${id}' is ${line.length} characters, over ${DESCRIPTION_LIMIT}`);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return problems;
|
|
371
|
+
}
|
|
372
|
+
|
|
348
373
|
/**
|
|
349
374
|
* Every `<!-- aliases: … -->` name is a clean, unclaimed, single-owner path segment.
|
|
350
375
|
*
|
package/js/inspect/cost.mjs
CHANGED
|
@@ -48,23 +48,24 @@ export const CARRIER_CEILING = { full: 66_432, lean: 40_312 };
|
|
|
48
48
|
* count 0. The footprint does not change it: a description is the same text in both.
|
|
49
49
|
*
|
|
50
50
|
* WHY A CEILING. The listing is always-on context, and unlike the carrier nothing bounded its
|
|
51
|
-
* total. Each description has its own
|
|
51
|
+
* total. Each description has its own limit (`DESCRIPTION_LIMIT`, 80, js/build/source.mjs), which
|
|
52
52
|
* bounds one skill and says nothing about fifty: the catalogue once reached 22k characters
|
|
53
53
|
* before anyone measured it (that docblock has the history). And the host has a listing budget
|
|
54
54
|
* of its own, past which it trims descriptions without a word, so growth here ends as routing
|
|
55
55
|
* text the model never sees. A new skill, or a longer trigger sentence, now has to fit, or the
|
|
56
56
|
* number is raised in the open.
|
|
57
57
|
*
|
|
58
|
-
* MEASURED 2026-11-
|
|
59
|
-
*
|
|
60
|
-
* (
|
|
58
|
+
* MEASURED 2026-11-15: 3 971 characters over the default install's listed skills (neutral, no
|
|
59
|
+
* kits), down from 8 836 when each skill's description became its 80-character catalogue line
|
|
60
|
+
* (`src/skill-descriptions.json`). The ceiling is that figure plus 2 %, rounded up (the
|
|
61
|
+
* headroom the lean carrier ceiling was given). `tests/unit/emit_smoke.test.mjs` gates it.
|
|
61
62
|
* Raise it by the measured overrun and say why here, after trying a shorter description first.
|
|
62
63
|
*
|
|
63
64
|
* `alwaysOnCost` returns it as `skillCeiling` for a `claude` install only, the one host it was
|
|
64
65
|
* measured on and is gated for, and the console draws it under that install's cost breakdown.
|
|
65
66
|
* Every other host answers `null`: no bar, not a bar against a number nobody measured there.
|
|
66
67
|
*/
|
|
67
|
-
export const SKILL_LISTING_CEILING =
|
|
68
|
+
export const SKILL_LISTING_CEILING = 4_051;
|
|
68
69
|
|
|
69
70
|
/**
|
|
70
71
|
* THE TRADE OF `--shared-tier on`, stated once. `--help` (js/cli-table.json), the console's toggle
|
package/js/inspect/diff.mjs
CHANGED
|
@@ -40,17 +40,18 @@ import {
|
|
|
40
40
|
} from '../hosts/hosts.mjs';
|
|
41
41
|
import {
|
|
42
42
|
EMIT_HOST_SCOPE, defaultTheme, doctrinesForBuild, excludedRulesOfDir,
|
|
43
|
-
excludedSkillsOfDir, gatesOfDir, kitsOfDir, sharedTierOfDir,
|
|
43
|
+
contextWindowOfDir, excludedSkillsOfDir, gatesOfDir, kitsOfDir, sharedTierOfDir,
|
|
44
44
|
footprintOfDir, modeOfDir, postureOfDir,
|
|
45
45
|
trustOfDir,
|
|
46
46
|
readJsonMaybe, readMaybe, renderedTier, themeOfDir,
|
|
47
47
|
} from '../hosts/installs.mjs';
|
|
48
|
-
import { hashesOf, ownedState, safeLeaf } from '../hosts/owned.mjs';
|
|
48
|
+
import { hashesOf, ownedState, safeLeaf, textHash } from '../hosts/owned.mjs';
|
|
49
49
|
import { hostGlobalInstalls as globalInstalls } from './excludes.mjs';
|
|
50
50
|
import { unifiedDiff, splitLines } from '../lib/udiff.mjs';
|
|
51
51
|
import { printOut, printErr, readText, writeText, isFile } from '../lib/fs.mjs';
|
|
52
52
|
import { NOTES_DIRS, sharedPaths } from '../lib/machine-dir.mjs';
|
|
53
|
-
import { toPlatformPath } from '../lib/paths.mjs';
|
|
53
|
+
import { normcase, toPlatformPath } from '../lib/paths.mjs';
|
|
54
|
+
import { projectNotesDir } from '../hosts/spec-feedback.mjs';
|
|
54
55
|
import { relPosix } from '../lib/text.mjs';
|
|
55
56
|
|
|
56
57
|
/**
|
|
@@ -266,6 +267,8 @@ export function diffCollect({
|
|
|
266
267
|
kits: kitsOfDir(dir, host),
|
|
267
268
|
// The shared-tier marker, or an install built `--shared-tier on` reads its `Shared tier: on` line as drift.
|
|
268
269
|
sharedTier: sharedTierOfDir(dir, host),
|
|
270
|
+
// The context window, or a `1m` install reads its `Context window: 1m` line as drift.
|
|
271
|
+
contextWindow: contextWindowOfDir(dir, host),
|
|
269
272
|
// The gate switches, or a disarmed install reads its `<gate>: off` line as drift.
|
|
270
273
|
...gatesOfDir(dir, host),
|
|
271
274
|
// The tier root it rendered, or an install left relative reads every file as behind source.
|
|
@@ -280,6 +283,8 @@ export function diffCollect({
|
|
|
280
283
|
const manifest = readJsonMaybe(path.join(dir, GLOBAL_MANIFEST));
|
|
281
284
|
const deployedOwned = ownedSet(dir, manifest);
|
|
282
285
|
const hashes = hashesOf(manifest);
|
|
286
|
+
// The bases of the files an emit left to the user, read with `hashes`' own defensive reader.
|
|
287
|
+
const keptHashes = hashesOf({ hashes: manifest?.kept_hashes });
|
|
283
288
|
// STALE IS NOT AN EDIT. A file whose bytes still match the hash its emit recorded was never
|
|
284
289
|
// touched: it differs only because the source moved on, and the next rebuild overwrites it.
|
|
285
290
|
// Reporting it as "edited" told every install behind its source that it was hand-edited.
|
|
@@ -303,7 +308,18 @@ export function diffCollect({
|
|
|
303
308
|
// being behind, never an edit, with or without hashes.
|
|
304
309
|
const stale = rel === VERSION_MARKER
|
|
305
310
|
|| (hashed && ownedState(dir, rel, hashes) === 'unmodified');
|
|
306
|
-
|
|
311
|
+
// KEPT OR DIVERGED (spec 2026-11-13, D1/D6). The base is what the last emit wrote here:
|
|
312
|
+
// `hashes[rel]` while the rel is still owned, else the `kept_hashes[rel]` the emit that
|
|
313
|
+
// refused it carried forward. The edit loses nothing while the fresh render still hashes
|
|
314
|
+
// to that base. `tb` is the LOCATED render read through `readText` (CRLF folded), so
|
|
315
|
+
// `textHash` of it is the manifest's `fileHash` of the same bytes. No base: diverged.
|
|
316
|
+
let diverged;
|
|
317
|
+
if (!stale) {
|
|
318
|
+
const base = Object.hasOwn(hashes, rel) ? hashes[rel]
|
|
319
|
+
: Object.hasOwn(keptHashes, rel) ? keptHashes[rel] : null;
|
|
320
|
+
diverged = base === null || textHash(tb) !== base;
|
|
321
|
+
}
|
|
322
|
+
rec = { rel, status: stale ? 'stale' : 'edited', diff, ...(diverged !== undefined && { diverged }) };
|
|
307
323
|
}
|
|
308
324
|
} else if (isFile(a)) {
|
|
309
325
|
const body = splitLines(readText(a));
|
|
@@ -349,11 +365,28 @@ export const drifted = (files) => files.filter((f) => f.status !== 'linked');
|
|
|
349
365
|
*/
|
|
350
366
|
const localChanges = (files) => drifted(files).filter((f) => f.status !== 'stale');
|
|
351
367
|
|
|
352
|
-
/**
|
|
368
|
+
/**
|
|
369
|
+
* Where an install's notes are: its own notebook (where every note went before the two scopes,
|
|
370
|
+
* and a global install's until the fold), the machine notes in the tier's `notes/`, which every
|
|
371
|
+
* install's loops now write (D6), and, for a project install, the project notes in
|
|
372
|
+
* `<project>/notebook` (js/hosts/spec-feedback.mjs `projectNotesDir`, a linked worktree mapped to its main checkout). The project is the
|
|
373
|
+
* install's parent when the install is a host layer (`.claude`, `.opencode`, …), else the install
|
|
374
|
+
* itself. One folder is listed once, under its first label.
|
|
375
|
+
*/
|
|
353
376
|
function notesRoots(dir) {
|
|
354
377
|
const roots = [[path.join(dir, 'notebook'), 'notebook']];
|
|
355
|
-
try {
|
|
356
|
-
|
|
378
|
+
try { roots.push([sharedPaths().notes, 'notes']); } catch { /* no home: no tier */ }
|
|
379
|
+
if (!isGlobalInstall(null, dir)) {
|
|
380
|
+
const project = path.basename(dir).startsWith('.') ? path.dirname(dir) : dir;
|
|
381
|
+
roots.push([projectNotesDir(project), 'project-notebook']);
|
|
382
|
+
}
|
|
383
|
+
const seen = new Set();
|
|
384
|
+
return roots.filter(([root]) => {
|
|
385
|
+
const k = normcase(path.resolve(root));
|
|
386
|
+
if (seen.has(k)) return false;
|
|
387
|
+
seen.add(k);
|
|
388
|
+
return true;
|
|
389
|
+
});
|
|
357
390
|
}
|
|
358
391
|
|
|
359
392
|
/**
|
|
@@ -570,7 +603,12 @@ export function cmdDiff(args) {
|
|
|
570
603
|
if (stale.length) printOut(`[diff] ${stale.length} file(s) behind source — rebuild to update them\n`);
|
|
571
604
|
const notes = collectNotes(target);
|
|
572
605
|
if (notes.length) printOut(`[diff] ${notes.length} self-improvement note(s) to back-port\n`);
|
|
573
|
-
|
|
606
|
+
// The two states of an edit (spec 2026-11-13 §4): kept loses nothing, diverged misses an update.
|
|
607
|
+
for (const f of edited) {
|
|
608
|
+
printOut(` ~ ${f.rel} (edited in deployed — ${'diverged' in f && f.diverged === false
|
|
609
|
+
? 'source unchanged, nothing missed'
|
|
610
|
+
: 'the source has moved; review to back-port, or restore'})\n`);
|
|
611
|
+
}
|
|
574
612
|
for (const f of added) printOut(` + ${f.rel} (only in deployed — your addition)\n`);
|
|
575
613
|
for (const f of missing) printOut(` - ${f.rel} (in source, not deployed — re-emit to add)\n`);
|
|
576
614
|
for (const f of linked) printOut(` = ${f.rel} (a link — yours, left alone)\n`);
|
package/js/inspect/doctor.mjs
CHANGED
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
shimProblems, strayClaimProblems,
|
|
50
50
|
} from './checks-repo.mjs';
|
|
51
51
|
import { NOTE, isDoctorNote, sortedProblems, sortedUnique, stemOf, withTempDir } from './scan.mjs';
|
|
52
|
+
import { profileSetProblems } from '../maintain/profiles.mjs';
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
55
|
* Which themes doctor validates.
|
|
@@ -245,6 +246,9 @@ export function doctorCollect({
|
|
|
245
246
|
problems = problems.concat(ran('authoring', 'Authoring gates', authoringProblems()));
|
|
246
247
|
problems = problems.concat(ran('loops', 'Loop catalogue', loopProblems()));
|
|
247
248
|
problems = problems.concat(ran('factories', 'Factory catalogue', factoryProblems()));
|
|
249
|
+
// Every profile, Shipped and Personal, through the loader `setup --profile` uses, and every
|
|
250
|
+
// Personal file a Shipped name shadows (install profiles, D10, D36).
|
|
251
|
+
problems = problems.concat(ran('profiles', 'Install profiles', profileSetProblems()));
|
|
248
252
|
problems = problems.concat(ran('shim', 'Hook shim', shimProbs));
|
|
249
253
|
// Windows: a Claude install's hooks emitted for Git Bash on a machine that no longer has it
|
|
250
254
|
// misbehave under PowerShell — context/learn fail open, and the two gates fail CLOSED
|
package/js/inspect/inventory.mjs
CHANGED
|
@@ -105,7 +105,7 @@ export const SKILL_CLASS = {
|
|
|
105
105
|
// knowledge base, terminal) rather than about the user's code. They sat under
|
|
106
106
|
// `understand` before, which made that class a grab-bag.
|
|
107
107
|
wiki: 'harness', geneseed: 'harness', rule: 'harness', profile: 'harness',
|
|
108
|
-
'skill-forge': 'harness', adhd: 'harness',
|
|
108
|
+
'skill-forge': 'harness', adhd: 'harness', herdr: 'harness', 'opencode-cli': 'harness',
|
|
109
109
|
teach: 'learn', 'learn-mode': 'learn',
|
|
110
110
|
};
|
|
111
111
|
|
package/js/inspect/status.mjs
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
37
37
|
import path from 'node:path';
|
|
38
38
|
|
|
39
|
-
import { GATE_SWITCHES, THEMES, ROOT, loadKits, makeCfg } from '../build/source.mjs';
|
|
39
|
+
import { DEFAULT_CONTEXT_WINDOW, GATE_SWITCHES, THEMES, ROOT, loadKits, makeCfg } from '../build/source.mjs';
|
|
40
40
|
import { tuiInventory } from './inventory.mjs';
|
|
41
41
|
import { sourceGeneration } from '../build/render.mjs';
|
|
42
42
|
import { readVersion, sourceFingerprint } from '../build/version.mjs';
|
|
@@ -508,6 +508,8 @@ export function statusLines(d, color = false, boxed = true) {
|
|
|
508
508
|
packs, excl, ...(p.excludeSkills?.length ? [`skills off: ${p.excludeSkills.join(',')}`] : []),
|
|
509
509
|
...(p.kits?.length ? [`kits: ${p.kits.join(',')}`] : []),
|
|
510
510
|
...(p.sharedTier ? ['shared tier: on'] : []),
|
|
511
|
+
// Elided at the default, like the shared tier, so a default row prints what it did.
|
|
512
|
+
...(p.contextWindow && p.contextWindow !== DEFAULT_CONTEXT_WINDOW ? [`context window: ${p.contextWindow}`] : []),
|
|
511
513
|
// Each elided when armed. The law's text still binds; only its tool-boundary gate is off.
|
|
512
514
|
...GATE_SWITCHES.filter((g) => p[g.key] === false)
|
|
513
515
|
.map((g) => `${g.marker.toLowerCase()}: off${g.law ? ` (Law ${g.law} text still binds)` : ''}`)]
|
package/js/inspect/validate.mjs
CHANGED
|
@@ -155,6 +155,7 @@ export function cmdValidate(args) {
|
|
|
155
155
|
theme: args.theme, footprint: args.footprint, posture: args.posture, mode: args.mode,
|
|
156
156
|
trust: args.trust, doctrines: args.doctrines, excludeRules: args.excludeRules,
|
|
157
157
|
excludeSkills: args.excludeSkills, kits: args.kits, sharedTier: args.sharedTier === 'on',
|
|
158
|
+
contextWindow: args.contextWindow,
|
|
158
159
|
...Object.fromEntries(GATE_SWITCHES.map((g) => [g.key, args[g.arg] ? false : null])),
|
|
159
160
|
};
|
|
160
161
|
let scanDirs;
|
package/js/lib/machine-dir.mjs
CHANGED
|
@@ -30,6 +30,14 @@ export const LEGACY_WIKI_SEED = 'cccc917c34e6b990e821620bdb4739090151885ab71b6e8
|
|
|
30
30
|
/** Where the self-improvement loops write, relative to a notes root. */
|
|
31
31
|
export const NOTES_DIRS = ['skill-notes', 'agent-notes'];
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* The tier's root as a PROJECT emit names it. A project install's files may be committed and read
|
|
35
|
+
* on a teammate's machine, so they never carry this machine's absolute path: the default location
|
|
36
|
+
* in `~` form, the same bytes on every machine. A relocated `$XDG_CONFIG_HOME` is the one case it
|
|
37
|
+
* misses: there the hook still writes to the real tier, and a project's step 0 reads the default.
|
|
38
|
+
*/
|
|
39
|
+
export const PORTABLE_MACHINE_DIR = '~/.config/geneseed';
|
|
40
|
+
|
|
33
41
|
export function machineDir() {
|
|
34
42
|
const base = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config');
|
|
35
43
|
return path.join(base, 'geneseed');
|
package/js/lib/paths.mjs
CHANGED
|
@@ -12,6 +12,9 @@ import path from 'node:path';
|
|
|
12
12
|
/** Does `root` sit directly in a `node_modules`? Any name: an npm alias installs under its own. */
|
|
13
13
|
export const inNodeModules = (root) => path.basename(path.dirname(root)).toLowerCase() === 'node_modules';
|
|
14
14
|
|
|
15
|
+
/** Does `root` sit in npm's npx cache (`…/_npx/<hash>/…`)? npm prunes that cache. */
|
|
16
|
+
export const inNpxCache = (root) => root.split(/[\\/]/).includes('_npx');
|
|
17
|
+
|
|
15
18
|
/**
|
|
16
19
|
* Is `root` a lasting install of the npm package, `…/node_modules/geneseed`? A path rule, so
|
|
17
20
|
* `migrate` can answer under the CLI's spawn ban. An npx cache is not one: npm prunes it, and the
|
|
@@ -20,7 +23,7 @@ export const inNodeModules = (root) => path.basename(path.dirname(root)).toLower
|
|
|
20
23
|
* upgrade if a project-local `migrate` ever proves real.
|
|
21
24
|
*/
|
|
22
25
|
export const isNpmPackageDir = (root) => inNodeModules(root) && path.basename(root).toLowerCase() === 'geneseed'
|
|
23
|
-
&& !root
|
|
26
|
+
&& !inNpxCache(root);
|
|
24
27
|
|
|
25
28
|
const { X_OK } = constants;
|
|
26
29
|
/**
|