geneseed 4.30.1 → 4.32.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 +34 -0
- package/SHIPPED.md +1 -1
- package/adapters/opencode/plugins/geneseed-context.js +136 -1
- package/adapters/opencode/plugins/geneseed-guard.js +145 -2
- package/docs/concepts/exclusions.md +1 -1
- package/docs/concepts/footprint.md +1 -1
- package/docs/concepts/hook-gates.md +1 -1
- package/docs/concepts/hooks.md +6 -4
- package/docs/concepts/host-matrix.md +1 -1
- package/docs/concepts/loop-bricks.md +1 -1
- package/docs/concepts/loop-notes.md +4 -2
- package/docs/concepts/loop-templates.md +7 -4
- package/docs/concepts/loops.md +3 -0
- package/docs/concepts/ownership.md +1 -1
- package/docs/guides/run-a-loop.md +1 -1
- package/docs/guides/set-up-ownership.md +1 -1
- package/docs/reference/loop-actions.md +1 -1
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/plugin-context.md +4 -0
- package/docs/reference/plugin-guard.md +1 -1
- package/docs/understand/enforced-vs-asked.md +3 -2
- package/docs/understand/machine-bob.md +1 -1
- package/docs/web-ui.md +85 -26
- package/harness.config.json +1 -1
- package/js/README.md +3 -3
- package/js/hosts/hooks-context.mjs +22 -1
- package/js/hosts/hooks-done.mjs +97 -31
- package/js/hosts/hooks-prims.mjs +65 -0
- package/js/hosts/hooks.mjs +188 -27
- package/js/loop/state.mjs +15 -5
- package/js/web/actions.mjs +17 -27
- package/js/web/activity.mjs +139 -23
- package/js/web/api.mjs +31 -13
- package/js/web/catalog.mjs +108 -23
- package/js/web/handler.mjs +4 -3
- package/js/web/routes.mjs +47 -14
- package/js/web/server.mjs +14 -13
- package/js/web/state.mjs +36 -15
- package/js/web/usage-api.mjs +7 -3
- package/package.json +1 -1
- package/src/agents/_template.md +3 -0
- package/src/agents/developer.md +5 -2
- package/src/agents/tester.md +4 -1
- package/src/bricks/apply.md +3 -0
- package/src/bricks/test.md +6 -4
- package/src/loops/bugfix.json +11 -5
- package/src/loops/feature.json +7 -4
- package/src/skills/loop.md +1 -0
- package/src/skills/ship.md +9 -1
- package/web/dist/assets/Activity-Bjy64wHC.js +1 -0
- package/web/dist/assets/ActivityDetail-B0AaipP8.js +1 -0
- package/web/dist/assets/{Bonsai-CN4rRAHc.js → Bonsai-CJniRqaH.js} +1 -1
- package/web/dist/assets/{CopyButton-CYljsnLo.js → CopyButton-C5Li6awl.js} +1 -1
- package/web/dist/assets/Dashboard-B-6DTmae.js +2 -0
- package/web/dist/assets/{DataTable-BWbUx4bY.js → DataTable-b9zTShqJ.js} +1 -1
- package/web/dist/assets/{Docs-DE04qOKj.js → Docs-LRc30XL9.js} +2 -2
- package/web/dist/assets/{EmptyState-1sPNleqv.js → EmptyState-CY5Pm2xy.js} +1 -1
- package/web/dist/assets/FilterInput-qGKNSlxv.js +1 -0
- package/web/dist/assets/{GreenhouseView-DPwhFO_j.js → GreenhouseView-CcoYlaWo.js} +1 -1
- package/web/dist/assets/Installs-dp1epTcE.js +3 -0
- package/web/dist/assets/JournalView-nFP4poCf.js +1 -0
- package/web/dist/assets/{KitApply-BN2Az7dc.js → KitApply-DwyZUj57.js} +1 -1
- package/web/dist/assets/{Kits-C9qVd466.js → Kits-C0IEdZXe.js} +1 -1
- package/web/dist/assets/Laws-CkykmQWu.js +3 -0
- package/web/dist/assets/Library-Guh9HBZU.js +2 -0
- package/web/dist/assets/Loops-CzitjxGV.js +2 -0
- package/web/dist/assets/Markdown-C4S4tTA7.js +69 -0
- package/web/dist/assets/{OperatorHudView-CLN6Qn25.js → OperatorHudView-DLGNulIY.js} +1 -1
- package/web/dist/assets/Personal-BMtberL8.js +2 -0
- package/web/dist/assets/RailCats-D5weYPCS.js +1 -0
- package/web/dist/assets/Tabs-uYJqfuQt.js +1 -0
- package/web/dist/assets/api-BxjLd7Qd.js +1 -0
- package/web/dist/assets/index-DA7BiaE5.js +3 -0
- package/web/dist/assets/index-dbbDGFDq.css +1 -0
- package/web/dist/assets/{motion-CXaUMNkg.js → motion-Bccx3zE8.js} +1 -1
- package/web/dist/assets/react-C1iE8mnY.js +9 -0
- package/web/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/web/dist/assets/{usePoll-bDFN-Hr6.js → usePoll-o8ul-Sog.js} +1 -1
- package/web/dist/index.html +6 -6
- package/web/dist/assets/Activity-C8pQvnos.js +0 -1
- package/web/dist/assets/ActivityDetail-D_8Bx-QO.js +0 -1
- package/web/dist/assets/Dashboard-DkUm4XMu.js +0 -2
- package/web/dist/assets/FilterInput-CZREvrjX.js +0 -1
- package/web/dist/assets/Installs-DmPzD4BW.js +0 -3
- package/web/dist/assets/JournalView-DQlDC-7i.js +0 -1
- package/web/dist/assets/Laws-T2wbwMmB.js +0 -3
- package/web/dist/assets/Library-t3KocV0-.js +0 -2
- package/web/dist/assets/Loops-6lNY-9uR.js +0 -2
- package/web/dist/assets/Markdown-DpmmtW2Y.js +0 -65
- package/web/dist/assets/Personal-xjoSqCzr.js +0 -2
- package/web/dist/assets/RailCats-BuJD4Jou.js +0 -1
- package/web/dist/assets/Tabs-DaExAgql.js +0 -1
- package/web/dist/assets/api-LvBC0CnK.js +0 -1
- package/web/dist/assets/index-DhNNxhfg.js +0 -3
- package/web/dist/assets/index-XTGBLKQr.css +0 -1
- package/web/dist/assets/react-DlYQp10C.js +0 -9
- package/web/dist/assets/rolldown-runtime-hePW80VL.js +0 -1
|
@@ -18,7 +18,7 @@ This page is the how-to. For how the engine works (rings, scoring, trailers), se
|
|
|
18
18
|
| A git repository with a remote named `origin` | Every iteration ends with `git push -u origin HEAD:loop/<slug>`. With no remote, the agent reports and stops. |
|
|
19
19
|
| A test command the agent can run | The `test` brick runs the project's suite, and most templates retry `apply` until it passes. |
|
|
20
20
|
| For `ci-repair`: CI that runs on `loop/*` branches, and the `gh` CLI | `ci-triage` reads the checks of the HEAD commit with `gh run list --commit`. |
|
|
21
|
-
| For `legacy-tests`: a mutation tool (PIT, Stryker, mutmut, cargo-mutants) | Optional. Without one, `mutation-check` reports `unavailable` and the loop carries on, with a note saying so. |
|
|
21
|
+
| For `legacy-tests` and `bugfix`: a mutation tool (PIT, Stryker, mutmut, cargo-mutants) | Optional. Without one, `mutation-check` reports `unavailable` and the loop carries on, with a note saying so. |
|
|
22
22
|
|
|
23
23
|
Check the catalogue the CLI sees from your repo:
|
|
24
24
|
|
|
@@ -82,7 +82,7 @@ Commit the root `AGENTS.md` with the repository, so the whole team works under t
|
|
|
82
82
|
- **The team default.** Edit `granularity:` in `AGENTS.md` and commit it.
|
|
83
83
|
- **Opt the repo out.** Set `mode: off`. The gate stays quiet, and no checkpoint runs.
|
|
84
84
|
- **Skip it for yourself only.** Answer "skip in this repo until I ask" to the proposal, or write `Setup: declined <YYYY-MM-DD>` into `.geneseed/ownership.md` yourself. The team's `AGENTS.md` does not change.
|
|
85
|
-
- **Opt the whole install out of the gate.**
|
|
85
|
+
- **Opt the whole install out of the gate.** Open the *Ownership* row and flip its gate switch, in the Credo band of the web console's Constitution page, or rebuild with the flag, as [Exclusions](../concepts/exclusions.md) shows. The install's `AGENT.md` then carries no ownership proposal either, and no decline reminder prints:
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
88
|
geneseed build --emit claude-global --no-ownership-gate
|
|
@@ -14,7 +14,7 @@ The actions of `geneseed loop`, the state machine behind [Loops](../concepts/loo
|
|
|
14
14
|
| `init` | writes a fresh `LOOP.md` from a template or graph file, under a title, requirement and trust preset |
|
|
15
15
|
| `next` | the only driver of the cycle — returns the next thing to do: run a node, score a card, answer an `awaiting`, or a terminal |
|
|
16
16
|
| `score` | scores a declared card (`--declared`) before a mutate node runs, or the real diff (`--diff`, numstat piped on stdin) before a commit |
|
|
17
|
-
| `record` | records a brick's reported outcome and advances the graph; `--note` or `--note-file <path>` carries a finding
|
|
17
|
+
| `record` | records a brick's reported outcome and advances the graph; `--note` or `--note-file <path>` carries a finding into `LOOP.md`'s notes for the bricks after it: a plan survives the unit, and `review` and `mutation-check` findings last until `apply` reports. `test` cannot report `pass` when that note lists a check as `SKIPPED`: the record is refused and `LOOP.md` does not change |
|
|
18
18
|
| `decide` | answers an `awaiting` validation with a verdict and a note |
|
|
19
19
|
|
|
20
20
|
Run `geneseed loop --help` for the full flag list.
|
|
@@ -16,7 +16,7 @@ One of the [OpenCode plugins](opencode-plugins.md). [Environment variables](envi
|
|
|
16
16
|
|
|
17
17
|
**Archive.** On `SessionStart` and `SessionEnd` the hook writer moves every snapshot that is no longer live into `activity/archive/`, keeping the newest 50 and none older than 7 days. `/api/activity` returns them, with the stale and dead ones still in `activity/`, in its `ended` list — capped there by the same rule, since the OpenCode plugin never sweeps.
|
|
18
18
|
|
|
19
|
-
**What `/api/activity` returns.** `activity` (the live sessions), `ended`, and `collisions`. Each session carries the snapshot as written, plus the v2 fields: `root` (the git root of the session's own checkout, read from the session's directory: never the plugin instance's, since one `opencode serve` hosts an instance per opened project and each hears every session; `null` outside any repository), `repo` (its main worktree), `agents` (`{id, type, status, started}`), `attribution` (`false` only on a Bob session that ran a sub-agent, else `null`), `turns`, `context` (`{used, window}`), `compactions`, `compacted_at` and `context_at_compaction` (either `context` field can be `null`, right after a compaction for one), and `repo_key`, the repo (else the root) case-folded on Windows, to group a repo's sessions whatever case each host spelled it in. A v1 snapshot reads `null` for those, `[]` for `agents` and `0` for the counts. A live session also gets `files_all`, the uncapped file rows from its detail file (`files` stays the capped summary), and `loops`: `{title, iteration, status}` for each loop registered on its `root`, a finished or unreadable loop left out. `collisions` lists each `{repo, path}` that two or more writers changed among the live sessions — a writer is a session or one of its sub-agents (`{sid, by, root}`) — with `kind: "same-worktree"` when two of them share a `root`, else `"cross-worktree"`. A file outside the root is stored with `path: null` (its `file` keeps the basename) and takes no part in a collision. Roots and paths compare case-folded on Windows, and a session root is resolved to its real path before the loop join, as the loop registry stores it. `/api/activity/<id
|
|
19
|
+
**What `/api/activity` returns.** One list over every active install on the machine (each install's `activity/` folder), so it ignores a `?host=&path=` pair. It returns `enabled`, `installs`, `activity` (the live sessions), `ended`, and `collisions`. `installs` has one `{install, host, scope, path, enabled}` row per active install, in the same fixed order: `install` is the `host:scope:root` key that `/api/usage` also uses, `path` is the install root as `/api/installs` gives it, and `enabled` is that install's own on/off flag. An install that is off gives no session. The top-level `enabled` is true when any install is on, or when no install is active. `ended` keeps the newest 50 over all installs. A global and a project install of one host both record the same session (both hooks run), so the copies that share a session id and a checkout (the same `root`, case-folded on Windows, or the same `cwd` when there is no root) are one session. Its data comes from the newest copy. `installs` lists every install that recorded it in a fixed order (host order: OpenCode, Claude Code, Bob, OpenClaude; then global before project; then detection order), and `install`, the first of them, names the install the chip shows and the detail link reads. The order never follows recency, because two installs write one session milliseconds apart. The session also has a `key` (its id and its checkout, with a trailing separator dropped) that never names an install, so the console keeps the same card from poll to poll. A detail page that is already open keeps reading the install its link names. Such a session never collides with itself. The same id in two checkouts stays two sessions. Each collision writer carries `install` too. An OpenCode project install has no `installs` row: the plugin always writes its sessions and reads its on/off flag in the global OpenCode config folder, so OpenCode project sessions appear under, and follow the switch of, the OpenCode global install. Each session carries the snapshot as written, plus the v2 fields: `root` (the git root of the session's own checkout, read from the session's directory: never the plugin instance's, since one `opencode serve` hosts an instance per opened project and each hears every session; `null` outside any repository), `repo` (its main worktree), `agents` (`{id, type, status, started}`), `attribution` (`false` only on a Bob session that ran a sub-agent, else `null`), `turns`, `context` (`{used, window}`), `compactions`, `compacted_at` and `context_at_compaction` (either `context` field can be `null`, right after a compaction for one), and `repo_key`, the repo (else the root) case-folded on Windows, to group a repo's sessions whatever case each host spelled it in. A v1 snapshot reads `null` for those, `[]` for `agents` and `0` for the counts. A live session also gets `files_all`, the uncapped file rows from its detail file (`files` stays the capped summary), and `loops`: `{title, iteration, status}` for each loop registered on its `root`, a finished or unreadable loop left out. `collisions` lists each `{repo, path}` that two or more writers changed among the live sessions — a writer is a session or one of its sub-agents (`{sid, by, root, install}`), and sessions from different installs collide too — with `kind: "same-worktree"` when two of them share a `root`, else `"cross-worktree"`. A file outside the root is stored with `path: null` (its `file` keeps the basename) and takes no part in a collision. Roots and paths compare case-folded on Windows, and a session root is resolved to its real path before the loop join, as the loop registry stores it. `/api/activity/<id>?host=&path=` returns the same fields for one session of the install the pair names (the console's link carries it), an archived one included; with no pair it reads the default install (the first active one). `POST /api/activity` with `{enabled, host, path}` turns tracking on or off for that install only.
|
|
20
20
|
|
|
21
21
|
**What you see.** A card per live session in **Activity** (`geneseed web`).
|
|
22
22
|
|
|
@@ -17,10 +17,14 @@ One of the [OpenCode plugins](opencode-plugins.md). Its switches are also listed
|
|
|
17
17
|
|
|
18
18
|
**When it runs.** On every request: the context rides invisibly in the request's message list, so it also survives compaction. If your OpenCode build lacks that (experimental) hook, the plugin notices and falls back to one visible message at session start, re-pushed when the session compacts.
|
|
19
19
|
|
|
20
|
+
**The weakened-test reminder.** A write tool call that adds a skip marker to a test file or removes an assertion (the rule in [Hooks](../concepts/hooks.md)) makes the next request carry one invisible message citing *Cure the Cause*, on OpenCode 1 and 2. It is advisory, needs no checks, and an install built `--no-done-gate` does not say it. The call is read before it runs, so one the guard then refuses is still named.
|
|
21
|
+
|
|
20
22
|
**The done gate's reminder.** The project's checks come from `.geneseed/done-checks.txt`, or, without that file, are inferred from the manifests at the project's git root (see [Hooks](../concepts/hooks.md)). A request that follows a turn which edited files without every check passing since gets one more invisible message naming the checks owed (inferred ones marked advisory). OpenCode has no turn-end event a plugin can block on, so this is a reminder, not a block. OpenCode 1 only: on OpenCode 2 the turn is not judged, and with a listed file the plugin logs that once. The context block also opens with one line naming the checks and their source (`Done gate: …`), ending `(reminder)` for a listed file or `(advisory)` for inferred checks on OpenCode 1, and `(not judged on this host)` on OpenCode 2. `GENESEED_CONTEXT_INJECT=off` does not turn the reminder off; a done list that lists nothing does, and so does an install built `--no-done-gate` (`Done gate: off` in its `AGENT.md`, read once when OpenCode starts), which also silences the OpenCode 2 log line and the context line.
|
|
21
23
|
|
|
22
24
|
**The ownership decline line.** In an application repo whose root `AGENTS.md` has no `## Ownership` section, a `Setup: declined <YYYY-MM-DD>` line in the personal `.geneseed/ownership.md` of the main worktree (the main checkout's, from a linked git worktree) adds one line beside the done line: `Ownership: setup declined since <date> — not set up; say "set up ownership" to run it`. An install built `--no-ownership-gate` (`Ownership gate: off` in its `AGENT.md`, read once when OpenCode starts) prints no such line.
|
|
23
25
|
|
|
26
|
+
**The runtime floor line.** A git root whose `package.json` has no `engines` field adds one line after those: `Runtime floor: package.json declares no engines — name the supported runtime before you add a dependency or a language feature.` There is no line when `engines` exists, when there is no `package.json`, or when the file is not a JSON object.
|
|
27
|
+
|
|
24
28
|
**What you see.** Normally nothing — the context is there, but not shown. With the visible fallback, a `PROJECT CONTEXT` block at the top of the session.
|
|
25
29
|
|
|
26
30
|
**Switches.**
|
|
@@ -10,7 +10,7 @@ One of the [OpenCode plugins](opencode-plugins.md). [Environment variables](envi
|
|
|
10
10
|
|
|
11
11
|
**What it does.** Enforces the safety rules at the tool boundary — before a tool call runs, not after. High-confidence patterns only, so legitimate work is not caught.
|
|
12
12
|
|
|
13
|
-
- **Blocks** writes to private-key and credential files and writes whose content carries a credential (*Sealed Secrets*; an install built `--no-secrets-gate` carries `Secrets gate: off` in its `AGENT.md`, read once at load, and both stop blocking), catastrophic shell commands such as deleting the filesystem root and every command that would really lose data — a protected branch deleted or force-pushed, an unpushed unmerged branch deleted, a protected branch force-moved off commits nothing else holds, unpushed commits abandoned by `reset --hard`, uncommitted work discarded other than by `reset --hard`, a stash dropped, files git cannot restore removed — judged against the repository's state, the same decisions the Claude/Bob hook makes (*Deletion Is Deliberate*; `reflog expire` and `gc --prune` are left to the `permission.bash` ask; an install built `--no-deletion-gate` carries `Deletion gate: off` in its `AGENT.md`, which the plugin reads once at load and then stops blocking real loss — catastrophic commands still block), a recursive scan rooted at a whole filesystem such as `find /` (*Commands Must Return* — search a specific directory instead), and any change — write, move, rename, delete — under a wiki folder declared `protected` in `geneseed-wiki.jsonc`, and writes to a check listed in the project's `.geneseed/protected-checks.txt` (*External Gate* — see [Hooks](../concepts/hooks.md)).
|
|
13
|
+
- **Blocks** writes to private-key and credential files and writes whose content carries a credential (*Sealed Secrets*; an install built `--no-secrets-gate` carries `Secrets gate: off` in its `AGENT.md`, read once at load, and both stop blocking), catastrophic shell commands such as deleting the filesystem root and every command that would really lose data — a protected branch deleted or force-pushed, an unpushed unmerged branch deleted, a protected branch force-moved off commits nothing else holds, unpushed commits abandoned by `reset --hard`, uncommitted work discarded other than by `reset --hard`, a stash dropped, files git cannot restore removed — judged against the repository's state, the same decisions the Claude/Bob hook makes (*Deletion Is Deliberate*; `reflog expire` and `gc --prune` are left to the `permission.bash` ask; an install built `--no-deletion-gate` carries `Deletion gate: off` in its `AGENT.md`, which the plugin reads once at load and then stops blocking real loss — catastrophic commands still block), a recursive scan rooted at a whole filesystem such as `find /` (*Commands Must Return* — search a specific directory instead), and any change — write, move, rename, delete — under a wiki folder declared `protected` in `geneseed-wiki.jsonc`, and writes to a check listed in the project's `.geneseed/protected-checks.txt` (*External Gate* — see [Hooks](../concepts/hooks.md)). The guard also refuses a write to the other hosts' Geneseed-only files (their `excludes.json`, `AGENT.md` and manifests); OpenCode's own config and the shared hook settings get `permission.edit` "ask" keys in `opencode.json` instead, so you see OpenCode's prompt. A shell write is read as well: the targets of `>`, `>>`, `tee`, `sed -i`, `cp`, `mv` and `rm` get the same path checks, by path only. `permission.edit` never sees a shell command and this hook has no ask tier, so a shell write to those "ask" files is refused too.
|
|
14
14
|
- **Refuses once** the first write of a session in an application repo (a git root holding a build manifest) whose root `AGENTS.md` has no `## Ownership` section, so the agent proposes the [ownership](../concepts/ownership.md) setup first; the next write passes, and a sub-agent's session never triggers it. Off per repo with `mode: off` in that section, or for one developer with a personal `Setup: declined <YYYY-MM-DD>` line in `.geneseed/ownership.md`; an install built `--no-ownership-gate` carries `Ownership gate: off` in its `AGENT.md`, read once at load.
|
|
15
15
|
- **Warns** (logged, allowed) on `.env` writes.
|
|
16
16
|
- **Speed-bumps** the *first* write to `user-rules.md` or a memory file: it is refused once, naming *Persist Insight* — whether something is a standing rule or a fact to remember is your call, settled through the `rule` skill. The re-issued write goes through.
|
|
@@ -28,11 +28,12 @@ On Claude Code and OpenClaude the hooks never block silently. They make the host
|
|
|
28
28
|
- **Credentials**: a write or edit whose content looks like a real key (AWS, GitHub, Anthropic, Slack, or a private-key block), anywhere except a `.env` file.
|
|
29
29
|
- **Your rules and memory**: any write by the agent to `user-rules.md` or to the memory store. Whether something is a standing rule or a fact to remember is your call.
|
|
30
30
|
- **The first write in an application with no ownership setup**: in a repo with a build manifest whose root `AGENTS.md` has no `## Ownership` section, the session's first write is refused once, with the reason sent to the agent rather than to you: it then asks you to set [ownership](../concepts/ownership.md) up now, skip this session, or skip in this repo until you ask. Off per repo with `mode: off`, for you alone in one repo with `Setup: declined <YYYY-MM-DD>` in `.geneseed/ownership.md`, per install with `--no-ownership-gate`.
|
|
31
|
-
- **
|
|
31
|
+
- **The checks you are judged by, and the gates' own switches**: a write to a file listed in `.geneseed/protected-checks.txt`, to the done gate's list, or to a file that can switch a gate off (the hook settings, `excludes.json`, a gate marker in `AGENT.md`, the hook shim). You get a prompt. A shell write counts too, for the common forms: `>`, `>>`, `tee`, `sed -i`, `cp`, `mv`, `rm`. A script or an interpreter's inline code is not seen, so run the checks in CI as well.
|
|
32
|
+
- **Ending a turn without the proof**: only in a project whose `.geneseed/done-checks.txt` lists at least one check; a file that lists none turns the gate off for that project. A turn that edited files cannot end until every listed check has passed since the last edit. The agent is stopped once, then the turn may end. Without that file, Geneseed infers the checks from the project's manifest (`package.json` scripts, Maven, Gradle, `pyproject.toml`, `Cargo.toml`, `go.mod`): you get a warning when a turn ends without them, but the turn is not stopped.
|
|
32
33
|
|
|
33
34
|
If a gate crashes, it asks instead of letting the call through. If it cannot start at all (a deleted or broken shim) or times out, Claude Code blocks the call instead: see [Troubleshoot hooks](../reference/troubleshoot-hooks.md) to recover. Other shell commands go through Claude Code's normal permission flow; an `rm` of files git cannot restore is the real-loss case above.
|
|
34
35
|
|
|
35
|
-
**Bob** runs one combined gate and has no "ask": it refuses with exit code 2, and only for the rules that admit no judgement call: credentials, destructive git, a scan of a whole filesystem,
|
|
36
|
+
**Bob** runs one combined gate and has no "ask": it refuses with exit code 2, and only for the rules that admit no judgement call: credentials, destructive git, a scan of a whole filesystem, a write under a project's own protected-checks list, and writes that would switch a gate off. The commit/push and memory checks become a log line, and the call goes through. The ownership gate also refuses with exit 2, but once: the same write passes after you answer. Bob's hook wiring follows its documentation but has not been tested on a live Bob install.
|
|
36
37
|
|
|
37
38
|
<!--/harness-->
|
|
38
39
|
<!--harness:opencode-->
|
|
@@ -8,7 +8,7 @@ description: "Where an install lands on IBM Bob or as a plain AGENT.md bundle, a
|
|
|
8
8
|
---
|
|
9
9
|
Bob and the plain bundle carry the same rules, agents and skills as the other hosts. What differs is where they land and how much of it is enforced. The **Kind** words are explained in [What lands on your machine](on-your-machine.md).
|
|
10
10
|
|
|
11
|
-
**Bob.** A global install writes to `~/.bob/`, or `BOB_CONFIG_DIR`. Bob does not load a global `AGENTS.md`, so the rules go into `~/.bob/rules/geneseed.md`. A per-repo install writes `AGENTS.md` instead. Hooks live in `~/.bob/settings/settings.json`. Bob runs three of them: context at session start, one combined gate before each tool call, and learn at session end. Bob has no "ask" prompt, so the gate refuses outright, and only for the checks that admit no judgement call: credentials, destructive git,
|
|
11
|
+
**Bob.** A global install writes to `~/.bob/`, or `BOB_CONFIG_DIR`. Bob does not load a global `AGENTS.md`, so the rules go into `~/.bob/rules/geneseed.md`. A per-repo install writes `AGENTS.md` instead. Hooks live in `~/.bob/settings/settings.json`. Bob runs three of them: context at session start, one combined gate before each tool call, and learn at session end. Bob has no "ask" prompt, so the gate refuses outright, and only for the checks that admit no judgement call: credentials, destructive git, a write under a project's own protected-checks list, and writes that would switch a gate off. The commit/push and memory questions become log lines. One more refusal happens only once: in an application repo whose root `AGENTS.md` has no `## Ownership` section, the session's first write is refused so the agent proposes the [ownership](../concepts/ownership.md) setup, and the same write passes after you answer. Turn it off per repo with `mode: off` in that section, for yourself in one repo with `Setup: declined <YYYY-MM-DD>` in `.geneseed/ownership.md`, or per install with `--no-ownership-gate`.
|
|
12
12
|
|
|
13
13
|
**Plain bundle.** The `files` target writes `AGENT.md` and the same folders into `./Harness/` for any tool that reads `AGENT.md`. It installs no hooks and no plugins, so nothing in it is enforced.
|
|
14
14
|
|
package/docs/web-ui.md
CHANGED
|
@@ -61,16 +61,38 @@ A request can name the install it reads or writes. A read takes two query parame
|
|
|
61
61
|
it against the same detected-install allowlist as the install toggle. An unknown or half pair
|
|
62
62
|
gets a 404 and never falls through to another install's folder. The writes that take the pair
|
|
63
63
|
are `/api/activity`, `/api/memory/delete`, `/api/rules`, `/api/rules/promote`, `/api/profile`,
|
|
64
|
-
and the `restore` and `build` actions. In `/api/
|
|
64
|
+
and the `restore` and `build` actions. In `/api/install`, the `install` and
|
|
65
65
|
`deploy` actions, `/api/excludes` and `/api/reveal`, `host`/`path` keep their own meaning.
|
|
66
66
|
|
|
67
67
|
Every `/api/*` read takes and checks the pair, with these exceptions:
|
|
68
68
|
- `/api/ping` and `/api/jobs` ignore it.
|
|
69
69
|
- The machine-wide reads also ignore it: `/api/update`, `/api/installs`, `/api/fleet`,
|
|
70
|
-
`/api/kits`, `/api/usage`, `/api/gates`, `/api/excludes`, `/api/mcp
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
`/api/kits`, `/api/usage`, `/api/gates`, `/api/excludes`, `/api/mcp`, `/api/loops/active`,
|
|
71
|
+
`/api/activity`, and the Library's skill, agent, memory and notebook lists,
|
|
72
|
+
`/api/catalog/skills`, `/api/catalog/agents`, `/api/catalog/memory` and
|
|
73
|
+
`/api/catalog/notebook`. Such a read does not check the pair, and its answer does not change
|
|
74
|
+
with the pair. The Activity detail (`/api/activity/<id>`) and the Activity toggle still take
|
|
75
|
+
the pair.
|
|
76
|
+
|
|
77
|
+
The skill, agent, memory and notebook lists read every active install (memory and notebook
|
|
78
|
+
entries are your own files, so a fact's Forget and Promote act on the install of the copy on
|
|
79
|
+
screen, and Promote writes to that install's `user-rules.md`). Each row is one id (kind and name), and
|
|
80
|
+
its `installs` field names the installs that have it, as `host:scope:root` keys (the same keys
|
|
81
|
+
as `/api/usage`). An id that only some installs have lists only those installs, so an exclusion
|
|
82
|
+
stays visible. The other catalog sections stay install-scoped. `/api/item/skill/<name>` and
|
|
83
|
+
`/api/item/agent/<name>` stay install-scoped too, because each install renders its own copy in
|
|
84
|
+
its own theme and footprint. With a pair, the item is that install's copy, and an id that
|
|
85
|
+
install lacks gets a 404. Without a pair, the item is the copy of the first install that has
|
|
86
|
+
it. The order is the host order (OpenCode, Claude Code, Bob, OpenClaude), then global before
|
|
87
|
+
project. The item's `install` field names the copy, and its `installs` field names every
|
|
88
|
+
install that has the id.
|
|
89
|
+
|
|
90
|
+
A request that names no install reads the **default install**: the first active one in the console's one
|
|
91
|
+
install order (`fleetSort`): host order (opencode, claude, bob, openclaude), then global before
|
|
92
|
+
project. `/api/installs` marks
|
|
93
|
+
that row `default: true`. There is no console-wide install and no `POST /api/view`: a page that
|
|
94
|
+
acts on one install names it on each request, through a picker placed beside the entry or form it
|
|
95
|
+
applies to (see below).
|
|
74
96
|
Each named install keeps its own cached doctor run and inventory, and a mutation refreshes all
|
|
75
97
|
of them.
|
|
76
98
|
|
|
@@ -87,9 +109,20 @@ The left rail mirrors the harness's own shape:
|
|
|
87
109
|
|
|
88
110
|
At the foot of the rail sits a **vitals** card — the doctor's verdict, drift, how long ago the
|
|
89
111
|
harness was built, and a Voice button — so those facts are on screen from every page. It is
|
|
90
|
-
hidden where the rail collapses to icons (≤960px) and returns with the phone drawer.
|
|
91
|
-
|
|
92
|
-
|
|
112
|
+
hidden where the rail collapses to icons (≤960px) and returns with the phone drawer. The topbar's
|
|
113
|
+
breadcrumb starts at the page: it names no install.
|
|
114
|
+
|
|
115
|
+
**Install pickers.** The console has no install switch. Where a page acts on one install, an
|
|
116
|
+
`InstallPicker` sits beside what it applies to, labelled for it (*Write to:*, *Doctor for:*), and
|
|
117
|
+
starts on the default install; with one active install it is not shown. Rules and Profile list
|
|
118
|
+
every active install's entries together, each tagged with its install, and write back to the
|
|
119
|
+
install an entry came from; so do Memory and Notebook, whose Forget and Promote act on the
|
|
120
|
+
install of the copy on screen. Doctor, Local edits, Server, the Constitution (*Constitution of:*,
|
|
121
|
+
for its gate switches and doctrine Apply), Loops (*Templates and bricks of:*) and the rail's Voice
|
|
122
|
+
popover (*Rebuild:*) each keep their own pick (in the browser's localStorage). The Overview is
|
|
123
|
+
fleet-wide: each install's own facts (voice, footprint, posture, mode, memory facts, drift) sit on
|
|
124
|
+
its row, and a figure still read off the default install (a suggestion, a tab badge, an older
|
|
125
|
+
Overview view, Personal's Rule budget) names that install once two or more are active.
|
|
93
126
|
|
|
94
127
|
A global **Spotlight** search lives in the topbar — press <kbd>/</kbd> to focus it (or
|
|
95
128
|
<kbd>Ctrl</kbd>/<kbd>⌘</kbd>+<kbd>K</kbd>, which also works from inside a text field), type
|
|
@@ -124,7 +157,9 @@ streams the output of background jobs and keeps their history across reloads.
|
|
|
124
157
|
|
|
125
158
|
- **Rules** (`#/rules`) — your own standing rules, read from and written to the
|
|
126
159
|
`user-rules.md` beside the deployed AGENT.md (the seed-once file no update ever
|
|
127
|
-
touches)
|
|
160
|
+
touches) of every active install, listed together and tagged with their install; an edit,
|
|
161
|
+
graduate or retire writes back to the rule's own install, and a new rule goes to the install
|
|
162
|
+
its form's *Write to:* picker names. List with scope (project/global — a hand-written `user` opens as global — or any other scope written by hand, which a
|
|
128
163
|
save keeps as written) and trial chips, add/edit/retire forms (retire moves the rule to `user-rules-retired.md`, which is never loaded; its id is never reused) (a body line starting
|
|
129
164
|
`## ` is refused: the file would read it as a new rule heading), a
|
|
130
165
|
**Graduate** action that adopts a trial rule for good, and a budget meter that turns
|
|
@@ -139,11 +174,21 @@ streams the output of background jobs and keeps their history across reloads.
|
|
|
139
174
|
secrets gate, the done gate and the deletion gate (`--no-secrets-gate`, `--no-done-gate`,
|
|
140
175
|
`--no-deletion-gate`; *Enforced by* reads *Gate off* while one is off) — flipping one asks,
|
|
141
176
|
then rebuilds the install once; the other Rules read *no gate*. The ownership gate belongs
|
|
142
|
-
to no Rule, so
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
177
|
+
to no Rule, so its switch (`--no-ownership-gate`) sits inside the Ethos band's *Ownership*
|
|
178
|
+
row and works the same way. Closed, the row reads *Always* (the section's text binds whatever
|
|
179
|
+
the gate does) and *Hook gate* or *Gate off*. Open, it shows the text, then a gate line with
|
|
180
|
+
the gate's asks and the switch. That line exists only in the console and only where an install
|
|
181
|
+
can be rebuilt: with no install the row reads *Instruction*. The gate counts in *Gated* but
|
|
182
|
+
not as a Rule or a section, and the Ethos rank's pill counts it while it is off. Every tab,
|
|
183
|
+
view and filter shows the row, like the sections around it.
|
|
184
|
+
A precedence ladder heads the page (a state pill per rank; ranks 5–6 below). *Gated* and *Changed* narrow the rows; packs fold; staged doctrine changes
|
|
185
|
+
collect in a sticky *Unapplied changes* bar that holds Revert and the page's one Apply.
|
|
186
|
+
Every row expands to its full body, lazily fetched. The rail
|
|
187
|
+
entry is labelled *Constitution* while the route, the id and the badge key stay `laws`; deep links
|
|
188
|
+
are `#/item/law/ont:telos`, `#/item/law/IV`, `#/item/law/process.5` and `#/item/law/ownership` — address
|
|
189
|
+
shapes that cannot collide, because a slug carries a colon no numeral has, a doctrine
|
|
190
|
+
address carries a dot, and `ownership`, which opens the Ownership row at its gate, is a word
|
|
191
|
+
no rule uses.
|
|
147
192
|
- **Library** (`#/library`) — browse the content that has no tab of its own: **Memory ·
|
|
148
193
|
Notebook · Knowledge** (the wiki chip, which also carries the two setup manifests).
|
|
149
194
|
Constitution, Skills and Agents each have their own rail entry instead. Drill into a section, then an item, to read its
|
|
@@ -176,8 +221,10 @@ streams the output of background jobs and keeps their history across reloads.
|
|
|
176
221
|
for *mutate*, *human gate*, what they override and *unavailable*; the reader shows the
|
|
177
222
|
frontmatter facts (outcomes as pills, availability with its reason), then the body rendered as
|
|
178
223
|
markdown, with a **View source** toggle for the file as parsed, frontmatter and all. Templates and
|
|
179
|
-
Bricks read `GET /api/loops
|
|
180
|
-
|
|
224
|
+
Bricks read `GET /api/loops` for the install the page's *Templates and bricks of:* picker
|
|
225
|
+
names (its own remembered pick, starting on the default; hidden with one install and on
|
|
226
|
+
Active), resolved from that install's root, so a project install shows its `.geneseed/` bricks
|
|
227
|
+
and templates. **Active** is every loop
|
|
181
228
|
`geneseed loop init` registered on this machine (`GET /api/loops/active`, polled every
|
|
182
229
|
5 s), grouped awaiting, running, done/stopped, finished/unreadable; the reader shows its
|
|
183
230
|
branch, `iteration N / max`, current node and a preset picker (`POST /api/loops/preset`,
|
|
@@ -185,11 +232,15 @@ streams the output of background jobs and keeps their history across reloads.
|
|
|
185
232
|
human gate, with its node) — the answer is given in the agent's session, never here — and
|
|
186
233
|
its ring with the current node filled, with its iteration history under it.
|
|
187
234
|
- **Profile** (`#/profile`) — `PROFILE.md` beside the deployed AGENT.md: who you are and
|
|
188
|
-
how you like to work. Opens rendered; **Edit** is a whole-file editor. The save carries
|
|
235
|
+
how you like to work, one card per active install, each saving to its own. Opens rendered; **Edit** is a whole-file editor. The save carries
|
|
189
236
|
the fingerprint it loaded — if an agent session changed the file first, your edit stays
|
|
190
237
|
on screen and a second Save replaces the newer version.
|
|
191
|
-
- **Skills** (`#/skills`) and **Agents** (`#/agents`) — the deployed catalogue
|
|
192
|
-
with its purpose line and full spec.
|
|
238
|
+
- **Skills** (`#/skills`) and **Agents** (`#/agents`) — the deployed catalogue of every
|
|
239
|
+
installed harness, each entry with its purpose line and full spec. Each row is one skill or
|
|
240
|
+
agent; when more than one install is active, it carries a badge for each install that has it
|
|
241
|
+
(`opencode · global`; a project install by its folder). The reader shows the first install's copy. When more installs have the entry,
|
|
242
|
+
a **Viewing copy from** picker beside the copy opens another install's version, for that
|
|
243
|
+
entry only. While Skills is selected, its skill types sit nested
|
|
193
244
|
under it in the rail, each with its count, above a thin bar of their shares; pick one to
|
|
194
245
|
narrow the list.
|
|
195
246
|
- **Docs** (`#/docs`) — rendered documentation: markdown pages, concept pages, a CLI
|
|
@@ -205,8 +256,16 @@ streams the output of background jobs and keeps their history across reloads.
|
|
|
205
256
|
|
|
206
257
|
### 🩺 Care
|
|
207
258
|
|
|
208
|
-
- **Activity** (`#/activity`) — the agent sessions on this machine
|
|
209
|
-
the files it touched and its todo progress; open one for its
|
|
259
|
+
- **Activity** (`#/activity`) — the agent sessions on this machine, from every active install
|
|
260
|
+
in one view: each one's status, the files it touched and its todo progress; open one for its
|
|
261
|
+
detail. Each card has a chip that names its install: the host, then the scope when a host has
|
|
262
|
+
two installs, then the project folder when a host has two project installs, and more of the
|
|
263
|
+
folder's path (up to the whole path) when two folders have the same name. A session that two
|
|
264
|
+
installs of one host both recorded is one card. Its chip and link name the first of those
|
|
265
|
+
installs in a fixed order (host order, then global before project), so they do not change
|
|
266
|
+
between polls. Tracking is on or off per install: the tracking
|
|
267
|
+
card has one switch per install, and each switch changes only that install. OpenCode project
|
|
268
|
+
installs have no switch: their sessions appear under, and follow, the OpenCode global switch. Sessions that ended in the last 7 days are listed under
|
|
210
269
|
**Recently ended**, below the live ones. Every host records it:
|
|
211
270
|
the OpenCode plugin, and `geneseed-hook activity` on Claude Code, OpenClaude and Bob.
|
|
212
271
|
The live sessions open in the **Garden** by default; a **List | Garden** switch (kept in the
|
|
@@ -227,17 +286,17 @@ streams the output of background jobs and keeps their history across reloads.
|
|
|
227
286
|
you) fold into chips, the largest first; the last standing shelf never folds. **Sakura** repaints the crowns pink, nothing more.
|
|
228
287
|
A session's detail page shows its tree too, live or ended, with the same pad hovers and a
|
|
229
288
|
legend of its turns, context, compactions and sub-agents; an ended session's tree stands still, without the `!`.
|
|
230
|
-
- **Changes** (`#/diff`) — the diff between the
|
|
289
|
+
- **Changes** (`#/diff`) — the diff between the install its *Local edits of:* picker names and the source: edited /
|
|
231
290
|
added / missing files, and files only behind the source (unedited; a rebuild updates them)
|
|
232
291
|
listed apart under **Behind source**, with per-file expansion and coloured unified-diff lines. Select
|
|
233
292
|
files to **export an `improvements.md`** back-port, or **restore** them to source.
|
|
234
293
|
Restore acts only on files the diff lists, and never on your own files (`user-rules.md`,
|
|
235
294
|
`PROFILE.md`, `memory/`, `notebook/`). An added file is moved into
|
|
236
295
|
`archived-restore/<date-time>/` in the install, not deleted.
|
|
237
|
-
- **Doctor** (`#/doctor`) — runs the same health engine as the `doctor` command (every
|
|
296
|
+
- **Doctor** (`#/doctor`) — runs, for the install its *Doctor for:* picker names, the same health engine as the `doctor` command (every
|
|
238
297
|
theme, parity, links, authoring gates, drift), grouping any problems per check. It shows
|
|
239
|
-
the server's last run — warmed at start, redone after a job
|
|
240
|
-
|
|
298
|
+
the server's last run for that install — warmed at start, redone after a job or an install
|
|
299
|
+
toggle — and **Re-run checks** runs every check again on demand.
|
|
241
300
|
|
|
242
301
|
### 🎨 Setup
|
|
243
302
|
|
|
@@ -276,7 +335,7 @@ streams the output of background jobs and keeps their history across reloads.
|
|
|
276
335
|
- **Server** (`#/installs/server`; `#/settings` and `#/about` resolve here) — a settings sheet
|
|
277
336
|
with a section index. **Appearance**: skin, accent (a skin change resets it to the skin's own), Overview view. **Machine**:
|
|
278
337
|
version + Update (labelled by how this copy updates: git pull, npm install -g, or the command
|
|
279
|
-
to run by hand), Add to PATH, the
|
|
338
|
+
to run by hand), Add to PATH, the footprint of the install the head's *Footprint of:* picker names (read-only, links to Hosts). **Server**: running · port ·
|
|
280
339
|
pid · uptime, whether the code matches the disk (with Restart), start-at-login state (read
|
|
281
340
|
only), and the four request guards; the index marks Server with a good/warn dot. **About**: version, changelog, credits, source, creator.
|
|
282
341
|
**Danger zone**: Stop server, Remove from PATH, and a pointer to each install's own
|
package/harness.config.json
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
"_comment": "version is a human-readable release label only; the canonical identity of an installed harness is the source fingerprint stamped in .geneseed-version (see `harness version`), not this string.",
|
|
3
3
|
"theme": "neutral",
|
|
4
4
|
"product": "Geneseed",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.32.0"
|
|
6
6
|
}
|
package/js/README.md
CHANGED
|
@@ -240,8 +240,8 @@ the deployed harness as JSON.
|
|
|
240
240
|
| `server.mjs` | `serve()`/`cmdWeb`: UI-build precheck, socket bind, token mint, daemon record wiring |
|
|
241
241
|
| `routes.mjs` | The route tables — `STATE_ROUTES`, `PREFIX_ROUTES`, `POST_ROUTES` (+ its 409 column) — and the inline lists |
|
|
242
242
|
| `handler.mjs` | One function per request: per-request install (`?host=&path=` on every read but `MACHINE_GETS`, or the body on `VIEW_POSTS`), dispatch, gzip, `requestGuard` (Host+port, Origin/Sec-Fetch-Site on `/api`, constant-time CSRF token) and body cap (before the body is read), `securityHeaders` (CSP nonce, framing), static SPA fallback |
|
|
243
|
-
| `state.mjs` | `webState` — the resolved install view every endpoint reads, with its cached inventory and doctor; per-install views (`installView` in `actions.mjs`) hang off it, pinned, refreshed with it |
|
|
244
|
-
| `catalog.mjs` | The Library read model: inventory, constitution tiers, memory/notebook/wiki/config items, `apiCatalog`/`apiItem`, `NotFound` |
|
|
243
|
+
| `state.mjs` | `webState` — the resolved install view every endpoint reads, with its cached inventory and doctor, `defaultView` (the install a request naming none reads) and `fleetSort` (the one install order); per-install views (`installView` in `actions.mjs`) hang off it, pinned, refreshed with it |
|
|
244
|
+
| `catalog.mjs` | The Library read model: inventory, constitution tiers, memory/notebook/wiki/config items, `apiCatalog`/`apiItem`, `NotFound`. Skills and agents are listed across every active install (`FLEET_SECTIONS`; `routes.mjs` builds the fleet), each item served from one install's copy |
|
|
245
245
|
| `api.mjs` | The dashboard and settings reads: overview, recent, themes, setup, doctor, diff, installs, excludes, loops |
|
|
246
246
|
| `update-check.mjs` | Is a newer release on npm? Answers from memory, refreshes in the background (a day when it got an answer, an hour when it did not), `null` on any failure, never asked under `node --test` |
|
|
247
247
|
| `gates-api.mjs` | `GET /api/gates`: gate asks per rule per day over 30 days, read off every installed harness's `notebook/gates.jsonl` (the Overview's sparklines) |
|
|
@@ -251,7 +251,7 @@ the deployed harness as JSON.
|
|
|
251
251
|
| `daemon.mjs` | Detached web start/stop/status/restart, the `.geneseed-web.json` record, and `openUrl` |
|
|
252
252
|
| `jobs.mjs` | `JobManager` and the action→argv table. The only module here that spawns job children |
|
|
253
253
|
| `docs.mjs` | The Docs tab: the `docs/<folder>/` page registry, `?harness=` filtering, link rewriting, the six page kinds |
|
|
254
|
-
| `activity.mjs` | The `activity/` session files:
|
|
254
|
+
| `activity.mjs` | The `activity/` session files of every active install: one merged list (`activitySummary`), the per-install detail and on/off flag, and the daemon's sweep over all installs (`sweepInstalls`) |
|
|
255
255
|
|
|
256
256
|
**Before editing:** `makeHandler(state, jm, token, dist, holder)`'s arity is load-bearing — three
|
|
257
257
|
test call sites construct one directly and drive it without a socket. `routes.mjs`'s tables
|
|
@@ -171,6 +171,27 @@ export function memoryNudge(map) {
|
|
|
171
171
|
return '';
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
// The one context line for a project that names no runtime; the OpenCode context plugin carries
|
|
175
|
+
// the same text (tests/plugins/context_done.test.mjs holds the two equal).
|
|
176
|
+
const FLOOR_LINE = 'Runtime floor: package.json declares no engines — name the supported runtime before you '
|
|
177
|
+
+ 'add a dependency or a language feature.';
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* `FLOOR_LINE` when the git root's package.json is a JSON object with no `engines` field, else
|
|
181
|
+
* null: no file, invalid JSON, or `engines` present (even empty). It reads the file itself:
|
|
182
|
+
* `inferDoneChecks` skips that read for a project with a done list, and an install with the done
|
|
183
|
+
* gate off never reaches it, so sharing it would tie this line to the done gate.
|
|
184
|
+
*
|
|
185
|
+
* shortcut: package.json only — pom.xml (`maven.compiler.release`), pyproject.toml
|
|
186
|
+
* (`requires-python`) and go.mod (`go`) are not read. Add one when a session in such a repo adds
|
|
187
|
+
* something its runtime cannot run.
|
|
188
|
+
*/
|
|
189
|
+
function runtimeFloorLine(root) {
|
|
190
|
+
let pkg;
|
|
191
|
+
try { pkg = JSON.parse(readText(path.join(root, 'package.json'))); } catch { return null; }
|
|
192
|
+
return pkg && typeof pkg === 'object' && !Array.isArray(pkg) && pkg.engines === undefined ? FLOOR_LINE : null;
|
|
193
|
+
}
|
|
194
|
+
|
|
174
195
|
/**
|
|
175
196
|
* The session files present under `hookRoot` and changed from their seed, as `{ rel, abs, text }`
|
|
176
197
|
* (text CRLF-folded, trailing newlines trimmed). `$GENESEED_WIKI` overrides the wiki declaration,
|
|
@@ -459,7 +480,7 @@ export function cmdContext(args) {
|
|
|
459
480
|
// The ownership decline reminder (`./ownership-gate.mjs`), under the same contract: an install
|
|
460
481
|
// built `--no-ownership-gate` carries `Ownership gate: off` and gets no line.
|
|
461
482
|
const owned = gitRoot && !gateOff('Ownership gate') ? ownershipLine(gitRoot) : null;
|
|
462
|
-
const heads = [done, owned].filter(Boolean);
|
|
483
|
+
const heads = [done, owned, gitRoot && runtimeFloorLine(gitRoot)].filter(Boolean);
|
|
463
484
|
if (!session.length && !eager.length && !lazy.length) {
|
|
464
485
|
err(`[context] nothing to load for ${root} `
|
|
465
486
|
+ '(no docs discovered, no manifest entries).\n');
|
package/js/hosts/hooks-done.mjs
CHANGED
|
@@ -11,8 +11,17 @@
|
|
|
11
11
|
* one command per line, and it BLOCKS (a present file that lists nothing switches the gate off for
|
|
12
12
|
* that project). Absent, the checks are INFERRED from the root manifests (`inferDoneChecks`), and
|
|
13
13
|
* an inferred check is ADVISORY: an unproven turn still ends, with a `systemMessage` to the user,
|
|
14
|
-
* a ledger line and a stderr line — never `decision: block`.
|
|
15
|
-
*
|
|
14
|
+
* a ledger line and a stderr line — never `decision: block`. It stays advisory, with no date: an
|
|
15
|
+
* inferred check is a guess at a project's proof, and only a list the project wrote may block
|
|
16
|
+
* (user decision 2026-11). An inferred check is a GROUP of accepted command forms (`npm test` |
|
|
17
|
+
* `npm run test` | `npm t`), satisfied by any one.
|
|
18
|
+
*
|
|
19
|
+
* THE OTHER ADVISORY: A WEAKENED TEST (Cure the Cause). A turn whose write tools added a skip marker
|
|
20
|
+
* to a test file, or dropped an assertion (`weakenedBy`), gets a `[done-gate] advisory` line in the
|
|
21
|
+
* same `systemMessage`. It needs no checks and never blocks, and `--no-done-gate` silences it as
|
|
22
|
+
* it silences the inferred advisory: `cmdLearn` does not call this module at all then. On a Write
|
|
23
|
+
* the old text comes from the transcript line's `toolUseResult.originalFile` (a string on an
|
|
24
|
+
* update, null on a create, seen in real transcripts 2026-11); without it the text reads as new.
|
|
16
25
|
*
|
|
17
26
|
* WHY IT RIDES `learn` AND NOT A VERB OR A FLAG OF ITS OWN (ADR 0010). The machine-wide shim is
|
|
18
27
|
* last-writer-wins: an older `geneseed-hook` would refuse a new verb or flag, and the Stop
|
|
@@ -33,7 +42,8 @@
|
|
|
33
42
|
* inferred checks from `doneLine`, in the SessionStart context, instead.
|
|
34
43
|
*
|
|
35
44
|
* WHAT COUNTS (shortcut: write tools only; a shell `sed -i` or redirect is not an edit here —
|
|
36
|
-
* seeing
|
|
45
|
+
* seeing every one would need `git status`, a spawn; the rule gate reads the common forms for
|
|
46
|
+
* `protected-checks.txt`, but a turn is judged on what it wrote, which a command line cannot prove):
|
|
37
47
|
* - an edit is a Write/Edit/NotebookEdit/MultiEdit whose target is under the project root and
|
|
38
48
|
* whose result is not an error (a denied write changed nothing);
|
|
39
49
|
* - a pass is a Bash/PowerShell call whose command contains one of the check's forms UNPIPED (a pipe
|
|
@@ -56,7 +66,7 @@ import { within } from '../lib/paths.mjs';
|
|
|
56
66
|
import { gitRootOf } from './gitref.mjs';
|
|
57
67
|
import { recordGate } from './hooks.mjs';
|
|
58
68
|
import { ADVISORY_VERB } from './hosts.mjs';
|
|
59
|
-
import { DONE_LIST, splitLines, tailReader } from './hooks-prims.mjs';
|
|
69
|
+
import { DONE_LIST, editPairs, isTestPath, splitLines, tailReader, weakenedBy } from './hooks-prims.mjs';
|
|
60
70
|
import { doneChecksOf } from './done-checks.mjs';
|
|
61
71
|
|
|
62
72
|
const EDIT_TOOLS = new Set(['Write', 'Edit', 'NotebookEdit', 'MultiEdit']);
|
|
@@ -133,15 +143,12 @@ function isPrompt(obj) {
|
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
/**
|
|
136
|
-
* The
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* null ("read more") — a turn judged from its middle could miss its edit and wrongly pass.
|
|
141
|
-
* A check is a line (one form) or a `{ label, forms }` group; the answer lists labels.
|
|
146
|
+
* The current turn in transcript TEXT: its tool calls in order, each result's `is_error`, and the
|
|
147
|
+
* old text the host recorded for a write. `whole` false means the text is only the file's tail:
|
|
148
|
+
* with no prompt in it the turn may start earlier, so the answer is null ("read more") — a turn
|
|
149
|
+
* judged from its middle could miss its edit and wrongly pass.
|
|
142
150
|
*/
|
|
143
|
-
|
|
144
|
-
const groups = checks.map((c) => (typeof c === 'string' ? { label: c, forms: [c] } : c));
|
|
151
|
+
function turnOf(transcript, whole) {
|
|
145
152
|
const entries = [];
|
|
146
153
|
for (const line of splitLines(transcript)) {
|
|
147
154
|
if (!line.trim()) continue;
|
|
@@ -157,6 +164,7 @@ export function doneDecide(transcript, checks, root, cwd = root, whole = true) {
|
|
|
157
164
|
}
|
|
158
165
|
const calls = []; // tool_use blocks, in order
|
|
159
166
|
const results = new Map(); // tool_use_id -> is_error
|
|
167
|
+
const originals = new Map(); // tool_use_id -> the file before a Write
|
|
160
168
|
for (const obj of entries.slice(start)) {
|
|
161
169
|
if (obj.isSidechain) continue;
|
|
162
170
|
const content = obj.message && obj.message.content;
|
|
@@ -164,15 +172,58 @@ export function doneDecide(transcript, checks, root, cwd = root, whole = true) {
|
|
|
164
172
|
for (const b of content) {
|
|
165
173
|
if (!b || typeof b !== 'object') continue;
|
|
166
174
|
if (b.type === 'tool_use') calls.push(b);
|
|
167
|
-
else if (b.type === 'tool_result')
|
|
175
|
+
else if (b.type === 'tool_result') {
|
|
176
|
+
results.set(b.tool_use_id, b.is_error === true);
|
|
177
|
+
const before = obj.toolUseResult && obj.toolUseResult.originalFile;
|
|
178
|
+
if (typeof before === 'string') originals.set(b.tool_use_id, before);
|
|
179
|
+
}
|
|
168
180
|
}
|
|
169
181
|
}
|
|
182
|
+
return { calls, results, originals };
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** The target of a landed write under `root`, absolute, or null. A denied write changed nothing. */
|
|
186
|
+
function editTarget(c, results, root, cwd) {
|
|
187
|
+
if (!EDIT_TOOLS.has(c.name) || results.get(c.id) === true) return null;
|
|
188
|
+
const p = c.input && (c.input.file_path || c.input.notebook_path || c.input.path);
|
|
189
|
+
if (typeof p !== 'string' || !p) return null;
|
|
190
|
+
const abs = path.resolve(cwd, p);
|
|
191
|
+
return within(abs, root) ? abs : null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** The turn's weakened tests, one `path (labels)` entry per file, the path relative to `root`. */
|
|
195
|
+
function weakenedTests({ calls, results, originals }, root, cwd) {
|
|
196
|
+
const byFile = new Map();
|
|
197
|
+
for (const c of calls) {
|
|
198
|
+
const abs = editTarget(c, results, root, cwd);
|
|
199
|
+
if (!abs) continue;
|
|
200
|
+
const rel = path.relative(root, abs).split(path.sep).join('/');
|
|
201
|
+
if (!isTestPath(rel)) continue;
|
|
202
|
+
const hits = weakenedBy(editPairs(c.input, originals.get(c.id)));
|
|
203
|
+
if (hits.length) byFile.set(rel, new Set([...(byFile.get(rel) || []), ...hits]));
|
|
204
|
+
}
|
|
205
|
+
return [...byFile].map(([rel, hits]) => `${rel} (${[...hits].join(', ')})`);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* The decision, over transcript TEXT: the checks that have not passed since the turn's last
|
|
210
|
+
* edit, or [] when the turn may end (no edit, or every check passed after it); null when `whole`
|
|
211
|
+
* is false and the tail holds no prompt (`turnOf`). Exported for the unit tier — a transcript is
|
|
212
|
+
* text no CLI cell can vary cheaply. A check is a line (one form) or a `{ label, forms }` group;
|
|
213
|
+
* the answer lists labels.
|
|
214
|
+
*/
|
|
215
|
+
export function doneDecide(transcript, checks, root, cwd = root, whole = true) {
|
|
216
|
+
const turn = turnOf(transcript, whole);
|
|
217
|
+
return turn && missingChecks(turn, checks, root, cwd);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** `weakenedTests` over transcript TEXT, for the unit tier: `doneDecide`'s other question. */
|
|
221
|
+
export const weakenedIn = (transcript, root, cwd = root) => weakenedTests(turnOf(transcript, true), root, cwd);
|
|
222
|
+
|
|
223
|
+
function missingChecks({ calls, results }, checks, root, cwd) {
|
|
224
|
+
const groups = checks.map((c) => (typeof c === 'string' ? { label: c, forms: [c] } : c));
|
|
170
225
|
let lastEdit = -1;
|
|
171
|
-
calls.forEach((c, i) => {
|
|
172
|
-
if (!EDIT_TOOLS.has(c.name) || results.get(c.id) === true) return;
|
|
173
|
-
const p = c.input && (c.input.file_path || c.input.notebook_path || c.input.path);
|
|
174
|
-
if (typeof p === 'string' && p && within(path.resolve(cwd, p), root)) lastEdit = i;
|
|
175
|
-
});
|
|
226
|
+
calls.forEach((c, i) => { if (editTarget(c, results, root, cwd)) lastEdit = i; });
|
|
176
227
|
if (lastEdit === -1) return [];
|
|
177
228
|
const passed = new Set();
|
|
178
229
|
calls.slice(lastEdit + 1).forEach((c) => {
|
|
@@ -199,38 +250,53 @@ export function doneGate(meta, args, install, read = tailReader()) {
|
|
|
199
250
|
const root = gitRootOf(cwd);
|
|
200
251
|
if (!root) return null;
|
|
201
252
|
const { source, blocking, checks } = doneChecksOf(root);
|
|
202
|
-
if (!checks.length) return null;
|
|
203
253
|
// Bob's Stop payload carries no transcript (learn's I2): nothing to judge, and a listed gate
|
|
204
254
|
// says so. Inferred checks stay quiet there: every repo with a manifest would log it.
|
|
205
255
|
if (args.host === 'bob' || typeof meta.transcript_path !== 'string') {
|
|
206
|
-
if (blocking) err(`[done-gate] no transcript${args.host === 'bob' ? ' (bob)' : ''} — turn not judged.\n`);
|
|
256
|
+
if (blocking && checks.length) err(`[done-gate] no transcript${args.host === 'bob' ? ' (bob)' : ''} — turn not judged.\n`);
|
|
207
257
|
return null;
|
|
208
258
|
}
|
|
209
|
-
let
|
|
259
|
+
let verdict;
|
|
210
260
|
try {
|
|
211
|
-
|
|
212
|
-
|
|
261
|
+
verdict = read(meta.transcript_path, (text, whole) => {
|
|
262
|
+
const turn = turnOf(text, whole);
|
|
263
|
+
return turn && {
|
|
264
|
+
missing: missingChecks(turn, checks, root, cwd), weakened: weakenedTests(turn, root, cwd),
|
|
265
|
+
};
|
|
266
|
+
});
|
|
213
267
|
} catch {
|
|
214
268
|
// No ask tier on Stop: blocking on an unreadable transcript would trap the user.
|
|
215
|
-
err('[done-gate] transcript unreadable — turn not judged.\n');
|
|
269
|
+
if (checks.length) err('[done-gate] transcript unreadable — turn not judged.\n');
|
|
216
270
|
return null;
|
|
217
271
|
}
|
|
272
|
+
const { missing, weakened } = verdict;
|
|
273
|
+
// One JSON document on stdout, whatever the advisories: Stop reads no second one.
|
|
274
|
+
const advise = (...said) => {
|
|
275
|
+
if (weakened.length) {
|
|
276
|
+
// A stable id, not a law number: an advisory is no hook-pinned rule (`HOOK_PINNED`).
|
|
277
|
+
recordGate(install, ADVISORY_VERB, 'cure-the-cause');
|
|
278
|
+
const line = `[done-gate] advisory — test weakened this turn: ${weakened.join('; ')}`;
|
|
279
|
+
err(`${line}\n`);
|
|
280
|
+
said.push(`${line}. Cure the Cause: fix the code, not the test.`);
|
|
281
|
+
}
|
|
282
|
+
out(`${JSON.stringify({ systemMessage: said.join(' ') })}\n`);
|
|
283
|
+
return 'advisory';
|
|
284
|
+
};
|
|
285
|
+
if (!missing.length && weakened.length) return advise();
|
|
218
286
|
if (!missing.length) return null;
|
|
219
287
|
if (!blocking) {
|
|
220
288
|
recordGate(install, ADVISORY_VERB, 'law-3');
|
|
221
289
|
err(`[done-gate] advisory — unproven since the last edit: ${missing.join('; ')}\n`);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
+ `List your own in ${DONE_LIST} to make the gate block.`,
|
|
226
|
-
})}\n`);
|
|
227
|
-
return 'advisory';
|
|
290
|
+
return advise('Geneseed done gate (advisory) — this turn edited files, and these checks '
|
|
291
|
+
+ `inferred from ${source} have not passed since the last edit: ${missing.join('; ')}. `
|
|
292
|
+
+ `List your own in ${DONE_LIST} to make the gate block.`);
|
|
228
293
|
}
|
|
229
294
|
if (meta.stop_hook_active === true) {
|
|
230
295
|
recordGate(install, 'done-gate-cap', 'law-3');
|
|
231
296
|
err(`[done-gate] cap reached — turn ends with unproven checks: ${missing.join('; ')}\n`);
|
|
232
|
-
return null;
|
|
297
|
+
return weakened.length ? advise() : null;
|
|
233
298
|
}
|
|
299
|
+
// The turn goes on, so a weakened test is said at the Stop that really ends it.
|
|
234
300
|
recordGate(install, 'done-gate', 'law-3');
|
|
235
301
|
out(`${JSON.stringify({
|
|
236
302
|
decision: 'block',
|