geneseed 4.26.0 → 4.27.1

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/DESIGN.md +6 -5
  3. package/README.md +10 -6
  4. package/SHIPPED.md +4 -3
  5. package/adapters/bob/README.md +1 -1
  6. package/adapters/claude-code/README.md +5 -1
  7. package/adapters/claude-code/skills/geneseed/SKILL.md +2 -2
  8. package/adapters/opencode/HOW-OPENCODE-LOADS.md +1 -1
  9. package/adapters/opencode/README.md +5 -2
  10. package/adapters/opencode/plugins/geneseed-guard.js +84 -5
  11. package/bin/geneseed-hook.mjs +9 -3
  12. package/docs/concepts/enforcement-table.md +12 -0
  13. package/docs/concepts/exclusions.md +15 -1
  14. package/docs/concepts/hook-gates.md +1 -1
  15. package/docs/concepts/hooks.md +2 -1
  16. package/docs/concepts/ownership.md +79 -0
  17. package/docs/concepts/rules.md +1 -1
  18. package/docs/guides/set-up-ownership.md +77 -0
  19. package/docs/reference/glossary.md +1 -1
  20. package/docs/reference/plugin-guard.md +2 -1
  21. package/docs/reference/troubleshoot-doctor.md +2 -2
  22. package/docs/understand/enforced-vs-asked.md +3 -2
  23. package/docs/understand/machine-bob.md +1 -1
  24. package/docs/understand/machine-claude.md +1 -1
  25. package/docs/understand/machine-opencode.md +1 -1
  26. package/docs/web-ui.md +6 -4
  27. package/harness.config.json +1 -1
  28. package/js/README.md +1 -0
  29. package/js/build/render.mjs +1 -1
  30. package/js/build/source.mjs +5 -1
  31. package/js/cli-table.json +46 -1
  32. package/js/hosts/hooks.mjs +53 -7
  33. package/js/hosts/ownership-gate.mjs +105 -0
  34. package/js/hosts/settings.mjs +8 -3
  35. package/js/inspect/cost.mjs +1 -1
  36. package/js/inspect/inventory.mjs +1 -1
  37. package/js/inspect/status.mjs +1 -1
  38. package/package.json +1 -1
  39. package/registry.json +7 -0
  40. package/src/AGENT.md.tmpl +5 -0
  41. package/src/agents/developer.md +7 -1
  42. package/src/modes/foreman.md +4 -1
  43. package/src/ontology/universal.md +19 -0
  44. package/src/skills/_checkpoints.md +15 -0
  45. package/src/skills/develop.md +4 -0
  46. package/src/skills/document-project.md +2 -1
  47. package/src/skills/learn-mode.md +13 -17
  48. package/src/skills/ownership.md +139 -0
  49. package/src/skills/pipeline.md +1 -1
  50. package/themes/README.md +2 -2
  51. package/themes/_TEMPLATE.json +1 -0
  52. package/themes/biker.json +1 -0
  53. package/themes/commentator.json +1 -0
  54. package/themes/cyberpunk.json +1 -0
  55. package/themes/gamer.json +1 -0
  56. package/themes/imperial.json +1 -0
  57. package/themes/joker.json +1 -0
  58. package/themes/marvin.json +1 -0
  59. package/themes/mean.json +1 -0
  60. package/themes/military.json +1 -0
  61. package/themes/neutral.json +1 -0
  62. package/themes/pirate.json +1 -0
  63. package/themes/sports.json +1 -0
  64. package/themes/verstappen.json +1 -0
  65. package/themes/wizard.json +1 -0
  66. package/web/dist/assets/Activity-DfETiyWm.js +1 -0
  67. package/web/dist/assets/{ActivityDetail-BIxt9mAe.js → ActivityDetail-CnP3GPAN.js} +1 -1
  68. package/web/dist/assets/{CopyButton-DmXwAzBl.js → CopyButton-CRAUXSG7.js} +1 -1
  69. package/web/dist/assets/{Dashboard-BsevsUea.js → Dashboard-CaqOqtkG.js} +2 -2
  70. package/web/dist/assets/{Docs-BkipFlm8.js → Docs-BFxyAVdN.js} +1 -1
  71. package/web/dist/assets/{GreenhouseView-BJmyqf49.js → GreenhouseView-19roNb5W.js} +1 -1
  72. package/web/dist/assets/{Installs-CICECChj.js → Installs-BSoQN7w7.js} +1 -1
  73. package/web/dist/assets/{JournalView-BOyq2Abk.js → JournalView-BgU2ybaq.js} +1 -1
  74. package/web/dist/assets/{KitApply-BRSZjM_N.js → KitApply-Ckc0P5kt.js} +1 -1
  75. package/web/dist/assets/{Kits-DPGxX2Vv.js → Kits-BZqWGWMu.js} +1 -1
  76. package/web/dist/assets/{Laws-CY0hBpkK.js → Laws-CnUWiNIx.js} +1 -1
  77. package/web/dist/assets/{Library-PzXbaBWz.js → Library-rYO8owx_.js} +1 -1
  78. package/web/dist/assets/{Loops-DflSj8Pz.js → Loops-CljFhhQV.js} +1 -1
  79. package/web/dist/assets/{OperatorHudView-CjJlJqGm.js → OperatorHudView-xs7SCwCe.js} +1 -1
  80. package/web/dist/assets/{Personal-CC7cLkTe.js → Personal-CMPwtl36.js} +1 -1
  81. package/web/dist/assets/{Tabs-DCzA2Eop.js → Tabs-CEfSUVQp.js} +1 -1
  82. package/web/dist/assets/{index-xjpstIKL.js → index-FLVXXvV3.js} +2 -2
  83. package/web/dist/index.html +1 -1
  84. package/web/dist/assets/Activity-Dq8_Xhxu.js +0 -1
