geneseed 4.28.0 → 4.29.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 +41 -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-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 +11 -3
- package/docs/concepts/ownership.md +7 -6
- 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-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 +15 -2
- 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/ownership.md +26 -4
- 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,47 @@ label. For the capability ↔ spec map, see [SHIPPED.md](SHIPPED.md).
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [4.29.0] — 2026-10-29
|
|
12
|
+
|
|
13
|
+
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.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **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.
|
|
18
|
+
- **`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.
|
|
19
|
+
- **`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.
|
|
20
|
+
- **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.
|
|
21
|
+
- **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.
|
|
22
|
+
- **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.
|
|
23
|
+
- **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.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- Ownership setup writes the root `AGENTS.md` only (and removes a personal `Setup: declined`
|
|
27
|
+
line, if there is one). `.geneseed/ownership.md` is created later,
|
|
28
|
+
only when there is personal state to keep (a finer granularity, the first pending checkpoint,
|
|
29
|
+
the first decision); no file means the team granularity, nothing pending, no decisions.
|
|
30
|
+
- `.geneseed/` is personal by default: its first writer creates `.geneseed/.gitignore` when
|
|
31
|
+
absent (never overwriting one) with `/*` plus `!/` exceptions for the team paths —
|
|
32
|
+
`.gitignore`, `bricks/`, `loops/`, `protected-checks.txt`, `done-checks.txt`. The writers are
|
|
33
|
+
the ownership and learn-mode Rites (in place of an offer to edit the root `.gitignore`) and
|
|
34
|
+
the OpenCode workflow plugin on its first trace, and a project emit whenever `.geneseed/`
|
|
35
|
+
exists at the git root.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
- **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.
|
|
39
|
+
- `--no-ownership-gate` now silences everything: the install's `AGENT.md` no longer carries the
|
|
40
|
+
"propose it once before the first write" sentence, so the model stops proposing the ownership
|
|
41
|
+
setup, nor the read-only `/document-project` suggestion beside it; and no decline reminder
|
|
42
|
+
prints at session start. Before, only the hook stood down.
|
|
43
|
+
- The OpenCode workflow runtime's `.geneseed/.gitignore` was a bare `*`, which hid new team
|
|
44
|
+
bricks and loops (and the check lists) from git; it now writes the same allowlist. An
|
|
45
|
+
existing `.geneseed/.gitignore` that holds only `*` (that old output) is upgraded
|
|
46
|
+
automatically on the next workflow run (and by the ownership and learn-mode Rites when they
|
|
47
|
+
next write there); any other content is left as is.
|
|
48
|
+
- If your project's ROOT `.gitignore` lists `.geneseed/` (added by the old Rite offer), remove
|
|
49
|
+
that line by hand: git cannot re-include files under an ignored directory, so the team paths
|
|
50
|
+
stay hidden until you do.
|
|
51
|
+
|
|
11
52
|
## [4.28.0] — 2026-10-28
|
|
12
53
|
|
|
13
54
|
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.29.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).
|
|
@@ -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()),
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
// - Wiki (AGENT.md §8): block mutations under a declared wiki's `protected`
|
|
15
15
|
// folders — the user's knowledge base sets its own no-go zones in geneseed-wiki.jsonc.
|
|
16
16
|
// - Ownership: in an application repo whose root AGENTS.md has no `## Ownership` section,
|
|
17
|
-
// refuse the session's first write once, so the agent proposes the setup first
|
|
17
|
+
// refuse the session's first write once, so the agent proposes the setup first — unless
|
|
18
|
+
// the developer's personal `.geneseed/ownership.md` holds `Setup: declined <date>`.
|
|
18
19
|
// High-confidence patterns only, so legitimate work is never caught. Borderline cases
|
|
19
20
|
// (.env edits) are WARNED, not blocked. Every block is recorded in the gate
|
|
20
21
|
// ledger (`<cfg>/notebook/gates.jsonl`) under the hook's rule key (`law-1`, `rigor-5`,
|
|
@@ -140,11 +141,12 @@ const WARN_ONLY = MODE === "warn"
|
|
|
140
141
|
// restart. Anything unreadable or unexpected reads as ARMED. Each stands down only its own check
|
|
141
142
|
// below (the real-loss check; the Sealed Secrets path block and content scan) — catastrophic
|
|
142
143
|
// commands, root scans and protected checks still block.
|
|
144
|
+
// Every dir the carrier may come from, in read order; the gate-config check protects AGENT.md in each.
|
|
145
|
+
const CARRIER_DIRS = [...(process.env.GENESEED_HARNESS ? [process.env.GENESEED_HARNESS] : []),
|
|
146
|
+
path.resolve(PLUGIN_DIR, ".."), path.resolve(PLUGIN_DIR, "..", "..")]
|
|
143
147
|
function carrierText() {
|
|
144
148
|
try {
|
|
145
|
-
const
|
|
146
|
-
if (process.env.GENESEED_HARNESS) dirs.unshift(process.env.GENESEED_HARNESS)
|
|
147
|
-
for (const d of dirs) {
|
|
149
|
+
for (const d of CARRIER_DIRS) {
|
|
148
150
|
try { return readFileSync(path.join(d, "AGENT.md"), "utf8") } catch { continue }
|
|
149
151
|
}
|
|
150
152
|
} catch { /* fall through: armed */ }
|
|
@@ -1355,6 +1357,37 @@ function protectedIn(target) {
|
|
|
1355
1357
|
}
|
|
1356
1358
|
}
|
|
1357
1359
|
|
|
1360
|
+
// ---- the gates' own configuration (External Gate) ------------------------------
|
|
1361
|
+
// Twin of js/hosts/hooks.mjs's `gateConfig`, MINUS what OpenCode now asks about itself
|
|
1362
|
+
// (tests/plugins/guard.test.mjs pins the difference). A file that turns a gate off is a gate the
|
|
1363
|
+
// agent can switch off. Every host's shared config — `opencode.json(c)`, the hook `settings.json`
|
|
1364
|
+
// files — and this install's own files (its `AGENT.md`, `excludes.json`, manifest,
|
|
1365
|
+
// `plugins/geneseed-*.js`) and the hook shim dir get a native `permission.edit` "ask" written into
|
|
1366
|
+
// opencode.json by the emit (`opencodeEditAsks`, js/hosts/settings.mjs), so the user can approve
|
|
1367
|
+
// the edit: this guard must not deny those, or the ask never shows. What stays a deny here is
|
|
1368
|
+
// Geneseed-only state of the OTHER hosts, which no user edits through OpenCode — their
|
|
1369
|
+
// `excludes.json`, `AGENT.md` and manifests, found by the parent's folder name — and an `AGENT.md`
|
|
1370
|
+
// under `$GENESEED_HARNESS`, a carrier the emit cannot name.
|
|
1371
|
+
const GATE_CONFIG_FILES = ['excludes.json', 'AGENT.md', '.geneseed-manifest.json', '.geneseed-emit'];
|
|
1372
|
+
const GATE_CONFIG_MARKERS = ['.claude', '.openclaude', '.bob'];
|
|
1373
|
+
const GATE_CONFIG_ASK = 'is a gate\'s own configuration (the hook wiring, the exclusion list, a gate switch or the hook shim). Editing it could switch a check off: fix the code, not the gate, unless the user asks for this edit. Stop and ask the user now; never write it another way (for example through a shell command).';
|
|
1374
|
+
function gateConfig(p) {
|
|
1375
|
+
try {
|
|
1376
|
+
const fold = (s) => nocase(path.resolve(s))
|
|
1377
|
+
const cfg = path.dirname(PLUGIN_DIR)
|
|
1378
|
+
const carriers = CARRIER_DIRS.filter((d) => ![fold(cfg), fold(path.dirname(cfg))].includes(fold(d)))
|
|
1379
|
+
.map((d) => fold(path.join(d, "AGENT.md")))
|
|
1380
|
+
for (const target of [path.resolve(p), resolvePath(p)]) {
|
|
1381
|
+
const t = fold(target)
|
|
1382
|
+
if (carriers.includes(t)) return true
|
|
1383
|
+
const dir = path.dirname(target)
|
|
1384
|
+
if (GATE_CONFIG_MARKERS.some((m) => nocase(m) === nocase(path.basename(dir)))
|
|
1385
|
+
&& GATE_CONFIG_FILES.some((f) => fold(path.join(dir, f)) === t)) return true
|
|
1386
|
+
}
|
|
1387
|
+
} catch { /* an unresolvable path is no hit, like `protectedIn` */ }
|
|
1388
|
+
return false
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1358
1391
|
// ---- the ownership first-write gate --------------------------------------------
|
|
1359
1392
|
// Twin of js/hosts/ownership-gate.mjs's `ownershipBlock` — keep in step (same manifests, same
|
|
1360
1393
|
// managed-block strip, same section match, same reason). In an application repo (a git root
|
|
@@ -1372,12 +1405,20 @@ const OWNERSHIP_TAIL = "Opt out per repo: `## Ownership` with `mode: off` in the
|
|
|
1372
1405
|
"install: rebuild with `--no-ownership-gate`. Offer the full documentation " +
|
|
1373
1406
|
"(`/document-project`) as yes / later. Stop and ask the developer now; re-issue the write only " +
|
|
1374
1407
|
"after they answer. This gate fires once per session and repo."
|
|
1408
|
+
const OWNERSHIP_SKIP = "skip this session; or skip in this repo until they ask — only on that third answer, " +
|
|
1409
|
+
"write the line `Setup: declined <YYYY-MM-DD>` (today) into `.geneseed/ownership.md` at the " +
|
|
1410
|
+
"MAIN worktree's root (in a linked git worktree, the main checkout's, so it outlives this " +
|
|
1411
|
+
"worktree), which is personal and never committed (if `.geneseed/.gitignore` is absent there, " +
|
|
1412
|
+
"create it first, as the ownership skill's checkpoint rules say)"
|
|
1375
1413
|
const OWNERSHIP_REASON_NONE = "Geneseed (Ownership) — this application has no `AGENTS.md` with " +
|
|
1376
|
-
"`## Ownership`. Before writing, propose to the developer: set it up
|
|
1377
|
-
`
|
|
1414
|
+
"`## Ownership`. Before writing, propose three answers to the developer: set it up now " +
|
|
1415
|
+
`(ownership skill); ${OWNERSHIP_SKIP}. ${OWNERSHIP_TAIL}`
|
|
1378
1416
|
const OWNERSHIP_REASON_NO_SECTION = "Geneseed (Ownership) — this application's `AGENTS.md` has no " +
|
|
1379
|
-
"`## Ownership` section. Before writing, ask the developer: add the Ownership section " +
|
|
1380
|
-
`(ownership skill)
|
|
1417
|
+
"`## Ownership` section. Before writing, ask the developer: add the Ownership section now " +
|
|
1418
|
+
`(ownership skill); ${OWNERSHIP_SKIP}? ${OWNERSHIP_TAIL}`
|
|
1419
|
+
// The developer's durable, personal decline (`DECLINED_RE` in the hook twin; geneseed-context.js
|
|
1420
|
+
// carries it too): with no section, this line in `.geneseed/ownership.md` defers the gate.
|
|
1421
|
+
const OWNERSHIP_DECLINED_RE = /^Setup:[ \t]*declined[ \t]+(\d{4}-\d{2}-\d{2})[ \t]*\r?$/m
|
|
1381
1422
|
// The reason to refuse this write, or null. `p` is absolute. Never throws.
|
|
1382
1423
|
function ownershipBlock(p, sessionID) {
|
|
1383
1424
|
try {
|
|
@@ -1396,6 +1437,15 @@ function ownershipBlock(p, sessionID) {
|
|
|
1396
1437
|
try { text = readFileSync(path.join(root, "AGENTS.md"), "utf8") } catch { /* none: gate */ }
|
|
1397
1438
|
const own = text === null ? "" : text.replace(MANAGED_BLOCK_RE, "")
|
|
1398
1439
|
if (OWNERSHIP_SECTION_RE.test(own)) return null
|
|
1440
|
+
let personal = ""
|
|
1441
|
+
// In the MAIN worktree (the hook twin's `mainWorktreeOf(root) ?? root`): the shared `.git`'s
|
|
1442
|
+
// parent, else this root (a main worktree, a submodule, a bare common dir, a bad link).
|
|
1443
|
+
// Sync equivalent of this plugin's async `mainWorktreeOf` and js/hosts/gitref.mjs
|
|
1444
|
+
// `mainWorktreeOf`; the parity table in tests/plugins/ownership_guard.test.mjs pins all three.
|
|
1445
|
+
let home = root
|
|
1446
|
+
try { const c = gitCommonDirOf(root); if (path.basename(c) === ".git") home = path.dirname(c) } catch { /* this root */ }
|
|
1447
|
+
try { personal = readFileSync(path.join(home, ".geneseed", "ownership.md"), "utf8") } catch { /* none: gate */ }
|
|
1448
|
+
if (OWNERSHIP_DECLINED_RE.test(personal.replace(/^\uFEFF/, ""))) return null
|
|
1399
1449
|
const key = `${sessionID}|${nocase(root)}`
|
|
1400
1450
|
if (OWNERSHIP_SEEN.has(key)) return null
|
|
1401
1451
|
OWNERSHIP_SEEN.add(key)
|
|
@@ -1491,6 +1541,7 @@ export const GeneseedGuard = async (ctx) => {
|
|
|
1491
1541
|
if (SECRET_WARN_RE.some((re) => re.test(p))) log(`WARN: writing ${p} — keep secrets out of tracked files (Sealed Secrets)`)
|
|
1492
1542
|
const sensor = protectedCheck(p)
|
|
1493
1543
|
if (sensor) { await deny(`${p} is a protected check (${sensor === DONE_LIST ? "the done gate list itself" : `${sensor}, listed in ${SENSOR_LIST}`}) — a check the agent can edit is not a check (External Gate)`, "rigor-5"); return }
|
|
1544
|
+
if (gateConfig(p)) { await deny(`${p} ${GATE_CONFIG_ASK} (External Gate)`, "rigor-5"); return }
|
|
1494
1545
|
const store = ruleStoreTarget(p)
|
|
1495
1546
|
if (store && !RULE_STORE_BUMPED.has(p)) {
|
|
1496
1547
|
RULE_STORE_BUMPED.add(p)
|