Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
The brain owner's own credential saves facts shared by default and withdraws facts it shared (GST-2346)
garrytan31d2585eb0cb
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a112377797..0f1b4a8b88 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,20 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [Unreleased]++**The brain owner's own agents now save facts shared by default, the way they already save pages.** A credential bound to the brain owner (`gbrain access owner set`) reads the whole brain, but its `remember` kept every fact private on the owner's member page unless the call passed `share: true`, its `visibility: "world"` was refused, and its `forget` refused a fact it had just shared. Those private facts also stayed out of hot memory, turn context and context packs, which carry shared facts only. Now, speaking for itself, the owner's credential saves a fact with no `visibility` on its subject's page for every reader of the source, keeps it private on its member page when the call passes `visibility: "private"` or the page or `facts.default_visibility` keeps facts private, and withdraws a shared fact it reads. The reply still names the `page` and `visibility` the fact got. The trade-off: an owner agent that follows a planted instruction can now share a fact without passing a flag, so pass `visibility: "private"` for a fact that must stay with the owner. Member credentials, attested QM calls (`x-qm-actor`), audiences, subagent jobs and slug-fenced clients keep what they had. Works the same on a brain with no Git repository and on a managed one.++Reported by @andreineacsu (#9101). First fixed by @Masashi-Ono0611 in #9103.++### Itemized changes++- `src/core/access/member-facts.ts`: `ownerSpeaksForItself` (`CallerAccess.owner`, no attested actor, no audience, not a subagent, no slug fence).+- `src/core/persistence/memory-mutations.ts`: `remember` takes the ordinary route for the owner and moves a default save the page or brain default keeps private to the owner's member page; `forget` takes the ordinary remote path for the owner when that path reads the fact. `src/core/verbs.ts`: no `member_share_required` for the owner.+- `src/core/facts/writeback-config.ts`, `src/core/ops/memory-settings.ts`, `src/mcp/http-transport.ts`, `src/commands/serve-http-mcp.ts`: with writeback on, the owner's credential gets the instructions of a credential bound to no member.+- Docs: access designations, the company-brain tutorial, `TOOL_REFERENCE.md`, `MEMORY_VERBS_v1.md`, the access key-files entry, `skills/brain-ops/SKILL.md`; behaviour-change row `owner_facts_shared_gst2346`.+- Tests: `test/owner-facts-d1-gst2346.test.ts` (every caller shape, repo-less and managed, PGLite and Postgres); `test/member-forget-refusal-9101.test.ts` now expects the owner to withdraw a fact it shared.+## [0.60.678.0] - 2026-11-11**Pushes from an unmanaged checkout now scan every commit they publish for secrets, not only the files they just wrote.** Four gbrain pushes from a checkout that is not a managed worktree carried earlier local commits to the remote unscanned: the access-policy commit, the durability-scaffolding commit, `gbrain sources push` (which scanned only its own staged files, then pushed the whole branch tip, even with nothing new to commit) and the first push of `gbrain bootstrap repo` after the remote branch was gone (which scanned only the current tree). A credential a script committed with plain `git commit`, including one a later commit removed or one in a commit message, went out with them. Each now runs the range scan managed publishes use over what the remote lacks (the whole history when the remote has no such branch) and refuses `publish_secret_found` or `publish_scan_unreadable`, with nothing pushed and the local commits kept. `gbrain sources push` pushes the exact commit it scanned, leased on the remote tip it read, so a remote rewound in between is scanned again. An allowlist edit that `gbrain sources push` or `gbrain bootstrap repo` commits itself, after scanning it, still publishes; one a script committed is left to the user. Remoteless checkouts, managed worktrees and repo-less brains are unchanged, and the policy command's retry hint keeps `--scan-secrets`.diff --git a/docs/architecture/key-files/access.md b/docs/architecture/key-files/access.mdindex a6f502986b..c368f946c4 100644--- a/docs/architecture/key-files/access.md+++ b/docs/architecture/key-files/access.md@@ -3,7 +3,7 @@[Subsystem index](../KEY_FILES.md). Read only the entries relevant to your change.Current behavior and load-bearing invariants; history belongs in Git and CHANGELOG.-- `src/core/access/` (GBRA-218) — per-member read access inside one source. `principals.ts` normalizes frontmatter `readable_by` (bare id = `member:<id>`, `group:<g>`, ASCII case fold, space trim; anything malformed is `['!nobody']`); it is the row twin of the SQL `gbrain_access_readers()` (`test/access-principals.test.ts` holds them equal). A BEFORE trigger keeps `pages.page_readers` equal to that function (direct writes to the column are recomputed), and predicates test the array, never the function, which costs ~0.2 ms per row. A page that names readers with no derived value yet (written before the migration) reads as nobody until `gbrain repair access` (`repair/access.ts`). `members.ts` (members, groups, tombstoned ids never reused, bindings), `token-binding.ts` (the verifiers' join; a credential bound to a disabled, tombstoned or missing member is refused with `access_member_disabled`) and `caller.ts` (`remoteCallerAccess`: the identity dispatch puts on the caller-access record; stdio binds through `serve --stdio-member`, else `mcp.stdio_member`; publication re-resolves from the stored principal). In `search/private-visibility.ts` every page fragment is `accessAllowedSql` AND the privacy part: plain fragments use the empty identity (over-hide, never leak), `*ForCaller` fragments the caller's, and `GBRAIN_REMOTE_PRIVATE_PAGES`, `search.remote_private_pages` and `granted_sources` relax only the privacy part (`privacyForCaller`). A derivative of a page that names readers is hidden from every remote caller (`originAllowedSql`, which calls the SQL function `gbrain_access_origin_restricted()` only for atom, question, concept, event or `derived_from` rows, so each read plans one call instead of four subplans). Both parts lead with column tests (`page_readers IS NULL`, `type`) so row estimates follow column statistics; an expression test such as `->'readable_by' IS NULL` estimates almost no rows and sent restricted vector searches into nested-loop sequential scans. The index walk's page probe (`INDEX_WALK_PAGE_COLUMNS`) projects `page_readers`. Config `access.restrictions_present` (set by a trigger, sticky) keeps every pre-A1 path on a brain with no restriction. `check:remote-privacy-reads` keeps the two relaxations read only in `private-visibility.ts`. Tests: `test/member-read-access.test.ts` (remote matrix, both engines), `test/access-*.test.ts`. Folder rules (A2) keep whole folders of a source to named members. `folder-rules.ts` is the grammar (`.gbrain/access.yml`: `rules:` of `id`, `prefix`, `readable_by`), `classifyRulebook` (each change is narrowing or widening; the target installs only the narrowing part) and `matchingRuleIds`. `policy.ts` owns the one applied rulebook for both stores: `access_rules` (source-qualified ids), the append-only `access_policy_revisions` log, `access_pending_coverage` (prefixes that read as nobody while a narrowing restamps, or while a committed file is invalid) and `sources.config.access_store`, persisted at the first rule and changed only by `policy-migrate.ts` (journaled in `access_policy_migrations`). `proposeRevision` installs narrowing at once under a per-source row lock and holds widening for `applyApproved` (`plan_hash`, `preview_changed`); `restampSource` rewrites `pages.folder_rule_ids` in id windows, then clears pending coverage under the lock; re-proposing the same rulebook finishes an interrupted restamp. A trigger stamps `folder_rule_ids` from the SQL function `gbrain_access_folder_rules()` on insert and on slug or source change, never from git on the serve path. `policy-git.ts` is the git store (files committed through the commit door, applied by `syncAccessPolicyAt` from sync preflight and before and after every managed pass (`performManagedSync`: sync, drain, `sources refresh`, git conversion), read with `git show` at the synced commit (GST-2331: every read under `HARDENED_GIT_ARGS` and `NO_LAZY_FETCH_ENV`, so a partial clone fetches nothing; a policy file the commit names that the clone lacks, or a history the replay cannot read, makes the source read as nobody until the objects are fetched: the problem names the exact `git cat-file -p` or `git log --first-parent -p` that fetches them, and the next sync applies the rules and clears the mark); a database with no revision yet replays each committed `access.yml` since the `access.approved` baseline, so a rebuild holds a removal a plain commit made); `policy-transfer.ts` carries the applied rulebook through `gbrain export` and installs it before any page in `gbrain import`; `policy-notice.ts` is the `access_policy_pending` degraded notice. In `private-visibility.ts`, `folderRulesAllowedSql` sits inside `accessAllowedSql` (`folder_rule_ids IS NULL OR folder_rule_ids <@ <satisfied ids>` plus coverage conjuncts), so no hatch, grant or `--as` relaxes it, and the unrestricted short form tests `folder_rule_ids IS NULL` next to `page_readers IS NULL` (v283 triggers set `access.restrictions_present` on the first rule or pending prefix); `caller.ts`'s `folderAccessFor` fails closed to whole-source coverage. CLI: `src/commands/access-rules.ts`; doctor: `src/commands/doctor/checks/folder-access.ts`. Tests: `test/access-folder-rules.test.ts` (database store, both engines), `test/access-folder-rules-git.test.ts`, `test/access-folder-transfer.test.ts`, `test/access-folder-doctor.test.ts`. Shared agents (B, GBRA-231): `audience.ts` parses the audience a harness asserts (`X-Gbrain-On-Behalf-Of` or request-level `_meta.on_behalf_of`, 1-50 principals, `guest` = the empty identity; the same key inside tool arguments is refused) and appends each assertion to `access-audience-YYYY-Www.jsonl`. Dispatch resolves it on every remote call through `caller.ts` (`resolveAudienceIdentities`: every entry must be in the credential's live `may_act_for`, then name an enabled member or existing group); the caller-access record then carries `audienceIdentities`, and `accessAllowedForAllSql` needs one readers conjunct per identity, folder rules the intersection of each entry's satisfied set (`folderAccessForAll`). Privacy relaxes only for a one-member audience. Writes carry the audience as `WriteAuthority.actingFor` (re-resolved at publication) and agent jobs as `grant.actingFor`. Every remote response carries `_meta.access` (`appliedAccessSummary`), which `whoami` returns as `access.applied`; doctor `access_may_act_for_wildcard` (`checks/shared-agent-access.ts`) warns on `*`. Tests: `test/access-on-behalf-of.test.ts` (both engines), `test/e2e/serve-http-on-behalf-of.test.ts`. Attested actor (C1, GST-359): `actor-model.ts` (dependency-free: `x-qm-actor`, `acting_user`, `EXTERNAL_ID_RE` = 1-256 visible ASCII, `attestRightFrom`: the right counts only for a member-less credential whose token is legacy or `client_credentials`, read from `oauth_tokens.grant_type`) and `actor.ts`. `resolveAttestedActor` runs in dispatch before any work: an invalid id refuses `actor_not_attested` (`invalid_actor_id`) before any lookup, then the right, the op list (`attest_ops`, default `get_write_request,memory_recall,memory_write`), `acting_user` = header (stripped), and `actorCoverage` (the one coverage test: live right plus a live link in `access_member_links` to an enabled member, compared exactly) or `actor_unlinked`. GST-1158: `scope-read.ts` holds `SCOPE_READ_ACCESS` (no identity, actor or audience; privacy never relaxed) and `SCOPE_READ_OPS`; dispatch runs an attested call to one of those ops that names `source_id`/`source_ids` under that record (`attestedReadMode`, which refuses `__all__`/`all_sources`), or as the person when the right's `attest_read` (v298, `--attest-read`) is `person`, and handlers read the mode with `currentReadMode`. `attest_read = 'scope'` refuses a call that names no actor (`actor_required`). Tests: `test/qm-scope-read.test.ts` (both engines), `test/doctor-attest-read-shared-scope.test.ts`. GBRA-284: `member-sources.ts` binds a source to its member (`access_member_sources`, v299; `gbrain access member source add|remove|list`); `attestedReadScope`, called in dispatch for every attested call and in `minions/tools/brain-allowlist.ts` for an attested job's tool calls, replaces the call's read grant with the grant minus personal sources bound to another member (every personal source under a scope read), so every resolver refuses or skips them like out-of-grant sources and nothing is added. Test: `test/qm-personal-sources.test.ts` (both engines). `ACTOR_DEFERRED_OPS` (`capture`, `extract_facts`, take writes, `list_write_conflicts`, and since GST-2249 W1 every page write; `test/qm-attest-write-boundary.test.ts` classifies every attestable mutating operation) are never attestable: refused by `parseAttestOps`, `bindCredential`, every call and the stored re-check, which also re-checks `attest_ops` for a queued write's operation and each job tool call. Under the header serve-http lists only attested tools and refuses `resources/read`. `attestedCallerAccess` is a one-member audience with privacy never relaxed (no granted sources, no hatch), never B's `may_act_for` path. Writes store `WriteAuthority.actingFor = {system, external_id, member}` and jobs `grant.actor`; `storedActorIdentity` re-resolves both through `actorCoverage` and refuses when the member changed. `linkMember` / `unlinkMember` / `listMemberLinks` back `gbrain access member link|unlink|links`; `linkMemberByEmail` (GST-1158) finds the member by its declared email (`members.ts` `memberByEmail`: `access_members.email`, migration v301, case-folded, unique, cleared on removal; `not_found` when none, `email_ambiguous` when several) and then links exactly as `linkMember`, from the local CLI and the owner-session routes in `src/commands/serve-http-access.ts` only; `--attest-actor` / `--attest-ops` on `auth rescope` (`members.ts`) only for a member-less legacy token or confidential client-credentials client. Migration v286. Tests: `test/access-qm-actor.test.ts` (both engines), `test/e2e/serve-http-qm-actor.test.ts`. Member facts (C2, GST-359): `member-facts.ts`. A remote `remember` from an attested actor or a lone-member credential (`callerMember`, never an audience of several) writes to `memory/members/<member>` (`memberFactPage`; `persistence/memory-prepare.ts` creates the page with `readable_by: [member:<id>]`), `visibility: private`, `infer_entity` off, the entity kept as `entity_slug`, unless the call passes `share: true` (GST-2243), which takes the ordinary world route to the subject's page; a member's explicit `visibility: "world"` is refused in `remember`'s validation (`member_share_required`), so a batch with one such item saves nothing. A member id whose page slug `slugifyPath` would change (`a--b`, `zed-`) is refused (`invalid_params`). The page must name that member alone (`memberPageIsOwn`, checked at submission and again in preparation, `memberPageNotOwned`), and remote writes under `memory/members/` go only to the caller's own page (`assertMemberPageWriter`, called from `ops/context.ts` `enforceClientSlugFence`, so every remote page write passes it; trusted local callers are unaffected). Reads widen a world-only fact list only by `memberFactAdmitSql` (a private fact on the caller's own live member page whose readers and folder rules admit the caller; `factVisibilitySql` in `engine-sql/facts.ts` and `search/fact-relevance.ts`), and `privateProvenanceFilterUnderPolicy` judges a member-page fact's source page as the caller (every other fact keeps the empty identity, so a fact from a page that names readers stays hidden from every remote caller). Writers never cross pages: `facts/single-prepare.ts` (`SingleFactIntent.page_slug`) and `trust/supersede-handlers.ts` dedup, supersede and contest only within the member page, and no other write matches a fact there (`onMemberPageSql`); consolidation skips facts whose page names readers (`readersSourcedFactSql`). Per-person keys: `callerIdentityKey` joins the hot-memory cache key (`facts/meta-hook.ts`, `::xid=`), `callerSessionKey` the `delta` cursor (`ops/facts.ts`), `sameAttestedActor` gates receipts (`persistence/authority.ts` `ownRequestAccessible`) and replays (`persistence/journal.ts`) on the stored actor, else the stored audience, and `get_agent_job` and the owner-fenced `get_job`, `wait_job`, `get_job_progress`, `list_jobs` and `cancel_job` match the job's `grant.actor` (system, external id, member) and `grant.actingFor` (the same distinct audience entries; `jobActorSql` in `minions/types.ts`), so a job or receipt with an actor or audience reads as missing to the bare client and to other actors and audiences, and one with neither to every actor and audience. Tests: `test/access-member-facts.test.ts` (both engines), `test/access-member-sweep.test.ts` (every attestable op as Bob, the bare client and an unbound credential; `test/helpers/member-sweep.ts`), `test/e2e/serve-http-member-sweep.test.ts` (two members over a real `serve --http` on a keyless repo-less brain).+- `src/core/access/` (GBRA-218) — per-member read access inside one source. `principals.ts` normalizes frontmatter `readable_by` (bare id = `member:<id>`, `group:<g>`, ASCII case fold, space trim; anything malformed is `['!nobody']`); it is the row twin of the SQL `gbrain_access_readers()` (`test/access-principals.test.ts` holds them equal). A BEFORE trigger keeps `pages.page_readers` equal to that function (direct writes to the column are recomputed), and predicates test the array, never the function, which costs ~0.2 ms per row. A page that names readers with no derived value yet (written before the migration) reads as nobody until `gbrain repair access` (`repair/access.ts`). `members.ts` (members, groups, tombstoned ids never reused, bindings), `token-binding.ts` (the verifiers' join; a credential bound to a disabled, tombstoned or missing member is refused with `access_member_disabled`) and `caller.ts` (`remoteCallerAccess`: the identity dispatch puts on the caller-access record; stdio binds through `serve --stdio-member`, else `mcp.stdio_member`; publication re-resolves from the stored principal). In `search/private-visibility.ts` every page fragment is `accessAllowedSql` AND the privacy part: plain fragments use the empty identity (over-hide, never leak), `*ForCaller` fragments the caller's, and `GBRAIN_REMOTE_PRIVATE_PAGES`, `search.remote_private_pages` and `granted_sources` relax only the privacy part (`privacyForCaller`). A derivative of a page that names readers is hidden from every remote caller (`originAllowedSql`, which calls the SQL function `gbrain_access_origin_restricted()` only for atom, question, concept, event or `derived_from` rows, so each read plans one call instead of four subplans). Both parts lead with column tests (`page_readers IS NULL`, `type`) so row estimates follow column statistics; an expression test such as `->'readable_by' IS NULL` estimates almost no rows and sent restricted vector searches into nested-loop sequential scans. The index walk's page probe (`INDEX_WALK_PAGE_COLUMNS`) projects `page_readers`. Config `access.restrictions_present` (set by a trigger, sticky) keeps every pre-A1 path on a brain with no restriction. `check:remote-privacy-reads` keeps the two relaxations read only in `private-visibility.ts`. Tests: `test/member-read-access.test.ts` (remote matrix, both engines), `test/access-*.test.ts`. Folder rules (A2) keep whole folders of a source to named members. `folder-rules.ts` is the grammar (`.gbrain/access.yml`: `rules:` of `id`, `prefix`, `readable_by`), `classifyRulebook` (each change is narrowing or widening; the target installs only the narrowing part) and `matchingRuleIds`. `policy.ts` owns the one applied rulebook for both stores: `access_rules` (source-qualified ids), the append-only `access_policy_revisions` log, `access_pending_coverage` (prefixes that read as nobody while a narrowing restamps, or while a committed file is invalid) and `sources.config.access_store`, persisted at the first rule and changed only by `policy-migrate.ts` (journaled in `access_policy_migrations`). `proposeRevision` installs narrowing at once under a per-source row lock and holds widening for `applyApproved` (`plan_hash`, `preview_changed`); `restampSource` rewrites `pages.folder_rule_ids` in id windows, then clears pending coverage under the lock; re-proposing the same rulebook finishes an interrupted restamp. A trigger stamps `folder_rule_ids` from the SQL function `gbrain_access_folder_rules()` on insert and on slug or source change, never from git on the serve path. `policy-git.ts` is the git store (files committed through the commit door, applied by `syncAccessPolicyAt` from sync preflight and before and after every managed pass (`performManagedSync`: sync, drain, `sources refresh`, git conversion), read with `git show` at the synced commit (GST-2331: every read under `HARDENED_GIT_ARGS` and `NO_LAZY_FETCH_ENV`, so a partial clone fetches nothing; a policy file the commit names that the clone lacks, or a history the replay cannot read, makes the source read as nobody until the objects are fetched: the problem names the exact `git cat-file -p` or `git log --first-parent -p` that fetches them, and the next sync applies the rules and clears the mark); a database with no revision yet replays each committed `access.yml` since the `access.approved` baseline, so a rebuild holds a removal a plain commit made); `policy-transfer.ts` carries the applied rulebook through `gbrain export` and installs it before any page in `gbrain import`; `policy-notice.ts` is the `access_policy_pending` degraded notice. In `private-visibility.ts`, `folderRulesAllowedSql` sits inside `accessAllowedSql` (`folder_rule_ids IS NULL OR folder_rule_ids <@ <satisfied ids>` plus coverage conjuncts), so no hatch, grant or `--as` relaxes it, and the unrestricted short form tests `folder_rule_ids IS NULL` next to `page_readers IS NULL` (v283 triggers set `access.restrictions_present` on the first rule or pending prefix); `caller.ts`'s `folderAccessFor` fails closed to whole-source coverage. CLI: `src/commands/access-rules.ts`; doctor: `src/commands/doctor/checks/folder-access.ts`. Tests: `test/access-folder-rules.test.ts` (database store, both engines), `test/access-folder-rules-git.test.ts`, `test/access-folder-transfer.test.ts`, `test/access-folder-doctor.test.ts`. Shared agents (B, GBRA-231): `audience.ts` parses the audience a harness asserts (`X-Gbrain-On-Behalf-Of` or request-level `_meta.on_behalf_of`, 1-50 principals, `guest` = the empty identity; the same key inside tool arguments is refused) and appends each assertion to `access-audience-YYYY-Www.jsonl`. Dispatch resolves it on every remote call through `caller.ts` (`resolveAudienceIdentities`: every entry must be in the credential's live `may_act_for`, then name an enabled member or existing group); the caller-access record then carries `audienceIdentities`, and `accessAllowedForAllSql` needs one readers conjunct per identity, folder rules the intersection of each entry's satisfied set (`folderAccessForAll`). Privacy relaxes only for a one-member audience. Writes carry the audience as `WriteAuthority.actingFor` (re-resolved at publication) and agent jobs as `grant.actingFor`. Every remote response carries `_meta.access` (`appliedAccessSummary`), which `whoami` returns as `access.applied`; doctor `access_may_act_for_wildcard` (`checks/shared-agent-access.ts`) warns on `*`. Tests: `test/access-on-behalf-of.test.ts` (both engines), `test/e2e/serve-http-on-behalf-of.test.ts`. Attested actor (C1, GST-359): `actor-model.ts` (dependency-free: `x-qm-actor`, `acting_user`, `EXTERNAL_ID_RE` = 1-256 visible ASCII, `attestRightFrom`: the right counts only for a member-less credential whose token is legacy or `client_credentials`, read from `oauth_tokens.grant_type`) and `actor.ts`. `resolveAttestedActor` runs in dispatch before any work: an invalid id refuses `actor_not_attested` (`invalid_actor_id`) before any lookup, then the right, the op list (`attest_ops`, default `get_write_request,memory_recall,memory_write`), `acting_user` = header (stripped), and `actorCoverage` (the one coverage test: live right plus a live link in `access_member_links` to an enabled member, compared exactly) or `actor_unlinked`. GST-1158: `scope-read.ts` holds `SCOPE_READ_ACCESS` (no identity, actor or audience; privacy never relaxed) and `SCOPE_READ_OPS`; dispatch runs an attested call to one of those ops that names `source_id`/`source_ids` under that record (`attestedReadMode`, which refuses `__all__`/`all_sources`), or as the person when the right's `attest_read` (v298, `--attest-read`) is `person`, and handlers read the mode with `currentReadMode`. `attest_read = 'scope'` refuses a call that names no actor (`actor_required`). Tests: `test/qm-scope-read.test.ts` (both engines), `test/doctor-attest-read-shared-scope.test.ts`. GBRA-284: `member-sources.ts` binds a source to its member (`access_member_sources`, v299; `gbrain access member source add|remove|list`); `attestedReadScope`, called in dispatch for every attested call and in `minions/tools/brain-allowlist.ts` for an attested job's tool calls, replaces the call's read grant with the grant minus personal sources bound to another member (every personal source under a scope read), so every resolver refuses or skips them like out-of-grant sources and nothing is added. Test: `test/qm-personal-sources.test.ts` (both engines). `ACTOR_DEFERRED_OPS` (`capture`, `extract_facts`, take writes, `list_write_conflicts`, and since GST-2249 W1 every page write; `test/qm-attest-write-boundary.test.ts` classifies every attestable mutating operation) are never attestable: refused by `parseAttestOps`, `bindCredential`, every call and the stored re-check, which also re-checks `attest_ops` for a queued write's operation and each job tool call. Under the header serve-http lists only attested tools and refuses `resources/read`. `attestedCallerAccess` is a one-member audience with privacy never relaxed (no granted sources, no hatch), never B's `may_act_for` path. Writes store `WriteAuthority.actingFor = {system, external_id, member}` and jobs `grant.actor`; `storedActorIdentity` re-resolves both through `actorCoverage` and refuses when the member changed. `linkMember` / `unlinkMember` / `listMemberLinks` back `gbrain access member link|unlink|links`; `linkMemberByEmail` (GST-1158) finds the member by its declared email (`members.ts` `memberByEmail`: `access_members.email`, migration v301, case-folded, unique, cleared on removal; `not_found` when none, `email_ambiguous` when several) and then links exactly as `linkMember`, from the local CLI and the owner-session routes in `src/commands/serve-http-access.ts` only; `--attest-actor` / `--attest-ops` on `auth rescope` (`members.ts`) only for a member-less legacy token or confidential client-credentials client. Migration v286. Tests: `test/access-qm-actor.test.ts` (both engines), `test/e2e/serve-http-qm-actor.test.ts`. Member facts (C2, GST-359): `member-facts.ts`. A remote `remember` from an attested actor or a lone-member credential (`callerMember`, never an audience of several) writes to `memory/members/<member>` (`memberFactPage`; `persistence/memory-prepare.ts` creates the page with `readable_by: [member:<id>]`), `visibility: private`, `infer_entity` off, the entity kept as `entity_slug`, unless the call passes `share: true` (GST-2243), which takes the ordinary world route to the subject's page; a member's explicit `visibility: "world"` is refused in `remember`'s validation (`member_share_required`), so a batch with one such item saves nothing. GST-2346 D1: the owner speaking for itself (`ownerSpeaksForItself`: `CallerAccess.owner`, no actor or audience, no subagent, no slug fence) takes the world route unless it passes `visibility: "private"` or the page or `facts.default_visibility` makes the default private (then its member page), is never refused `member_share_required`, and its `forget` of a fact off its member page takes the ordinary remote path when that path reads the fact. A member id whose page slug `slugifyPath` would change (`a--b`, `zed-`) is refused (`invalid_params`). The page must name that member alone (`memberPageIsOwn`, checked at submission and again in preparation, `memberPageNotOwned`), and remote writes under `memory/members/` go only to the caller's own page (`assertMemberPageWriter`, called from `ops/context.ts` `enforceClientSlugFence`, so every remote page write passes it; trusted local callers are unaffected). Reads widen a world-only fact list only by `memberFactAdmitSql` (a private fact on the caller's own live member page whose readers and folder rules admit the caller; `factVisibilitySql` in `engine-sql/facts.ts` and `search/fact-relevance.ts`), and `privateProvenanceFilterUnderPolicy` judges a member-page fact's source page as the caller (every other fact keeps the empty identity, so a fact from a page that names readers stays hidden from every remote caller). Writers never cross pages: `facts/single-prepare.ts` (`SingleFactIntent.page_slug`) and `trust/supersede-handlers.ts` dedup, supersede and contest only within the member page, and no other write matches a fact there (`onMemberPageSql`); consolidation skips facts whose page names readers (`readersSourcedFactSql`). Per-person keys: `callerIdentityKey` joins the hot-memory cache key (`facts/meta-hook.ts`, `::xid=`), `callerSessionKey` the `delta` cursor (`ops/facts.ts`), `sameAttestedActor` gates receipts (`persistence/authority.ts` `ownRequestAccessible`) and replays (`persistence/journal.ts`) on the stored actor, else the stored audience, and `get_agent_job` and the owner-fenced `get_job`, `wait_job`, `get_job_progress`, `list_jobs` and `cancel_job` match the job's `grant.actor` (system, external id, member) and `grant.actingFor` (the same distinct audience entries; `jobActorSql` in `minions/types.ts`), so a job or receipt with an actor or audience reads as missing to the bare client and to other actors and audiences, and one with neither to every actor and audience. Tests: `test/access-member-facts.test.ts` (both engines), `test/access-member-sweep.test.ts` (every attestable op as Bob, the bare client and an unbound credential; `test/helpers/member-sweep.ts`), `test/e2e/serve-http-member-sweep.test.ts` (two members over a real `serve --http` on a keyless repo-less brain).- `src/core/access/federation-exposure.ts` (#8982) — `remotePagesFederationExposes(engine, source)`: the live pages of a source that name no readers and no folder rule, that the read paths' privacy rules (`privacyPartSql`) do not hide from a no-grant connection (#9068; skipped when `remotePrivacyRelaxed` says an operator opted out), and whose live revision (`pages.revision_principal_*`) or any version (`page_versions.write_principal_*`) a token or OAuth client wrote (revoked or deleted included; no record keeps a credential's member at write time, so an unbound, rebound or deleted one counts and each example names its member now; a tag change moves the revision attribution without a version, hiding the earlier author): count, the first five slugs, and shell-quoted `who-can-read` / `access rule add` commands. `remotePagesFederationExposesOrWarn` runs it, after the change commits, only for a change that added the source to the no-grant floor (federate reads the prior state under the source row lock), and turns a failed read into a stderr warning, so the caller's federation never changes. Read by `sources federate`, the unmanaged `sources restore` (stderr; `--json` as `pages_exposed`) and the managed `source_lifecycle` restore result. Pinned by `test/sources-federate-member-pages.test.ts` and `test/federation-exposure-private-9068.test.ts`.- `src/core/access/serves.ts` + `src/commands/access-serves.ts` (GST-363 PR 1) — whether a brain serves several people (`brainServes`: config `access.serves` `one`|`several` wins, else 2+ enabled members) and `gbrain access serves [several --members a,b [--yes]]`: preview, then config, members (kept when present), one folder rule `people/<member>/` per member through `addFolderRules` (`access-rules.ts`, the `rule add` preview-then-write path; a git store commits `.gbrain/access.yml` through the commit door), and one read-write token `member-<id>` per member through `auth-mint.ts` (the `auth create` mint) written to `<configDir>/member-keys/<id>.key` (0600, dir 0700, refused inside a git work tree: `access_serves_key_dir_in_git`). Idempotent on the member id; a token whose file is gone is reported, never re-minted. `GBRAIN_SETUP_ABORT_AFTER=serves-members|serves-rules|serves-key` is the crash seam. Doctor: `checks/unlabeled-people-folders.ts` fails a `people/<x>/` folder with pages no rule covers on a several-person brain. Tests: `test/setup-serves-several.test.ts` (both engines).- `gbrain serve --stdio-member <id>` (GST-363 PR 3) — `parseStdioMemberFlag`, `registeredStdioMember` and `withStdioMember` live in `src/core/stdio-member-flag.ts` (kept out of `mcp-registration.ts` so serve and doctor pick up no registration flags); serve passes the value to `startMcpServer`, dispatch sets `OperationContext.stdioMember` only for an unauthenticated stdio call, and `caller.ts` resolves it live ahead of config `mcp.stdio_member` (a disabled or unknown member reads as nobody, no fallback). Stored writes stamp it on `WriteAuthority.stdioMember` (jsonb, no migration); a stdio watch uses principal id `registration` so the wake drain re-checks that member. Setup writes it into one claude-code or codex entry (`ClaudeSetupPlan`/`CodexSetupPlan.stdioMember`); inspection reports an owned entry's member so setup re-runs and `refreshHookLaunchers` carry it, and `setupRerunArgv` never names it.diff --git a/docs/guides/access-designations.md b/docs/guides/access-designations.mdindex 51fbf8f8e1..023d6a4983 100644--- a/docs/guides/access-designations.md+++ b/docs/guides/access-designations.md@@ -121,10 +121,14 @@ except the owner's, whose new pages stay shared (`POST /ingest` still refuses bo### Fact visibility (`private` | `world`)Each fact row has its own visibility. `remember` defaults to `world`, except into a private page or under an-explicit private `facts.default_visibility`. A remote credential bound to a member, the owner's included, saves-`private` on its own member page (`memory/members/<member>`) unless the call passes `share: true`, and its-`visibility: "world"` is refused; it withdraws only facts on that page, and the brain host withdraws the rest-(`gbrain forget <id>`). Extracted facts follow `facts.default_visibility` (private when unset)+explicit private `facts.default_visibility`. A remote credential bound to a member saves `private` on its own member+page (`memory/members/<member>`) unless the call passes `share: true`, and its `visibility: "world"` is refused; it+withdraws only facts on that page, and the brain host withdraws the rest (`gbrain forget <id>`). The owner's own+credential, speaking for itself (no audience, not a subagent job, no slug fence), saves like a credential bound to no+member: shared on the subject's page, or `private` on its member page when it passes `visibility: "private"` or the+page or `facts.default_visibility` keeps facts private (the reply names the `page` and `visibility`), and its `forget`+withdraws a shared fact it reads. The trade-off: an owner agent that follows a planted instruction can share a fact+without passing any flag, so pass `visibility: "private"` for a fact that must stay with the owner. Extracted facts follow `facts.default_visibility` (private when unset)and are never wider than their page. Remote fact reads return private facts to the owner only.### The owner (`gbrain access owner`)diff --git a/docs/mcp/TOOL_REFERENCE.md b/docs/mcp/TOOL_REFERENCE.mdindex 52aad48ad1..c5e1d9bff7 100644--- a/docs/mcp/TOOL_REFERENCE.md+++ b/docs/mcp/TOOL_REFERENCE.md@@ -372,7 +372,7 @@ MEMORY VERB (v1): retrieve saved facts/snippets — the protocol read verb. Filt## `remember`-MEMORY VERB (v1): save one fact to durable agent memory — the protocol write verb. provenance is REQUIRED (free text, e.g. "conversation 2026-06-12", "user said in chat", "import: notes.md"). Set `entity` whenever the fact is about a specific person/company/project — entity-scoped recall will not find it otherwise. ttl accepts duration shorthand ("30d", "12h") or an absolute ISO 8601 timestamp; ISO-8601 durations like "P30D" are rejected with a fix. visibility defaults to "world" (readable by every agent connected to this brain; pass "private" for local-CLI-only facts). A credential bound to a member, the brain owner's included, saves on its own member page as "private" by default; pass share: true to share a fact with everyone who reads the source. Response: branch on `status` (inserted|duplicate|superseded), never on `status_text` (human rendering only). On duplicate, `id` is the EXISTING fact's id. For bulk extraction from a raw transcript use extract_facts instead.+MEMORY VERB (v1): save one fact to durable agent memory — the protocol write verb. provenance is REQUIRED (free text, e.g. "conversation 2026-06-12", "user said in chat", "import: notes.md"). Set `entity` whenever the fact is about a specific person/company/project — entity-scoped recall will not find it otherwise. ttl accepts duration shorthand ("30d", "12h") or an absolute ISO 8601 timestamp; ISO-8601 durations like "P30D" are rejected with a fix. visibility defaults to "world" (readable by every agent connected to this brain; pass "private" for local-CLI-only facts). A credential bound to a member saves on its own member page as "private" by default; pass share: true to share a fact with everyone who reads the source. The brain owner's own credential saves shared on the subject's page unless it passes visibility "private" or the page or the brain's default keeps facts private (then on its member page); the reply names the page and visibility. Response: branch on `status` (inserted|duplicate|superseded), never on `status_text` (human rendering only). On duplicate, `id` is the EXISTING fact's id. For bulk extraction from a raw transcript use extract_facts instead.| Parameter | Type | Guidance || --- | --- | --- |diff --git a/docs/protocol/MEMORY_VERBS_v1.md b/docs/protocol/MEMORY_VERBS_v1.mdindex fbd6a5adfd..363abd659a 100644--- a/docs/protocol/MEMORY_VERBS_v1.md+++ b/docs/protocol/MEMORY_VERBS_v1.md@@ -302,7 +302,12 @@ Save ONE fact with mandatory attribution.consent line. An omitted `visibility` saves `private` when the target page isprivate (by `visibility` or a privacy alias such as `access: private`) or theoperator set `facts.default_visibility` to private; a save never lands wider- than the page it is written into.+ than the page it is written into. In gbrain, a remote credential bound to+ one member saves `private` on its own member page unless it passes+ `share: true`, and its `visibility: "world"` is refused; the brain owner's+ own credential saves as above (shared by default, `private` on its member+ page when it asks or the page or default keeps facts private). The response+ names the `page` and `visibility` the fact got.Response: `{ id, status, status_text, entity_slug, valid_until,protocol_version }` (+ `degraded_dedup: true` when no embedding provider —@@ -742,6 +747,9 @@ forgetting the unlinked fact is refused with `invalid_params`, message prefixsays to keep them, or to forget them first to withdraw the claim everywhere.A forget never withdraws an active fact the caller cannot read; when onewould be reached, the refusal keeps the `claim_linked:` prefix and names no fact.+In gbrain, a credential bound to one member withdraws only facts on its own+member page (another fact it reads is refused naming the brain host); the+brain owner's own credential also withdraws a shared fact it reads.#### forget publishes like a page write (additive note)diff --git a/docs/tutorials/company-brain.md b/docs/tutorials/company-brain.mdindex 0fd6b0e2f0..04f599773a 100644--- a/docs/tutorials/company-brain.md+++ b/docs/tutorials/company-brain.md@@ -171,7 +171,7 @@ gbrain auth rescope --client <client_id> --attest-actor qm # default ops: ggbrain access member link alice-example --qm U0ALICE # --dry-run previews; unlink and links manage them```-Each request then carries `x-qm-actor: U0ALICE`, and each attested operation runs as `alice-example` (page reads, and the person's own memory writes), never reading `visibility: private` pages, whatever the client's own grant says. A fact the person saves (`remember`) goes on their own page `memory/members/<member>`, which names them as its only reader, so another member, the client's bare calls and an unbound credential never recall it, and no one but that member writes under `memory/members/<member>` remotely. A credential bound to a member may save with `share: true` to put the fact on its subject's page for everyone who reads the source, and its `visibility: "world"` is refused (`member_share_required`); an attested call (`x-qm-actor`) never shares (`attested_share_refused`). Every `remember` reply names the `page` and `visibility` the fact got; `delta` cursors, write receipts and agent jobs (`submit_agent`, `get_agent_job`) are kept to the person the same way, and `forget` or `forget_fact` withdraws only a fact on the person's own page. QM itself calls `memory_recall` and `memory_write` ([QM guide](../guides/qm.md)). Not attestable yet, because what they read or write is not yet kept to the person: `list_write_conflicts`, `capture`, `extract_facts` and `takes_add|update|resolve|supersede`; every page write (`add_timeline_entry`, `add_link`, `put_page`, `edit_page`, tags, deletes, uploads and the rest) waits for owner-approved proposals. Under the header, `tools/list` lists only the attested operations and `resources/read` is refused. An `acting_user` argument must equal the header and is stripped. A client without the right, an operation outside `--attest-ops`, or an id that is not 1-256 visible ASCII characters refuses `actor_not_attested`; an id with no link to an enabled member refuses `actor_unlinked`. Ids compare exactly, unlink and disable take effect on the next call, and queued writes and jobs re-check the link before they commit or call a tool. Links and the right are database state, so this works the same on a repo-less brain.+Each request then carries `x-qm-actor: U0ALICE`, and each attested operation runs as `alice-example` (page reads, and the person's own memory writes), never reading `visibility: private` pages, whatever the client's own grant says. A fact the person saves (`remember`) goes on their own page `memory/members/<member>`, which names them as its only reader, so another member, the client's bare calls and an unbound credential never recall it, and no one but that member writes under `memory/members/<member>` remotely. A credential bound to a member may save with `share: true` to put the fact on its subject's page for everyone who reads the source, and its `visibility: "world"` is refused (`member_share_required`); the brain owner's own credential saves shared by default instead, unless it passes `visibility: "private"` or the page or `facts.default_visibility` keeps facts private; an attested call (`x-qm-actor`) never shares (`attested_share_refused`). Every `remember` reply names the `page` and `visibility` the fact got; `delta` cursors, write receipts and agent jobs (`submit_agent`, `get_agent_job`) are kept to the person the same way, and `forget` or `forget_fact` withdraws only a fact on the person's own page. QM itself calls `memory_recall` and `memory_write` ([QM guide](../guides/qm.md)). Not attestable yet, because what they read or write is not yet kept to the person: `list_write_conflicts`, `capture`, `extract_facts` and `takes_add|update|resolve|supersede`; every page write (`add_timeline_entry`, `add_link`, `put_page`, `edit_page`, tags, deletes, uploads and the rest) waits for owner-approved proposals. Under the header, `tools/list` lists only the attested operations and `resources/read` is refused. An `acting_user` argument must equal the header and is stripped. A client without the right, an operation outside `--attest-ops`, or an id that is not 1-256 visible ASCII characters refuses `actor_not_attested`; an id with no link to an enabled member refuses `actor_unlinked`. Ids compare exactly, unlink and disable take effect on the next call, and queued writes and jobs re-check the link before they commit or call a tool. Links and the right are database state, so this works the same on a repo-less brain.For most company-brain installs (10+ teammates each with their own AI client), Model A is the right starting point. If you're running the fat-agent-serves-everyone pattern from the personal-brain tutorial, Model B is genuinely simpler. You can also mix: separate sources for the obviously-different ones (customer notes vs internal-only) AND a `partners/<slug>/` convention inside the shared source for per-person workspace.diff --git a/llms-full.txt b/llms-full.txtindex 42077105d5..3571cd251e 100644--- a/llms-full.txt+++ b/llms-full.txt@@ -7855,7 +7855,12 @@ Save ONE fact with mandatory attribution.consent line. An omitted `visibility` saves `private` when the target page isprivate (by `visibility` or a privacy alias such as `access: private`) or theoperator set `facts.default_visibility` to private; a save never lands wider- than the page it is written into.+ than the page it is written into. In gbrain, a remote credential bound to+ one member saves `private` on its own member page unless it passes+ `share: true`, and its `visibility: "world"` is refused; the brain owner's+ own credential saves as above (shared by default, `private` on its member+ page when it asks or the page or default keeps facts private). The response+ names the `page` and `visibility` the fact got.Response: `{ id, status, status_text, entity_slug, valid_until,protocol_version }` (+ `degraded_dedup: true` when no embedding provider —@@ -8295,6 +8300,9 @@ forgetting the unlinked fact is refused with `invalid_params`, message prefixsays to keep them, or to forget them first to withdraw the claim everywhere.A forget never withdraws an active fact the caller cannot read; when onewould be reached, the refusal keeps the `claim_linked:` prefix and names no fact.+In gbrain, a credential bound to one member withdraws only facts on its own+member page (another fact it reads is refused naming the brain host); the+brain owner's own credential also withdraws a shared fact it reads.#### forget publishes like a page write (additive note)diff --git a/plugin-variants/gbrain-coding/skills/brain-ops/SKILL.md b/plugin-variants/gbrain-coding/skills/brain-ops/SKILL.mdindex 3cac9117c2..f8e6283a33 100644--- a/plugin-variants/gbrain-coding/skills/brain-ops/SKILL.md+++ b/plugin-variants/gbrain-coding/skills/brain-ops/SKILL.md@@ -97,7 +97,8 @@ suppresses writes for that turn, including when standing capture is enabled.> `idea` kind the extractor and DB carry is NOT one of them) and the> visibility the envelope's `agent_action` names> (default private — pin it; `remember` defaults to world, or to your own-> member page when your credential is bound to a member), or author a+> member page when your credential is bound to a member other than the+> brain owner), or author a> `## Facts` fence on the entity page. A `skipped: extraction_failed` envelope> (server-side extractor errored on this turn; `reason` names why) invites the> same manual `remember` fallback for that turn — automatic extraction staysdiff --git a/plugin/skills/brain-ops/SKILL.md b/plugin/skills/brain-ops/SKILL.mdindex 3cac9117c2..f8e6283a33 100644--- a/plugin/skills/brain-ops/SKILL.md+++ b/plugin/skills/brain-ops/SKILL.md@@ -97,7 +97,8 @@ suppresses writes for that turn, including when standing capture is enabled.> `idea` kind the extractor and DB carry is NOT one of them) and the> visibility the envelope's `agent_action` names> (default private — pin it; `remember` defaults to world, or to your own-> member page when your credential is bound to a member), or author a+> member page when your credential is bound to a member other than the+> brain owner), or author a> `## Facts` fence on the entity page. A `skipped: extraction_failed` envelope> (server-side extractor errored on this turn; `reason` names why) invites the> same manual `remember` fallback for that turn — automatic extraction staysdiff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex 728118c9e0..d8d0193411 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -48,5 +48,5 @@ src/commands/doctor/checks/extraction-sync.ts 1500 ratchet +7 GBRA-130 A-1: linksrc/core/search/evidence-delivery.ts 1759 ratchet +5 W5: EvidencePlan.rankCut resolved with the plan (logic in search/page-rank-cut.ts); +20 W5 whole_pages: wholeCost prices a block as delivery would emit it whole (needs the private Block/enrichBlock internals) and the cut is wired before allocate (cutWholePages lives in search/page-rank-cut.ts); new row: crossed the 1500 unlisted cap at the #6367 merge (master 1479, its explicit-budget cap) by the C1 date header threaded through every block path, cap included; pagePlanHits (search/page-plan-hits.ts) and the header loader (evidence-date.ts blockDateHeaders) were peeled first; peel candidate: allocateCapped; +8 at the #6396 merge: page evidence text cut through the fence-chunk trust overlay and the caller minTrust floor (re-summed: our 1504 + master +8); +119 Cat 40 next wave F2: the search.long_page_unit policy (withLongPagePolicy, selectLongPages size preflight with page/byte/deadline limits) and the long-page fetch and fallback in deliverEvidence, kept in the shared seam the plan names (gbrain-evals docs/plans/2026-10-11-cat40-next-wave, F2); +17 F2 rework to the frozen-comparison policy: search.long_page_min_chars (rendered-body characters, default 20,000) read in withLongPagePolicy, a character count in the preflight, the rendered-body confirmation in deliverEvidence, and the long-page row exemption in capDeliveredSnippets (re-summed at the 0.60.225.0 merge: master 1537 + F2 136); +39 Wave B PR 2 lane 2b: planSegmentedBlock joins the windows search/segmented-evidence.ts reads around a segmented page's hits into one run-marked document (needs the private Doc/Piece/buildDoc/locateAnchor internals), planBlock's unit cut split into blockFromDoc for both, sections bounded by their run, selectionCost counts a gap between runs, and the fetch skips the whole-body fence overlay for a segmented page; +4 segmented pages read at once before planning (segmentedReads; the read is search/segmented-evidence.ts, the statements page-body/read-range.ts); +17 GBRA-156: tail trim plan flag, DeliverOptions.query, DeliveryMeta.tail_trim, the trim call and the frozen-hit score/query library fields (logic in search/evidence-tail-trim.ts; interface fields cannot move); +7 GBRA-205: EvidencePlan.titleHeader and DeliveryMeta.title_header (interface fields cannot move) and the titles option on the header loader (logic in search/evidence-date.ts; the query budget key lives in search/evidence-packing.ts); +11 #7600: assemble_evidence quotes conversation rows and capEvidenceToBudget counts the quote fence (logic in search/transcript-quote.ts); +2 GBRA-156 /ship review: the cut-path admission and title room count the quote fence; +2 GBRA-156 /ship review pass 2: capEvidenceToBudget counts the fence only for the paths that fence (quote flag; recall counts the text as returned); +4 GST-687: page evidence and the extractive fallback quote below-owner-tier text for untrusted readers (untrusted flag; logic in search/transcript-quote.ts)src/commands/config.ts 1530 ratchet +1 GBRA-216: recall.* config set value refusal (facts/recall-config.ts); +1 GBRA-216: config set refuses a dream.claim_conflicts.mode other than propose|off (refusal in facts/claim-conflicts.ts); new row: crossed the 1500 unlisted cap in wave 15 P7.4 #5461: set-time validation of think.pages_budget_chars / think.excerpt_ceiling_chars (range + parser live in core/think/pages-budget.ts), mirroring the cycle.consolidate.cluster_threshold hook; +1 wave 16 G5.1 (#6495): set-time refusal hook for search.keyword_statement_timeout_ms (check lives in commands/config/keyword-timeout-value.ts); +1 wave 18b lane 5 (#5012 item 6): search.contextual_retrieval prints the existing-pages hint after the write (text lives in commands/config/contextual-mode-hint.ts); +1 #6712 PR 2: retired/rollback sync key dispatch line (logic in core/sync-config-keys.ts handleSyncKeyConfig); +1 #6865: sync.slug_conflicts.auto_remove boolean validation at set time (refusal text in repair/slug-autoheal.ts); +1 #6948: sync.origin_twins.auto_resolve boolean validation at set time (refusal text in repair/origin-twins-heal.ts); +2 #6795: config set chat_model/expansion_model help line and the model-pin import (shadow report and file-pin unset live in commands/config/model-pin-shadow.ts); +1 #6712 PR 4b: sync.admission set-time hook (value logic in commands/config/sync-admission-value.ts); +4 #7130: set-time refusal hook for sync.max_deletes / sync.max_delete_ratio (and .source.<id>) / purge.retention_hours (check lives in core/sync-reconcile.ts deleteSafetyConfigRefusal); +1 GBRA-150: sync.metafile_pages set-time route (body in config/sync-metafile-pages-value.ts); re-summed at the v0.60.330.0 merge (1520 measured); +2 #7242 minions.terminal_hook file-plane key and its set branch (logic in minions/terminal-hook.ts); +1 GBRA-161: generations.* set-time route (refusal in commands/config/generations-values.ts); +1 GBRA-207 #7630: sync.repo_path set-time refusal hook (refusal in core/sync-config-keys.ts syncRepoPathRefusal); +4 GBRA-377 PR B: skills.resolver.* file-plane routing (doc line, the one-line router and its two dispatch lines; logic in core/setup/skill-resolver-config.ts)src/commands/mcp-expose.ts 1519 ratchet hosted_option: Session carries the gbrain.io coaching notice on the first-receipt run and Tailscale/service friction exits (copy, refs and gating live in core/onboard/hosted-option.ts); +7 GBRA-199: --surface help lines, surfaceChosen option field and the advertise pass-through (registrationAdvertise in core/mcp-registration.ts)-src/core/behavior-change-notice.ts 1734 ratchet +4 train R: #7491/#7492 keyword_identifier_probe and keyword_slug_handles rows and their comment, #7175 keyword phrase row; the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +1 GBRA-156 #7593: private_pages_granted_sources row (re-summed at the 0.60.527.0 merge: 1574 + 1); +3 GBRA-200 comment, write-grant refusal and degraded-stamp rows (re-summed at the 0.60.562.0 merge: 1615 + 3); +2 GBRA-280 get_page selector-precedence row and comment (re-summed at the 0.60.569.0 merge: 1619 + 2); the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +2 #7199 (re-port of #7228) classic_drift_rescreen_7199 comment and row; +2 #7931 file_drift_agrees_7931 comment and row; +1 #7950 file_drift_slug_release_7950 row; +1 #7974 file_drift_followups_7974 row; +1 #8059 quoted_fence_marker_8059 row; +2 GBRA-247 #8009 provenance_repair_held_8009 and #7982 pass_transient_streak_7982 rows; +4 GBRA-247 #7973 plain_directory_sync_7973, #7988 managed_marker_own_directory_7988, #7985 former_binding_parked_group_7985 and settle_effects_retire_7985 rows Train S merge: 1570 base + 5 (master since the #8077 base) + 13 (#8077) = 1588.; +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (re-summed at the gate-ahead on train S 0.60.534.0: 1588 + 2); +2 #8377: the quote fence follow-ups row and its comment; +2 #8384: the quote fence follow-ups 2 row and its comment; +2 #8384 wave 3: the quote fence follow-ups 3 row and its comment; +5 GBRA-218 train M rows (A1 member_read_access_gbra218 and member_access_hatch_scope_gbra218, B shared_agent_audience_gbra231, A2 folder_access_rules_gbra218, folder_access_scoped_role_gbra218), re-summed at the train M merge of master v0.60.541.0: 1596 + 5 = 1601 measured; +3 GST-359 train C rows (C1 qm_attested_actor_gst359, C2 member_facts_gst359, D qm_memory_provider_gst359), re-summed at the train C merge of master v0.60.543.0: 1601 + 3 = 1604 measured; +2 #8424: hook_launcher_8424 row and its comment (rows are data and cannot move), re-summed at the #8418 v0.60.546.0 merge: 1604 + 2 = 1606 measured; +2 #8426: mcp_lane_launcher_8426 row and its comment (rows are data and cannot move); +2 GST-927: empty_nonstring_args_gst927 row and its comment, re-summed at the gate-ahead on master v0.60.550.0 plus #8420: 1610 measured; +2 GBRA-283 Wave A (#8460): engine_keyed_caches_gbra283 row and its comment (rows are data and cannot move); +2 GBRA-287: segmented_freeze_hold_gbra287 and segmented_reexport_gbra287 rows (rows are data and cannot move); +1 GST-1209: segmented_tiling_gst1209 row (rows are data and cannot move); +1 GST-1251: skillopt_loop_deprecated_gst1251 row (rows are data and cannot move); +1 GST-1209 follow-up: untiled_hold_repair_gst1209 row (rows are data and cannot move); +1 GBRA-283 B3a: embedded_scope_required_gbra283 row (rows are data and cannot move); re-summed at the train R merge with v0.60.574.0: 1623 + 4; +2 GST-1387: refresh_fence_refusal_gst1387 row and its comment (rows are data and cannot move); re-summed at the memory train #8481 merge with v0.60.578.0 (1643 measured); +3 GBRA-253 #8109 rows (frontmatter_drift_write_8109, contacts_activity_advance_8109, contact_rows_dedupe_8109; rows are data and cannot move), re-summed at the master v0.60.581.0 merge: 1643 + 3 = 1646 measured; +3 #8123 part C rows: sync_write_through_off_writeback_7084, managed_sync_dry_run_counts_7087, frontmatter_missing_source_dir_7889 (since TBD until the merge slot; re-summed at the 0.60.583.0 merge: 1646 + 3); +4 PR B commit_ledger_prb, doctor_foreign_writers_prb and sources_guard_prb rows and their comment (rows are data and cannot move; since TBD until the merge slot); +1 PR B #8615: file_drift_held_needs_prefer_8615 row; +1 PR B #8617: refresh_source_changed_retry_8617 row; +1 PR B #8662: commit_push_checkout_not_a_source_8662 row (since TBD until the merge slot; rows are data and cannot move); +2 PR B refresh_barrier_prb and commit_push_base_prb rows (re-summed: 1658 measured); +3 convergence PR A: the wave comment and two rows (conversion_content_evidence_pr_a, git_gap_live_pages_pr_a; since TBD until the merge slot; rows are data and cannot move); re-summed at the gate-ahead on master v0.60.592.0 plus #8711: 1658 + 3 = 1661 measured; +4 GST-1094/GST-900 rows (memory_recall scope-read, member-bound acting_user, recall max_chars, unknown_param _meta-only) and +1 qm_scope_writes_gst1113 and +1 recall_question_terms_gst1304 rows (rows are data and cannot move), re-summed at the 0.60.595.0 slot merge: 1661 + 6; +1 GST-1582 refresh_barrier_import_gst1582 row (since TBD until the merge slot; rows are data and cannot move); +2 GST-1601 source_changed_origin_gst1601 and adopt_local_edits_gst1601 rows (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.596.0 merge: 1668 + 2; +1 GST-1623 refresh_barrier_capacity_gst1623 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.599.0 merge: 1670 + 1; +2 GBRA-224 W1 release_channel_stable_default row and its comment; +1 GST-1623 refresh_barrier_later_write_gst1623 row (#8765; rows are data and cannot move); +5 #8766 GST-1623 items 4/6-9 and #8755: the wave comment and four rows (doctor_foreign_writers_partial_gst1623, commit_push_enclosing_repo_gst1623, owner_guard_fail_closed_gst1623, adopt_local_edits_hardening_8755) and +1 managed_sync_kind_reserved_8765 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on master v0.60.608.0 plus #8798: 1674 + 6; +1 GST-1853 refresh_barrier_aborted_refresh_sync_gst1853 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.613.0 merge: 1680 + 1; +1 GST-1674 refresh_refused_merge_recovery_gst1674 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.614.0 merge: 1681 + 1; +1 #8824/#8826/#8767: adopt_local_edits_replay_markers_8824 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8837: 1682 + 1; +1 url_source_origin row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8834: 1683 + 1; +1 #8828: the refresh_replan_own_commits_8828 row (1684 + 1 at the 0.60.618.0 slot); +1 the managed commit-push unpublished-count row; +1 the refresh publish-diverged default row; +1 GST-2051 ungranted_member_writes_gst2051 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-731 think_window_trajectory_gst731 row and +1 GST-1602 purge_cancels_deferred_write_gst1602 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8915 v0.60.621.0: 1688 + 2; +1 GST-2059: owner_reads_private row; +1 #8888: the record-origin checkout lock-down row (re-summed at the Q6 stack on #8934 v0.60.625.0: 1691 + 1); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 GST-1158 E1/F3/F4 rows (since TBD until the merge slot), re-summed at the master merge; +1 GBRA-284 personal_sources_gbra284 row (since TBD until the merge slot) (re-summed at the QM wave merge onto master v0.60.626.0: 1692 + 3); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 GST-1158 v3: the qm_personal_structured_gst1158 row (since TBD until the merge slot); +1 #8477 GST-1158 F2 personal-tools row at the QM wave merge (1695 + 1); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 #8483 memory_propose row at the QM wave merge (1696 + 1); +1 GST-1094 gap 4: the qm_admin_http_gst1094 row (since TBD until the merge slot); +1 GST-1158: the member_email_link_gst1158 row (since TBD until the merge slot); +2 #8479 member-email rows at the QM wave merge (1697 + 2); +1 GST-2112: ingest_keeps_readers_gst2112 row (re-summed at the Q7 v0.60.627.0 merge: 1692 + 1); +1 #8982 federated_member_writes_8982 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-2116 commit_push_skipped_paths_gst2116 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q10 slot on #9009 ee0f4a78: 1694 + 1; +1 GST-2118 pending_ledger_flagged_gst2118 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q12 slot on #9016 afb49de5: 1695 + 1; +1 GBRA-431: read_scope_params_gbra431 row (rows are data and cannot move), re-summed at the #9032 stack merge: 1697 measured; +2 GST-2201 sync_restored_file_gst2201 and purge_keeps_committed_file_gst2201 rows (since is the current VERSION until the merge slot; +1 GST-2243 remember_share_gst2243 row (re-summed at the #9098 stack merge: 1699 + 1); +1 GST-2312 #9024 sync_filter_owned_hold_9024 row (re-summed at the #9064 stack merge: 1700 + 1; rows are data and cannot move); +2 access-privacy wave (0.60.649.0): the owner_private_facts_gst2089 and private_labels_write_ahead_gst2092 rows; +1 GBRA-443 private_labels_batch_exit_gbra443 row (rows are data and cannot move), re-summed at the 0.60.650.0 slot on #9038: 1703 + 1; +1 postgres_tls_default row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.651.0 merge: 1704 + 1; +1 GST-2331 sync_reads_fetch_nothing_gst2331 row (rows are data and cannot move), re-summed at the 0.60.654.0 stack on #9045 6ff5540d: 1705 + 1; +7 QM wave (#9037) rows: attest_scope_read_ops_gst1158, attest_direct_page_writes_deferred_gst1158, personal_sources_gbra284, qm_personal_structured_gst1158, memory_propose_held_writes_gst1158, member_email_link_gst1158, qm_admin_http_gst1094 (re-summed at the 0.60.655.0 stack on #9110 f9b2072e: 1706 + 7); +1 GST-2228 recreated_takes_section_keeps_stored_takes_gst2228 row (since TBD; re-summed at the keep-takes-and-link-dates train merge: 1713 + 1); +1 GST-2228 links_rows_keep_own_dates_gst2228 row (since TBD; re-summed at the same train merge: 1714 + 1); +2 the W1 + memory proposals train (#9133): attest_every_page_write_deferred_gst2249 and memory_proposals_owner_http_gst2407 rows (rows are data and cannot move), re-summed at the #9138 v0.60.661.0 stack merge: 1715 + 2 = 1717 measured; +1 #8903 effect_git_secret_gate_gst1923 row (rows are data and cannot move), re-summed at the 0.60.664.0 stack on #9142 3931adb4: 1717 + 1; +1 GST-2407 PR 3: qm_recall_own_page_contract_v4 row (rows are data and cannot move), re-summed at the 0.60.666.0 stack on #9148 69c12917: 1718 + 1; +2 GST-363 PR 1 and PR 3 (#9135): the serves_several_labels_gst363 and stdio_member_per_harness_gst363 rows; +3 #9134 train rows member_forget_names_host_9101, refresh_fence_retry_id_gst2353 and recorded_read_view_args_gst2214 (rows are data and cannot move), re-summed at the #9134 slot merge onto #8829 dfc24954: 1721 + 3; +3 source-checkouts wave rows (autopilot_git_reconcile_gbra386, unknown_drift_history_rescreen, refresh_abandon_members_gst1465), re-summed at the #9137 stack merge: 1724 + 3; persistence train 13 at 0.60.676.0: its five rows on top of 0.60.675.0; +1 GST-2250 reconcile_publish_opt_out_gst2250 row (since TBD until the merge slot; rows are data and cannot move); +1 #8902 unmanaged_push_history_scan_8902 row (re-summed at the 0.60.678.0 stack on 501742d9: 1733 + 1)+src/core/behavior-change-notice.ts 1735 ratchet +4 train R: #7491/#7492 keyword_identifier_probe and keyword_slug_handles rows and their comment, #7175 keyword phrase row; the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +1 GBRA-156 #7593: private_pages_granted_sources row (re-summed at the 0.60.527.0 merge: 1574 + 1); +3 GBRA-200 comment, write-grant refusal and degraded-stamp rows (re-summed at the 0.60.562.0 merge: 1615 + 3); +2 GBRA-280 get_page selector-precedence row and comment (re-summed at the 0.60.569.0 merge: 1619 + 2); the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +2 #7199 (re-port of #7228) classic_drift_rescreen_7199 comment and row; +2 #7931 file_drift_agrees_7931 comment and row; +1 #7950 file_drift_slug_release_7950 row; +1 #7974 file_drift_followups_7974 row; +1 #8059 quoted_fence_marker_8059 row; +2 GBRA-247 #8009 provenance_repair_held_8009 and #7982 pass_transient_streak_7982 rows; +4 GBRA-247 #7973 plain_directory_sync_7973, #7988 managed_marker_own_directory_7988, #7985 former_binding_parked_group_7985 and settle_effects_retire_7985 rows Train S merge: 1570 base + 5 (master since the #8077 base) + 13 (#8077) = 1588.; +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (re-summed at the gate-ahead on train S 0.60.534.0: 1588 + 2); +2 #8377: the quote fence follow-ups row and its comment; +2 #8384: the quote fence follow-ups 2 row and its comment; +2 #8384 wave 3: the quote fence follow-ups 3 row and its comment; +5 GBRA-218 train M rows (A1 member_read_access_gbra218 and member_access_hatch_scope_gbra218, B shared_agent_audience_gbra231, A2 folder_access_rules_gbra218, folder_access_scoped_role_gbra218), re-summed at the train M merge of master v0.60.541.0: 1596 + 5 = 1601 measured; +3 GST-359 train C rows (C1 qm_attested_actor_gst359, C2 member_facts_gst359, D qm_memory_provider_gst359), re-summed at the train C merge of master v0.60.543.0: 1601 + 3 = 1604 measured; +2 #8424: hook_launcher_8424 row and its comment (rows are data and cannot move), re-summed at the #8418 v0.60.546.0 merge: 1604 + 2 = 1606 measured; +2 #8426: mcp_lane_launcher_8426 row and its comment (rows are data and cannot move); +2 GST-927: empty_nonstring_args_gst927 row and its comment, re-summed at the gate-ahead on master v0.60.550.0 plus #8420: 1610 measured; +2 GBRA-283 Wave A (#8460): engine_keyed_caches_gbra283 row and its comment (rows are data and cannot move); +2 GBRA-287: segmented_freeze_hold_gbra287 and segmented_reexport_gbra287 rows (rows are data and cannot move); +1 GST-1209: segmented_tiling_gst1209 row (rows are data and cannot move); +1 GST-1251: skillopt_loop_deprecated_gst1251 row (rows are data and cannot move); +1 GST-1209 follow-up: untiled_hold_repair_gst1209 row (rows are data and cannot move); +1 GBRA-283 B3a: embedded_scope_required_gbra283 row (rows are data and cannot move); re-summed at the train R merge with v0.60.574.0: 1623 + 4; +2 GST-1387: refresh_fence_refusal_gst1387 row and its comment (rows are data and cannot move); re-summed at the memory train #8481 merge with v0.60.578.0 (1643 measured); +3 GBRA-253 #8109 rows (frontmatter_drift_write_8109, contacts_activity_advance_8109, contact_rows_dedupe_8109; rows are data and cannot move), re-summed at the master v0.60.581.0 merge: 1643 + 3 = 1646 measured; +3 #8123 part C rows: sync_write_through_off_writeback_7084, managed_sync_dry_run_counts_7087, frontmatter_missing_source_dir_7889 (since TBD until the merge slot; re-summed at the 0.60.583.0 merge: 1646 + 3); +4 PR B commit_ledger_prb, doctor_foreign_writers_prb and sources_guard_prb rows and their comment (rows are data and cannot move; since TBD until the merge slot); +1 PR B #8615: file_drift_held_needs_prefer_8615 row; +1 PR B #8617: refresh_source_changed_retry_8617 row; +1 PR B #8662: commit_push_checkout_not_a_source_8662 row (since TBD until the merge slot; rows are data and cannot move); +2 PR B refresh_barrier_prb and commit_push_base_prb rows (re-summed: 1658 measured); +3 convergence PR A: the wave comment and two rows (conversion_content_evidence_pr_a, git_gap_live_pages_pr_a; since TBD until the merge slot; rows are data and cannot move); re-summed at the gate-ahead on master v0.60.592.0 plus #8711: 1658 + 3 = 1661 measured; +4 GST-1094/GST-900 rows (memory_recall scope-read, member-bound acting_user, recall max_chars, unknown_param _meta-only) and +1 qm_scope_writes_gst1113 and +1 recall_question_terms_gst1304 rows (rows are data and cannot move), re-summed at the 0.60.595.0 slot merge: 1661 + 6; +1 GST-1582 refresh_barrier_import_gst1582 row (since TBD until the merge slot; rows are data and cannot move); +2 GST-1601 source_changed_origin_gst1601 and adopt_local_edits_gst1601 rows (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.596.0 merge: 1668 + 2; +1 GST-1623 refresh_barrier_capacity_gst1623 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.599.0 merge: 1670 + 1; +2 GBRA-224 W1 release_channel_stable_default row and its comment; +1 GST-1623 refresh_barrier_later_write_gst1623 row (#8765; rows are data and cannot move); +5 #8766 GST-1623 items 4/6-9 and #8755: the wave comment and four rows (doctor_foreign_writers_partial_gst1623, commit_push_enclosing_repo_gst1623, owner_guard_fail_closed_gst1623, adopt_local_edits_hardening_8755) and +1 managed_sync_kind_reserved_8765 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on master v0.60.608.0 plus #8798: 1674 + 6; +1 GST-1853 refresh_barrier_aborted_refresh_sync_gst1853 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.613.0 merge: 1680 + 1; +1 GST-1674 refresh_refused_merge_recovery_gst1674 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.614.0 merge: 1681 + 1; +1 #8824/#8826/#8767: adopt_local_edits_replay_markers_8824 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8837: 1682 + 1; +1 url_source_origin row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8834: 1683 + 1; +1 #8828: the refresh_replan_own_commits_8828 row (1684 + 1 at the 0.60.618.0 slot); +1 the managed commit-push unpublished-count row; +1 the refresh publish-diverged default row; +1 GST-2051 ungranted_member_writes_gst2051 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-731 think_window_trajectory_gst731 row and +1 GST-1602 purge_cancels_deferred_write_gst1602 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8915 v0.60.621.0: 1688 + 2; +1 GST-2059: owner_reads_private row; +1 #8888: the record-origin checkout lock-down row (re-summed at the Q6 stack on #8934 v0.60.625.0: 1691 + 1); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 GST-1158 E1/F3/F4 rows (since TBD until the merge slot), re-summed at the master merge; +1 GBRA-284 personal_sources_gbra284 row (since TBD until the merge slot) (re-summed at the QM wave merge onto master v0.60.626.0: 1692 + 3); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 GST-1158 v3: the qm_personal_structured_gst1158 row (since TBD until the merge slot); +1 #8477 GST-1158 F2 personal-tools row at the QM wave merge (1695 + 1); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 #8483 memory_propose row at the QM wave merge (1696 + 1); +1 GST-1094 gap 4: the qm_admin_http_gst1094 row (since TBD until the merge slot); +1 GST-1158: the member_email_link_gst1158 row (since TBD until the merge slot); +2 #8479 member-email rows at the QM wave merge (1697 + 2); +1 GST-2112: ingest_keeps_readers_gst2112 row (re-summed at the Q7 v0.60.627.0 merge: 1692 + 1); +1 #8982 federated_member_writes_8982 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-2116 commit_push_skipped_paths_gst2116 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q10 slot on #9009 ee0f4a78: 1694 + 1; +1 GST-2118 pending_ledger_flagged_gst2118 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q12 slot on #9016 afb49de5: 1695 + 1; +1 GBRA-431: read_scope_params_gbra431 row (rows are data and cannot move), re-summed at the #9032 stack merge: 1697 measured; +2 GST-2201 sync_restored_file_gst2201 and purge_keeps_committed_file_gst2201 rows (since is the current VERSION until the merge slot; +1 GST-2243 remember_share_gst2243 row (re-summed at the #9098 stack merge: 1699 + 1); +1 GST-2312 #9024 sync_filter_owned_hold_9024 row (re-summed at the #9064 stack merge: 1700 + 1; rows are data and cannot move); +2 access-privacy wave (0.60.649.0): the owner_private_facts_gst2089 and private_labels_write_ahead_gst2092 rows; +1 GBRA-443 private_labels_batch_exit_gbra443 row (rows are data and cannot move), re-summed at the 0.60.650.0 slot on #9038: 1703 + 1; +1 postgres_tls_default row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.651.0 merge: 1704 + 1; +1 GST-2331 sync_reads_fetch_nothing_gst2331 row (rows are data and cannot move), re-summed at the 0.60.654.0 stack on #9045 6ff5540d: 1705 + 1; +7 QM wave (#9037) rows: attest_scope_read_ops_gst1158, attest_direct_page_writes_deferred_gst1158, personal_sources_gbra284, qm_personal_structured_gst1158, memory_propose_held_writes_gst1158, member_email_link_gst1158, qm_admin_http_gst1094 (re-summed at the 0.60.655.0 stack on #9110 f9b2072e: 1706 + 7); +1 GST-2228 recreated_takes_section_keeps_stored_takes_gst2228 row (since TBD; re-summed at the keep-takes-and-link-dates train merge: 1713 + 1); +1 GST-2228 links_rows_keep_own_dates_gst2228 row (since TBD; re-summed at the same train merge: 1714 + 1); +2 the W1 + memory proposals train (#9133): attest_every_page_write_deferred_gst2249 and memory_proposals_owner_http_gst2407 rows (rows are data and cannot move), re-summed at the #9138 v0.60.661.0 stack merge: 1715 + 2 = 1717 measured; +1 #8903 effect_git_secret_gate_gst1923 row (rows are data and cannot move), re-summed at the 0.60.664.0 stack on #9142 3931adb4: 1717 + 1; +1 GST-2407 PR 3: qm_recall_own_page_contract_v4 row (rows are data and cannot move), re-summed at the 0.60.666.0 stack on #9148 69c12917: 1718 + 1; +2 GST-363 PR 1 and PR 3 (#9135): the serves_several_labels_gst363 and stdio_member_per_harness_gst363 rows; +3 #9134 train rows member_forget_names_host_9101, refresh_fence_retry_id_gst2353 and recorded_read_view_args_gst2214 (rows are data and cannot move), re-summed at the #9134 slot merge onto #8829 dfc24954: 1721 + 3; +3 source-checkouts wave rows (autopilot_git_reconcile_gbra386, unknown_drift_history_rescreen, refresh_abandon_members_gst1465), re-summed at the #9137 stack merge: 1724 + 3; persistence train 13 at 0.60.676.0: its five rows on top of 0.60.675.0; +1 GST-2250 reconcile_publish_opt_out_gst2250 row (since TBD until the merge slot; rows are data and cannot move); +1 #8902 unmanaged_push_history_scan_8902 row (re-summed at the 0.60.678.0 stack on 501742d9: 1733 + 1); +1 GST-2346 D1 owner_facts_shared_gst2346 row (since TBD until the merge slot; rows are data and cannot move)src/commands/auth.ts 1503 ratchet new row: crossed the 1500 unlisted cap at the v0.60.595.0 merge: GST-1113 --attest-sources help lines plus GST-1158 F3 --attest-read help lines (3); CLI help lines cannot movediff --git a/skills/brain-ops/SKILL.md b/skills/brain-ops/SKILL.mdindex ee3b790cfb..5d46410e97 100644--- a/skills/brain-ops/SKILL.md+++ b/skills/brain-ops/SKILL.md@@ -96,7 +96,8 @@ suppresses writes for that turn, including when standing capture is enabled.> `idea` kind the extractor and DB carry is NOT one of them) and the> visibility the envelope's `agent_action` names> (default private — pin it; `remember` defaults to world, or to your own-> member page when your credential is bound to a member), or author a+> member page when your credential is bound to a member other than the+> brain owner), or author a> `## Facts` fence on the entity page. A `skipped: extraction_failed` envelope> (server-side extractor errored on this turn; `reason` names why) invites the> same manual `remember` fallback for that turn — automatic extraction staysdiff --git a/skills/skills.lock.json b/skills/skills.lock.jsonindex 51e22b2ede..5f199e985a 100644--- a/skills/skills.lock.json+++ b/skills/skills.lock.json@@ -20,7 +20,7 @@"brain-ingest-gate/routing-eval.jsonl": "281e94affbb8631ef7ff44203884cce1c03c468b27f893829da1e6e439401a33","brain-link-discipline/SKILL.md": "db2a77319475dd8eb370e9a3bb0eafe81d3b19d2de126113b30df7454dd9a069","brain-link-discipline/routing-eval.jsonl": "0adea4c6d72fdb849c12fe2cad718568b9ab704299b00b093c40c2284faf684c",- "brain-ops/SKILL.md": "a5f42937b3114a74128f1f9bf9a49efe65d2d43d8cc5ffbe5c93ded3fc06ebeb",+ "brain-ops/SKILL.md": "a21bd5a0d3556fe73a037c73340a875f5d5d4144bf906c02bfa8dc117d13932f","brain-pdf/SKILL.md": "2dfffd2373f00b5f11c1e4b39a75be48e90870201b4c11979d520bd5975dcae4","brain-pdf/routing-eval.jsonl": "119e4fa113ea45783cee4499e63a729fdeecb4d9a45d47497754b4f5b21d0734","brain-taxonomist/SKILL.md": "418fd4cdac3355551c42a70fea4d76e3d9255fe04698358b2c1e89dc666bf11d",diff --git a/src/commands/serve-http-mcp.ts b/src/commands/serve-http-mcp.tsindex 466507f9b6..af239ac466 100644--- a/src/commands/serve-http-mcp.ts+++ b/src/commands/serve-http-mcp.ts@@ -23,6 +23,7 @@ import { createSkillResources } from '../mcp/skill-resources.ts';import { resolveAuthCapabilities } from '../core/harness/capabilities.ts';import { ambientOptsFrom, writebackCaller, type WritebackConfig } from '../core/facts/writeback-config.ts';import { resolveAgentWriteback } from '../core/facts/writeback-settings.ts';+import { OWNER_MEMBER_KEY } from '../core/search/private-visibility.ts';import { hasScope, operationScopesAllowed } from '../core/scope.ts';import { summarizeMcpParams, dispatchToolCall, requestLogStatusForResult, requestMetaSessionId, hotMemoryOffIn, acceptedPendingReceipt, unknownToolEnvelope, errorResult, dispatchRenderContext, grantBlockedNotices, admitNotices, audienceRefusal, type ToolResult } from '../mcp/dispatch.ts';import { toAgentError } from '../core/agent-output.ts';@@ -202,7 +203,7 @@ export function mountMcp(app: Express, ctx: ServeHttpContext): void {const state: McpRequestState = { authInfo, agentName, startTime, mcpOperations, surface, surfaceCeiling, surfaceAllowedOps, resultRows, thinClient,onBehalfOfHeader: req.get(ON_BEHALF_OF_HEADER), actorHeader: req.get(ACTOR_HEADER), audienceHeader: req.get(QM_AUDIENCE_HEADER),userAgent: req.get('user-agent'), agentLabel: parseAgentLabel(req.get(AGENT_LABEL_HEADER)) };- const server = createMcpRequestServer(ctx, state, writeback);+ const server = createMcpRequestServer(ctx, state, writeback, writeback?.enabled ? await engine.getConfig(OWNER_MEMBER_KEY).catch(() => null) : null);await serveMcpRequest(server, req, res);}}@@ -211,6 +212,7 @@ function createMcpRequestServer(ctx: ServeHttpContext,state: McpRequestState,writeback: WritebackConfig | null,+ ownerMember: string | null,): Server {const { engine, config, mcpResourceUrl } = ctx;const { authInfo, mcpOperations, surface, surfaceCeiling, surfaceAllowedOps } = state;@@ -226,7 +228,7 @@ function createMcpRequestServer(writebackOpts = ambientOptsFrom(writeback, {remember: rememberOp !== undefined && opAllowedForBoundClient(authInfo, rememberOp),extractFacts: extractFactsOp !== undefined && opAllowedForBoundClient(authInfo, extractFactsOp),- ...writebackCaller(authInfo),+ ...writebackCaller(authInfo, ownerMember),});}const server = new Server(diff --git a/src/core/access/member-facts.ts b/src/core/access/member-facts.tsindex 9b454fd11f..5d48be9cab 100644--- a/src/core/access/member-facts.ts+++ b/src/core/access/member-facts.ts@@ -51,6 +51,19 @@ export function memberFactPage(ctx: Pick<OperationContext, 'remote'>): string |return slug;}+/**+ * GST-2346 D1: whether the caller is the brain owner's own credential speaking for itself: CallerAccess.owner with no+ * attested actor and no asserted audience, outside a subagent and every slug-prefix fence. Its facts then save as a+ * caller with no member page saves them, on the subject's page, and its forget reaches a fact off its member page the+ * same way; a fact it asks to keep private, or one the page or the brain's default keeps private, stays on its member+ * page. Every other member caller keeps its member page (GST-359 C2).+ */+export function ownerSpeaksForItself(ctx: Pick<OperationContext, 'remote' | 'viaSubagent' | 'allowedSlugPrefixes' | 'auth'>): boolean {+ const access = currentCallerAccess();+ return ctx.remote !== false && access.owner && !access.actor && access.audience === null && ctx.viaSubagent !== true+ && !ctx.allowedSlugPrefixes?.length && !ctx.auth?.boundSlugPrefixes && !ctx.auth?.fenceProjectionDegraded;+}+/*** GST-2249 W1: a save made for an attested person (x-qm-actor) stays on that person's member page. Sharing it would be* a write every reader of the source sees, made with no owner approval, so remember refuses share: true (and an explicitdiff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.tsindex 626319db48..589cb311ea 100644--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@ -1536,6 +1536,7 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;{ since: '0.60.676.0', id: 'write_capacity_low_saved_gst2107', text: 'The `write_capacity_low` notice a write receipt carries now opens with "This write was saved" and its fix is the read-only `gbrain doctor --only persistence_capacity --json` (actor agent) instead of a `gbrain config set` cap raise for the user, so an agent reading the end of a successful write no longer reports it as refused. The one-more-year value doctor, the notice snapshot and `/metrics` recommend now uses the 7-day mean rate, so one bulk day is no longer projected for a year; days-to-exhaustion still uses the larger of the mean and the last 24 hours. A `write_quota_exhausted`, `write_quota_insufficient` or background-pause refusal names the same value doctor does instead of sizing the year from the latest 1,000 admissions.' },{ since: '0.60.676.0', id: 'ingest_backfill_409_recovery_gst2112', text: 'A `revision_backfill_pending` refusal (a write to a page the revision backfill has not reached, including the 409 a webhook capture to such a page gets from `POST /ingest`) now names the command that resumes the backfill, `gbrain apply-migrations --force-schema` on the brain host, instead of `gbrain apply-migrations --yes`, which does not resume it once the schema is current. A capture answered 409 stores and queues nothing, so its sender sends it again after the backfill; an `ingest_capture` job already queued for such a page goes straight to dead and is re-run with `gbrain jobs retry <id>`.' },{ since: '0.60.678.0', id: 'unmanaged_push_history_scan_8902', text: 'Four pushes from a checkout that is not a managed worktree now scan every local commit they publish for secrets, not only what they just wrote: the access-policy commit (`gbrain access rule` and the other policy writers), the durability-scaffolding commit of `gbrain sources harden`, `gbrain sources push`, and the first push of `gbrain bootstrap repo` (the whole history, since the remote has no such branch yet). A credential that a commit made with plain `git commit` added, even one a later commit removed, or one in a commit message, now refuses `publish_secret_found` naming the file, line, rule and commit (never the value), and nothing is pushed; history the scan cannot read in full refuses `publish_scan_unreadable`. The local commits stay where they are. `gbrain sources push` now pushes the exact commit it scanned, leased on the remote tip it read, and an allowlist (`.gbrain-scan-allow`) edit it commits itself still publishes; one a script committed is left for the user to review and push. Remove the value from the unpublished commits, or allowlist a false positive by fingerprint, then rerun.' },+ { since: 'TBD', id: 'owner_facts_shared_gst2346', text: 'A credential bound to the brain owner (`gbrain access owner set`), speaking for itself, now saves `remember` facts the way a credential bound to no member does: with no `visibility`, a fact is shared on its subject\'s page and every reader of the source recalls it, where it used to be kept private on the owner\'s member page. It stays private on that page when the call passes `visibility: "private"` or the subject\'s page or `facts.default_visibility` keeps facts private, and the reply names the `page` and `visibility` either way. Its `visibility: "world"` is saved instead of refused (`member_share_required`), and its `forget` withdraws a shared fact it reads instead of saying only the brain host can. An owner agent that follows a planted instruction can therefore share a fact without passing any flag; to keep a fact private, pass `visibility: "private"`. Member credentials, attested QM calls (`x-qm-actor`), audiences (`X-Gbrain-On-Behalf-Of`), subagent jobs and slug-fenced clients are unchanged, and with writeback on the owner\'s credential is no longer told its saves stay private.' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --git a/src/core/facts/writeback-config.ts b/src/core/facts/writeback-config.tsindex cfd52f71eb..bafbddd4a2 100644--- a/src/core/facts/writeback-config.ts+++ b/src/core/facts/writeback-config.ts@@ -180,9 +180,11 @@ interface AmbientOptsShape {/*** GST-2243: who an HTTP credential writes as, for its instructions: a member-bound credential is one member; a credential* that may name a member per call (x-qm-actor on remember) writes as that member on those calls and as itself otherwise.+ * GST-2346 D1: a credential bound to the brain owner (`ownerMember`, config access.owner_member) and fenced to no slug+ * prefixes saves shared by default, so it is told what a credential bound to no member is told.*/-export function writebackCaller(auth: Pick<AuthInfo, 'member' | 'attest'> | undefined): { member?: true; actor?: true } {- if (auth?.member) return { member: true };+export function writebackCaller(auth: Pick<AuthInfo, 'member' | 'attest' | 'boundSlugPrefixes'> | undefined, ownerMember?: string | null): { member?: true; actor?: true } {+ if (auth?.member && !(ownerMember && auth.member.id === ownerMember.trim() && !auth.boundSlugPrefixes)) return { member: true };return auth?.attest?.ops.includes('remember') ? { actor: true } : {};}diff --git a/src/core/operation-manifest.generated.ts b/src/core/operation-manifest.generated.tsindex a53be04d9d..5b6ea02cbb 100644--- a/src/core/operation-manifest.generated.ts+++ b/src/core/operation-manifest.generated.ts@@ -89,7 +89,7 @@ export const OPERATION_MANIFEST: OperationMeta[] = [},"share": {"type": "boolean",- "description": "Members save privately; true: all source readers recall it. Share team work, not facts about a person."+ "description": "Members save privately, owner shared; true: all source readers recall it. Not for facts about a person."},"visibility": {"type": "string",diff --git a/src/core/ops/memory-settings.ts b/src/core/ops/memory-settings.tsindex c18198e6e2..89e3e42616 100644--- a/src/core/ops/memory-settings.ts+++ b/src/core/ops/memory-settings.ts@@ -15,7 +15,7 @@ import { opError, OperationError } from './contract.ts';import { hostFix } from './op-fix.ts';import { opAllowedForBoundClient } from './context.ts';import { hasScope } from '../scope.ts';-import { callerMember } from '../access/member-facts.ts';+import { callerMember, ownerSpeaksForItself } from '../access/member-facts.ts';import { buildAmbientWritebackSection } from '../facts/writeback-instructions.ts';import { CAPTURE_GATE_LANES, CAPTURE_LANE_LABELS, captureGateDecision, resolveWritebackConfig, type WritebackMode } from '../facts/writeback-config.ts';import {@@ -75,7 +75,7 @@ function ruleFor(res: AgentWritebackResolution, mode: WritebackMode, ctx: Operatvisibility: res.operator.visibility,extractFactsAvailable: callerCan(ctx, EXTRACT_FACTS_OP),origin,- ...(ctx.remote !== false && callerMember() ? { member: true } : {}),+ ...(ctx.remote !== false && callerMember() && !ownerSpeaksForItself(ctx) ? { member: true } : {}),});}diff --git a/src/core/persistence/memory-mutations.ts b/src/core/persistence/memory-mutations.tsindex 2fefef60fb..3c5a59ac2d 100644--- a/src/core/persistence/memory-mutations.ts+++ b/src/core/persistence/memory-mutations.ts@@ -31,6 +31,8 @@ import { resolveReadEligibility } from '../eligibility/policy.ts';import { callerMember, factVisibilitySql, memberFactPage, memberPageIsOwn, memberPageNotOwned, memberPageSlug, ownMemberFactIds, scopePageIsShared, scopePageNotShared, SCOPE_PAGE_SLUG } from '../access/member-facts.ts';import { perCallWriteSource } from '../access/attest-sources.ts';+import { ownerSpeaksForItself } from '../access/member-facts.ts';+export { prepareMemoryMutation } from './memory-prepare.ts';/** Only semantic appends without an explicit caller revision can be recomputed. */function sourceInactive(sourceId: string): OperationError {@@ -206,20 +208,28 @@ export async function submitRememberMutation(ctx: OperationContext, params: Reco// GST-2243: share: true saves a member's fact as anyone else's, on the subject's page for every reader of the source.const scopePage = perCallWriteSource(ctx, sourceId);const ownPage = scopePage ? null : memberFactPage(ctx);- const memberPage = scopePage ? SCOPE_PAGE_SLUG : p.share === true ? null : ownPage;- const call: RememberCall = memberPage ? { p: { ...p, visibility: scopePage ? 'world' : 'private', infer_entity: false }, visibilityDefaulted: false }+ // GST-2346 D1: the brain owner speaking for itself saves as a caller with no member page does, unless it asks for private.+ const ownerShares = ownPage !== null && p.share !== true && ownerSpeaksForItself(ctx) && (opts.visibilityDefaulted === true || p.visibility !== 'private');+ let memberPage = scopePage ? SCOPE_PAGE_SLUG : p.share === true || ownerShares ? null : ownPage;+ let call: RememberCall = memberPage ? { p: { ...p, visibility: scopePage ? 'world' : 'private', infer_entity: false }, visibilityDefaulted: false }: { p, visibilityDefaulted: opts.visibilityDefaulted === true || p.share === true };- const inference = entity === null && !memberPage ? await inferRememberTarget(ctx, sourceId, source, call) : null;- const linked = inference && 'target' in inference ? inference : null;- const entitySlug = linked?.target.slug ?? resolved?.slug ?? null;+ let inference = entity === null && !memberPage ? await inferRememberTarget(ctx, sourceId, source, call) : null;+ let linked = inference && 'target' in inference ? inference : null;+ let entitySlug = linked?.target.slug ?? resolved?.slug ?? null;// A source-scoped absent identity serializes subjectless facts. Bound writers// cannot use it to escape their namespace grant.- const { slug, authority, snapshot, fence, binding, writeThrough } = linked?.target ?? await planRememberTarget(ctx, sourceId, source, entitySlug, null, call, memberPage);+ let { slug, authority, snapshot, fence, binding, writeThrough } = linked?.target ?? await planRememberTarget(ctx, sourceId, source, entitySlug, null, call, memberPage);const { assertFactNotWithdrawn, decideReplacement, replacementVisibility } = await import('../facts/single-prepare.ts');const defaultedVisibility = await rememberVisibility(ctx, call, snapshot?.page);const visibility = call.visibilityDefaulted && p.replaces !== undefined && p.replaces !== null? await replacementVisibility(ctx.engine, sourceId, Number(p.replaces), defaultedVisibility, { remote: ctx.remote !== false }): defaultedVisibility;+ // D1: a default save the page or the brain's default keeps private goes to the owner's own member page, as a member's does.+ if (ownerShares && visibility === 'private') {+ memberPage = ownPage; call = { p: { ...p, visibility: 'private', infer_entity: false }, visibilityDefaulted: false };+ inference = null; linked = null; entitySlug = resolved?.slug ?? null;+ ({ slug, authority, snapshot, fence, binding, writeThrough } = await planRememberTarget(ctx, sourceId, source, entitySlug, null, call, memberPage));+ }if (p.share === true && visibility !== 'world') {throw Object.assign(verbError('invalid_params', `remember: share: true cannot share a fact on ${slug}, whose facts are kept private (restricted page or the brain's private fact default); nothing was saved.`,'Share it on a page every reader of this source can read, or drop share to keep the fact on your own page.'), { reason: 'share_target_restricted' });@@ -326,8 +336,11 @@ export async function submitForgetMutation(ctx: OperationContext, operation: 'fo// claim stays active and rememberable. Ownership is judged first: any other fact is not_found before a trust check,// so no owner proposal is filed and its tier is never disclosed.const member = remote ? callerMember() : null;- const ownPage = member ? memberPageSlug(member) : null;- if (ownPage && !(await ownMemberFactIds(ctx.engine, sourceId, [id])).has(id)) {+ const mine = member !== null && (await ownMemberFactIds(ctx.engine, sourceId, [id])).has(id);+ // GST-2346 D1: the owner speaking for itself withdraws a fact off its member page as a caller with no member page does.+ const asOwner = member !== null && !mine && ownerSpeaksForItself(ctx) && await readForgetTarget(ctx.engine, id, sourceId, remote, excludePrivate) !== null;+ const ownPage = member && !asOwner ? memberPageSlug(member) : null;+ if (ownPage && !mine) {// #9101: a fact the caller reads (one it shared, or a teammate's shared fact) is refused by name; a fact it cannot read stays not_found.// An attested QM actor keeps not_found for every fact off its page, as QM memory-provider contract v3 states.if (currentCallerAccess().actor) throw missing();diff --git a/src/core/verbs.ts b/src/core/verbs.tsindex 5b1d573437..c6d0691005 100644--- a/src/core/verbs.ts+++ b/src/core/verbs.ts@@ -106,7 +106,7 @@ const remember: Operation = {},share: {type: 'boolean',- description: 'Members save privately; true: all source readers recall it. Share team work, not facts about a person.',+ description: 'Members save privately, owner shared; true: all source readers recall it. Not for facts about a person.',},visibility: {type: 'string',@@ -193,7 +193,8 @@ const remember: Operation = {const attested = ctx.attestedOp !== 'memory_write' && (await import('./search/private-visibility.ts')).currentCallerAccess().actor != null;if (attested && p.share === true) throw memberFacts.attestedShareRefused(verbError);// GST-2243: a member shares only with share: true, so its explicit visibility "world" is refused, never quietly made private.- if (p.share !== true && p.visibility === 'world' && ctx.attestedOp !== 'memory_write' && memberFacts.memberFactPage(ctx)) {+ // GST-2346 D1: the brain owner speaking for itself is not refused; its "world" is saved shared.+ if (p.share !== true && p.visibility === 'world' && ctx.attestedOp !== 'memory_write' && memberFacts.memberFactPage(ctx) && !memberFacts.ownerSpeaksForItself(ctx)) {if (attested) throw memberFacts.attestedShareRefused(verbError);throw Object.assign(verbError('invalid_params', 'remember: a member credential shares a fact with share: true, not visibility "world"; nothing was saved.','Retry the same call with share: true in place of visibility "world" to share a fact about the team\'s work with everyone who reads this source, or with no visibility to keep a fact about a person on your own member page. A member shares only this way: pass share: true, never visibility "world".'),diff --git a/src/mcp/http-transport.ts b/src/mcp/http-transport.tsindex 60b4ae9d16..2670265374 100644--- a/src/mcp/http-transport.ts+++ b/src/mcp/http-transport.ts@@ -36,6 +36,7 @@ import { MCP_SERVER_DESCRIPTION, readInstructionContent, resolveMcpInstructionsimport { httpInstructionTools } from './initialize-context.ts';import { ambientOptsFrom, writebackCaller } from '../core/facts/writeback-config.ts';import { resolveAgentWriteback } from '../core/facts/writeback-settings.ts';+import { OWNER_MEMBER_KEY } from '../core/search/private-visibility.ts';import { operations, operationsByName, opAllowedForBoundClient } from '../core/operations.ts';import { scopeDeniedError } from '../core/ops/op-fix.ts';import { ON_BEHALF_OF_HEADER } from '../core/access/audience.ts';@@ -473,7 +474,7 @@ export async function startHttpTransport(opts: HttpTransportOptions) {capabilities: { tools: {}, resources: {} },// #4748: contract (+ opt-in writeback section) + deployment identity.instructions: resolveMcpInstructions(fileConfig, process.env, {- writeback: ambientOptsFrom(writeback, { remember: canWriteOp('remember'), extractFacts: canWriteOp('extract_facts'), ...writebackCaller(auth.auth) }),+ writeback: ambientOptsFrom(writeback, { remember: canWriteOp('remember'), extractFacts: canWriteOp('extract_facts'), ...writebackCaller(auth.auth, writeback.enabled ? await engine.getConfig(OWNER_MEMBER_KEY).catch(() => null) : null) }),tools: await httpInstructionTools(engine, fileConfig, { ops: surfacedOps, surface, auth: auth.auth!, allowedOps: surfaceAllowedOps }), // F1...await readInstructionContent(engine),}),diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.jsonindex 6cd8781fe0..5152d3a550 100644--- a/test/fixtures/goldens/cli/tools-json.json+++ b/test/fixtures/goldens/cli/tools-json.json@@ -2,8 +2,8 @@"golden": {"exitCode": 0,"stderr": "",- "stdoutBytes": 287194,- "stdoutSha256": "77ce6903a27a21e1913a9b4cd49be328cffda29f27d55ef25465c189461d3af5",+ "stdoutBytes": 287195,+ "stdoutSha256": "0ce2ce7f78140fd56cf7bbd02098a18c5802abfb26bd5713b347d2f50e36e5f1","toolNames": ["remember","entity",@@ -309,7 +309,7 @@"type": "string"},"share": {- "description": "Members save privately; true: all source readers recall it. Share team work, not facts about a person.",+ "description": "Members save privately, owner shared; true: all source readers recall it. Not for facts about a person.","type": "boolean"},"source_id": {diff --git a/test/member-forget-refusal-9101.test.ts b/test/member-forget-refusal-9101.test.tsindex 9f6b8a750e..6812dca7e5 100644--- a/test/member-forget-refusal-9101.test.ts+++ b/test/member-forget-refusal-9101.test.ts@@ -1,10 +1,10 @@/*** #9101: a remote member's forget names who can withdraw a fact it can see but cannot withdraw.*- * 1. Protects: a member-bound or owner-bound credential that forgets a fact it reads (a fact it shared, or another- * member's shared fact) gets scope_denied naming the brain host, and the fact stays active; a fact the caller- * cannot read (another member's private fact) still answers not_found, so the reply never confirms a hidden fact;- * the caller's own private fact is still withdrawn.+ * 1. Protects: a member-bound credential that forgets a fact it reads (a fact it shared, or another member's shared+ * fact) gets scope_denied naming the brain host, and the fact stays active; a fact the caller cannot read (another+ * member's private fact) still answers not_found, so the reply never confirms a hidden fact; the caller's own+ * private fact is still withdrawn. GST-2346 D1: an owner-bound credential withdraws a fact it shared.* 2. Fails when: forget answers not_found for a fact the caller just saved or reads, or the refusal leaks a fact the* caller cannot read.* 3. Existing coverage: test/access-member-facts.test.ts (GST-359 D) pins forget on the member page.@@ -99,18 +99,17 @@ for (const kind of testBackends()) {expect(await active(kept)).toBe(true);}, 120_000);- test("an owner-bound credential forgetting a fact it shared is refused naming the brain host; a member's private fact stays not_found to it", async () => {+ test("an owner-bound credential withdraws a fact it shared (GST-2346 D1); a member's private fact stays not_found to it", async () => {const shared = await saved('owner', 'Acme moved its HQ canaryownershared', { share: true });+ const recalled = await call('owner', 'recall', { entity: ACME });const out = await call('owner', 'forget', { id: shared });- expect([out.isError, out.json.error]).toEqual([true, 'scope_denied']);- expect(out.text).toContain('brain host');- expect(await active(shared)).toBe(true);+ expect(out.isError ? out.text : 'ok').toBe('ok');+ expect(await active(shared)).toBe(false);const bobs = await saved('bob', 'Acme lunch plans canarybobprivate');const hidden = await call('owner', 'forget', { id: bobs });expect([hidden.isError, hidden.json.error]).toEqual([true, 'not_found']);expect(await active(bobs)).toBe(true);- const recalled = await call('owner', 'recall', { entity: ACME });- expect([recalled.text.includes('canaryownershared'), recalled.text.includes('canarybobprivate')]).toEqual([true, false]);+ expect([recalled.text.includes('canaryownershared'), (await call('owner', 'recall', { entity: ACME })).text.includes('canarybobprivate')]).toEqual([true, false]);}, 120_000);test("a member still withdraws its own private fact", async () => {diff --git a/test/owner-facts-d1-gst2346.test.ts b/test/owner-facts-d1-gst2346.test.tsnew file mode 100644index 0000000000..097c41ab3f--- /dev/null+++ b/test/owner-facts-d1-gst2346.test.ts@@ -0,0 +1,288 @@+/**+ * GST-2346 D1: the brain owner's own credential saves and forgets facts the way it already writes pages.+ *+ * 1. Protects: an owner-bound credential speaking for itself saves a fact with no visibility shared on the subject's+ * page, saves it private (on its own member page, and the reply says so) when that page names readers or the+ * brain's fact default is private, honours an explicit visibility both ways, and withdraws a fact it shared. Every+ * other caller keeps what it had: a member credential, an attested actor (even one linked to the owner), a shared+ * room (even one the owner's credential asserts), an owner credential naming an audience, a sandboxed subagent+ * running on the owner's credential, an owner credential fenced to slug prefixes and an unbound connection.+ * 2. Fails when: the owner's default save lands on its member page, its visibility "world" is refused, its forget+ * answers not_found or a refusal for a fact it shared, or any non-owner caller reaches the owner's route.+ * 3. Existing coverage: test/remember-share-gst2243.test.ts (member share), test/member-forget-refusal-9101.test.ts+ * (member forget refusal), test/qm-memory-tools.test.ts (QM contract).+ * 4. Real seams: OAuth client-credentials tokens bound to members and to the owner, MCP dispatch as remote callers,+ * a repo-less brain and a managed one, PGLite and Postgres.+ */+import { afterAll, beforeAll, describe, expect, test } from 'bun:test';+import { randomUUID } from 'node:crypto';+import { existsSync, readFileSync } from 'node:fs';+import { join } from 'node:path';+import type { BrainEngine } from '../src/core/engine.ts';+import { PGLiteEngine } from '../src/core/pglite-engine.ts';+import { importFromContent } from '../src/core/import-file.ts';+import { configureGateway, resetGateway, __setEmbedTransportForTests } from '../src/core/ai/gateway.ts';+import { GBrainOAuthProvider } from '../src/core/oauth-provider.ts';+import { sqlQueryForEngine } from '../src/core/sql-query.ts';+import { dispatchToolCall } from '../src/mcp/dispatch.ts';+import { __resetPrivateVisibilityCacheForTests, withCallerAccess } from '../src/core/search/private-visibility.ts';+import { addMember, bindCredential } from '../src/core/access/members.ts';+import { setOwner } from '../src/core/access/owner.ts';+import { linkMember } from '../src/core/access/actor.ts';+import { remoteCallerAccess } from '../src/core/access/caller.ts';+import { operationsByName } from '../src/core/operations.ts';+import { FACTS_DEFAULT_VISIBILITY_KEY } from '../src/core/facts/visibility.ts';+import { ambientOptsFrom, writebackCaller } from '../src/core/facts/writeback-config.ts';+import { buildAmbientWritebackSection } from '../src/core/facts/writeback-instructions.ts';+import type { AuthInfo, OperationContext } from '../src/core/ops/contract.ts';+import { testBackends } from './helpers/test-backends.ts';+import { isolatedPersistencePostgres } from './helpers/persistence-postgres.ts';+import { managedBrain, settleManagedGitEffects } from './helpers/managed-brain.ts';++const ACME = 'companies/acme-example';+const GLOBEX = 'companies/globex-example';+const OWNER = 'carol-example';+const OWNER_PAGE = 'memory/members/' + OWNER;+const ATTEST_OPS = ['forget', 'forget_fact', 'get_write_request', 'memory_recall', 'memory_write', 'recall', 'remember'];++type Call = { isError: boolean; text: string; json: Record<string, any> };+type Channels = { actor?: string; audience?: string };++/** An owner, two members and every non-owner credential shape, in sourceId of an initialized engine. */+async function seedCallers(engine: BrainEngine, sourceId: string,+ writePage: (slug: string, content: string) => Promise<unknown> = (slug, content) => importFromContent(engine, slug, content, { sourceId })) {+ const provider = () => new GBrainOAuthProvider({ sql: sqlQueryForEngine(engine), transaction: fn => engine.transaction(tx => fn(sqlQueryForEngine(tx))) });+ __resetPrivateVisibilityCacheForTests();+ for (const id of ['alice-example', 'bob-example', OWNER]) await addMember(engine, id);+ await setOwner(engine, OWNER);+ await writePage(ACME, '---\ntype: company\ntitle: Acme Example\n---\n# Acme Example\n\nAcme example builds harbor ledgers.');+ await writePage(GLOBEX, '---\ntype: company\ntitle: Globex Example\nreadable_by: [' + OWNER + ']\n---\n# Globex Example\n\nGlobex example runs a quiet pilot.');+ const tokens: Record<string, string> = {};+ const bindings: Record<string, Parameters<typeof bindCredential>[2] | null> = {+ owner: { member: OWNER }, alice: { member: 'alice-example' }, bob: { member: 'bob-example' }, plain: null,+ qm: { attestActor: 'qm', attestOps: ATTEST_OPS },+ room: { mayActFor: ['member:' + OWNER, 'member:alice-example'] },+ ownerRoom: { member: OWNER, mayActFor: ['member:' + OWNER, 'member:alice-example'] },+ fenced: { member: OWNER },+ };+ const clients: Record<string, string> = {};+ for (const [name, binding] of Object.entries(bindings)) {+ const c = await provider().registerClientManual('d1-' + name + '-' + randomUUID().slice(0, 8), ['client_credentials'], 'read write', [], sourceId);+ if (binding) await bindCredential(engine, { kind: 'client', id: c.clientId }, binding);+ clients[name] = c.clientId;+ tokens[name] = (await provider().exchangeClientCredentials(c.clientId, c.clientSecret ?? '')).access_token;+ }+ await engine.executeRaw("UPDATE oauth_clients SET bound_slug_prefixes = ARRAY['companies/'] WHERE client_id = $1", [clients.fenced]);+ await linkMember(engine, OWNER, 'qm', 'U0CAROL');+ await linkMember(engine, 'alice-example', 'qm', 'U0ALICE');+ const auth = async (who: string) => await provider().verifyAccessToken(tokens[who]!) as unknown as AuthInfo;+ const parse = (text: string, isError: boolean, first = text): Call => {+ let json: Record<string, any> = {};+ try { json = JSON.parse(first); } catch { /* prose */ }+ return { isError, text, json };+ };+ async function call(who: string, op: string, params: Record<string, unknown>, ch: Channels = {}): Promise<Call> {+ const out = await dispatchToolCall(engine, op, { ...params }, {+ remote: true, transport: 'http', auth: await auth(who), sourceId, takesHoldersAllowList: ['world'],+ ...(ch.actor ? { actor: { header: ch.actor } } : {}), ...(ch.audience ? { onBehalfOf: { header: ch.audience } } : {}),+ });+ return parse(out.content.map(c => c.text).join('\n'), out.isError === true, out.content[0]?.text);+ }+ /** op run as a subagent tool call on the owner's credential, the way minions/tools/brain-allowlist.ts runs one. */+ async function asSubagent(op: string, params: Record<string, unknown>): Promise<Call> {+ const ownerAuth = await auth('owner');+ const ctx: OperationContext = { engine, config: { engine: engine.kind, embedding_disabled: true } as never, sourceId, remote: true, dryRun: false,+ logger: { info() {}, warn() {}, error() {} }, auth: ownerAuth, viaSubagent: true, subagentId: 1, jobId: 1 };+ try {+ const out = await withCallerAccess(await remoteCallerAccess(engine, ownerAuth, []), () => operationsByName[op]!.handler(ctx, params));+ return parse(JSON.stringify(out), false);+ } catch (error) {+ return parse(JSON.stringify({ error: (error as { code?: string }).code, message: (error as Error).message }), true);+ }+ }+ const row = async (canary: string) => (await engine.executeRaw<{ id: number; visibility: string; source_markdown_slug: string | null; entity_slug: string | null; active: boolean }>(+ 'SELECT id, visibility, source_markdown_slug, entity_slug, expired_at IS NULL AS active FROM facts WHERE fact LIKE $1 ORDER BY id DESC LIMIT 1', ['%' + canary + '%']))[0];+ const remember = (who: string, fact: string, extra: Record<string, unknown> = {}, ch: Channels = {}) =>+ call(who, 'remember', { fact, entity: ACME, provenance: 'owner facts test', ...extra }, ch);+ return { call, asSubagent, row, remember, auth };+}++function setupGateway() {+ configureGateway({ embedding_model: 'openai:text-embedding-3-small', embedding_dimensions: 1536, env: { OPENAI_API_KEY: 'test' } });+ __setEmbedTransportForTests((async ({ values }: { values: string[] }) => ({ embeddings: values.map(() => new Array<number>(1536).fill(0).map((_, i) => (i === 0 ? 1 : 0))) })) as never);+}++for (const kind of testBackends()) {+ describe('owner facts (GST-2346 D1, ' + kind + ', repo-less)', () => {+ const SRC = 'source-a';+ let engine: BrainEngine;+ let close: () => Promise<void>;+ let h: Awaited<ReturnType<typeof seedCallers>>;++ beforeAll(async () => {+ setupGateway();+ if (kind === 'postgres') ({ engine, close } = await isolatedPersistencePostgres(process.env.DATABASE_URL!));+ else { engine = new PGLiteEngine(); await engine.connect({ engine: 'pglite' } as never); await engine.initSchema(); close = () => engine.disconnect(); }+ await engine.executeRaw('INSERT INTO sources (id, name) VALUES ($1, $1) ON CONFLICT (id) DO NOTHING', [SRC]);+ h = await seedCallers(engine, SRC);+ }, 120_000);++ afterAll(async () => { __setEmbedTransportForTests(null); resetGateway(); await close?.(); });++ test("the owner's fact with no visibility is shared on the subject's page, the reply says so, and a member recalls it", async () => {+ const out = await h.remember('owner', 'Acme opened a harbor office canaryownerdefault');+ expect(out.isError ? out.text : 'ok').toBe('ok');+ expect([out.json.page, out.json.visibility]).toEqual([ACME, 'world']);+ expect(await h.row('canaryownerdefault')).toMatchObject({ visibility: 'world', source_markdown_slug: ACME, entity_slug: ACME });+ expect((await h.call('alice', 'recall', { entity: ACME })).text).toContain('canaryownerdefault');+ }, 120_000);++ test("the owner's explicit visibility is honoured both ways: world is saved shared, private stays on its own page", async () => {+ const world = await h.remember('owner', 'Acme hired a harbor pilot canaryownerworld', { visibility: 'world' });+ expect(world.isError ? world.text : 'ok').toBe('ok');+ expect(world.text).not.toContain('member_share_required');+ expect([world.json.page, world.json.visibility]).toEqual([ACME, 'world']);+ const kept = await h.remember('owner', 'Acme margin worries me canaryownerprivate', { visibility: 'private' });+ expect([kept.isError, kept.json.page, kept.json.visibility]).toEqual([false, OWNER_PAGE, 'private']);+ expect(await h.row('canaryownerprivate')).toMatchObject({ visibility: 'private', source_markdown_slug: OWNER_PAGE });+ expect((await h.call('alice', 'recall', { entity: ACME })).text).not.toContain('canaryownerprivate');+ }, 120_000);++ test("a page that names readers keeps the owner's default save private, on its own page, and the reply says so", async () => {+ const out = await h.remember('owner', 'Globex pilot slipped a month canaryownerglobex', { entity: GLOBEX });+ expect([out.isError, out.json.page, out.json.visibility]).toEqual([false, OWNER_PAGE, 'private']);+ expect(await h.row('canaryownerglobex')).toMatchObject({ visibility: 'private', source_markdown_slug: OWNER_PAGE, entity_slug: GLOBEX });+ }, 120_000);++ test("the brain's private fact default keeps the owner's default save private, on its own page, and the reply says so", async () => {+ await engine.setConfig(FACTS_DEFAULT_VISIBILITY_KEY, 'private');+ try {+ const out = await h.remember('owner', 'Acme board meets quarterly canaryownerdefaultprivate');+ expect([out.isError, out.json.page, out.json.visibility]).toEqual([false, OWNER_PAGE, 'private']);+ expect((await h.call('alice', 'recall', { entity: ACME })).text).not.toContain('canaryownerdefaultprivate');+ } finally { await engine.setConfig(FACTS_DEFAULT_VISIBILITY_KEY, 'world'); }+ }, 120_000);++ test("the owner withdraws a fact it shared and one on its own page; a member's private fact stays not_found to it", async () => {+ const shared = await h.remember('owner', 'Acme closed its old dock canaryownerforgetshared');+ const out = await h.call('owner', 'forget', { id: String(shared.json.id) });+ expect(out.isError ? out.text : 'ok').toBe('ok');+ expect((await h.row('canaryownerforgetshared'))!.active).toBe(false);+ const viaShare = await h.remember('owner', 'Acme renamed its fleet canaryownerforgetshare', { share: true });+ const viaFact = await h.call('owner', 'forget_fact', { id: Number(viaShare.json.id) });+ expect(viaFact.isError ? viaFact.text : 'ok').toBe('ok');+ expect((await h.row('canaryownerforgetshare'))!.active).toBe(false);+ const own = await h.remember('owner', 'Acme note to self canaryownerforgetown', { visibility: 'private' });+ const ownOut = await h.call('owner', 'forget', { id: String(own.json.id) });+ expect(ownOut.isError ? ownOut.text : 'ok').toBe('ok');+ expect((await h.row('canaryownerforgetown'))!.active).toBe(false);+ const bobs = await h.remember('bob', 'Acme lunch plans canarybobkept');+ const hidden = await h.call('owner', 'forget', { id: String(bobs.json.id) });+ expect([hidden.isError, hidden.json.error]).toEqual([true, 'not_found']);+ expect((await h.row('canarybobkept'))!.active).toBe(true);+ }, 120_000);++ test('a member credential keeps K1: private on its member page by default, visibility "world" refused, a fact it shared refused by name', async () => {+ const kept = await h.remember('alice', 'Acme renewal worried me canaryalicekept');+ expect([kept.isError, kept.json.page, kept.json.visibility]).toEqual([false, 'memory/members/alice-example', 'private']);+ const world = await h.remember('alice', 'Acme hired canaryaliceworld', { visibility: 'world' });+ expect([world.isError, world.text.includes('member_share_required')]).toEqual([true, true]);+ expect(await h.row('canaryaliceworld')).toBeUndefined();+ const shared = await h.remember('alice', 'Acme asked for SSO canaryaliceshared', { share: true });+ const forget = await h.call('alice', 'forget', { id: String(shared.json.id) });+ expect([forget.isError, forget.json.error]).toEqual([true, 'scope_denied']);+ expect((await h.row('canaryaliceshared'))!.active).toBe(true);+ }, 120_000);++ test('an attested actor linked to the owner keeps the member route: private on the member page, sharing refused, forget of a shared fact not_found', async () => {+ const ch = { actor: 'U0CAROL' };+ const kept = await h.remember('qm', 'Acme told the owner a secret canaryattestedkept', {}, ch);+ expect([kept.isError, kept.json.page, kept.json.visibility]).toEqual([false, OWNER_PAGE, 'private']);+ const world = await h.remember('qm', 'Acme attested world canaryattestedworld', { visibility: 'world' }, ch);+ expect([world.isError, world.text.includes('attested_share_refused')]).toEqual([true, true]);+ expect(await h.row('canaryattestedworld')).toBeUndefined();+ const shared = await h.remember('owner', 'Acme expanded north canaryattestedforget', { share: true });+ const forget = await h.call('qm', 'forget', { id: String(shared.json.id) }, ch);+ expect([forget.isError, forget.json.error]).toEqual([true, 'not_found']);+ expect((await h.row('canaryattestedforget'))!.active).toBe(true);+ }, 120_000);++ test("the owner's credential naming an audience (a shared room, or the owner alone) never takes the owner's route", async () => {+ const room = await h.remember('ownerRoom', 'Acme room note canaryownerroom', {}, { audience: 'member:' + OWNER + ', member:alice-example' });+ const alone = await h.remember('ownerRoom', 'Acme alone note canaryowneraudience', {}, { audience: 'member:' + OWNER });+ const plainRoom = await h.remember('room', 'Acme plain room note canaryplainroom', {}, { audience: 'member:' + OWNER + ', member:alice-example' });+ expect([alone.isError, alone.json.page, alone.json.visibility]).toEqual([false, OWNER_PAGE, 'private']);+ expect(await h.row('canaryowneraudience')).toMatchObject({ visibility: 'private', source_markdown_slug: OWNER_PAGE });+ // A room of several (GBRA-231) writes as no single member, so it has no member page and saves on the subject's page,+ // as it did before D1; the owner's credential in the room saves exactly as any other room credential.+ for (const [out, canary] of [[room, 'canaryownerroom'], [plainRoom, 'canaryplainroom']] as const) {+ expect([out.isError, out.json.page, out.json.visibility]).toEqual([false, ACME, 'world']);+ expect(await h.row(canary)).toMatchObject({ visibility: 'world', source_markdown_slug: ACME });+ }+ const ownersOwn = await h.remember('owner', 'Acme owner private canaryroomforget', { visibility: 'private' });+ const roomForget = await h.call('ownerRoom', 'forget', { id: String(ownersOwn.json.id) }, { audience: 'member:' + OWNER + ', member:alice-example' });+ expect([roomForget.isError, roomForget.json.error]).toEqual([true, 'not_found']);+ expect((await h.row('canaryroomforget'))!.active).toBe(true);+ }, 120_000);++ test("a sandboxed subagent on the owner's credential and an owner credential fenced to slug prefixes never take the owner's route", async () => {+ const sub = await h.asSubagent('remember', { fact: 'Acme subagent note canarysubagent', entity: ACME, provenance: 'owner facts test' });+ const fenced = await h.remember('fenced', 'Acme fenced note canaryfenced');+ const fencedWorld = await h.remember('fenced', 'Acme fenced world canaryfencedworld', { visibility: 'world' });+ const shared = await h.remember('owner', 'Acme bought a crane canarysubforget');+ const subForget = await h.asSubagent('forget', { id: String(shared.json.id) });+ const fencedForget = await h.call('fenced', 'forget', { id: String(shared.json.id) });+ expect([sub.isError, sub.json.error]).toEqual([true, 'scope_denied']);+ expect([fenced.isError, fenced.json.error, fenced.text.includes(OWNER_PAGE)]).toEqual([true, 'scope_denied', true]);+ expect([fencedWorld.isError, fencedWorld.json.reason]).toEqual([true, 'member_share_required']);+ expect([subForget.isError, subForget.json.error]).toEqual([true, 'scope_denied']);+ expect([fencedForget.isError, fencedForget.json.error]).toEqual([true, 'permission_denied']);+ for (const canary of ['canarysubagent', 'canaryfenced', 'canaryfencedworld']) expect(await h.row(canary)).toBeUndefined();+ expect((await h.row('canarysubforget'))!.active).toBe(true);+ }, 120_000);++ test("with writeback on, the owner's credential is not told its saves stay private; a member and a fenced owner credential still are", async () => {+ const section = async (who: string) => buildAmbientWritebackSection(ambientOptsFrom({ enabled: true, mode: 'salient', transient_ttl: '3d', visibility: 'world' } as never,+ { remember: true, extractFacts: true, ...writebackCaller(await h.auth(who), OWNER) })!);+ expect([writebackCaller(await h.auth('owner'), OWNER), writebackCaller(await h.auth('fenced'), OWNER), writebackCaller(await h.auth('alice'), OWNER)])+ .toEqual([{}, { member: true }, { member: true }]);+ expect([(await section('owner')).includes('stay private to you'), (await section('alice')).includes('stay private to you')]).toEqual([false, true]);+ await engine.setConfig('mcp.publish_memory_settings', 'true');+ await engine.setConfig('memory.auto_writeback', 'salient');+ try {+ const rule = async (who: string) => JSON.stringify((await h.call(who, 'get_memory_settings', {})).json);+ expect([(await rule('owner')).includes('stay private to you'), (await rule('alice')).includes('stay private to you')]).toEqual([false, true]);+ } finally { await engine.setConfig('memory.auto_writeback', 'off'); }+ }, 120_000);++ test("an unbound connection never reads or withdraws the owner's private fact", async () => {+ const kept = await h.remember('owner', 'Acme private owner note canaryunboundhidden', { visibility: 'private' });+ expect((await h.call('plain', 'recall', { entity: ACME })).text).not.toContain('canaryunboundhidden');+ const forget = await h.call('plain', 'forget', { id: String(kept.json.id) });+ expect([forget.isError, forget.json.error]).toEqual([true, 'not_found']);+ expect((await h.row('canaryunboundhidden'))!.active).toBe(true);+ }, 120_000);+ });++ describe('owner facts (GST-2346 D1, ' + kind + ', managed)', () => {+ afterAll(() => { __setEmbedTransportForTests(null); resetGateway(); });++ test("on a managed brain the owner's default fact is shared on the subject's page file and its forget withdraws it", async () => {+ setupGateway();+ await managedBrain(async ({ engine, ctx, root }) => {+ const h = await seedCallers(engine, 'default', (slug, content) => operationsByName.put_page!.handler(ctx, { slug, content }));+ const out = await h.remember('owner', 'Acme moved its HQ canarymanagedowner');+ expect(out.isError ? out.text : 'ok').toBe('ok');+ expect([out.json.page, out.json.visibility]).toEqual([ACME, 'world']);+ await settleManagedGitEffects(engine);+ const file = join(root, ACME + '.md');+ expect(existsSync(file) && readFileSync(file, 'utf8').includes('canarymanagedowner')).toBe(true);+ const forget = await h.call('owner', 'forget', { id: String(out.json.id) });+ expect(forget.isError ? forget.text : 'ok').toBe('ok');+ expect((await h.row('canarymanagedowner'))!.active).toBe(false);+ const member = await h.remember('alice', 'Acme member note canarymanagedmember');+ expect([member.isError, member.json.page, member.json.visibility]).toEqual([false, 'memory/members/alice-example', 'private']);+ }, kind === 'postgres' ? { databaseUrl: process.env.DATABASE_URL! } : {});+ }, 240_000);+ });+}diff --git a/test/postgres-unit-arms.txt b/test/postgres-unit-arms.txtindex 88a04eddc1..68613f6838 100644--- a/test/postgres-unit-arms.txt+++ b/test/postgres-unit-arms.txt@@ -324,6 +324,7 @@ test/origin-twin-sequence-7150.test.tstest/origin-twins-6948.test.tstest/orphan-effect-diagnostics-7985.test.tstest/overwritten-edits-6712.test.ts+test/owner-facts-d1-gst2346.test.tstest/owner-refusal.test.tstest/pack-relation-direction-engine.test.tstest/page-change-reason-gbra217.test.ts