@@ -0,0 +1,79 @@
1
+ ---
2
+ group: concepts
3
+ order: 17
4
+ title: "Ownership"
5
+ kind: "concept"
6
+ section: "Working together"
7
+ description: "The developer decides each part of production code, at a granularity the team sets."
8
+ ---
9
+ **Ownership** keeps the developer the author of production code. The agent proposes options, interfaces and placements; the developer decides each part, at a granularity the team chooses, and can answer for every line that lands.
10
+
11
+ > **You already know this:** pair programming where you hold the keyboard rights. Your partner suggests, explains the hard parts and types what you approve — but you must be able to defend every change in review without them.
12
+
13
+ ## Why
14
+
15
+ The Credo carries an **Ownership** section, always in force: the code belongs to whoever will answer for it — the developer who ships it, the team that maintains it — never to the agent that typed it. Work is handed over only when the developer can say what changed, where and why. Approval without understanding is not ownership, so a genuinely complex part is explained before it lands, unasked.
16
+
17
+ The `ownership` [skill](skills.md) carries the procedure; a repository switches it on for its team.
18
+
19
+ ## The `## Ownership` section
20
+
21
+ The team's settings live in the committed root `AGENTS.md`, the cross-tool rules file, outside any `<!-- BEGIN GENESEED -->` block:
22
+
23
+ ```markdown
24
+ ## Ownership
25
+
26
+ mode: on # on | off
27
+ granularity: file # feature | file | function — the team default
28
+ sensitive: # always a checkpoint, whatever the granularity
29
+ - src/main/java/**/payment/**
30
+ - src/main/resources/db/migration/**
31
+ ```
32
+
33
+ The rest of `AGENTS.md` holds the project's coding rules: conventions, build and test commands, project rules. Each developer's own state — a finer granularity, the pending checkpoint, the log of decisions — lives in the git-ignored `.geneseed/ownership.md`. [Set up ownership](../guides/set-up-ownership.md) walks through writing both.
34
+
35
+ ## Granularity
36
+
37
+ - **`feature`** — one checkpoint on the plan, then each file is announced and its edit is the approval.
38
+ - **`file`** — the default: one checkpoint per file.
39
+ - **`function`** — the signature, then the body.
40
+
41
+ Whatever the level, an **interface is always a checkpoint** — a public signature, an API contract, a database schema, a new dependency — and so is every change in a `sensitive:` zone. The developer can change the level for the current task at any moment ("go finer here", "do the rest in one go"); the file keeps its default.
42
+
43
+ On complex code (business branching, transactions, concurrency, security) the agent goes finer by itself and explains why; on trivial code it may only *propose* a coarser batch. It announces routine steps — the host's diff prompt is the approval — and asks only at a real fork, recommended option first.
44
+
45
+ ## The first-write gate
46
+
47
+ On every host, a hook stops the first write in an application that has not decided yet:
48
+
49
+ - **Where.** An *application repo*: a git root holding a build manifest — `package.json`, `pom.xml`, `build.gradle*`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `*.csproj`, `composer.json` or `Gemfile`. A folder with no git or no manifest is never gated.
50
+ - **When.** Its root `AGENTS.md` has no `## Ownership` heading outside Geneseed's managed block. The heading with `mode: on` or `mode: off` both count: the team has decided.
51
+ - **What.** The first Write, Edit or NotebookEdit of the session in that repo is refused once. The refusal's reason goes to the agent, which then asks you: set ownership up, or proceed without for this session. The next write passes. Writes to `AGENTS.md` and `.geneseed/` themselves always pass.
52
+ - **What it skips.** Sub-agents defer on Claude Code and OpenClaude, which name them in the hook's input, and on OpenCode, whose guard sees that the session has a parent: a sub-agent cannot ask you, so it never spends the session's one stop. Shell writes are not seen; the line in the harness file covers them.
53
+
54
+ Per host: Claude Code and OpenClaude deny the call with the reason; Bob refuses it with exit 2, once; OpenCode's guard plugin refuses it. See [Hooks](hooks.md) and [Rule enforcement, by host](enforcement-table.md).
55
+
56
+ ## Turning it off
57
+
58
+ | Scope | How | Lasts |
59
+ | --- | --- | --- |
60
+ | One session | Answer "proceed without" when the agent asks | This session; it asks again in the next one |
61
+ | One repo | `## Ownership` with `mode: off` in the root `AGENTS.md` | Until the line changes; travels with the repo |
62
+ | One install | Rebuild with `--no-ownership-gate` ([Exclusions](exclusions.md)) | Every rebuild replays it |
63
+
64
+ The per-install switch stops only the gate. A repo with `mode: on` still runs the ownership checkpoints, and the Credo section still binds.
65
+
66
+ ## learn-mode comes first
67
+
68
+ While `.geneseed/learn.md` says `Learning mode: active`, learn-mode drives the flow. It is the developer's personal choice, and no project can forbid a developer from learning. The team's `AGENTS.md` rules still apply on top: conventions, and interfaces and sensitive zones as checkpoints.
69
+
70
+ The two draw close — both stop at checkpoints, and learn-mode may now propose a solution, though it never applies one it has not explained. Keep them apart by what differs:
71
+
72
+ | | learn-mode | ownership |
73
+ | --- | --- | --- |
74
+ | Who chooses it | The developer, for themself | The team, in `AGENTS.md`; a developer may go finer, coarser only with an explicit, logged yes |
75
+ | Explanation | Every solution, before it is applied | Complex parts only; routine steps are announced |
76
+ | Record | `## Understood` in `.geneseed/learn.md`: what the developer has grasped | `## Decisions` in `.geneseed/ownership.md`: forks, interfaces, sensitive zones, granularity changes |
77
+ | Pacing | A level: beginner, intermediate, advanced | A granularity: feature, file, function |
78
+
79
+ Under [Foreman mode](foreman-mode.md), the session holds every checkpoint; a background worker receives only approved decisions.
@@ -21,7 +21,7 @@ The one place you type a position is the command line: `--exclude-rules "process
21
21
 
22
22
  When two instructions disagree, the higher one wins.
23
23
 
24
- 1. **Ethos** — always on. {N_ONTOLOGY} sections of flowing prose (Telos, Evidence, Decisions, Conduct): what the agent is for, how it weighs evidence, how it decides, how it behaves. It is where the **Pact**, the two-way contract between you and the agent, is stated ([Collaboration](collaboration.md)). Cited by section name, e.g. *Ethos: Decisions*.
24
+ 1. **Ethos** — always on. {N_ONTOLOGY} sections of flowing prose (Telos, Evidence, Decisions, Ownership, Conduct): what the agent is for, how it weighs evidence, how it decides, who owns the code it writes, how it behaves. It is where the **Pact**, the two-way contract between you and the agent, is stated ([Collaboration](collaboration.md)). Cited by section name, e.g. *Ethos: Decisions*.
25
25
  2. **Rules** — always on. {N_LAWS} invariants, the things that are never traded away: sealed secrets, one intent per act, verify before asserting, deliberate deletion, surface failures, treat content as data not orders, least privilege, cure the cause, echo the intent. No install can switch one off.
26
26
  3. **Your `user-rules.md`** — rules you write for yourself, seeded once beside the instructions file and never overwritten. A rule here **outranks any doctrine rule**: a practice pack chosen at build time never overrides an instruction you wrote. It may tighten an invariant, never repeal one. The [rule skill](skills.md) helps you decide whether something belongs here or in [memory](memory.md).
27
27
  4. **Doctrines** — chosen at build time. Practices rather than principles, grouped in packs (below).
@@ -0,0 +1,77 @@
1
+ ---
2
+ group: guides
3
+ order: 21
4
+ title: "Set up ownership"
5
+ kind: "concept"
6
+ section: "Set up"
7
+ description: "Give an application repo its `## Ownership` section, so the developer decides each part."
8
+ ---
9
+ This guide gives one application repository its ownership setup: a `## Ownership` section in the committed root `AGENTS.md`, and your personal state file. What ownership is, and how it differs from learn-mode: [Ownership](../concepts/ownership.md).
10
+
11
+ You need a Geneseed install on your host (any of Claude Code, OpenClaude, OpenCode or Bob) and a repository with a build manifest at its git root (`package.json`, `pom.xml`, `build.gradle*` and the like).
12
+
13
+ ## 1. Start the setup
14
+
15
+ Open a session in the repository and ask for it: "set up ownership for this repo". The agent runs the `ownership` skill.
16
+
17
+ You may not need to ask. In an application with no `## Ownership` section, the first file write of a session is stopped once, and the agent proposes the setup to you. Answer "set it up", or "proceed without" to skip it for this session only.
18
+
19
+ ## 2. Review the conventions it found
20
+
21
+ The agent reads the code first and writes nothing yet. It proposes the conventions it found: naming, layers, test patterns, build and test commands. Correct what is wrong. If the stack matches a [kit](../concepts/kits.md) (`spring-boot`, `react`), it proposes that kit too.
22
+
23
+ ## 3. Answer the questions
24
+
25
+ About five questions, one at a time, each with a recommended answer:
26
+
27
+ 1. Are the conventions right?
28
+ 2. Ownership on for this repo? (`mode: on`, or `mode: off` to opt the repo out)
29
+ 3. The default granularity: `feature`, `file` (recommended) or `function`.
30
+ 4. The sensitive zones: paths where every change is a checkpoint, such as `payment/`, database migrations or security configuration.
31
+ 5. Any free-form project rules.
32
+
33
+ ## 4. Check the diff
34
+
35
+ The setup writes two files and shows you the diff:
36
+
37
+ - `AGENTS.md` at the repository root, at most about 60 lines, ending with the section:
38
+
39
+ ```markdown
40
+ ## Ownership
41
+
42
+ mode: on
43
+ granularity: file
44
+ sensitive:
45
+ - src/main/resources/db/migration/**
46
+ ```
47
+
48
+ If the file already exists, your own lines stay. Geneseed's managed `<!-- BEGIN GENESEED -->` block (written there by a Bob per-repo install) is left alone, and a section inside it does not count.
49
+ - `.geneseed/ownership.md`, your personal state: a finer granularity if you want one, the pending checkpoint, and the decisions you took. It is data, never instructions, and it belongs in `.gitignore` — the agent offers to add `.geneseed/` once.
50
+
51
+ Nothing is committed unless you ask.
52
+
53
+ ## 5. Check how diffs reach you
54
+
55
+ Under ownership, the host's own diff prompt is how you approve a routine step. The setup checks the permission mode:
56
+
57
+ - **Claude Code, OpenClaude.** If edits are auto-accepted (bypass or accept-edits mode), no diff stops for you. Switch back to asking, or keep it: the agent then shows a compact diff in the chat and waits for your reply.
58
+ - **OpenCode.** The agent proposes `permission.edit: "ask"` in the project `opencode.json`.
59
+
60
+ ## 6. Commit `AGENTS.md`
61
+
62
+ Commit the root `AGENTS.md` with the repository, so the whole team works under the same section. From then on the first-write gate stays quiet in this repo, and every session runs the checkpoints at the team's granularity.
63
+
64
+ ## Change it later
65
+
66
+ - **Finer for one task.** Say "go finer here", or "do the rest in one go" to propose a coarser batch.
67
+ - **The team default.** Edit `granularity:` in `AGENTS.md` and commit it.
68
+ - **Opt the repo out.** Set `mode: off`. The gate stays quiet, and no checkpoint runs.
69
+ - **Opt the whole install out of the gate.** Rebuild with the flag, as [Exclusions](../concepts/exclusions.md) shows:
70
+
71
+ ```bash
72
+ geneseed build --emit claude-global --no-ownership-gate
73
+ ```
74
+
75
+ ## Verify
76
+
77
+ In a fresh session, ask for a small change in the repository. The agent should announce the file it will touch, or ask at a real fork, before the edit — and the first write should pass without the gate stopping it.
@@ -12,7 +12,7 @@ Every word Geneseed uses that you would not find in a general programming glossa
12
12
  |---|---|---|---|
