geneseed 4.28.0 → 4.30.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 +58 -0
- package/README.md +4 -2
- package/SHIPPED.md +2 -2
- package/adapters/bob/README.md +1 -1
- package/adapters/claude-code/README.md +4 -2
- package/adapters/opencode/HOW-OPENCODE-LOADS.md +2 -2
- package/adapters/opencode/README.md +18 -2
- package/adapters/opencode/plugins/geneseed-activity.js +22 -20
- package/adapters/opencode/plugins/geneseed-context.js +155 -18
- package/adapters/opencode/plugins/geneseed-guard.js +59 -8
- package/adapters/opencode/plugins/geneseed-workflow.js +18 -1
- package/adapters/opencode/workflows/_runtime.js +14 -3
- package/docs/concepts/enforcement-table.md +5 -4
- package/docs/concepts/exclusions.md +3 -3
- package/docs/concepts/hooks.md +12 -4
- package/docs/concepts/ownership.md +9 -8
- package/docs/concepts/skills.md +1 -0
- package/docs/guides/set-up-ownership.md +22 -6
- package/docs/reference/environment.md +1 -0
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/plugin-context.md +3 -1
- package/docs/reference/plugin-guard.md +1 -1
- package/docs/understand/enforced-vs-asked.md +3 -3
- package/docs/understand/machine-bob.md +1 -1
- package/docs/understand/machine-claude.md +1 -1
- package/docs/understand/machine-opencode.md +1 -1
- package/harness.config.json +1 -1
- package/js/README.md +3 -1
- package/js/build/driver.mjs +29 -9
- package/js/build/emit-opencode.mjs +12 -10
- package/js/build/render.mjs +9 -0
- package/js/hosts/done-checks.mjs +134 -0
- package/js/hosts/geneseed-dir.mjs +116 -0
- package/js/hosts/hooks-context.mjs +19 -0
- package/js/hosts/hooks-done.mjs +82 -38
- package/js/hosts/hooks-learn.mjs +9 -2
- package/js/hosts/hooks-prims.mjs +4 -0
- package/js/hosts/hooks.mjs +139 -6
- package/js/hosts/hosts.mjs +6 -0
- package/js/hosts/native.mjs +1 -1
- package/js/hosts/owned.mjs +19 -0
- package/js/hosts/ownership-gate.mjs +64 -10
- package/js/hosts/settings.mjs +115 -74
- package/js/inspect/checks-constitution.mjs +5 -1
- package/js/inspect/cost.mjs +1 -1
- package/js/inspect/doctor.mjs +2 -1
- package/js/inspect/inventory.mjs +1 -1
- package/js/inspect/status.mjs +2 -1
- package/js/inspect/validate.mjs +2 -1
- package/js/lib/json.mjs +70 -0
- package/js/maintain/uninstall.mjs +18 -5
- package/js/web/gates-api.mjs +2 -2
- package/package.json +1 -1
- package/registry.json +14 -0
- package/src/AGENT.md.tmpl +2 -2
- package/src/licenses/i-have-adhd.txt +21 -0
- package/src/skills/_checkpoints.md +28 -5
- package/src/skills/adhd.md +40 -0
- package/src/skills/diagram-design/LICENSE +21 -0
- package/src/skills/diagram-design/SKILL.md +392 -0
- package/src/skills/diagram-design/THIRD_PARTY_LICENSES.md +134 -0
- package/src/skills/diagram-design/VENDOR.md +81 -0
- package/src/skills/diagram-design/assets/example-architecture.html +183 -0
- package/src/skills/diagram-design/assets/example-venn.html +110 -0
- package/src/skills/diagram-design/assets/template-dark.html +99 -0
- package/src/skills/diagram-design/assets/template-full.html +421 -0
- package/src/skills/diagram-design/assets/template-motion.html +448 -0
- package/src/skills/diagram-design/assets/template-terminal.html +188 -0
- package/src/skills/diagram-design/assets/template.html +100 -0
- package/src/skills/diagram-design/references/animation.md +135 -0
- package/src/skills/diagram-design/references/layout-budget.md +97 -0
- package/src/skills/diagram-design/references/onboarding.md +368 -0
- package/src/skills/diagram-design/references/output-spec.md +277 -0
- package/src/skills/diagram-design/references/primitive-annotation.md +36 -0
- package/src/skills/diagram-design/references/primitive-icons.md +782 -0
- package/src/skills/diagram-design/references/primitive-sketchy.md +43 -0
- package/src/skills/diagram-design/references/primitive-terminal.md +76 -0
- package/src/skills/diagram-design/references/primitives-core.md +144 -0
- package/src/skills/diagram-design/references/profiles.md +183 -0
- package/src/skills/diagram-design/references/semantic-patterns.md +154 -0
- package/src/skills/diagram-design/references/style-guide.md +232 -0
- package/src/skills/diagram-design/references/type-architecture-delta.md +143 -0
- package/src/skills/diagram-design/references/type-architecture.md +117 -0
- package/src/skills/diagram-design/references/type-axonometric-plan.md +83 -0
- package/src/skills/diagram-design/references/type-bar.md +108 -0
- package/src/skills/diagram-design/references/type-data-flow.md +371 -0
- package/src/skills/diagram-design/references/type-db-schema.md +48 -0
- package/src/skills/diagram-design/references/type-dependency.md +44 -0
- package/src/skills/diagram-design/references/type-deployment.md +45 -0
- package/src/skills/diagram-design/references/type-dp-integration.md +407 -0
- package/src/skills/diagram-design/references/type-dp-security-matrix.md +379 -0
- package/src/skills/diagram-design/references/type-er.md +25 -0
- package/src/skills/diagram-design/references/type-exploded.md +115 -0
- package/src/skills/diagram-design/references/type-fishbone.md +75 -0
- package/src/skills/diagram-design/references/type-flowchart.md +23 -0
- package/src/skills/diagram-design/references/type-gantt.md +45 -0
- package/src/skills/diagram-design/references/type-heatmap.md +80 -0
- package/src/skills/diagram-design/references/type-high-level.md +470 -0
- package/src/skills/diagram-design/references/type-it-state.md +468 -0
- package/src/skills/diagram-design/references/type-journey.md +55 -0
- package/src/skills/diagram-design/references/type-kanban.md +49 -0
- package/src/skills/diagram-design/references/type-layers.md +26 -0
- package/src/skills/diagram-design/references/type-line.md +337 -0
- package/src/skills/diagram-design/references/type-loop.md +223 -0
- package/src/skills/diagram-design/references/type-medallion.md +356 -0
- package/src/skills/diagram-design/references/type-nested.md +22 -0
- package/src/skills/diagram-design/references/type-org-chart.md +44 -0
- package/src/skills/diagram-design/references/type-polar.md +136 -0
- package/src/skills/diagram-design/references/type-process.md +490 -0
- package/src/skills/diagram-design/references/type-pyramid.md +33 -0
- package/src/skills/diagram-design/references/type-quadrant.md +81 -0
- package/src/skills/diagram-design/references/type-radar.md +82 -0
- package/src/skills/diagram-design/references/type-sankey.md +75 -0
- package/src/skills/diagram-design/references/type-scatter.md +276 -0
- package/src/skills/diagram-design/references/type-sequence.md +130 -0
- package/src/skills/diagram-design/references/type-service-blueprint.md +103 -0
- package/src/skills/diagram-design/references/type-state.md +30 -0
- package/src/skills/diagram-design/references/type-story-map.md +46 -0
- package/src/skills/diagram-design/references/type-swimlane.md +22 -0
- package/src/skills/diagram-design/references/type-timeline.md +20 -0
- package/src/skills/diagram-design/references/type-tree.md +24 -0
- package/src/skills/diagram-design/references/type-treemap.md +137 -0
- package/src/skills/diagram-design/references/type-uml-class.md +65 -0
- package/src/skills/diagram-design/references/type-venn.md +26 -0
- package/src/skills/diagram-design/references/type-wardley.md +39 -0
- package/src/skills/diagram-design/references/type-waterfall.md +75 -0
- package/src/skills/document-project.md +4 -1
- package/src/skills/learn-mode.md +11 -11
- package/src/skills/ownership.md +41 -18
- package/src/upstreams.json +14 -0
- package/themes/_TEMPLATE.json +1 -0
- package/themes/biker.json +1 -0
- package/themes/commentator.json +1 -0
- package/themes/cyberpunk.json +1 -0
- package/themes/gamer.json +1 -0
- package/themes/imperial.json +1 -0
- package/themes/joker.json +1 -0
- package/themes/marvin.json +1 -0
- package/themes/mean.json +1 -0
- package/themes/military.json +1 -0
- package/themes/neutral.json +1 -0
- package/themes/pirate.json +1 -0
- package/themes/sports.json +1 -0
- package/themes/verstappen.json +1 -0
- package/themes/wizard.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,64 @@ label. For the capability ↔ spec map, see [SHIPPED.md](SHIPPED.md).
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [4.30.0] — 2026-10-31
|
|
12
|
+
|
|
13
|
+
Minor: the ownership and learn-mode state files stay short (general preferences, no per-checkpoint writes), and OpenCode activity cards land on their own repo shelf. Run `geneseed rebuild-all` once after updating to get the new Rite text.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **The learn-mode and ownership state files stay short.** `.geneseed/ownership.md` and `.geneseed/learn.md` lose `## Pending`: the open checkpoint lives in the conversation, nothing is written per checkpoint, and after a restart or compaction the agent re-asks any step the visible conversation did not approve. The dated `## Decisions` log becomes `## Preferences`: general rules ("show the test first"), rewritten in place, about 10 lines at most, proposed only when the user states a rule generally or makes the same choice a third time in a session, and always asked. In ownership, a rule about the code is proposed as a one-line `AGENTS.md` convention instead. learn-mode's `## Understood` becomes one line per topic with a `not yet:` part, about 15 lines at most. An old-format file is condensed only on the user's yes.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- **OpenCode activity cards land on their own repo shelf.** The activity plugin took `root`
|
|
21
|
+
and `repo` from its plugin instance's worktree. One `opencode serve` hosts an instance per
|
|
22
|
+
opened project, and every instance hears every session, so each stamped its own root on
|
|
23
|
+
all of them: a session in `~/dev-home` showed under another project, a card flipped between
|
|
24
|
+
roots, and files lost their repo-relative paths and dropped out of collision grouping. Both
|
|
25
|
+
OpenCode 1 and 2 now read the root from the session's own directory (`null` outside any
|
|
26
|
+
repository).
|
|
27
|
+
|
|
28
|
+
## [4.29.0] — 2026-10-29
|
|
29
|
+
|
|
30
|
+
Minor: the done gate works with no file (inferred checks, advisory in this release) and no longer passes a masked check; a project install arms the protected-checks gate; the gates protect their own configuration; ownership can be declined per repo; two new skills (`adhd`, `diagram-design`). Run `geneseed rebuild-all` once after updating to seed `protected-checks.txt` in existing project installs and to pick up the new gate configuration.
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **An `adhd` mode skill.** `/adhd` shapes every reply for a reader with ADHD until "stop adhd mode" or "normal mode": the next action first, numbered steps, the state restated each turn, tangents held back, concrete time estimates, and a pre-send check. It is user-only (the agent never starts it) and adapted from [ayghri/i-have-adhd](https://github.com/ayghri/i-have-adhd) (MIT). The rules, `user-rules.md` and the comms doctrines outrank it: the readiness sigil stays first, the five-item cap never renumbers a reference code, the closing action uses the Mark-the-Ask markers, and verification output is never cut as a recap.
|
|
35
|
+
- **`diagram-design` skill, vendored.** [cathrynlavery/diagram-design](https://github.com/cathrynlavery/diagram-design) by Cathryn Lavery (MIT), pinned at 0cf73c3f: editorial HTML/SVG diagrams in 45 visual types, with a style-guide gate on first use. Trimmed from 5.9 MB to 0.8 MB: no Python helpers (so no PNG export, an SVG is copied out of the HTML by hand, and import reads the source file directly), two of upstream's ~220 examples, no icon gallery, and five icons whose licence upstream left unverified. The Tabler, log-z/logos and Devicon MIT texts ship in its `THIRD_PARTY_LICENSES.md`. `src/skills/diagram-design/VENDOR.md` lists every change. The `§N` gate no longer reads a vendored folder's bare section numbers as AGENT.md citations; an explicit `AGENT.md §N` there is still checked.
|
|
36
|
+
- **`document-project` draws its HTML diagrams through `diagram-design` when it is installed.** The C4 views and flows in `overview.html` come from that skill (its first-run style gate skipped, the page's own palette kept); without it, the SVG is hand-authored as before. The Markdown pages keep Mermaid.
|
|
37
|
+
- **The done gate needs no file any more.** With no `.geneseed/done-checks.txt`, it infers the project's checks from its manifest: `package.json` scripts `test`, `lint` and `typecheck` (package manager read from the lockfile), Maven, Gradle, pytest (only where pytest shows), `cargo test` and `go test`. Each check accepts its usual spellings (`npm test`, `npm run test`, `pnpm test`, `./mvnw clean verify`), and a form that skips the tests (`-DskipTests`, `-x test`, `--no-run`) does not count. Inferred checks are **advisory** in this release: an unproven one is named to the user (`systemMessage`) and never blocks. A `done-checks.txt` still wins and still blocks; an empty one switches the gate off. Every session now opens with one line naming the checks and their source; on Bob and OpenCode 2, which never judge a turn, it says so. Advisories are kept out of the gate counts in `status` and the web UI.
|
|
38
|
+
- **A project install arms the protected-checks gate.** Every project emit (Claude Code, OpenCode, Bob, OpenClaude) seeds `<git root>/.geneseed/protected-checks.txt` when it is absent, listing only what exists there: CI files, lint/type/test config, and the manifests the done gate infers from (so the agent can no longer lower that bar by editing `package.json` without being asked). Nothing is seeded without a git root, without a candidate, or on a global emit. It is seeded once, then it is yours: an existing list is never touched, and Geneseed never rewrites the seed, records it in a manifest or deletes it on uninstall (so two hosts in one repo, or a committed list, are safe). To opt out, delete the listed paths (the comments may stay) but keep the file; a deleted file is seeded again. Whenever `.geneseed/` exists, the emit also creates its `.gitignore` if absent (or upgrades a bare `*`); uninstall leaves it. A `.geneseed` that is not a directory, or a write that fails, is one warning: the emit still completes. `geneseed validate` and the doctor's sandbox emits never seed. Run `geneseed rebuild-all` to seed existing project installs.
|
|
39
|
+
- **Decline the ownership setup once, for good, in one repo.** The ownership proposal now offers three answers: set it up now, skip this session, or skip in this repo until asked. The third writes `Setup: declined <YYYY-MM-DD>` into the developer's personal, git-ignored `.geneseed/ownership.md` in the main worktree, so a decline made in a linked git worktree outlives it (Claude Desktop opens a fresh one per session). From then on the first-write gate defers in that repo on every host (Claude Code, OpenClaude, Bob, OpenCode), with no expiry: the developer deletes the line, or asks for the setup, which removes it. Every session there opens with one reminder line, `Ownership: setup declined since <date> — not set up; say "set up ownership" to run it`, which the agent repeats once. A `## Ownership` section in `AGENTS.md`, on or off, outranks the line.
|
|
40
|
+
- **The gates protect their own configuration.** A write tool aimed at a file that can switch a gate off now gets the *External Gate* prompt on Claude Code and OpenClaude. The files are the hook settings (`settings.json`, `settings.local.json`, in the install dir and in each host's project dir), `excludes.json`, the `AGENT.md` gate markers, the install manifest, `opencode.json(c)`, the OpenCode guard's own plugin files, and the hook shim in `~/.geneseed/bin/`. OpenCode: the emit writes `permission.edit` "ask" keys for these files into `opencode.json` (a blanket `"edit": "allow"` becomes `{"*": "allow", …}`), records them in the manifest, and uninstall takes them back; the guard plugin refuses only the other hosts' Geneseed-only files. Bob: only writes are judged; a hook `settings.json` edit is blocked only when it changes Geneseed's own `geneseed-hook` entries, turns on `disableAllHooks` or changes an env value the hook reads, and an edit the hook cannot replay exactly is blocked; `excludes.json`, `AGENT.md`, the manifest and the shim stay blocked. `geneseed` commands still write them without a prompt. Shell writes are not seen.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
- Ownership setup writes the root `AGENTS.md` only (and removes a personal `Setup: declined`
|
|
44
|
+
line, if there is one). `.geneseed/ownership.md` is created later,
|
|
45
|
+
only when there is personal state to keep (a finer granularity, the first pending checkpoint,
|
|
46
|
+
the first decision); no file means the team granularity, nothing pending, no decisions.
|
|
47
|
+
- `.geneseed/` is personal by default: its first writer creates `.geneseed/.gitignore` when
|
|
48
|
+
absent (never overwriting one) with `/*` plus `!/` exceptions for the team paths —
|
|
49
|
+
`.gitignore`, `bricks/`, `loops/`, `protected-checks.txt`, `done-checks.txt`. The writers are
|
|
50
|
+
the ownership and learn-mode Rites (in place of an offer to edit the root `.gitignore`) and
|
|
51
|
+
the OpenCode workflow plugin on its first trace, and a project emit whenever `.geneseed/`
|
|
52
|
+
exists at the git root.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
- **The done gate no longer passes a masked check.** `npm test || true`, `npm test; true` and `npm test; exit 0` exit 0 on a red suite, so the gate read them as a passing run. Any `||` after a check, or a `;` or newline followed by `true`, `:`, `exit 0` or a bare `exit`, now reads as "not run"; `&&` still passes. OpenCode gets the same rule. One opening stays: `npm test; npm run lint` passes both checks.
|
|
56
|
+
- `--no-ownership-gate` now silences everything: the install's `AGENT.md` no longer carries the
|
|
57
|
+
"propose it once before the first write" sentence, so the model stops proposing the ownership
|
|
58
|
+
setup, nor the read-only `/document-project` suggestion beside it; and no decline reminder
|
|
59
|
+
prints at session start. Before, only the hook stood down.
|
|
60
|
+
- The OpenCode workflow runtime's `.geneseed/.gitignore` was a bare `*`, which hid new team
|
|
61
|
+
bricks and loops (and the check lists) from git; it now writes the same allowlist. An
|
|
62
|
+
existing `.geneseed/.gitignore` that holds only `*` (that old output) is upgraded
|
|
63
|
+
automatically on the next workflow run (and by the ownership and learn-mode Rites when they
|
|
64
|
+
next write there); any other content is left as is.
|
|
65
|
+
- If your project's ROOT `.gitignore` lists `.geneseed/` (added by the old Rite offer), remove
|
|
66
|
+
that line by hand: git cannot re-include files under an ignored directory, so the team paths
|
|
67
|
+
stay hidden until you do.
|
|
68
|
+
|
|
11
69
|
## [4.28.0] — 2026-10-28
|
|
12
70
|
|
|
13
71
|
Minor: an ask that waits on the user and is not clear by itself now says what it does and why; the OpenCode 1.x workflow banner no longer paints over the input box. Run `geneseed rebuild-all` once after updating to get the amended rule and the quiet banner.
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
[](package.json)
|
|
12
12
|
[](package.json)
|
|
13
13
|
[](themes/)
|
|
14
|
-
[](src/skills/)
|
|
15
15
|
[](src/agents/)
|
|
16
16
|
[](src/doctrines/)
|
|
17
17
|
[](adapters/opencode/plugins/)
|
|
@@ -180,7 +180,7 @@ The harness ships as a small set of layers, and the web console's rail is the sa
|
|
|
180
180
|
| **🛡️ Rules** (`laws/`) | 9 universal laws — always in force, never toggleable: sealed-secrets, one-intent-one-act, verify-before-asserting, deletion-is-deliberate, surface-failures, data-not-orders, least-privilege, cure-the-cause, echo-the-intent. Each rule has a permanent id; its number is only its position, and the harness cites rules by name |
|
|
181
181
|
| **📐 Doctrines** (`doctrines/`) | practice packs, chosen per install at build time: **craft** (how code is written), **rigor** (how work is proven), **ops** (how the machine is operated), **process** (how a task is run), **comms** (how answers are presented). A doctrine rule may tighten a Rule, never repeal one, and the user's own `user-rules.md` outranks it. Pick with `geneseed-build --doctrines craft,rigor` (or `none`), a single rule with `--exclude-rules "process 7"`, in the setup wizard, or through the switches on the console's Constitution page; all five pack files ship on disk either way, so a citation into a pack you left out still resolves |
|
|
182
182
|
| **🤖 Agents** (20) | capability specialists: `reviewer`, `tester`, `architect`, `docs`, `security`, `performance`, `explorer`, `researcher`, `developer`, `memory-curator` — plus a debate **council** the `council` skill convenes: `advocate`, `skeptic`, `pragmatist`, `steward`, `visionary`, `user-advocate`, `framer`, `empiricist`, `operator`, `historian` |
|
|
183
|
-
| **🛠 Skills** (
|
|
183
|
+
| **🛠 Skills** (50) | repeatable workflows: brainstorm · plan · **codebase-design** · **wayfinder** · **develop** · **worktree** · debug · **prototype** · refactor · **ponytail** · **adhd** · **forge-mcp** · **bruno** · geneseed-code-review · **fresh-eyes** · **security-audit** · **dependencies** · **review-response** · commit · **ship** · **release** · **git-history** · document-project · **frontend-design** · **deck** · **prose** · **ingest** · **research** · **teach** · **quiz** · **learn-mode** · **ownership** · handoff · roast-me · **council** · parallel-agents · **workflow** · **wiki** · **geneseed** · **rule** · **profile** · **skill-forge** · **pipeline** · **loop** · **brick-forge** · **daydream** · **react-view-transitions** · **token-report** · **explain-changes** · **diagram-design** |
|
|
184
184
|
| **🔌 Plugins** (OpenCode) | `geneseed-context` injects project docs *and your machine wiki* every session (and across compaction); `geneseed-learn` distils memory at session end; `geneseed-guard` enforces the safety Laws and protected wiki folders at the tool boundary; `geneseed-workflow` registers the `workflow` tool that runs saved orchestration scripts; `geneseed-notify` sends a native OS notification when a long run finishes; `geneseed-ponytail` holds a minimal-code mode (`/ponytail lite\|full\|ultra\|off`), opt-in, injecting the laziest-that-works ruleset every turn so it doesn't drift; `geneseed-activity` streams what each session is doing to the web console's Activity view |
|
|
185
185
|
| **🧠 Memory** (`memory/`) | one-fact-per-file durable knowledge, indexed by `MEMORY.md` (git-ignored, personal) |
|
|
186
186
|
| **📓 Notebook** (`notebook/`) | the agent's sovereign space — any medium (code, tools, data, notes), self-ruled via a seed-once charter, always git-ignored; only its `.gitignore` is build-asserted |
|
|
@@ -378,6 +378,7 @@ Some skills and agents are adapted from other open-source skill collections, und
|
|
|
378
378
|
|
|
379
379
|
- `daydream` — [glebis/claude-skills](https://github.com/glebis/claude-skills) by Gleb Kalinin (MIT): the vendored `daydream` skill.
|
|
380
380
|
- `react-view-transitions` — [vercel-labs/agent-skills](https://github.com/vercel-labs/agent-skills) by Vercel Engineering (MIT): the vendored `react-view-transitions` skill.
|
|
381
|
+
- `diagram-design` — [cathrynlavery/diagram-design](https://github.com/cathrynlavery/diagram-design) by Cathryn Lavery (MIT): the vendored `diagram-design` skill, trimmed (no Python helpers, two of its examples).
|
|
381
382
|
- `mattpocock-skills` — [mattpocock/skills](https://github.com/mattpocock/skills) by Matt Pocock (MIT): the vocabulary and procedures behind codebase-design, wayfinder, prototype, develop, handoff and research, the spec pass of geneseed-code-review, the question rounds and questionnaire of brainstorm, the slicing of plan, the reproduction step of debug, the integration-branch rules of parallel-agents, the trigger-pruning of skill-forge, and the dated-history rule of wiki.
|
|
382
383
|
- `mattpocock-skills-frozen` — [mattpocock/skills](https://github.com/mattpocock/skills) by Matt Pocock (MIT), pinned at 391a2701, the last commit carrying `resolving-merge-conflicts` (deleted upstream since): the merge-conflict step of git-history, from a skill upstream has since deleted, so the weekly drift check skips it.
|
|
383
384
|
- `mattpocock-skills-2509` — [mattpocock/skills](https://github.com/mattpocock/skills) by Matt Pocock (MIT), a second key for the same repo, at the same pin as `mattpocock-skills` today (5beb35b0): the PR body of ship and the guardrail clause of rule.
|
|
@@ -385,6 +386,7 @@ Some skills and agents are adapted from other open-source skill collections, und
|
|
|
385
386
|
- `vibe-wise` — [nykooi1/vibe-wise](https://github.com/nykooi1/vibe-wise) by Noah Kim (MIT): the state file, levels and checkpoints of learn-mode, and the checkpoint rules ownership shares.
|
|
386
387
|
- `piomin-spring-boot` — [piomin/claude-ai-spring-boot](https://github.com/piomin/claude-ai-spring-boot) by Piotr Mińkowski (Apache-2.0): the Spring Boot kit's skills and agents, rewritten and condensed for Boot 4.
|
|
387
388
|
- `everything-claude-code` — [affaan-m/everything-claude-code](https://github.com/affaan-m/everything-claude-code) by Affaan Mustafa (MIT): the React kit's skills and agents, rewritten and condensed for Vite and Jest.
|
|
389
|
+
- `i-have-adhd` — [ayghri/i-have-adhd](https://github.com/ayghri/i-have-adhd) by Ayoub Ghriss (MIT): the rules, rule-breaking cases and pre-send check of the adhd mode.
|
|
388
390
|
|
|
389
391
|
## 📄 License
|
|
390
392
|
|
package/SHIPPED.md
CHANGED
|
@@ -20,7 +20,7 @@ historical references, not files distributed with the repo.
|
|
|
20
20
|
> **On version numbers.** [`harness.config.json`](harness.config.json)'s `version` is a
|
|
21
21
|
> human-readable label only. The canonical identity of an installed harness is the
|
|
22
22
|
> **source fingerprint** stamped in `.geneseed-version` (see `geneseed version`), not the
|
|
23
|
-
> string. Current label: **4.
|
|
23
|
+
> string. Current label: **4.30.0**.
|
|
24
24
|
|
|
25
25
|
## Capabilities
|
|
26
26
|
|
|
@@ -29,7 +29,7 @@ Every row below is present in the tree today; "Spec" names the design record.
|
|
|
29
29
|
| Capability | What it is | Spec |
|
|
30
30
|
| --- | --- | --- |
|
|
31
31
|
| **Themed generator** | One neutral `src/` → 14 themed bundles via `geneseed-build` (zero dependencies); structure stays theme-independent | [DESIGN.md](DESIGN.md) |
|
|
32
|
-
| **Laws / Agents / Skills / Memory / Notebook** | 9 laws, 20 agents,
|
|
32
|
+
| **Laws / Agents / Skills / Memory / Notebook** | 9 laws, 20 agents, 50 skills, the memory convention, and the agent's sovereign notebook | `2026-06-11-notebook-sovereign-space` · `2026-06-10-notebook-agent-own-space` |
|
|
33
33
|
| **Three-tier constitution** | The governance surface splits into an always-on **Ontology** (Telos, Evidence, Decisions, Ownership, Conduct — the Pact absorbed into Telos), the nine always-on **Invariants**, and five toggleable **Doctrine** packs (craft, rigor, ops, process, comms) addressed `<pack> <n>`. Every rule carries a permanent id; its number is its position, computed at render time, and a citation renders as the rule's principle name. Packs are chosen at build time with `--doctrines` or the setup wizard; the whole catalogue ships on disk either way, so a citation into an inactive pack still resolves. Precedence, in order: Ontology + Invariants, then the user's `user-rules.md`, then the active Doctrines, then `PROFILE.md`. `doctor`'s `constitutionProblems` gates rule ids (declared, unique, never a retired one), the per-rule Principle column, every `{{LAW:<id>}}` / `{{DOCTRINE:<id>}}` citation in `src/`, and the rule that an always-on tier may never cite a toggleable one | `2026-08-19-three-tier-constitution-design` |
|
|
34
34
|
| **`doctor`** | One check: unresolved tokens, dead/non-hermetic links, theme-key parity, authoring gates, rendered-bundle drift | `2026-06-07-theme-aware-doctor-diff` |
|
|
35
35
|
| **`diff` + improvements export** | Deployed-vs-source drift report; export an `improvements.md` back-port | `2026-06-12-improvements-export` |
|
package/adapters/bob/README.md
CHANGED
|
@@ -104,7 +104,7 @@ What the global emit writes into `~/.bob/settings/settings.json`:
|
|
|
104
104
|
| event | verb | how the verdict travels |
|
|
105
105
|
| --- | --- | --- |
|
|
106
106
|
| `SessionStart` | `context --host bob` | plain stdout, as on Claude |
|
|
107
|
-
| `PreToolUse` | `tool-gate --host bob` — one group, no matcher | Laws I/IV, rigor-5 and ops-2: **exit 2**, reason on stderr — it says no chat confirmation lifts the block, since Bob has no ask tier; process 1/5: a stderr line, exit 0; the ownership gate (the session's first write in an application repo with no `## Ownership` section in its root `AGENTS.md`): **exit 2 once**, the same write then passes — off with `--no-ownership-gate` or `
|
|
107
|
+
| `PreToolUse` | `tool-gate --host bob` — one group, no matcher | Laws I/IV, rigor-5 and ops-2: **exit 2**, reason on stderr — it says no chat confirmation lifts the block, since Bob has no ask tier; process 1/5: a stderr line, exit 0; the ownership gate (the session's first write in an application repo with no `## Ownership` section in its root `AGENTS.md`): **exit 2 once**, the same write then passes — off with `--no-ownership-gate`, `mode: off`, or a personal `Setup: declined <YYYY-MM-DD>` line in `.geneseed/ownership.md` |
|
|
108
108
|
| `Stop` | `learn` | never a verdict |
|
|
109
109
|
| `UserPromptSubmit` | `activity --host bob` | never a verdict; records the turn for the web console's Activity view |
|
|
110
110
|
|
|
@@ -43,8 +43,10 @@ absolute-path hooks instead — `geneseed setup` does that for you.) It:
|
|
|
43
43
|
something you want kept is a rule or a fact is your call). In an application repo (a git
|
|
44
44
|
root holding a build manifest) whose root `AGENTS.md` has no `## Ownership` section, it also
|
|
45
45
|
denies the session's first write once, with a reason addressed to the agent: propose the
|
|
46
|
-
ownership setup,
|
|
47
|
-
with `mode: off` in that section,
|
|
46
|
+
ownership setup now, skip this session, or skip in this repo until asked; the next write
|
|
47
|
+
passes, and sub-agents defer. Off per repo with `mode: off` in that section, for one developer
|
|
48
|
+
in one repo with `Setup: declined <YYYY-MM-DD>` in their personal `.geneseed/ownership.md`,
|
|
49
|
+
per install with `--no-ownership-gate`. Ordinary edits pass.
|
|
48
50
|
(`MultiEdit` is not a Claude Code tool and is not in the matcher; the gate reads
|
|
49
51
|
`edits[].new_string` as a cheap guard regardless.)
|
|
50
52
|
- on **SessionStart**, every source (`startup`, `resume`, `clear`, `compact`, `fork`), runs
|
|
@@ -126,8 +126,8 @@ to native **skills**, not slash commands (same `SKILL.md` shape as Claude Code).
|
|
|
126
126
|
| plugin on `session.created` | **context plugin (v2)** — auto-discovers & injects the repo's `eager` docs |
|
|
127
127
|
| plugin on `experimental.session.compacting` | **context plugin** — re-pushes the `eager` docs so they survive compaction |
|
|
128
128
|
| plugin on `session.idle` | **learn plugin** — distils memory into `memory/` (debounced to fire once, at session end) |
|
|
129
|
-
| plugin on `experimental.chat.messages.transform` (V1) | **context plugin** — also adds the done gate's reminder when a check in `.geneseed/done-checks.txt` has not passed since the last edit (Verify Before Asserting); OpenCode 2 turns are not judged |
|
|
130
|
-
| plugin on `tool.execute.before` | **guard plugin** — blocks secret-file writes and credential-shaped write content (Sealed Secrets), writes to a protected check or the done list (External Gate), catastrophic shell and every other real data loss, judged against the repository's state (Deletion Is Deliberate), a recursive whole-filesystem scan (Commands Must Return), the first rule-store write (Persist Insight), protected wiki folders, and the session's first write in an application repo with no `## Ownership` section in its root `AGENTS.md` (the ownership gate, once; a child session defers; off with `--no-ownership-gate`); logs each block to the gate ledger and counts skill/subagent use (`GENESEED_GUARD=off\|warn`) |
|
|
129
|
+
| plugin on `experimental.chat.messages.transform` (V1) | **context plugin** — also adds the done gate's reminder when a check in `.geneseed/done-checks.txt` (or, without it, a check inferred from the root manifests) has not passed since the last edit (Verify Before Asserting); OpenCode 2 turns are not judged |
|
|
130
|
+
| plugin on `tool.execute.before` | **guard plugin** — blocks secret-file writes and credential-shaped write content (Sealed Secrets), writes to a protected check or the done list (External Gate), catastrophic shell and every other real data loss, judged against the repository's state (Deletion Is Deliberate), a recursive whole-filesystem scan (Commands Must Return), the first rule-store write (Persist Insight), protected wiki folders, and the session's first write in an application repo with no `## Ownership` section in its root `AGENTS.md` (the ownership gate, once; a child session defers; off with `--no-ownership-gate` or a personal `Setup: declined <date>` line in `.geneseed/ownership.md`); logs each block to the gate ledger and counts skill/subagent use (`GENESEED_GUARD=off\|warn`) |
|
|
131
131
|
| plugin registering a custom tool | **workflow plugin** — the `workflow` tool runs saved orchestration scripts from `workflows/` |
|
|
132
132
|
| `context.json` / `.harness/` (manifest) | *optional* override when discovery doesn't fit |
|
|
133
133
|
|
|
@@ -252,7 +252,10 @@ the script, not the model, drives the control flow.
|
|
|
252
252
|
concurrency is capped at `min(16, cores − 2)`; `budget` meters output tokens.
|
|
253
253
|
- **Synchronous and contained:** the tool blocks until the workflow finishes; a
|
|
254
254
|
phase-by-phase trace plus the full result land in
|
|
255
|
-
`.geneseed/workflow-runs/<runId>.log`.
|
|
255
|
+
`.geneseed/workflow-runs/<runId>.log`; a `.geneseed/` with no `.gitignore` gets one
|
|
256
|
+
that ignores everything there but the team paths (`bricks/`, `loops/`, the two check
|
|
257
|
+
lists and itself), so traces and isolation worktrees stay out of `git status`. An
|
|
258
|
+
existing one is left as is. Failures are reported, never thrown into
|
|
256
259
|
the session. `GENESEED_DEBUG=1` enables stderr logging.
|
|
257
260
|
|
|
258
261
|
The matching `workflow` **skill** (in the rendered bundle) teaches the agent when
|
|
@@ -389,7 +392,8 @@ behaviour** — nothing changes the machine's current agent/model unless you opt
|
|
|
389
392
|
a declared wiki's `protected` folders (AGENT.md §8, from `geneseed-wiki.jsonc`); **refuses
|
|
390
393
|
once** the session's first write in an application repo whose root `AGENTS.md` has no
|
|
391
394
|
`## Ownership` section (the ownership gate; a child session defers; off with `mode: off` in
|
|
392
|
-
that section
|
|
395
|
+
that section, a personal `Setup: declined <YYYY-MM-DD>` line in `.geneseed/ownership.md`, or
|
|
396
|
+
an install built `--no-ownership-gate`); **warns** on
|
|
393
397
|
`.env` writes. `GENESEED_GUARD=off` disables it, `=warn` downgrades
|
|
394
398
|
blocks to warnings. Every **block** appends one line to the install's
|
|
395
399
|
`notebook/gates.jsonl` (rule `law-1` / `law-4` / `process-1` / `wiki` / `ownership`, a timestamp,
|
|
@@ -415,6 +419,18 @@ behaviour** — nothing changes the machine's current agent/model unless you opt
|
|
|
415
419
|
`"git commit*"` / `"git push*"` to `"allow"` in your own `permission.bash` map. (Note:
|
|
416
420
|
OpenCode lets a user pick "always allow" for the session, which makes the gate
|
|
417
421
|
session-sticky — the Claude Code adapter's PreToolUse hook re-asks every time instead.)
|
|
422
|
+
- **Gate-config asks** (*External Gate*). The emit also writes `permission.edit` "ask" keys
|
|
423
|
+
for the files that can switch a gate off: every `opencode.json(c)`, the global
|
|
424
|
+
`config.json`, the install's `AGENT.md`, the install dir's `excludes.json`, manifest,
|
|
425
|
+
`.geneseed-emit` and `plugins/geneseed-*.js`, the `.claude/`, `.openclaude/` and `.bob/`
|
|
426
|
+
hook settings, and the hook shim dir — each as a bare and a `*/` pattern (a root `AGENT.md`
|
|
427
|
+
bare only). A missing `edit` gets only these keys; a blanket `"edit": "allow"` becomes
|
|
428
|
+
`{"*": "allow", …}` with the asks after it; a blanket `"ask"`/`"deny"` is left alone; a key
|
|
429
|
+
you already set is kept and named in a warning. The manifest records what Geneseed added
|
|
430
|
+
(`edit_asks`, `edit_shorthand`); a rebuild drops a recorded key it no longer wants, and
|
|
431
|
+
uninstall removes those still set to `"ask"` and restores your `"allow"`. The guard plugin no
|
|
432
|
+
longer refuses these files — it would hide the prompt — but still refuses the other hosts'
|
|
433
|
+
Geneseed-only files (`excludes.json`, `AGENT.md`, manifest).
|
|
418
434
|
- **Primary agent** (`GENESEED_PRIMARY=1`). Emits a `mode: primary` orchestrator that
|
|
419
435
|
works by the Rules and delegates to the capability subagents. Off by default (it can
|
|
420
436
|
change which agent is your default, so it stays opt-in).
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
// distil sessions are skipped entirely, and so is a child whose parent this process does not
|
|
22
22
|
// track.
|
|
23
23
|
//
|
|
24
|
-
// Snapshot v2 (the Activity garden) adds `files[].path` and `files[].by`, `root` (
|
|
25
|
-
// own
|
|
24
|
+
// Snapshot v2 (the Activity garden) adds `files[].path` and `files[].by`, `root` (the git root
|
|
25
|
+
// of the session's own directory), `repo` (its main checkout), `agents`, `turns`, `context` and the compaction
|
|
26
26
|
// trio — see docs/reference/opencode-plugins.md.
|
|
27
27
|
//
|
|
28
28
|
// v1.1 enriches each entry from events/fields it already receives or one `case` away:
|
|
@@ -134,8 +134,8 @@ function acctTotals(map, msgId, cost, tokens) {
|
|
|
134
134
|
return { cost: c, tokens: t }
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
// Where a FileDiff's file is, for the garden: OpenCode's own path (relative to the
|
|
138
|
-
// `/`-separated) when
|
|
137
|
+
// Where a FileDiff's file is, for the garden: OpenCode's own path (relative to the session's
|
|
138
|
+
// checkout, `/`-separated) when the session has a root, else null — as for anything that would leave the root
|
|
139
139
|
// or is absolute (`../`, `/`, a drive, a UNC path). Never an absolute path on disk, and never
|
|
140
140
|
// a basename in `path`, where it would collide with a same-named file at the top of the repo.
|
|
141
141
|
function relPath(file, root) {
|
|
@@ -235,13 +235,14 @@ function mainWorktreeOf(cwd) {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
// `
|
|
239
|
-
//
|
|
240
|
-
//
|
|
241
|
-
//
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
238
|
+
// `top` is the git root above the SESSION's own directory (gitRootOf), or null outside any
|
|
239
|
+
// repository — never the plugin instance's worktree: one `opencode serve` hosts an instance per
|
|
240
|
+
// opened project, every instance hears every session, and each would otherwise stamp its own
|
|
241
|
+
// root on all of them. `root` is that top level (a linked worktree is its own root); a
|
|
242
|
+
// filesystem root is no root. `repo` is the main checkout, the root itself on a main checkout.
|
|
243
|
+
function rootsOf(top) {
|
|
244
|
+
if (typeof top !== "string" || !top) return { root: null, repo: null }
|
|
245
|
+
const root = path.resolve(top)
|
|
245
246
|
if (root === path.parse(root).root) return { root: null, repo: null }
|
|
246
247
|
return { root, repo: mainWorktreeOf(root) ?? root }
|
|
247
248
|
}
|
|
@@ -316,8 +317,8 @@ function removeDetail(sid) { try { fs.unlinkSync(detailPath(sid)) } catch {} }
|
|
|
316
317
|
|
|
317
318
|
// --- plugin ------------------------------------------------------------------
|
|
318
319
|
|
|
319
|
-
|
|
320
|
-
|
|
320
|
+
// `input` (V1's worktree) is not read: root/repo are per session (see rootsOf).
|
|
321
|
+
export const GeneseedActivity = async (_input) => {
|
|
321
322
|
const owned = new Map() // sid -> entry (top-level sessions this process tracks)
|
|
322
323
|
const skipped = new Set() // sid -> geneseed throwaway / orphan child, ignored from here on
|
|
323
324
|
const childOf = new Map() // child sid -> the owned root session it is a sub-agent of
|
|
@@ -366,12 +367,13 @@ export const GeneseedActivity = async (input) => {
|
|
|
366
367
|
}
|
|
367
368
|
const wideDiff = (sid, list) => {
|
|
368
369
|
if (!Array.isArray(list) || !owned.has(sid)) return false
|
|
369
|
-
detFor(sid).wideDiff = list.map((d) => slimDiff(d, null, root))
|
|
370
|
+
detFor(sid).wideDiff = list.map((d) => slimDiff(d, null, owned.get(sid).root))
|
|
370
371
|
return !detFor(sid).turnDiffs.size // write only when it is the source in force
|
|
371
372
|
}
|
|
372
373
|
// A turn's diff list (user message `id` of session `owner`; `by` the child that ran it).
|
|
374
|
+
// Paths are relative to the owner's root: a sub-agent works in its parent's checkout.
|
|
373
375
|
const turnDiff = (owner, id, list, by) => {
|
|
374
|
-
detFor(owner).turnDiffs.set(id, list.map((d) => slimDiff(d, by, root)))
|
|
376
|
+
detFor(owner).turnDiffs.set(id, list.map((d) => slimDiff(d, by, owned.get(owner)?.root ?? null)))
|
|
375
377
|
}
|
|
376
378
|
const agentsOf = (sid) => { let m = agentRows.get(sid); if (!m) { m = new Map(); agentRows.set(sid, m) } return m }
|
|
377
379
|
// Create or update a sub-agent row of `owner`; writes only on a change.
|
|
@@ -537,7 +539,7 @@ export const GeneseedActivity = async (input) => {
|
|
|
537
539
|
}
|
|
538
540
|
if (event.type !== "session.created" && !owned.has(sid)) return
|
|
539
541
|
const ev = { type: event.type, title: info.title ?? null, cwd: info.directory }
|
|
540
|
-
if (!owned.has(sid)) Object.assign(ev, {
|
|
542
|
+
if (!owned.has(sid)) Object.assign(ev, { ...rootsOf(info.directory && gitRootOf(info.directory)), agents: [], turns: 0, context: null,
|
|
541
543
|
compactions: 0, compacted_at: null, context_at_compaction: null })
|
|
542
544
|
// A session summary is a files source only when it carries diffs (see setFiles):
|
|
543
545
|
// 1.19 sends it zeroed on every step, which must not wipe the card.
|
|
@@ -804,13 +806,13 @@ function toV1Events(ev, tools) {
|
|
|
804
806
|
}
|
|
805
807
|
|
|
806
808
|
async function setupV2(ctx) {
|
|
807
|
-
//
|
|
808
|
-
//
|
|
809
|
-
// files are relative to the same tree (core snapshot.ts: git.repo.discover on
|
|
809
|
+
// As on V1, each session's root is the checkout's top level above its own directory
|
|
810
|
+
// (session.created's `location.directory`, carried by toV1Events), never this instance's.
|
|
811
|
+
// Step files are relative to the same tree (core snapshot.ts: git.repo.discover on
|
|
810
812
|
// location.project.directory, which project.ts resolves from the nearest `.git` above the
|
|
811
813
|
// directory), but OpenCode takes its realPath: through a symlinked path the two spellings
|
|
812
814
|
// of the root differ, while the relative file paths do not.
|
|
813
|
-
const hooks = await GeneseedActivity(
|
|
815
|
+
const hooks = await GeneseedActivity()
|
|
814
816
|
const tools = new Map()
|
|
815
817
|
// The user's prompt, as V1's chat.message hook received it.
|
|
816
818
|
await ctx.session.hook("prompt", async (event) => {
|
|
@@ -795,7 +795,7 @@ async function renderSet(out, { eager, lazy }, state, { fold = false } = {}) {
|
|
|
795
795
|
state.lazy += lazyLines.length
|
|
796
796
|
}
|
|
797
797
|
|
|
798
|
-
async function buildBlock(sets, wikis = [], commands = [], session = []) {
|
|
798
|
+
async function buildBlock(sets, wikis = [], commands = [], session = [], done = null) {
|
|
799
799
|
const state = { spent: 0, injected: 0, lazy: 0, headingsRead: 0 }
|
|
800
800
|
|
|
801
801
|
// A session file discovery also found (user-rules.md at the root of a project install,
|
|
@@ -816,7 +816,8 @@ async function buildBlock(sets, wikis = [], commands = [], session = []) {
|
|
|
816
816
|
state.injected++
|
|
817
817
|
}
|
|
818
818
|
|
|
819
|
-
|
|
819
|
+
// The done gate's line opens the project section, and keeps it (and the block) alive alone.
|
|
820
|
+
const proj = done ? [done, ""] : []
|
|
820
821
|
await renderSet(proj, sets, state, { fold: true })
|
|
821
822
|
|
|
822
823
|
if (commands.length) {
|
|
@@ -846,8 +847,9 @@ async function buildBlock(sets, wikis = [], commands = [], session = []) {
|
|
|
846
847
|
|
|
847
848
|
// Resolve the eager/lazy sets (manifest or auto-discovery) plus the machine wikis,
|
|
848
849
|
// and render the injection block — shared by the session.created injection and the
|
|
849
|
-
// compaction hook (the transform path reuses it via cachedBlockText).
|
|
850
|
-
|
|
850
|
+
// compaction hook (the transform path reuses it via cachedBlockText). `judged` false is
|
|
851
|
+
// OpenCode 2, which never judges a turn: its done line claims no verdict.
|
|
852
|
+
async function resolveBlock(root, judged = true) {
|
|
851
853
|
const harness = await harnessDir()
|
|
852
854
|
const src = await resolveSource(root, harness)
|
|
853
855
|
const sets = src.mode === "manifest"
|
|
@@ -855,7 +857,10 @@ async function resolveBlock(root) {
|
|
|
855
857
|
: await discover(root)
|
|
856
858
|
const wikis = await wikiSets()
|
|
857
859
|
const commands = await discoverCommands(root)
|
|
858
|
-
|
|
860
|
+
const done = (await doneGateOff()) ? null : await doneLine(root, judged).catch(() => null)
|
|
861
|
+
const owned = (await ownershipGateOff()) ? null : await ownershipLine(root).catch(() => null)
|
|
862
|
+
const heads = [done, owned].filter(Boolean).join("\n") || null
|
|
863
|
+
return { block: await buildBlock(sets, wikis, commands, await sessionFiles(harness), heads), src }
|
|
859
864
|
}
|
|
860
865
|
|
|
861
866
|
// Per-INSTANCE cache of the rendered block text for the transform path: the caller owns
|
|
@@ -868,7 +873,7 @@ async function cachedBlockText(root, cache) {
|
|
|
868
873
|
const now = Date.now()
|
|
869
874
|
if (cache.text !== null && now - cache.at < BLOCK_TTL_MS) return cache.text
|
|
870
875
|
let text = ""
|
|
871
|
-
try { const { block } = await resolveBlock(root); text = block?.text || "" } catch {}
|
|
876
|
+
try { const { block } = await resolveBlock(root, cache.judged ?? true); text = block?.text || "" } catch {}
|
|
872
877
|
cache.text = text
|
|
873
878
|
cache.at = now
|
|
874
879
|
return text
|
|
@@ -916,15 +921,134 @@ function doneGateOff() {
|
|
|
916
921
|
return doneGateOffOnce
|
|
917
922
|
}
|
|
918
923
|
|
|
924
|
+
// null when the project has no list (or it is unreadable): then the checks are inferred.
|
|
919
925
|
async function readDoneChecks(root) {
|
|
920
926
|
try {
|
|
921
927
|
const text = await fs.readFile(path.join(root, DONE_LIST), "utf8")
|
|
922
928
|
return text.split(/\r?\n/).map((l) => l.trim().replace(/\s+/g, " ")).filter((l) => l && !l.startsWith("#"))
|
|
923
929
|
} catch {
|
|
924
|
-
return
|
|
930
|
+
return null
|
|
925
931
|
}
|
|
926
932
|
}
|
|
927
933
|
|
|
934
|
+
// The inference twin of js/hosts/done-checks.mjs (user decision 2026-10-29): with no list, the
|
|
935
|
+
// root manifests imply the checks, each a GROUP of accepted forms. Here they only shape the
|
|
936
|
+
// reminder's wording ("advisory"); OpenCode never blocks either way.
|
|
937
|
+
// tests/plugins/context_done.test.mjs runs both copies over the same fixtures.
|
|
938
|
+
const PM_LOCKS = [["bun.lockb", "bun"], ["bun.lock", "bun"], ["pnpm-lock.yaml", "pnpm"], ["yarn.lock", "yarn"]]
|
|
939
|
+
const PM_SCRIPTS = ["test", "lint", "typecheck"]
|
|
940
|
+
function scriptCheck(pm, s) {
|
|
941
|
+
const npm = s === "test" ? ["npm test", "npm run test", "npm t"] : [`npm run ${s}`]
|
|
942
|
+
const own = pm === "npm" ? [] : pm === "bun" ? [`bun run ${s}`] : [`${pm} ${s}`, `${pm} run ${s}`]
|
|
943
|
+
return { label: own[0] ?? npm[0], forms: [...own, ...npm] }
|
|
944
|
+
}
|
|
945
|
+
const wrapped = (label, bins, tasks, refuse) => ({
|
|
946
|
+
label, refuse, forms: bins.flatMap((b) => tasks.flatMap((t) => [`${b} ${t}`, `${b} clean ${t}`])),
|
|
947
|
+
})
|
|
948
|
+
const MAVEN = wrapped("mvn test", ["mvn", "./mvnw", ".\\mvnw", "mvnw", "mvnw.cmd"], ["test", "verify", "install"],
|
|
949
|
+
/(?:^|\s)-D(?:skipTests|maven\.test\.skip)(?=[=\s]|$)/)
|
|
950
|
+
const GRADLE = wrapped("gradle test", ["gradle", "./gradlew", ".\\gradlew", "gradlew", "gradlew.bat"], ["test", "build", "check"],
|
|
951
|
+
/(?:^|\s)(?:-x|--exclude-task)[ =](?:\S*:)?test(?=\s|$)/)
|
|
952
|
+
const PYTEST = { label: "pytest", forms: ["pytest", "python -m pytest", "python3 -m pytest", "py -m pytest", "poetry run pytest"] }
|
|
953
|
+
const MANIFEST_CHECKS = [
|
|
954
|
+
["pom.xml", MAVEN],
|
|
955
|
+
["build.gradle", GRADLE],
|
|
956
|
+
["build.gradle.kts", GRADLE],
|
|
957
|
+
["pyproject.toml", PYTEST],
|
|
958
|
+
["Cargo.toml", { label: "cargo test", forms: ["cargo test"], refuse: /(?:^|\s)--no-run(?=\s|$)/ }],
|
|
959
|
+
["go.mod", { label: "go test", forms: ["go test"] }],
|
|
960
|
+
]
|
|
961
|
+
const exists = (p) => fs.access(p).then(() => true, () => false)
|
|
962
|
+
// The Node hook's `gitRootOf`: the nearest ancestor holding `.git` (a dir, or a worktree's file).
|
|
963
|
+
async function gitRootOf(dir) {
|
|
964
|
+
for (let d = path.resolve(dir); ; d = path.dirname(d)) {
|
|
965
|
+
if (await exists(path.join(d, ".git"))) return d
|
|
966
|
+
if (path.dirname(d) === d) return null
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
async function inferDoneChecks(root) {
|
|
970
|
+
const has = (f) => exists(path.join(root, f))
|
|
971
|
+
const sources = [], checks = []
|
|
972
|
+
const add = (source, list) => {
|
|
973
|
+
if (!list.length) return
|
|
974
|
+
sources.push(source)
|
|
975
|
+
for (const c of list) if (!checks.some((k) => k.label === c.label)) checks.push(c)
|
|
976
|
+
}
|
|
977
|
+
if (await has("package.json")) {
|
|
978
|
+
let scripts = null
|
|
979
|
+
try { scripts = JSON.parse(await fs.readFile(path.join(root, "package.json"), "utf8")).scripts } catch {}
|
|
980
|
+
if (!scripts || typeof scripts !== "object") scripts = {}
|
|
981
|
+
let pm = "npm"
|
|
982
|
+
for (const [f, name] of PM_LOCKS) if (await has(f)) { pm = name; break }
|
|
983
|
+
add("package.json", PM_SCRIPTS.filter((s) => typeof scripts[s] === "string"
|
|
984
|
+
&& !(s === "test" && /no test specified/.test(scripts[s]))).map((s) => scriptCheck(pm, s)))
|
|
985
|
+
}
|
|
986
|
+
// pytest only where it shows (the Node side's rule): a unittest-only repo could never clear it.
|
|
987
|
+
const pytestShows = async () => {
|
|
988
|
+
const toml = await fs.readFile(path.join(root, "pyproject.toml"), "utf8").catch(() => "")
|
|
989
|
+
if (toml.includes("[tool.pytest")) return true
|
|
990
|
+
for (const f of ["pytest.ini", "conftest.py", "tests"]) if (await has(f)) return true
|
|
991
|
+
return false
|
|
992
|
+
}
|
|
993
|
+
for (const [file, check] of MANIFEST_CHECKS) {
|
|
994
|
+
if (await has(file) && (check !== PYTEST || await pytestShows())) add(file, [check])
|
|
995
|
+
}
|
|
996
|
+
return { sources, checks }
|
|
997
|
+
}
|
|
998
|
+
// The checks of the git root above `dir`; `root` null outside a repo: no gate, as on the Node side.
|
|
999
|
+
async function doneChecksOf(dir) {
|
|
1000
|
+
const root = await gitRootOf(dir)
|
|
1001
|
+
if (!root) return { root, source: "", blocking: false, checks: [] }
|
|
1002
|
+
const listed = await readDoneChecks(root)
|
|
1003
|
+
if (listed) return { root, source: DONE_LIST, blocking: true, checks: listed.map((l) => ({ label: l, forms: [l] })) }
|
|
1004
|
+
const { sources, checks } = await inferDoneChecks(root)
|
|
1005
|
+
return { root, source: sources.join(", "), blocking: false, checks }
|
|
1006
|
+
}
|
|
1007
|
+
// The context block's one line on the done gate. "reminder", not "blocking": nothing blocks here.
|
|
1008
|
+
// `judged` false (OpenCode 2, whose turns are never judged) claims no verdict at all.
|
|
1009
|
+
async function doneLine(dir, judged = true) {
|
|
1010
|
+
const { root, source, blocking, checks } = await doneChecksOf(dir)
|
|
1011
|
+
if (!root) return null
|
|
1012
|
+
const names = checks.map((c) => c.label).join(", ")
|
|
1013
|
+
const how = (verdict) => (judged ? verdict : "not judged on this host")
|
|
1014
|
+
if (blocking) return checks.length ? `Done gate: from ${source} — ${names} (${how("reminder")})` : `Done gate: off — ${source} lists no checks`
|
|
1015
|
+
return checks.length ? `Done gate: inferred from ${source} — ${names} (${how("advisory")})` : "Done gate: no checks could be inferred"
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
// ---- The ownership decline reminder: the twin of js/hosts/ownership-gate.mjs `ownershipLine` ----
|
|
1019
|
+
// In an application repo (a git root holding a build manifest) whose root AGENTS.md has no
|
|
1020
|
+
// `## Ownership` section outside the Geneseed block, the developer's `Setup: declined <date>`
|
|
1021
|
+
// line in `.geneseed/ownership.md` gets one context line, so the decline stays visible. Same
|
|
1022
|
+
// manifests, strip, section and decline patterns as the hook (and geneseed-guard.js, whose gate
|
|
1023
|
+
// defers on that line). `--no-ownership-gate` (`Ownership gate: off` in AGENT.md) prints nothing.
|
|
1024
|
+
const OWN_MANIFESTS = new Set(["package.json", "pom.xml", "pyproject.toml", "go.mod", "Cargo.toml",
|
|
1025
|
+
"composer.json", "Gemfile"])
|
|
1026
|
+
const isOwnManifest = (n) => OWN_MANIFESTS.has(n) || n.startsWith("build.gradle") || n.endsWith(".csproj")
|
|
1027
|
+
const OWN_BLOCK_RE = /<!-- BEGIN GENESEED -->[\s\S]*?<!-- END GENESEED -->/g
|
|
1028
|
+
const OWN_SECTION_RE = /^## Ownership[ \t]*\r?$/m
|
|
1029
|
+
const OWN_DECLINED_RE = /^Setup:[ \t]*declined[ \t]+(\d{4}-\d{2}-\d{2})[ \t]*\r?$/m
|
|
1030
|
+
let ownershipGateOffOnce = null
|
|
1031
|
+
function ownershipGateOff() {
|
|
1032
|
+
ownershipGateOffOnce ??= (async () => {
|
|
1033
|
+
const dir = await harnessDir()
|
|
1034
|
+
if (!dir) return false
|
|
1035
|
+
const text = await fs.readFile(path.join(dir, "AGENT.md"), "utf8")
|
|
1036
|
+
return /^Ownership gate:[ \t]*off[ \t]*\r?$/m.test(text)
|
|
1037
|
+
})().catch(() => false)
|
|
1038
|
+
return ownershipGateOffOnce
|
|
1039
|
+
}
|
|
1040
|
+
async function ownershipLine(dir) {
|
|
1041
|
+
const root = await gitRootOf(dir)
|
|
1042
|
+
if (!root || !(await fs.readdir(root)).some(isOwnManifest)) return null
|
|
1043
|
+
const agents = await fs.readFile(path.join(root, "AGENTS.md"), "utf8").catch(() => "")
|
|
1044
|
+
if (OWN_SECTION_RE.test(agents.replace(OWN_BLOCK_RE, ""))) return null
|
|
1045
|
+
// The decline lives in the MAIN worktree (a fresh linked worktree per session must not lose it).
|
|
1046
|
+
const home = (await mainWorktreeOf(root)) ?? root
|
|
1047
|
+
const personal = await fs.readFile(path.join(home, ".geneseed", "ownership.md"), "utf8").catch(() => "")
|
|
1048
|
+
const since = OWN_DECLINED_RE.exec(personal.replace(/^\uFEFF/, ""))?.[1]
|
|
1049
|
+
return since ? `Ownership: setup declined since ${since} — not set up; say "set up ownership" to run it` : null
|
|
1050
|
+
}
|
|
1051
|
+
|
|
928
1052
|
function runsUnpiped(command, line) {
|
|
929
1053
|
const cmd = String(command).replace(/[ \t]+/g, " ")
|
|
930
1054
|
for (let i = cmd.indexOf(line); i !== -1; i = cmd.indexOf(line, i + 1)) {
|
|
@@ -947,11 +1071,21 @@ function runsUnpiped(command, line) {
|
|
|
947
1071
|
if (two === "&&" || two === "||" || rest[j] === ";" || rest[j] === "\n") break
|
|
948
1072
|
if (rest[j] === "|") { piped = true; break }
|
|
949
1073
|
}
|
|
950
|
-
if (!piped) return true
|
|
1074
|
+
if (!piped && !/\|\||[;\n] ?(?:true|:|exit(?: 0)?)(?= ?(?:$|[;&|\n]))/.test(rest)) return true
|
|
951
1075
|
}
|
|
952
1076
|
return false
|
|
953
1077
|
}
|
|
954
1078
|
|
|
1079
|
+
// The twin of hooks-done.mjs's `groupPasses`: a form runs unpiped, and no flag in `refuse`
|
|
1080
|
+
// skips the tests in the segment that ran it. Held equal by tests/plugins/context_done.test.mjs.
|
|
1081
|
+
function groupPasses(command, g) {
|
|
1082
|
+
if (!g.forms.some((f) => runsUnpiped(command, f))) return false
|
|
1083
|
+
if (!g.refuse) return true
|
|
1084
|
+
return String(command).replace(/[ \t]+/g, " ").split(/&&|\|\||;|\n/).map((s) => s.trim())
|
|
1085
|
+
.some((s) => !s.includes("|") && !g.refuse.test(s)
|
|
1086
|
+
&& g.forms.some((f) => s === f || s.startsWith(`${f} `)))
|
|
1087
|
+
}
|
|
1088
|
+
|
|
955
1089
|
// An `apply_patch` call names its targets only in `patchText` markers. Copied from
|
|
956
1090
|
// geneseed-guard.js (tests/plugins/helper_parity.test.mjs holds the copies equal); `from` is
|
|
957
1091
|
// the pre-move path of an `Update File` + `Move to`, `path` where the file lands.
|
|
@@ -982,6 +1116,7 @@ function patchSections(patchText) {
|
|
|
982
1116
|
// The checks still owed, judged over the previous turn and the current one: a reminder lasts
|
|
983
1117
|
// one turn, not the whole session. Our own injected messages (`geneseed-*` ids) open no turn.
|
|
984
1118
|
function doneOwed(messages, checks, root) {
|
|
1119
|
+
const groups = checks.map((c) => (typeof c === "string" ? { label: c, forms: [c] } : c))
|
|
985
1120
|
const prompts = []
|
|
986
1121
|
messages.forEach((m, i) => {
|
|
987
1122
|
if (m?.info?.role === "user" && !String(m.info.id ?? "").startsWith("geneseed-")) prompts.push(i)
|
|
@@ -1015,9 +1150,9 @@ function doneOwed(messages, checks, root) {
|
|
|
1015
1150
|
if (typeof command !== "string" || p.state.status !== "completed") continue
|
|
1016
1151
|
const exit = p.state.metadata?.exit
|
|
1017
1152
|
if (typeof exit === "number" && exit !== 0) continue
|
|
1018
|
-
for (const
|
|
1153
|
+
for (const g of groups) if (groupPasses(command, g)) passed.add(g.label)
|
|
1019
1154
|
}
|
|
1020
|
-
return
|
|
1155
|
+
return groups.map((g) => g.label).filter((l) => !passed.has(l))
|
|
1021
1156
|
}
|
|
1022
1157
|
|
|
1023
1158
|
// The session-scope rule, once for both majors and both deliveries: a child/subagent session
|
|
@@ -1162,16 +1297,16 @@ export const GeneseedContext = async (ctx) => {
|
|
|
1162
1297
|
// Its own function, so its early returns end the reminder, never the context injection.
|
|
1163
1298
|
await (async () => {
|
|
1164
1299
|
if (await doneGateOff()) return
|
|
1165
|
-
const checks = await
|
|
1300
|
+
const { root: gitRoot, source, blocking, checks } = await doneChecksOf(root)
|
|
1166
1301
|
if (!checks.length) return
|
|
1167
|
-
const owed = doneOwed(output.messages, checks,
|
|
1302
|
+
const owed = doneOwed(output.messages, checks, gitRoot)
|
|
1168
1303
|
if (!owed.length) return
|
|
1169
1304
|
const stamp = Date.now()
|
|
1170
1305
|
output.messages.unshift({
|
|
1171
1306
|
info: { id: `geneseed-done-${stamp}`, role: "user", sessionID: sid, time: { created: stamp } },
|
|
1172
1307
|
parts: [{ id: `geneseed-done-part-${stamp}`, type: "text", text:
|
|
1173
|
-
|
|
1174
|
-
+ `${
|
|
1308
|
+
`Geneseed (Verify Before Asserting) — files were edited, and these checks ${blocking ? "from" : "(advisory) inferred from"} `
|
|
1309
|
+
+ `${source} have not passed since the last edit: ${owed.join("; ")}. Run them unpiped `
|
|
1175
1310
|
+ "before reporting the work done, or say plainly that they were not run and why." }],
|
|
1176
1311
|
})
|
|
1177
1312
|
log("transform: done-gate reminder injected")
|
|
@@ -1224,7 +1359,8 @@ const v2Model = (ref) => (ref?.providerID && ref?.id ? `${ref.providerID}/${ref.
|
|
|
1224
1359
|
|
|
1225
1360
|
async function setupV2(ctx) {
|
|
1226
1361
|
const root = repoRoot({ worktree: ctx?.location?.project?.directory, directory: ctx?.location?.directory })
|
|
1227
|
-
|
|
1362
|
+
// `judged: false`: OpenCode 2 never judges a turn, so the done line claims no verdict.
|
|
1363
|
+
const blockCache = { text: null, at: 0, judged: false }
|
|
1228
1364
|
// Same scope rule as V1's skipSession. V2's info names the parent `parentID` only, so only
|
|
1229
1365
|
// that and the title are passed on.
|
|
1230
1366
|
const skipSession = sessionSkipper(async (sid) => {
|
|
@@ -1233,7 +1369,8 @@ async function setupV2(ctx) {
|
|
|
1233
1369
|
})
|
|
1234
1370
|
|
|
1235
1371
|
// The done gate is not judged on OpenCode 2 (see `doneOwed`): said once, where its log goes.
|
|
1236
|
-
|
|
1372
|
+
// The listed gate only: an inferred one would log in every repo with a manifest.
|
|
1373
|
+
if (!(await doneGateOff()) && await doneChecksOf(root).then((d) => d.blocking && d.checks.length, () => false)) {
|
|
1237
1374
|
console.error(`[geneseed-context] done gate: ${DONE_LIST} found, but OpenCode 2 turns are not judged.`)
|
|
1238
1375
|
}
|
|
1239
1376
|
|
|
@@ -1262,7 +1399,7 @@ async function setupV2(ctx) {
|
|
|
1262
1399
|
try {
|
|
1263
1400
|
if (await sovereignBypass(root)) return
|
|
1264
1401
|
if (!Array.isArray(event?.messages) || await skipSession(event.sessionID)) return
|
|
1265
|
-
const { block } = await resolveBlock(root)
|
|
1402
|
+
const { block } = await resolveBlock(root, false)
|
|
1266
1403
|
if (block) event.messages.unshift(v2UserMessage(event.messages, block.text))
|
|
1267
1404
|
} catch (err) {
|
|
1268
1405
|
log(`compaction error: ${err?.message ?? err}`)
|
|
@@ -1276,7 +1413,7 @@ async function setupV2(ctx) {
|
|
|
1276
1413
|
try {
|
|
1277
1414
|
if (isSkippedSession({ parentID: d.parentID, title: d.title })) continue
|
|
1278
1415
|
if (await sovereignBypass(root)) continue
|
|
1279
|
-
const { block } = await resolveBlock(root)
|
|
1416
|
+
const { block } = await resolveBlock(root, false)
|
|
1280
1417
|
if (!block) continue
|
|
1281
1418
|
await ctx.session.synthetic({
|
|
1282
1419
|
sessionID: d.sessionID, text: withModel(block.text, v2Model(d.model) || envModelStr()),
|