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
package/docs/web-ui.md
CHANGED
|
@@ -75,9 +75,9 @@ Every `/api/*` read takes and checks the pair, with these exceptions:
|
|
|
75
75
|
- `/api/ping` and `/api/jobs` ignore it.
|
|
76
76
|
- The machine-wide reads also ignore it: `/api/update`, `/api/installs`, `/api/fleet`, `/api/migrate/preview`,
|
|
77
77
|
`/api/kits`, `/api/usage`, `/api/gates`, `/api/excludes`, `/api/mcp`, `/api/loops/active`,
|
|
78
|
-
`/api/factories/active`, `/api/activity`, and the Library's skill, agent, memory and
|
|
79
|
-
`/api/catalog/skills`, `/api/catalog/agents`, `/api/catalog/memory
|
|
80
|
-
`/api/catalog/notebook`. Such a read does not check the pair, and its answer does not change
|
|
78
|
+
`/api/factories/active`, `/api/activity`, and the Library's skill, agent, memory, notebook, wiki and config lists,
|
|
79
|
+
`/api/catalog/skills`, `/api/catalog/agents`, `/api/catalog/memory`,
|
|
80
|
+
`/api/catalog/notebook`, `/api/catalog/wiki` and `/api/catalog/config`. Such a read does not check the pair, and its answer does not change
|
|
81
81
|
with the pair. The Activity detail (`/api/activity/<id>`) and the Activity toggle still take
|
|
82
82
|
the pair.
|
|
83
83
|
|
|
@@ -88,7 +88,7 @@ tier hold one memory store: it is listed under the first of them, and `/api/cata
|
|
|
88
88
|
them all in `sharedInstalls`. Each row is one id (kind and name), and
|
|
89
89
|
its `installs` field names the installs that have it, as `host:scope:root` keys (the same keys
|
|
90
90
|
as `/api/usage`). An id that only some installs have lists only those installs, so an exclusion
|
|
91
|
-
stays visible. The
|
|
91
|
+
stays visible. The laws section stays install-scoped. `/api/item/skill/<name>` and
|
|
92
92
|
`/api/item/agent/<name>` stay install-scoped too, because each install renders its own copy in
|
|
93
93
|
its own theme and footprint. With a pair, the item is that install's copy, and an id that
|
|
94
94
|
install lacks gets a 404. Without a pair, the item is the copy of the first install that has
|
|
@@ -485,7 +485,9 @@ screen the run list stacks above the detail.
|
|
|
485
485
|
files), in sync or not checked, shows local edits apart from stale files, and links to Local edits.
|
|
486
486
|
`#/harnesses` and `#/themes` both still resolve here, so old links and bookmarks keep
|
|
487
487
|
working. *Make default* on an active row sets the default install (above), and a per-repo
|
|
488
|
-
install's panel has the **Shared tier** switch, with its benefit and cost beside it.
|
|
488
|
+
install's panel has the **Shared tier** switch, with its benefit and cost beside it. A Claude
|
|
489
|
+
Code install's panel has the **Context window** picker (`200k`/`1m`, `--context-window`), with
|
|
490
|
+
a line that says what it writes into `settings.json`; no other host reads those keys.
|
|
489
491
|
- The **Voice** card is the former Themes tab, kept as a REFERENCE rather than a second
|
|
490
492
|
control: a collapsed row that opens to every shipped voice with its tagline, the
|
|
491
493
|
deployed one pinned first and marked. It is the one place you can read what a voice
|
|
@@ -505,7 +507,7 @@ screen the run list stacks above the detail.
|
|
|
505
507
|
- "Deploy to folder…" and "Rebuild all" apply to the whole set. An **Excluded folders**
|
|
506
508
|
card (shown once a global install exists) manages sovereign repos — folders where every
|
|
507
509
|
global harness goes dormant (hooks stay silent, the global preamble never loads);
|
|
508
|
-
add or remove one here, the web mirror of `
|
|
510
|
+
add or remove one here, the web mirror of `geneseed exclude add|remove|list`.
|
|
509
511
|
- **Settings** (`#/settings`; `#/about` and `#/installs/server` resolve here) — a rail entry of its
|
|
510
512
|
own, about the tool and never one install: a sheet with a section index. **Machine**:
|
|
511
513
|
version + Update (labelled by how this copy updates: git pull, npm install -g, or the command
|
package/harness.config.json
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
"_comment": "version is a human-readable release label only; the canonical identity of an installed harness is the source fingerprint stamped in .geneseed-version (see `harness version`), not this string.",
|
|
3
3
|
"theme": "neutral",
|
|
4
4
|
"product": "Geneseed",
|
|
5
|
-
"version": "5.
|
|
5
|
+
"version": "5.5.0"
|
|
6
6
|
}
|
package/js/README.md
CHANGED
|
@@ -66,6 +66,7 @@ as a per-host install at project or global scope.
|
|
|
66
66
|
| `emit-opencode.mjs` | The OpenCode emits — a project's `.opencode/` and the global config dir. Deliberate twin of the above |
|
|
67
67
|
| `emit-common.mjs` | Constants, tree walkers, and the three writers BOTH global emits share. Decides no host |
|
|
68
68
|
| `fold.mjs` | The fold: moves a global install's stores into the shared tier, in the emit. Moves aside, never deletes; a second run writes nothing |
|
|
69
|
+
| `notes-migrate.mjs` | A project install's spec-feedback notes, once kept in its host layer's notebook (`.claude/notebook`, …), merged into `<project>/notebook` on its next emit. No cap, read back, then set aside, never deleted |
|
|
69
70
|
| `retired-skills.mjs` | Skill folders an old build rendered under a name that no longer ships: the canonical global emit moves a plain, fingerprinted, unowned one to `archived-skills/`; `migrate --dry-run` reads the same split |
|
|
70
71
|
| `rule-decide.mjs` | The decisions on the draft: the approval flow of `src/skills/rule/approve.md`, as the console applies it. Write order: target, ledger, draft |
|
|
71
72
|
| `stubs.mjs` | Write-once seed files: context, wiki, rules, excludes, profile, `.gitignore`, memory/notebook indexes |
|
|
@@ -73,6 +74,7 @@ as a per-host install at project or global scope.
|
|
|
73
74
|
| `driver.mjs` | The generator driver: the nine emit targets, per-host emit orchestration, the prune and the manifest. `bin/build-driver.mjs` is only its entry |
|
|
74
75
|
| `args.mjs` | The generator's flag surface: `harness.config.json` defaults, the `--emit`/`--theme`/`--footprint` parse tables and choices, `-h`, and `die` (a throw, so `rebuild-all` survives one bad install) |
|
|
75
76
|
| `generate.mjs` | CLI verbs `build`, `prompt`, `theme`, `rebuild-all` — the thin face over `driver.mjs` |
|
|
77
|
+
| `profile.mjs` | An install's profile (`installProfile`, `setupBuildArgs`, `rebuildCommand`: every setting read back, and the argv that re-emits it) and the preserve guard: a build over an existing install refuses to change a setting it was not given, unless `--reset`. A leaf the driver may import; `generate.mjs` re-exports the three |
|
|
76
78
|
| `catalog.mjs` | `geneseed catalog` — prints the shipped roster. Classifies nothing itself |
|
|
77
79
|
| `export.mjs` | `geneseed export` — skills, agents and the constitution as catalogue entities for a shared library (`SKILL.md`/`AGENT.md` + `metadata.yaml`), shaped by a profile kept outside the repo. One way, claim-on-create, not an install |
|
|
78
80
|
| `themes.mjs` | Maintainer-only `--sync-themes`: inserts `_TEMPLATE.json`'s missing keys into the committed themes |
|
|
@@ -97,14 +99,16 @@ user co-owns, and the hook verbs those emitted configs then run.
|
|
|
97
99
|
| `hooks.mjs` | The gate verbs, run on every tool call: `git-gate`, `rule-gate`, `tool-gate` (the two gates fused, for Bob), plus `ask`/the gate ledger/`guardGate`. `--host` picks the verdict dialect |
|
|
98
100
|
| `hooks-context.mjs` | The `context` verb — SessionStart: session files (shared tier first on a global install, wiki rendered) plus the repo's context docs; `sessionStartSize`, the console's read of the same payload |
|
|
99
101
|
| `ownership-gate.mjs` | The ownership first-write gate, last in `rule-gate`: in an application repo (git root + build manifest) whose root `AGENTS.md` has no `## Ownership` section, denies the session's first write once (a tmpdir marker per session). Builtins + `gitRootOf` only. Twin: the OpenCode guard plugin |
|
|
100
|
-
| `hooks-done.mjs` | The done gate (#289): on Stop, inside `learn` and before its spawn, judges a turn that edited files against the project's checks — blocks until `.geneseed/done-checks.txt`'s checks passed after the last edit; without that file, the inferred checks are advisory (a `systemMessage`, never a block) |
|
|
102
|
+
| `hooks-done.mjs` | The done gate (#289): on Stop and SubagentStop, inside `learn` and before its spawn, judges a turn (a sub-agent's own, at SubagentStop, against each git root it wrote under) that edited files against the project's checks — blocks until `.geneseed/done-checks.txt`'s checks passed after the last edit; without that file, the inferred checks are advisory (a `systemMessage`, never a block) |
|
|
101
103
|
| `done-checks.mjs` | Where the done gate's checks come from: `.geneseed/done-checks.txt`, else inferred from the git root's manifests (package.json scripts, pom.xml, Gradle, pyproject.toml, Cargo.toml, go.mod), each a group of accepted command forms; plus `doneLine`, the SessionStart line `context` prints. Spawn-free: `context` is in the CLI's closure. Twin: the OpenCode context plugin |
|
|
102
104
|
| `hooks-learn.mjs` | The `learn` verb — Stop/SubagentStop/PreCompact distiller; the hook path's ONE spawn (`$GENESEED_LLM`) |
|
|
105
|
+
| `spec-feedback.mjs` | On SubagentStop, inside `learn` and with no model: copies the `spec-feedback:` lines of a sub-agent's final report into `agent-notes/<name>.md` (and `_general.md`). On Stop, the `[skill:<name>]` lines of the main reply into `skill-notes/<name>.md` (and `_general.md`). Each line picks its scope: the machine notes (the tier's `notes/`) or, tagged `:project`, the project's `<project>/notebook/`. Its pure part (parser, routing table, merge) is a twin in the OpenCode learn plugin |
|
|
103
106
|
| `hooks-prims.mjs` | The Python path/text primitives the hook verbs share (`splitLines`, `readStdin`, a never-throwing `isFile`), plus the activity off switch (`activityOn`) and the do-nothing `activity` verb |
|
|
104
107
|
| `store-watch.mjs` | The change report: a session's baseline of the rule and memory files (`writeBaseline`, from the hook entry after `context`), the compare at Stop (`storeReport`, from `learn`), and `recordOwnWrites`, around Geneseed's own writers. It detects; it prevents nothing. The OpenCode guard holds the twin |
|
|
105
108
|
| `activity.mjs` | The hook-side activity writer and the owner of snapshot liveness: `recordActivity` (one payload into `<root>/activity/`), `readTranscriptDelta`, `sweepActivity` (archive, newest 50, 7 days). Loaded only when tracking is on; never prints |
|
|
106
109
|
| `hook-tap.mjs` | The opt-in tap: with `GENESEED_HOOK_TAP=<dir>` set, one file per hook call recording the payload's SHAPE (keys kept, every string replaced by its type and length), for fixtures from a host the canary cannot run. Refuses a directory inside a git worktree. Imported only when the variable is set; never prints, never throws |
|
|
107
|
-
| `
|
|
110
|
+
| `agent-runs.mjs` | The agent outcome ledger: on SubagentStop, inside `learn` and with no model, one line per finished named sub-agent into `notebook/agent-runs.jsonl` (spec hash, done-gate end and blocks, tool and refused calls, feedback lines, report). Its marker table, hash and line are a twin in the OpenCode learn plugin |
|
|
111
|
+
| `usage.mjs` | The usage counter `tool-gate` runs: one `{day, kind, name}` line per Skill or subagent call into `notebook/usage.jsonl`; `activity` adds a `via: "slash"` line for a typed `/<skill>`. A global install stands down beside a wired project install. Hook path: builtins only, silent, never throws |
|
|
108
112
|
| `memory-files.mjs` | The memory store's file format — `frontmatter`, `MEMORY.md` index writes, agent lessons, consolidate — the `user-rules.md` parser, the draft's format and the fold's ledger reader. No spawn: the CLI, web console and fold import it |
|
|
109
113
|
| `geneseed-dir.mjs` | The Node writers into a project's `<git root>/.geneseed/`: the personal-by-default `.gitignore` (`GENESEED_GITIGNORE`, pinned to the two OpenCode copies), and the protected-checks seed every project emit runs (`seedProtectedChecks`: seed once when absent, then the user's — never recorded, rewritten or uninstalled). Never throws, never writes through a link. Spawn-free |
|
|
110
114
|
| `gitref.mjs` | fs/path-only: `gitRootOf`, `gitDirOf`, `gitCommonDirOf`, `currentBranch`, `protectedBranches`, `stashExists`, `loopLaunched`, `headCommit` — read straight off `.git`, never spawn git. Shared by `hooks.mjs`'s git-gate, `loss.mjs` and `js/loop/cli.mjs`'s commit-message writer; `headCommit` by `js/factory/cli.mjs` (R2) |
|
|
@@ -141,6 +145,7 @@ Everything that inspects an already-built or already-deployed harness and report
|
|
|
141
145
|
| `scan.mjs` | The shared walk/sort/strip/test primitives every `checks-*` uses. Owns no judgement itself |
|
|
142
146
|
| `validate.mjs` | The `validate` verb (the generator's old `--validate-only`): renders a sandbox, scans it for tokens and dead links, own exit contract |
|
|
143
147
|
| `inventory.mjs` | The one catalog walk and its taxonomy tables, read by status, the TUI and the web console |
|
|
148
|
+
| `agent-scores.mjs` | `geneseed catalog agents --scores`: the outcome ledger read back, one row per agent and spec hash per active install. Read-only |
|
|
144
149
|
| `status.mjs` | `geneseed status` and `version` — the panel data, counts, accent colour, version verdict |
|
|
145
150
|
| `cost.mjs` | What one install injects every session, by part (root file, skill and agent lists, session files), in characters; owns `CARRIER_CEILING`, which the smoke test gates and the console draws, and `SKILL_LISTING_CEILING`, which the smoke test gates and the console draws on a Claude Code install |
|
|
146
151
|
| `diff.mjs` | `geneseed diff` — what a deployed install has that a fresh render of `src/` does not |
|
|
@@ -233,7 +238,9 @@ Verbs that change an install that already exists, as opposed to rendering one.
|
|
|
233
238
|
| module | owns |
|
|
234
239
|
|---|---|
|
|
235
240
|
| `update.mjs` | `upgrade`/`bootstrap` — git pull, doctor gate, rebuild, each via a respawn |
|
|
236
|
-
| `setup.mjs` | The install wizard. Its prompts go through `js/lib/prompt.mjs`'s stdin readers |
|
|
241
|
+
| `setup.mjs` | The install wizard. Its prompts go through `js/lib/prompt.mjs`'s stdin readers. `setup --profile` installs a profile with no prompt; `profile apply` (`cmdProfileApply`) shares its build loop |
|
|
242
|
+
| `profiles.mjs` | Install profiles from two sources, Shipped (`profiles/*.json`) and Personal (`<machine tier>/profiles/`): load and validate against the generator's own sources, the per-host argv (global or project), `profile save` |
|
|
243
|
+
| `profile-scope.mjs` | The scope half of `profile apply`: the project folder check (shared with the console's deploy) and what a global install still runs inside a project (`globalLayering`) |
|
|
237
244
|
| `uninstall.mjs` | Removes or disables an install: manifest-driven reversal, plus stash deactivate/reactivate |
|
|
238
245
|
| `migrate.mjs` | `geneseed migrate` — all-or-nothing re-emit moving installs onto the npm install shape |
|
|
239
246
|
| `memory.mjs` | `geneseed memory list|rm|consolidate` — CLI-side fact removal (archive by default, `--purge` deletes), twin of the web delete endpoint; `consolidate` rebuilds the index by hand, twin of the hook's `learn --consolidate` |
|
|
@@ -274,6 +281,7 @@ the deployed harness as JSON.
|
|
|
274
281
|
| `update-check.mjs` | Is a newer release on npm? Answers from memory, refreshes in the background (a day when it got an answer, an hour when it did not), `null` on any failure, never asked under `node --test` |
|
|
275
282
|
| `gates-api.mjs` | `GET /api/gates`: gate asks per rule per day over 30 days, read off every installed harness's `notebook/gates.jsonl` (the Overview's sparklines) |
|
|
276
283
|
| `usage-api.mjs` | `GET /api/usage`: the 30-day skill and agent call counts across every installed harness, the never-fired list, a fleet-wide `names` list (per-name 30-day counts, installs, daily series, last day seen), and skips lines older than 90 days in each `notebook/usage.jsonl` |
|
|
284
|
+
| `profiles-api.mjs` | The Profiles tab: `GET /api/profiles` (both sources, the installs that follow each, an apply preview) and the `profile-apply` / `profile-save` jobs, which run the CLI's own verb |
|
|
277
285
|
| `user-files.mjs` | The fingerprint-guarded editors for `user-rules.md` (incl. memory promotion) and `PROFILE.md`, read and write |
|
|
278
286
|
| `actions.mjs` | The other mutating endpoints — memory delete, MCP, excludes, installs, view, restore — plus install/deploy argv, and `installView`, the per-request install behind the one (host, path) allowlist |
|
|
279
287
|
| `daemon.mjs` | Detached web start/stop/status/restart, the `.geneseed-web.json` record, and `openUrl` |
|
package/js/build/args.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { parseArgs as nodeParseArgs } from 'node:util';
|
|
|
11
11
|
import { withPlatformNewlines } from '../lib/fs.mjs';
|
|
12
12
|
import path from 'node:path';
|
|
13
13
|
import {
|
|
14
|
-
CONFIG, discoverNames, GATE_SWITCHES, PACK_ORDER, SRC, knownRuleIds, knownSkillIds, linkedSkillIds, loadKits,
|
|
14
|
+
CONFIG, CONTEXT_WINDOWS, DEFAULT_CONTEXT_WINDOW, discoverNames, GATE_SWITCHES, PACK_ORDER, SRC, knownRuleIds, knownSkillIds, linkedSkillIds, loadKits,
|
|
15
15
|
resolveSkillNames, retiredRuleAddresses, reusedRuleAddresses, ruleCanon, skillAliases,
|
|
16
16
|
} from './source.mjs';
|
|
17
17
|
// The loop engine's trust presets — the `--trust` choices. `score.mjs` imports nothing, which is
|
|
@@ -102,7 +102,7 @@ export function configDefaults(config = CONFIG, rules = ruleCanon(SRC).rules) {
|
|
|
102
102
|
export const VALUED = {
|
|
103
103
|
'--theme': 'theme', '--posture': 'posture', '--mode': 'mode', '--trust': 'trust',
|
|
104
104
|
'--doctrines': 'doctrines', '--exclude-rules': 'excludeRules', '--exclude-skills': 'excludeSkills',
|
|
105
|
-
'--kits': 'kits', '--shared-tier': 'sharedTier',
|
|
105
|
+
'--kits': 'kits', '--shared-tier': 'sharedTier', '--context-window': 'contextWindow',
|
|
106
106
|
'--out': 'out', '--target': 'out', '--emit': 'emit',
|
|
107
107
|
'--footprint': 'footprint', '--root': 'root', '--config-dir': 'cfgDir',
|
|
108
108
|
};
|
|
@@ -118,6 +118,10 @@ export const FLAGS = {
|
|
|
118
118
|
// One build's instruction, never recorded: Geneseed's copy replaces a file the user edited
|
|
119
119
|
// or put at a name Geneseed ships. `claimer` (js/hosts/native.mjs) holds the rule.
|
|
120
120
|
'--force': 'force',
|
|
121
|
+
// One build's consent: the settings this build does not pass return to their defaults on the
|
|
122
|
+
// install it targets. Without it the preserve guard (js/build/profile.mjs) refuses such a
|
|
123
|
+
// build. Never recorded, never replayed.
|
|
124
|
+
'--reset': 'reset',
|
|
121
125
|
'-v': 'verbose', '--verbose': 'verbose',
|
|
122
126
|
};
|
|
123
127
|
|
|
@@ -163,6 +167,7 @@ export function choicesFor() {
|
|
|
163
167
|
'--mode': discoverNames('modes', 'direct'),
|
|
164
168
|
'--trust': Object.keys(PRESETS),
|
|
165
169
|
'--shared-tier': ['on', 'off'],
|
|
170
|
+
'--context-window': Object.keys(CONTEXT_WINDOWS),
|
|
166
171
|
};
|
|
167
172
|
}
|
|
168
173
|
|
|
@@ -372,11 +377,16 @@ export function parseArgs(argv, defaults) {
|
|
|
372
377
|
excludeRules: defaults.excludeRules,
|
|
373
378
|
excludeSkills: defaults.excludeSkills ?? [],
|
|
374
379
|
kits: defaults.kits ?? [],
|
|
375
|
-
sharedTier: 'off',
|
|
380
|
+
sharedTier: 'off', contextWindow: DEFAULT_CONTEXT_WINDOW,
|
|
376
381
|
out: 'Harness', emit: 'files', footprint: 'lean', root: null,
|
|
377
|
-
syncThemes: false, validateOnly: false, verbose: false, pruneGates: false, force: false,
|
|
382
|
+
syncThemes: false, validateOnly: false, verbose: false, pruneGates: false, force: false, reset: false,
|
|
378
383
|
...Object.fromEntries(GATE_SWITCHES.map((g) => [g.arg, false])),
|
|
379
384
|
};
|
|
385
|
+
// The keys the caller PASSED, for the preserve guard: after this walk a default and a value
|
|
386
|
+
// typed equal to it look the same, and only the second is intent. Non-enumerable, so
|
|
387
|
+
// `makeCfg(args)`'s rest spread never sees it.
|
|
388
|
+
const given = new Set();
|
|
389
|
+
Object.defineProperty(args, 'given', { value: given, enumerable: false });
|
|
380
390
|
const { tokens } = nodeParseArgs({
|
|
381
391
|
args: argv, options: PARSE_OPTIONS, allowPositionals: true, strict: false, tokens: true,
|
|
382
392
|
});
|
|
@@ -393,6 +403,7 @@ export function parseArgs(argv, defaults) {
|
|
|
393
403
|
if (tok.kind === 'option' && VALUED_BY_NAME[tok.name] !== undefined) {
|
|
394
404
|
if (tok.value === undefined) die(2, `argument ${tok.rawName}: expected one argument`);
|
|
395
405
|
args[VALUED_BY_NAME[tok.name]] = tok.value;
|
|
406
|
+
given.add(VALUED_BY_NAME[tok.name]);
|
|
396
407
|
continue;
|
|
397
408
|
}
|
|
398
409
|
// `tok.value === undefined` excludes `--sync-themes=x` from matching here — a store_true
|
|
@@ -402,6 +413,7 @@ export function parseArgs(argv, defaults) {
|
|
|
402
413
|
// given), so this must compare the VALUE, not `'value' in tok` — the key is always there.
|
|
403
414
|
if (tok.kind === 'option' && tok.value === undefined && FLAG_BY_NAME[tok.name] !== undefined) {
|
|
404
415
|
args[FLAG_BY_NAME[tok.name]] = true;
|
|
416
|
+
given.add(FLAG_BY_NAME[tok.name]);
|
|
405
417
|
continue;
|
|
406
418
|
}
|
|
407
419
|
// Every other shape — an unrecognized option, a bare positional, or `--` (which `parseArgs`
|
package/js/build/catalog.mjs
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { helpWidth } from '../ui/cli.mjs';
|
|
27
27
|
import { tuiInventory } from '../inspect/inventory.mjs';
|
|
28
28
|
import { defaultTheme, installedDefaults } from '../hosts/installs.mjs';
|
|
29
|
-
import { printOut } from '../lib/fs.mjs';
|
|
29
|
+
import { printErr, printOut } from '../lib/fs.mjs';
|
|
30
30
|
import { dwidth, fit, icon, truncd, tuiEntries } from '../ui/tui.mjs';
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -119,6 +119,16 @@ export function catalogLines(inv, section, width, showSource = false) {
|
|
|
119
119
|
* validator here, and the entry point's `exitCode` arm carries the refusal out.
|
|
120
120
|
*/
|
|
121
121
|
export function cmdCatalog(args) {
|
|
122
|
+
// `--scores` reads the installs' outcome ledgers, not the roster: its own module, loaded only
|
|
123
|
+
// when asked (js/inspect/agent-scores.mjs). It scores agents alone, so any other section, or
|
|
124
|
+
// none, refuses: the command line must say `agents`.
|
|
125
|
+
if (args.scores) {
|
|
126
|
+
if (args.section !== 'agents') {
|
|
127
|
+
printErr(`[catalog] --scores reads agent runs: use \`geneseed catalog agents --scores\`.\n`);
|
|
128
|
+
return 2;
|
|
129
|
+
}
|
|
130
|
+
return import('../inspect/agent-scores.mjs').then((m) => m.cmdAgentScores());
|
|
131
|
+
}
|
|
122
132
|
const inst = installedDefaults();
|
|
123
133
|
const theme = args.theme || inst.theme || defaultTheme();
|
|
124
134
|
// The install's own pack selection, so an inactive pack's rules are listed and MARKED
|
package/js/build/driver.mjs
CHANGED
|
@@ -38,7 +38,7 @@ import path from 'node:path';
|
|
|
38
38
|
import { build, phaseLog } from './bundle.mjs';
|
|
39
39
|
import { emitClaudeRender } from './emit-claude.mjs';
|
|
40
40
|
import { emitOpencodeRender, emitOpencodeGlobalRender } from './emit-opencode.mjs';
|
|
41
|
-
import { settingsIntegrityCheck } from '../hosts/settings.mjs';
|
|
41
|
+
import { loadJsonObject, settingsIntegrityCheck } from '../hosts/settings.mjs';
|
|
42
42
|
import { hookRunnerEntry } from '../hosts/shim.mjs';
|
|
43
43
|
import { writeText, withPlatformNewlines, isFile, withWriteRecord } from '../lib/fs.mjs';
|
|
44
44
|
import { parseJson, jsonDumpsIndent } from '../lib/json.mjs';
|
|
@@ -59,20 +59,21 @@ import { seedProtectedChecks } from '../hosts/geneseed-dir.mjs';
|
|
|
59
59
|
// status` renders to count, so `bin/geneseed-cli.mjs` needs the same checkout paths and the
|
|
60
60
|
// same cfg.
|
|
61
61
|
import {
|
|
62
|
-
GATE_SWITCHES, ROOT, makeCfg,
|
|
62
|
+
CONTEXT_WINDOWS, GATE_SWITCHES, ROOT, makeCfg,
|
|
63
63
|
} from './source.mjs';
|
|
64
64
|
|
|
65
65
|
// P5f moved these, for the same arithmetic a third time: `harness rebuild-all` reads the
|
|
66
66
|
// registry to find every install it must re-emit, and a CLI verb may not reach into a driver
|
|
67
67
|
// for a reader. See js/inspect/registry.mjs.
|
|
68
68
|
import { registryRecord, registryRoots } from '../inspect/registry.mjs';
|
|
69
|
-
import { kitsOfDir } from '../hosts/installs.mjs';
|
|
69
|
+
import { installedDefaults, kitsOfDir } from '../hosts/installs.mjs';
|
|
70
70
|
|
|
71
71
|
// P2. `--sync-themes` crossed into its own module rather than into this file: it is 90 lines
|
|
72
72
|
// of textual surgery over committed files with a corpus of its own, and it is the half of the
|
|
73
73
|
// maintainer pair that needs nothing this driver is banned from having.
|
|
74
74
|
import { syncThemes } from './themes.mjs';
|
|
75
75
|
import { configDefaults, die, parseArgs } from './args.mjs';
|
|
76
|
+
import { guardTarget, preserveRefusal, preserveRefusalText } from './profile.mjs';
|
|
76
77
|
|
|
77
78
|
export { parseDriverArgs } from './args.mjs';
|
|
78
79
|
|
|
@@ -134,6 +135,24 @@ function preambleExclude(claudeMd, host) {
|
|
|
134
135
|
return resolvePath(path.join(globalDir, 'CLAUDE.md')).split(path.sep).join('/');
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
/**
|
|
139
|
+
* The skill-listing keys (`CONTEXT_WINDOWS`) the USER-level Claude Code settings file already
|
|
140
|
+
* sets, for a Claude Code PROJECT emit — `[]` for every other emit. Project-local settings
|
|
141
|
+
* outrank `~/.claude/settings.json`, so a project value would silently undercut a global `1m`
|
|
142
|
+
* install or a value the user set there by hand; the project emit leaves those keys to the user
|
|
143
|
+
* level. Resolved here, in the driver, for `preambleExclude`'s reason: the render half must never
|
|
144
|
+
* resolve a config dir. An unreadable file sets nothing.
|
|
145
|
+
*/
|
|
146
|
+
function userListingKeys(host, scope) {
|
|
147
|
+
if (host !== 'claude' || scope !== 'project') return [];
|
|
148
|
+
let file;
|
|
149
|
+
try { file = path.join(claudeConfigDir(), 'settings.json'); } catch { return []; }
|
|
150
|
+
const { state, data } = loadJsonObject(file);
|
|
151
|
+
if (state !== 'ok') return [];
|
|
152
|
+
const keys = new Set(Object.values(CONTEXT_WINDOWS).flatMap((w) => Object.keys(w)));
|
|
153
|
+
return [...keys].filter((k) => Object.hasOwn(data, k));
|
|
154
|
+
}
|
|
155
|
+
|
|
137
156
|
/**
|
|
138
157
|
* `_build_global._warn_bob_global_over_project` — informational, never auto-removes.
|
|
139
158
|
*
|
|
@@ -259,6 +278,18 @@ function pruneOwned(oc, oldOwned, owned, oldHashes = {}, editRefused = [], force
|
|
|
259
278
|
*/
|
|
260
279
|
const keptKey = (kept) => (kept && kept.length ? { kept: [...kept].sort() } : {});
|
|
261
280
|
|
|
281
|
+
/**
|
|
282
|
+
* The manifest's `kept_hashes` (spec 2026-11-13 §1): for each rel an emit left to the user after
|
|
283
|
+
* an edit, the hash the last emit that WROTE it recorded — the base `diffCollect` needs to tell a
|
|
284
|
+
* kept edit from a diverged one after the rel has left `owned`. Read with `hashesOf`, so a
|
|
285
|
+
* malformed map empties as `hashes` does; written only when non-empty, so a clean manifest is
|
|
286
|
+
* byte-identical (`golden.mjs --idempotent`). Keys sorted, like `hashes`.
|
|
287
|
+
*/
|
|
288
|
+
const keptHashesOf = (doc) => hashesOf({ hashes: doc && doc.kept_hashes });
|
|
289
|
+
const keptHashesKey = (h) => (h && Object.keys(h).length
|
|
290
|
+
? { kept_hashes: Object.fromEntries(Object.entries(h).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) }
|
|
291
|
+
: {});
|
|
292
|
+
|
|
262
293
|
/**
|
|
263
294
|
* Whether this PROJECT emit seeds `<git root>/.geneseed/protected-checks.txt`. A real emit does;
|
|
264
295
|
* a sandbox emit must not, because the seed walks UP to the git root and a sandbox under a temp
|
|
@@ -334,6 +365,7 @@ function emitOpencode(cfg, args, out) {
|
|
|
334
365
|
const oldEdit = recordedEdit(doc);
|
|
335
366
|
const oldGates = recordedGates(doc);
|
|
336
367
|
const oldHashes = hashesOf(doc);
|
|
368
|
+
const oldKeptHashes = keptHashesOf(doc);
|
|
337
369
|
|
|
338
370
|
const agentPathRel = relUnder(out, root);
|
|
339
371
|
const agentPath = agentPathRel ? `${agentPathRel}/AGENT.md` : 'AGENT.md';
|
|
@@ -345,9 +377,9 @@ function emitOpencode(cfg, args, out) {
|
|
|
345
377
|
{
|
|
346
378
|
theme: args.theme, out, root, footprint: args.footprint,
|
|
347
379
|
nativeCatalog: hostCatalogsNatively('opencode'), oldOwned, manifestExisted, agentPath,
|
|
348
|
-
oldDenies, oldEdit, oldHashes, oldGates,
|
|
380
|
+
oldDenies, oldEdit, oldHashes, oldGates, oldKeptHashes,
|
|
349
381
|
});
|
|
350
|
-
const { owned, stats, cfgName, skillDenies, editRecord, editRefused, bashGates, kept } = rendered;
|
|
382
|
+
const { owned, stats, cfgName, skillDenies, editRecord, editRefused, bashGates, kept, keptHashes } = rendered;
|
|
351
383
|
// Seed once: absent -> created, then the user's (never recorded, rewritten or removed).
|
|
352
384
|
if (seeds(args)) seedProtectedChecks(root);
|
|
353
385
|
|
|
@@ -362,6 +394,7 @@ function emitOpencode(cfg, args, out) {
|
|
|
362
394
|
owned: [...owned].sort(),
|
|
363
395
|
hashes: ownedHashes(oc, owned),
|
|
364
396
|
...keptKey(kept),
|
|
397
|
+
...keptHashesKey(keptHashes),
|
|
365
398
|
scope: 'project',
|
|
366
399
|
...(skillDenies.length ? { skill_denies: skillDenies } : {}),
|
|
367
400
|
...editRecordKeys(editRecord),
|
|
@@ -402,6 +435,7 @@ function emitOpencodeGlobal(cfg, args, out) {
|
|
|
402
435
|
const oldEdit = recordedEdit(doc);
|
|
403
436
|
const oldGates = recordedGates(doc);
|
|
404
437
|
const oldHashes = hashesOf(doc);
|
|
438
|
+
const oldKeptHashes = keptHashesOf(doc);
|
|
405
439
|
|
|
406
440
|
const agentPath = path.join(cfgDir, 'AGENT.md').split(path.sep).join('/');
|
|
407
441
|
|
|
@@ -410,9 +444,9 @@ function emitOpencodeGlobal(cfg, args, out) {
|
|
|
410
444
|
{
|
|
411
445
|
theme: args.theme, cfgDir, out, sharedRoot: args.sharedRoot,
|
|
412
446
|
footprint: args.footprint, nativeCatalog: hostCatalogsNatively('opencode'),
|
|
413
|
-
oldOwned, agentPath, oldDenies, oldEdit, oldHashes, oldGates,
|
|
447
|
+
oldOwned, agentPath, oldDenies, oldEdit, oldHashes, oldGates, oldKeptHashes,
|
|
414
448
|
});
|
|
415
|
-
const { owned, stats, memStatus, nbStatus, cfgName, skillDenies, editRecord, editRefused, bashGates, kept } = rendered;
|
|
449
|
+
const { owned, stats, memStatus, nbStatus, cfgName, skillDenies, editRecord, editRefused, bashGates, kept, keptHashes } = rendered;
|
|
416
450
|
|
|
417
451
|
phaseLog('PRUNE');
|
|
418
452
|
pruneOwned(cfgDir, oldOwned, owned, oldHashes, editRefused, cfg.force);
|
|
@@ -425,6 +459,7 @@ function emitOpencodeGlobal(cfg, args, out) {
|
|
|
425
459
|
owned: [...owned].sort(),
|
|
426
460
|
hashes: ownedHashes(cfgDir, owned),
|
|
427
461
|
...keptKey(kept),
|
|
462
|
+
...keptHashesKey(keptHashes),
|
|
428
463
|
...(skillDenies.length ? { skill_denies: skillDenies } : {}),
|
|
429
464
|
...editRecordKeys(editRecord),
|
|
430
465
|
...(bashGates.length ? { bash_gates: bashGates } : {}),
|
|
@@ -456,6 +491,7 @@ function emitClaudeCore(cfg, args, { cfgDir, claudeMd, scope, host, out, hookOpt
|
|
|
456
491
|
const oldManaged = (doc && doc.managed && typeof doc.managed === 'object'
|
|
457
492
|
&& !Array.isArray(doc.managed)) ? doc.managed : {};
|
|
458
493
|
const oldHashes = hashesOf(doc);
|
|
494
|
+
const oldKeptHashes = keptHashesOf(doc);
|
|
459
495
|
|
|
460
496
|
// RENDER + WIRE in one child's worth of work. `preambleExclude` is null for every
|
|
461
497
|
// carrier but `CLAUDE.md`, so Bob's `AGENTS.md` does not resolve to one; for a `CLAUDE.md`
|
|
@@ -467,9 +503,10 @@ function emitClaudeCore(cfg, args, { cfgDir, claudeMd, scope, host, out, hookOpt
|
|
|
467
503
|
out,
|
|
468
504
|
footprint: args.footprint, nativeCatalog: hostCatalogsNatively(host),
|
|
469
505
|
oldOwned, oldManaged, preambleExclude: preambleExclude(claudeMd, host),
|
|
470
|
-
|
|
506
|
+
userListing: userListingKeys(host, scope),
|
|
507
|
+
hookOpts, oldHashes, oldKeptHashes,
|
|
471
508
|
});
|
|
472
|
-
const { owned, stats, memStatus, nbStatus, managed, editRefused, kept } = rendered;
|
|
509
|
+
const { owned, stats, memStatus, nbStatus, managed, editRefused, kept, keptHashes } = rendered;
|
|
473
510
|
// `root` is null on a global emit: it has no project to seed.
|
|
474
511
|
if (root && seeds(args)) seedProtectedChecks(root);
|
|
475
512
|
|
|
@@ -486,6 +523,7 @@ function emitClaudeCore(cfg, args, { cfgDir, claudeMd, scope, host, out, hookOpt
|
|
|
486
523
|
owned: [...owned].sort(),
|
|
487
524
|
hashes: ownedHashes(cfgDir, owned),
|
|
488
525
|
...keptKey(kept),
|
|
526
|
+
...keptHashesKey(keptHashes),
|
|
489
527
|
managed,
|
|
490
528
|
scope,
|
|
491
529
|
});
|
|
@@ -686,12 +724,13 @@ const PROJECT_EMITS = {
|
|
|
686
724
|
* carry straight past the parameter default.
|
|
687
725
|
*/
|
|
688
726
|
function axesCfg({
|
|
689
|
-
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, ...gates
|
|
727
|
+
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, contextWindow, ...gates
|
|
690
728
|
}) {
|
|
691
729
|
return makeCfg({
|
|
692
730
|
...(posture ? { posture } : {}), ...(mode ? { mode } : {}), ...(trust ? { trust } : {}),
|
|
693
731
|
...(doctrines ? { doctrines } : {}), ...(excludeRules ? { excludeRules } : {}),
|
|
694
732
|
...(excludeSkills ? { excludeSkills } : {}), ...(kits ? { kits } : {}), ...(sharedTier ? { sharedTier } : {}),
|
|
733
|
+
...(contextWindow ? { contextWindow } : {}),
|
|
695
734
|
// The gate switches (`GATE_SWITCHES` keys): only an explicit `false` disarms; `null` (no
|
|
696
735
|
// opinion) keeps the gate.
|
|
697
736
|
...Object.fromEntries(GATE_SWITCHES.filter((g) => gates[g.key] === false).map((g) => [g.arg, true])),
|
|
@@ -700,7 +739,7 @@ function axesCfg({
|
|
|
700
739
|
|
|
701
740
|
export function emitProjectInto(host, {
|
|
702
741
|
theme, out, root, footprint = 'full', posture = null, mode = null, trust = null,
|
|
703
|
-
doctrines = null, excludeRules = null, excludeSkills = null, kits = null, sharedTier = false, seed = true, ...gates
|
|
742
|
+
doctrines = null, excludeRules = null, excludeSkills = null, kits = null, sharedTier = false, contextWindow = null, seed = true, ...gates
|
|
704
743
|
}) {
|
|
705
744
|
const emit = PROJECT_EMITS[host];
|
|
706
745
|
// The axes ride the same rail into every `*Into`, and for the same reason: a drift reader
|
|
@@ -711,7 +750,7 @@ export function emitProjectInto(host, {
|
|
|
711
750
|
// the git root, which for a temp dir inside a repo is that repo, outside the sandbox.
|
|
712
751
|
return withPlatformNewlines(() => emit(
|
|
713
752
|
axesCfg({
|
|
714
|
-
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, ...gates }),
|
|
753
|
+
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, contextWindow, ...gates }),
|
|
715
754
|
{ theme, footprint, root, seed }, out,
|
|
716
755
|
));
|
|
717
756
|
}
|
|
@@ -726,16 +765,17 @@ export function emitProjectInto(host, {
|
|
|
726
765
|
*/
|
|
727
766
|
export function buildInto({
|
|
728
767
|
theme, out, footprint = 'lean', posture = null, mode = null, trust = null, doctrines = null,
|
|
729
|
-
excludeRules = null, excludeSkills = null, kits = null, sharedTier = false, ...gates
|
|
768
|
+
excludeRules = null, excludeSkills = null, kits = null, sharedTier = false, contextWindow = null, ...gates
|
|
730
769
|
}) {
|
|
731
770
|
return withPlatformNewlines(() => build(axesCfg({
|
|
732
|
-
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, ...gates }),
|
|
771
|
+
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, contextWindow, ...gates }),
|
|
733
772
|
theme, out, { footprint, nativeCatalog: false }));
|
|
734
773
|
}
|
|
735
774
|
|
|
736
775
|
export function emitGlobalInto(host, {
|
|
737
776
|
theme, out, cfgDir, footprint, posture = null, mode = null, doctrines = null, trust = null,
|
|
738
|
-
excludeRules = null, excludeSkills = null, kits = null, sharedTier = false,
|
|
777
|
+
excludeRules = null, excludeSkills = null, kits = null, sharedTier = false, contextWindow = null,
|
|
778
|
+
sharedRoot = undefined, ...gates
|
|
739
779
|
}) {
|
|
740
780
|
// `build.HOSTS.get(host, build.HOSTS["opencode"])` — an unknown host falls back rather than
|
|
741
781
|
// raising, because the host comes from a marker file a user can edit.
|
|
@@ -752,7 +792,7 @@ export function emitGlobalInto(host, {
|
|
|
752
792
|
// the same scar the footprint left in `diffCollect`, one axis over each time.
|
|
753
793
|
return withPlatformNewlines(() => emit(
|
|
754
794
|
axesCfg({
|
|
755
|
-
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, ...gates }),
|
|
795
|
+
posture, mode, trust, doctrines, excludeRules, excludeSkills, kits, sharedTier, contextWindow, ...gates }),
|
|
756
796
|
{ theme, footprint, root: null, cfgDir, sharedRoot }, out,
|
|
757
797
|
));
|
|
758
798
|
}
|
|
@@ -844,6 +884,24 @@ function run(argv) {
|
|
|
844
884
|
die(2, `argument --shared-tier: only applies to a per-repo host emit (got --emit ${args.emit}); `
|
|
845
885
|
+ 'a global install already owns the shared tier');
|
|
846
886
|
}
|
|
887
|
+
// A NEW project install takes the machine's context window when none is given: the window is
|
|
888
|
+
// the model's, so a project on a machine whose global install says `1m` is a 1m project too. An
|
|
889
|
+
// existing install keeps the default rule, and the preserve guard below holds it to its own.
|
|
890
|
+
// NOT UNDER `--reset`: a replay (profile apply, the console, the wizard) is a whole selection
|
|
891
|
+
// that has already resolved the window, and `setupBuildArgs` elides `200k` as the default, so
|
|
892
|
+
// its silence there means 200k, not "no opinion".
|
|
893
|
+
if (!args.reset && !args.given.has('contextWindow') && args.emit !== 'files' && !args.emit.endsWith('-global')
|
|
894
|
+
&& !guardTarget(args, out)) {
|
|
895
|
+
try { args.contextWindow = installedDefaults().contextWindow; } catch { /* default */ }
|
|
896
|
+
}
|
|
897
|
+
// The preserve guard, before anything is written: a build over an existing install that would
|
|
898
|
+
// change a setting it was not given refuses, naming each change and the command that keeps
|
|
899
|
+
// them. `--reset` is the caller's consent. See `preserveRefusal` (js/build/profile.mjs).
|
|
900
|
+
const refusal = preserveRefusal(args, args.given, out, args.root ? resolveOut(args.root) : null);
|
|
901
|
+
if (refusal) {
|
|
902
|
+
process.stderr.write(preserveRefusalText(refusal));
|
|
903
|
+
throw Object.assign(new Error('preserve guard'), { exitCode: 1 });
|
|
904
|
+
}
|
|
847
905
|
const cfg = makeCfg(args);
|
|
848
906
|
warnDroppedKits(args, out);
|
|
849
907
|
|
package/js/build/emit-claude.mjs
CHANGED
|
@@ -11,17 +11,20 @@ import { claimer, loadAgentOverrides, writeNativeLayer } from '../hosts/native.m
|
|
|
11
11
|
import { ensureAgentOverridesStub, writeAliasCommands } from '../hosts/opencode.mjs';
|
|
12
12
|
import {
|
|
13
13
|
managedBlockRemove, managedBlockWrite, mergeClaudeSettings,
|
|
14
|
-
unwireClaudeEnv, unwireClaudeExcludes, unwireClaudeSettings, wireClaudeEnv,
|
|
14
|
+
unwireClaudeEnv, unwireClaudeExcludes, unwireClaudeListing, unwireClaudeSettings, wireClaudeEnv,
|
|
15
|
+
wireClaudeExcludes, wireClaudeListing,
|
|
15
16
|
} from '../hosts/settings.mjs';
|
|
17
|
+
import { CONTEXT_WINDOWS } from './source.mjs';
|
|
16
18
|
import { get, isDict, isTruthy } from '../lib/json.mjs';
|
|
17
19
|
import { relPosix } from '../lib/text.mjs';
|
|
18
20
|
import { assertSourceComplete, phaseLog, ensureMemoryStore } from './bundle.mjs';
|
|
19
21
|
import { foldOnEmit } from './fold.mjs';
|
|
22
|
+
import { migrateProjectNotes } from './notes-migrate.mjs';
|
|
20
23
|
import { pruneRetiredSkills } from './retired-skills.mjs';
|
|
21
24
|
import {
|
|
22
25
|
claimAndWrite, globalMemory, globalNotebook, shipLeanLaws, stripCapabilityLinks,
|
|
23
26
|
} from './emit-common.mjs';
|
|
24
|
-
import { kitsBody, pathTokens, renderAll, renderFile } from './render.mjs';
|
|
27
|
+
import { kitsBody, modeBody, pathTokens, renderAll, renderFile } from './render.mjs';
|
|
25
28
|
import {
|
|
26
29
|
BOB_RULES_STUB, bobFirstReply, ensureContextStub, ensureExcludesStub, ensureNotebookIndex,
|
|
27
30
|
ensureProfileStub,
|
|
@@ -52,7 +55,7 @@ export function emitClaudeRender(cfg, job) {
|
|
|
52
55
|
phaseLog('RENDER');
|
|
53
56
|
const {
|
|
54
57
|
theme: themeName, cfgDir, claudeMd, scope, out, footprint, host, nativeCatalog,
|
|
55
|
-
oldOwned, oldHashes = {},
|
|
58
|
+
oldOwned, oldHashes = {}, oldKeptHashes = {},
|
|
56
59
|
} = job;
|
|
57
60
|
|
|
58
61
|
// Relative to the CLAUDE.md directory, so the argument order is cfg-from-claude_md; an
|
|
@@ -91,6 +94,8 @@ export function emitClaudeRender(cfg, job) {
|
|
|
91
94
|
Object.assign(ptheme, pathTokens(ptheme, sharedRoot));
|
|
92
95
|
// The Kits block was substituted with the unprefixed DIR_* tokens; rebuild it, or its links dangle.
|
|
93
96
|
ptheme.KITS_BODY = kitsBody(cfg, ptheme, '');
|
|
97
|
+
// The Foreman mode names its ledger under DIR_NOTEBOOK: rebuilt for the same reason.
|
|
98
|
+
ptheme.MODE_BODY = modeBody(cfg, ptheme);
|
|
94
99
|
// Same catalogue decision as the renderAll above — a re-render that forgot it would
|
|
95
100
|
// quietly put the stripped tables back.
|
|
96
101
|
return renderFile(cfg, tmplItem.src, ptheme, footprint, '', new Set(), nativeCatalog);
|
|
@@ -126,7 +131,8 @@ export function emitClaudeRender(cfg, job) {
|
|
|
126
131
|
// below both push into the same `owned` list, so a pre-manifest-install warning still
|
|
127
132
|
// prints once across the whole emit rather than once per writer.
|
|
128
133
|
// Before the claim: a retired folder freed here lets this emit write the alias that replaces it.
|
|
129
|
-
|
|
134
|
+
// `held`: the user's kept edits under a revived name, recorded again so they never lapse.
|
|
135
|
+
const held = sharedRoot !== null ? pruneRetiredSkills(host, cfgDir, oldOwned) : [];
|
|
130
136
|
const claim = claimer(oldOwned, cfgDir, true, oldHashes, cfg.force);
|
|
131
137
|
const { nAgents, nSkills, written } = writeNativeLayer(
|
|
132
138
|
items, path.join(cfgDir, 'agents'), path.join(cfgDir, 'skills'),
|
|
@@ -149,6 +155,8 @@ export function emitClaudeRender(cfg, job) {
|
|
|
149
155
|
ensureMemoryStore(path.join(cfgDir, 'memory'));
|
|
150
156
|
const nbStatus = globalNotebook(cfgDir, items, out, cfg.src);
|
|
151
157
|
ensureNotebookIndex(path.join(cfgDir, 'notebook'));
|
|
158
|
+
// A project's notes live in `<repo>/notebook` now, whatever the host (js/build/notes-migrate.mjs).
|
|
159
|
+
if (scope === 'project') migrateProjectNotes(cfgDir, path.dirname(cfgDir));
|
|
152
160
|
// context.json too: the root names it as the project's own manifest, and until 2026-10 this
|
|
153
161
|
// emit never seeded one — the bundle and OpenCode did — so §9 pointed at a file that was not
|
|
154
162
|
// there. The context hook reads it from this dir (`resolveContextSets`' last candidate).
|
|
@@ -206,7 +214,8 @@ export function emitClaudeRender(cfg, job) {
|
|
|
206
214
|
nbStatus,
|
|
207
215
|
managed,
|
|
208
216
|
editRefused: [...claim.editRefused],
|
|
209
|
-
kept: [...claim.kept],
|
|
217
|
+
kept: [...new Set([...claim.kept, ...held])],
|
|
218
|
+
keptHashes: claim.keptHashes(oldKeptHashes),
|
|
210
219
|
};
|
|
211
220
|
}
|
|
212
221
|
|
|
@@ -286,6 +295,7 @@ function claudeWire(job, claudeMdText, hasAgentText, doctrines = null, excludeRu
|
|
|
286
295
|
unwireClaudeSettings(path.join(cfgDir, oldSf), get(old, 'settings_hooks') || [], cfgDir);
|
|
287
296
|
unwireClaudeExcludes(path.join(cfgDir, oldSf), get(old, 'settings_excludes') || []);
|
|
288
297
|
unwireClaudeEnv(path.join(cfgDir, oldSf), get(old, 'settings_env'));
|
|
298
|
+
unwireClaudeListing(path.join(cfgDir, oldSf), get(old, 'settings_listing'));
|
|
289
299
|
}
|
|
290
300
|
// The merge prunes recorded groups that are no longer canonical and returns the
|
|
291
301
|
// COMPLETE current claim set — store it as-is; unioning with prior would resurrect the
|
|
@@ -304,6 +314,23 @@ function claudeWire(job, claudeMdText, hasAgentText, doctrines = null, excludeRu
|
|
|
304
314
|
const priorEnv = oldSf === settingsName && isDict(get(old, 'settings_env')) ? old.settings_env : {};
|
|
305
315
|
const env = { ...priorEnv, ...wireClaudeEnv(settingsPath) };
|
|
306
316
|
if (Object.keys(env).length) managed.settings_env = env;
|
|
317
|
+
// The skill-listing budget of `--context-window` (`CONTEXT_WINDOWS` says why and why Claude
|
|
318
|
+
// Code only). The record is what this install owns on file, so a value can change on a rebuild.
|
|
319
|
+
const priorListing = oldSf === settingsName && isDict(get(old, 'settings_listing')) ? old.settings_listing : {};
|
|
320
|
+
// A project emit leaves a key the user-level settings already set to that level
|
|
321
|
+
// (`userListingKeys`, js/build/driver.mjs): a project value would undercut it.
|
|
322
|
+
const wantListing = Object.fromEntries(Object.entries(CONTEXT_WINDOWS[gates.contextWindow] ?? {})
|
|
323
|
+
.filter(([k]) => !(job.userListing ?? []).includes(k)));
|
|
324
|
+
const listing = wireClaudeListing(settingsPath, wantListing, priorListing);
|
|
325
|
+
if (Object.keys(listing).length) managed.settings_listing = listing;
|
|
326
|
+
// Said once, the first time this install writes the keys: an install older than the option
|
|
327
|
+
// reads as 200k, and on a 1M machine that is a choice its owner should see being made.
|
|
328
|
+
if (!Object.keys(priorListing).length && Object.keys(listing).length) {
|
|
329
|
+
process.stdout.write(`[geneseed] skill listing: wrote ${Object.entries(listing).map(([k, v]) => `${k} ${v}`)
|
|
330
|
+
.join(', ')} into ${settingsName} for a ${gates.contextWindow} context window; `
|
|
331
|
+
+ `${gates.contextWindow === '1m' ? 'for a 200k-token model, rebuild with --context-window 200k'
|
|
332
|
+
: 'on a 1M-token model, rebuild with --context-window 1m'}.\n`);
|
|
333
|
+
}
|
|
307
334
|
}
|
|
308
335
|
|
|
309
336
|
// Project-bypasses-global (Claude and OpenClaude): a PROJECT install suppresses the GLOBAL
|