13
13
  | Harness | — | everything Geneseed installs around the model: the rules it loads, the gates that run before its actions, the workflows it can call | git hooks + CI + a runbook, for an agent |
14
14
  | Hook | — | a command your tool runs before or after an agent action; Geneseed's hooks gate risky actions and load context | a git hook, fired on every tool call |
15
- | Ethos (Ontology) | ONTOLOGY | the always-on worldview under the rules — telos, evidence, decisions, conduct; it holds the Pact | the team's engineering principles |
15
+ | Ethos (Ontology) | ONTOLOGY | the always-on worldview under the rules — telos, evidence, decisions, ownership, conduct; it holds the Pact | the team's engineering principles |
16
16
  | Rule (Law) | LAW | one of the nine always-on invariants: what is never done | a lint rule set to error |
17
17
  | Rules (Laws) | LAWS | the body of always-on invariants | the error-level rule set |
18
18
  | Doctrine | DOCTRINE | one practice rule, cited `<pack> <n>` — how work is done here | a team convention in CONTRIBUTING.md |
@@ -11,6 +11,7 @@ One of the [OpenCode plugins](opencode-plugins.md). [Environment variables](envi
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
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)).
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; an install built `--no-ownership-gate` carries `Ownership gate: off` in its `AGENT.md`, read once at load.
14
15
  - **Warns** (logged, allowed) on `.env` writes.
