Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge remote-tracking branch 'origin/access-lineage-designs' into labelled-only-grant

garrytan518e17fa1fbe
diff --cc CHANGELOG.md
index 8c5687c32d,a7c4c31e89..fee3b13baa
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -10,9 -10,9 +10,26 @@@ credits are retained; no result has bee
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
+## [Unreleased]
+
- **Three opt-in ways to share what is derived from member-restricted pages: raw-only folder rules, audience members the owner reads, and member lineage reads.** A folder rule kept the summaries, atoms, chronicle events and facts made from its pages as tightly as the pages themselves, so a transcript folder kept to one member hid every summary of those calls from everyone else; a group chat's own memory page was closed to the brain owner; and only the owner could read the derived pages and facts of pages it already reads. Each now has an operator setting, off by default, and nothing changes on upgrade: `gbrain access rule add --raw-only` keeps a folder's pages to its readers but lets whoever reads a derived page read it (use it for transcripts, never for a folder whose content is itself the secret); `gbrain access member kind <id> audience` lets the owner read that member's own member page, versions, derived pages and facts; and `gbrain access members-read-lineage on` lets every member read the derived pages and facts of pages it reads, as the owner does. All three work the same on a repo-less brain and with rules in `access.yml`, only the operator on the brain host sets them, and no write widens. A fourth setting goes the other way: `gbrain access member labelled-only <id> on` keeps a group or audience credential to pages that name it, hiding unlabelled pages and anything derived from them.
++**A member can now be kept to pages labelled for it.** A group chat bot or a shared assistant bound to a member read every unlabelled page its source grant opened, and every summary, atom and fact made from them. `gbrain access member labelled-only <id> on` (off by default, unchanged on upgrade) keeps every credential of that member to pages that name it: the member or one of its groups in `readable_by`, or a folder or page rule listing them. Unlabelled pages, and derived pages and facts that name nobody, are hidden on every read path; with `access.members_read_lineage` on, a derived page passes only when every origin names the member. Writes follow the same rule. Only the operator on the brain host sets it, and never on the owner. It works the same on a repo-less brain and with rules in `access.yml`.
++
++### Itemized changes
++
++#### Labelled-only members (GBRA-108 design 1)
++
++- The labelled-only migration (`src/core/schema-migrations/`, numbered at merge): `access_members.labelled_only` (default false) and the SQL function `gbrain_access_origin_labelled_for()`, which passes a derived page only when it has an origin and every origin names the caller. Nothing is rewritten.
++- `src/core/access/labelled-only.ts`: `gbrain access member labelled-only <id> [on|off]`, local operator only (remote callers get `permission_denied`), never on the owner (`access_labelled_only_owner`, exit 3; `gbrain access owner` refuses a labelled-only member the same way).
++- `src/core/search/private-visibility.ts`: `CallerAccess.labelledOnly` adds one conjunct to every caller page, version and fact filter; derived pages and facts that name nobody fail closed, and under member lineage pass only when every origin names the caller. `src/core/access/caller.ts`, `actor.ts` and `src/cli/as-preview.ts` set it for a labelled-only member, never the owner.
++- Writes: `src/core/persistence/page-visibility.ts` holds a labelled-only writer to the same read rule and refuses a create that would not name it (`access_labelled_only_unnamed`, checked in page preparation, streamed uploads and capture ingest); the enforced member CLI (`src/cli/enforced-member.ts`) does the same.
++- The semantic cache key (`xlo=1`) and the per-caller key (`labelled_only`) separate a labelled-only caller.
++- `gbrain access member list`, `access check` and `who-can-read` report it; doctor `access_labelled_only_members`.
++- Docs: `docs/guides/access-designations.md` (labelled-only members), `docs/guides/error-codes.md`, key-files entry.
++- Tests: `test/access-labelled-only.test.ts` (every read path, derived pages and facts with member lineage off and on, older versions, writes over MCP and in the enforced CLI, the owner and remote refusals, cache keys, check, who-can-read and doctor; PGLite and Postgres, rules in the database and in `access.yml`); migration, catalog and doctor goldens.
++
+ ## [0.60.689.0] - 2026-11-12
+
+ **Three opt-in ways to share what is derived from member-restricted pages: raw-only folder rules, audience members the owner reads, and member lineage reads.** A folder rule kept the summaries, atoms, chronicle events and facts made from its pages as tightly as the pages themselves, so a transcript folder kept to one member hid every summary of those calls from everyone else; a group chat's own memory page was closed to the brain owner; and only the owner could read the derived pages and facts of pages it already reads. Each now has an operator setting, off by default, and nothing changes on upgrade: `gbrain access rule add --raw-only` keeps a folder's pages to its readers but lets whoever reads a derived page read it (use it for transcripts, never for a folder whose content is itself the secret: summaries of a raw-only page, and the facts extracted from it, are readable like any other derived page, so the facts pulled out of a fenced transcript are not fenced); `gbrain access member kind <id> audience` lets the owner read that member's own member page, versions, derived pages and facts; and `gbrain access members-read-lineage on` lets every member read the derived pages and facts of pages it reads, as the owner does. All three work the same on a repo-less brain and with rules in `access.yml`, only the operator on the brain host sets them, and no write widens.
### Itemized changes
diff --cc docs/architecture/key-files/access.md
index 75fd8ccdce,a900fcbf0d..fe3fd73a99
--- a/docs/architecture/key-files/access.md
+++ b/docs/architecture/key-files/access.md
@@@ -3,7 -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`). GST-2490: an owner read (`CallerAccess.lineage` with `owner`, read-only ops only) uses `lineageAccessSql`: the owner's readers and folder rules as for any member, with `gbrain_access_origin_hidden_for()` (v304; per origin `gbrain_access_origin_closed_for()`) in place of the every-caller lineage, so a derivative or fact passes when the owner reads every origin; `ownerReadsRestricted` (config `access.owner_reads_restricted`, `owner.ts` `setOwnerReadsRestricted`, local only) also passes pages kept to other members except another member's own member page and pending coverage. `access check`, `who-can-read`, `whoami` (`ownerReadsRestrictedNotice`) and doctor `access_owner_reads_restricted` report it; test `test/owner-reads-restricted.test.ts` (both engines, database and access.yml rules). GBRA-108 (migration v305, `v305-access-lineage-designs.ts`): `access_rules.covers_derived` (default true) — a raw-only rule (`folder-rules.ts` `covers_derived: false`, `rule add --raw-only`; digest unchanged for covering rules; true→false is the held widening `derived_released`, false→true the narrowing `derived_covered`) is dropped from an origin's rule set by the SQL function `gbrain_access_lineage_rules()` inside `gbrain_access_origin_restricted()` and the 10-argument `gbrain_access_origin_closed_for()`, so it keeps its pages but not their lineage (a page's own readers still close it; fact provenance filters judge with `derived = true`). `access_members.kind` (`person` | `audience`, `members.ts` `setMemberKind`, local only): an owner read carries `CallerAccess.audienceKindMembers`, whose member pages pass the readers test and the member-page exemptions (`audiencePages`, `notOtherMemberPageSql`, the `p_audience_pages` argument of the 9-argument `gbrain_access_origin_hidden_for()`). Config `access.members_read_lineage` (`lineage.ts`, local only) sets `CallerAccess.lineage` for any member read speaking for itself (`caller.ts`; never an audience of several or an unbound credential; `withCallerAccess` drops it for several identities and keeps the owner opt-in and audience members owner-only). Cache keys: `knobsHash` `xol=3` and `xak=`, `callerIdentityKey` `owner_reads`/`audience_kind`. Doctor `access_lineage` (`checks/access-lineage.ts`). Tests: `test/access-raw-only-rules.test.ts`, `test/access-audience-members.test.ts`, `test/access-members-read-lineage.test.ts` (both engines, both stores; fixture `test/helpers/access-lineage-fixture.ts`). GBRA-108 design 1 (migration v306): `access_members.labelled_only` (`labelled-only.ts` `setMemberLabelledOnly`, local only, refused on the owner with `access_labelled_only_owner` from `owner.ts`, which `setOwner` also raises) sets `CallerAccess.labelledOnly` (`caller.ts`, `actor.ts`, `as-preview.ts`; fails closed to true when the table cannot be read). `private-visibility.ts` `labelledOnlySql` ANDs `page_readers && identity OR folder_rule_ids && satisfied` into `callerAccessSql`, `callerReadersAllowedSql` (a snapshot needs its own readers or a rule on the live page) and the fact filters (`labelledOnlyFactSql`: FALSE, or under member lineage a provenance page that passes); under member lineage a derived row may pass through `gbrain_access_origin_labelled_for()` (every origin labelled, none missing). The entity page of a fact is judged by the ordinary policy. Writes: `persistence/page-visibility.ts` (`writerReadPolicySql`, `assertLabelledOnlyCreate` → `access_labelled_only_unnamed`), `cli/enforced-member.ts` `memberPageView`. Cache keys `xlo=1`, `labelled_only`; doctor `access_labelled_only_members` (`checks/access-labelled-only.ts`). Test: `test/access-labelled-only.test.ts` (both engines, both stores). A derivative of a page that names readers is otherwise 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`). GST-2490: an owner read (`CallerAccess.lineage` with `owner`, read-only ops only) uses `lineageAccessSql`: the owner's readers and folder rules as for any member, with `gbrain_access_origin_hidden_for()` (v304; per origin `gbrain_access_origin_closed_for()`) in place of the every-caller lineage, so a derivative or fact passes when the owner reads every origin; `ownerReadsRestricted` (config `access.owner_reads_restricted`, `owner.ts` `setOwnerReadsRestricted`, local only) also passes pages kept to other members except another member's own member page and pending coverage. `access check`, `who-can-read`, `whoami` (`ownerReadsRestrictedNotice`) and doctor `access_owner_reads_restricted` report it; test `test/owner-reads-restricted.test.ts` (both engines, database and access.yml rules). GBRA-108 (migration v305, `v305-access-lineage-designs.ts`): `access_rules.covers_derived` (default true) — a raw-only rule (`folder-rules.ts` `covers_derived: false`, `rule add --raw-only`; digest unchanged for covering rules; true→false is the held widening `derived_released`, false→true the narrowing `derived_covered`) is dropped from an origin's rule set by the SQL function `gbrain_access_lineage_rules()` inside `gbrain_access_origin_restricted()` and the 10-argument `gbrain_access_origin_closed_for()`, so it keeps its pages but not their lineage (a page's own readers still close it; fact provenance filters judge with `derived = true`). `access_members.kind` (`person` | `audience`, `members.ts` `setMemberKind`, local only): an owner read carries `CallerAccess.audienceKindMembers`, whose member pages pass the readers test and the member-page exemptions (`audiencePages`, `notOtherMemberPageSql`, the `p_audience_pages` argument of the 9-argument `gbrain_access_origin_hidden_for()`). Config `access.members_read_lineage` (`lineage.ts`, local only) sets `CallerAccess.lineage` for any member read speaking for itself (`caller.ts`; never an audience of several or an unbound credential; `withCallerAccess` drops it for several identities and keeps the owner opt-in and audience members owner-only). Cache keys: `knobsHash` `xol=3` and `xak=`, `callerIdentityKey` `owner_reads`/`audience_kind`. Doctor `access_lineage` (`checks/access-lineage.ts`). Tests: `test/access-raw-only-rules.test.ts`, `test/access-audience-members.test.ts`, `test/access-members-read-lineage.test.ts` (both engines, both stores; fixture `test/helpers/access-lineage-fixture.ts`). A derivative of a page that names readers is otherwise 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/` (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`). GST-2490: an owner read (`CallerAccess.lineage` with `owner`, read-only ops only) uses `lineageAccessSql`: the owner's readers and folder rules as for any member, with `gbrain_access_origin_hidden_for()` (v304; per origin `gbrain_access_origin_closed_for()`) in place of the every-caller lineage, so a derivative or fact passes when the owner reads every origin; `ownerReadsRestricted` (config `access.owner_reads_restricted`, `owner.ts` `setOwnerReadsRestricted`, local only) also passes pages kept to other members except another member's own member page and pending coverage. `access check`, `who-can-read`, `whoami` (`ownerReadsRestrictedNotice`) and doctor `access_owner_reads_restricted` report it; test `test/owner-reads-restricted.test.ts` (both engines, database and access.yml rules). GBRA-108 (migration v305, `v305-access-lineage-designs.ts`): `access_rules.covers_derived` (default true) — a raw-only rule (`folder-rules.ts` `covers_derived: false`, `rule add --raw-only`; digest unchanged for covering rules; true→false is the held widening `derived_released`, false→true the narrowing `derived_covered`) is dropped from an origin's rule set by the SQL function `gbrain_access_lineage_rules()` inside `gbrain_access_origin_restricted()` and the 10-argument `gbrain_access_origin_closed_for()`, so it keeps its pages but not their lineage (a page's own readers still close it; fact provenance filters judge with `derived = true`). `access_members.kind` (`person` | `audience`, `members.ts` `setMemberKind`, local only): an owner read carries `CallerAccess.audienceKindMembers`, whose member pages pass the readers test and the member-page exemptions (`audiencePages`, `notOtherMemberPageSql`, the `p_audience_pages` argument of the 9-argument `gbrain_access_origin_hidden_for()`). Config `access.members_read_lineage` (`lineage.ts`, local only) sets `CallerAccess.lineage` for any member read speaking for itself (`caller.ts`; never an audience of several or an unbound credential; `withCallerAccess` drops it for several identities and keeps the owner opt-in and audience members owner-only). Cache keys: `knobsHash` `xol=3` and `xak=`, `callerIdentityKey` `owner_reads`/`audience_kind`. Doctor `access_lineage` (`checks/access-lineage.ts`). Tests: `test/access-raw-only-rules.test.ts`, `test/access-audience-members.test.ts`, `test/access-members-read-lineage.test.ts` (both engines, both stores; fixture `test/helpers/access-lineage-fixture.ts`). GBRA-108 design 1 (the labelled-only migration, `schema-migrations/v*-access-labelled-only.ts`): `access_members.labelled_only` (`labelled-only.ts` `setMemberLabelledOnly`, local only, refused on the owner with `access_labelled_only_owner` from `owner.ts`, which `setOwner` also raises) sets `CallerAccess.labelledOnly` (`caller.ts`, `actor.ts`, `as-preview.ts`; fails closed to true when the table cannot be read). `private-visibility.ts` `labelledOnlySql` ANDs `page_readers && identity OR folder_rule_ids && satisfied` into `callerAccessSql`, `callerReadersAllowedSql` (a snapshot needs its own readers or a rule on the live page) and the fact filters (`labelledOnlyFactSql`: FALSE, or under member lineage a provenance page that passes); under member lineage a derived row may pass through `gbrain_access_origin_labelled_for()` (every origin labelled, none missing). The entity page of a fact is judged by the ordinary policy. Writes: `persistence/page-visibility.ts` (`writerReadPolicySql`, `remoteLabelsChecked` → `assertLabelledOnlyCreate` → `access_labelled_only_unnamed`), `cli/enforced-member.ts` `memberPageView`. Cache keys `xlo=1`, `labelled_only`; doctor `access_labelled_only_members` (`checks/access-labelled-only.ts`). Test: `test/access-labelled-only.test.ts` (both engines, both stores). A derivative of a page that names readers is otherwise 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 --cc scripts/postgres-arm-weights.json
index 5e08b4c701,87f4f3593f..fb35d14640
--- a/scripts/postgres-arm-weights.json
+++ b/scripts/postgres-arm-weights.json
@@@ -1,574 -1,675 +1,676 @@@
{
- "test/access-as.test.ts": 4248,
- "test/access-binding.test.ts": 8986,
- "test/access-folder-lock-order.test.ts": 2090,
- "test/access-folder-multiconn.test.ts": 3239,
- "test/access-folder-rules.test.ts": 19259,
- "test/access-folder-scoped-role.test.ts": 5774,
- "test/access-members.test.ts": 4638,
- "test/access-on-behalf-of.test.ts": 31443,
- "test/access-page-indexes-online.test.ts": 5117,
- "test/access-writes.test.ts": 9810,
- "test/activation-unbound-rooted-6449.test.ts": 7632,
- "test/alias-source-cascade-5094.test.ts": 15465,
- "test/attribution-backfill-history.test.ts": 31564,
- "test/backstop-same-page-shadow-managed-6333.test.ts": 9978,
- "test/behavior-change-notice.test.ts": 12747,
- "test/belief-ledger-append-owner.test.ts": 22282,
- "test/belief-ledger-coverage.test.ts": 155909,
- "test/belief-ledger-group.test.ts": 32880,
- "test/belief-ledger-identity.test.ts": 55793,
- "test/belief-ledger-lifecycle.test.ts": 54929,
- "test/belief-ledger-page-at-time.test.ts": 71367,
- "test/belief-ledger-privacy.test.ts": 26881,
- "test/belief-ledger-purge-review.test.ts": 192959,
- "test/belief-ledger-purge.test.ts": 118158,
- "test/belief-ledger-restore.test.ts": 146417,
- "test/belief-ledger-touched.test.ts": 50106,
- "test/belief-ledger-trust.test.ts": 17875,
- "test/belief-ledger-w5-time-model.test.ts": 23674,
- "test/belief-ledger-weekly-diff.test.ts": 122277,
- "test/belief-ledger-weekly-probes.test.ts": 35349,
- "test/capacity-bounded-read-6803.test.ts": 8117,
- "test/capture-consent-admission.test.ts": 10544,
- "test/capture-dispatch-provenance-6524.test.ts": 8537,
- "test/chronicle-backfill-max-usd.test.ts": 6590,
- "test/claim-fifo-foreground-waiting.test.ts": 6792,
- "test/claim-lease-holder-only-6712.test.ts": 5726,
- "test/claude-cli-output-cap.test.ts": 6085,
- "test/cli-page-writes.test.ts": 179339,
- "test/colon-slug-windows-5032.test.ts": 8539,
- "test/company-brain-policy.test.ts": 17848,
- "test/company-brain-runtime.test.ts": 34969,
- "test/consolidate-fenced-close-reimport.test.ts": 13421,
- "test/consolidate-same-instant-6023.test.ts": 17847,
- "test/contact-rows-drift-8109.test.ts": 13000,
- "test/conversation-facts-outcome-marker-purge-7778.test.ts": 17532,
- "test/conversation-facts-oversized-sidecar.test.ts": 6072,
- "test/conversation-facts-purged-claim-7438.test.ts": 14149,
- "test/cycle/derived-write-through-commit.test.ts": 69983,
- "test/cycle/dream-reverse-write-commit.test.ts": 41563,
- "test/cycle/synthesize-concepts-merge.test.ts": 7620,
- "test/db-lock-reconnect.test.ts": 6124,
- "test/decide/conflict-proposals-managed.test.ts": 7791,
- "test/declared-lineage-visibility.test.ts": 6655,
- "test/derived-link-reconciliation.test.ts": 8296,
- "test/direct-pool-profile.test.ts": 11633,
- "test/doctor-frontmatter-holds.test.ts": 12424,
- "test/doctor-image-embedding-coverage.test.ts": 7424,
- "test/doctor-keyword-plan-6495.test.ts": 4748,
- "test/doctor-routing-skill-pack-source.test.ts": 5806,
- "test/doctor-sync-freshness-skill-pack-6076.test.ts": 6410,
- "test/embed-once-per-content-version.serial.test.ts": 15853,
- "test/embed-stale-images-managed-6529.test.ts": 8505,
- "test/embedding-completion-atomic.serial.test.ts": 7971,
- "test/engine-sql-facts-keyset.test.ts": 6073,
- "test/extract-all-stamp-intersection.serial.test.ts": 8177,
- "test/extract-atoms-input-truncated-6503.test.ts": 13765,
- "test/extract-atoms-raised-cap-drain-7391.test.ts": 13495,
- "test/extract-endpoint-revision.serial.test.ts": 9825,
- "test/extract-entities-managed.test.ts": 44168,
- "test/extract-timeline-from-meetings-managed.test.ts": 22850,
- "test/extraction-watermark-atoms.test.ts": 7760,
- "test/fact-embedding-oversized-7211.test.ts": 6749,
- "test/fact-fence-adoption-exits.test.ts": 41247,
- "test/fact-purge-lookup-timeout-6511.test.ts": 6440,
- "test/facts-absorb-stalled-receipt-7439.test.ts": 19384,
- "test/facts-entity-moved-7602.test.ts": 242296,
- "test/facts-insert-guards-7105.test.ts": 15666,
- "test/facts-publication-large-fence-6898.test.ts": 45303,
- "test/facts-subject-infer-7405.test.ts": 7124,
- "test/fence-fact-append.test.ts": 38939,
- "test/fence-repair-receipts.test.ts": 13410,
- "test/fenced-embed-reuse-6961.test.ts": 5786,
- "test/file-drift-soft-delete-hold-release-gbra133.test.ts": 14597,
- "test/forecast-journal.test.ts": 38616,
- "test/frontmatter-reserved-keys-6454.test.ts": 10521,
- "test/get-chunks-paging.test.ts": 6060,
- "test/git-canonical-conversion-g8a.test.ts": 324022,
- "test/git-canonical-conversion-live-writer.test.ts": 23957,
- "test/git-canonical-conversion-no-checkout-7885.test.ts": 23816,
- "test/git-canonical-conversion-progress.test.ts": 192500,
- "test/git-canonical-conversion-strict-pass-7866.test.ts": 145995,
- "test/git-canonical-declared-g7a.test.ts": 87613,
- "test/git-canonical-indexer-g3.test.ts": 57519,
- "test/git-door-index-lock-7742.test.ts": 16992,
- "test/git-door-planned-state.test.ts": 55820,
- "test/git-door-plumbing-gbra133.test.ts": 7387,
- "test/git-door-remote-g7b.test.ts": 54029,
- "test/git-door-strict-gbra133.test.ts": 62186,
- "test/git-door-write-cost.test.ts": 23013,
- "test/git-gap-census.test.ts": 9086,
- "test/google-connector-facts-fence-7292.test.ts": 16185,
- "test/grade-takes-window.test.ts": 5701,
- "test/graduation-copy.test.ts": 90741,
- "test/graduation-digest.test.ts": 3283,
- "test/graduation-drain.test.ts": 13520,
- "test/graduation-inventory.test.ts": 5968,
- "test/graduation-rollback.test.ts": 152413,
- "test/graduation-state.test.ts": 192327,
- "test/graduation-target.test.ts": 4517,
- "test/graduation-verify-sync-freshness.test.ts": 6529,
- "test/graduation-verify.test.ts": 16643,
- "test/grandfather-managed.test.ts": 38572,
- "test/harness-skills-epoch.test.ts": 4613,
- "test/held-read-signals.test.ts": 10911,
- "test/hermes-clarify-transcripts-7396.test.ts": 6213,
- "test/hold-action-chain-6712.test.ts": 24596,
- "test/hosted-repo-g7b2.test.ts": 59247,
- "test/import-file-result-callback-gbra130.test.ts": 7873,
- "test/import-frontmatter-key-order-5158.test.ts": 5521,
- "test/import-inline-chunk-keep.test.ts": 6391,
- "test/import-revision-concurrency.test.ts": 6744,
- "test/init-cold-home-embedding.test.ts": 37969,
- "test/keyword-statement-timeout-knob-6495.test.ts": 13393,
- "test/keyword-timeout-negative-cache-6495.test.ts": 5890,
- "test/lane-apply-pipelining.test.ts": 5881,
- "test/large-pages/append-concurrency.test.ts": 41890,
- "test/large-pages/append-cost.test.ts": 61736,
- "test/large-pages/append-mention-links.test.ts": 24074,
- "test/large-pages/chunk-retirement-plan.test.ts": 9659,
- "test/large-pages/chunk-visibility.test.ts": 7091,
- "test/large-pages/contextual-reembed-segmented.test.ts": 8606,
- "test/large-pages/credential-reseal-segments.test.ts": 7807,
- "test/large-pages/doctor-skipped-segmented.test.ts": 16756,
- "test/large-pages/edit-segmented.test.ts": 53503,
- "test/large-pages/forget-reason-segmented.test.ts": 7501,
- "test/large-pages/forget-scope.test.ts": 27951,
- "test/large-pages/gbra117-segmented-classes-window.test.ts": 78658,
- "test/large-pages/held-budget-count-list.test.ts": 12092,
- "test/large-pages/held-budget-shrink.test.ts": 12640,
- "test/large-pages/managed-import-outside-root.test.ts": 25611,
- "test/large-pages/managed-import-projection-pending.test.ts": 73939,
- "test/large-pages/managed-links-timeline-heap.test.ts": 40393,
- "test/large-pages/managed-streamed-import.test.ts": 73287,
- "test/large-pages/managed-sync-segmented-rename.test.ts": 23663,
- "test/large-pages/managed-sync-streamed.test.ts": 124040,
- "test/large-pages/oversized-backfill-segmented.test.ts": 7913,
- "test/large-pages/page-purge-segments.test.ts": 40070,
- "test/large-pages/pinned-segmented-reads.test.ts": 43782,
- "test/large-pages/projection-claim-ownership.test.ts": 33904,
- "test/large-pages/projection-demotion-race.test.ts": 7014,
- "test/large-pages/projection-lock-hold.test.ts": 66150,
- "test/large-pages/projection-parity.test.ts": 68291,
- "test/large-pages/publication-seal-bounded.test.ts": 29448,
- "test/large-pages/purge-fact-inflight-staging.test.ts": 18967,
- "test/large-pages/purge-fact-segmented-preimage.test.ts": 25166,
- "test/large-pages/purge-inflight-create.test.ts": 10022,
- "test/large-pages/purge-replay-segments.test.ts": 11689,
- "test/large-pages/purge-segment-residue.test.ts": 8653,
- "test/large-pages/purge-segmented-versions-batch.test.ts": 13503,
- "test/large-pages/purge-segments.test.ts": 11475,
- "test/large-pages/recovery-budget-ceiling.slow.test.ts": 261998,
- "test/large-pages/recovery-budget-default.test.ts": 10949,
- "test/large-pages/remote-get-page-privacy.test.ts": 70483,
- "test/large-pages/remote-versions-storage-change.test.ts": 10674,
- "test/large-pages/remote-window-privacy.test.ts": 55798,
- "test/large-pages/restore-deferred-retire.test.ts": 33943,
- "test/large-pages/restore-publication-statement-bound.test.ts": 36444,
- "test/large-pages/restore-segmented-reprojects.test.ts": 98160,
- "test/large-pages/sealed-segmented-search.test.ts": 18768,
- "test/large-pages/second-write-deferred-retire.test.ts": 12444,
- "test/large-pages/segment-rewrite-cr-tier.test.ts": 13075,
- "test/large-pages/segment-vector-reuse.test.ts": 5651,
- "test/large-pages/segmented-append-reembed.test.ts": 9009,
- "test/large-pages/segmented-body-unreachable.test.ts": 6033,
- "test/large-pages/segmented-bom.test.ts": 19171,
- "test/large-pages/segmented-conversation-facts.test.ts": 56688,
- "test/large-pages/segmented-conversation-sidecar-token.test.ts": 30393,
- "test/large-pages/segmented-core-list.test.ts": 37815,
- "test/large-pages/segmented-create-searchable.test.ts": 32027,
- "test/large-pages/segmented-delete-crash.slow.test.ts": 69766,
- "test/large-pages/segmented-delete-restore-file.slow.test.ts": 155030,
- "test/large-pages/segmented-delete-stage-crash.slow.test.ts": 201193,
- "test/large-pages/segmented-derived-parity.test.ts": 17616,
- "test/large-pages/segmented-derived-passes.test.ts": 21486,
- "test/large-pages/segmented-derived-work.test.ts": 102073,
- "test/large-pages/segmented-embedding-paths.test.ts": 44235,
- "test/large-pages/segmented-embedding.test.ts": 6922,
- "test/large-pages/segmented-evidence-read-cost.test.ts": 41343,
- "test/large-pages/segmented-evidence.test.ts": 49068,
- "test/large-pages/segmented-extraction-stale.test.ts": 10954,
- "test/large-pages/segmented-facts-forced-lines.test.ts": 14322,
- "test/large-pages/segmented-facts-reconcile.test.ts": 106143,
- "test/large-pages/segmented-file-drift-ledger.test.ts": 47218,
- "test/large-pages/segmented-file-drift.test.ts": 120471,
- "test/large-pages/segmented-forced-cuts.test.ts": 80703,
- "test/large-pages/segmented-frontmatter-reimport.test.ts": 39208,
- "test/large-pages/segmented-get-cli.test.ts": 25145,
- "test/large-pages/segmented-get-page-parity.test.ts": 24029,
- "test/large-pages/segmented-leads.test.ts": 18852,
- "test/large-pages/segmented-loser-chunks.test.ts": 10420,
- "test/large-pages/segmented-maintenance-commands.test.ts": 13736,
- "test/large-pages/segmented-prior-view.test.ts": 13608,
- "test/large-pages/segmented-read-refusals.test.ts": 13039,
- "test/large-pages/segmented-real-size.slow.test.ts": 59468,
- "test/large-pages/segmented-remember-refusal.test.ts": 30347,
- "test/large-pages/segmented-repair-scans.test.ts": 16459,
- "test/large-pages/segmented-retained-blocks.test.ts": 60672,
- "test/large-pages/segmented-search-dedup.test.ts": 14470,
- "test/large-pages/segmented-semantic-writes-near-ceiling.slow.test.ts": 132014,
- "test/large-pages/segmented-semantic-writes.test.ts": 74547,
- "test/large-pages/segmented-shrink-below-ceiling.test.ts": 98505,
- "test/large-pages/segmented-storage-visibility.test.ts": 25589,
- "test/large-pages/segmented-sweep-budget.test.ts": 30452,
- "test/large-pages/segmented-sweep-deferral.test.ts": 18795,
- "test/large-pages/segmented-switch.test.ts": 37646,
- "test/large-pages/segmented-think-compile-leads.serial.test.ts": 12090,
- "test/large-pages/segmented-timeline-heap.test.ts": 68179,
- "test/large-pages/segmented-timeline-retract-versions.test.ts": 10186,
- "test/large-pages/segmented-versions.test.ts": 9376,
- "test/large-pages/segmented-withdrawal-mirror.test.ts": 300865,
- "test/large-pages/segmented-withdrawn-fence-delete.test.ts": 67821,
- "test/large-pages/streamed-import-drift.test.ts": 32554,
- "test/large-pages/streamed-sync-origin-b14.test.ts": 86851,
- "test/large-pages/stuck-recovery-large.slow.test.ts": 197254,
- "test/large-pages/timeline-top-insert-reembed.test.ts": 10532,
- "test/large-pages/upload-binding.test.ts": 8869,
- "test/large-pages/upload-over-ceiling.test.ts": 177207,
- "test/large-pages/upload-provenance-7873.test.ts": 52494,
- "test/large-pages/upload-review.test.ts": 8547,
- "test/large-pages/v252-master-reader-compat.test.ts": 8358,
- "test/link-cross-source.test.ts": 20870,
- "test/link-preparation-shared-index.test.ts": 12341,
- "test/links-attendance-blocked.test.ts": 11280,
- "test/links-extraction-yield.test.ts": 8093,
- "test/list-jobs-row-bound.test.ts": 9214,
- "test/maintenance-lowering-7917-7918.test.ts": 23445,
- "test/maintenance-trust-marker-7905.test.ts": 31511,
- "test/managed-cycle-pull-upstream.test.ts": 9471,
- "test/managed-facts-withdrawal-recovery-6506.test.ts": 10944,
- "test/managed-facts-withdrawn-skip-6506.test.ts": 8919,
- "test/managed-lint.test.ts": 14254,
- "test/managed-maintenance-links.test.ts": 10563,
- "test/managed-root-aliases-7203.test.ts": 35481,
- "test/managed-root-marker-enclosing-7988.test.ts": 10336,
- "test/managed-sweep-corpus-windows.test.ts": 10174,
- "test/managed-sweep-refused-window-retry.test.ts": 15254,
- "test/managed-sweep-timeline.test.ts": 8380,
- "test/managed-sync-blocked-job-6858.test.ts": 7771,
- "test/managed-sync-bulk.test.ts": 227409,
- "test/managed-sync-checkpoint-controls-company.test.ts": 8911,
- "test/managed-sync-chunker-version.test.ts": 7941,
- "test/managed-sync-concurrent-write-hold.test.ts": 19731,
- "test/managed-sync-connection-loss.test.ts": 12687,
- "test/managed-sync-drain.test.ts": 11525,
- "test/managed-sync-foreground-priority.test.ts": 87859,
- "test/managed-sync-gate-markers-6858.test.ts": 9054,
- "test/managed-sync-group-completion.test.ts": 15123,
- "test/managed-sync-group-uncommitted-head.test.ts": 44557,
- "test/managed-sync-images-5493.test.ts": 14158,
- "test/managed-sync-keep-disk-6858.test.ts": 31343,
- "test/managed-sync-lanes.test.ts": 32614,
- "test/managed-sync-orphans-incarnation-6518.test.ts": 6088,
- "test/managed-sync-page-fault-holds.test.ts": 28910,
- "test/managed-sync-pinned-reads.test.ts": 37495,
- "test/managed-sync-preparation-stalled-holds.test.ts": 112711,
- "test/managed-sync-row-parity.test.ts": 12767,
- "test/managed-sync-stale-group-head.test.ts": 9392,
- "test/mcp-sources-not-readable.test.ts": 7613,
- "test/member-read-access.test.ts": 51181,
- "test/migration-0-53-host-move-7900.test.ts": 22008,
- "test/migration-persistence-foreground-committed-index.test.ts": 6968,
- "test/migration-persistence-request-id-index.test.ts": 7358,
- "test/migration-persistence-request-slug-index.test.ts": 10138,
- "test/notifier-passed-freshness-marker-7941.test.ts": 34780,
- "test/on-commit-embedding.serial.test.ts": 14329,
- "test/oneshot-consumer-direct-route.test.ts": 6244,
- "test/oneshot-housekeeping-cli.test.ts": 16296,
- "test/origin-guard-6948.test.ts": 10295,
- "test/origin-twin-sequence-7150.test.ts": 10236,
- "test/origin-twins-6948.test.ts": 7062,
- "test/orphan-effect-diagnostics-7985.test.ts": 13479,
- "test/overwritten-edits-6712.test.ts": 52791,
- "test/owner-refusal.test.ts": 8348,
- "test/pack-relation-direction-engine.test.ts": 9605,
- "test/page-embedding-budget.test.ts": 7430,
- "test/page-embedding-content-validity.test.ts": 8195,
- "test/page-embedding-install-batch.test.ts": 6140,
- "test/page-embedding-lease.serial.test.ts": 11874,
- "test/page-prepare-shared-origin-6517.test.ts": 15070,
- "test/page-purge-batch-sweep-6884.test.ts": 10753,
- "test/page-purge-journal-timeout-6511.test.ts": 24185,
- "test/page-spend-reservation.test.ts": 7125,
- "test/page-state-engine.test.ts": 6375,
- "test/pages-source-created-idx-7379.test.ts": 7033,
- "test/pages-status-7179.test.ts": 20662,
- "test/pathological/a-36-facts-batch-partial-refusal.test.ts": 11598,
- "test/pathological/a-42-atom-dot-led-slug.test.ts": 14639,
- "test/pathological/a-51-conversation-batch-booking.test.ts": 15175,
- "test/pathological/a-60-belief-commit-mark.test.ts": 7467,
- "test/pathological/a-65-captured-facts-unreadable-corpus.test.ts": 4910,
- "test/pathological/a1-links-extract.test.ts": 56065,
- "test/pathological/a10-global-maintenance-stamp.test.ts": 7452,
- "test/pathological/a11-effect-retry-budget.test.ts": 48705,
- "test/pathological/a12-withdrawal-mirror-gate.test.ts": 104796,
- "test/pathological/a13-embedding-target-park.test.ts": 44269,
- "test/pathological/a15-deactivate-exits.test.ts": 14178,
- "test/pathological/a18-ledger-path-text.test.ts": 62350,
- "test/pathological/a2-transcripts-ingest.test.ts": 99826,
- "test/pathological/a21-facts-expire-deleted.test.ts": 53654,
- "test/pathological/a22-consolidate-buckets.test.ts": 44376,
- "test/pathological/a23-patterns-grounding.test.ts": 91829,
- "test/pathological/a24-phantom-redirect-cursor.test.ts": 46489,
- "test/pathological/a25-propose-takes-poison-pages.test.ts": 44851,
- "test/pathological/a26-safe-chunks-reseal.test.ts": 9754,
- "test/pathological/a27-credential-reseal.test.ts": 9717,
- "test/pathological/a3-google-items.test.ts": 112750,
- "test/pathological/a30-watchdog-attribution.test.ts": 7542,
- "test/pathological/a31-migrate-loop-rows.serial.test.ts": 43781,
- "test/pathological/a4-synthesize-postprocess.test.ts": 16356,
- "test/pathological/a41-maintain-sources.test.ts": 41503,
- "test/pathological/a44-slug-conflicts-rotation.test.ts": 60045,
- "test/pathological/a45-repair-all-kinds.test.ts": 6753,
- "test/pathological/a46-content-lane-kinds.test.ts": 6712,
- "test/pathological/a47-backfill-poison-row.test.ts": 7386,
- "test/pathological/a49-unmanaged-purge-tombstones.test.ts": 60200,
- "test/pathological/a50-unmanaged-expired-sources.test.ts": 6376,
- "test/pathological/a9-repair-core.test.ts": 6205,
- "test/pathological/b-10-ontology-rekey-collision.test.ts": 6456,
- "test/pathological/b-7-facts-pageless-entity.test.ts": 20059,
- "test/pathological/b-9-enrich-retired-alias.test.ts": 6523,
- "test/pathological/b12-slug-segment-bytes.test.ts": 27884,
- "test/pathological/b5-enrich-entity-identity.test.ts": 7748,
- "test/pathological/b5-export-unsafe-slugs.test.ts": 37019,
- "test/pathological/b6-triage-verdict-surrogate.test.ts": 7544,
- "test/pathological/c-23-override-and-doctor-fixes.test.ts": 6175,
- "test/pathological/c-9-facts-absorb-dead.test.ts": 10659,
- "test/pathological/c1-effect-stuck-recovery.test.ts": 56460,
- "test/pathological/c2-url-clone-fences.test.ts": 85845,
- "test/pathological/c22-stuck-recovery-large-file.test.ts": 33799,
- "test/pathological/c4-bundle-stuck-recovery.test.ts": 156294,
- "test/pathological/c5-writer-transfer-cancel.test.ts": 40292,
- "test/pathological/c7-content-receipt-root.test.ts": 49989,
- "test/pathological/d1-unfenced-facts-overwrite.test.ts": 44743,
- "test/pathological/d10-derived-atom-file-overwrite.test.ts": 33603,
- "test/pathological/d11-derived-retired-atom-unlink.test.ts": 26615,
- "test/pathological/d12-concept-stale-fences.test.ts": 34047,
- "test/pathological/d13-concept-occupied-path.test.ts": 31743,
- "test/pathological/d14-brainstorm-resume-overwrite.test.ts": 26364,
- "test/pathological/d15-sync-reexport-overwrite.test.ts": 41118,
- "test/pathological/d16-google-file-replacement.test.ts": 54881,
- "test/pathological/d17-github-file-replacement.test.ts": 51760,
- "test/pathological/d18-think-take-db-only.test.ts": 47829,
- "test/pathological/d19-takes-bootstrap-db-only.test.ts": 29054,
- "test/pathological/d2-fence-write-overwrite.test.ts": 45686,
- "test/pathological/d21-migration-verifier-record.test.ts": 101449,
- "test/pathological/d22-legacy-hash-body-history.test.ts": 76838,
- "test/pathological/d23-extract-atoms-db-only.test.ts": 55121,
- "test/pathological/d3-forget-overwrite.test.ts": 78608,
- "test/pathological/d4-proposal-overwrite.test.ts": 108053,
- "test/pathological/d5-phantom-canonical-overwrite.test.ts": 37738,
- "test/pathological/d6-phantom-file-unlink.test.ts": 26046,
- "test/pathological/d7-synthesize-reverse-write.test.ts": 50592,
- "test/pathological/d8-patterns-reverse-write.test.ts": 44116,
- "test/pathological/d9-dream-summary-overwrite.test.ts": 30441,
- "test/pathological/facts-mirror-failures.test.ts": 81635,
- "test/pathological/g0-derived-retirement-hold.test.ts": 17704,
- "test/pathological/g1-atom-generations.test.ts": 19606,
- "test/pathological/g1-generation-crash.test.ts": 37825,
- "test/pathological/g1-generation-probes.test.ts": 46801,
- "test/pathological/g1-generations.test.ts": 59878,
- "test/pathological/h1-zero-yield-atom-reextract.test.ts": 20941,
- "test/pathological/h2-git-effect-moved-remote.test.ts": 18778,
- "test/pathological/h3-chronicle-partial-generation.test.ts": 68975,
- "test/pathological/h4-conversation-facts-zero-yield.test.ts": 76829,
- "test/pathological/h5-atoms-restore.test.ts": 27082,
- "test/pathological/lp-a-segmented-mirror.test.ts": 85163,
- "test/pathological/lp-b-transient-retry-budget.test.ts": 91353,
- "test/pathological/lp-c-publication-ceiling-retry.test.ts": 101339,
- "test/pathological/lp-d-recovery-version.test.ts": 17210,
- "test/pathological/lp-d-segmented-mirror-gate.test.ts": 20635,
- "test/pathological/lp-f-split-fence-withdrawal-capacity.test.ts": 8831,
- "test/pathological/lp-g-file-digest-fence-bound.test.ts": 34170,
- "test/pathological/lp-h-purge-orphan-segment-text.test.ts": 57857,
- "test/pathological/w1-write-through-staging-window.serial.test.ts": 13712,
- "test/persistence-background-pause.test.ts": 6914,
- "test/persistence-bounded-read-session.test.ts": 9868,
- "test/persistence-capacity-forecast.test.ts": 11632,
- "test/persistence-capacity-notices.test.ts": 9219,
- "test/persistence-commit-durability.test.ts": 5793,
- "test/persistence-deactivate.test.ts": 26993,
- "test/persistence-diagnostics.test.ts": 8802,
- "test/persistence-edit-embedding-reuse.test.ts": 7376,
- "test/persistence-effect-claim-loss.test.ts": 29409,
- "test/persistence-embedding-noop-settle.test.ts": 10015,
- "test/persistence-file-import.test.ts": 39692,
- "test/persistence-git-subdir-origin.test.ts": 16165,
- "test/persistence-graph-publication.test.ts": 7172,
- "test/persistence-history-fixture.test.ts": 43263,
- "test/persistence-image-import.serial.test.ts": 8397,
- "test/persistence-import-batch.test.ts": 27950,
- "test/persistence-managed-lifecycle.test.ts": 26819,
- "test/persistence-managed-sync.test.ts": 194672,
- "test/persistence-manifest-git-scope.test.ts": 8810,
- "test/persistence-memory-mutations.test.ts": 11801,
- "test/persistence-owner-activity.test.ts": 6230,
- "test/persistence-page-authority.test.ts": 7363,
- "test/persistence-physical-root-device.test.ts": 8707,
- "test/persistence-preactivation-claim.test.ts": 8971,
- "test/persistence-publication-deadline.test.ts": 19946,
- "test/persistence-receipt-true-up.test.ts": 9477,
- "test/persistence-reconcile-git-dirty-6138.test.ts": 5957,
- "test/persistence-skill-bundles.serial.test.ts": 7659,
- "test/persistence-skill-crash.slow.test.ts": 64022,
- "test/persistence-skip-cost.test.ts": 7725,
- "test/persistence-sync-cursor-options.test.ts": 8939,
- "test/persistence-sync-cursor-strategy-6696.test.ts": 7456,
- "test/persistence-sync-fence-holds.test.ts": 32312,
- "test/persistence-sync-holds.test.ts": 38608,
- "test/persistence-sync-lease.test.ts": 35108,
- "test/persistence-sync-metafile-pages.test.ts": 9189,
- "test/persistence-write-interrupted.test.ts": 82294,
- "test/persistence-write-stall.test.ts": 8324,
- "test/persistence-writer-fences.test.ts": 7058,
- "test/physical-root-birth-tolerance-6501.test.ts": 12200,
- "test/provenance-drift-7891.test.ts": 81164,
- "test/provenance-stamps-7873.test.ts": 81264,
- "test/purge-fact.test.ts": 11196,
- "test/purge-global-marker.test.ts": 7870,
- "test/purge-missing-cache-6911.test.ts": 11652,
- "test/purge-read-surfaces.test.ts": 18926,
- "test/purge-sync-tombstone-hold-7130.test.ts": 56299,
- "test/read-meta-diag.test.ts": 6563,
- "test/recall-page-fill.test.ts": 10828,
- "test/receipt-compaction-newest-sync-gbra130.test.ts": 7554,
- "test/reconcile-clears-stalled-hold-7364.test.ts": 14827,
- "test/remediation-manual-only.test.ts": 9108,
- "test/remember-batch-entity-7432.test.ts": 8927,
- "test/repair-apply-pending-6543.test.ts": 75562,
- "test/repair-database-stop-gbra133.test.ts": 6646,
- "test/repair-embedding-effects.test.ts": 10067,
- "test/repair-failed-writes-conflict-6429.test.ts": 7881,
- "test/repair-failed-writes-drift-w411.test.ts": 11032,
- "test/repair-fences.test.ts": 31234,
- "test/repair-file-drift-consumer-env-7506.test.ts": 49392,
- "test/repair-file-drift-deleted-6712.test.ts": 15419,
- "test/repair-file-drift-held-6712.test.ts": 15869,
- "test/repair-file-drift-held-window-gbra133.test.ts": 43708,
- "test/repair-file-drift-provenance-gbra133.test.ts": 13414,
- "test/repair-frontmatter-keys-sweep-6454.test.ts": 8781,
- "test/repair-frontmatter.test.ts": 24112,
- "test/repair-ghost-database-ahead-gbra133.test.ts": 8375,
- "test/repair-quoted-markers-8059.test.ts": 15758,
- "test/repair-receipt-compaction.test.ts": 7458,
- "test/repair-rename-identity-6729.test.ts": 22071,
- "test/repair-secret-spans.test.ts": 15958,
- "test/retrieval-coverage-notices.test.ts": 9375,
- "test/schema-missing-tables.test.ts": 6269,
- "test/schema-replay-deadlock-6143.test.ts": 7950,
- "test/scripts/test-stress-postgres.test.ts": 12943,
- "test/search-entity-facts-eligibility.test.ts": 7652,
- "test/search-read-keyword-bound.test.ts": 4474,
- "test/search-remote-page-cap.test.ts": 10516,
- "test/search-transcript-quote-8384.test.ts": 8944,
- "test/search-transcript-quote-8384b.test.ts": 10876,
- "test/search-transcript-quote-budget.test.ts": 7297,
- "test/search-transcript-quote-coverage.test.ts": 19376,
- "test/search-transcript-quote-followups.test.ts": 9887,
- "test/search-transcript-quote-legacy-claim.test.ts": 6599,
- "test/search-transcript-quote-tiers.test.ts": 13849,
- "test/search-transcript-quote.test.ts": 6767,
- "test/search-vector-scope-parity.test.ts": 12438,
- "test/search/page-rank-cut.test.ts": 15083,
- "test/search/rerank-gate-hybrid.test.ts": 8648,
- "test/search/rerank-gate-telemetry.test.ts": 4914,
- "test/serve-head-watcher-managed.serial.test.ts": 9587,
- "test/shared-content-freshness.test.ts": 9391,
- "test/shared-skills-catalog.test.ts": 60334,
- "test/shared-skills-retention-capacity.test.ts": 8400,
- "test/shared-skills-source-opt-out.test.ts": 5730,
- "test/shared-skills-writer-boundary.test.ts": 24251,
- "test/source-lifecycle-dry-run-physical-root-6849.test.ts": 5626,
- "test/source-retire-missing-checkout.test.ts": 7728,
- "test/source-row-diagnostics.test.ts": 6360,
- "test/sources-resolve-path.test.ts": 15171,
- "test/stats-health-source-scope.test.ts": 6910,
- "test/sync-absent-from-worktree-s27.test.ts": 24424,
- "test/sync-admission-6712.test.ts": 5587,
- "test/sync-apply-held-deletions-gbra133.test.ts": 9613,
- "test/sync-capacity-preflight.test.ts": 8033,
- "test/sync-checkpoint-moved-6834.test.ts": 9966,
- "test/sync-classic-drift-7199.test.ts": 16489,
- "test/sync-discovery-legacy-origin-7130.test.ts": 7661,
- "test/sync-drain-claims.test.ts": 14777,
- "test/sync-drain-effect-recovery-blocked.test.ts": 9734,
- "test/sync-drain-head-blocked-6543.test.ts": 5849,
- "test/sync-drain-inpass-stall.test.ts": 7077,
- "test/sync-drain-write-capacity.test.ts": 11888,
- "test/sync-dry-run-drain-7167.test.ts": 6447,
- "test/sync-exits-l4-6712.test.ts": 10049,
- "test/sync-fenced-slices-gbra133.test.ts": 26741,
- "test/sync-file-drift-agrees-7931.test.ts": 23319,
- "test/sync-freshness-6858.test.ts": 10560,
- "test/sync-frontmatter-recovery.test.ts": 8802,
- "test/sync-frontmatter-slug-conflict.test.ts": 7967,
- "test/sync-full-committed-progress-gbra133.test.ts": 7166,
- "test/sync-full-cursor-slices-6349.test.ts": 12809,
- "test/sync-full-untracked-import-5459.test.ts": 15005,
- "test/sync-group-member-order.test.ts": 12503,
- "test/sync-handler-drain-6706.test.ts": 34037,
- "test/sync-holds-followups-7974.test.ts": 28716,
- "test/sync-holds-only-converge-7327.test.ts": 10656,
- "test/sync-holds-wave-gbra133.test.ts": 56059,
- "test/sync-import-provenance-disk.test.ts": 13088,
- "test/sync-inexact-rename-6729.test.ts": 34599,
- "test/sync-landing-gaps.test.ts": 8814,
- "test/sync-legacy-edit-import-7338.test.ts": 73595,
- "test/sync-legacy-holds.test.ts": 15322,
- "test/sync-legacy-retry-actions-6696.test.ts": 9273,
- "test/sync-legacy-slug-adoption-6727.test.ts": 18414,
- "test/sync-legacy-sweep-resume-7189.test.ts": 64745,
- "test/sync-level-reuse-across-gbra133.test.ts": 29241,
- "test/sync-metafile-foreign-slug-7341.test.ts": 7910,
- "test/sync-origin-live-wins-6517.test.ts": 5635,
- "test/sync-page-identity-hold-gbra130.test.ts": 40643,
- "test/sync-page-write-failed-gbra130.test.ts": 16028,
- "test/sync-pass-abandoned-7355.test.ts": 10137,
- "test/sync-pass-cost-grouping-gbra130.test.ts": 6101,
- "test/sync-pass-dirty-after-freeze-gbra130.test.ts": 8392,
- "test/sync-pass-interrupted-7596.test.ts": 8295,
- "test/sync-pass-phase-lines-7243.serial.test.ts": 8460,
- "test/sync-pass-readers-7614.test.ts": 92604,
- "test/sync-pass-stop-in-level-gbra133.test.ts": 7781,
- "test/sync-plain-directory-7973.test.ts": 23730,
- "test/sync-prescreen-both-delta-6712.test.ts": 22153,
- "test/sync-prescreen-drift-6712.test.ts": 116820,
- "test/sync-slug-root-mode-6694.test.ts": 20339,
- "test/sync-staged-catchup.test.ts": 12212,
- "test/sync-status-failure-detail-6513.test.ts": 7749,
- "test/sync-status-truthful-7243.test.ts": 15443,
- "test/sync-storage-invalid-8007.test.ts": 51306,
- "test/sync-tree-reuse-gbra133.test.ts": 20564,
- "test/sync-unblock-repair-error-gbra130.test.ts": 7967,
- "test/sync-uncommitted-origin-7130.test.ts": 42726,
- "test/sync-unknown-drift-rescreen-gbra133.test.ts": 8404,
- "test/sync-unreadable-file-gbra130.test.ts": 24230,
- "test/sync-waiver-budget.test.ts": 9879,
- "test/sync-waiver-run-imports.test.ts": 15792,
- "test/take-resolution-survives-publish.test.ts": 7899,
- "test/takes-vector-lifecycle-5885.serial.test.ts": 11085,
- "test/terminal-failures-6650.test.ts": 17376,
- "test/timeline-chunk-reuse.test.ts": 48282,
- "test/trust-channel-writes.test.ts": 18519,
- "test/trust-guarded-supersession.test.ts": 12656,
- "test/trust-held-removals.test.ts": 17508,
- "test/trust-keep-maintenance-reimport-8352.test.ts": 8310,
- "test/trust-owner-actions.test.ts": 11743,
- "test/unbound-source-6536.test.ts": 8976,
- "test/unindexed-files-convergence-7149.test.ts": 18880,
- "test/unindexed-files.test.ts": 19669,
- "test/v273-validate-timeouts.test.ts": 7366,
- "test/vector-manifest-probe-bound.test.ts": 21550,
- "test/visibility-fail-closed-derived-writes.test.ts": 13728,
- "test/visibility-repair-scale.test.ts": 24946,
- "test/withdrawal-overlay-concurrency.test.ts": 7194,
- "test/withdrawal-publication-file.test.ts": 6347,
- "test/worktree-refresh-recovery-row-gbra130.test.ts": 8117,
- "test/worktree-refresh-unexpected-throw.test.ts": 55403,
- "test/write-roundtrips-gbra156.test.ts": 21176,
- "test/write-through-leak-guard-alias-7203.test.ts": 62334,
- "test/writer-admin-state-embed-lease.test.ts": 6117,
- "test/writer-status-movement-not-read-gbra130.test.ts": 7105,
- "test/writer-status-owner-backends.test.ts": 5333
+ "test/access-as.test.ts": 5975,
+ "test/access-audience-members.test.ts": 54425,
+ "test/access-binding.test.ts": 5600,
+ "test/access-federated-member-writes.test.ts": 30079,
+ "test/access-folder-lock-order.test.ts": 2582,
+ "test/access-folder-multiconn.test.ts": 4236,
+ "test/access-folder-rules.test.ts": 33058,
+ "test/access-folder-scoped-role.test.ts": 3693,
+ "test/access-hidden-page-writes.test.ts": 16117,
++ "test/access-labelled-only.test.ts": 91440,
+ "test/access-member-facts.test.ts": 15215,
+ "test/access-member-sweep.test.ts": 32626,
+ "test/access-members-read-lineage.test.ts": 94453,
+ "test/access-members.test.ts": 5368,
+ "test/access-on-behalf-of.test.ts": 37713,
+ "test/access-owner-default-writes.test.ts": 7288,
+ "test/access-owner-reads.test.ts": 21663,
+ "test/access-page-indexes-online.test.ts": 5674,
+ "test/access-page-rule-fileless.test.ts": 14908,
+ "test/access-qm-actor.test.ts": 8466,
+ "test/access-raw-only-rules.test.ts": 62996,
+ "test/access-token-grant-columns.test.ts": 6984,
+ "test/access-ungranted-member-writes.test.ts": 20271,
+ "test/access-writes.test.ts": 12954,
+ "test/activation-unbound-rooted-6449.test.ts": 7891,
+ "test/adopt-local-edit.test.ts": 164333,
+ "test/alias-source-cascade-5094.test.ts": 13954,
+ "test/attribution-backfill-history.test.ts": 27052,
+ "test/backlinks-type-exists-gbra449.test.ts": 6580,
+ "test/backstop-same-page-shadow-managed-6333.test.ts": 11500,
+ "test/behavior-change-notice.test.ts": 6765,
+ "test/belief-ledger-append-owner.test.ts": 23693,
+ "test/belief-ledger-coverage.test.ts": 188340,
+ "test/belief-ledger-group.test.ts": 38961,
+ "test/belief-ledger-identity.test.ts": 46962,
+ "test/belief-ledger-lifecycle.test.ts": 47038,
+ "test/belief-ledger-page-at-time.test.ts": 79400,
+ "test/belief-ledger-privacy.test.ts": 25336,
+ "test/belief-ledger-purge-review.test.ts": 183670,
+ "test/belief-ledger-purge.test.ts": 146582,
+ "test/belief-ledger-restore.test.ts": 206513,
+ "test/belief-ledger-touched.test.ts": 51010,
+ "test/belief-ledger-trust.test.ts": 25299,
+ "test/belief-ledger-w5-time-model.test.ts": 22130,
+ "test/belief-ledger-weekly-diff.test.ts": 102700,
+ "test/belief-ledger-weekly-probes.test.ts": 35614,
+ "test/capacity-bounded-read-6803.test.ts": 8904,
+ "test/capture-consent-admission.test.ts": 10088,
+ "test/capture-dispatch-provenance-6524.test.ts": 7201,
+ "test/chronicle-backfill-max-usd.test.ts": 7281,
+ "test/claim-fifo-foreground-waiting.test.ts": 7484,
+ "test/claim-lease-holder-only-6712.test.ts": 6005,
+ "test/claude-cli-output-cap.test.ts": 6166,
+ "test/cli-page-writes.test.ts": 165146,
+ "test/colon-slug-windows-5032.test.ts": 8744,
+ "test/company-brain-policy.test.ts": 16073,
+ "test/company-brain-runtime.test.ts": 32676,
+ "test/consolidate-fenced-close-reimport.test.ts": 14801,
+ "test/consolidate-same-instant-6023.test.ts": 16644,
+ "test/contact-rows-drift-8109.test.ts": 10628,
+ "test/conversation-facts-outcome-marker-purge-7778.test.ts": 15022,
+ "test/conversation-facts-oversized-sidecar.test.ts": 6699,
+ "test/conversation-facts-purged-claim-7438.test.ts": 12441,
+ "test/cycle-world-fence-rows.test.ts": 6345,
+ "test/cycle/derived-write-through-commit.test.ts": 65813,
+ "test/cycle/dream-reverse-write-commit.test.ts": 40246,
+ "test/cycle/synthesize-concepts-merge.test.ts": 9536,
+ "test/db-lock-reconnect.test.ts": 6446,
+ "test/decide/conflict-proposals-managed.test.ts": 6984,
+ "test/declared-lineage-visibility.test.ts": 6312,
+ "test/derived-link-reconciliation.test.ts": 8591,
+ "test/direct-pool-profile.test.ts": 10127,
+ "test/doctor-attest-read-shared-scope.test.ts": 6467,
+ "test/doctor-database-encoding.test.ts": 2590,
+ "test/doctor-frontmatter-holds.test.ts": 15372,
+ "test/doctor-image-embedding-coverage.test.ts": 8105,
+ "test/doctor-keyword-plan-6495.test.ts": 4580,
+ "test/doctor-routing-skill-pack-source.test.ts": 6433,
+ "test/doctor-sync-freshness-skill-pack-6076.test.ts": 5394,
+ "test/edge-whitespace-twins.test.ts": 9721,
+ "test/embed-once-per-content-version.serial.test.ts": 17930,
+ "test/embed-stale-images-managed-6529.test.ts": 11128,
+ "test/embedding-completion-atomic.serial.test.ts": 8616,
+ "test/enforced-member.serial.test.ts": 180449,
+ "test/engine-sql-facts-keyset.test.ts": 6534,
+ "test/extract-all-stamp-intersection.serial.test.ts": 6869,
+ "test/extract-atoms-input-truncated-6503.test.ts": 16912,
+ "test/extract-atoms-raised-cap-drain-7391.test.ts": 14291,
+ "test/extract-atoms-world-fence-rows.test.ts": 11439,
+ "test/extract-endpoint-revision.serial.test.ts": 9446,
+ "test/extract-entities-managed.test.ts": 39528,
+ "test/extract-facts-fence-failure-health-8758.test.ts": 25549,
+ "test/extract-timeline-from-meetings-managed.test.ts": 31978,
+ "test/extraction-watermark-atoms.test.ts": 7568,
+ "test/fact-embedding-oversized-7211.test.ts": 7126,
+ "test/fact-fence-adoption-exits.test.ts": 49576,
+ "test/fact-purge-lookup-timeout-6511.test.ts": 6709,
+ "test/fact-reads-page-access.test.ts": 30196,
+ "test/facts-absorb-stalled-receipt-7439.test.ts": 24290,
+ "test/facts-entity-moved-7602.test.ts": 224344,
+ "test/facts-insert-guards-7105.test.ts": 13443,
+ "test/facts-publication-large-fence-6898.test.ts": 48906,
+ "test/facts-subject-infer-7405.test.ts": 7399,
+ "test/federation-exposure-private-9068.test.ts": 7098,
+ "test/fence-absent-append-keeps-rows.test.ts": 158977,
+ "test/fence-fact-append.test.ts": 29220,
+ "test/fence-first-generation-8819.test.ts": 68451,
+ "test/fence-repair-receipts.test.ts": 13397,
+ "test/fenced-embed-reuse-6961.test.ts": 7359,
+ "test/file-drift-soft-delete-hold-release-gbra133.test.ts": 20851,
+ "test/forecast-journal.test.ts": 33091,
+ "test/frontmatter-reserved-keys-6454.test.ts": 9014,
+ "test/g4-forget-fence-edit.test.ts": 100033,
+ "test/get-chunks-paging.test.ts": 7403,
+ "test/git-canonical-conversion-evidence-d4.test.ts": 69424,
+ "test/git-canonical-conversion-g8a.test.ts": 285780,
+ "test/git-canonical-conversion-live-writer.test.ts": 20114,
+ "test/git-canonical-conversion-no-checkout-7885.test.ts": 20705,
+ "test/git-canonical-conversion-progress.test.ts": 165255,
+ "test/git-canonical-conversion-strict-pass-7866.test.ts": 146232,
+ "test/git-canonical-declared-g7a.test.ts": 97127,
+ "test/git-canonical-indexer-g3.test.ts": 51382,
+ "test/git-door-index-lock-7742.test.ts": 17185,
+ "test/git-door-planned-state.test.ts": 53907,
+ "test/git-door-plumbing-gbra133.test.ts": 7335,
+ "test/git-door-remote-g7b.test.ts": 48741,
+ "test/git-door-strict-gbra133.test.ts": 55895,
+ "test/git-door-write-cost.test.ts": 23479,
+ "test/git-gap-census.test.ts": 7552,
+ "test/git-gap-direction-evidence-d4.test.ts": 7670,
+ "test/google-connector-facts-fence-7292.test.ts": 14276,
+ "test/grade-takes-window.test.ts": 6348,
+ "test/graduation-copy.test.ts": 85799,
+ "test/graduation-digest.test.ts": 3321,
+ "test/graduation-drain.test.ts": 14428,
+ "test/graduation-inventory.test.ts": 5761,
+ "test/graduation-rollback.test.ts": 114145,
+ "test/graduation-state.test.ts": 161105,
+ "test/graduation-target.test.ts": 2914,
+ "test/graduation-verify-sync-freshness.test.ts": 6454,
+ "test/graduation-verify.test.ts": 18535,
+ "test/grandfather-managed.test.ts": 46554,
+ "test/harness-skills-epoch.test.ts": 4313,
+ "test/held-read-signals.test.ts": 10071,
+ "test/hermes-clarify-transcripts-7396.test.ts": 7683,
+ "test/hold-action-chain-6712.test.ts": 28000,
+ "test/hosted-repo-g7b2.test.ts": 34833,
+ "test/ignored-privacy-labels.test.ts": 5134,
+ "test/import-file-result-callback-gbra130.test.ts": 8660,
+ "test/import-frontmatter-key-order-5158.test.ts": 6797,
+ "test/import-inline-chunk-keep.test.ts": 8355,
+ "test/import-revision-concurrency.test.ts": 7810,
+ "test/import-write-barrier.test.ts": 47145,
+ "test/ingest-capture-keeps-readers.test.ts": 16676,
+ "test/init-cold-home-embedding.test.ts": 31155,
+ "test/keyword-statement-timeout-knob-6495.test.ts": 13855,
+ "test/keyword-timeout-negative-cache-6495.test.ts": 5994,
+ "test/label-only-repairs.test.ts": 57888,
+ "test/lane-apply-pipelining.test.ts": 5679,
+ "test/large-pages/append-concurrency.test.ts": 38468,
+ "test/large-pages/append-cost.test.ts": 48238,
+ "test/large-pages/append-mention-links.test.ts": 23227,
+ "test/large-pages/chunk-retirement-plan.test.ts": 6466,
+ "test/large-pages/chunk-visibility.test.ts": 6326,
+ "test/large-pages/contextual-reembed-segmented.test.ts": 7921,
+ "test/large-pages/credential-reseal-segments.test.ts": 8911,
+ "test/large-pages/doctor-skipped-segmented.test.ts": 14372,
+ "test/large-pages/edit-segmented.test.ts": 39818,
+ "test/large-pages/forget-reason-segmented.test.ts": 9501,
+ "test/large-pages/forget-scope.test.ts": 27965,
+ "test/large-pages/gbra117-segmented-classes-window.test.ts": 54848,
+ "test/large-pages/held-budget-count-list.test.ts": 14931,
+ "test/large-pages/held-budget-shrink.test.ts": 15791,
+ "test/large-pages/managed-import-outside-root.test.ts": 27776,
+ "test/large-pages/managed-import-projection-pending.test.ts": 73006,
+ "test/large-pages/managed-links-timeline-heap.test.ts": 35797,
+ "test/large-pages/managed-streamed-import.test.ts": 53570,
+ "test/large-pages/managed-sync-segmented-rename.test.ts": 26053,
+ "test/large-pages/managed-sync-streamed.test.ts": 135962,
+ "test/large-pages/oversized-backfill-segmented.test.ts": 8660,
+ "test/large-pages/page-purge-segments.test.ts": 26193,
+ "test/large-pages/pinned-segmented-reads.test.ts": 35723,
+ "test/large-pages/projection-claim-ownership.test.ts": 28027,
+ "test/large-pages/projection-demotion-race.test.ts": 9206,
+ "test/large-pages/projection-lock-hold.test.ts": 56460,
+ "test/large-pages/projection-parity.test.ts": 58948,
+ "test/large-pages/publication-seal-bounded.test.ts": 26335,
+ "test/large-pages/purge-fact-inflight-staging.test.ts": 17378,
+ "test/large-pages/purge-fact-segmented-preimage.test.ts": 23797,
+ "test/large-pages/purge-inflight-create.test.ts": 12563,
+ "test/large-pages/purge-replay-segments.test.ts": 13404,
+ "test/large-pages/purge-segment-residue.test.ts": 10671,
+ "test/large-pages/purge-segmented-versions-batch.test.ts": 15553,
+ "test/large-pages/purge-segments.test.ts": 11434,
+ "test/large-pages/recovery-budget-ceiling.slow.test.ts": 235025,
+ "test/large-pages/recovery-budget-default.test.ts": 9661,
+ "test/large-pages/remote-get-page-privacy.test.ts": 85632,
+ "test/large-pages/remote-versions-storage-change.test.ts": 9416,
+ "test/large-pages/remote-window-privacy.test.ts": 60399,
+ "test/large-pages/restore-deferred-retire.test.ts": 29753,
+ "test/large-pages/restore-publication-statement-bound.test.ts": 31605,
+ "test/large-pages/restore-segmented-reprojects.test.ts": 87111,
+ "test/large-pages/sealed-segmented-search.test.ts": 16864,
+ "test/large-pages/second-write-deferred-retire.test.ts": 15010,
+ "test/large-pages/segment-rewrite-cr-tier.test.ts": 9659,
+ "test/large-pages/segment-vector-reuse.test.ts": 4280,
+ "test/large-pages/segmented-append-reembed.test.ts": 10636,
+ "test/large-pages/segmented-body-unreachable.test.ts": 7052,
+ "test/large-pages/segmented-bom.test.ts": 22436,
+ "test/large-pages/segmented-conversation-facts.test.ts": 43312,
+ "test/large-pages/segmented-conversation-sidecar-token.test.ts": 29340,
+ "test/large-pages/segmented-core-list.test.ts": 34204,
+ "test/large-pages/segmented-create-searchable.test.ts": 31003,
+ "test/large-pages/segmented-delete-crash.slow.test.ts": 69753,
+ "test/large-pages/segmented-delete-restore-file.slow.test.ts": 148074,
+ "test/large-pages/segmented-delete-stage-crash.slow.test.ts": 146861,
+ "test/large-pages/segmented-derived-parity.test.ts": 14435,
+ "test/large-pages/segmented-derived-passes.test.ts": 21467,
+ "test/large-pages/segmented-derived-work.test.ts": 85065,
+ "test/large-pages/segmented-embedding-paths.test.ts": 35239,
+ "test/large-pages/segmented-embedding.test.ts": 7060,
+ "test/large-pages/segmented-evidence-read-cost.test.ts": 41889,
+ "test/large-pages/segmented-evidence.test.ts": 42284,
+ "test/large-pages/segmented-extraction-stale.test.ts": 9631,
+ "test/large-pages/segmented-facts-forced-lines.test.ts": 12865,
+ "test/large-pages/segmented-facts-reconcile.test.ts": 110177,
+ "test/large-pages/segmented-file-drift-ledger.test.ts": 46211,
+ "test/large-pages/segmented-file-drift.test.ts": 108441,
+ "test/large-pages/segmented-forced-cuts.test.ts": 84480,
+ "test/large-pages/segmented-frontmatter-reimport.test.ts": 35871,
+ "test/large-pages/segmented-get-cli.test.ts": 25663,
+ "test/large-pages/segmented-get-page-parity.test.ts": 24957,
+ "test/large-pages/segmented-leads.test.ts": 19990,
+ "test/large-pages/segmented-loser-chunks.test.ts": 9936,
+ "test/large-pages/segmented-maintenance-commands.test.ts": 16606,
+ "test/large-pages/segmented-prior-view.test.ts": 15940,
+ "test/large-pages/segmented-read-refusals.test.ts": 17817,
+ "test/large-pages/segmented-real-size.slow.test.ts": 65362,
+ "test/large-pages/segmented-remember-refusal.test.ts": 29917,
+ "test/large-pages/segmented-repair-scans.test.ts": 17891,
+ "test/large-pages/segmented-retained-blocks.test.ts": 76407,
+ "test/large-pages/segmented-search-dedup.test.ts": 14316,
+ "test/large-pages/segmented-semantic-writes-near-ceiling.slow.test.ts": 132380,
+ "test/large-pages/segmented-semantic-writes.test.ts": 75625,
+ "test/large-pages/segmented-shrink-below-ceiling.test.ts": 86997,
+ "test/large-pages/segmented-storage-visibility.test.ts": 23162,
+ "test/large-pages/segmented-sweep-budget.test.ts": 34162,
+ "test/large-pages/segmented-sweep-deferral.test.ts": 18110,
+ "test/large-pages/segmented-switch.test.ts": 32655,
+ "test/large-pages/segmented-think-compile-leads.serial.test.ts": 14448,
+ "test/large-pages/segmented-timeline-heap.test.ts": 68291,
+ "test/large-pages/segmented-timeline-retract-versions.test.ts": 9626,
+ "test/large-pages/segmented-versions.test.ts": 7839,
+ "test/large-pages/segmented-withdrawal-mirror.test.ts": 270189,
+ "test/large-pages/segmented-withdrawn-fence-delete.test.ts": 63035,
+ "test/large-pages/streamed-import-drift.test.ts": 32997,
+ "test/large-pages/streamed-sync-origin-b14.test.ts": 79033,
+ "test/large-pages/stuck-recovery-large.slow.test.ts": 223097,
+ "test/large-pages/timeline-top-insert-reembed.test.ts": 11707,
+ "test/large-pages/upload-binding.test.ts": 9944,
+ "test/large-pages/upload-over-ceiling.test.ts": 183469,
+ "test/large-pages/upload-provenance-7873.test.ts": 48274,
+ "test/large-pages/upload-review.test.ts": 9472,
+ "test/large-pages/v252-master-reader-compat.test.ts": 8694,
+ "test/link-cross-source.test.ts": 14356,
+ "test/link-dates-per-row-gst2228.test.ts": 149122,
+ "test/link-origin-scope.test.ts": 7552,
+ "test/link-preparation-shared-index.test.ts": 12846,
+ "test/link-transitions-source-migration-gst2228.test.ts": 6741,
+ "test/links-attendance-blocked.test.ts": 10117,
+ "test/links-extraction-yield.test.ts": 7936,
+ "test/list-jobs-row-bound.test.ts": 8733,
+ "test/list-pages-empty-type-notice-gbra449.test.ts": 7004,
+ "test/maintenance-lowering-7917-7918.test.ts": 18406,
+ "test/maintenance-trust-marker-7905.test.ts": 37567,
+ "test/managed-cycle-pull-upstream.test.ts": 8793,
+ "test/managed-facts-withdrawal-recovery-6506.test.ts": 12912,
+ "test/managed-facts-withdrawn-skip-6506.test.ts": 9737,
+ "test/managed-lint.test.ts": 16799,
+ "test/managed-maintenance-links.test.ts": 7656,
+ "test/managed-root-aliases-7203.test.ts": 32407,
+ "test/managed-root-marker-enclosing-7988.test.ts": 11471,
+ "test/managed-sweep-corpus-windows.test.ts": 8561,
+ "test/managed-sweep-refused-window-retry.test.ts": 14845,
+ "test/managed-sweep-timeline.test.ts": 7049,
+ "test/managed-sync-blocked-job-6858.test.ts": 8696,
+ "test/managed-sync-bulk-round-trips-5984.test.ts": 11053,
+ "test/managed-sync-bulk.test.ts": 224435,
+ "test/managed-sync-checkpoint-controls-company.test.ts": 10110,
+ "test/managed-sync-chunker-version.test.ts": 9305,
+ "test/managed-sync-concurrent-write-hold.test.ts": 25077,
+ "test/managed-sync-connection-loss.test.ts": 12196,
+ "test/managed-sync-drain.test.ts": 14141,
+ "test/managed-sync-foreground-priority.test.ts": 87763,
+ "test/managed-sync-gate-markers-6858.test.ts": 9179,
+ "test/managed-sync-group-completion.test.ts": 16091,
+ "test/managed-sync-group-uncommitted-head.test.ts": 42226,
+ "test/managed-sync-images-5493.test.ts": 15150,
+ "test/managed-sync-keep-disk-6858.test.ts": 32579,
+ "test/managed-sync-lanes.test.ts": 30558,
+ "test/managed-sync-orphans-incarnation-6518.test.ts": 5780,
+ "test/managed-sync-page-fault-holds.test.ts": 28770,
+ "test/managed-sync-pinned-reads.test.ts": 37005,
+ "test/managed-sync-preparation-stalled-holds.test.ts": 111333,
+ "test/managed-sync-row-parity.test.ts": 11727,
+ "test/managed-sync-stale-group-head.test.ts": 8306,
+ "test/mcp-sources-not-readable.test.ts": 9981,
+ "test/member-forget-refusal-9101.test.ts": 10572,
+ "test/member-read-access.test.ts": 42666,
+ "test/migration-0-53-host-move-7900.test.ts": 23610,
+ "test/migration-persistence-foreground-committed-index.test.ts": 9311,
+ "test/migration-persistence-request-id-index.test.ts": 10916,
+ "test/migration-persistence-request-slug-index.test.ts": 13917,
+ "test/notifier-passed-freshness-marker-7941.test.ts": 31038,
+ "test/on-commit-embedding.serial.test.ts": 13575,
+ "test/oneshot-consumer-direct-route.test.ts": 6699,
+ "test/oneshot-housekeeping-cli.test.ts": 15812,
+ "test/origin-guard-6948.test.ts": 13096,
+ "test/origin-twin-sequence-7150.test.ts": 9814,
+ "test/origin-twins-6948.test.ts": 5322,
+ "test/orphan-effect-diagnostics-7985.test.ts": 13288,
+ "test/overwritten-edits-6712.test.ts": 58270,
+ "test/owner-facts-d1-gst2346.test.ts": 19218,
+ "test/owner-member-boundary.test.ts": 8601,
+ "test/owner-reads-restricted.test.ts": 75912,
+ "test/owner-refusal.test.ts": 6032,
+ "test/pack-relation-direction-engine.test.ts": 9256,
+ "test/page-change-reason-gbra217.test.ts": 9547,
+ "test/page-change-reason-git-gbra217.test.ts": 67695,
+ "test/page-embedding-budget.test.ts": 8213,
+ "test/page-embedding-content-validity.test.ts": 8350,
+ "test/page-embedding-install-batch.test.ts": 5887,
+ "test/page-embedding-lease.serial.test.ts": 14394,
+ "test/page-history-guards-gbra286.test.ts": 8443,
+ "test/page-prepare-shared-origin-6517.test.ts": 14590,
+ "test/page-purge-batch-sweep-6884.test.ts": 10920,
+ "test/page-purge-journal-timeout-6511.test.ts": 24937,
+ "test/page-spend-reservation.test.ts": 7349,
+ "test/page-state-engine.test.ts": 4862,
+ "test/pages-source-created-idx-7379.test.ts": 5691,
+ "test/pages-status-7179.test.ts": 18417,
+ "test/pathological/a-36-facts-batch-partial-refusal.test.ts": 18440,
+ "test/pathological/a-42-atom-dot-led-slug.test.ts": 16219,
+ "test/pathological/a-51-conversation-batch-booking.test.ts": 13794,
+ "test/pathological/a-60-belief-commit-mark.test.ts": 7476,
+ "test/pathological/a-65-captured-facts-unreadable-corpus.test.ts": 7494,
+ "test/pathological/a1-links-extract.test.ts": 48299,
+ "test/pathological/a10-global-maintenance-stamp.test.ts": 8105,
+ "test/pathological/a11-effect-retry-budget.test.ts": 46420,
+ "test/pathological/a12-withdrawal-mirror-gate.test.ts": 104529,
+ "test/pathological/a13-embedding-target-park.test.ts": 43441,
+ "test/pathological/a15-deactivate-exits.test.ts": 12056,
+ "test/pathological/a18-ledger-path-text.test.ts": 63364,
+ "test/pathological/a2-transcripts-ingest.test.ts": 82077,
+ "test/pathological/a21-facts-expire-deleted.test.ts": 59149,
+ "test/pathological/a22-consolidate-buckets.test.ts": 46640,
+ "test/pathological/a23-patterns-grounding.test.ts": 57927,
+ "test/pathological/a24-phantom-redirect-cursor.test.ts": 41027,
+ "test/pathological/a25-propose-takes-poison-pages.test.ts": 51529,
+ "test/pathological/a26-safe-chunks-reseal.test.ts": 9571,
+ "test/pathological/a27-credential-reseal.test.ts": 10551,
+ "test/pathological/a3-google-items.test.ts": 112165,
+ "test/pathological/a30-watchdog-attribution.test.ts": 8127,
+ "test/pathological/a31-migrate-loop-rows.serial.test.ts": 39610,
+ "test/pathological/a4-synthesize-postprocess.test.ts": 17237,
+ "test/pathological/a41-maintain-sources.test.ts": 49137,
+ "test/pathological/a44-slug-conflicts-rotation.test.ts": 68731,
+ "test/pathological/a45-repair-all-kinds.test.ts": 7536,
+ "test/pathological/a46-content-lane-kinds.test.ts": 6500,
+ "test/pathological/a47-backfill-poison-row.test.ts": 7123,
+ "test/pathological/a49-unmanaged-purge-tombstones.test.ts": 53140,
+ "test/pathological/a50-unmanaged-expired-sources.test.ts": 6344,
+ "test/pathological/a68-memory-proposal-upkeep.test.ts": 8135,
+ "test/pathological/a9-repair-core.test.ts": 7373,
+ "test/pathological/b-10-ontology-rekey-collision.test.ts": 7576,
+ "test/pathological/b-7-facts-pageless-entity.test.ts": 20657,
+ "test/pathological/b-9-enrich-retired-alias.test.ts": 7856,
+ "test/pathological/b12-slug-segment-bytes.test.ts": 25410,
+ "test/pathological/b5-enrich-entity-identity.test.ts": 7528,
+ "test/pathological/b5-export-unsafe-slugs.test.ts": 37568,
+ "test/pathological/b6-triage-verdict-surrogate.test.ts": 8698,
+ "test/pathological/c-23-override-and-doctor-fixes.test.ts": 5723,
+ "test/pathological/c-9-facts-absorb-dead.test.ts": 8439,
+ "test/pathological/c1-effect-stuck-recovery.test.ts": 47260,
+ "test/pathological/c2-url-clone-fences.test.ts": 65606,
+ "test/pathological/c22-stuck-recovery-large-file.test.ts": 32019,
+ "test/pathological/c4-bundle-stuck-recovery.test.ts": 150761,
+ "test/pathological/c5-writer-transfer-cancel.test.ts": 40830,
+ "test/pathological/c7-content-receipt-root.test.ts": 43166,
+ "test/pathological/d1-unfenced-facts-overwrite.test.ts": 48941,
+ "test/pathological/d10-derived-atom-file-overwrite.test.ts": 30541,
+ "test/pathological/d11-derived-retired-atom-unlink.test.ts": 22232,
+ "test/pathological/d12-concept-stale-fences.test.ts": 27927,
+ "test/pathological/d13-concept-occupied-path.test.ts": 28520,
+ "test/pathological/d14-brainstorm-resume-overwrite.test.ts": 26926,
+ "test/pathological/d15-sync-reexport-overwrite.test.ts": 43815,
+ "test/pathological/d16-google-file-replacement.test.ts": 56087,
+ "test/pathological/d17-github-file-replacement.test.ts": 40792,
+ "test/pathological/d18-think-take-db-only.test.ts": 36140,
+ "test/pathological/d19-takes-bootstrap-db-only.test.ts": 47308,
+ "test/pathological/d2-fence-write-overwrite.test.ts": 44172,
+ "test/pathological/d21-migration-verifier-record.test.ts": 102608,
+ "test/pathological/d22-legacy-hash-body-history.test.ts": 52942,
+ "test/pathological/d23-extract-atoms-db-only.test.ts": 39664,
+ "test/pathological/d3-forget-overwrite.test.ts": 81267,
+ "test/pathological/d4-proposal-overwrite.test.ts": 85071,
+ "test/pathological/d5-phantom-canonical-overwrite.test.ts": 30334,
+ "test/pathological/d6-phantom-file-unlink.test.ts": 25134,
+ "test/pathological/d7-synthesize-reverse-write.test.ts": 42857,
+ "test/pathological/d8-patterns-reverse-write.test.ts": 38316,
+ "test/pathological/d9-dream-summary-overwrite.test.ts": 23723,
+ "test/pathological/facts-mirror-failures.test.ts": 95268,
+ "test/pathological/g0-derived-retirement-hold.test.ts": 17329,
+ "test/pathological/g1-atom-generations.test.ts": 20308,
+ "test/pathological/g1-generation-crash.test.ts": 27602,
+ "test/pathological/g1-generation-probes.test.ts": 47485,
+ "test/pathological/g1-generations.test.ts": 52902,
+ "test/pathological/h1-zero-yield-atom-reextract.test.ts": 22653,
+ "test/pathological/h2-git-effect-moved-remote.test.ts": 21469,
+ "test/pathological/h3-chronicle-partial-generation.test.ts": 87232,
+ "test/pathological/h4-conversation-facts-zero-yield.test.ts": 85224,
+ "test/pathological/h5-atoms-restore.test.ts": 21836,
+ "test/pathological/lp-a-segmented-mirror.test.ts": 51284,
+ "test/pathological/lp-b-transient-retry-budget.test.ts": 91439,
+ "test/pathological/lp-c-publication-ceiling-retry.test.ts": 104252,
+ "test/pathological/lp-d-recovery-version.test.ts": 15393,
+ "test/pathological/lp-d-segmented-mirror-gate.test.ts": 20321,
+ "test/pathological/lp-f-split-fence-withdrawal-capacity.test.ts": 9004,
+ "test/pathological/lp-g-file-digest-fence-bound.test.ts": 32079,
+ "test/pathological/lp-h-purge-orphan-segment-text.test.ts": 49941,
+ "test/pathological/w1-write-through-staging-window.serial.test.ts": 13796,
+ "test/persistence-background-pause.test.ts": 9389,
+ "test/persistence-bounded-read-session.test.ts": 10504,
+ "test/persistence-capacity-forecast.test.ts": 11091,
+ "test/persistence-capacity-notices.test.ts": 21469,
+ "test/persistence-commit-durability.test.ts": 5523,
+ "test/persistence-deactivate.test.ts": 20987,
+ "test/persistence-diagnostics.test.ts": 8891,
+ "test/persistence-edit-embedding-reuse.test.ts": 8728,
+ "test/persistence-effect-claim-loss.test.ts": 23699,
+ "test/persistence-embedding-noop-settle.test.ts": 9784,
+ "test/persistence-file-import.test.ts": 42017,
+ "test/persistence-git-subdir-origin.test.ts": 18102,
+ "test/persistence-graph-publication.test.ts": 7818,
+ "test/persistence-history-fixture.test.ts": 38494,
+ "test/persistence-image-import.serial.test.ts": 8375,
+ "test/persistence-import-batch.test.ts": 25755,
+ "test/persistence-managed-lifecycle.test.ts": 29479,
+ "test/persistence-managed-sync.test.ts": 187819,
+ "test/persistence-manifest-git-scope.test.ts": 9157,
+ "test/persistence-memory-mutations.test.ts": 15597,
+ "test/persistence-opt-in-caps.test.ts": 19135,
+ "test/persistence-owner-activity.test.ts": 6520,
+ "test/persistence-page-authority.test.ts": 8959,
+ "test/persistence-physical-root-device.test.ts": 6945,
+ "test/persistence-preactivation-claim.test.ts": 11856,
+ "test/persistence-publication-deadline.test.ts": 24154,
+ "test/persistence-receipt-true-up.test.ts": 10593,
+ "test/persistence-reconcile-git-dirty-6138.test.ts": 5431,
+ "test/persistence-skill-bundles.serial.test.ts": 8144,
+ "test/persistence-skill-crash.slow.test.ts": 43595,
+ "test/persistence-skip-cost.test.ts": 9060,
+ "test/persistence-stale-plan-retry.test.ts": 13789,
+ "test/persistence-sync-cursor-options.test.ts": 11024,
+ "test/persistence-sync-cursor-strategy-6696.test.ts": 9720,
+ "test/persistence-sync-fence-holds.test.ts": 27841,
+ "test/persistence-sync-holds.test.ts": 30456,
+ "test/persistence-sync-lease.test.ts": 37811,
+ "test/persistence-sync-metafile-pages.test.ts": 11579,
+ "test/persistence-write-interrupted.test.ts": 84343,
+ "test/persistence-write-stall.test.ts": 8443,
+ "test/persistence-writer-fences.test.ts": 5064,
+ "test/physical-root-birth-tolerance-6501.test.ts": 7598,
+ "test/privacy-label-ignored.test.ts": 18648,
+ "test/provenance-drift-7891.test.ts": 65797,
+ "test/provenance-stamps-7873.test.ts": 99555,
+ "test/purge-expires-page-facts.test.ts": 22090,
+ "test/purge-fact.test.ts": 11637,
+ "test/purge-global-marker.test.ts": 9255,
+ "test/purge-missing-cache-6911.test.ts": 10857,
+ "test/purge-name-stores-9068.test.ts": 16323,
+ "test/purge-read-surfaces.test.ts": 14745,
+ "test/purge-scrub-followups-9068.test.ts": 9315,
+ "test/purge-sync-tombstone-hold-7130.test.ts": 50265,
+ "test/qm-attest-write-boundary.test.ts": 7200,
+ "test/qm-memory-propose.test.ts": 19584,
+ "test/qm-memory-tools.test.ts": 32903,
+ "test/qm-personal-sources.test.ts": 10216,
+ "test/qm-personal-tools.test.ts": 14235,
+ "test/qm-scope-read.test.ts": 12809,
+ "test/qm-scope-writes.test.ts": 26999,
+ "test/read-meta-diag.test.ts": 6603,
+ "test/readers-label-setter.test.ts": 35850,
+ "test/reason-trailers-gbra217.test.ts": 22834,
+ "test/recall-page-fill.test.ts": 11747,
+ "test/receipt-compaction-newest-sync-gbra130.test.ts": 7251,
+ "test/reconcile-clears-stalled-hold-7364.test.ts": 13139,
+ "test/reconcile-publish-opt-out-gst2250.test.ts": 19490,
+ "test/recorded-read-gate.test.ts": 61319,
+ "test/recreated-takes-section-keeps-stored-takes.test.ts": 133465,
+ "test/refresh-barrier-gst1623.test.ts": 82281,
+ "test/refresh-barrier-held-after-abort.test.ts": 33684,
+ "test/refresh-barrier-purge-gst1602.test.ts": 11173,
+ "test/refresh-fence-retry-id-gst2353.test.ts": 24948,
+ "test/refresh-own-commits-replan-8828.test.ts": 19127,
+ "test/refresh-retry-hint-gst1582.test.ts": 25930,
+ "test/refresh-write-barrier.test.ts": 86931,
+ "test/remediation-manual-only.test.ts": 9509,
+ "test/remember-batch-entity-7432.test.ts": 9339,
+ "test/remember-pageless-entity-gst2446.test.ts": 45717,
+ "test/remember-share-gst2243.test.ts": 10092,
+ "test/remember-strict-held-gst2492.test.ts": 153454,
+ "test/repair-apply-pending-6543.test.ts": 79775,
+ "test/repair-atom-fence-rows.test.ts": 15582,
+ "test/repair-database-stop-gbra133.test.ts": 6901,
+ "test/repair-embedding-effects.test.ts": 9942,
+ "test/repair-failed-writes-conflict-6429.test.ts": 10490,
+ "test/repair-failed-writes-drift-w411.test.ts": 6869,
+ "test/repair-fences.test.ts": 29378,
+ "test/repair-file-drift-consumer-env-7506.test.ts": 47488,
+ "test/repair-file-drift-deleted-6712.test.ts": 17565,
+ "test/repair-file-drift-held-6712.test.ts": 11404,
+ "test/repair-file-drift-held-window-gbra133.test.ts": 30603,
+ "test/repair-file-drift-provenance-gbra133.test.ts": 7919,
+ "test/repair-frontmatter-keys-sweep-6454.test.ts": 10019,
+ "test/repair-frontmatter.test.ts": 26839,
+ "test/repair-ghost-database-ahead-gbra133.test.ts": 9540,
+ "test/repair-lost-fence-rows.test.ts": 161571,
+ "test/repair-private-labels-batch.test.ts": 77647,
+ "test/repair-quoted-markers-8059.test.ts": 14972,
+ "test/repair-receipt-compaction.test.ts": 8951,
+ "test/repair-rename-identity-6729.test.ts": 17599,
+ "test/repair-secret-spans.test.ts": 15126,
+ "test/repair-unwithdrawn-facts-8819.test.ts": 84804,
+ "test/request-tools-combined-gbra449.test.ts": 6841,
+ "test/retrieval-coverage-notices.test.ts": 9206,
+ "test/schema-missing-tables.test.ts": 7664,
+ "test/schema-replay-deadlock-6143.test.ts": 7511,
+ "test/scripts/test-stress-postgres.test.ts": 12073,
+ "test/search-entity-facts-eligibility.test.ts": 10831,
+ "test/search-keyword-evidence-label-gbra449.test.ts": 11740,
+ "test/search-read-keyword-bound.test.ts": 4494,
+ "test/search-remote-page-cap.test.ts": 12686,
+ "test/search-transcript-quote-8384.test.ts": 10834,
+ "test/search-transcript-quote-8384b.test.ts": 13071,
+ "test/search-transcript-quote-budget.test.ts": 7020,
+ "test/search-transcript-quote-coverage.test.ts": 15417,
+ "test/search-transcript-quote-followups.test.ts": 12349,
+ "test/search-transcript-quote-legacy-claim.test.ts": 8161,
+ "test/search-transcript-quote-tiers.test.ts": 15050,
+ "test/search-transcript-quote.test.ts": 8256,
+ "test/search-vector-scope-parity.test.ts": 11567,
+ "test/search/page-rank-cut.test.ts": 16213,
+ "test/search/rerank-gate-hybrid.test.ts": 8093,
+ "test/search/rerank-gate-telemetry.test.ts": 6103,
+ "test/segmented-untiled-hold-gst1209.test.ts": 8456,
+ "test/serve-head-watcher-managed.serial.test.ts": 8951,
+ "test/serve-http-access.test.ts": 7060,
+ "test/serve-http-memory-proposals.test.ts": 8975,
+ "test/setup-serves-several.test.ts": 173498,
+ "test/shared-content-freshness.test.ts": 6590,
+ "test/shared-skills-catalog.test.ts": 61720,
+ "test/shared-skills-retention-capacity.test.ts": 7557,
+ "test/shared-skills-source-opt-out.test.ts": 4679,
+ "test/shared-skills-writer-boundary.test.ts": 23530,
+ "test/source-lifecycle-dry-run-physical-root-6849.test.ts": 4712,
+ "test/source-retire-missing-checkout.test.ts": 6258,
+ "test/source-row-diagnostics.test.ts": 5513,
+ "test/sources-git-reconcile.test.ts": 19780,
+ "test/sources-resolve-path.test.ts": 15625,
+ "test/stale-plan-heal.test.ts": 8569,
+ "test/stats-health-source-scope.test.ts": 5779,
+ "test/status-snapshot-source-scope.test.ts": 5781,
+ "test/sync-absent-from-worktree-s27.test.ts": 21022,
+ "test/sync-admission-6712.test.ts": 4821,
+ "test/sync-apply-held-deletions-gbra133.test.ts": 12112,
+ "test/sync-capacity-preflight.test.ts": 10246,
+ "test/sync-checkpoint-moved-6834.test.ts": 10097,
+ "test/sync-classic-drift-7199.test.ts": 17147,
+ "test/sync-concurrent-write-deleted-hold-8751.test.ts": 9898,
+ "test/sync-disabled-cycle-window.test.ts": 10171,
+ "test/sync-discovery-legacy-origin-7130.test.ts": 8556,
+ "test/sync-drain-claims.test.ts": 24032,
+ "test/sync-drain-effect-recovery-blocked.test.ts": 9012,
+ "test/sync-drain-head-blocked-6543.test.ts": 7438,
+ "test/sync-drain-inpass-stall.test.ts": 5788,
+ "test/sync-drain-write-capacity.test.ts": 9692,
+ "test/sync-drift-rescreen-progress-gst2515.test.ts": 51193,
+ "test/sync-dry-run-drain-7167.test.ts": 7631,
+ "test/sync-exits-l4-6712.test.ts": 12728,
+ "test/sync-fenced-slices-gbra133.test.ts": 25583,
+ "test/sync-file-drift-agrees-7931.test.ts": 28343,
+ "test/sync-filter-owned-9024.test.ts": 66408,
+ "test/sync-filter-owned-company-9024.test.ts": 6482,
+ "test/sync-freeze-turn-write-gbra133.test.ts": 18321,
+ "test/sync-freshness-6858.test.ts": 7686,
+ "test/sync-frontmatter-recovery.test.ts": 7921,
+ "test/sync-frontmatter-slug-conflict.test.ts": 7186,
+ "test/sync-full-committed-progress-gbra133.test.ts": 6733,
+ "test/sync-full-cursor-slices-6349.test.ts": 10965,
+ "test/sync-full-untracked-import-5459.test.ts": 12581,
+ "test/sync-group-member-order.test.ts": 15160,
+ "test/sync-handler-drain-6706.test.ts": 31324,
+ "test/sync-holds-followups-7974.test.ts": 26001,
+ "test/sync-holds-only-converge-7327.test.ts": 12474,
+ "test/sync-holds-wave-gbra133.test.ts": 64228,
+ "test/sync-import-provenance-disk.test.ts": 14657,
+ "test/sync-inexact-rename-6729.test.ts": 37180,
+ "test/sync-landing-gaps.test.ts": 8872,
+ "test/sync-legacy-edit-import-7338.test.ts": 55971,
+ "test/sync-legacy-holds.test.ts": 18193,
+ "test/sync-legacy-retry-actions-6696.test.ts": 10745,
+ "test/sync-legacy-slug-adoption-6727.test.ts": 17584,
+ "test/sync-legacy-sweep-resume-7189.test.ts": 53897,
+ "test/sync-level-reuse-across-gbra133.test.ts": 24704,
+ "test/sync-metafile-foreign-slug-7341.test.ts": 7372,
+ "test/sync-origin-live-wins-6517.test.ts": 5055,
+ "test/sync-page-identity-hold-gbra130.test.ts": 52050,
+ "test/sync-page-write-failed-gbra130.test.ts": 15342,
+ "test/sync-partial-clone-2331.test.ts": 60546,
+ "test/sync-pass-abandoned-7355.test.ts": 10128,
+ "test/sync-pass-cost-grouping-gbra130.test.ts": 6726,
+ "test/sync-pass-dirty-after-freeze-gbra130.test.ts": 8831,
+ "test/sync-pass-interrupted-7596.test.ts": 10578,
+ "test/sync-pass-phase-lines-7243.serial.test.ts": 8954,
+ "test/sync-pass-readers-7614.test.ts": 97894,
+ "test/sync-pass-stop-in-level-gbra133.test.ts": 7600,
+ "test/sync-plain-directory-7973.test.ts": 25584,
+ "test/sync-prescreen-both-delta-6712.test.ts": 19830,
+ "test/sync-prescreen-drift-6712.test.ts": 72547,
+ "test/sync-restored-file-purge.test.ts": 200599,
+ "test/sync-slug-root-mode-6694.test.ts": 16628,
+ "test/sync-staged-catchup.test.ts": 8602,
+ "test/sync-status-commits-waiting-gst2515.test.ts": 25676,
+ "test/sync-status-failure-detail-6513.test.ts": 7065,
+ "test/sync-status-truthful-7243.test.ts": 14660,
+ "test/sync-storage-invalid-8007.test.ts": 45745,
+ "test/sync-tree-reuse-gbra133.test.ts": 16696,
+ "test/sync-unblock-repair-error-gbra130.test.ts": 9641,
+ "test/sync-uncommitted-origin-7130.test.ts": 33601,
+ "test/sync-unknown-drift-history-rescreen.test.ts": 10131,
+ "test/sync-unknown-drift-rescreen-gbra133.test.ts": 9851,
+ "test/sync-unreadable-file-gbra130.test.ts": 23304,
+ "test/sync-waiver-budget.test.ts": 8748,
+ "test/sync-waiver-run-imports.test.ts": 14947,
+ "test/take-resolution-survives-publish.test.ts": 7420,
+ "test/takes-vector-lifecycle-5885.serial.test.ts": 13607,
+ "test/terminal-failures-6650.test.ts": 18490,
+ "test/timeline-chunk-reuse.test.ts": 49010,
+ "test/transcript-redaction-key-names.test.ts": 8032,
+ "test/trust-channel-writes.test.ts": 20848,
+ "test/trust-guarded-supersession.test.ts": 16132,
+ "test/trust-held-removals.test.ts": 21396,
+ "test/trust-keep-maintenance-reimport-8352.test.ts": 6771,
+ "test/trust-owner-actions.test.ts": 9757,
+ "test/unbound-source-6536.test.ts": 8163,
+ "test/unindexed-files-convergence-7149.test.ts": 15915,
+ "test/unindexed-files.test.ts": 20566,
+ "test/url-source-origin.test.ts": 54860,
+ "test/v273-validate-timeouts.test.ts": 4976,
+ "test/valid-time-gbra217.test.ts": 28349,
+ "test/vector-manifest-probe-bound.test.ts": 21263,
+ "test/visibility-fail-closed-derived-writes.test.ts": 12919,
+ "test/visibility-repair-scale.test.ts": 27989,
+ "test/withdrawal-overlay-concurrency.test.ts": 6356,
+ "test/withdrawal-publication-file.test.ts": 7147,
+ "test/worktree-refresh-recovery-row-gbra130.test.ts": 9989,
+ "test/worktree-refresh-unexpected-throw.test.ts": 57491,
+ "test/write-refusal-refresh-fence-8621.test.ts": 58889,
+ "test/write-roundtrips-gbra156.test.ts": 15266,
+ "test/write-through-leak-guard-alias-7203.test.ts": 41644,
+ "test/writer-admin-state-embed-lease.test.ts": 6099,
+ "test/writer-status-movement-not-read-gbra130.test.ts": 6971,
+ "test/writer-status-owner-backends.test.ts": 4563
}
diff --cc src/commands/access.ts
index f6c57f28f5,5565aa8b24..24c6be23ce
--- a/src/commands/access.ts
+++ b/src/commands/access.ts
@@@ -139,7 -135,7 +139,7 @@@ function positionals(args: string[]): s
}
function memberLine(m: MemberRecord): string {
- return ` ${m.id}${m.display_name ? ` (${m.display_name})` : ''} ${m.status} ${m.kind}${m.labelled_only ? ' labelled-only' : ''}${m.email ? ` email: ${m.email}` : ''}${m.groups.length ? ` groups: ${m.groups.join(', ')}` : ''}`;
- return ` ${m.id}${m.display_name ? ` (${m.display_name})` : ''} ${m.status}${m.kind === 'audience' ? ' audience' : ''}${m.email ? ` email: ${m.email}` : ''}${m.groups.length ? ` groups: ${m.groups.join(', ')}` : ''}`;
++ return ` ${m.id}${m.display_name ? ` (${m.display_name})` : ''} ${m.status}${m.kind === 'audience' ? ' audience' : ''}${m.labelled_only ? ' labelled-only' : ''}${m.email ? ` email: ${m.email}` : ''}${m.groups.length ? ` groups: ${m.groups.join(', ')}` : ''}`;
}
export interface WhoCanReadEntry {
diff --cc src/core/access/labelled-only.ts
index e055db7d9e,0000000000..b43727e548
mode 100644,000000..100644
--- a/src/core/access/labelled-only.ts
+++ b/src/core/access/labelled-only.ts
@@@ -1,73 -1,0 +1,73 @@@
+/**
- * GBRA-108 design 1: the labelled-only grant. A member that carries access_members.labelled_only (v306; false by default
++ * GBRA-108 design 1: the labelled-only grant. A member that carries access_members.labelled_only (the labelled-only migration; false by default
+ * and unchanged on upgrade) reads only pages that name it: its member id or one of its groups in readable_by, or a folder
+ * or page rule that lists it. Unlabelled pages its source grant would otherwise open are hidden, and so is every derived
+ * page and fact with no readers or rule of its own, except under access.members_read_lineage where every origin names it
+ * (CallerAccess.labelledOnly, search/private-visibility.ts). For group and audience credentials that should see only what
+ * was deliberately labelled for them.
+ *
+ * The flag lives on the member, so every token, OAuth client and stdio binding of that member inherits it, and a second
+ * credential cannot forget it. It never applies to the owner: setting it on the owner, or naming a labelled-only member
+ * the owner, is refused (access_labelled_only_owner, exit 3). Only the trusted local operator sets it; a remote caller is
+ * refused before anything is written, and no MCP operation or HTTP route reaches it. Everything lives in the database, so
+ * a repo-less brain gets it unchanged.
+ */
+import type { BrainEngine } from '../engine.ts';
+import { opError } from '../ops/contract.ts';
+import { hostOnlyError } from '../ops/op-fix.ts';
+import { ACCESS_ID_RE } from './principals.ts';
+import { assertAccessId, existingMember, getMember, type MemberRecord } from './members.ts';
+import { labelledOnlyOwnerError, ownerMemberId } from './owner.ts';
+
+/**
+ * Marks a member labelled-only or clears it. Only the trusted local operator may (remote strictly false), and never on the
+ * owner; both refusals come before anything is written.
+ */
+export async function setMemberLabelledOnly(engine: BrainEngine, rawId: unknown, on: boolean, ctx: { remote?: boolean }): Promise<{ member: MemberRecord; changed: boolean }> {
+ const id = assertAccessId(rawId);
+ if (ctx.remote !== false) {
+ throw hostOnlyError({ remote: true, transport: 'http' }, 'permission_denied',
+ 'Only the brain operator on the brain host sets or clears a labelled-only grant, so nothing was changed.',
+ ['gbrain', 'access', 'member', 'labelled-only', id, on ? 'on' : 'off'],
+ 'Decides which pages every credential of that member reads. Who reads what is the brain operator\'s decision, never an agent\'s.');
+ }
+ const member = await existingMember(engine, id, 'changed');
+ if (member.status === 'removed') {
+ throw opError('access_member_id_retired', `Member id "${member.id}" was removed and can never be reused.`, 'Add a new member id instead.', { why: 'A removed member stays removed.' });
+ }
+ if (on && await ownerMemberId(engine) === member.id) throw labelledOnlyOwnerError(member.id, 'grant');
+ if (member.labelled_only === on) return { member, changed: false };
+ await engine.executeRaw('UPDATE access_members SET labelled_only = $2, updated_at = now() WHERE id = $1 AND tombstoned_at IS NULL', [member.id, on]);
+ return { member: (await getMember(engine, member.id))!, changed: true };
+}
+
+/** The enabled labelled-only members, sorted; empty when none. */
+export async function labelledOnlyMemberIds(engine: Pick<BrainEngine, 'executeRaw'>): Promise<string[]> {
+ const rows = await engine.executeRaw<{ id: string }>(
+ 'SELECT id FROM access_members WHERE labelled_only AND disabled_at IS NULL AND tombstoned_at IS NULL ORDER BY id');
+ return rows.map(r => r.id);
+}
+
+/** Whether any member carries the grant: the one cheap test a write runs before resolving its writer. Unreadable counts as yes. */
+export async function anyLabelledOnlyMember(engine: Pick<BrainEngine, 'executeRaw'>): Promise<boolean> {
+ try {
+ return (await engine.executeRaw('SELECT 1 FROM access_members WHERE labelled_only LIMIT 1')).length > 0;
+ } catch {
+ return true;
+ }
+}
+
+/**
+ * Whether a read or write by these identities is labelled-only: one of their members carries the grant. A table that
+ * cannot be read counts as yes (fail closed: it only narrows). Identities without a member (unbound, a group, a guest)
+ * are never labelled-only.
+ */
+export async function labelledOnlyFor(engine: Pick<BrainEngine, 'executeRaw'>, identities: readonly (readonly string[])[]): Promise<boolean> {
+ const members = [...new Set(identities.flat().filter(p => p.startsWith('member:')).map(p => p.slice('member:'.length)).filter(id => ACCESS_ID_RE.test(id)))];
+ if (!members.length) return false;
+ try {
+ return (await engine.executeRaw('SELECT 1 FROM access_members WHERE labelled_only AND id = ANY($1::text[]) LIMIT 1', [members])).length > 0;
+ } catch {
+ return true;
+ }
+}
diff --cc src/core/cli-flag-registry.generated.ts
index 8a6bcd0173,aaea0b0410..ede6fce95e
--- a/src/core/cli-flag-registry.generated.ts
+++ b/src/core/cli-flag-registry.generated.ts
@@@ -52,7 -52,7 +52,7 @@@ export const CLI_FLAG_REGISTRY: Record<
'db-repair': ['--accept-pending', '--apply', '--apply-rewrites', '--as', '--background', '--brain', '--break-lock', '--db-url', '--dry-run', '--explain', '--filter', '--follow', '--force', '--force-retry', '--format', '--help', '--http', '--json', '--legacy-lock', '--locks', '--name', '--no-accept-pending', '--path', '--prefer-postgres', '--probe', '--progress-interval', '--progress-json', '--quiet', '--remediate', '--restart', '--skip-verify', '--source', '--statement-timeout', '--supabase', '--timeout', '--timings', '--undo-last-rewrite', '--url', '--version', '--wait', '--yes'],
'decide': ['--accept-all', '--all', '--all-from', '--apply', '--brain', '--call-site', '--claims', '--dataset', '--dry-run', '--egress', '--embedding-dimensions', '--embedding-model', '--expect', '--from', '--help', '--include-withdrawals', '--input', '--items-out', '--json', '--kind', '--limit', '--max-cost', '--max-usd', '--min', '--non-interactive', '--out', '--provenance', '--provider', '--query', '--rate', '--reason', '--reason-family', '--recommended', '--remove', '--shadow', '--since', '--slot', '--source', '--status', '--suite', '--target', '--threshold', '--trust', '--undo', '--uri-prefix', '--version', '--what-if-threshold', '--yes'],
'diag': ['--access', '--add', '--all', '--allowed-operations', '--apply', '--as', '--asof', '--body', '--bound-slug-prefixes', '--brain', '--budget-ms', '--client', '--count', '--cursor', '--date', '--dated-since', '--days', '--detach', '--entities', '--expect', '--expected-revision', '--federated-read', '--filter', '--follow', '--format', '--from-index', '--full', '--fuzzy', '--group-by', '--held', '--help', '--http', '--id', '--include', '--include-ambiguous', '--include-deleted', '--json', '--kind', '--limit', '--max-usd', '--model', '--multimodal', '--no-autopilot-install', '--no-pull', '--no-walk', '--of', '--only', '--page', '--params', '--path', '--phase', '--prefer', '--preview', '--purge', '--query', '--recent', '--refresh-operations', '--replace', '--restart-only', '--reverse', '--row', '--scopes', '--session', '--side', '--since', '--slug', '--slugs', '--source', '--source-id', '--sources', '--stale', '--state', '--surface', '--to', '--updated-after', '--url', '--yes'],
- 'doctor': ['--abandon', '--abbrev-ref', '--abort', '--absolute-git-dir', '--accept-all', '--accept-capabilities', '--accept-pending', '--access', '--access-policy', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt', '--adopt-columns', '--adopt-permissions', '--advertise', '--after', '--agent', '--aggressive', '--aliases', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-outside-source-root', '--allow-shell-jobs', '--allow-unverified-remote', '--allowed-operations', '--anchor', '--applied', '--apply', '--apply-rewrites', '--approval-out', '--approved', '--as', '--assign-corpus', '--assume-unchanged', '--attest-actor', '--attest-ops', '--attest-read', '--attest-sources', '--audit', '--auto', '--auto-additive', '--auto-fix', '--autostash', '--background', '--base', '--batch', '--batch-check', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--bundled', '--by-mention', '--cached', '--cacheinfo', '--call-site', '--catalog', '--catch-up', '--channel', '--check', '--check-downgrade', '--check-only', '--cherry-mark', '--claims', '--class', '--claude-plugins', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--concurrency', '--confidence', '--config', '--confirm', '--confirm-destructive', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--contacts-dir', '--content-audit', '--content-root', '--continue', '--conversation', '--count', '--credentials-file', '--cursor', '--cwd', '--dataset', '--day', '--db-url', '--deadline', '--decisions', '--delegated-namespace', '--delegated-slug-prefixes', '--delete-brain', '--dest', '--detach', '--detail', '--diff-filter', '--dim', '--dimensions', '--dir', '--disable', '--drain', '--drain-timeout', '--dry-run', '--egress', '--email', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--entity', '--env', '--env-file', '--error-unmatch', '--exclude', '--exclude-standard', '--exit-code', '--expand', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--facts', '--fast', '--federated', '--federated-read', '--fetch-timeout-ms', '--ff-only', '--file', '--filter', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-rechunk', '--force-remove', '--force-retry', '--force-schema', '--force-with-lease', '--format', '--fresh', '--fresh-token', '--from', '--from-json', '--from-meetings', '--from-pages', '--full', '--full-tree', '--fuzzy', '--gbrain-bin', '--generation', '--get', '--get-all', '--get-regexp', '--get-url', '--git-common-dir', '--git-dir', '--git-path', '--grammar', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--heads', '--held', '--help', '--hold-state', '--holds', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--ignore-missing', '--images', '--import', '--include-ambiguous', '--include-covered', '--include-cross-entity', '--include-deleted', '--include-failures', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-pseudo', '--include-repairs', '--include-withdrawals', '--index-audit', '--index-info', '--infer-dates', '--init', '--input', '--input-type', '--install', '--instructions', '--instructions-only', '--is-ancestor', '--is-bare-repository', '--is-inside-work-tree', '--is-shallow-repository', '--items-out', '--job-isolation', '--jq', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--label-lowerings', '--lanes', '--lang', '--left-right', '--legacy-lock', '--limit', '--link', '--link-source', '--link-type', '--list', '--list-out', '--literal-pathspecs', '--local', '--local-env-vars', '--locks', '--log-noop', '--manifest', '--markdown', '--max-cost', '--max-cost-usd', '--max-count', '--max-facts', '--max-jobs', '--max-requests', '--max-rss', '--max-runtime', '--max-usd', '--max-waiting', '--may-act-for', '--mcp-only', '--member', '--members', '--members-file', '--merge-base', '--migrate-legacy', '--migrate-only', '--migration', '--min', '--min-n', '--mode', '--model', '--multimodal', '--name', '--name-only', '--name-status', '--nice', '--no-accept-pending', '--no-assume-unchanged', '--no-autopilot-install', '--no-autostash', '--no-capture', '--no-commit-id', '--no-confirm', '--no-cron', '--no-delegate', '--no-edit', '--no-embed', '--no-embed-cache', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-gpg-sign', '--no-hooks', '--no-instructions', '--no-lanes', '--no-llm', '--no-merges', '--no-migrate', '--no-optional-locks', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-seat', '--no-skip-worktree', '--no-stdio-member', '--no-tags', '--no-verify', '--no-walk', '--no-write-fetch-head', '--non-interactive', '--not', '--now', '--of', '--older-than', '--once', '--only', '--operation', '--operations', '--others', '--out', '--output', '--oversized', '--overwrite', '--page', '--parallel', '--params', '--parents', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--path-format', '--pending', '--pglite', '--phase', '--pid-file', '--plan', '--porcelain', '--port', '--prefer', '--prefer-postgres', '--prefix', '--preload', '--preset', '--preview', '--principal', '--private-pages', '--probe', '--probe-pglite', '--profile', '--progress-interval', '--progress-json', '--project', '--provenance', '--provider', '--providers', '--prune-orphans', '--public-url', '--pull', '--pure', '--purge', '--push', '--push-only', '--qm', '--query', '--question', '--queue', '--quiet', '--rate', '--raw-only', '--reader-mode', '--readers', '--reason', '--reauth', '--rebase', '--rebuild', '--recommended', '--redact-paths', '--reference-date', '--refresh', '--refresh-operations', '--refresh-skills', '--regenerate', '--reissue', '--relative', '--relower', '--remediate', '--remediation-plan', '--remote', '--remove', '--remove-core', '--repair', '--repair-unknown-markers', '--replace', '--repo', '--request', '--request-id', '--require', '--require-clean', '--reranker', '--reset', '--reset-checkpoint', '--reset-default', '--reset-session', '--resolve', '--restart-only', '--restore-only', '--resume', '--retire', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--reverse', '--review-lower', '--revision', '--right-only', '--rollback-to-source', '--root', '--routing', '--rules', '--run', '--runtime', '--safe', '--sample', '--save', '--scan-secrets', '--scope', '--scopes', '--search-mode', '--seat', '--section', '--segmented', '--select', '--self-transfer', '--semantic', '--serves', '--session', '--session-id', '--set', '--set-upstream-to', '--shadow', '--shared-skills', '--short', '--show-current', '--show-object-format', '--show-prefix', '--show-token', '--show-toplevel', '--side', '--since', '--since-last-run', '--skill-loading', '--skills-dir', '--skills-index-only', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--skip-verify', '--skip-worktree', '--slot', '--slot-a-model', '--slot-b-model', '--slot-c-model', '--slug', '--slugs', '--source', '--source-id', '--source-ids', '--sources', '--squash', '--src-subpath', '--staged', '--stale', '--stat', '--state', '--statement-timeout', '--status', '--stdin', '--stdio-member', '--stop-mcp', '--strategy', '--strict', '--suite', '--supabase', '--surface', '--swap-only', '--symbol-kind', '--symbolic-full-name', '--tags', '--take', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--timings', '--to', '--token', '--token-ttl', '--top-k', '--topo-order', '--trust', '--tsconfig-override', '--type', '--types', '--unindexed', '--uninstall', '--unsafe-bypass-dream-guard', '--unset', '--unset-all', '--unsettle', '--unshallow', '--untracked-files', '--url', '--url-env', '--user', '--vacuum', '--vectors', '--verbose', '--verify', '--version', '--wait', '--wait-drain', '--warn-only', '--watch', '--what-if-threshold', '--where', '--window', '--workers', '--working-tree', '--workspace', '--worktree', '--write-tree', '--yes'],
- 'doctor': ['--abandon', '--abbrev-ref', '--abort', '--absolute-git-dir', '--accept-all', '--accept-capabilities', '--accept-pending', '--access', '--access-policy', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt', '--adopt-columns', '--adopt-permissions', '--advertise', '--after', '--agent', '--aggressive', '--aliases', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-outside-source-root', '--allow-shell-jobs', '--allow-unverified-remote', '--allow-without-owner', '--allowed-operations', '--anchor', '--applied', '--apply', '--apply-rewrites', '--approval-out', '--approved', '--as', '--assign-corpus', '--assume-unchanged', '--attest-actor', '--attest-ops', '--attest-read', '--attest-sources', '--audit', '--auto', '--auto-additive', '--auto-fix', '--autostash', '--background', '--base', '--batch', '--batch-check', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--bundled', '--by-mention', '--cached', '--cacheinfo', '--call-site', '--catalog', '--catch-up', '--channel', '--check', '--check-downgrade', '--check-only', '--cherry-mark', '--claims', '--class', '--claude-plugins', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--concurrency', '--confidence', '--config', '--confirm', '--confirm-destructive', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--contacts-dir', '--content-audit', '--content-root', '--continue', '--conversation', '--count', '--credentials-file', '--cursor', '--cwd', '--dataset', '--day', '--db-url', '--deadline', '--decisions', '--delegated-namespace', '--delegated-slug-prefixes', '--delete-brain', '--dest', '--detach', '--detail', '--diff-filter', '--dim', '--dimensions', '--dir', '--disable', '--drain', '--drain-timeout', '--dry-run', '--egress', '--email', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--entity', '--env', '--env-file', '--error-unmatch', '--exclude', '--exclude-standard', '--exit-code', '--expand', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--facts', '--fast', '--federated', '--federated-read', '--fetch-timeout-ms', '--ff-only', '--file', '--filter', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-rechunk', '--force-remove', '--force-retry', '--force-schema', '--force-with-lease', '--format', '--fresh', '--fresh-token', '--from', '--from-json', '--from-meetings', '--from-pages', '--full', '--full-tree', '--fuzzy', '--gbrain-bin', '--generation', '--get', '--get-all', '--get-regexp', '--get-url', '--git-common-dir', '--git-dir', '--git-path', '--grammar', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--heads', '--held', '--help', '--hold-state', '--holds', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--ignore-missing', '--images', '--import', '--include-ambiguous', '--include-covered', '--include-cross-entity', '--include-deleted', '--include-failures', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-pseudo', '--include-repairs', '--include-withdrawals', '--index-audit', '--index-info', '--infer-dates', '--init', '--input', '--input-type', '--install', '--instructions', '--instructions-only', '--is-ancestor', '--is-bare-repository', '--is-inside-work-tree', '--is-shallow-repository', '--items-out', '--job-isolation', '--jq', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--label-lowerings', '--lanes', '--lang', '--left-right', '--legacy-lock', '--limit', '--link', '--link-source', '--link-type', '--list', '--list-out', '--literal-pathspecs', '--local', '--local-env-vars', '--locks', '--log-noop', '--manifest', '--markdown', '--max-cost', '--max-cost-usd', '--max-count', '--max-facts', '--max-jobs', '--max-requests', '--max-rss', '--max-runtime', '--max-usd', '--max-waiting', '--may-act-for', '--mcp-only', '--member', '--members', '--members-file', '--merge-base', '--migrate-legacy', '--migrate-only', '--migration', '--min', '--min-n', '--mode', '--model', '--multimodal', '--name', '--name-only', '--name-status', '--nice', '--no-accept-pending', '--no-assume-unchanged', '--no-autopilot-install', '--no-autostash', '--no-capture', '--no-commit-id', '--no-confirm', '--no-cron', '--no-delegate', '--no-edit', '--no-embed', '--no-embed-cache', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-gpg-sign', '--no-hooks', '--no-instructions', '--no-lanes', '--no-llm', '--no-merges', '--no-migrate', '--no-optional-locks', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-seat', '--no-skip-worktree', '--no-stdio-member', '--no-tags', '--no-verify', '--no-walk', '--no-write-fetch-head', '--non-interactive', '--not', '--now', '--of', '--older-than', '--once', '--only', '--operation', '--operations', '--others', '--out', '--output', '--oversized', '--overwrite', '--page', '--parallel', '--params', '--parents', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--path-format', '--pending', '--pglite', '--phase', '--pid-file', '--plan', '--porcelain', '--port', '--prefer', '--prefer-postgres', '--prefix', '--preload', '--preset', '--preview', '--principal', '--private-pages', '--probe', '--probe-pglite', '--profile', '--progress-interval', '--progress-json', '--project', '--provenance', '--provider', '--providers', '--prune-orphans', '--public-url', '--pull', '--pure', '--purge', '--push', '--push-only', '--qm', '--query', '--question', '--queue', '--quiet', '--rate', '--raw-only', '--reader-mode', '--readers', '--reason', '--reauth', '--rebase', '--rebuild', '--recommended', '--redact-paths', '--reference-date', '--refresh', '--refresh-operations', '--refresh-skills', '--regenerate', '--reissue', '--relative', '--relower', '--remediate', '--remediation-plan', '--remote', '--remove', '--remove-core', '--repair', '--repair-unknown-markers', '--replace', '--repo', '--request', '--request-id', '--require', '--require-clean', '--reranker', '--reset', '--reset-checkpoint', '--reset-default', '--reset-session', '--resolve', '--restart-only', '--restore-only', '--resume', '--retire', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--reverse', '--review-lower', '--revision', '--right-only', '--rollback-to-source', '--root', '--routing', '--rules', '--run', '--runtime', '--safe', '--sample', '--save', '--scan-secrets', '--scope', '--scopes', '--search-mode', '--seat', '--section', '--segmented', '--select', '--self-transfer', '--semantic', '--serves', '--session', '--session-id', '--set', '--set-upstream-to', '--shadow', '--shared-skills', '--short', '--show-current', '--show-object-format', '--show-prefix', '--show-token', '--show-toplevel', '--side', '--since', '--since-last-run', '--skill-loading', '--skills-dir', '--skills-index-only', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--skip-verify', '--skip-worktree', '--slot', '--slot-a-model', '--slot-b-model', '--slot-c-model', '--slug', '--slugs', '--slugs-file', '--source', '--source-id', '--source-ids', '--sources', '--squash', '--src-subpath', '--staged', '--stale', '--stat', '--state', '--statement-timeout', '--status', '--stdin', '--stdio-member', '--stop-mcp', '--strategy', '--strict', '--suite', '--supabase', '--surface', '--swap-only', '--symbol-kind', '--symbolic-full-name', '--tags', '--take', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--timings', '--to', '--token', '--token-ttl', '--top-k', '--topo-order', '--trust', '--tsconfig-override', '--type', '--types', '--unindexed', '--uninstall', '--unsafe-bypass-dream-guard', '--unset', '--unset-all', '--unsettle', '--unshallow', '--untracked-files', '--url', '--url-env', '--user', '--vacuum', '--vectors', '--verbose', '--verify', '--version', '--wait', '--wait-drain', '--warn-only', '--watch', '--what-if-threshold', '--where', '--window', '--workers', '--working-tree', '--workspace', '--worktree', '--write-tree', '--yes'],
++ 'doctor': ['--abandon', '--abbrev-ref', '--abort', '--absolute-git-dir', '--accept-all', '--accept-capabilities', '--accept-pending', '--access', '--access-policy', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt', '--adopt-columns', '--adopt-permissions', '--advertise', '--after', '--agent', '--aggressive', '--aliases', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-outside-source-root', '--allow-shell-jobs', '--allow-unverified-remote', '--allow-without-owner', '--allowed-operations', '--anchor', '--applied', '--apply', '--apply-rewrites', '--approval-out', '--approved', '--as', '--assign-corpus', '--assume-unchanged', '--attest-actor', '--attest-ops', '--attest-read', '--attest-sources', '--audit', '--auto', '--auto-additive', '--auto-fix', '--autostash', '--background', '--base', '--batch', '--batch-check', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--bundled', '--by-mention', '--cached', '--cacheinfo', '--call-site', '--catalog', '--catch-up', '--channel', '--check', '--check-downgrade', '--check-only', '--cherry-mark', '--claims', '--class', '--claude-plugins', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--concurrency', '--confidence', '--config', '--confirm', '--confirm-destructive', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--contacts-dir', '--content-audit', '--content-root', '--continue', '--conversation', '--count', '--credentials-file', '--cursor', '--cwd', '--dataset', '--day', '--db-url', '--deadline', '--decisions', '--delegated-namespace', '--delegated-slug-prefixes', '--delete-brain', '--dest', '--detach', '--detail', '--diff-filter', '--dim', '--dimensions', '--dir', '--disable', '--drain', '--drain-timeout', '--dry-run', '--egress', '--email', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--entity', '--env', '--env-file', '--error-unmatch', '--exclude', '--exclude-standard', '--exit-code', '--expand', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--facts', '--fast', '--federated', '--federated-read', '--fetch-timeout-ms', '--ff-only', '--file', '--filter', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-rechunk', '--force-remove', '--force-retry', '--force-schema', '--force-with-lease', '--format', '--fresh', '--fresh-token', '--from', '--from-json', '--from-meetings', '--from-pages', '--full', '--full-tree', '--fuzzy', '--gbrain-bin', '--generation', '--get', '--get-all', '--get-regexp', '--get-url', '--git-common-dir', '--git-dir', '--git-path', '--grammar', '--grant-types', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--heads', '--held', '--help', '--hold-state', '--holds', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--ignore-missing', '--images', '--import', '--include-ambiguous', '--include-covered', '--include-cross-entity', '--include-deleted', '--include-failures', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-pseudo', '--include-repairs', '--include-withdrawals', '--index-audit', '--index-info', '--infer-dates', '--init', '--input', '--input-type', '--install', '--instructions', '--instructions-only', '--is-ancestor', '--is-bare-repository', '--is-inside-work-tree', '--is-shallow-repository', '--items-out', '--job-isolation', '--jq', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--label-lowerings', '--lanes', '--lang', '--left-right', '--legacy-lock', '--limit', '--link', '--link-source', '--link-type', '--list', '--list-out', '--literal-pathspecs', '--local', '--local-env-vars', '--locks', '--log-noop', '--manifest', '--markdown', '--max-cost', '--max-cost-usd', '--max-count', '--max-facts', '--max-jobs', '--max-requests', '--max-rss', '--max-runtime', '--max-usd', '--max-waiting', '--may-act-for', '--mcp-only', '--member', '--members', '--members-file', '--merge-base', '--migrate-legacy', '--migrate-only', '--migration', '--min', '--min-n', '--mode', '--model', '--multimodal', '--name', '--name-only', '--name-status', '--nice', '--no-accept-pending', '--no-assume-unchanged', '--no-autopilot-install', '--no-autostash', '--no-capture', '--no-commit-id', '--no-confirm', '--no-cron', '--no-delegate', '--no-edit', '--no-embed', '--no-embed-cache', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-gpg-sign', '--no-hooks', '--no-instructions', '--no-lanes', '--no-llm', '--no-merges', '--no-migrate', '--no-optional-locks', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-seat', '--no-skip-worktree', '--no-stdio-member', '--no-tags', '--no-verify', '--no-walk', '--no-write-fetch-head', '--non-interactive', '--not', '--now', '--of', '--older-than', '--once', '--only', '--operation', '--operations', '--others', '--out', '--output', '--oversized', '--overwrite', '--page', '--parallel', '--params', '--parents', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--path-format', '--pending', '--pglite', '--phase', '--pid-file', '--plan', '--porcelain', '--port', '--prefer', '--prefer-postgres', '--prefix', '--preload', '--preset', '--preview', '--principal', '--private-pages', '--probe', '--probe-pglite', '--profile', '--progress-interval', '--progress-json', '--project', '--provenance', '--provider', '--providers', '--prune-orphans', '--public-url', '--pull', '--pure', '--purge', '--push', '--push-only', '--qm', '--query', '--question', '--queue', '--quiet', '--rate', '--raw-only', '--reader-mode', '--readers', '--reason', '--reauth', '--rebase', '--rebuild', '--recommended', '--redact-paths', '--reference-date', '--refresh', '--refresh-operations', '--refresh-skills', '--regenerate', '--reissue', '--relative', '--relower', '--remediate', '--remediation-plan', '--remote', '--remove', '--remove-core', '--repair', '--repair-unknown-markers', '--replace', '--repo', '--request', '--request-id', '--require', '--require-clean', '--reranker', '--reset', '--reset-checkpoint', '--reset-default', '--reset-session', '--resolve', '--restart-only', '--restore-only', '--resume', '--retire', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--reverse', '--review-lower', '--revision', '--right-only', '--rollback-to-source', '--root', '--routing', '--rules', '--run', '--runtime', '--safe', '--sample', '--save', '--scan-secrets', '--scope', '--scopes', '--search-mode', '--seat', '--section', '--segmented', '--select', '--self-transfer', '--semantic', '--serves', '--session', '--session-id', '--set', '--set-upstream-to', '--shadow', '--shared-skills', '--short', '--show-current', '--show-object-format', '--show-prefix', '--show-token', '--show-toplevel', '--side', '--since', '--since-last-run', '--skill-loading', '--skills-dir', '--skills-index-only', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--skip-verify', '--skip-worktree', '--slot', '--slot-a-model', '--slot-b-model', '--slot-c-model', '--slug', '--slugs', '--slugs-file', '--source', '--source-id', '--source-ids', '--sources', '--squash', '--src-subpath', '--staged', '--stale', '--stat', '--state', '--statement-timeout', '--status', '--stdin', '--stdio-member', '--stop-mcp', '--strategy', '--strict', '--suite', '--supabase', '--surface', '--swap-only', '--symbol-kind', '--symbolic-full-name', '--tags', '--take', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--timings', '--to', '--token', '--token-ttl', '--top-k', '--topo-order', '--trust', '--tsconfig-override', '--type', '--types', '--unindexed', '--uninstall', '--unsafe-bypass-dream-guard', '--unset', '--unset-all', '--unsettle', '--unshallow', '--untracked-files', '--url', '--url-env', '--user', '--vacuum', '--vectors', '--verbose', '--verify', '--version', '--wait', '--wait-drain', '--warn-only', '--watch', '--what-if-threshold', '--where', '--window', '--workers', '--working-tree', '--workspace', '--worktree', '--write-tree', '--yes'],
'dream': ['--audit-rejects', '--brain', '--cancel-unmatched', '--date', '--dir', '--drain', '--dry-run', '--eval-run', '--force', '--from', '--help', '--input', '--install', '--json', '--limit', '--list', '--max-usd', '--once', '--phase', '--probe', '--pull', '--reconcile-queue', '--since', '--source', '--source-id', '--threshold', '--to', '--unsafe-bypass-dream-guard', '--window', '--yes'],
'edge-proposals': ['--access', '--add', '--all', '--all-applied', '--all-held', '--allowed-operations', '--as', '--asof', '--body', '--bound-slug-prefixes', '--brain', '--client', '--cursor', '--date', '--dated-since', '--days', '--entities', '--federated-read', '--follow', '--from-index', '--full', '--fuzzy', '--group-by', '--help', '--http', '--id', '--include', '--include-deleted', '--json', '--kind', '--limit', '--max-usd', '--model', '--multimodal', '--no-autopilot-install', '--of', '--only', '--page', '--params', '--path', '--phase', '--prefer', '--purge', '--recent', '--refresh-operations', '--row', '--scopes', '--session', '--since', '--slugs', '--source', '--sources', '--stale', '--status', '--surface', '--to', '--updated-after', '--url', '--yes'],
'edges-backfill': ['--all-sources', '--brain', '--concurrency', '--help', '--json', '--max-chunks', '--source', '--workers'],
diff --cc src/core/persistence/page-visibility.ts
index 8806a2d474,e04873559a..165db2a928
--- a/src/core/persistence/page-visibility.ts
+++ b/src/core/persistence/page-visibility.ts
@@@ -33,12 -31,10 +33,13 @@@ export async function excludesPrivateWr
* member disabled or unbound after submission (a queued job, a replay) loses the page before commit, and the
* member-access part applies even when an operator relaxed privacy.
*/
- export async function authorizePageVisibility(engine: SqlEngine, authority: WriteAuthority, slug: string): Promise<void> {
+ export async function authorizePageVisibility(engine: SqlEngine, authority: WriteAuthority, page: string): Promise<void> {
if (!authority.remote) return;
+ const slug = authorizedSlug(authority, page);
- if (authority.excludePrivate ?? true) {
+ // GBRA-108 design 1: a labelled-only writer reads only pages that name it, so the empty-identity shortcut (a page every
+ // caller reads) does not apply to it.
+ const labelled = await anyLabelledOnlyMember(engine) && await writerLabelledOnly(engine, authority, await writerIdentities(engine, authority));
+ if (!labelled && (authority.excludePrivate ?? true)) {
// Privacy is hidden whatever the policy says, and an empty identity is the strictest reading (an identity only
// opens a page that names readers or sits under a folder rule), so a page visible with none needs no policy read
// or member lookup.
diff --cc src/core/search/private-visibility.ts
index 589635e0fc,2c1990167b..1c865d8b5d
--- a/src/core/search/private-visibility.ts
+++ b/src/core/search/private-visibility.ts
@@@ -349,14 -349,6 +349,14 @@@ export interface CallerAccess
* facts as if its readers named the owner. Ids pass ACCESS_ID_RE, so they embed as literals; empty otherwise.
*/
audienceKindMembers: readonly string[];
+ /**
- * GBRA-108 design 1 (labelled-only grant): the caller's member carries access_members.labelled_only (v306), so every
++ * GBRA-108 design 1 (labelled-only grant): the caller's member carries access_members.labelled_only (the labelled-only migration), so every
+ * credential bound to it reads only pages that name it: its member id or one of its groups in readable_by, or a folder
+ * or page rule that lists it (labelledOnlySql). An unlabelled page its source grant would otherwise open is hidden; a
+ * derived page or fact with no readers and no rule of its own is hidden too, except under access.members_read_lineage
+ * where every origin is labelled for the caller (gbrain_access_origin_labelled_for). Never on the owner.
+ */
+ labelledOnly: boolean;
applyRemoteReadPolicy: boolean;
restricted: boolean;
/** The fresh remote policy (readRemotePolicyNow) a remote request read when it started; null outside one. */
@@@ -469,50 -460,9 +469,50 @@@ export function callerReadersAllowedSql
const ownPage = ownerOptInPage(access);
const audience = audiencePages(access);
const onPage = (test: (pageAlias: string) => string) => row === 'snapshot' ? `EXISTS (SELECT 1 FROM pages sp WHERE sp.id = ${alias}.page_id AND ${test('sp')})` : test(alias);
- if (ownPage) return `(${readersAllowedSql(alias, access.identity, row)} OR ${onPage(a => notOtherMemberPageSql(a, ownPage, audience))})`;
- if (audience.length) return `(${readersAllowedSql(alias, access.identity, row)} OR ${onPage(a => audiencePageSql(a, audience))})`;
- return callerIdentities().map(identity => readersAllowedSql(alias, identity, row)).join(' AND ');
+ const readers = ownPage ? `(${readersAllowedSql(alias, access.identity, row)} OR ${onPage(a => notOtherMemberPageSql(a, ownPage, audience))})`
+ : audience.length ? `(${readersAllowedSql(alias, access.identity, row)} OR ${onPage(a => audiencePageSql(a, audience))})`
+ : callerIdentities().map(identity => readersAllowedSql(alias, identity, row)).join(' AND ');
+ if (!access.labelledOnly) return readers;
+ if (row === 'page') return `(${readers} AND ${labelledOnlySql(alias, access)})`;
+ return `(${readers} AND (COALESCE(gbrain_access_readers(${alias}.frontmatter) && ${textArraySql(labelledIdentity(access))}, false)
+ OR EXISTS (SELECT 1 FROM pages sp WHERE sp.id = ${alias}.page_id AND ${labelledOnlySql('sp', access, false)})))`;
+}
+
+type LabelledRecord = Pick<CallerAccess, 'identity' | 'audienceIdentities' | 'satisfiedRuleIds' | 'lineage' | 'owner'>;
+
+/** GBRA-108 design 1: every principal a labelled-only read may be named by (the identity, or each audience entry's). */
+function labelledIdentity(access: LabelledRecord): string[] {
+ const identity = [...new Set([...access.identity, ...access.audienceIdentities.flat()])].sort();
+ return identity.length && validIdentity(identity) ? identity : [];
+}
+
+/**
+ * GBRA-108 design 1: `alias` names a labelled-only caller (CallerAccess.labelledOnly): its readable_by holds the caller's
+ * member or one of its groups, or one of its folder or page rules lists them (a rule the caller satisfies). Under
+ * access.members_read_lineage (a member read with lineage) a derived page with no label of its own passes only when it
- * has an origin and every origin names the caller (gbrain_access_origin_labelled_for, v306); with it off a derived page
++ * has an origin and every origin names the caller (gbrain_access_origin_labelled_for, the labelled-only migration); with it off a derived page
+ * that names nobody is hidden, whatever its origins say. ANDed with the caller's ordinary access, so it only narrows.
+ * `readers` false tests only the rules (a version snapshot carries its own readers). Ids embed as validated literals.
+ */
+function labelledOnlySql(alias: string, access: LabelledRecord, readers = true): string {
+ const identity = textArraySql(labelledIdentity(access));
+ const satisfied = textArraySql(access.satisfiedRuleIds.every(validQualifiedRuleId) ? access.satisfiedRuleIds : []);
+ const named = `(${readers ? `COALESCE(${alias}.page_readers && ${identity}, false) OR ` : ''}COALESCE(${alias}.folder_rule_ids && ${satisfied}, false))`;
+ if (!access.lineage || access.owner) return named;
+ return `(${named} OR ((${alias}.type IN ('atom', 'question', 'concept', 'event') OR ${alias}.frontmatter ? 'derived_from')
+ AND gbrain_access_origin_labelled_for(${alias}.id, ${alias}.source_id, ${alias}.type, ${alias}.frontmatter, ${identity}, ${satisfied})))`;
+}
+
+/**
+ * GBRA-108 design 1: the fact conjunct of a labelled-only read. A fact has no readers or rule of its own, so it is hidden,
+ * except under access.members_read_lineage when its provenance page exists and names the caller (labelledOnlySql). Empty
+ * for every other caller.
+ */
+function labelledOnlyFactSql(factAlias: string): string {
+ const access = currentCallerAccess();
+ if (!access.labelledOnly) return '';
+ if (!access.lineage || access.owner) return ' AND FALSE';
+ return ` AND EXISTS (SELECT 1 FROM pages lp WHERE lp.source_id = ${factAlias}.source_id AND lp.slug = ${factAlias}.source_markdown_slug AND ${labelledOnlySql('lp', access)})`;
}
const GUEST_ENTRY = 'guest';
diff --cc test/access-labelled-only.test.ts
index 88e46946e9,0000000000..34f520bad4
mode 100644,000000..100644
--- a/test/access-labelled-only.test.ts
+++ b/test/access-labelled-only.test.ts
@@@ -1,311 -1,0 +1,311 @@@
+import { afterAll, beforeAll, describe, expect, spyOn, test } from 'bun:test';
+import type { DoctorContext } from '../src/commands/doctor/context.ts';
+import { accessLabelledOnlyEntry } from '../src/commands/doctor/checks/access-labelled-only.ts';
+import { accessCheck, runAccess, whoCanRead } from '../src/commands/access.ts';
+import { setMembersReadLineage } from '../src/core/access/lineage.ts';
+import { setMemberLabelledOnly } from '../src/core/access/labelled-only.ts';
+import { setOwner } from '../src/core/access/owner.ts';
+import { bindCredential } from '../src/core/access/members.ts';
+import { callerIdentityKey } from '../src/core/access/member-facts.ts';
+import { knobsHash, resolveSearchMode } from '../src/core/search/mode.ts';
+import { __resetPrivateVisibilityCacheForTests, withCallerAccess } from '../src/core/search/private-visibility.ts';
+import { authorizePageVisibility } from '../src/core/persistence/page-visibility.ts';
+import type { WriteAuthority } from '../src/core/persistence/model.ts';
+import { exitCodeForCode } from '../src/core/error-catalogue.ts';
+import { importFromContent } from '../src/core/import-file.ts';
+import { mintLegacyToken } from '../src/core/token-mint.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 type { AuthInfo } from '../src/core/ops/contract.ts';
+import { ENFORCED_MEMBER_ENV, enforcedRead, memberPageView, type EnforcedAccess } from '../src/cli/enforced-member.ts';
+import { remoteCallerAccess } from '../src/core/access/caller.ts';
+import { PGLiteEngine } from '../src/core/pglite-engine.ts';
+import { buildLineageBrain, derivedOf, factsOf, HUB, type LineageBrain, type Seen } from './helpers/access-lineage-fixture.ts';
+import { testBackends } from './helpers/test-backends.ts';
+import { withEnv } from './helpers/with-env.ts';
+
+/**
- * GBRA-108 design 1: the labelled-only grant (access_members.labelled_only, v306; off by default, set only by the operator
++ * GBRA-108 design 1: the labelled-only grant (access_members.labelled_only, the labelled-only migration; off by default, set only by the operator
+ * on the brain host with gbrain access member labelled-only <id> on|off).
+ * 1. Protects: every credential bound to a labelled-only member reads only pages that name it (its id or one of its
+ * groups in readable_by, or a folder rule listing them), on every read path: MCP over HTTP tokens, the --as preview
+ * and the enforced member CLI's whole read surface. Unlabelled pages its source grant opens are hidden, and so is
+ * every derived page and fact with no readers or rule of its own (fail closed), except under
+ * access.members_read_lineage where every origin names the caller. An update to a page it cannot read and a create
+ * that would not name it are refused. With no grant set anywhere, nothing changes, and every other caller reads the
+ * same with the grant on.
+ * 2. Fails when: a labelled-only caller reads an unlabelled page, a derived page or fact that names nobody (off), or a
+ * derivative with one unlabelled or unreadable origin (on); misses a labelled page; another caller's view changes;
+ * the owner can hold the grant; a remote caller sets it; check, who-can-read or doctor do not report it; or the
+ * semantic cache and caller key do not separate it.
+ * 3. Real seams: tokens minted by the token service and verified by the serve --http verifier, dispatched through MCP
+ * dispatch (remote: true); the enforced member CLI's enforcedRead; the access CLI; folder rules in the database
+ * (repo-less) and in a committed access.yml (git); PGLite, and Postgres with DATABASE_URL; embeddings stubbed.
+ */
+
+const OWNER = 'owner-example';
+const BOT = 'group-bot-example';
+const ORIGINS = {
+ lab: { slug: 'notes/lab-example', fm: ['readable_by: [group:team-a]'], derive: true },
+ rule: { slug: 'team/rule-example', fm: [] as string[], derive: true },
+ open: { slug: 'notes/open-example', fm: [] as string[], derive: true },
+ other: { slug: 'notes/other-example', fm: ['readable_by: [alice-example]'], derive: true },
+};
+const MIXED = 'notes/mixed-derived';
+const LHUB = 'team/hub-labelled';
+const MIXED_CANARY = 'canarylomixedx';
+const RELAB = 'notes/relabelled-example';
+const RELAB_V1 = 'canarylorelabonex';
+const RELAB_V2 = 'canarylorelabtwox';
+const OTHERS = ['owner', 'bob', 'alice', 'unbound'] as const;
+
+describe('labelled-only grant: the cache keys', () => {
+ test('the semantic cache and the caller identity key separate a labelled-only caller from an ordinary one', () => {
+ const knobs = resolveSearchMode({ mode: 'balanced' });
+ const base = { identity: ['member:' + BOT, 'group:team-a'], applyRemoteReadPolicy: true, hidePrivate: true, privateReadableSources: [] as string[] };
+ const keys = (labelledOnly: boolean, lineage = false) => withCallerAccess({ ...base, labelledOnly, lineage }, () => [knobsHash(knobs, { excludePrivate: true }), callerIdentityKey()]);
+ const [plain, labelled, plainLineage, labelledLineage] = [keys(false), keys(true), keys(false, true), keys(true, true)];
+ for (const i of [0, 1]) expect(new Set([plain[i], labelled[i], plainLineage[i], labelledLineage[i]]).size).toBe(4);
+ expect(withCallerAccess({ ...base }, () => [knobsHash(knobs, { excludePrivate: true }), callerIdentityKey()])).toEqual(plain);
+ });
+});
+
+describe('labelled-only grant: who may set it', () => {
+ let engine: PGLiteEngine;
+ beforeAll(async () => {
+ engine = new PGLiteEngine(); await engine.connect({ engine: 'pglite' } as never); await engine.initSchema();
+ for (const id of [OWNER, BOT]) await engine.executeRaw('INSERT INTO access_members (id) VALUES ($1)', [id]);
+ await setOwner(engine, OWNER);
+ }, 120_000);
+ afterAll(async () => { await engine?.disconnect(); });
+
+ test('a remote caller cannot set or clear it, and no operation reaches it', async () => {
+ await expect(setMemberLabelledOnly(engine, BOT, true, { remote: true })).rejects.toMatchObject({ code: 'permission_denied' });
+ await expect(setMemberLabelledOnly(engine, BOT, true, {})).rejects.toMatchObject({ code: 'permission_denied' });
+ const [row] = await engine.executeRaw<{ labelled_only: boolean }>('SELECT labelled_only FROM access_members WHERE id = $1', [BOT]);
+ expect(row!.labelled_only).toBe(false);
+ const { OPERATION_MANIFEST } = await import('../src/cli/op-manifest.ts');
+ expect(OPERATION_MANIFEST.filter(o => /labelled/.test(o.name))).toEqual([]);
+ expect(await setMemberLabelledOnly(engine, BOT, true, { remote: false })).toMatchObject({ changed: true, member: { labelled_only: true } });
+ expect(await setMemberLabelledOnly(engine, BOT, false, { remote: false })).toMatchObject({ changed: true, member: { labelled_only: false } });
+ });
+
+ test('never on the owner: setting it there, or naming a labelled-only member the owner, refuses with exit 3 and asks the user', async () => {
+ const refused = await setMemberLabelledOnly(engine, OWNER, true, { remote: false }).catch(e => e);
+ expect(refused).toMatchObject({ code: 'access_labelled_only_owner', fix: { ask_user: true, actor: 'user' } });
+ expect(String(refused.message)).toContain('is the brain owner');
+ expect(exitCodeForCode(refused.code)).toBe(3);
+ const [row] = await engine.executeRaw<{ labelled_only: boolean }>('SELECT labelled_only FROM access_members WHERE id = $1', [OWNER]);
+ expect(row!.labelled_only).toBe(false);
+ await setMemberLabelledOnly(engine, BOT, true, { remote: false });
+ const owner = await setOwner(engine, BOT).catch(e => e);
+ expect(owner).toMatchObject({ code: 'access_labelled_only_owner', fix: { ask_user: true, argv: ['gbrain', 'access', 'member', 'labelled-only', BOT, 'off'] } });
+ expect(await engine.getConfig('access.owner_member')).toBe(OWNER);
+ await setMemberLabelledOnly(engine, BOT, false, { remote: false });
+ });
+});
+
+for (const kind of testBackends()) {
+ for (const store of ['database', 'git'] as const) {
+ describe('labelled-only grant (' + kind + ', rules in ' + (store === 'git' ? 'access.yml' : 'the database, repo-less') + ')', () => {
+ let b: LineageBrain;
+ const SRC = 'lo-src';
+ const before: Record<string, Seen> = {};
+ const writeToken = { token: '', id: '' };
+ async function cli(args: string[]): Promise<any> {
+ const lines: string[] = [];
+ const spy = spyOn(console, 'log').mockImplementation((...a: unknown[]) => { lines.push(a.map(String).join(' ')); });
+ try { await runAccess(b.engine, [...args, '--json']); } finally { spy.mockRestore(); }
+ return JSON.parse(lines.join('\n'));
+ }
+ const grant = async (on: boolean) => { await cli(['member', 'labelled-only', BOT, on ? 'on' : 'off']); __resetPrivateVisibilityCacheForTests(); };
+ const lineage = async (on: boolean) => { await setMembersReadLineage(b.engine, on, { remote: false }); __resetPrivateVisibilityCacheForTests(); };
+ const doctor = async () => (await accessLabelledOnlyEntry.run({ engine: b.engine } as unknown as DoctorContext) as Array<{ name: string; status: string; message: string }>)[0]!;
+ const authority = (): WriteAuthority => ({ version: 1, principal: { kind: 'legacy_token', id: writeToken.id }, remote: true, excludePrivate: true, sourceId: SRC,
+ sourceIncarnation: 'unused', scopes: ['read', 'write'], operations: null, slugPrefixes: null } as WriteAuthority);
+ async function put(slug: string, fm: string[]): Promise<{ isError: boolean; json: Record<string, any> }> {
+ const provider = new GBrainOAuthProvider({ sql: sqlQueryForEngine(b.engine), transaction: fn => b.engine.transaction(tx => fn(sqlQueryForEngine(tx))) });
+ const auth = await provider.verifyAccessToken(writeToken.token) as unknown as AuthInfo;
+ const content = ['---', 'type: note', 'title: Bot page', ...fm, '---', '# Bot page', '', 'Written by the group bot.'].join('\n');
+ const out = await dispatchToolCall(b.engine, 'put_page', { slug, content }, { remote: true, transport: 'http', auth, sourceId: SRC, takesHoldersAllowList: ['world'] });
+ const text = out.content.map(c => c.text).join('\n');
+ let json: Record<string, any> = {};
+ try { json = JSON.parse(text); } catch { /* prose */ }
+ return { isError: out.isError === true, json };
+ }
+ const oldCanary = (key: string) => 'canaryold' + 'lo' + key.replace(/[^a-z]/g, '') + 'x';
+ /** The enforced member CLI's whole read surface (enforced-member-classes READ_OPS), for one origin key: which ops show it. */
+ async function enforcedSeen(key: 'lab' | 'open'): Promise<string[]> {
+ const slug = ORIGINS[key].slug;
+ const reads: Array<[string, Record<string, unknown>, (text: string) => boolean]> = [
+ ['search', { query: 'harbor ledger planning notes', autocut: false, limit: 100 }, t => t.includes(b.canary(key))],
+ ['query', { query: 'harbor ledger planning notes', expand: false, autocut: false, limit: 100 }, t => t.includes(b.canary(key))],
+ ['search_exact', { phrase: b.canary(key) }, t => t.includes('"slug":"' + slug + '"')],
+ ['list_pages', { limit: 100 }, t => t.includes('"' + slug + '"')],
+ ['find_pages', { pattern: slug.split('/')[0] + '/*' }, t => t.includes('"slug":"' + slug + '"')],
+ ['get_page', { slug }, t => t.includes(b.canary(key))],
+ ['get_backlinks', { slug: LHUB }, t => t.includes('"' + slug + '"')],
+ ['get_timeline', { slug }, t => t.includes('Timeline ' + b.canary(key))],
+ ['get_links', { slug }, t => t.includes('"to_slug":"' + LHUB + '"')],
+ ['get_tags', { slug }, t => t.includes('tag-' + key)],
+ ['get_versions', { slug, include_body: true }, t => t.includes(oldCanary(key))],
+ ['whoami', {}, t => t.includes(b.canary(key)) || t.includes(slug)],
+ ['entity', { name: slug }, t => t.includes(b.canary(key))],
+ ['whois', { query: key + ' origin', types: ['note'] }, t => t.includes('"slug":"' + slug + '"')],
+ ['traverse_graph', { slug: LHUB, depth: 1, direction: 'in' }, t => t.includes('"from_slug":"' + slug + '"')],
+ ];
+ const seen: string[] = [];
+ await withEnv({ [ENFORCED_MEMBER_ENV]: BOT }, async () => {
+ for (const [op, params, shows] of reads) {
+ const text = await enforcedRead(b.engine, op, op, params, { sourceId: SRC }).then(r => JSON.stringify(r), () => '');
+ if (shows(text)) seen.push(op);
+ }
+ });
+ return seen;
+ }
+ /** get_stats --by type through the enforced CLI: the page counts the member sees. */
+ async function enforcedStats(): Promise<number> {
+ return withEnv({ [ENFORCED_MEMBER_ENV]: BOT }, async () => ((await enforcedRead(b.engine, 'get_stats', 'get_stats', { by: 'type' }, { sourceId: SRC })) as { total_pages: number }).total_pages);
+ }
+ const ALL_READS = ['search', 'query', 'search_exact', 'list_pages', 'find_pages', 'get_page', 'get_backlinks', 'get_timeline', 'get_links', 'get_tags', 'get_versions', 'entity', 'whois', 'traverse_graph'];
+
+ beforeAll(async () => {
+ b = await buildLineageBrain({
+ kind, store, src: SRC, tag: 'lo', origins: ORIGINS,
+ rules: [{ id: 'team', prefix: 'team/', readable_by: ['group:team-a'] }],
+ members: [OWNER, BOT, 'bob-example', 'alice-example'], groups: { 'team-a': [BOT, 'bob-example'] }, owner: OWNER,
+ callers: [{ name: 'owner', member: OWNER }, { name: 'bot', member: BOT }, { name: 'bob', member: 'bob-example' }, { name: 'alice', member: 'alice-example' },
+ { name: 'as-bot', as: BOT }, { name: 'unbound' }],
+ });
+ await importFromContent(b.engine, MIXED, ['---', 'type: note', 'title: mixed derived', 'derived_from: [' + ORIGINS.lab.slug + ', ' + ORIGINS.open.slug + ']', '---', '# mixed', '', 'Harbor ledger planning notes ' + MIXED_CANARY + ' here.'].join('\n'), { sourceId: SRC });
+ for (const [fm, canary] of [[[] as string[], RELAB_V1], [['readable_by: [group:team-a]'], RELAB_V2]] as const) {
+ await importFromContent(b.engine, RELAB, ['---', 'type: note', 'title: relabelled', ...fm, '---', '# relabelled', '', 'Harbor ledger planning notes ' + canary + ' here.'].join('\n'), { sourceId: SRC });
+ }
+ await importFromContent(b.engine, LHUB, ['---', 'type: project', 'title: labelled hub', '---', '# labelled hub', '', 'Anchor page.'].join('\n'), { sourceId: SRC });
+ for (const key of ['lab', 'open'] as const) {
+ await b.engine.addLink(ORIGINS[key].slug, LHUB, 'hub', 'mentions', 'fixture', undefined, undefined, { fromSourceId: SRC, toSourceId: SRC });
+ await b.engine.addTimelineEntry(ORIGINS[key].slug, { date: '2026-01-02', source: 'fixture', summary: 'Timeline ' + b.canary(key) }, { sourceId: SRC });
+ await b.engine.addTag(ORIGINS[key].slug, 'tag-' + key, { sourceId: SRC });
+ }
+ await b.engine.executeRaw('UPDATE pages SET text_projection_revision = knowledge_revision WHERE source_id = $1', [SRC]);
+ const minted = await mintLegacyToken(b.engine, { name: 'bot-writer', scopes: ['read', 'write'], takesHolders: ['world'], sourceGrant: [SRC] });
+ await bindCredential(b.engine, { kind: 'token', id: minted.id }, { member: BOT });
+ Object.assign(writeToken, { token: minted.token, id: minted.id });
+ }, 300_000);
+ afterAll(async () => { await b?.close(); }, 60_000);
+
+ test('no grant anywhere (the default): every caller, the future labelled-only member included, reads as before', async () => {
+ for (const who of [...OTHERS, 'bot', 'as-bot']) before[who] = await b.seenBy(who);
+ const ordinary = b.expected(['lab', 'rule', 'open', ...derivedOf(b.keys, ['open'])], factsOf(b.keys, ['open']));
+ expect(before.bot).toEqual(ordinary);
+ expect(before.bob).toEqual(ordinary);
+ expect(before['as-bot']).toEqual(ordinary);
+ expect(await enforcedSeen('open')).toEqual(ALL_READS);
+ expect((await doctor()).message).toStartWith('Not applicable');
+ expect((await accessCheck(b.engine, { token: 'bot' })).labelled_only).toBe(false);
+ }, 600_000);
+
+ test('on, lineage off: only the labelled pages, on every path; no derived page or fact, whatever its origin', async () => {
+ await grant(true);
+ const labelled = { ...b.expected(['lab', 'rule'], []), backlinks: [] };
+ expect(await b.seenBy('bot')).toEqual(labelled);
+ expect(await b.seenBy('as-bot')).toEqual(labelled);
+ expect(await b.call('bot', 'get_page', { slug: MIXED })).not.toContain(MIXED_CANARY);
+ for (const who of OTHERS) expect({ who, seen: await b.seenBy(who) }).toEqual({ who, seen: before[who]! });
+ }, 600_000);
+
+ test('on: the enforced member CLI shows the labelled page on every read op and the unlabelled one on none; stats count only labelled pages', async () => {
+ expect(await enforcedSeen('lab')).toEqual(ALL_READS);
+ expect(await enforcedSeen('open')).toEqual([]);
+ expect(await enforcedStats()).toBe(4);
+ }, 600_000);
+
+ test('on, lineage on: derived pages and facts of labelled origins only; never of an unlabelled, unreadable or mixed origin', async () => {
+ await lineage(true);
+ try {
+ expect(await b.seenBy('bot')).toEqual({ ...b.expected(['lab', 'rule', ...derivedOf(b.keys, ['lab', 'rule'])], factsOf(b.keys, ['lab', 'rule'])), backlinks: [] });
+ expect(await b.call('bot', 'get_page', { slug: MIXED })).not.toContain(MIXED_CANARY);
+ expect(await b.call('bob', 'get_page', { slug: MIXED })).toContain(MIXED_CANARY);
+ expect(await enforcedStats()).toBe(4 + derivedOf(b.keys, ['lab', 'rule']).length);
+ } finally {
+ await lineage(false);
+ }
+ expect(await b.seenBy('bot')).toEqual({ ...b.expected(['lab', 'rule'], []), backlinks: [] });
+ }, 600_000);
+
+ test('writes: an unreadable target is refused; a create must name the member', async () => {
+ await expect(authorizePageVisibility(b.engine, authority(), ORIGINS.open.slug)).rejects.toMatchObject({ code: 'page_not_found' });
+ await expect(authorizePageVisibility(b.engine, authority(), ORIGINS.lab.slug)).resolves.toBeUndefined();
+ await expect(authorizePageVisibility(b.engine, authority(), ORIGINS.rule.slug)).resolves.toBeUndefined();
+ // A checkout source on Postgres refuses direct writes until it is bound or allows database-only writes; the access checks run either way.
+ if (store === 'git') await b.engine.setConfig('persistence.unbound_write', 'database_only');
+ const unnamed = await put('notes/bot-new', []);
+ expect(unnamed.json).toMatchObject({ code: 'access_labelled_only_unnamed' });
+ expect(JSON.stringify(unnamed.json)).toContain('readable_by: [' + BOT + ']');
+ expect((await b.engine.executeRaw('SELECT 1 FROM pages WHERE source_id = $1 AND slug = $2', [SRC, 'notes/bot-new'])).length).toBe(0);
+ expect((await put('notes/bot-new', ['readable_by: [group:team-a]'])).isError).toBe(false);
+ expect((await put('team/bot-new', [])).isError).toBe(false);
+ await grant(false);
+ try {
+ await expect(authorizePageVisibility(b.engine, authority(), ORIGINS.open.slug)).resolves.toBeUndefined();
+ expect((await put('notes/bot-open', [])).isError).toBe(false);
+ } finally {
+ await grant(true);
+ }
+ }, 600_000);
+
+ test('access check, who-can-read and doctor report it; the grant off restores every view', async () => {
+ const check = await accessCheck(b.engine, { token: 'bot' });
+ expect(check.labelled_only).toBe(true);
+ expect(check.explanation).toContain('It is labelled-only');
+ expect((await accessCheck(b.engine, { token: 'bob' })).labelled_only).toBe(false);
+ const open = (await whoCanRead(b.engine, ORIGINS.open.slug, SRC))[0]!;
+ expect(open.note).toContain('Labelled-only members (' + BOT + ')');
+ const lab = (await whoCanRead(b.engine, ORIGINS.lab.slug, SRC))[0]!;
+ expect(lab.members).toContain(BOT);
+ expect((await whoCanRead(b.engine, ORIGINS.other.slug, SRC))[0]!.members).not.toContain(BOT);
+ const d = await doctor();
+ expect(d.status).toBe('ok');
+ expect(d.message).toContain(BOT);
+ expect((await cli(['member', 'list'])).members.find((m: { id: string }) => m.id === BOT)).toMatchObject({ labelled_only: true });
+ await grant(false);
+ expect(await b.seenBy('bot')).toEqual(before.bot);
+ expect((await doctor()).message).toStartWith('Not applicable');
+ }, 600_000);
+
+ test('an older version that named nobody stays hidden after the page is relabelled; ordinary readers still see it', async () => {
+ const versions = (who: string) => b.call(who, 'get_versions', { slug: RELAB, include_body: true });
+ expect(await versions('bob')).toContain(RELAB_V1);
+ await grant(true);
+ try {
+ expect(await b.call('bot', 'get_page', { slug: RELAB })).toContain(RELAB_V2);
+ const own = await versions('bot');
+ expect(own).not.toContain(RELAB_V1);
+ expect(await versions('bob')).toContain(RELAB_V1);
+ } finally {
+ await grant(false);
+ }
+ expect(await versions('bot')).toContain(RELAB_V1);
+ }, 600_000);
+
+ test('enforced member writes: an unlabelled target is hidden, and a new slug is writable only under a rule naming the member', async () => {
+ const view = async (slug: string) => {
+ const base = await remoteCallerAccess(b.engine, undefined, [], 'stdio', null, BOT);
+ const ea: EnforcedAccess = { member: BOT, hiddenSources: new Set(),
+ access: { ...base, identity: [...base.identity ?? []], satisfiedRuleIds: [...base.satisfiedRuleIds ?? []], hidePrivate: true, owner: false, privateReadableSources: [], applyRemoteReadPolicy: false } };
+ return memberPageView(b.engine, ea, SRC, slug);
+ };
+ const all = async () => [await view(ORIGINS.open.slug), await view(ORIGINS.lab.slug), await view('notes/enforced-new'), await view('team/enforced-new')];
+ expect(await all()).toEqual(['readable', 'readable', 'missing', 'missing']);
+ await grant(true);
+ try {
+ expect(await all()).toEqual(['hidden', 'readable', 'hidden', 'missing']);
+ } finally {
+ await grant(false);
+ }
+ expect(await all()).toEqual(['readable', 'readable', 'missing', 'missing']);
+ }, 600_000);
+ });
+ }
+}