15
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.
16
17
 
@@ -20,7 +21,7 @@ There is no DYNAMIC loop/* exemption on OpenCode — it declares a `permission.a
20
21
 
21
22
  **When it runs.** Before every tool call (`tool.execute.before`).
22
23
 
23
- **What you see.** A refused tool call: `[geneseed-guard] blocked: <reason> — set GENESEED_GUARD=off to allow`. Warnings go to stderr.
24
+ **What you see.** A refused tool call: `[geneseed-guard] blocked: <reason>`. The reason never names the switches below: the agent reads it, and a switch named there reads as leave to get round the block. The *Persist Insight* reason tells the agent to ask you and, once you answer, re-issue the same refused edit — never to write the file another way (through a shell command, say). Warnings go to stderr.
24
25
 
25
26
  **Switches.**
26
27
  - `GENESEED_GUARD=warn` — log every block, allow the call.
@@ -43,8 +43,8 @@ These come only from `geneseed doctor --probe`. It runs each installed gate exac
43
43
  settings spell it, through the host's own shell, on `git reflog expire --expire=now --all` (which must be refused)
44
44
  and `git status` (which must go through). A gate wired with `--no-deletion-gate` lets the first one
45
45
  through by design, so it is probed on `find / -name geneseed-probe` instead — a root-wide scan it
46
- must still refuse. `--no-secrets-gate` and `--no-done-gate` change nothing here: neither judges a
47
- shell command. An OpenCode install's guard plugin has no command to
46
+ must still refuse. `--no-secrets-gate`, `--no-done-gate` and `--no-ownership-gate` change nothing here: none
47
+ judges a shell command. An OpenCode install's guard plugin has no command to
48
48
  run: the probe imports it and calls its hook through both plugin APIs (V1 and V2), with `rm -rf /`
49
49
  as the call it must refuse. `GENESEED_GUARD=off` or `warn` in your terminal makes that a note,
50
50
  not a failure.
@@ -27,11 +27,12 @@ On Claude Code and OpenClaude the hooks never block silently. They make the host
27
27
  - **A scan of a whole filesystem**: a recursive `find`, `du`, `grep -r`, `rg` or `Get-ChildItem -Recurse` rooted at `/`, `/c` or `C:\`, which in Git Bash walks every drive for hours. Wired in every build.
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
+ - **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 or proceed without. Off per repo with `mode: off`, per install with `--no-ownership-gate`.
30
31
  - **Ending a turn without the proof**: only in a project that lists its checks in `.geneseed/done-checks.txt`. 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.
31
32
 
32
33
  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.
33
34
 
34
- **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, and a write under a project's own protected-checks list. The commit/push and memory checks become a log line, and the call goes through. Bob's hook wiring follows its documentation but has not been tested on a live Bob install.
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, and a write under a project's own protected-checks list. 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.
35
36
 
36
37
  <!--/harness-->
37
38
  <!--harness:opencode-->
@@ -40,7 +41,7 @@ If a gate crashes, it asks instead of letting the call through. If it cannot sta
40
41
  On OpenCode, two mechanisms enforce rules:
41
42
 
42
43
  - **OpenCode's own permission prompt**, which Geneseed configures in `opencode.json`. It asks you before `git reflog expire`, `git gc --prune` and a force-push or delete of `main`/`master`, and, when the **process** pack is on, before every commit and push.
43
- - **The guard plugin**, which blocks outright: writes to key and credential files (`id_rsa`, `*.pem`, `.ssh/`, `.npmrc`…), catastrophic commands (`rm -rf /`, `rm -rf ~`, formatting or overwriting a disk), every other real data loss (the same state-aware decisions as the hook), a recursive scan of a whole filesystem (`find /`, `du -sh /`, `Get-ChildItem C:\ -Recurse`), and any change inside a folder your wiki marks `protected`. It also refuses the first write to `user-rules.md` or memory once. Re-issue the write and it goes through.
44
+ - **The guard plugin**, which blocks outright: writes to key and credential files (`id_rsa`, `*.pem`, `.ssh/`, `.npmrc`…), catastrophic commands (`rm -rf /`, `rm -rf ~`, formatting or overwriting a disk), every other real data loss (the same state-aware decisions as the hook), a recursive scan of a whole filesystem (`find /`, `du -sh /`, `Get-ChildItem C:\ -Recurse`), and any change inside a folder your wiki marks `protected`. It also refuses the first write to `user-rules.md` or memory once. Re-issue the write and it goes through. And in an application repo with no `## Ownership` section in its root `AGENTS.md`, it refuses the session's first write once, so the agent proposes the [ownership](../concepts/ownership.md) setup (off with `mode: off` or `--no-ownership-gate`).
44
45
 
45
46
  The guard only warns on `.env` edits. It checks credentials by **file path**, not by content, so a key pasted into an ordinary source file is not caught here. One caveat about the process pack: if your `opencode.json` already has a `git commit*` entry, a rebuild without the pack leaves that entry in place and reports it. Geneseed cannot tell its own entry from one you typed.
46
47
 
@@ -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, and a write under a project's own protected-checks list. The commit/push and memory questions become log lines.
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, and a write under a project's own protected-checks list. 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, 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
 
@@ -16,7 +16,7 @@ What a Claude Code or OpenClaude install writes, piece by piece. The **Kind** wo
16
16
  | `PROFILE.md` | Who you are and how you like answers pitched. Fill it with the `profile` skill | asked | 0 until you fill it | Leave the seeded text untouched |
17
17
  | context hook | At session start, and again after a resume or compaction, puts your repo's README, CONTRIBUTING and a listing of `docs/` in front of the agent, with your rules, profile, memory index and wiki | automatic | Your docs, capped at 16 KB a file and 48 KB a session | `geneseed exclude add <folder>` silences every hook in that folder |
18
18
  | git-gate hook | Before each shell command: asks you before any `git commit` or `git push`, and before a command that would really lose data — a force-push to `main`, a `reset --hard` that abandons unpushed commits, `branch -D` of an unpushed branch, an `rm` git cannot undo | enforced | ~14 ms per shell call | The commit/push question goes away if you build without the **process** pack; the destructive-git question has no switch except `geneseed exclude` |
19
- | rule-gate hook | Before each write or edit: asks you when the file would carry a credential-shaped string (outside `.env`), or when the agent writes to `user-rules.md` or memory | enforced | ~14 ms per write | `geneseed exclude add <folder>` |
19
+ | rule-gate hook | Before each write or edit: asks you when the file would carry a credential-shaped string (outside `.env`), or when the agent writes to `user-rules.md` or memory. In an application repo with no `## Ownership` section in its root `AGENTS.md`, stops the session's first write once so the agent proposes the [ownership](../concepts/ownership.md) setup | enforced | ~14 ms per write | `geneseed exclude add <folder>`; the ownership stop alone: `mode: off` in the repo's `## Ownership`, or rebuild with `--no-ownership-gate` |
20
20
  | learn hook | When the agent finishes a reply, and before compaction, distils durable facts from the recent conversation into `memory/`. Off until you set `GENESEED_LLM` to a model command such as `claude -p` | automatic | One model call each time it runs, once enabled | Leave `GENESEED_LLM` unset (the default) |
21
21
  | `skills/` | Written procedures you call by name, such as `brainstorm` or `plan` | on demand | ~4.1k tokens for names and descriptions; a skill's body loads only when called | No per-skill switch; `geneseed uninstall` removes them all |
22
22
  | `agents/` | Specialists the agent can delegate to, such as `reviewer` or `tester` | on demand | ~0.5k tokens | `geneseed uninstall` |
@@ -16,7 +16,7 @@ What an OpenCode install writes, piece by piece. The **Kind** words are explaine
16
16
  | `PROFILE.md` | Who you are and how you like answers pitched. Fill it with the `profile` skill | asked | 0 until you fill it | Leave the seeded text untouched |
17
17
  | `opencode.json` entries | `instructions` points OpenCode at `AGENT.md`. `permission.bash` makes OpenCode ask before `git reflog expire`, `git gc --prune` or a force-push or delete of `main`/`master`, and before every commit and push when the **process** pack is on. `permission.skill` denies each user-only skill, so the model never starts it but `/name` still runs it; Geneseed takes back only the denies it wrote | enforced | No tokens | Edit the `permission` block yourself. The commit/push questions follow the **process** pack |
18
18
  | context plugin | Puts your repo's README, CONTRIBUTING and a listing of `docs/` in front of the agent, with your rules, profile, memory index and wiki | automatic | Your docs, capped at 16 KB a file and 48 KB a session | `GENESEED_CONTEXT_INJECT=off` |
19
- | guard plugin | Blocks writes to key and credential files (`id_rsa`, `.pem`, `.ssh/`…), catastrophic commands (`rm -rf /`, formatting a disk), every other real data loss judged against the repository's state, a recursive scan of a whole filesystem (`find /`), and changes inside your wiki's protected folders. Refuses the first write to `user-rules.md` or memory once, so the choice is yours | enforced | No tokens | `GENESEED_GUARD=off`, or `GENESEED_GUARD=warn` to log instead of block |
19
+ | guard plugin | Blocks writes to key and credential files (`id_rsa`, `.pem`, `.ssh/`…), catastrophic commands (`rm -rf /`, formatting a disk), every other real data loss judged against the repository's state, a recursive scan of a whole filesystem (`find /`), and changes inside your wiki's protected folders. Refuses the first write to `user-rules.md` or memory once, so the choice is yours. In an application repo with no `## Ownership` section in its root `AGENTS.md`, refuses the session's first write once so the agent proposes the [ownership](../concepts/ownership.md) setup | enforced | No tokens | `GENESEED_GUARD=off`, or `GENESEED_GUARD=warn` to log instead of block; the ownership refusal alone: `mode: off` in the repo's `## Ownership`, or rebuild with `--no-ownership-gate` |
20
20
  | learn plugin | Once a session has been quiet for 60 seconds, distils durable facts into `memory/` with the model the session already uses | automatic | One model call per quiet session | `geneseed exclude add <folder>` silences it in that folder |
21
21
  | activity plugin | Writes one small file per session that the web console's Activity view shows: what the session does now, its sub-agents, the files each of them changed (by path inside the repository), its turns, how full its context is and its compactions | automatic | No tokens | `GENESEED_ACTIVITY=off` |
22
22
  | notify plugin | A desktop notification when a turn took longer than 30 seconds | automatic | No tokens | `GENESEED_NOTIFY=off` |
package/docs/web-ui.md CHANGED
@@ -111,13 +111,14 @@ streams the output of background jobs and keeps their history across reloads.
111
111
  content the page last read — if an agent session edited the file meanwhile, the save
112
112
  409s and the page reloads instead of clobbering it.
113
113
  - **Constitution** (`#/laws`) — the whole governance surface on one page, in three bands:
114
- the **Ethos** (four prose sections), the **Dictates** (the nine numbered Rules, with
114
+ the **Ethos** (five prose sections), the **Dictates** (the nine numbered Rules, with
115
115
  a class facet — only non-empty classes render, and two of the six have had no invariant
116
116
  since the split), and the **Doctrines** (one group per pack, each marked active or not for
117
117
  this install). Rules I, III and IV each carry a switch for the install's hook gate — the
118
118
  secrets gate, the done gate and the deletion gate (`--no-secrets-gate`, `--no-done-gate`,
119
119
  `--no-deletion-gate`; *Enforced by* reads *Gate off* while one is off) — flipping one asks,
120
- then rebuilds the install once; the other Rules read *no gate*. A precedence ladder heads the page (a state pill per rung; ranks 5–6 below). *Gated* and *Changed* narrow the rows; packs fold; staged doctrine changes collect in a sticky *Unapplied changes* bar that holds Revert and the page's one Apply. Every row expands to its full body, lazily fetched. The rail entry is
120
+ then rebuilds the install once; the other Rules read *no gate*. The ownership gate belongs
121
+ to no Rule, so it has no switch here: rebuild with `--no-ownership-gate` instead. A precedence ladder heads the page (a state pill per rung; ranks 5–6 below). *Gated* and *Changed* narrow the rows; packs fold; staged doctrine changes collect in a sticky *Unapplied changes* bar that holds Revert and the page's one Apply. Every row expands to its full body, lazily fetched. The rail entry is
121
122
  labelled *Constitution* while the route, the id and the badge key stay `laws`; deep links
122
123
  are `#/item/law/ont:telos`, `#/item/law/IV` and `#/item/law/process.5` — three address
123
124
  shapes that cannot collide, because a slug carries a colon no numeral has and a doctrine
@@ -187,8 +188,9 @@ streams the output of background jobs and keeps their history across reloads.
187
188
  the files it touched and its todo progress; open one for its detail. Sessions that ended in the last 7 days are listed under
188
189
  **Recently ended**, below the live ones. Every host records it:
189
190
  the OpenCode plugin, and `geneseed-hook activity` on Claude Code, OpenClaude and Bob.
190
- A **List | Garden** switch (kept in the URL with the filters, which apply to both) shows the
191
- live sessions as pixel bonsai instead: one shelf per repository (worktrees stand on their
191
+ The live sessions open in the **Garden** by default; a **List | Garden** switch (kept in the
192
+ URL with the filters, which apply to both) shows them as a list of cards instead. The Garden
193
+ shows them as pixel bonsai: one shelf per repository (worktrees stand on their
192
194
  repo's shelf, tagged ⎇), one tree per session. The pot's glaze is the host (clay Claude Code,
193
195
  blue Bob, grey OpenCode, violet OpenClaude); the tree grows taller with turns, its crown
194
196
  with context fill, and the tips yellow past 80 %. A compaction cuts the crown flat (it
@@ -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.26.0"
5
+ "version": "4.27.1"
6
6
  }
package/js/README.md CHANGED
@@ -91,6 +91,7 @@ user co-owns, and the hook verbs those emitted configs then run.
91
91
  | `hosts.mjs` | The four host config dirs (opencode/claude/bob/openclaude), their `family` (`CLAUDE_STYLE`), plus `resolvePath`/`expanduser` |
92
92
  | `hooks.mjs` | The gate verbs, run on every tool call: `git-gate`, `rule-gate`, `tool-gate` (the two gates fused, for Bob), plus `ask`/the gate ledger/`guardGate`. `--host` picks the verdict dialect |
93
93
  | `hooks-context.mjs` | The `context` verb — SessionStart: session files plus the repo's context docs |
94
+ | `ownership-gate.mjs` | The ownership first-write gate, last in `rule-gate`: in an application repo (git root + build manifest) whose root `AGENTS.md` has no `## Ownership` section, denies the session's first write once (a tmpdir marker per session). Builtins + `gitRootOf` only. Twin: the OpenCode guard plugin |
94
95
  | `hooks-done.mjs` | The done gate (#289): on Stop, inside `learn` and before its spawn, blocks a turn that edited files until `.geneseed/done-checks.txt`'s checks passed after the last edit |
95
96
  | `hooks-learn.mjs` | The `learn` verb — Stop/SubagentStop/PreCompact distiller; the hook path's ONE spawn (`$GENESEED_LLM`) |
96
97
  | `hooks-prims.mjs` | The Python path/text primitives the hook verbs share (`splitLines`, `readStdin`, a never-throwing `isFile`), plus the activity off switch (`activityOn`) and the do-nothing `activity` verb |
@@ -54,7 +54,7 @@ export const STRUCTURE = {
54
54
  // `({{ONTOLOGY}}: {{ONT_TELOS}})` — token on both sides, so the heading and every
55
55
  // reference to it move together and a rename can never desync them.
56
56
  ONT_TELOS: 'Telos', ONT_EVIDENCE: 'Evidence', ONT_DECISIONS: 'Decisions',
57
- ONT_CONDUCT: 'Conduct',
57
+ ONT_OWNERSHIP: 'Ownership', ONT_CONDUCT: 'Conduct',
58
58
  };
59
59
 
60
60
  /**
@@ -524,7 +524,8 @@ export function resolveSkillNames(names, {
524
524
  }
525
525
 
526
526
  /**
527
- * The laws whose hook gate an install can switch off, in law order: the cfg/profile key, the
527
+ * The hook gates an install can switch off (the laws', in law order, then the ownership gate,
528
+ * which has no law: `law: null`): the cfg/profile key, the
528
529
  * build flag, the carrier marker (`<marker>: off`, written only when off) and the law. ONE
529
530
  * table, so the flag, the marker, the rebuild argv, the read-back and `status` cannot drift
530
531
  * apart. Every gate is ARMED by default and the law's text binds either way. The deletion row
@@ -534,6 +535,9 @@ export const GATE_SWITCHES = [
534
535
  { key: 'secretsGate', flag: '--no-secrets-gate', arg: 'noSecretsGate', marker: 'Secrets gate', law: 'I' },
535
536
  { key: 'doneGate', flag: '--no-done-gate', arg: 'noDoneGate', marker: 'Done gate', law: 'III' },
536
537
  { key: 'deletionGate', flag: '--no-deletion-gate', arg: 'noDeletionGate', marker: 'Deletion gate', law: 'IV' },
538
+ // Not a law's gate (`law: null`): the ownership first-write gate (js/hosts/ownership-gate.mjs,
539
+ // ruling D25). Its off switch is this flag, never `harness.config.json` (args.mjs says why).
540
+ { key: 'ownershipGate', flag: '--no-ownership-gate', arg: 'noOwnershipGate', marker: 'Ownership gate', law: null },
537
541
  ];
538
542
 
539
543
  /**
package/js/cli-table.json CHANGED
@@ -336,6 +336,21 @@
336
336
  "is_flag": true,
337
337
  "type": null,
338
338
  "hidden": false
339
+ },
340
+ {
341
+ "names": [
342
+ "--no-ownership-gate"
343
+ ],
344
+ "dest": "no_ownership_gate",
345
+ "metavar": null,
346
+ "help": "switch the ownership first-write gate off for this install: an application repo with no '## Ownership' section in its root AGENTS.md is no longer stopped once per session before its first write (not a law's gate); written to the carrier as 'Ownership gate: off' and replayed by rebuilds",
347
+ "choices": null,
348
+ "default": false,
349
+ "required": false,
350
+ "nargs": "0",
351
+ "is_flag": true,
352
+ "type": null,
353
+ "hidden": false
339
354
  }
340
355
  ],
341
356
  "mutex": []
@@ -1216,7 +1231,7 @@
1216
1231
  },
1217
1232
  {
1218
1233
  "name": "rule-gate",
1219
- "help": "PreToolUse hook: force an ASK before any write to user-rules.md or memory (Persist Insight backstop)",
1234
+ "help": "PreToolUse hook: force an ASK before any write to user-rules.md or memory (Persist Insight backstop), and stop the first write of a session once in an application repo with no ## Ownership section in its root AGENTS.md (the ownership gate)",
1220
1235
  "description": "",
1221
1236
  "positionals": [],
1222
1237
  "options": [
@@ -1264,6 +1279,21 @@
1264
1279
  "is_flag": true,
1265
1280
  "type": null,
1266
1281
  "hidden": false
1282
+ },
1283
+ {
1284
+ "names": [
1285
+ "--no-ownership-gate"
1286
+ ],
1287
+ "dest": "no_ownership_gate",
1288
+ "metavar": null,
1289
+ "help": "skip the ownership first-write gate (set by the emit when the install was built --no-ownership-gate); every other check still runs",
1290
+ "choices": null,
1291
+ "default": false,
1292
+ "required": false,
1293
+ "nargs": "0",
1294
+ "is_flag": true,
1295
+ "type": null,
1296
+ "hidden": false
1267
1297
  }
1268
1298
  ],
1269
1299
  "mutex": []
@@ -1556,6 +1586,21 @@
1556
1586
  "is_flag": true,
1557
1587
  "type": null,
1558
1588
  "hidden": false
1589
+ },
1590
+ {
1591
+ "names": [
1592
+ "--no-ownership-gate"
1593
+ ],
1594
+ "dest": "no_ownership_gate",
1595
+ "metavar": null,
1596
+ "help": "skip the ownership first-write gate (set by the emit when the install was built --no-ownership-gate); every other check still runs",
1597
+ "choices": null,
1598
+ "default": false,
1599
+ "required": false,
1600
+ "nargs": "0",
1601
+ "is_flag": true,
1602
+ "type": null,
1603
+ "hidden": false
1559
1604
  }
1560
1605
  ],
1561
1606
  "mutex": []
@@ -10,8 +10,10 @@
10
10
  *
11
11
  * THREE HOSTS, TWO DIALECTS. `--host` names the host that will read the verdict. Claude Code
12
12
  * (the default) reads `hookSpecificOutput.permissionDecision: "ask"` and shows the user a
13
- * prompt. `--host bob` is Bob's own protocol: PreToolUse ignores stdout and refuses only on
14
- * EXIT CODE 2, so `BLOCK_RULES` (Laws I and IV, plus rigor-5 and ops-2) exit 2 with the reason on stderr
13
+ * prompt; the one `"deny"` (the ownership first-write gate, `./ownership-gate.mjs`) carries
14
+ * its reason to the MODEL instead. `--host bob` is Bob's own protocol: PreToolUse ignores stdout and refuses only on
15
+ * EXIT CODE 2, so `BLOCK_RULES` (Laws I and IV, plus rigor-5 and ops-2) exit 2 with the reason on stderr,
16
+ * as does the ownership gate (through `deny`, with a one-time tail in place of `BOB_FINAL`),
15
17
  * and the rest is a stderr line with exit 0; SessionStart context is plain stdout, as on
16
18
  * Claude. `--host openclaude` speaks Claude's dialect verbatim (OpenClaude is a Claude Code
17
19
  * fork); the flag only picks which root file counts as native for `context`'s discovery.
@@ -63,6 +65,7 @@ import { currentBranch, gitRootOf, loopLaunched } from './gitref.mjs';
63
65
  import { LOSS_CANDIDATE_RE, catastrophic, lossReason, stripStructure } from './loss.mjs';
64
66
  import { selfAndParents, readStdin, SECRET_RE } from './hooks-prims.mjs';
65
67
  import { recordUse } from './usage.mjs';
68
+ import { ownershipBlock } from './ownership-gate.mjs';
66
69
 
67
70
  // ======================================================================================
68
71
  // git-gate — Doctrine process 5's tool-boundary backstop
@@ -175,10 +178,20 @@ export function loopExempt(command, cwd) {
175
178
  * 378-line module parse, being the only thing on the gate path that needed it.
176
179
  * `tests/unit/hook_gates.test.mjs` holds the two byte-identical over non-ASCII reasons.
177
180
  */
178
- export function askDecision(reason) {
181
+ export function askDecision(reason) { return decisionDoc('ask', reason); }
182
+
183
+ /**
184
+ * The `permissionDecision: "deny"` twin of `askDecision`, same spelling. Claude Code shows an
185
+ * ask's reason to the USER and a deny's reason to the MODEL (hooks reference, the
186
+ * `permissionDecisionReason` row), so a gate whose reason is an instruction to the agent (the
187
+ * ownership gate: "propose the setup") must deny, not ask.
188
+ */
189
+ export function denyDecision(reason) { return decisionDoc('deny', reason); }
190
+
191
+ function decisionDoc(decision, reason) {
179
192
  const value = JSON.stringify(reason)
180
193
  .replace(/[\u007f-￿]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`);
181
- return '{"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "ask", '
194
+ return `{"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "${decision}", `
182
195
  + `"permissionDecisionReason": ${value}}}\n`;
183
196
  }
184
197
 
@@ -284,6 +297,28 @@ function ask(args, verb, rule, reason) {
284
297
  return 0;
285
298
  }
286
299
 
300
+ /**
301
+ * Said after Bob's ownership block, in place of `BOB_FINAL`: this block is NOT final. The
302
+ * marker was written before the refusal, so the same write passes once the developer answered.
303
+ */
304
+ const BOB_ONCE = ' On Bob this block is one-time, not final: the same write passes once the '
305
+ + 'developer has answered.';
306
+
307
+ /**
308
+ * Refuse, and record it, for a gate whose reason the AGENT must read (`denyDecision`), not a
309
+ * prompt for the user. Not `ask`: the ownership rule is not in `BLOCK_RULES`, so on Bob `ask`
310
+ * would warn and let the call through. Bob: exit 2 with `BOB_ONCE`, never `BOB_FINAL`.
311
+ */
312
+ function deny(args, verb, rule, reason) {
313
+ ledger(args && args.root, verb, rule);
314
+ if (HOST === 'bob') {
315
+ err(`[geneseed] BLOCKED: ${reason}${BOB_ONCE}\n`);
316
+ return BOB_DENY_EXIT;
317
+ }
318
+ out(denyDecision(reason));
319
+ return 0;
320
+ }
321
+
287
322
  /**
288
323
  * FAIL CLOSED. Wraps a gate verb so that any throw — a payload that is not JSON, a path
289
324
  * primitive refusing a form, a bug — becomes an `ask` carrying the error, never a silent
@@ -509,6 +544,13 @@ export const cmdGitGate = guardGate(gitGate, 'git-gate');
509
544
  * Geneseed's own coinage and match anywhere; any other markdown matches only inside THIS
510
545
  * install's `<root>/memory/`.
511
546
  */
547
+ // The close of the process-1 text, word for word the OpenCode guard's PERSIST_ASK (tests pin
548
+ // both). A weak model once took a refusal as leave to write the same file through a shell
549
+ // command, so the text names the one way forward and never a switch that turns the gate off.
550
+ export const PERSIST_ASK = 'Stop and ask the user now (the rule skill). If this edit was refused, '
551
+ + 're-issue the same edit only after they answer; never write it another way (for example '
552
+ + 'through a shell command).';
553
+
512
554
  function ruleGateTarget(p, root) {
513
555
  if (typeof p !== 'string') return null;
514
556
  // Split on BOTH separators rather than taking a basename: a payload carrying a Windows
@@ -615,10 +657,14 @@ function ruleDecide(args, payload) {
615
657
  + 'check: fix the code, not the check, unless the user asks for this edit.');
616
658
  }
617
659
  const target = ruleGateTarget(p, args.root);
618
- if (!target) return 0;
660
+ if (!target) {
661
+ // The ownership first-write gate (./ownership-gate.mjs), last: every rule above outranks it.
662
+ // `--no-ownership-gate`: the install switched it off (D25).
663
+ const why = args.noOwnershipGate ? null : ownershipBlock(p, payload, body, args.root);
664
+ return why ? deny(args, 'rule-gate', 'ownership', why) : 0;
665
+ }
619
666
  return ask(args, 'rule-gate', 'process-1', `Geneseed (Persist Insight) \u2014 writing to `
620
- + `${target}: a standing rule, or a fact to remember? That choice is the user's. Run the `
621
- + 'rule skill first.');
667
+ + `${target}: a standing rule, or a fact to remember? That choice is the user's. ${PERSIST_ASK}`);
622
668
  }
623
669
  export const cmdRuleGate = guardGate(ruleGate, 'rule-gate');
624
670