Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Bind a stdio connection to one person per harness entry instead of brain-wide (GST-363)
garrytan257c75682894
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0e4f2f4af3..2115a10e79 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -27,6 +27,16 @@ identifiers and attribution are available in the pre-removal Git revision- Docs: `docs/guides/setup.md` ("A brain that serves several people"), `INSTALL_FOR_AGENTS.md`, `skills/setup/SKILL.md`, `skills/conventions/brain-routing.md`.- Tests: `test/setup-serves-several.test.ts` (PGLite repo-less and Postgres in process with the minted keys verified by the serve --http verifier; spawned setup on PGLite; a repo brain with a real git repository).+**A stdio connection can now be bound to one person for one harness only: `gbrain setup claude-code --stdio-member <member>` (or `codex`) writes the binding into that harness's own MCP entry, and setup no longer writes the brain-wide `mcp.stdio_member`.** Before, binding stdio meant one config key in the brain, so every stdio session that opened it, from any harness on any machine, read as that member, private pages included. That is why setup refused the flag on Postgres. Now the member rides in the one harness entry that starts `gbrain serve --stdio-member <member>`, so another harness on the same machine, or another machine on the same Postgres brain, stays as it was.++### Itemized changes++- `gbrain serve --stdio-member <id>` (stdio only; refused with `--http`): that server reads as the live member, ahead of config `mcp.stdio_member`. A disabled or unknown member reads as nobody, with no fallback to the config key. Only the server's own argv sets it; nothing a caller sends (tool arguments, `_meta`, headers) does. whoami reports `bound_by: stdio_registration`.+- Stored writes from such a server stamp the member on the write authority (a jsonb field, so no migration), and preparation and publication re-resolve it live. A stdio wake subscription uses principal id `registration`, so the drain re-checks that member.+- `gbrain setup claude-code|codex --stdio-member <id>` no longer needs `--serves several` or a PGLite brain. The member must be enabled, or one of `--members` in the same run. It is still refused off claude-code and codex, with `--instructions-only` or `--remove`, and wherever OpenClaw or Hermes is installed; that refusal now names a per-person HTTP key as the route. `--no-stdio-member` removes it.+- Re-runs, `gbrain post-upgrade`'s launcher refresh and doctor's setup re-run keep an entry's existing `--stdio-member` and never add one; `setupRerunArgv` never names it.+- Tests: `test/access-binding.test.ts` (PGLite and Postgres), `test/setup-serves-several.test.ts`.+## [0.60.634.0] - 2026-11-09**Privacy, trust and access checks written in SQL now give the same answer as their TypeScript versions, so remote callers can't see a page through one path that another path hides.** Several rules are evaluated twice: once in TypeScript on a page already read, and once in SQL for list, search, backlink and scan queries. Postgres `btrim(x)` strips only spaces, while JavaScript's `trim()` strips every Unicode edge whitespace character, and Postgres `lower()` follows the database collation. A page marked private through the `access` or `confidentiality` field, with other whitespace around the value (a YAML block scalar keeps a trailing newline), was hidden from remote `get_page` but not from remote list and search. The fast page filters also skipped the full check for `type: question` pages and pages with a `pinned_question` key, which the full check treats as private.diff --git a/INSTALL_FOR_AGENTS.md b/INSTALL_FOR_AGENTS.mdindex 7f43f3f45c..1b7d256274 100644--- a/INSTALL_FOR_AGENTS.md+++ b/INSTALL_FOR_AGENTS.md@@ -154,7 +154,7 @@ a member, a folder `people/<member>/` only they read and a key bound to themthe receipt proves no member reads another member's folder.`setup_serves_several` means the brain already serves several people and theconnection would be bound to nobody: rerun with its fix. Add `--stdio-member <member>`-only when one person alone uses this machine; it binds every stdio session here.+(claude-code, codex) only when one person alone uses that harness; it binds that entry alone.Doctor's `unlabeled_people_folders`names any person's folder still without a rule.`--remove` undoes only what setup wrote. Guide:diff --git a/docs/architecture/key-files/access.md b/docs/architecture/key-files/access.mdindex 40c029ccec..c9a75f56d6 100644--- a/docs/architecture/key-files/access.md+++ b/docs/architecture/key-files/access.md@@ -3,6 +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 `mcp.stdio_member`; publication re-resolves from the stored principal). In `search/private-visibility.ts` every page fragment is `accessAllowedSql` AND the privacy part: plain fragments use the empty identity (over-hide, never leak), `*ForCaller` fragments the caller's, and `GBRAIN_REMOTE_PRIVATE_PAGES`, `search.remote_private_pages` and `granted_sources` relax only the privacy part (`privacyForCaller`). A derivative of a page that names readers is hidden from every remote caller (`originAllowedSql`, which calls the SQL function `gbrain_access_origin_restricted()` only for atom, question, concept, event or `derived_from` rows, so each read plans one call instead of four subplans). Both parts lead with column tests (`page_readers IS NULL`, `type`) so row estimates follow column statistics; an expression test such as `->'readable_by' IS NULL` estimates almost no rows and sent restricted vector searches into nested-loop sequential scans. The index walk's page probe (`INDEX_WALK_PAGE_COLUMNS`) projects `page_readers`. Config `access.restrictions_present` (set by a trigger, sticky) keeps every pre-A1 path on a brain with no restriction. `check:remote-privacy-reads` keeps the two relaxations read only in `private-visibility.ts`. Tests: `test/member-read-access.test.ts` (remote matrix, both engines), `test/access-*.test.ts`. Folder rules (A2) keep whole folders of a source to named members. `folder-rules.ts` is the grammar (`.gbrain/access.yml`: `rules:` of `id`, `prefix`, `readable_by`), `classifyRulebook` (each change is narrowing or widening; the target installs only the narrowing part) and `matchingRuleIds`. `policy.ts` owns the one applied rulebook for both stores: `access_rules` (source-qualified ids), the append-only `access_policy_revisions` log, `access_pending_coverage` (prefixes that read as nobody while a narrowing restamps, or while a committed file is invalid) and `sources.config.access_store`, persisted at the first rule and changed only by `policy-migrate.ts` (journaled in `access_policy_migrations`). `proposeRevision` installs narrowing at once under a per-source row lock and holds widening for `applyApproved` (`plan_hash`, `preview_changed`); `restampSource` rewrites `pages.folder_rule_ids` in id windows, then clears pending coverage under the lock; re-proposing the same rulebook finishes an interrupted restamp. A trigger stamps `folder_rule_ids` from the SQL function `gbrain_access_folder_rules()` on insert and on slug or source change, never from git on the serve path. `policy-git.ts` is the git store (files committed through the commit door, applied by `syncAccessPolicyAt` from sync preflight and before and after every managed pass (`performManagedSync`: sync, drain, `sources refresh`, git conversion), read with `git show` at the synced commit; 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`. `ACTOR_DEFERRED_OPS` (`capture`, `extract_facts`, take writes, `list_write_conflicts`) are never attestable until each is keyed to the member: 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`; `--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`. 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`), 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; `jobActorSql` in `minions/types.ts`), so a job with an actor reads as missing to the bare client and to other actors. Tests: `test/access-member-facts.test.ts` (both engines), `test/access-member-sweep.test.ts` (every attestable op as Bob, the bare client and an unbound credential; `test/helpers/member-sweep.ts`), `test/e2e/serve-http-member-sweep.test.ts` (two members over a real `serve --http` on a keyless repo-less brain).+- `src/core/access/` (GBRA-218) — per-member read access inside one source. `principals.ts` normalizes frontmatter `readable_by` (bare id = `member:<id>`, `group:<g>`, ASCII case fold, space trim; anything malformed is `['!nobody']`); it is the row twin of the SQL `gbrain_access_readers()` (`test/access-principals.test.ts` holds them equal). A BEFORE trigger keeps `pages.page_readers` equal to that function (direct writes to the column are recomputed), and predicates test the array, never the function, which costs ~0.2 ms per row. A page that names readers with no derived value yet (written before the migration) reads as nobody until `gbrain repair access` (`repair/access.ts`). `members.ts` (members, groups, tombstoned ids never reused, bindings), `token-binding.ts` (the verifiers' join; a credential bound to a disabled, tombstoned or missing member is refused with `access_member_disabled`) and `caller.ts` (`remoteCallerAccess`: the identity dispatch puts on the caller-access record; stdio binds through `serve --stdio-member`, else `mcp.stdio_member`; publication re-resolves from the stored principal). In `search/private-visibility.ts` every page fragment is `accessAllowedSql` AND the privacy part: plain fragments use the empty identity (over-hide, never leak), `*ForCaller` fragments the caller's, and `GBRAIN_REMOTE_PRIVATE_PAGES`, `search.remote_private_pages` and `granted_sources` relax only the privacy part (`privacyForCaller`). A derivative of a page that names readers is hidden from every remote caller (`originAllowedSql`, which calls the SQL function `gbrain_access_origin_restricted()` only for atom, question, concept, event or `derived_from` rows, so each read plans one call instead of four subplans). Both parts lead with column tests (`page_readers IS NULL`, `type`) so row estimates follow column statistics; an expression test such as `->'readable_by' IS NULL` estimates almost no rows and sent restricted vector searches into nested-loop sequential scans. The index walk's page probe (`INDEX_WALK_PAGE_COLUMNS`) projects `page_readers`. Config `access.restrictions_present` (set by a trigger, sticky) keeps every pre-A1 path on a brain with no restriction. `check:remote-privacy-reads` keeps the two relaxations read only in `private-visibility.ts`. Tests: `test/member-read-access.test.ts` (remote matrix, both engines), `test/access-*.test.ts`. Folder rules (A2) keep whole folders of a source to named members. `folder-rules.ts` is the grammar (`.gbrain/access.yml`: `rules:` of `id`, `prefix`, `readable_by`), `classifyRulebook` (each change is narrowing or widening; the target installs only the narrowing part) and `matchingRuleIds`. `policy.ts` owns the one applied rulebook for both stores: `access_rules` (source-qualified ids), the append-only `access_policy_revisions` log, `access_pending_coverage` (prefixes that read as nobody while a narrowing restamps, or while a committed file is invalid) and `sources.config.access_store`, persisted at the first rule and changed only by `policy-migrate.ts` (journaled in `access_policy_migrations`). `proposeRevision` installs narrowing at once under a per-source row lock and holds widening for `applyApproved` (`plan_hash`, `preview_changed`); `restampSource` rewrites `pages.folder_rule_ids` in id windows, then clears pending coverage under the lock; re-proposing the same rulebook finishes an interrupted restamp. A trigger stamps `folder_rule_ids` from the SQL function `gbrain_access_folder_rules()` on insert and on slug or source change, never from git on the serve path. `policy-git.ts` is the git store (files committed through the commit door, applied by `syncAccessPolicyAt` from sync preflight and before and after every managed pass (`performManagedSync`: sync, drain, `sources refresh`, git conversion), read with `git show` at the synced commit; 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`. `ACTOR_DEFERRED_OPS` (`capture`, `extract_facts`, take writes, `list_write_conflicts`) are never attestable until each is keyed to the member: 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`; `--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`. 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`), 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; `jobActorSql` in `minions/types.ts`), so a job with an actor reads as missing to the bare client and to other actors. 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/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.- `src/core/ops/qm-memory.ts` (GST-359 D) — QM's memory provider pair. `memory_recall` reads the attested person's own last-24-hour facts on their member page (`listFactsSince` with `sourceMarkdownSlug`), then `rankFactsByQuestion` over the facts they may read, renders one plain line per fact (`plainFactText` strips fence and heading markers) and cuts at a line within `max_chars` (`boundFactLines`). A call that names `source_id` or `source_ids` (full surface only) reads as that scope instead: `recallSources` resolves them through `requestSourceScope` (a source outside the credential's grant is `permission_denied`), `SCOPE_READ_ACCESS` empties identity, actor and audience, so no own facts and no member-page fact are read, restricted pages stay hidden and privacy is never relaxed; the query is ranked on its first 2,000 characters (`MEMORY_RECALL_QUERY_CHARS`). `memory_write` validates 1-20 facts, derives each request id from uuidv5(member, idempotency_key) (`memoryWriteRequestId`) and saves through `remember`'s handler with `ctx.attestedOp = 'memory_write'`, which the stored write authority keeps (`WriteAuthority.attestedOp`) so publication and receipt reads re-check that operation's attest right. `qmMemoryToolResult` (dispatch) moves the result into `structuredContent` and leaves the model text in `content`; `unlinkedRecallResult` is the empty success dispatch's `actorRefusal` returns for an unlinked person. Contract fixture: `scripts/build-qm-memory-contract.ts` writes `docs/contracts/qm-memory-provider/v1.json` (frozen, byte-identical) and `v2.json` (the scope read and write; `regen:all` artifacts). Scope writes (GST-1113): `memory_write {source_id}` saves on `memory/scope` in a scope source listed in the credential's `attest_sources` (migration v293, on `access_tokens` and `oauth_clients`); `access/attest-sources.ts` holds `perCallWriteSource` (the one exemption from the one-write-source checks in `page-mutations.ts`, `memory-mutations.ts` and `persistence/authority.ts`, keyed to that slug and re-checked at publication through `actorCoverage(..., source)`), the sticky mark `sources.config.qm_scope` (set by `applyAttestSources` under row locks; `isSourceFederated` ignores federation on it), `assertScopeSourceGrant` (in `insertClientGrant`, `persistGrant`, `writeTokenGrant` and `insertUnifiedToken`) and `withoutScopeSources` (a person recall never reads a scope source). `member-facts.ts` `assertScopePageWriter` keeps other remote writers off `memory/scope`. Tests: `test/qm-scope-writes.test.ts` (both engines), `test/qm-memory-tools.test.ts` (both engines), `test/qm-memory-contract.test.ts` (drift), `test/e2e/serve-http-qm-memory.test.ts` (keyless `serve --http`).diff --git a/docs/guides/access-designations.md b/docs/guides/access-designations.mdindex f8cedfe2a9..ab597902a8 100644--- a/docs/guides/access-designations.md+++ b/docs/guides/access-designations.md@@ -16,10 +16,10 @@ Five kinds of caller read a brain:- **Local CLI** on the brain host (`remote = false`). Reads everything.- **The owner**: a remote credential (token or OAuth client) or stdio server bound to the member named by`gbrain access owner set <member>` (config `access.owner_member`). Bind each of the owner's agents, delegates and- sub-agents included, with `gbrain auth rescope --token <name> --member <owner>`. A stdio harness only the owner- uses: `gbrain setup <harness> --serves several --stdio-member <owner>`, which makes every stdio session on this- host read as the owner, private pages included; a harness several people talk to gets one key per person over- `gbrain serve --http` (`gbrain auth create --member <id>`). On a single-user brain this is how the owner's own+ sub-agents included, with `gbrain auth rescope --token <name> --member <owner>`. A Claude Code or Codex install+ only the owner uses: `gbrain setup <claude-code|codex> --stdio-member <owner>`, which binds that harness's stdio+ entry on that machine and nothing else (PGLite or Postgres); for a harness several people talk to, one key per+ person over `gbrain serve --http` (`gbrain auth create <name> --member <id>`). On a single-user brain this is how the owner's ownagent reads the whole brain.- **Other members**: credentials bound to any other enabled member.- **Public or unbound callers**: credentials bound to no member, and audiences that include a guest.diff --git a/docs/guides/error-codes.md b/docs/guides/error-codes.mdindex 963b00140e..bfeb0044f7 100644--- a/docs/guides/error-codes.md+++ b/docs/guides/error-codes.md@@ -4512,7 +4512,7 @@ More: [docs/guides/repair.md#setup-owner-conflict](../../docs/guides/repair.md#s| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable ||---|---|---|---|---|---|---|-| gbrain setup for one person was run on a brain that serves several people, and config mcp.stdio_member binds no stdio connection there, so setup wrote nothing. | On a brain that serves several people an unbound connection reads every page no rule restricts, for whoever is asking; setup never writes one. | Run gbrain setup <harness> --serves several --members <id,...> to label each person; add --stdio-member <member> only for a harness that one person alone uses. Run: gbrain access serves --json | agent | `repeat the read that failed` | 1 | no |+| gbrain setup for one person was run on a brain that serves several people, and neither this harness's entry (--stdio-member) nor config mcp.stdio_member binds its stdio connection, so setup wrote nothing. | On a brain that serves several people an unbound connection reads every page no rule restricts, for whoever is asking; setup never writes one. | Run gbrain setup <harness> --serves several --members <id,...> to label each person; add --stdio-member <member> only for a harness that one person alone uses. Run: gbrain access serves --json | agent | `repeat the read that failed` | 1 | no |### setup_serves_unreadablediff --git a/docs/guides/setup.md b/docs/guides/setup.mdindex 93fe474ca0..b4458c7e25 100644--- a/docs/guides/setup.md+++ b/docs/guides/setup.md@@ -175,14 +175,21 @@ The receipt also lists any other `people/<name>/` folder that no rule covers, sievery member reads it, and the run is not OK until it has a rule.Setup leaves the stdio server unbound: stdio sessions read only pages no rulerestricts, and the harness's instructions keep the one-person scoping lines.-`mcp.stdio_member` is brain-wide, so binding it makes every stdio MCP session on-the host, from any harness, read as that member, including pages only that member-may read. Bind it only on a machine one person uses:-`gbrain setup claude-code --serves several --members ... --stdio-member <member>`-(claude-code or codex on a local PGLite brain only; refused where OpenClaw or Hermes-is installed, because their shared sessions would read as that member too, and on a-Postgres brain, which other machines can open). A bot that answers several-people runs `gbrain serve --http` with each member's key.+For a Claude Code or Codex install only one person uses, bind that harness alone:+`gbrain setup claude-code --stdio-member <member>` (or `codex`) writes+`serve --stdio-member <member>` into that harness's MCP entry, so its sessions read+as that member, including pages only that member may read. Other harnesses on the+machine, and other machines that open the same brain (PGLite or Postgres), are+unchanged. The member must be enabled (or one of `--members` in the same run).+Re-runs, `gbrain post-upgrade` and doctor fixes keep the entry's member and never+add one; `--no-stdio-member` removes it, also on a brain that serves several+people. Setup refuses `--stdio-member` where OpenClaw or Hermes is installed,+because those harnesses serve several people, and `gbrain serve` refuses to start+with the flag there too: a bot that answers several people runs+`gbrain serve --http` with each member's key. Setup also refuses it when a gbrain+plugin serves the harness, since setup does not write the plugin's launch arguments.+Setup never writes config `mcp.stdio_member`; set by hand, it still binds every+stdio session on the brain that starts without `--stdio-member`.The preview runs first, and a BLOCKED line (a disabled member, an existing rule on`people/<member>/` that someone else also reads, a key whose file is gone or holds@@ -193,7 +200,8 @@ its own: revoke it (`gbrain auth revoke member-<id>`) and run setup again. Anempty roster refuses.`--serves one` (the default) changes nothing, but on a brain that already servesseveral people a plain setup refuses (`setup_serves_several`) rather than write a-connection bound to nobody, unless `mcp.stdio_member` already binds it, and+connection bound to nobody, unless the harness's entry (`--stdio-member`) or+`mcp.stdio_member` already binds it, anda brain setup cannot read refuses (`setup_serves_unreadable`).`gbrain doctor` fails `unlabeled_people_folders` when such a brain has a`people/<name>/` folder with pages and no rule naming its readers.diff --git a/llms-full.txt b/llms-full.txtindex 37f81212eb..466dbb4056 100644--- a/llms-full.txt+++ b/llms-full.txt@@ -2846,7 +2846,7 @@ a member, a folder `people/<member>/` only they read and a key bound to themthe receipt proves no member reads another member's folder.`setup_serves_several` means the brain already serves several people and theconnection would be bound to nobody: rerun with its fix. Add `--stdio-member <member>`-only when one person alone uses this machine; it binds every stdio session here.+(claude-code, codex) only when one person alone uses that harness; it binds that entry alone.Doctor's `unlabeled_people_folders`names any person's folder still without a rule.`--remove` undoes only what setup wrote. Guide:diff --git a/plugin/skills/setup/SKILL.md b/plugin/skills/setup/SKILL.mdindex 82f9ec4e31..1a4fdd8cb7 100644--- a/plugin/skills/setup/SKILL.md+++ b/plugin/skills/setup/SKILL.md@@ -40,7 +40,7 @@ Use the user's existing context; do not repeat choices they already made.| --- | --- || Add memory inside Grok Bot | First choice: use the brain on your own computer over MCP — [remote-mcp](../remote-mcp/SKILL.md) publishes it (`--funnel`, the Bot runs in the vendor cloud), then [hosted harness access](https://github.com/garrytan/gbrain/blob/master/docs/guides/hosted-harness-access.md) installs the private handoff in the Bot. No always-on machine: follow [Grok Bot](https://github.com/garrytan/gbrain/blob/master/docs/guides/grok-bot.md) and the isolated [setup helper](https://github.com/garrytan/gbrain/blob/master/docs/guides/in-agent-setup.md). Root: `/workspace/gbrain`, with data under `.gbrain`. || Add memory inside Muse | First choice: use the brain on your own computer over MCP — [remote-mcp](../remote-mcp/SKILL.md) publishes it (`--funnel`), then [hosted harness access](https://github.com/garrytan/gbrain/blob/master/docs/guides/hosted-harness-access.md) installs the private handoff in Muse. No always-on machine: follow [Muse](https://github.com/garrytan/gbrain/blob/master/docs/guides/muse.md). Either way, establish its durable user-files location first. Do not invent `MUSE.md`, a persistent path, or a native MCP mechanism. |-| Memory for a bot that answers several people | `gbrain setup <harness> --serves several --members <id,...>`; ask the user who the people are, never guess. Relay key file paths, never keys. Fix a `setup_serves_several` refusal with its `fix`. Pass `--stdio-member` only for a machine one person uses: it binds every stdio session on the host. [Guide](https://github.com/garrytan/gbrain/blob/master/docs/guides/setup.md#a-brain-that-serves-several-people). |+| Memory for a bot that answers several people | `gbrain setup <harness> --serves several --members <id,...>`; ask the user who the people are, never guess. Relay key file paths, never keys. Fix a `setup_serves_several` refusal with its `fix`. Pass `--stdio-member <id>` (claude-code, codex) only for a harness one person uses: it binds that harness's entry alone; refused where OpenClaw or Hermes runs. [Guide](https://github.com/garrytan/gbrain/blob/master/docs/guides/setup.md#a-brain-that-serves-several-people). || Add memory to another existing agent | Follow [INSTALL_FOR_AGENTS.md](https://github.com/garrytan/gbrain/blob/master/INSTALL_FOR_AGENTS.md); the [coding-agent tutorial](https://github.com/garrytan/gbrain/blob/master/docs/tutorials/connect-coding-agent.md) covers Claude Code and Codex. || Connect an existing hosted brain | Follow [mcp-access](../mcp-access/SKILL.md) and [hosted harness access](https://github.com/garrytan/gbrain/blob/master/docs/guides/hosted-harness-access.md). Select native OAuth/PKCE or a private machine handoff for the intended harness. || Use the brain from other devices, apps or cloud agents over MCP | Follow [remote-mcp](../remote-mcp/SKILL.md): `gbrain mcp expose` publishes the local server on the Tailscale tailnet (Funnel only for cloud agents), then [mcp-access](../mcp-access/SKILL.md) / hosted access selects native OAuth or a private machine handoff for each consumer. |diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex 113236dc89..d1fdb657e9 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -47,4 +47,4 @@ src/commands/doctor/checks/extraction-sync.ts 1500 ratchet +7 GBRA-130 A-1: linksrc/core/search/evidence-delivery.ts 1759 ratchet +5 W5: EvidencePlan.rankCut resolved with the plan (logic in search/page-rank-cut.ts); +20 W5 whole_pages: wholeCost prices a block as delivery would emit it whole (needs the private Block/enrichBlock internals) and the cut is wired before allocate (cutWholePages lives in search/page-rank-cut.ts); new row: crossed the 1500 unlisted cap at the #6367 merge (master 1479, its explicit-budget cap) by the C1 date header threaded through every block path, cap included; pagePlanHits (search/page-plan-hits.ts) and the header loader (evidence-date.ts blockDateHeaders) were peeled first; peel candidate: allocateCapped; +8 at the #6396 merge: page evidence text cut through the fence-chunk trust overlay and the caller minTrust floor (re-summed: our 1504 + master +8); +119 Cat 40 next wave F2: the search.long_page_unit policy (withLongPagePolicy, selectLongPages size preflight with page/byte/deadline limits) and the long-page fetch and fallback in deliverEvidence, kept in the shared seam the plan names (gbrain-evals docs/plans/2026-10-11-cat40-next-wave, F2); +17 F2 rework to the frozen-comparison policy: search.long_page_min_chars (rendered-body characters, default 20,000) read in withLongPagePolicy, a character count in the preflight, the rendered-body confirmation in deliverEvidence, and the long-page row exemption in capDeliveredSnippets (re-summed at the 0.60.225.0 merge: master 1537 + F2 136); +39 Wave B PR 2 lane 2b: planSegmentedBlock joins the windows search/segmented-evidence.ts reads around a segmented page's hits into one run-marked document (needs the private Doc/Piece/buildDoc/locateAnchor internals), planBlock's unit cut split into blockFromDoc for both, sections bounded by their run, selectionCost counts a gap between runs, and the fetch skips the whole-body fence overlay for a segmented page; +4 segmented pages read at once before planning (segmentedReads; the read is search/segmented-evidence.ts, the statements page-body/read-range.ts); +17 GBRA-156: tail trim plan flag, DeliverOptions.query, DeliveryMeta.tail_trim, the trim call and the frozen-hit score/query library fields (logic in search/evidence-tail-trim.ts; interface fields cannot move); +7 GBRA-205: EvidencePlan.titleHeader and DeliveryMeta.title_header (interface fields cannot move) and the titles option on the header loader (logic in search/evidence-date.ts; the query budget key lives in search/evidence-packing.ts); +11 #7600: assemble_evidence quotes conversation rows and capEvidenceToBudget counts the quote fence (logic in search/transcript-quote.ts); +2 GBRA-156 /ship review: the cut-path admission and title room count the quote fence; +2 GBRA-156 /ship review pass 2: capEvidenceToBudget counts the fence only for the paths that fence (quote flag; recall counts the text as returned); +4 GST-687: page evidence and the extractive fallback quote below-owner-tier text for untrusted readers (untrusted flag; logic in search/transcript-quote.ts)src/commands/config.ts 1530 ratchet +1 GBRA-216: recall.* config set value refusal (facts/recall-config.ts); +1 GBRA-216: config set refuses a dream.claim_conflicts.mode other than propose|off (refusal in facts/claim-conflicts.ts); new row: crossed the 1500 unlisted cap in wave 15 P7.4 #5461: set-time validation of think.pages_budget_chars / think.excerpt_ceiling_chars (range + parser live in core/think/pages-budget.ts), mirroring the cycle.consolidate.cluster_threshold hook; +1 wave 16 G5.1 (#6495): set-time refusal hook for search.keyword_statement_timeout_ms (check lives in commands/config/keyword-timeout-value.ts); +1 wave 18b lane 5 (#5012 item 6): search.contextual_retrieval prints the existing-pages hint after the write (text lives in commands/config/contextual-mode-hint.ts); +1 #6712 PR 2: retired/rollback sync key dispatch line (logic in core/sync-config-keys.ts handleSyncKeyConfig); +1 #6865: sync.slug_conflicts.auto_remove boolean validation at set time (refusal text in repair/slug-autoheal.ts); +1 #6948: sync.origin_twins.auto_resolve boolean validation at set time (refusal text in repair/origin-twins-heal.ts); +2 #6795: config set chat_model/expansion_model help line and the model-pin import (shadow report and file-pin unset live in commands/config/model-pin-shadow.ts); +1 #6712 PR 4b: sync.admission set-time hook (value logic in commands/config/sync-admission-value.ts); +4 #7130: set-time refusal hook for sync.max_deletes / sync.max_delete_ratio (and .source.<id>) / purge.retention_hours (check lives in core/sync-reconcile.ts deleteSafetyConfigRefusal); +1 GBRA-150: sync.metafile_pages set-time route (body in config/sync-metafile-pages-value.ts); re-summed at the v0.60.330.0 merge (1520 measured); +2 #7242 minions.terminal_hook file-plane key and its set branch (logic in minions/terminal-hook.ts); +1 GBRA-161: generations.* set-time route (refusal in commands/config/generations-values.ts); +1 GBRA-207 #7630: sync.repo_path set-time refusal hook (refusal in core/sync-config-keys.ts syncRepoPathRefusal); +4 GBRA-377 PR B: skills.resolver.* file-plane routing (doc line, the one-line router and its two dispatch lines; logic in core/setup/skill-resolver-config.ts)src/commands/mcp-expose.ts 1519 ratchet hosted_option: Session carries the gbrain.io coaching notice on the first-receipt run and Tailscale/service friction exits (copy, refs and gating live in core/onboard/hosted-option.ts); +7 GBRA-199: --surface help lines, surfaceChosen option field and the advertise pass-through (registrationAdvertise in core/mcp-registration.ts)-src/core/behavior-change-notice.ts 1697 ratchet +4 train R: #7491/#7492 keyword_identifier_probe and keyword_slug_handles rows and their comment, #7175 keyword phrase row; the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +1 GBRA-156 #7593: private_pages_granted_sources row (re-summed at the 0.60.527.0 merge: 1574 + 1); +3 GBRA-200 comment, write-grant refusal and degraded-stamp rows (re-summed at the 0.60.562.0 merge: 1615 + 3); +2 GBRA-280 get_page selector-precedence row and comment (re-summed at the 0.60.569.0 merge: 1619 + 2); the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +2 #7199 (re-port of #7228) classic_drift_rescreen_7199 comment and row; +2 #7931 file_drift_agrees_7931 comment and row; +1 #7950 file_drift_slug_release_7950 row; +1 #7974 file_drift_followups_7974 row; +1 #8059 quoted_fence_marker_8059 row; +2 GBRA-247 #8009 provenance_repair_held_8009 and #7982 pass_transient_streak_7982 rows; +4 GBRA-247 #7973 plain_directory_sync_7973, #7988 managed_marker_own_directory_7988, #7985 former_binding_parked_group_7985 and settle_effects_retire_7985 rows Train S merge: 1570 base + 5 (master since the #8077 base) + 13 (#8077) = 1588.; +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (re-summed at the gate-ahead on train S 0.60.534.0: 1588 + 2); +2 #8377: the quote fence follow-ups row and its comment; +2 #8384: the quote fence follow-ups 2 row and its comment; +2 #8384 wave 3: the quote fence follow-ups 3 row and its comment; +5 GBRA-218 train M rows (A1 member_read_access_gbra218 and member_access_hatch_scope_gbra218, B shared_agent_audience_gbra231, A2 folder_access_rules_gbra218, folder_access_scoped_role_gbra218), re-summed at the train M merge of master v0.60.541.0: 1596 + 5 = 1601 measured; +3 GST-359 train C rows (C1 qm_attested_actor_gst359, C2 member_facts_gst359, D qm_memory_provider_gst359), re-summed at the train C merge of master v0.60.543.0: 1601 + 3 = 1604 measured; +2 #8424: hook_launcher_8424 row and its comment (rows are data and cannot move), re-summed at the #8418 v0.60.546.0 merge: 1604 + 2 = 1606 measured; +2 #8426: mcp_lane_launcher_8426 row and its comment (rows are data and cannot move); +2 GST-927: empty_nonstring_args_gst927 row and its comment, re-summed at the gate-ahead on master v0.60.550.0 plus #8420: 1610 measured; +2 GBRA-283 Wave A (#8460): engine_keyed_caches_gbra283 row and its comment (rows are data and cannot move); +2 GBRA-287: segmented_freeze_hold_gbra287 and segmented_reexport_gbra287 rows (rows are data and cannot move); +1 GST-1209: segmented_tiling_gst1209 row (rows are data and cannot move); +1 GST-1251: skillopt_loop_deprecated_gst1251 row (rows are data and cannot move); +1 GST-1209 follow-up: untiled_hold_repair_gst1209 row (rows are data and cannot move); +1 GBRA-283 B3a: embedded_scope_required_gbra283 row (rows are data and cannot move); re-summed at the train R merge with v0.60.574.0: 1623 + 4; +2 GST-1387: refresh_fence_refusal_gst1387 row and its comment (rows are data and cannot move); re-summed at the memory train #8481 merge with v0.60.578.0 (1643 measured); +3 GBRA-253 #8109 rows (frontmatter_drift_write_8109, contacts_activity_advance_8109, contact_rows_dedupe_8109; rows are data and cannot move), re-summed at the master v0.60.581.0 merge: 1643 + 3 = 1646 measured; +3 #8123 part C rows: sync_write_through_off_writeback_7084, managed_sync_dry_run_counts_7087, frontmatter_missing_source_dir_7889 (since TBD until the merge slot; re-summed at the 0.60.583.0 merge: 1646 + 3); +4 PR B commit_ledger_prb, doctor_foreign_writers_prb and sources_guard_prb rows and their comment (rows are data and cannot move; since TBD until the merge slot); +1 PR B #8615: file_drift_held_needs_prefer_8615 row; +1 PR B #8617: refresh_source_changed_retry_8617 row; +1 PR B #8662: commit_push_checkout_not_a_source_8662 row (since TBD until the merge slot; rows are data and cannot move); +2 PR B refresh_barrier_prb and commit_push_base_prb rows (re-summed: 1658 measured); +3 convergence PR A: the wave comment and two rows (conversion_content_evidence_pr_a, git_gap_live_pages_pr_a; since TBD until the merge slot; rows are data and cannot move); re-summed at the gate-ahead on master v0.60.592.0 plus #8711: 1658 + 3 = 1661 measured; +4 GST-1094/GST-900 rows (memory_recall scope-read, member-bound acting_user, recall max_chars, unknown_param _meta-only) and +1 qm_scope_writes_gst1113 and +1 recall_question_terms_gst1304 rows (rows are data and cannot move), re-summed at the 0.60.595.0 slot merge: 1661 + 6; +1 GST-1582 refresh_barrier_import_gst1582 row (since TBD until the merge slot; rows are data and cannot move); +2 GST-1601 source_changed_origin_gst1601 and adopt_local_edits_gst1601 rows (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.596.0 merge: 1668 + 2; +1 GST-1623 refresh_barrier_capacity_gst1623 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.599.0 merge: 1670 + 1; +2 GBRA-224 W1 release_channel_stable_default row and its comment; +1 GST-1623 refresh_barrier_later_write_gst1623 row (#8765; rows are data and cannot move); +5 #8766 GST-1623 items 4/6-9 and #8755: the wave comment and four rows (doctor_foreign_writers_partial_gst1623, commit_push_enclosing_repo_gst1623, owner_guard_fail_closed_gst1623, adopt_local_edits_hardening_8755) and +1 managed_sync_kind_reserved_8765 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on master v0.60.608.0 plus #8798: 1674 + 6; +1 GST-1853 refresh_barrier_aborted_refresh_sync_gst1853 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.613.0 merge: 1680 + 1; +1 GST-1674 refresh_refused_merge_recovery_gst1674 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.614.0 merge: 1681 + 1; +1 #8824/#8826/#8767: adopt_local_edits_replay_markers_8824 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8837: 1682 + 1; +1 url_source_origin row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8834: 1683 + 1; +1 #8828: the refresh_replan_own_commits_8828 row (1684 + 1 at the 0.60.618.0 slot); +1 the managed commit-push unpublished-count row; +1 the refresh publish-diverged default row; +1 GST-2051 ungranted_member_writes_gst2051 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-731 think_window_trajectory_gst731 row and +1 GST-1602 purge_cancels_deferred_write_gst1602 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8915 v0.60.621.0: 1688 + 2; +1 GST-2059: owner_reads_private row; +1 #8888: the record-origin checkout lock-down row (re-summed at the Q6 stack on #8934 v0.60.625.0: 1691 + 1); +1 GST-2112: ingest_keeps_readers_gst2112 row (re-summed at the Q7 v0.60.627.0 merge: 1692 + 1); +1 #8982 federated_member_writes_8982 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-2116 commit_push_skipped_paths_gst2116 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q10 slot on #9009 ee0f4a78: 1694 + 1; +1 GST-2118 pending_ledger_flagged_gst2118 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q12 slot on #9016 afb49de5: 1695 + 1; +1 GST-363: the serves_several_labels_gst363 row+src/core/behavior-change-notice.ts 1698 ratchet +4 train R: #7491/#7492 keyword_identifier_probe and keyword_slug_handles rows and their comment, #7175 keyword phrase row; the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +1 GBRA-156 #7593: private_pages_granted_sources row (re-summed at the 0.60.527.0 merge: 1574 + 1); +3 GBRA-200 comment, write-grant refusal and degraded-stamp rows (re-summed at the 0.60.562.0 merge: 1615 + 3); +2 GBRA-280 get_page selector-precedence row and comment (re-summed at the 0.60.569.0 merge: 1619 + 2); the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +2 #7199 (re-port of #7228) classic_drift_rescreen_7199 comment and row; +2 #7931 file_drift_agrees_7931 comment and row; +1 #7950 file_drift_slug_release_7950 row; +1 #7974 file_drift_followups_7974 row; +1 #8059 quoted_fence_marker_8059 row; +2 GBRA-247 #8009 provenance_repair_held_8009 and #7982 pass_transient_streak_7982 rows; +4 GBRA-247 #7973 plain_directory_sync_7973, #7988 managed_marker_own_directory_7988, #7985 former_binding_parked_group_7985 and settle_effects_retire_7985 rows Train S merge: 1570 base + 5 (master since the #8077 base) + 13 (#8077) = 1588.; +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (re-summed at the gate-ahead on train S 0.60.534.0: 1588 + 2); +2 #8377: the quote fence follow-ups row and its comment; +2 #8384: the quote fence follow-ups 2 row and its comment; +2 #8384 wave 3: the quote fence follow-ups 3 row and its comment; +5 GBRA-218 train M rows (A1 member_read_access_gbra218 and member_access_hatch_scope_gbra218, B shared_agent_audience_gbra231, A2 folder_access_rules_gbra218, folder_access_scoped_role_gbra218), re-summed at the train M merge of master v0.60.541.0: 1596 + 5 = 1601 measured; +3 GST-359 train C rows (C1 qm_attested_actor_gst359, C2 member_facts_gst359, D qm_memory_provider_gst359), re-summed at the train C merge of master v0.60.543.0: 1601 + 3 = 1604 measured; +2 #8424: hook_launcher_8424 row and its comment (rows are data and cannot move), re-summed at the #8418 v0.60.546.0 merge: 1604 + 2 = 1606 measured; +2 #8426: mcp_lane_launcher_8426 row and its comment (rows are data and cannot move); +2 GST-927: empty_nonstring_args_gst927 row and its comment, re-summed at the gate-ahead on master v0.60.550.0 plus #8420: 1610 measured; +2 GBRA-283 Wave A (#8460): engine_keyed_caches_gbra283 row and its comment (rows are data and cannot move); +2 GBRA-287: segmented_freeze_hold_gbra287 and segmented_reexport_gbra287 rows (rows are data and cannot move); +1 GST-1209: segmented_tiling_gst1209 row (rows are data and cannot move); +1 GST-1251: skillopt_loop_deprecated_gst1251 row (rows are data and cannot move); +1 GST-1209 follow-up: untiled_hold_repair_gst1209 row (rows are data and cannot move); +1 GBRA-283 B3a: embedded_scope_required_gbra283 row (rows are data and cannot move); re-summed at the train R merge with v0.60.574.0: 1623 + 4; +2 GST-1387: refresh_fence_refusal_gst1387 row and its comment (rows are data and cannot move); re-summed at the memory train #8481 merge with v0.60.578.0 (1643 measured); +3 GBRA-253 #8109 rows (frontmatter_drift_write_8109, contacts_activity_advance_8109, contact_rows_dedupe_8109; rows are data and cannot move), re-summed at the master v0.60.581.0 merge: 1643 + 3 = 1646 measured; +3 #8123 part C rows: sync_write_through_off_writeback_7084, managed_sync_dry_run_counts_7087, frontmatter_missing_source_dir_7889 (since TBD until the merge slot; re-summed at the 0.60.583.0 merge: 1646 + 3); +4 PR B commit_ledger_prb, doctor_foreign_writers_prb and sources_guard_prb rows and their comment (rows are data and cannot move; since TBD until the merge slot); +1 PR B #8615: file_drift_held_needs_prefer_8615 row; +1 PR B #8617: refresh_source_changed_retry_8617 row; +1 PR B #8662: commit_push_checkout_not_a_source_8662 row (since TBD until the merge slot; rows are data and cannot move); +2 PR B refresh_barrier_prb and commit_push_base_prb rows (re-summed: 1658 measured); +3 convergence PR A: the wave comment and two rows (conversion_content_evidence_pr_a, git_gap_live_pages_pr_a; since TBD until the merge slot; rows are data and cannot move); re-summed at the gate-ahead on master v0.60.592.0 plus #8711: 1658 + 3 = 1661 measured; +4 GST-1094/GST-900 rows (memory_recall scope-read, member-bound acting_user, recall max_chars, unknown_param _meta-only) and +1 qm_scope_writes_gst1113 and +1 recall_question_terms_gst1304 rows (rows are data and cannot move), re-summed at the 0.60.595.0 slot merge: 1661 + 6; +1 GST-1582 refresh_barrier_import_gst1582 row (since TBD until the merge slot; rows are data and cannot move); +2 GST-1601 source_changed_origin_gst1601 and adopt_local_edits_gst1601 rows (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.596.0 merge: 1668 + 2; +1 GST-1623 refresh_barrier_capacity_gst1623 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.599.0 merge: 1670 + 1; +2 GBRA-224 W1 release_channel_stable_default row and its comment; +1 GST-1623 refresh_barrier_later_write_gst1623 row (#8765; rows are data and cannot move); +5 #8766 GST-1623 items 4/6-9 and #8755: the wave comment and four rows (doctor_foreign_writers_partial_gst1623, commit_push_enclosing_repo_gst1623, owner_guard_fail_closed_gst1623, adopt_local_edits_hardening_8755) and +1 managed_sync_kind_reserved_8765 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on master v0.60.608.0 plus #8798: 1674 + 6; +1 GST-1853 refresh_barrier_aborted_refresh_sync_gst1853 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.613.0 merge: 1680 + 1; +1 GST-1674 refresh_refused_merge_recovery_gst1674 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.614.0 merge: 1681 + 1; +1 #8824/#8826/#8767: adopt_local_edits_replay_markers_8824 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8837: 1682 + 1; +1 url_source_origin row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8834: 1683 + 1; +1 #8828: the refresh_replan_own_commits_8828 row (1684 + 1 at the 0.60.618.0 slot); +1 the managed commit-push unpublished-count row; +1 the refresh publish-diverged default row; +1 GST-2051 ungranted_member_writes_gst2051 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-731 think_window_trajectory_gst731 row and +1 GST-1602 purge_cancels_deferred_write_gst1602 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8915 v0.60.621.0: 1688 + 2; +1 GST-2059: owner_reads_private row; +1 #8888: the record-origin checkout lock-down row (re-summed at the Q6 stack on #8934 v0.60.625.0: 1691 + 1); +1 GST-2112: ingest_keeps_readers_gst2112 row (re-summed at the Q7 v0.60.627.0 merge: 1692 + 1); +1 #8982 federated_member_writes_8982 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-2116 commit_push_skipped_paths_gst2116 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q10 slot on #9009 ee0f4a78: 1694 + 1; +1 GST-2118 pending_ledger_flagged_gst2118 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q12 slot on #9016 afb49de5: 1695 + 1; +1 GST-363: the serves_several_labels_gst363 row; +1 GST-363 PR 3: the stdio_member_per_harness_gst363 row (since TBD until the merge slot; rows are data and cannot move)diff --git a/scripts/structural-suites.tsv b/scripts/structural-suites.tsvindex 67f0db8ec8..64d4bda7a0 100644--- a/scripts/structural-suites.tsv+++ b/scripts/structural-suites.tsv@@ -374,7 +374,7 @@ test/serve-http-github-webhook.test.ts handler wiring (source pin) 1 source-surftest/serve-http-mcp-transport-cleanup.test.ts POST /mcp transport cleanup (#2844) 2 source-surface-helpertest/serve-http-metrics.test.ts serve-http.ts wiring (structural — the two defects of the original PR) 2 source-surface-helpertest/serve-stdin-eof-drain.test.ts serve-sync-runner stays off the boot path (#4409) 1 readFileSync-test/setup-serves-several.test.ts gbrain setup --serves (spawned, PGLite) 9 readFileSync+test/setup-serves-several.test.ts gbrain setup --serves (spawned, PGLite) 11 readFileSynctest/setup-serves-several.test.ts labelling refuses or reports what it cannot make safe (pglite, repo-less) 8 readFileSynctest/setup.test.ts gbrain setup: setup migrations on the brain it creates (Cat 41 run 4) 3 readFileSynctest/shared-skills-catalog.test.ts (file-level) 22 readFileSyncdiff --git a/skills/setup/SKILL.md b/skills/setup/SKILL.mdindex 9a4bfd93bc..8d30d98975 100644--- a/skills/setup/SKILL.md+++ b/skills/setup/SKILL.md@@ -39,7 +39,7 @@ Use the user's existing context; do not repeat choices they already made.| --- | --- || Add memory inside Grok Bot | First choice: use the brain on your own computer over MCP — [remote-mcp](../remote-mcp/SKILL.md) publishes it (`--funnel`, the Bot runs in the vendor cloud), then [hosted harness access](https://github.com/garrytan/gbrain/blob/master/docs/guides/hosted-harness-access.md) installs the private handoff in the Bot. No always-on machine: follow [Grok Bot](https://github.com/garrytan/gbrain/blob/master/docs/guides/grok-bot.md) and the isolated [setup helper](https://github.com/garrytan/gbrain/blob/master/docs/guides/in-agent-setup.md). Root: `/workspace/gbrain`, with data under `.gbrain`. || Add memory inside Muse | First choice: use the brain on your own computer over MCP — [remote-mcp](../remote-mcp/SKILL.md) publishes it (`--funnel`), then [hosted harness access](https://github.com/garrytan/gbrain/blob/master/docs/guides/hosted-harness-access.md) installs the private handoff in Muse. No always-on machine: follow [Muse](https://github.com/garrytan/gbrain/blob/master/docs/guides/muse.md). Either way, establish its durable user-files location first. Do not invent `MUSE.md`, a persistent path, or a native MCP mechanism. |-| Memory for a bot that answers several people | `gbrain setup <harness> --serves several --members <id,...>`; ask the user who the people are, never guess. Relay key file paths, never keys. Fix a `setup_serves_several` refusal with its `fix`. Pass `--stdio-member` only for a machine one person uses: it binds every stdio session on the host. [Guide](https://github.com/garrytan/gbrain/blob/master/docs/guides/setup.md#a-brain-that-serves-several-people). |+| Memory for a bot that answers several people | `gbrain setup <harness> --serves several --members <id,...>`; ask the user who the people are, never guess. Relay key file paths, never keys. Fix a `setup_serves_several` refusal with its `fix`. Pass `--stdio-member <id>` (claude-code, codex) only for a harness one person uses: it binds that harness's entry alone; refused where OpenClaw or Hermes runs. [Guide](https://github.com/garrytan/gbrain/blob/master/docs/guides/setup.md#a-brain-that-serves-several-people). || Add memory to another existing agent | Follow [INSTALL_FOR_AGENTS.md](https://github.com/garrytan/gbrain/blob/master/INSTALL_FOR_AGENTS.md); the [coding-agent tutorial](https://github.com/garrytan/gbrain/blob/master/docs/tutorials/connect-coding-agent.md) covers Claude Code and Codex. || Connect an existing hosted brain | Follow [mcp-access](../mcp-access/SKILL.md) and [hosted harness access](https://github.com/garrytan/gbrain/blob/master/docs/guides/hosted-harness-access.md). Select native OAuth/PKCE or a private machine handoff for the intended harness. || Use the brain from other devices, apps or cloud agents over MCP | Follow [remote-mcp](../remote-mcp/SKILL.md): `gbrain mcp expose` publishes the local server on the Tailscale tailnet (Funnel only for cloud agents), then [mcp-access](../mcp-access/SKILL.md) / hosted access selects native OAuth or a private machine handoff for each consumer. |diff --git a/skills/skills.lock.json b/skills/skills.lock.jsonindex adc0a200d4..230332b971 100644--- a/skills/skills.lock.json+++ b/skills/skills.lock.json@@ -212,7 +212,7 @@"resolve-before-asking/routing-eval.jsonl": "bac1bcf30337f5255ef4ce1a2a8a2b38d58ebcd576503c483190c79ec6e69489","schema-author/SKILL.md": "38efb8b48399a2dc526d7084579aa265b2ab232882605bc2f86f6ba2869619f5","schema-unify/SKILL.md": "36259f1510fd693253535bd203e32db1bfa24aaae7278c7a2e8b7d6859022708",- "setup/SKILL.md": "110d3368f9a52889b7bd8d0bf21a79fd0b5925940c2447de15eed4e6f60d69ba",+ "setup/SKILL.md": "1cfb85220ef53a8575a54137ab45296a36e5d00652d1e71e8f569315b425b027","signal-detector/SKILL.md": "426a8a3b01a007dd25638e61adef510c18c3d9ce6f1c18ba3d77fdfcd3281d60","skill-autobench/SKILL.md": "29f5760dcfd823c5f7d4fb50a3cf4e36601b1b8125e57d6bf83645a41f97f613","skill-autobench/routing-eval.jsonl": "8d961ed6403b7e2f690948e4c18529d40f26f6f21064befc56d465966b1a9ec0",diff --git a/src/cli/help/serve.ts b/src/cli/help/serve.tsindex 0c55326d9b..d381b13847 100644--- a/src/cli/help/serve.ts+++ b/src/cli/help/serve.ts@@ -4,7 +4,7 @@ import type { CliHelpSpec } from '../command-table.ts';export const help: CliHelpSpec = {summary: 'Run the MCP server: stdio by default, or OAuth 2.1 HTTP with --http.',usage: [- 'gbrain serve [--surface verbs|starter|full] [--advertise verbs|starter|full] [--access full|read-only] [--source-guard] [--stdio-idle-timeout <s>] [--fail-fast] [--cli-socket]',+ 'gbrain serve [--surface verbs|starter|full] [--advertise verbs|starter|full] [--access full|read-only] [--source-guard] [--stdio-idle-timeout <s>] [--stdio-member <id>] [--fail-fast] [--cli-socket]','gbrain serve --http [--port <n>] [--bind <host>] [--public-url <url>] [--token-ttl <s>] [--enable-dcr] [--surface …] [--advertise …]',].join('\n'),flags: [@@ -14,6 +14,7 @@ export const help: CliHelpSpec = {{ name: '--access', type: 'enum', values: ['full', 'read-only'], desc: 'stdio only: read-only exposes read-scoped, non-mutating operations.' },{ name: '--source-guard', type: 'boolean', desc: 'stdio only: refuse writes unless the source binding is deliberate or unambiguous.' },{ name: '--stdio-idle-timeout', type: 'number', desc: 'stdio only: exit after this many idle seconds (0 = never).' },+ { name: '--stdio-member', type: 'string', desc: 'stdio only: answer as this enabled access member (written into one harness entry by gbrain setup claude-code|codex --stdio-member <id>). Wins over config mcp.stdio_member; a disabled or unknown member reads as nobody. Refused where OpenClaw or Hermes is installed.' },{ name: '--fail-fast', type: 'boolean', desc: 'Exit non-zero with the classified error when the database is unreachable (no degraded mode).' },{ name: '--cli-socket', type: 'boolean', desc: 'Postgres only, off by default (or config serve.cli_socket): answer this user\'s CLI search, query, get and recall over a private Unix socket in $GBRAIN_HOME/.gbrain/run/ instead of a cold connection per call.' },{ name: '--port', type: 'number', desc: 'HTTP port (default 3131).' },diff --git a/src/commands/serve.ts b/src/commands/serve.tsindex 5a6f98ca23..43a7b89a89 100644--- a/src/commands/serve.ts+++ b/src/commands/serve.ts@@ -8,6 +8,7 @@ export { serveFailFastRequested, writeServeFailFastEnvelope } from '../core/servimport { isEngineDegraded as isEngineDegradedForServe } from '../core/degraded-marker.ts';import { startMcpServer, stdioRpcsInFlightCount, resolveMcpStdioSourceScope } from '../mcp/server.ts';import { VERB_NAMES } from '../core/verbs.ts';+import { parseStdioMemberFlag } from '../core/stdio-member-flag.ts';import { RESIDENT_POOL_FLOOR } from '../core/pg-access-classify.ts';import { redirectStdoutLoggingToStderr } from '../core/console-prefix.ts';import { startFactsDrainScheduler, type FactsDrainScheduler, type FactsDrainSchedulerOpts } from '../core/facts/drain-scheduler.ts';@@ -294,6 +295,16 @@ async function serveBrain(throw new Error('--access read-only applies to stdio serve only; for HTTP narrow each token with ' +'gbrain auth rescope-token <name> --operations <op,...> (see docs/mcp/ADMIN.md#read-only-stdio-serve)');}+ // GST-363: --stdio-member binds this one stdio server (the harness entry that starts it) to one member.+ const stdioMember = parseStdioMemberFlag(args);+ if (stdioMember !== undefined && isHttp) {+ throw new Error('--stdio-member binds a stdio serve only; over HTTP bind each key to its person with ' ++ 'gbrain auth create <name> --member <id> (or gbrain auth rescope --token <name> --member <id>)');+ }+ const sharedHarness = stdioMember !== undefined ? (await import('./setup-serves.ts')).sharedStdioHarness() : null;+ if (sharedHarness) {+ throw new Error(`--stdio-member refused: ${sharedHarness} is installed on this host, and its sessions serve several people, so serve does not start a stdio server bound to one member here; remove the flag from this harness entry (gbrain setup claude-code|codex --no-stdio-member) and give each person their own key over HTTP (gbrain serve --http with gbrain auth create <name> --member <id>)`);+ }// --source-guard (plugin lanes, EV1): fail-closed write routing for// user-global serves whose cwd is meaningless (plugin snapshots). Write/@@ -477,7 +488,7 @@ async function serveBrain(}try {- await start(engine, { surface, surfaceSource: resolved.source, ...(resolved.invalidEnv !== undefined ? { invalidSurfaceEnv: resolved.invalidEnv } : {}), ...(sourceGuard ? { sourceGuard } : {}), onBootPhase: phase => { bootPhase = phase; bootProgressAt = Date.now(); }, ...(access === 'read-only' ? { access } : {}), ...(advertise ? { advertise } : {}) });+ await start(engine, { surface, surfaceSource: resolved.source, ...(resolved.invalidEnv !== undefined ? { invalidSurfaceEnv: resolved.invalidEnv } : {}), ...(sourceGuard ? { sourceGuard } : {}), onBootPhase: phase => { bootPhase = phase; bootProgressAt = Date.now(); }, ...(access === 'read-only' ? { access } : {}), ...(advertise ? { advertise } : {}), ...(stdioMember !== undefined ? { stdioMember } : {}) });// `--stdio-idle-timeout` arms its timer during lifecycle installation,// but its stdin activity listener must wait until startMcpServer has// attached the MCP SDK transport listener. Attaching any `data` listenerdiff --git a/src/commands/setup-serves.ts b/src/commands/setup-serves.tsindex ab22f1dc51..37bdd1d777 100644--- a/src/commands/setup-serves.ts+++ b/src/commands/setup-serves.ts@@ -4,11 +4,12 @@** - `gbrain access serves --json` reads whether the brain serves several people and the member the stdio server* reads as. An existing brain it cannot read refuses (setup_serves_unreadable). A one-person setup (the default)- * on a brain that serves several people refuses (setup_serves_several) unless config mcp.stdio_member already- * binds the stdio connection. Setup writes mcp.stdio_member only for --stdio-member <enabled member> with- * --serves several on claude-code or codex of a local PGLite brain: the key lives in the brain, so it binds every- * stdio session that opens it, and setup refuses the flag where a shared-stdio harness (sharedStdioHarness) is installed. The brain-first text- * says the connection is already scoped only once it is bound.+ * on a brain that serves several people refuses (setup_serves_several) unless this harness's entry or config+ * mcp.stdio_member binds the stdio connection. --stdio-member <enabled member> on claude-code or codex writes+ * `serve --stdio-member <member>` into that one harness entry (setup never writes mcp.stdio_member), so it binds+ * only that harness on this machine, PGLite or Postgres; setup refuses the flag where a shared-stdio harness+ * (sharedStdioHarness) is installed. A rewrite carries an entry's own member forward and never adds one. The+ * brain-first text says the connection is already scoped only once it is bound.* - `--serves several --members a,b` runs `gbrain access serves several --yes --json` (members, one folder rule per* member, one bound key per member in a 0600 file) and proves the labels with one bound read per member* per other member (`gbrain find people/<other>/ --as <member> --json`): none returns a page.@@ -23,6 +24,9 @@ import { readRoster, rosterEmpty, type ServesReceipt, type ServesStatus, receiptexport interface ServesFlags { serves?: 'one' | 'several'; members?: string; membersFile?: string; source?: string; stdioMember?: string; dryRun: boolean }+/** GST-363: the --stdio-member this harness entry will carry (member) and the one it carries now (previous). */+export interface EntryBinding { member: string | null; previous: string | null }+/** A harness installed on this host whose stdio sessions serve several conversations (OpenClaw, Hermes), or null. */export function sharedStdioHarness(): string | null {const onPath = (bin: string) => { try { return !!Bun.which(bin, { PATH: process.env.PATH ?? '' }); } catch { return false; } };@@ -39,7 +43,7 @@ export interface ServesOutcome {note?: string;receipt?: ServesReceipt;proof?: ProofLine[];- stdio?: { member: string | null; action: 'write' | 'keep' | 'unbound'; detail: string };+ stdio?: { member: string | null; action: 'write' | 'keep' | 'remove' | 'unbound'; detail: string };error?: string;}@@ -78,8 +82,9 @@ export function servesUnreadable(error: string, harness: string): OperationError}/** The refusal for a one-person setup that would write an unbound connection on a brain that serves several people. */-export function servesOneRefusal(status: ServesStatus | null, harness: string): OperationError | null {- if (!status || status.serves !== 'several' || status.stdio_member) return null;+export function servesOneRefusal(status: ServesStatus | null, harness: string, entry: EntryBinding = { member: null, previous: null }): OperationError | null {+ if (!status || status.serves !== 'several' || status.stdio_member || (entry.member && status.enabled_members.includes(entry.member))) return null;+ if (!entry.member && entry.previous) return null;const why = status.from === 'config' ? 'config access.serves is several' : `it has ${status.enabled_members.length} enabled members (${status.enabled_members.join(', ')})`;const argv = ['gbrain', 'setup', harness, '--serves', 'several', '--members', status.enabled_members.join(',') || '<id,...>'];return opError('setup_serves_several',@@ -122,50 +127,64 @@ export interface ServesPlan { roster: string[]; status: ServesStatus | null }* Before setup writes anything: the roster (an empty one refuses), the brain's serves view (none for a brain setup is* about to create, or while this registration's own stdio serve holds a PGLite brain), and the one-person refusal.*/-export function servesPreflight(flags: ServesFlags, launcher: string, harness: string, hasBrain: boolean, liveOurs: boolean, pglite: boolean): ServesPlan | OperationError {+export function servesPreflight(flags: ServesFlags, launcher: string, harness: string, hasBrain: boolean, liveOurs: boolean, entry: EntryBinding = { member: null, previous: null }): ServesPlan | OperationError {const roster = servesRoster(flags, harness);if (roster instanceof OperationError) return roster;- if (flags.stdioMember && !pglite) return opError('invalid_params', 'This brain is a Postgres database other machines can open, and mcp.stdio_member is stored in the brain, so --stdio-member would bind stdio sessions on every machine that opens it, including a shared OpenClaw or Hermes host; nothing was written.', 'Leave the stdio server unbound, or bind a single-person harness with a member key over serve --http.');- if (flags.stdioMember && !roster.includes(flags.stdioMember)) return opError('invalid_params', `--stdio-member ${flags.stdioMember} is not one of the people in --members; nothing was written.`, 'Name a member listed in --members.');- if (flags.serves === 'several' && liveOurs) {- return opError('setup_owner_conflict', 'A live stdio serve started by this registration holds the PGLite brain, and labelling several people needs to write to it; nothing was written.',+ const named = flags.stdioMember;+ if (named && flags.serves === 'several' && !roster.includes(named)) return opError('invalid_params', `--stdio-member ${named} is not one of the people in --members; nothing was written.`, 'Name a member listed in --members.');+ if (named && flags.serves !== 'several' && !hasBrain) return opError('invalid_params', `--stdio-member ${named} names a member, and this brain does not exist yet, so it has none; nothing was written.`, `Label the people it serves in the same run: gbrain setup ${harness} --serves several --members <ids> --stdio-member ${named}.`);+ if ((flags.serves === 'several' || named) && liveOurs) {+ return opError('setup_owner_conflict', `A live stdio serve started by this registration holds the PGLite brain, and ${flags.serves === 'several' ? 'labelling several people needs to write to it' : `checking that ${named} is an enabled member needs to read it`}; nothing was written.`,`Quit the ${harness} session that started it, then run setup again.`, { reason: 'live_serve', docs: 'docs/guides/repair.md#setup-owner-conflict' });}const read = hasBrain && !liveOurs ? readServesStatus(launcher) : null;if (read && 'error' in read) return servesUnreadable(read.error, harness);const status = read?.status ?? null;if (flags.serves === 'several') return { roster, status };- const refusal = servesOneRefusal(status, harness);+ if (named && !status?.enabled_members.includes(named)) {+ return opError('invalid_params', `--stdio-member ${named} is not an enabled member of this brain, so the ${harness} sessions would read as nobody; nothing was written.`,+ `Name one of: ${status?.enabled_members.join(', ') || '(none yet; label them with --serves several --members <ids>)'}.`,+ { fix: { argv: ['gbrain', 'access', 'serves', '--json'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Read-only: lists the enabled members a --stdio-member may name.' } });+ }+ const refusal = servesOneRefusal(status, harness, entry);return refusal ?? { roster, status };}-/** The serves part of a setup run (a preview on a dry run), or null when it has nothing to do or say: a one-person brain. */-export function servesApply(flags: ServesFlags, launcher: string, harness: string, plan: ServesPlan, hasBrain: boolean): ServesOutcome | null {+/** The serves part of a setup run (a preview on a dry run), or null when it has nothing to do or say: a one-person brain with no bound entry. */+export function servesApply(flags: ServesFlags, launcher: string, harness: string, plan: ServesPlan, hasBrain: boolean, entry: EntryBinding = { member: null, previous: null }): ServesOutcome | null {const several = flags.serves === 'several';const labelled = !several ? null : hasBrain || !flags.dryRun ? runServesSeveral(launcher, plan.roster, flags): { mode: 'several' as const, note: `the new brain is created first; then ${plan.roster.join(', ')} each get a member, a folder rule and a bound key` };const reread = several && !flags.dryRun ? readServesStatus(launcher) : null;const status = reread ? ('status' in reread ? reread.status : null) : plan.status;const preview = several && flags.dryRun && status?.serves !== 'several';- const member = labelled && !servesOk({ ...labelled, brain_serves: 'one' }) ? undefined : flags.stdioMember;- const stdio = bindStdio(launcher, harness, preview ? { serves: 'several', from: 'config', enabled_members: plan.roster, owner: null, stdio_member: status?.stdio_member ?? null } : status, member, flags.dryRun);+ const view: ServesStatus | null = preview ? { serves: 'several', from: 'config', enabled_members: plan.roster, owner: null, stdio_member: status?.stdio_member ?? null } : status;+ const stdio = bindStdio(harness, view, entry, flags.dryRun);if (!labelled && !stdio) return null;const outcome: ServesOutcome = { ...(labelled ?? { mode: 'one' as const }), brain_serves: 'one', ...(stdio ? { stdio } : {}),...(reread && 'error' in reread ? { error: `reading the brain back failed: ${reread.error}` } : {}) };- const bound = !!stdio && stdio.action !== 'unbound';+ const bound = !!stdio?.member && view?.serves === 'several';return { ...outcome, brain_serves: bound && servesOk(outcome) ? 'several' : 'one' };}-/** The stdio binding on a brain that serves several people: kept, written for the member a person named, else unbound. */-export function bindStdio(launcher: string, harness: string, status: ServesStatus | null, member: string | undefined, dryRun: boolean): ServesOutcome['stdio'] {- if (!status || status.serves !== 'several') return undefined;- if (status.stdio_member) return { member: status.stdio_member, action: 'keep', detail: `this harness reads as ${status.stdio_member} (config mcp.stdio_member)${member && member !== status.stdio_member ? `; --stdio-member ${member} ignored, since setup never replaces an existing binding` : ''}` };- if (!member || !status.enabled_members.includes(member)) return { member: null, action: 'unbound', detail: `stdio sessions on this brain read only pages no rule restricts, so this harness's instructions keep the one-person scoping lines; to bind a harness that only that person uses, run gbrain setup ${harness} --serves several --stdio-member <member>` };- if (!dryRun) {- const r = child(launcher, ['config', 'set', 'mcp.stdio_member', member]);- if (!r.ok) return { member: null, action: 'unbound', detail: `writing mcp.stdio_member = ${member} failed, so stdio stays unbound: ${r.stderr.trim()}` };+/**+ * Whom this harness's stdio sessions read as. Setup writes nothing to the brain here: the member rides in the harness+ * entry (`serve --stdio-member`, written by the MCP step), and config mcp.stdio_member is only ever set by hand.+ */+export function bindStdio(harness: string, status: ServesStatus | null, entry: EntryBinding, dryRun: boolean): ServesOutcome['stdio'] {+ const tense = (done: string, todo: string) => dryRun ? `would ${todo}` : done;+ const m = entry.member;+ if (m) {+ const action = m === entry.previous ? 'keep' as const : 'write' as const;+ const starts = action === 'keep' ? 'starts' : tense('now starts', 'start');+ if (status && !status.enabled_members.includes(m)) return { member: null, action, detail: `this ${harness} entry ${starts} serve --stdio-member ${m}, and ${m} is not an enabled member of this brain, so its sessions read as nobody` };+ return { member: m, action, detail: `this ${harness} entry ${starts} serve --stdio-member ${m}: only its sessions read as ${m}, including pages only ${m} may read; other harnesses on this host are unchanged` };}- return { member, action: 'write', detail: `${dryRun ? 'would bind: ' : ''}every stdio MCP session on this brain, from any harness on this host, now reads as ${member}, including pages only ${member} may read (config mcp.stdio_member)` };+ const removed = entry.previous ? `${tense('removed', 'remove')} --stdio-member ${entry.previous} from this ${harness} entry; ` : '';+ const action = removed ? 'remove' as const : null;+ if (status?.stdio_member) return { member: status.stdio_member, action: action ?? 'keep', detail: `${removed}this harness reads as ${status.stdio_member} through config mcp.stdio_member, set by hand, which every stdio session that opens this brain without --stdio-member reads as` };+ if (status?.serves !== 'several' && !removed) return undefined;+ return { member: null, action: action ?? 'unbound', detail: `${removed}this harness's stdio sessions read only pages no rule restricts, so its instructions keep the one-person scoping lines; to bind a harness only one person uses, run gbrain setup ${harness} --stdio-member <member>` };}export function servesOk(o: ServesOutcome | null): boolean {diff --git a/src/commands/setup.ts b/src/commands/setup.tsindex 307d705a64..868badc1b5 100644--- a/src/commands/setup.ts+++ b/src/commands/setup.ts@@ -36,6 +36,7 @@ import { hostedOptionMuted, hostedOptionNotice, writeHostedOption } from '../corimport { writeJsonDocument } from '../core/cli-force-exit.ts';import { configDir, gbrainPath, isThinClient, loadConfig, type GBrainConfig } from '../core/config.ts';import { resolveGbrainBin } from '../core/gbrain-bin.ts';+import { parseStdioMemberFlag } from '../core/stdio-member-flag.ts';import { isRegistrationSurface, isValidName, REGISTRATION_SURFACE, registrationAdvertise, stdioServeArgv } from '../core/mcp-registration.ts';import { hookLauncherPath } from '../core/setup/hook-launcher.ts';import { readResolverConfig, resolverHarnesses } from '../core/setup/skill-resolver-config.ts';@@ -47,7 +48,7 @@ import { claudeUserSettingsPath, type ClaudeHookEvent } from '../core/bootstrap/import { readHarnessReceiptState } from '../core/bootstrap/format.ts';import { smokeStdioRegistration } from './doctor/checks/harness-wiring.ts';import { finishFreshSetupMigrations } from './setup-migrations.ts';-import { readServesStatus, sharedStdioHarness, servesApply, servesLines, servesOk, servesPreflight, type ServesOutcome } from './setup-serves.ts';+import { readServesStatus, sharedStdioHarness, servesApply, servesLines, servesOk, servesPreflight, type EntryBinding, type ServesOutcome } from './setup-serves.ts';import type { McpSurface } from '../mcp/surface.ts';import {SETUP_CAPABILITIES,@@ -152,13 +153,16 @@ Flags:(a 0600 file under <config>/member-keys/), then one bound read per memberproves it. A one-person setup on a brain that already serves severalpeople (2+ enabled members) refuses rather than write a connection bound- to nobody, unless config mcp.stdio_member binds it.+ to nobody, unless this harness's entry or config mcp.stdio_member binds it.--members IDS The people of --serves several, comma-separated (e.g. alice-example,bob-example).--members-file PATH The same, one id per line.- --stdio-member ID With --serves several on claude-code or codex: bind the stdio server to ID.- mcp.stdio_member is brain-wide: every stdio session on this host then reads- as ID, so use it only on a machine one person uses; refused where OpenClaw- or Hermes is installed.+ --stdio-member ID claude-code or codex: write serve --stdio-member ID into this harness's+ MCP entry, so only its sessions read as ID (an enabled member, or one+ of --members). Other harnesses on this host are unchanged. Use it for a+ harness only ID uses; refused where OpenClaw or Hermes is installed+ (give each person their own HTTP key there). A re-run keeps the entry's+ member; setup never adds one on its own.+ --no-stdio-member Remove --stdio-member from this harness's entry.--remove Remove exactly what setup wrote (unchanged entries only), thebrain-first instruction block included. The brain and yournotes stay. Combine with --dry-run to preview.@@ -248,7 +252,9 @@ interface SetupFlags {serves?: 'one' | 'several';members?: string;membersFile?: string;+ /** GST-363: written into this harness's MCP entry as serve --stdio-member; never into config. */stdioMember?: string;+ noStdioMember: boolean;}const VALUE_FLAGS = new Set(['--surface', '--scope', '--name', '--source', '--gbrain-bin', '--workspace', '--skill-loading', '--serves', '--members', '--members-file', '--stdio-member']);@@ -273,11 +279,14 @@ function parseFlags(args: string[]): SetupFlags | string {const serves = value('--serves');if (serves !== undefined && serves !== 'one' && serves !== 'several') return `unknown --serves '${serves}'; pass one or several`;if ((args.includes('--members') || args.includes('--members-file')) && serves !== 'several') return '--members and --members-file name the people of --serves several';- const stdioMember = value('--stdio-member');- if (stdioMember !== undefined && serves !== 'several') return '--stdio-member needs --serves several --members <id,...>; nothing was written';- if (stdioMember !== undefined && (!['claude-code', 'codex'].includes(positionals[0] ?? '') || args.includes('--instructions-only'))) return '--stdio-member binds the stdio server setup registers for claude-code or codex (not --instructions-only); nothing was written';+ let stdioMember: string | undefined;+ try { stdioMember = parseStdioMemberFlag(args); } catch (e) { return `${(e as Error).message}; nothing was written`; }+ const noStdioMember = args.includes('--no-stdio-member');+ if (stdioMember !== undefined && noStdioMember) return 'pass --stdio-member or --no-stdio-member, not both';+ const memberFlag = stdioMember !== undefined ? '--stdio-member' : noStdioMember ? '--no-stdio-member' : null;+ if (memberFlag && (!['claude-code', 'codex'].includes(positionals[0] ?? '') || args.includes('--instructions-only') || args.includes('--remove'))) return `${memberFlag} changes the stdio MCP entry setup writes for claude-code or codex (not --instructions-only or --remove); nothing was written`;const shared = stdioMember === undefined ? null : sharedStdioHarness();- if (shared) return `--stdio-member refused: ${shared} is installed on this host and mcp.stdio_member is brain-wide, so the key would bind ${shared}'s shared sessions too; nothing was written`;+ if (shared) return `--stdio-member refused: ${shared} is installed on this host, and its sessions serve several people, so a stdio entry bound to one member is not something setup writes here; give each person their own key over HTTP instead (gbrain serve --http with gbrain auth create <name> --member <id> per person); nothing was written`;const workspace = value('--workspace');if (workspace !== undefined && !workspace.startsWith('/') && !workspace.startsWith('~')) return '--workspace needs an absolute path';const flagLoading = value('--skill-loading');@@ -313,6 +322,7 @@ function parseFlags(args: string[]): SetupFlags | string {...(value('--members') !== undefined ? { members: value('--members') } : {}),...(value('--members-file') !== undefined ? { membersFile: value('--members-file') } : {}),...(stdioMember !== undefined ? { stdioMember } : {}),+ noStdioMember,};}@@ -346,6 +356,8 @@ interface Target {launcher: string;surface: McpSurface;advertise?: McpSurface;+ /** GST-363: the serve --stdio-member this entry carries. */+ stdio_member?: string;registration_owner: 'none' | 'setup' | 'plugin';live_owner: { pid: number; transport: 'stdio' | 'http'; ours: boolean } | null;scope: WiringScope;@@ -392,7 +404,7 @@ function describeTarget(t: Target, out: Out, harness: SetupHarnessId = 'claude-csay(out, `Target (${HARNESS_LABEL[harness]}, ${t.scope} scope):`);say(out, ` brain ${brain}`);say(out, ` source ${t.source.id ? `'${t.source.id}' (pinned, from ${t.source.from === 'flag' ? '--source' : 'GBRAIN_SOURCE'})` : 'the brain\'s default source (unpinned)'}`);- say(out, ` transport stdio MCP: ${[hookLauncherPath(t.brain.config_dir), ...stdioServeArgv(t.launcher, t.surface, t.advertise ?? null)].join(' ')}${t.advertise ? ` (lists the ${t.advertise === 'verbs' ? 'memory verbs and request_tools' : `${t.advertise} tools`}; every ${t.surface} tool stays callable)` : ''}`);+ say(out, ` transport stdio MCP: ${[hookLauncherPath(t.brain.config_dir), ...stdioServeArgv(t.launcher, t.surface, t.advertise ?? null, t.stdio_member)].join(' ')}${t.advertise ? ` (lists the ${t.advertise === 'verbs' ? 'memory verbs and request_tools' : `${t.advertise} tools`}; every ${t.surface} tool stays callable)` : ''}`);say(out, ` owner ${t.registration_owner === 'setup' ? `this setup (${t.receipt_path})` : t.registration_owner === 'plugin' ? `the gbrain ${HARNESS_LABEL[harness]} plugin (MCP); setup adds hooks only` : `none yet; setup will own '${t.name}'`}`);if (t.live_owner) say(out, ` live gbrain ${t.live_owner.transport === 'http' ? 'serve --http' : 'stdio serve'} PID ${t.live_owner.pid}${t.live_owner.ours ? ' (started by this registration)' : ''}`);say(out, ` files ${t.config_path} (MCP${t.hooks_path ? ' + hook trust' : ''}), ${t.hooks_path ?? t.settings_path} (hooks)`);@@ -494,15 +506,18 @@ export async function runSetup(args: string[]): Promise<number> {const again = inspectClaudeSetup(listed);if (again.mcp.state === 'current') { plan = listed; found = again; }}+ const binding = entryBinding(flags, found.mcp.stdioMember);+ if (binding.member) { plan = { ...plan, stdioMember: binding.member }; found = inspectClaudeSetup(plan); }if (found.mcp.state === 'remote') return refuse(hostedConnection(found.mcp.url ?? 'a hosted brain', true, flags.name), out);const pluginOwner = flags.name === 'gbrain' ? claudePluginProvidesName(claudeUserSettingsPath(), 'gbrain') : null;+ if (pluginOwner && flags.stdioMember !== undefined) return refuse(pluginBindingRefusal(pluginOwner, 'claude-code', flags.stdioMember), out);const { dataDir, liveOwner } = liveOwnerOf(cfg, prior?.status === 'installed' && (found.mcp.state === 'current' || found.mcp.state === 'owned'));const target: Target = {brain: !cfg ? { kind: 'new-local-pglite', path: gbrainPath('brain.pglite'), config_dir: brainHome }: cfg.engine === 'pglite' ? { kind: 'local-pglite', path: dataDir, config_dir: brainHome } : { kind: 'local-postgres', config_dir: brainHome },source: { id: sourceId, pinned: sourceId !== null, from: flags.source ? 'flag' : sourceId ? 'env' : 'brain-default' },- transport: 'local-stdio', launcher, surface, ...(plan.advertise ? { advertise: plan.advertise } : {}),+ transport: 'local-stdio', launcher, surface, ...(plan.advertise ? { advertise: plan.advertise } : {}), ...(plan.stdioMember ? { stdio_member: plan.stdioMember } : {}),registration_owner: pluginOwner ? 'plugin' : prior ? 'setup' : 'none',live_owner: liveOwner, scope, name: flags.name,config_path: found.configPath, settings_path: found.settingsPath, receipt_path: found.receiptPath,@@ -524,7 +539,7 @@ export async function runSetup(args: string[]): Promise<number> {actor: 'agent', argv: ['gbrain', 'bootstrap', 'harness', '--remove', '--dry-run'],why: 'Preview removing the bootstrap harness wiring first, or keep it and skip setup.', verify: verifyDryRun('claude-code', flags.name) }), out);}- const servesPlan = servesPreflight(flags, launcher, 'claude-code', !!cfg, !!liveOwner?.ours, !cfg || cfg.engine === 'pglite');+ const servesPlan = servesPreflight(flags, launcher, 'claude-code', !!cfg, !!liveOwner?.ours, binding);if (servesPlan instanceof OperationError) return refuse(servesPlan, out);const brainCreate = !cfg;@@ -533,11 +548,11 @@ export async function runSetup(args: string[]): Promise<number> {const steps: SetupStep[] = [{ step: 'receipt', action: found.prior?.status === 'installed' && found.hooksCurrent && (found.mcp.state === 'current' || !!pluginOwner) && !brainCreate ? 'keep' : 'write', detail: found.receiptPath },...(brainCreate ? [{ step: 'brain' as const, action: 'write' as const, detail: `would run: ${initArgv.join(' ')}` }] : []),- { step: 'mcp', action: pluginOwner ? 'skip' : found.mcp.state === 'current' ? 'keep' : 'write', detail: `'${flags.name}' in ${found.configPath}` },+ { step: 'mcp', action: pluginOwner ? 'skip' : found.mcp.state === 'current' ? 'keep' : 'write', detail: `'${flags.name}' in ${found.configPath}${plan.stdioMember ? ` (serve --stdio-member ${plan.stdioMember})` : ''}` },{ step: 'hooks', action: found.hooksCurrent ? 'keep' : 'write', detail: plan.events.length ? `${plan.events.join(', ')} in ${found.settingsPath}` : `no hooks (${found.settingsPath})` },...Object.entries(found.edited).map(([event]) => ({ step: 'hooks' as const, action: 'preserve' as const, detail: `${event} was edited after setup wrote it; kept` })),];- const serves = servesApply(flags, launcher, 'claude-code', servesPlan, !!cfg);+ const serves = servesApply(flags, launcher, 'claude-code', servesPlan, !!cfg, binding);const instructions = brainFirstFor('claude-code', flags, mcpAccess(flags.name, plan.advertise ?? surface, serves), { scope, projectDir });const skills = skillsFor('claude-code', flags, launcher, { scope, projectDir }, instructions);const resolver = await resolverFor('claude-code', flags, launcher);@@ -550,7 +565,7 @@ export async function runSetup(args: string[]): Promise<number> {beforeMcp: brainCreate ? async () => { notices = runBrainInit(initArgv, out, 'claude-code'); } : undefined,});for (const s of result.steps) say(out, ` ${s.action.padEnd(8)} ${s.step.padEnd(7)} ${s.detail}`);- const serves = servesApply(flags, launcher, 'claude-code', servesPlan, true);+ const serves = servesApply(flags, launcher, 'claude-code', servesPlan, true, binding);const instructions = brainFirstFor('claude-code', flags, mcpAccess(flags.name, plan.advertise ?? surface, serves), { scope, projectDir });const skills = skillsFor('claude-code', flags, launcher, { scope, projectDir }, instructions);const resolver = await resolverFor('claude-code', flags, launcher);@@ -672,15 +687,18 @@ async function runCodexSetup(flags: SetupFlags, launcher: string, cfg: GBrainConconst again = inspectCodexSetup(listed);if (again.mcp.state === 'current') { plan = listed; found = again; }}+ const binding = entryBinding(flags, found.mcp.stdioMember);+ if (binding.member) { plan = { ...plan, stdioMember: binding.member }; found = inspectCodexSetup(plan); }if (found.mcp.state === 'remote') return refuse(hostedConnection(found.mcp.url ?? 'a hosted brain', true, flags.name, 'codex'), out);const pluginOwner = codexPluginProvidesName(paths.configPath, flags.name);+ if (pluginOwner && flags.stdioMember !== undefined) return refuse(pluginBindingRefusal(pluginOwner, 'codex', flags.stdioMember), out);const { dataDir, liveOwner } = liveOwnerOf(cfg, prior?.status === 'installed' && (found.mcp.state === 'current' || found.mcp.state === 'owned'));const target: Target = {brain: !cfg ? { kind: 'new-local-pglite', path: gbrainPath('brain.pglite'), config_dir: brainHome }: cfg.engine === 'pglite' ? { kind: 'local-pglite', path: dataDir, config_dir: brainHome } : { kind: 'local-postgres', config_dir: brainHome },source: { id: sourceId, pinned: sourceId !== null, from: flags.source ? 'flag' : sourceId ? 'env' : 'brain-default' },- transport: 'local-stdio', launcher, surface, ...(plan.advertise ? { advertise: plan.advertise } : {}),+ transport: 'local-stdio', launcher, surface, ...(plan.advertise ? { advertise: plan.advertise } : {}), ...(plan.stdioMember ? { stdio_member: plan.stdioMember } : {}),registration_owner: pluginOwner ? 'plugin' : prior ? 'setup' : 'none',live_owner: liveOwner, scope: 'user', name: flags.name,config_path: found.configPath, hooks_path: found.hooksPath, receipt_path: found.receiptPath,@@ -702,7 +720,7 @@ async function runCodexSetup(flags: SetupFlags, launcher: string, cfg: GBrainConactor: 'agent', argv: harnessLane ? ['gbrain', 'bootstrap', 'harness', '--remove', '--dry-run'] : ['gbrain', 'setup', 'codex', laneEvents.every((e) => e === 'SessionEnd') ? '--no-capture' : '--no-hooks', '--dry-run', '--json'],why: harnessLane ? 'Preview removing the bootstrap harness wiring first, or keep it and skip setup.' : 'Keep the bootstrap lane for those events and preview setup without them.', verify: verifyDryRun('codex', flags.name) }), out);}- const servesPlan = servesPreflight(flags, launcher, 'codex', !!cfg, !!liveOwner?.ours, !cfg || cfg.engine === 'pglite');+ const servesPlan = servesPreflight(flags, launcher, 'codex', !!cfg, !!liveOwner?.ours, binding);if (servesPlan instanceof OperationError) return refuse(servesPlan, out);const brainCreate = !cfg;@@ -712,12 +730,12 @@ async function runCodexSetup(flags: SetupFlags, launcher: string, cfg: GBrainConconst steps: CodexSetupStep[] = [{ step: 'receipt', action: unchanged ? 'keep' : 'write', detail: found.receiptPath },...(brainCreate ? [{ step: 'brain' as const, action: 'write' as const, detail: `would run: ${initArgv.join(' ')}` }] : []),- { step: 'mcp', action: pluginOwner ? 'skip' : found.mcp.state === 'current' ? 'keep' : 'write', detail: `[mcp_servers.${flags.name}] in ${found.configPath}` },+ { step: 'mcp', action: pluginOwner ? 'skip' : found.mcp.state === 'current' ? 'keep' : 'write', detail: `[mcp_servers.${flags.name}] in ${found.configPath}${plan.stdioMember ? ` (serve --stdio-member ${plan.stdioMember})` : ''}` },{ step: 'hooks', action: found.hooksCurrent ? 'keep' : 'write', detail: plan.events.length ? `${plan.events.join(', ')} in ${found.hooksPath}` : `no hooks (${found.hooksPath})` },{ step: 'trust', action: found.trustCurrent ? 'keep' : 'write', detail: `trust entries for setup's groups in ${found.configPath}` },...Object.keys(found.edited).map((event) => ({ step: 'hooks' as const, action: 'preserve' as const, detail: `${event} was edited after setup wrote it; kept` })),];- const serves = servesApply(flags, launcher, 'codex', servesPlan, !!cfg);+ const serves = servesApply(flags, launcher, 'codex', servesPlan, !!cfg, binding);const instructions = brainFirstFor('codex', flags, mcpAccess(flags.name, plan.advertise ?? surface, serves), {});const skills = skillsFor('codex', flags, launcher, {}, instructions);const resolver = await resolverFor('codex', flags, launcher);@@ -731,7 +749,7 @@ async function runCodexSetup(flags: SetupFlags, launcher: string, cfg: GBrainCon});for (const s of result.steps) say(out, ` ${s.action.padEnd(8)} ${s.step.padEnd(7)} ${s.detail}`);for (const n of result.notes) say(out, `note: ${n}`);- const serves = servesApply(flags, launcher, 'codex', servesPlan, true);+ const serves = servesApply(flags, launcher, 'codex', servesPlan, true, binding);const instructions = brainFirstFor('codex', flags, mcpAccess(flags.name, plan.advertise ?? surface, serves), {});const skills = skillsFor('codex', flags, launcher, {}, instructions);const resolver = await resolverFor('codex', flags, launcher);@@ -810,6 +828,17 @@ async function runRemove(flags: SetupFlags, receipt: ClaudeSetupReceipt | null,}/** The brain-first block for this run: decided from flags, env and the ledger, then applied (or previewed under --dry-run). */+/** GST-363: a plugin serves this harness's MCP server, and setup never writes the plugin's launch arguments, so a member named here would bind nothing. */+function pluginBindingRefusal(plugin: string, harness: SetupHarnessId, member: string): OperationError {+ return opError('invalid_params', `--stdio-member ${member} refused: the '${plugin}' plugin serves this ${harness} gbrain MCP server, and setup does not write the plugin's launch arguments, so its sessions would not read as ${member}; nothing was written.`,+ `Disable the '${plugin}' plugin and run gbrain setup ${harness} --stdio-member ${member}, or serve this brain over HTTP with one key per person (gbrain serve --http; for ${member}: gbrain auth create ${member}-key --member ${member}).`);+}++/** GST-363: the --stdio-member the harness entry will carry: the one named, none for --no-stdio-member, else the one setup's own entry carries now. */+function entryBinding(flags: SetupFlags, previous: string | undefined): EntryBinding {+ return { member: flags.noStdioMember ? null : flags.stdioMember ?? previous ?? null, previous: previous ?? null };+}+/** The access the brain-first block names; a brain that serves several people says the connection is already scoped. */function mcpAccess(server: string, surface: McpSurface, serves: ServesOutcome | null): BrainFirstAccess {return { kind: 'mcp', server, surface, ...(serves?.brain_serves === 'several' ? { serves: 'several' as const } : {}) };diff --git a/src/core/access/caller.ts b/src/core/access/caller.tsindex 61dceda3a2..fcc7a614e6 100644--- a/src/core/access/caller.ts+++ b/src/core/access/caller.ts@@ -6,8 +6,10 @@* against. The verifiers (src/core/oauth-provider.ts, src/mcp/http-transport.ts)* join the binding once and carry it on AuthInfo.member, so dispatch costs no* query; an AuthInfo no verifier built (member undefined) is looked up from- * its principal. A local stdio server reads its binding from config- * `mcp.stdio_member`. A brain with no member-access restriction skips all of+ * its principal. A local stdio server reads its binding from its own+ * `gbrain serve --stdio-member <id>` (the harness's MCP entry, so one+ * registration on one machine), else from config `mcp.stdio_member` set by+ * hand. A brain with no member-access restriction skips all of* it. Every failure (pre-migration schema, unreadable row, unknown or* disabled member) yields an empty identity, which reads no restricted page.*/@@ -44,14 +46,15 @@ async function liveIdentity(engine: Pick<BrainEngine, 'executeRaw'>, memberSql:/*** The member identity bound to `auth`: the verifier's join when present, else a lookup from its principal (a local- * stdio principal reads config mcp.stdio_member, as stdio reads do); empty when unbound, unknown or unreadable. A- * write's publication passes only its stored principal, so a member disabled or a binding removed after submission- * takes effect.+ * stdio principal reads the member its serve was started with, stamped as `stdioMember` on a stored write, else+ * config mcp.stdio_member, as stdio reads do); empty when unbound, unknown or unreadable. A write's publication passes+ * only its stored principal, so a member disabled or a binding removed after submission takes effect.*/-export async function memberIdentityFor(engine: Pick<BrainEngine, 'executeRaw'>, auth: Pick<AuthInfo, 'member'> & { principal?: { kind: string; id: string } } | undefined): Promise<string[]> {+export async function memberIdentityFor(engine: Pick<BrainEngine, 'executeRaw'>, auth: Pick<AuthInfo, 'member'> & { principal?: { kind: string; id: string }; stdioMember?: string } | undefined): Promise<string[]> {if (auth?.member !== undefined) return auth.member ? identityFor(auth.member.id, auth.member.groups) : [];const principal = auth?.principal;- if (principal?.kind === 'local_stdio') return liveIdentity(engine, `SELECT ${edgeTrimSql('value')} FROM config WHERE key = $1`, STDIO_MEMBER_KEY);+ if (principal?.kind === 'local_stdio') return auth?.stdioMember !== undefined ? liveIdentity(engine, '$1', auth.stdioMember)+ : liveIdentity(engine, `SELECT ${edgeTrimSql('value')} FROM config WHERE key = $1`, STDIO_MEMBER_KEY);if (!principal || (principal.kind !== 'legacy_token' && principal.kind !== 'oauth_client')) return [];return liveIdentity(engine, principal.kind === 'legacy_token'? 'SELECT member_id FROM access_tokens WHERE id::text = $1 AND revoked_at IS NULL'@@ -68,9 +71,13 @@ export async function stdioMemberId(engine: BrainEngine): Promise<string | null>}}-/** The identity of a local stdio server: its bound live member, else empty (unbound stdio reads no restricted page). */-export async function stdioMemberIdentity(engine: BrainEngine): Promise<string[]> {- const member = await stdioMemberId(engine);+/**+ * The identity of a local stdio server: the live member its serve was started with (--stdio-member), else the live+ * member config mcp.stdio_member names, else empty. A named member that is disabled or unknown reads as nobody and+ * never falls back to the config key.+ */+export async function stdioMemberIdentity(engine: BrainEngine, registered?: string): Promise<string[]> {+ const member = registered ?? await stdioMemberId(engine);return member ? liveIdentity(engine, '$1', member) : [];}@@ -197,15 +204,16 @@ export async function resolveAudienceIdentities(engine: Pick<BrainEngine, 'execu* (several entries, a group or a guest) sees no visibility: private page.* GST-2059: a caller bound to the brain owner (config access.owner_member) reads with its privacy relaxed in every* source its grant reads (owner), with no audience or an audience of the owner alone; member access stays.+ * GST-363: `stdioMember` is the member an unauthenticated stdio server was started with (serve --stdio-member).*/-export async function remoteCallerAccess(engine: BrainEngine, auth: AuthInfo | undefined, privateSources: readonly string[] | undefined, transport?: string, audience?: readonly AudiencePrincipal[] | null): Promise<Partial<CallerAccess>> {+export async function remoteCallerAccess(engine: BrainEngine, auth: AuthInfo | undefined, privateSources: readonly string[] | undefined, transport?: string, audience?: readonly AudiencePrincipal[] | null, stdioMember?: string): Promise<Partial<CallerAccess>> {const [relaxed, remotePolicy] = await Promise.all([remotePrivacyRelaxed(engine), requestRemotePolicy(engine)]);const restricted = remotePolicy.restricted;if (audience?.length) {const identities = await resolveAudienceIdentities(engine, { auth, transport }, audience);const single = singleMemberAudience(audience);const owner = single && audience[0] === `member:${remotePolicy.ownerMember}`- && isOwner(await boundIdentity(engine, auth, transport), remotePolicy);+ && isOwner(await boundIdentity(engine, auth, transport, stdioMember), remotePolicy);return {identity: identities.length === 1 ? identities[0]! : [],audience: [...audience],@@ -219,7 +227,7 @@ export async function remoteCallerAccess(engine: BrainEngine, auth: AuthInfo | uremotePolicy,};}- const identity = restricted || remotePolicy.ownerMember ? await boundIdentity(engine, auth, transport) : [];+ const identity = restricted || remotePolicy.ownerMember ? await boundIdentity(engine, auth, transport, stdioMember) : [];const owner = isOwner(identity, remotePolicy);return {identity,@@ -235,9 +243,9 @@ export async function remoteCallerAccess(engine: BrainEngine, auth: AuthInfo | u};}-/** The member identity a remote caller's credential (or, unauthenticated over stdio, config mcp.stdio_member) is bound to. */-async function boundIdentity(engine: BrainEngine, auth: AuthInfo | undefined, transport?: string): Promise<string[]> {- return !auth && transport === 'stdio' ? stdioMemberIdentity(engine) : memberIdentityFor(engine, auth);+/** The member identity a remote caller's credential (or, unauthenticated over stdio, serve --stdio-member, else config mcp.stdio_member) is bound to. */+async function boundIdentity(engine: BrainEngine, auth: AuthInfo | undefined, transport?: string, stdioMember?: string): Promise<string[]> {+ return !auth && transport === 'stdio' ? stdioMemberIdentity(engine, stdioMember) : memberIdentityFor(engine, auth);}/** GST-2059: the live identity is the brain owner's (config access.owner_member). Only a live, enabled member has an identity. */@@ -289,7 +297,7 @@ export interface CallerAccessView {member: string | null;groups: string[];may_act_for: string[] | null;- bound_by: 'credential' | 'stdio_config' | 'as' | 'none';+ bound_by: 'credential' | 'stdio_registration' | 'stdio_config' | 'as' | 'none';note?: string;}@@ -312,9 +320,14 @@ export async function credentialAccessView(engine: BrainEngine, auth: AuthInfo):return accessView(identity, 'credential', auth.mayActFor ?? null, identity.length ? undefined : UNBOUND_NOTE);}-/** The access view of a local stdio server (config mcp.stdio_member). */-export async function stdioAccessView(engine: BrainEngine): Promise<CallerAccessView> {- const [configured, identity] = await Promise.all([stdioMemberId(engine), stdioMemberIdentity(engine)]);+/** The access view of a local stdio server: serve --stdio-member (`registered`) when it was started with one, else config mcp.stdio_member. */+export async function stdioAccessView(engine: BrainEngine, registered?: string): Promise<CallerAccessView> {+ const [configured, identity] = await Promise.all([stdioMemberId(engine), stdioMemberIdentity(engine, registered)]);+ if (registered !== undefined) {+ const ignored = configured && configured !== registered ? ` config mcp.stdio_member names "${configured}", which this server ignores: its own --stdio-member wins.` : '';+ if (identity.length) return accessView(identity, 'stdio_registration', null, ignored.trim() || undefined);+ return accessView([], 'none', null, `This server was started with --stdio-member ${registered}, which is not an enabled member, so it reads no page that names readers.${ignored}`);+ }if (identity.length) return accessView(identity, 'stdio_config');return accessView([], 'none', null, configured? `mcp.stdio_member names "${configured}", which is not an enabled member, so this server reads no page that names readers.`diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.tsindex 70dd45403e..b548417c82 100644--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@ -1498,7 +1498,8 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;{ since: '0.60.628.0', id: 'federated_member_writes_8982', text: 'A token or OAuth client bound to a member whose write source is a federated source (`gbrain sources federate <id>`) now writes the pages it creates with `readable_by: [member:<id>]`, as one writing to `default` does, because every credential without a source grant reads federated sources too; `POST /ingest` refuses such a credential. Before this, other members\' no-grant tokens and unbound tokens read those pages. A write source that is not federated is unchanged, and pages written before the upgrade keep their readers (`gbrain access who-can-read <slug>`).' },{ since: '0.60.630.0', id: 'commit_push_skipped_paths_gst2116', text: '`gbrain git commit-push` and `scripts/brain-commit-push.sh` now exit 1 when git left a named path out of the commit, instead of exiting 0: a modified file flagged assume-unchanged or skip-worktree, or a file inside a nested Git repository. The other named paths are still committed (and pushed on a classic checkout); the error names each skipped path and its reason: `writer_coordinator_required` for a page in a managed canonical worktree (save it through put_page), `commit_paths_skipped` otherwise. The helper\'s managed-checkout refusal now prints the operator contract (code, why, fix, next). Existing brains get the new helper on the next `gbrain sources harden`.' },{ since: '0.60.632.0', id: 'pending_ledger_flagged_gst2118', text: 'A page write that git could not commit because the file is flagged assume-unchanged or skip-worktree now stays in the write-through pending ledger, so `gbrain doctor` reports it as `dirty_age`, and `gbrain git commit-push --pending` exits 1 with `commit_paths_skipped` naming it instead of exiting 0 with nothing_to_commit. `gbrain git commit-push` naming a modified skip-worktree file now commits the other paths and fails `commit_paths_skipped` (reason `skip_worktree`) instead of `commit_paths_invalid` with nothing committed.' },- { since: 'TBD', id: 'serves_several_labels_gst363', text: 'A brain now says whether it serves one person or several: config `access.serves` (`one` or `several`), else two or more enabled members means several (`gbrain access serves` shows which and why). `gbrain setup <harness> --serves several --members <id,...>` (or `--members-file`) labels each person: a member, a folder rule `people/<member>/` only that member reads, and one key bound to that member in a 0600 file under `~/.gbrain/member-keys/` (the receipt prints paths, never keys), then proves it with one bound read per member; `gbrain access serves several` does the labelling alone. On such a brain a plain `gbrain setup claude-code|codex` now refuses `setup_serves_several` and writes nothing, unless config `mcp.stdio_member` already binds the connection; setup never writes that brain-wide key on its own, and `--stdio-member <member>` (claude-code or codex, refused where OpenClaw or Hermes is installed) binds every stdio session on the host to that member; its brain-first block says the connection reads only what the person asking may read. `gbrain doctor` fails the new `unlabeled_people_folders` check when such a brain has a `people/<name>/` folder with pages and no folder rule naming its readers. A one-person brain sees no change.' },+ { since: 'TBD', id: 'serves_several_labels_gst363', text: 'A brain now says whether it serves one person or several: config `access.serves` (`one` or `several`), else two or more enabled members means several (`gbrain access serves` shows which and why). `gbrain setup <harness> --serves several --members <id,...>` (or `--members-file`) labels each person: a member, a folder rule `people/<member>/` only that member reads, and one key bound to that member in a 0600 file under `~/.gbrain/member-keys/` (the receipt prints paths, never keys), then proves it with one bound read per member; `gbrain access serves several` does the labelling alone. On such a brain a plain `gbrain setup claude-code|codex` now refuses `setup_serves_several` and writes nothing, unless the harness entry carries `--stdio-member` or config `mcp.stdio_member`, set by hand, binds the connection; setup never writes that brain-wide key, and `--stdio-member <member>` (claude-code or codex, refused where OpenClaw or Hermes is installed) binds only that harness entry to that member; its brain-first block says the connection reads only what the person asking may read. `gbrain doctor` fails the new `unlabeled_people_folders` check when such a brain has a `people/<name>/` folder with pages and no folder rule naming its readers. A one-person brain sees no change.' },+ { since: 'TBD', id: 'stdio_member_per_harness_gst363', text: '`gbrain setup claude-code|codex --stdio-member <member>` now writes `serve --stdio-member <member>` into that one harness entry instead of setting config `mcp.stdio_member`, so only that harness on that machine reads as the member, on PGLite and Postgres alike; setup never writes `mcp.stdio_member`, which still binds, when set by hand, every stdio server started without the flag. The flag no longer needs `--serves several`, the member must be enabled, and setup still refuses it where OpenClaw or Hermes is installed or a plugin serves the harness, and `gbrain serve` refuses to start with it where OpenClaw or Hermes is installed. Re-runs and `gbrain post-upgrade` keep an entry\'s member and never add one; `--no-stdio-member` removes it, also on a brain that serves several people. A disabled or unknown member reads as nobody.' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --git a/src/core/cli-flag-registry.generated.ts b/src/core/cli-flag-registry.generated.tsindex 3674996cdf..5520d74f10 100644--- a/src/core/cli-flag-registry.generated.ts+++ b/src/core/cli-flag-registry.generated.ts@@ -52,7 +52,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'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', '--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', '--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', '--aggressive', '--aliases', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-outside-source-root', '--allow-shell-jobs', '--allow-unverified-remote', '--allowed-operations', '--applied', '--apply', '--apply-rewrites', '--approval-out', '--approved', '--as', '--assign-corpus', '--attest-actor', '--attest-ops', '--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', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--concurrency', '--confidence', '--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', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--entity', '--env', '--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', '--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-url', '--git-common-dir', '--git-dir', '--git-path', '--grammar', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--held', '--help', '--hold-state', '--holds', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--ignore-missing', '--images', '--include-ambiguous', '--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', '--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', '--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-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', '--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', '--reader-mode', '--readers', '--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-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', '--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', '--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', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--timings', '--to', '--token', '--token-ttl', '--top-k', '--topo-order', '--trust', '--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', '--window', '--workers', '--working-tree', '--workspace', '--worktree', '--write-tree', '--yes'],+ 'doctor': ['--abandon', '--abbrev-ref', '--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', '--aggressive', '--aliases', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-outside-source-root', '--allow-shell-jobs', '--allow-unverified-remote', '--allowed-operations', '--applied', '--apply', '--apply-rewrites', '--approval-out', '--approved', '--as', '--assign-corpus', '--attest-actor', '--attest-ops', '--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', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--concurrency', '--confidence', '--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', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--entity', '--env', '--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', '--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-url', '--git-common-dir', '--git-dir', '--git-path', '--grammar', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--held', '--help', '--hold-state', '--holds', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--ignore-missing', '--images', '--include-ambiguous', '--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', '--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', '--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', '--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', '--reader-mode', '--readers', '--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-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', '--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', '--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', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--timings', '--to', '--token', '--token-ttl', '--top-k', '--topo-order', '--trust', '--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', '--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'],@@ -78,7 +78,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'graph-query': ['--brain', '--depth', '--direction', '--help', '--hop', '--include-foreign', '--json', '--mcp-only', '--request-id', '--source', '--type'],'hook': ['--allow-unverified-remote', '--auto', '--batch-check', '--brain', '--branch', '--cached', '--catalog', '--count', '--diff-filter', '--dir', '--enable', '--end-of-options', '--env', '--gbrain-bin', '--get', '--harness', '--help', '--instructions', '--instructions-only', '--jq', '--json', '--limit', '--name-only', '--no-instructions', '--only', '--others', '--pat-file', '--path', '--porcelain', '--print', '--pure', '--quiet', '--remove', '--scope', '--seat', '--session', '--show-current', '--show-toplevel', '--since', '--source', '--source-ids', '--verify', '--workspace', '--yes'],'import': ['--accept-pending', '--access-policy', '--admin-intent', '--allow-empty', '--allow-noncanonical-root', '--apply', '--as', '--background', '--batch-check', '--brain', '--cached', '--confirm-relocated-root', '--diff-filter', '--dim', '--embedding-dimensions', '--embedding-model', '--empty', '--exclude', '--exclude-standard', '--expected-epoch', '--expected-state', '--explain', '--follow', '--force', '--force-rechunk', '--format', '--fresh', '--help', '--include-gitignored', '--is-shallow-repository', '--json', '--literal-pathspecs', '--log-noop', '--manifest', '--name-only', '--no-accept-pending', '--no-embed', '--no-embedding', '--no-gpg-sign', '--no-pull', '--no-renames', '--no-verify', '--only', '--others', '--path', '--probe', '--progress-interval', '--progress-json', '--quiet', '--self-transfer', '--show-toplevel', '--skip-failed', '--slugs', '--source', '--source-id', '--stale', '--status', '--supabase', '--timeout', '--timings', '--to', '--url', '--verify', '--wait', '--workers'],- 'init': ['--abandon', '--absolute-git-dir', '--accept-all', '--accept-capabilities', '--access', '--access-policy', '--acknowledge-managed', '--adopt', '--advertise', '--after', '--aliases', '--all', '--all-drifted', '--allow-create-db', '--allow-docker', '--allow-outside-source-root', '--applied', '--apply', '--approval-out', '--approved', '--as', '--assign-corpus', '--attest-actor', '--attest-ops', '--attest-sources', '--audit', '--auto', '--auto-additive', '--background', '--base', '--batch', '--bound-slug-prefixes', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--by-mention', '--catch-up', '--channel', '--chat-model', '--check', '--check-downgrade', '--class', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--content-root', '--continue', '--conversation', '--cursor', '--db-only', '--deadline', '--decisions', '--dest', '--detach', '--detail', '--dim', '--disable', '--drain', '--embedding-dimensions', '--embedding-model', '--enable', '--entity', '--exclude', '--expand', '--expansion-model', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--explain', '--facts', '--fast', '--federated', '--file', '--fix', '--force', '--force-retry', '--format', '--fresh-token', '--from', '--from-meetings', '--full', '--git', '--grammar', '--grant-types', '--group-by', '--harness', '--held', '--help', '--hold-state', '--holds', '--http', '--id', '--images', '--include-ambiguous', '--include-cross-entity', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--infer-dates', '--input', '--install', '--instructions-only', '--issuer-url', '--job-isolation', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--lanes', '--legacy-lock', '--limit', '--link', '--list', '--list-out', '--local', '--local-postgres', '--markdown', '--max-cost-usd', '--max-facts', '--max-requests', '--max-rss', '--max-usd', '--may-act-for', '--mcp-only', '--mcp-url', '--member', '--members', '--members-file', '--migrate-only', '--migration', '--min-n', '--mode', '--model', '--no-autopilot-install', '--no-autostash', '--no-delegate', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-git', '--no-hooks', '--no-instructions', '--no-lanes', '--no-llm', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-verify', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--of', '--older-than', '--once', '--only', '--operation', '--output', '--oversized', '--page', '--params', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--pending', '--pglite', '--phase', '--plan', '--prefer', '--prefer-postgres', '--prefix', '--preview', '--private-pages', '--probe', '--profile', '--provenance', '--providers', '--pull', '--purge', '--push-only', '--qm', '--query', '--question', '--quiet', '--readers', '--rebase', '--rebuild', '--redact-paths', '--reference-date', '--remediate', '--remote', '--remove', '--repair', '--repair-unknown-markers', '--repo', '--request', '--request-id', '--require-clean', '--reset', '--resolve', '--restart-only', '--resume', '--retire', '--retry-failed', '--retry-parked', '--runtime', '--save', '--scan-secrets', '--schema-pack', '--scope', '--scopes', '--search-mode', '--section', '--segmented', '--self-transfer', '--semantic', '--serves', '--session', '--session-id', '--shared-skills', '--show-toplevel', '--side', '--since', '--since-last-run', '--skip', '--skip-embed-check', '--skip-failed', '--slug', '--slugs', '--source', '--source-id', '--sources', '--squash', '--src-subpath', '--stale', '--state', '--status', '--stdin', '--stdio-member', '--stop-mcp', '--strategy', '--supabase', '--surface', '--swap-only', '--tier', '--timeout', '--to', '--token', '--touchpoint', '--type', '--types', '--uninstall', '--unsettle', '--url', '--url-env', '--user', '--vacuum', '--verbose', '--version', '--wait', '--warn-only', '--watch', '--working-tree', '--workspace', '--yes'],+ 'init': ['--abandon', '--absolute-git-dir', '--accept-all', '--accept-capabilities', '--access', '--access-policy', '--acknowledge-managed', '--adopt', '--advertise', '--after', '--aliases', '--all', '--all-drifted', '--allow-create-db', '--allow-docker', '--allow-outside-source-root', '--applied', '--apply', '--approval-out', '--approved', '--as', '--assign-corpus', '--attest-actor', '--attest-ops', '--attest-sources', '--audit', '--auto', '--auto-additive', '--background', '--base', '--batch', '--bound-slug-prefixes', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--by-mention', '--catch-up', '--channel', '--chat-model', '--check', '--check-downgrade', '--class', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--content-root', '--continue', '--conversation', '--cursor', '--db-only', '--deadline', '--decisions', '--dest', '--detach', '--detail', '--dim', '--disable', '--drain', '--embedding-dimensions', '--embedding-model', '--enable', '--entity', '--exclude', '--expand', '--expansion-model', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--explain', '--facts', '--fast', '--federated', '--file', '--fix', '--force', '--force-retry', '--format', '--fresh-token', '--from', '--from-meetings', '--full', '--git', '--grammar', '--grant-types', '--group-by', '--harness', '--held', '--help', '--hold-state', '--holds', '--http', '--id', '--images', '--include-ambiguous', '--include-cross-entity', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--infer-dates', '--input', '--install', '--instructions-only', '--issuer-url', '--job-isolation', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--lanes', '--legacy-lock', '--limit', '--link', '--list', '--list-out', '--local', '--local-postgres', '--markdown', '--max-cost-usd', '--max-facts', '--max-requests', '--max-rss', '--max-usd', '--may-act-for', '--mcp-only', '--mcp-url', '--member', '--members', '--members-file', '--migrate-only', '--migration', '--min-n', '--mode', '--model', '--no-autopilot-install', '--no-autostash', '--no-delegate', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-git', '--no-hooks', '--no-instructions', '--no-lanes', '--no-llm', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-stdio-member', '--no-verify', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--of', '--older-than', '--once', '--only', '--operation', '--output', '--oversized', '--page', '--params', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--pending', '--pglite', '--phase', '--plan', '--prefer', '--prefer-postgres', '--prefix', '--preview', '--private-pages', '--probe', '--profile', '--provenance', '--providers', '--pull', '--purge', '--push-only', '--qm', '--query', '--question', '--quiet', '--readers', '--rebase', '--rebuild', '--redact-paths', '--reference-date', '--remediate', '--remote', '--remove', '--repair', '--repair-unknown-markers', '--repo', '--request', '--request-id', '--require-clean', '--reset', '--resolve', '--restart-only', '--resume', '--retire', '--retry-failed', '--retry-parked', '--runtime', '--save', '--scan-secrets', '--schema-pack', '--scope', '--scopes', '--search-mode', '--section', '--segmented', '--self-transfer', '--semantic', '--serves', '--session', '--session-id', '--shared-skills', '--show-toplevel', '--side', '--since', '--since-last-run', '--skip', '--skip-embed-check', '--skip-failed', '--slug', '--slugs', '--source', '--source-id', '--sources', '--squash', '--src-subpath', '--stale', '--state', '--status', '--stdin', '--stdio-member', '--stop-mcp', '--strategy', '--supabase', '--surface', '--swap-only', '--tier', '--timeout', '--to', '--token', '--touchpoint', '--type', '--types', '--uninstall', '--unsettle', '--url', '--url-env', '--user', '--vacuum', '--verbose', '--version', '--wait', '--warn-only', '--watch', '--working-tree', '--workspace', '--yes'],'integrations': ['--auto', '--brain', '--dry-run', '--help', '--json', '--overwrite', '--refresh', '--source', '--target'],'integrity': ['--accept-pending', '--as', '--auto', '--backend', '--background', '--body', '--brain', '--check', '--confidence', '--cost', '--dry-run', '--explain', '--follow', '--fresh', '--help', '--json', '--limit', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--review-lower', '--skip-bare-tweet', '--skip-urls', '--source', '--timeout', '--timings', '--type', '--wait'],'jobs': ['--abbrev-ref', '--access', '--access-policy', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt-slug-path', '--aliases', '--all', '--all-sources', '--allow-empty', '--allow-shell-jobs', '--allowed-operations', '--apply', '--approval-out', '--approved', '--as', '--asof', '--assign-corpus', '--attest-actor', '--attest-ops', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--base', '--batch-size', '--body', '--bound-slug-prefixes', '--brain', '--break-lock', '--budget-ms', '--bundled', '--by-mention', '--cached', '--catalog', '--catch-up', '--channel', '--check', '--check-downgrade', '--check-only', '--clear', '--cli-path', '--client', '--close', '--cluster-errors', '--code', '--concurrency', '--confidence', '--confirm-destructive', '--confirm-relocated-root', '--cost-estimate', '--cursor', '--date', '--dated-since', '--days', '--decisions', '--delay', '--detach', '--detail', '--diff-filter', '--dir', '--drain', '--drain-timeout', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--enable', '--entities', '--exclude', '--exclude-standard', '--expect', '--expect-catalog', '--expect-local', '--expect-upstream', '--expected-state', '--explain', '--facts', '--federated-read', '--ff-only', '--file', '--filters', '--finished-since', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--force-schema', '--format', '--fresh', '--from-index', '--from-json', '--from-meetings', '--full', '--full-history', '--fuzzy', '--git', '--grammar', '--grammar-diagnostics', '--group', '--group-by', '--hard-deadline', '--health-interval', '--held', '--help', '--hold-state', '--http', '--id', '--idempotency-key', '--ids', '--images', '--include', '--include-ambiguous', '--include-deleted', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-null-signature', '--infer-dates', '--inject-bootstrap', '--inline', '--input', '--input-json', '--install', '--interval', '--is-ancestor', '--is-shallow-repository', '--job-id', '--job-isolation', '--json', '--keep', '--kind', '--lanes', '--legacy-lock', '--limit', '--list', '--local', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--max-cost', '--max-cost-usd', '--max-crashes', '--max-rss', '--max-sources', '--max-stalled', '--max-usd', '--max-waiting', '--may-act-for', '--mcp-only', '--member', '--members', '--members-file', '--migration', '--min-context', '--missing-path', '--mode', '--model', '--multimodal', '--name', '--name-only', '--ner', '--nice', '--no-assume-unchanged', '--no-auto-embed', '--no-autopilot-install', '--no-bulk', '--no-confirm', '--no-delegate', '--no-embed', '--no-embedding', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-lanes', '--no-llm', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-skip-worktree', '--no-verify', '--no-worker', '--non-interactive', '--now', '--of', '--older-than', '--once', '--only', '--order', '--others', '--output', '--override-disabled', '--oversized', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--parked-code', '--pat-file', '--path', '--pause', '--pglite', '--phase', '--pid-file', '--plan', '--port', '--prefer', '--preview', '--priority', '--probe', '--prune-orphans', '--pull', '--purge', '--qm', '--question', '--queue', '--queue-only', '--quiet', '--rate', '--reason', '--reason-scan-limit', '--rebuild', '--recent', '--record', '--redact-paths', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--refresh-operations', '--remediate', '--repo', '--request-id', '--reset-checkpoint', '--restart-only', '--resume', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--review-lower', '--routing', '--row', '--save', '--scope', '--scopes', '--section', '--segment-limit', '--segmented', '--select', '--self-transfer', '--serial', '--serves', '--session', '--show-toplevel', '--side', '--sigkill-rescue', '--since', '--skill-loading', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--sleep', '--slug', '--slugs', '--source', '--source-guard', '--source-id', '--sources', '--src-subpath', '--staged', '--stale', '--state', '--statement-timeout', '--status', '--stdio-member', '--stop-mcp', '--strategy', '--suites', '--surface', '--swap-only', '--target', '--text', '--thin', '--thin-threshold', '--tier', '--timeout', '--timeout-ms', '--to', '--token', '--token-env', '--trust', '--type', '--types', '--uninstall', '--updated-after', '--url', '--user', '--vectors', '--verbose', '--verify', '--version', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],@@ -122,8 +122,8 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'salience': ['--brain', '--days', '--help', '--json', '--kind', '--limit', '--mcp-only', '--request-id', '--slug-prefix', '--source'],'schema': ['--alias', '--apply', '--as-filing-rules', '--brain', '--dims', '--expert', '--expert-routing', '--extractable', '--fields', '--force', '--help', '--inverse', '--json', '--kind', '--no-prefix', '--pack', '--page-type', '--path', '--prefix', '--primitive', '--schema-pack', '--since', '--source', '--source-id', '--target-type', '--to', '--with-db'],'self-upgrade': ['--apply', '--brain', '--channel', '--check-only', '--clear-never-installed', '--exit-code', '--ff-only', '--force', '--force-retry', '--help', '--is-ancestor', '--json', '--markdown', '--migrate-only', '--no-autopilot-install', '--no-bun-floor-check', '--no-restart', '--non-interactive', '--quiet', '--refresh-cache', '--refs', '--remediation-plan', '--restart-only', '--snooze', '--source', '--stop-mcp', '--swap-only', '--tags', '--version', '--yes'],- 'serve': ['--access', '--add', '--adopt-columns', '--adopt-permissions', '--advertise', '--all-new', '--apply-rewrites', '--attest-actor', '--attest-ops', '--bind', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--budget-usd-per-day', '--cli-socket', '--client', '--days', '--delegated-namespace', '--delegated-slug-prefixes', '--enable-dcr', '--enable-dcr-insecure', '--expect', '--fail-fast', '--federated-read', '--grant-types', '--harness', '--help', '--http', '--id', '--if-version', '--json', '--log-full-params', '--may-act-for', '--member', '--migrate-legacy', '--min-trust', '--no-embedding', '--no-pull', '--oauth-request', '--only', '--operations', '--path', '--pglite', '--port', '--prefer-postgres', '--print-admin-token', '--private-pages', '--profile', '--provenance', '--public-url', '--read-sources', '--redirect-uri', '--refresh-operations', '--repair', '--reset-default', '--retry-failed', '--scopes', '--source', '--source-guard', '--source-id', '--sources', '--stale', '--stdio-idle-timeout', '--suppress-bootstrap-token', '--surface', '--takes-holders', '--token', '--token-endpoint-auth-method', '--token-ttl', '--tools-json', '--url', '--usage', '--yes'],- 'setup': ['--accept-capabilities', '--advertise', '--agent', '--as', '--auto', '--bearer-token-env-var', '--brain', '--break-lock', '--capture', '--credentials-file', '--dry-run', '--env', '--force', '--gbrain-bin', '--harness', '--header', '--help', '--http', '--images', '--install', '--instructions', '--instructions-only', '--issuer-url', '--json', '--legacy-lock', '--limit', '--link', '--mcp-only', '--mcp-url', '--members', '--members-file', '--name', '--no-capture', '--no-embedding', '--no-hooks', '--no-instructions', '--no-providers', '--oauth-client-id', '--oauth-client-secret', '--only', '--path', '--pglite', '--probe', '--providers', '--pure', '--remove', '--root', '--runtime', '--save', '--scope', '--serves', '--skill-loading', '--skills-index-only', '--source', '--source-id', '--source-ids', '--stale', '--stdio-member', '--surface', '--token', '--url', '--workspace', '--yes'],+ 'serve': ['--access', '--add', '--adopt-columns', '--adopt-permissions', '--advertise', '--all-new', '--apply-rewrites', '--as', '--attest-actor', '--attest-ops', '--bind', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--budget-usd-per-day', '--cli-socket', '--client', '--days', '--delegated-namespace', '--delegated-slug-prefixes', '--enable-dcr', '--enable-dcr-insecure', '--expect', '--fail-fast', '--federated-read', '--grant-types', '--harness', '--help', '--http', '--id', '--if-version', '--json', '--limit', '--log-full-params', '--may-act-for', '--member', '--members', '--members-file', '--migrate-legacy', '--min-trust', '--no-embedding', '--no-pull', '--no-stdio-member', '--oauth-request', '--only', '--operations', '--path', '--pglite', '--port', '--prefer-postgres', '--print-admin-token', '--private-pages', '--profile', '--provenance', '--public-url', '--read-sources', '--redirect-uri', '--refresh-operations', '--repair', '--reset-default', '--retry-failed', '--scopes', '--serves', '--source', '--source-guard', '--source-id', '--sources', '--stale', '--stdio-idle-timeout', '--stdio-member', '--suppress-bootstrap-token', '--surface', '--takes-holders', '--token', '--token-endpoint-auth-method', '--token-ttl', '--tools-json', '--url', '--usage', '--yes'],+ 'setup': ['--accept-capabilities', '--advertise', '--agent', '--as', '--auto', '--bearer-token-env-var', '--brain', '--break-lock', '--capture', '--credentials-file', '--dry-run', '--env', '--force', '--gbrain-bin', '--harness', '--header', '--help', '--http', '--images', '--install', '--instructions', '--instructions-only', '--issuer-url', '--json', '--legacy-lock', '--limit', '--link', '--mcp-only', '--mcp-url', '--member', '--members', '--members-file', '--name', '--no-capture', '--no-embedding', '--no-hooks', '--no-instructions', '--no-providers', '--no-stdio-member', '--oauth-client-id', '--oauth-client-secret', '--only', '--path', '--pglite', '--probe', '--providers', '--pure', '--remove', '--root', '--runtime', '--save', '--scope', '--serves', '--skill-loading', '--skills-index-only', '--source', '--source-id', '--source-ids', '--stale', '--stdio-member', '--surface', '--token', '--url', '--workspace', '--yes'],'skill-resolver': ['--brain', '--bundled', '--catalog', '--dir', '--exclude', '--expect-catalog', '--explain-target', '--fail-open', '--from-json', '--harness', '--help', '--input-json', '--json', '--load-hint', '--names-only', '--out', '--previous', '--reset-session', '--routing', '--scope', '--session', '--shadow', '--shadow-log', '--source', '--text', '--top-k'],'skillify': ['--brain', '--description', '--dry-run', '--force', '--help', '--json', '--mutating', '--recent', '--skills-dir', '--source', '--strict', '--triggers', '--writes-pages', '--writes-to'],'skillopt': ['--all', '--allow-mutate-bundled', '--background', '--batch-size', '--benchmark', '--bootstrap-from-routing', '--bootstrap-from-skill', '--bootstrap-reviewed', '--bootstrap-tasks', '--brain', '--brain-wide-max-cost-usd', '--dry-run', '--epochs', '--follow', '--force', '--held-out', '--help', '--json', '--judge-model', '--loop', '--lr', '--lr-schedule', '--max-cost-usd', '--max-runtime-min', '--max-usd', '--models-strict', '--no-max-cost', '--no-mutate', '--optimizer-model', '--patch', '--reflect-max-tokens', '--resume', '--rewrite', '--skills-dir', '--source', '--split', '--status', '--target-model', '--target-models'],diff --git a/src/core/error-registry.ts b/src/core/error-registry.tsindex 8bdccd011e..4ce590ef93 100644--- a/src/core/error-registry.ts+++ b/src/core/error-registry.ts@@ -722,7 +722,7 @@ export const CODES = {setup_harness_unsupported: { class: 'caller', summary: "gbrain setup does not wire this harness yet; its guide has the manual connection steps.", why: 'Only harnesses with a supported row in the setup capability table are wired automatically, so setup never guesses another host\'s config format.', docs: 'docs/guides/repair.md#setup-harness-unsupported', exit: 2, fix: { argv: ['gbrain', 'setup', '--help'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Lists the harnesses setup wires and the guide for each.' } },setup_hosted_connection: { class: 'caller', summary: "This machine already reaches a hosted brain, so gbrain setup will not create a second, local brain.", why: 'A new local brain would split memory: sessions would read and write the empty local brain while useful memory stays on the hosted one.', docs: 'docs/guides/repair.md#setup-hosted-connection', fix: { argv: ['gbrain', 'doctor', '--only', 'harness_wiring', '--json'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Shows which brain the harness registration reaches.' } },setup_owner_conflict: { class: 'caller', summary: "Another owner holds what gbrain setup would change: a live server owns this PGLite brain, or the harness configuration holds an entry setup did not write.", why: 'A PGLite brain has one writer, so a second server would fail on its lock; an entry setup did not record by hash is the user\'s or another install\'s and is never overwritten.', reasons: ['live_serve', 'unowned_entry', 'other_install', 'harness_lane'], docs: 'docs/guides/repair.md#setup-owner-conflict', fix: { argv: ['gbrain', 'setup', 'claude-code', '--dry-run', '--json'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Shows the resolved target and which owner blocks it, without writing anything.' } },- setup_serves_several: { class: 'caller', summary: 'gbrain setup for one person was run on a brain that serves several people, and config mcp.stdio_member binds no stdio connection there, so setup wrote nothing.', why: 'On a brain that serves several people an unbound connection reads every page no rule restricts, for whoever is asking; setup never writes one.', suggestion: 'Run gbrain setup <harness> --serves several --members <id,...> to label each person; add --stdio-member <member> only for a harness that one person alone uses.', fix: { argv: ['gbrain', 'access', 'serves', '--json'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Read-only: shows why the brain counts as several people, its members, its owner and the member the stdio server reads as.' } },+ setup_serves_several: { class: 'caller', summary: 'gbrain setup for one person was run on a brain that serves several people, and neither this harness\'s entry (--stdio-member) nor config mcp.stdio_member binds its stdio connection, so setup wrote nothing.', why: 'On a brain that serves several people an unbound connection reads every page no rule restricts, for whoever is asking; setup never writes one.', suggestion: 'Run gbrain setup <harness> --serves several --members <id,...> to label each person; add --stdio-member <member> only for a harness that one person alone uses.', fix: { argv: ['gbrain', 'access', 'serves', '--json'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Read-only: shows why the brain counts as several people, its members, its owner and the member the stdio server reads as.' } },setup_serves_unreadable: { class: 'caller', summary: 'gbrain setup could not read whether the existing brain serves several people, so it wrote nothing.', why: 'Setup writes an unbound connection only on a brain it knows serves one person; a brain it cannot read might serve several.', suggestion: 'Run gbrain access serves --json to see why the brain cannot be read, fix that, then run setup again.', fix: { argv: ['gbrain', 'access', 'serves', '--json'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Read-only: shows whom the brain serves, or the error that stops setup reading it.' } },hook_session_cwd: { class: 'caller', summary: "A gbrain hook or stdio MCP entry (setup, the turn-rule lane, gbrain bootstrap's lanes) starts gbrain in the session's directory, or the hook launcher it names would not run.", why: 'Script-mode gbrain is a Bun script, and Bun runs the working directory\'s bunfig.toml preload and loads its .env before gbrain starts; harnesses run hooks and stdio MCP servers in the session directory, so a cloned repository could run code on every prompt or session.', reasons: ['session_cwd', 'missing', 'stale', 'foreign'], docs: 'docs/guides/repair.md#hook-session-cwd', fix: { argv: ['gbrain', 'doctor', '--only', 'harness_wiring', '--json'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Names the hook and the setup command that rewrites it through the launcher.' } },turn_hook_not_loaded: { class: 'caller', summary: "The per-turn hook that puts \"check gbrain first\" next to every user turn is missing, untrusted, or does not load in the harness.", why: 'Agents use the brain when that rule reaches them on every turn; registering the MCP server or writing an instruction file alone leaves them answering without it.', reasons: ['missing', 'untrusted', 'hook_failed', 'no_rule', 'not_loaded'], docs: 'docs/guides/repair.md#turn-hook-not-loaded', fix: { argv: ['gbrain', 'doctor', '--only', 'harness_wiring', '--json'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Shows which harness has no working per-turn hook and the command that wires it.' } },diff --git a/src/core/mcp-registration.ts b/src/core/mcp-registration.tsindex 1812bb2c99..bf675c5c31 100644--- a/src/core/mcp-registration.ts+++ b/src/core/mcp-registration.ts@@ -11,6 +11,7 @@import { shellQuote } from './shell-quote.ts';import type { McpSurface } from '../mcp/surface.ts';+import { STDIO_MEMBER_FLAG } from './stdio-member-flag.ts';export { shellQuote };@@ -58,9 +59,10 @@ const SURFACE_ORDER: readonly McpSurface[] = ['verbs', 'starter', 'full'];* existing bare registration bare when it replaces it. `--advertise` is* written only when it is narrower than the surface.*/-export function stdioServeArgv(bin: string, surface: McpSurface | null = REGISTRATION_SURFACE, advertise: McpSurface | null = null): string[] {- if (!surface) return [bin, 'serve'];- return [bin, 'serve', '--surface', surface, ...(advertise && SURFACE_ORDER.indexOf(advertise) < SURFACE_ORDER.indexOf(surface) ? ['--advertise', advertise] : [])];+export function stdioServeArgv(bin: string, surface: McpSurface | null = REGISTRATION_SURFACE, advertise: McpSurface | null = null, stdioMember?: string): string[] {+ const member = stdioMember !== undefined ? [STDIO_MEMBER_FLAG, stdioMember] : [];+ if (!surface) return [bin, 'serve', ...member];+ return [bin, 'serve', '--surface', surface, ...(advertise && SURFACE_ORDER.indexOf(advertise) < SURFACE_ORDER.indexOf(surface) ? ['--advertise', advertise] : []), ...member];}/**diff --git a/src/core/ops/contract.ts b/src/core/ops/contract.tsindex 1772dfdcb8..0350004b7c 100644--- a/src/core/ops/contract.ts+++ b/src/core/ops/contract.ts@@ -559,6 +559,12 @@ export interface OperationContext {applyRemoteReadPolicy?: boolean;/** The stdio session's surface (stdio MCP only): `request_tools` widens it for this session, `whoami` reports it. */stdioSurface?: StdioSurfaceState;+ /**+ * GST-363: the member this stdio server was started with (`gbrain serve --stdio-member <id>`, written into one+ * harness's own MCP entry). Set only by the stdio server from its process argv, never from a request; it wins over+ * config mcp.stdio_member, and a named member that is not enabled reads as nobody.+ */+ stdioMember?: string;/*** Set by transports that can widen a session's listed tools (stdio): when* `request_tools` returns schemas, the named tools join this session'sdiff --git a/src/core/ops/sources.ts b/src/core/ops/sources.tsindex a64a04d676..c652815cad 100644--- a/src/core/ops/sources.ts+++ b/src/core/ops/sources.ts@@ -70,7 +70,7 @@ const whoami: Operation = {if (verified.remote) scopes = verified.grant.scopes;} catch { /* no registration: no scopes */ }const session = ctx.stdioSurface;- return { transport: 'stdio', scopes, ...(session ? { surface: session.surface, surface_source: session.source } : {}), access: await withApplied(await stdioAccessView(ctx.engine)), readiness: readiness('stdio') };+ return { transport: 'stdio', scopes, ...(session ? { surface: session.surface, surface_source: session.source } : {}), access: await withApplied(await stdioAccessView(ctx.engine, ctx.stdioMember)), readiness: readiness('stdio') };}if (!ctx.auth) {throw opError(diff --git a/src/core/ops/wakeshift.ts b/src/core/ops/wakeshift.tsindex b406171f75..8bae7d023e 100644--- a/src/core/ops/wakeshift.ts+++ b/src/core/ops/wakeshift.ts@@ -16,7 +16,7 @@ import { memberIdentityFor } from '../access/caller.ts';import { WakeshiftError, type WakeshiftCall } from '../wakeshift/client.ts';import { wakeshiftBrainKey, wakeshiftRuntime, wakeshiftSecret, wakeshiftUserId } from '../wakeshift/config.ts';import { JOB_FINISHED } from '../wakeshift/events.ts';-import { drainWakes, endAtWakeshift, liveAccessMembers } from '../wakeshift/drain.ts';+import { drainWakes, endAtWakeshift, liveAccessMembers, STDIO_REGISTRATION_PRINCIPAL } from '../wakeshift/drain.ts';const WATCH_TTL = '7d';const TERMINAL = new Set(['completed', 'failed', 'dead', 'cancelled']);@@ -41,13 +41,17 @@ function notEnabled(): OperationError {export interface WatchPrincipal { kind: 'oauth_client' | 'legacy_token' | 'local_stdio'; id: string; member: string | null }-/** Who is watching: the verified credential (bound member when it has one), else the local stdio pipe. */+/**+ * Who is watching: the verified credential (bound member when it has one), else the local stdio pipe. A stdio server+ * started with --stdio-member watches as principal id 'registration', so the drain re-checks that member, never config.+ */export async function watchPrincipal(ctx: OperationContext): Promise<WatchPrincipal | null> {+ const registered = !ctx.auth && ctx.transport === 'stdio' ? ctx.stdioMember : undefined;const base = ctx.auth? (ctx.auth.principal ?? (ctx.auth.clientId ? { kind: 'oauth_client' as const, id: ctx.auth.clientId } : null))- : ctx.transport === 'stdio' ? { kind: 'local_stdio' as const, id: 'local' } : null;+ : ctx.transport === 'stdio' ? { kind: 'local_stdio' as const, id: registered !== undefined ? STDIO_REGISTRATION_PRINCIPAL : 'local' } : null;if (!base) return null;- const identity = await memberIdentityFor(ctx.engine, { ...(ctx.auth ? { member: ctx.auth.member } : {}), principal: base });+ const identity = await memberIdentityFor(ctx.engine, { ...(ctx.auth ? { member: ctx.auth.member } : {}), principal: base, ...(registered !== undefined ? { stdioMember: registered } : {}) });return { ...base, member: identity.find(i => i.startsWith('member:'))?.slice('member:'.length) ?? null };}diff --git a/src/core/persistence/authority.ts b/src/core/persistence/authority.tsindex 705784adc8..be8a2df9e8 100644--- a/src/core/persistence/authority.ts+++ b/src/core/persistence/authority.ts@@ -70,6 +70,9 @@ export async function submissionAuthority(ctx: OperationContext, operation: stri// GBRA-231: a channel audience (anything but one member) never relaxes privacy, so its ceiling hides private pages.excludePrivate: (actingFor !== undefined && currentCallerAccess().hidePrivate) || await excludesPrivateWritesAtAdmission(ctx.engine, ctx.remote !== false),...(actingFor ? { actingFor } : {}),+ // GST-363: a stdio server started with --stdio-member stamps that member, so preparation and publication re-resolve+ // the same member (live) instead of whatever config mcp.stdio_member names then.+ ...(principal.kind === 'local_stdio' && ctx.stdioMember !== undefined ? { stdioMember: ctx.stdioMember } : {}),...(access?.actor && ctx.attestedOp ? { attestedOp: ctx.attestedOp } : {}),...(perCallWriteSource(ctx, sourceId, slug) ? { attestedSource: sourceId } : {}),autoLinkTrusted: ctx.remote === false || ctx.viaSubagent === true && !ctx.auth && !!ctx.allowedSlugPrefixes?.length,diff --git a/src/core/persistence/model.ts b/src/core/persistence/model.tsindex 45e938d87a..a8f7e70c19 100644--- a/src/core/persistence/model.ts+++ b/src/core/persistence/model.ts@@ -22,6 +22,11 @@ export interface WriteAuthority {* link from the id to the same enabled member, so an unlink, a disabled member or a revoked right refuses it.*/actingFor?: string[] | { system: string; external_id: string; member: string };+ /**+ * GST-363: the member a local_stdio writer's serve was started with (`gbrain serve --stdio-member`). Preparation and+ * publication re-resolve it live (a disabled member reads as nobody); absent, they read config mcp.stdio_member.+ */+ stdioMember?: string;/** GST-359 D: the attested operation this write serves when it differs from the stored one (memory_write as remember). */attestedOp?: string;/** GST-1113: the scope source an attested memory_write named instead of the principal's own; publication re-checks attest_sources. */diff --git a/src/core/setup/claude-code.ts b/src/core/setup/claude-code.tsindex 8e7c280eb4..31e6d05f19 100644--- a/src/core/setup/claude-code.ts+++ b/src/core/setup/claude-code.ts@@ -37,6 +37,7 @@ import {type ClaudeHookEvent,} from '../bootstrap/host-specs.ts';import { stdioServeArgv } from '../mcp-registration.ts';+import { withStdioMember } from '../stdio-member-flag.ts';import { isTurnRuleEntry } from './turn-hook.ts';import { isSkillResolverEntry } from './skill-resolver-lane.ts';import { ensureHookLauncher, hookLauncherPath } from './hook-launcher.ts';@@ -98,6 +99,8 @@ export interface ClaudeSetupPlan {/** `serve --advertise`; null lists the whole surface. */advertise: McpSurface | null;events: ClaudeHookEvent[];+ /** GST-363: `serve --stdio-member`: this entry's sessions read as that member. Only a named --stdio-member or the entry setup already wrote sets it. */+ stdioMember?: string;}export interface SetupStep { step: 'brain' | 'receipt' | 'mcp' | 'hooks'; action: 'write' | 'keep' | 'skip' | 'remove' | 'preserve'; detail: string }@@ -109,7 +112,8 @@ export interface ClaudeInspection {prior: ClaudeSetupReceipt | null;/** A hosted `gbrain connect --install` receipt sits at this name. */hostedReceipt: { mcp_url?: string } | null;- mcp: { state: 'absent' | 'current' | 'owned' | 'remote' | 'unowned'; url?: string };+ /** stdioMember: the --stdio-member of an entry setup owns (current or owned), which a rewrite carries forward. */+ mcp: { state: 'absent' | 'current' | 'owned' | 'remote' | 'unowned'; url?: string; stdioMember?: string };/** Events wired by another gbrain lane in this settings file. */otherLaneEvents: string[];/** Owned events whose entry the user edited: preserved, never rewritten. */@@ -181,7 +185,7 @@ export function desiredMcpEntry(plan: ClaudeSetupPlan): Record<string, unknown>if (plan.gbrainHomeEnv) env.GBRAIN_HOME = plan.gbrainHomeEnv;if (plan.sourceId) env.GBRAIN_SOURCE = plan.sourceId;// The harness starts stdio servers in the session's directory, so serve starts through the launcher too (#8426).- return { type: 'stdio', command: hookLauncherPath(plan.brainHome), args: stdioServeArgv(plan.launcher, plan.surface, plan.advertise), env };+ return { type: 'stdio', command: hookLauncherPath(plan.brainHome), args: stdioServeArgv(plan.launcher, plan.surface, plan.advertise, plan.stdioMember), env };}export function desiredHookHashes(plan: ClaudeSetupPlan): HookHashes {@@ -232,9 +236,9 @@ export function inspectClaudeSetup(plan: ClaudeSetupPlan): ClaudeInspection {const entry = servers?.[plan.name];const desired = entryHash(desiredMcpEntry(plan));const mcp: ClaudeInspection['mcp'] = entry === undefined ? { state: 'absent' }- : entryHash(entry) === desired ? { state: 'current' }+ : entryHash(entry) === desired ? withStdioMember({ state: 'current' }, entry): typeof (entry as Record<string, unknown>)?.url === 'string' ? { state: 'remote', url: (entry as Record<string, string>).url }- : prior && [prior.entry_hash, prior.pending_entry_hash].includes(entryHash(entry)) ? { state: 'owned' } : { state: 'unowned' };+ : prior && [prior.entry_hash, prior.pending_entry_hash].includes(entryHash(entry)) ? withStdioMember({ state: 'owned' }, entry) : { state: 'unowned' };const census = hookCensus(paths.settingsPath);const want = desiredHookHashes(plan);diff --git a/src/core/setup/codex.ts b/src/core/setup/codex.tsindex fc462fed6a..77486c7a99 100644--- a/src/core/setup/codex.ts+++ b/src/core/setup/codex.ts@@ -49,6 +49,7 @@ import {type CodexSetupEvent,} from '../bootstrap/codex-hooks.ts';import { stdioServeArgv } from '../mcp-registration.ts';+import { withStdioMember } from '../stdio-member-flag.ts';import type { McpSurface } from '../../mcp/surface.ts';import { SetupAbortInjected, type SetupConsent, type SetupStep } from './claude-code.ts';import { ensureHookLauncher, hookLauncherPath } from './hook-launcher.ts';@@ -97,6 +98,8 @@ export interface CodexSetupPlan {/** `serve --advertise`; null lists the whole surface. */advertise: McpSurface | null;events: CodexSetupEvent[];+ /** GST-363: `serve --stdio-member`: this entry's sessions read as that member. Only a named --stdio-member or the entry setup already wrote sets it. */+ stdioMember?: string;}export type CodexSetupStep = Omit<SetupStep, 'step'> & { step: SetupStep['step'] | 'trust' };@@ -108,7 +111,8 @@ export interface CodexInspection {receiptPath: string;prior: CodexSetupReceipt | null;hostedReceipt: { mcp_url?: string } | null;- mcp: { state: 'absent' | 'current' | 'owned' | 'remote' | 'unowned'; url?: string };+ /** stdioMember: the --stdio-member of an entry setup owns (current or owned), which a rewrite carries forward. */+ mcp: { state: 'absent' | 'current' | 'owned' | 'remote' | 'unowned'; url?: string; stdioMember?: string };/** Events already wired by gbrain's bootstrap Codex lane (token-owned). */otherLaneEvents: string[];/** Owned events whose group the user edited: preserved, never rewritten. */@@ -136,12 +140,12 @@ export function readCodexSetupReceipt(receiptPath: string): { setup: CodexSetupRconst writeReceipt = (path: string, receipt: CodexSetupReceipt) => atomicWriteTextFile(path, `${JSON.stringify(receipt, null, 2)}\n`, { forceMode: 0o600 });-export function desiredCodexMcpEntry(plan: Pick<CodexSetupPlan, 'launcher' | 'brainHome' | 'surface' | 'advertise' | 'gbrainHomeEnv' | 'sourceId'>): Record<string, CodexTomlValue> {+export function desiredCodexMcpEntry(plan: Pick<CodexSetupPlan, 'launcher' | 'brainHome' | 'surface' | 'advertise' | 'gbrainHomeEnv' | 'sourceId' | 'stdioMember'>): Record<string, CodexTomlValue> {const env: Record<string, string> = {};if (plan.gbrainHomeEnv) env.GBRAIN_HOME = plan.gbrainHomeEnv;if (plan.sourceId) env.GBRAIN_SOURCE = plan.sourceId;// Codex starts stdio servers in the session's directory, so serve starts through the launcher too (#8426).- return { command: hookLauncherPath(plan.brainHome), args: stdioServeArgv(plan.launcher, plan.surface, plan.advertise), ...(Object.keys(env).length ? { env } : {}) };+ return { command: hookLauncherPath(plan.brainHome), args: stdioServeArgv(plan.launcher, plan.surface, plan.advertise, plan.stdioMember), ...(Object.keys(env).length ? { env } : {}) };}function desiredGroups(plan: CodexSetupPlan): Partial<Record<CodexSetupEvent, CodexHookGroup>> {@@ -180,9 +184,9 @@ export function inspectCodexSetup(plan: CodexSetupPlan): CodexInspection {const desired = ownedEntryFingerprint(desiredCodexMcpEntry(plan));const entryFp = entry === undefined ? null : ownedEntryFingerprint(entry);const mcp: CodexInspection['mcp'] = entry === undefined ? { state: 'absent' }- : entryFp === desired ? { state: 'current' }+ : entryFp === desired ? withStdioMember({ state: 'current' }, entry): typeof (entry as Record<string, unknown>)?.url === 'string' ? { state: 'remote', url: (entry as Record<string, string>).url }- : prior && [prior.entry_hash, prior.pending_entry_hash].includes(entryFp) ? { state: 'owned' } : { state: 'unowned' };+ : prior && [prior.entry_hash, prior.pending_entry_hash].includes(entryFp) ? withStdioMember({ state: 'owned' }, entry) : { state: 'unowned' };const census = codexHookCensus(paths.hooksPath);const groups = desiredGroups(plan);diff --git a/src/core/setup/hook-launcher-refresh.ts b/src/core/setup/hook-launcher-refresh.tsindex d56e5e4bac..881d43242e 100644--- a/src/core/setup/hook-launcher-refresh.ts+++ b/src/core/setup/hook-launcher-refresh.ts@@ -76,8 +76,11 @@ async function refreshSetup(log: (line: string) => void): Promise<void> {// Another install's hooks or MCP entry can share these files, so the home comes only from entries this receipt owns.const homeEnv = claudeHookEntries(paths.settingsPath).filter((e) => owned.has(hookEntryHash(e) ?? '')).map((e) => parseClaudeHookCommand(e.command as string)?.env.GBRAIN_HOME).find((h) => h !== undefined)?? (receipt.mcp_plugin ? undefined : claudeMcpHome(paths.configPath, receipt.name, receipt.project_dir, [receipt.entry_hash, receipt.pending_entry_hash]));- const plan: ClaudeSetupPlan = { name: receipt.name, scope: receipt.scope, ...(receipt.project_dir ? { projectDir: receipt.project_dir } : {}), launcher: receipt.launcher, brainHome: receipt.gbrain_home, ...(homeEnv ? { gbrainHomeEnv: homeEnv } : {}),+ const recorded: ClaudeSetupPlan = { name: receipt.name, scope: receipt.scope, ...(receipt.project_dir ? { projectDir: receipt.project_dir } : {}), launcher: receipt.launcher, brainHome: receipt.gbrain_home, ...(homeEnv ? { gbrainHomeEnv: homeEnv } : {}),sourceId: receipt.source_id, surface: receipt.surface, advertise: receipt.advertise ?? null, events: Object.keys({ ...receipt.hooks.owned, ...receipt.hooks.pending }) as ClaudeHookEvent[] };+ // GST-363: the rewrite carries the entry's own --stdio-member forward and never adds one.+ const carried = receipt.mcp_plugin ? undefined : inspectClaudeSetup(recorded).mcp.stdioMember;+ const plan: ClaudeSetupPlan = carried ? { ...recorded, stdioMember: carried } : recorded;// An MCP entry still exactly what setup last wrote predates the launcher (#8426): setup's own rewrite moves it.const mcp = receipt.mcp_plugin ? 'plugin' : inspectClaudeSetup(plan).mcp.state;if (!ours.some(needsLauncher) && mcp !== 'owned') continue;diff --git a/src/core/stdio-member-flag.ts b/src/core/stdio-member-flag.tsnew file mode 100644index 0000000000..678b33bfa5--- /dev/null+++ b/src/core/stdio-member-flag.ts@@ -0,0 +1,38 @@+/** GST-363: `gbrain serve --stdio-member <id>`, parsed and read back from a harness entry. Kept apart from mcp-registration.ts so serve and doctor import only this flag. */+import { ACCESS_ID_RE } from './access/principals.ts';++/**+ * GST-363: `serve --stdio-member <id>` binds one stdio server (the one harness entry that starts it) to one member.+ * It lives in that harness's own MCP entry, so it binds only that harness on this machine, on PGLite and Postgres+ * alike; config mcp.stdio_member, set by hand, is the brain-wide fallback for a serve started without it.+ */+export const STDIO_MEMBER_FLAG = '--stdio-member';++/** serve's --stdio-member value (either form), undefined when absent; a missing, repeated or ill-formed value throws. */+export function parseStdioMemberFlag(args: readonly string[]): string | undefined {+ const values: Array<string | undefined> = [];+ args.forEach((a, i) => {+ if (a === STDIO_MEMBER_FLAG) values.push(args[i + 1]);+ else if (a.startsWith(`${STDIO_MEMBER_FLAG}=`)) values.push(a.slice(STDIO_MEMBER_FLAG.length + 1));+ });+ if (values.length === 0) return undefined;+ if (values.length > 1) throw new Error(`${STDIO_MEMBER_FLAG} was given ${values.length} times; pass one member id.`);+ const id = values[0];+ if (id === undefined || !ACCESS_ID_RE.test(id)) {+ throw new Error(`${STDIO_MEMBER_FLAG} needs a member id (lowercase letters, digits, '.', '_' or '-'; gbrain access member list names them). Got: ${id === undefined ? '(missing value)' : JSON.stringify(id)}`);+ }+ return id;+}++/** The member a registered serve entry's args bind (--stdio-member), or undefined when it binds none or names it ill-formed. */+export function registeredStdioMember(entry: unknown): string | undefined {+ const args = entry && typeof entry === 'object' && Array.isArray((entry as { args?: unknown }).args) ? (entry as { args: unknown[] }).args : null;+ if (!args || !args.includes('serve') || !args.every((a): a is string => typeof a === 'string')) return undefined;+ try { return parseStdioMemberFlag(args); } catch { return undefined; }+}++/** An owned entry's inspection with the member its args bind, so a rewrite carries it forward. */+export function withStdioMember<T extends { state: string }>(mcp: T, entry: unknown): T & { stdioMember?: string } {+ const stdioMember = registeredStdioMember(entry);+ return stdioMember === undefined ? mcp : { ...mcp, stdioMember };+}diff --git a/src/core/wakeshift/drain.ts b/src/core/wakeshift/drain.tsindex a3ae2fc23c..e2073dde29 100644--- a/src/core/wakeshift/drain.ts+++ b/src/core/wakeshift/drain.ts@@ -101,6 +101,9 @@ function retryDelayS(attempts: number, err?: WakeshiftError): number {return WAKE_RETRY_SCHEDULE_S[attempts - 1] ?? cap;}+/** GST-363: the local_stdio principal id of a watch from a stdio server started with --stdio-member. */+export const STDIO_REGISTRATION_PRINCIPAL = 'registration';+/** The subscribing credential still exists and, when it was bound to a member, that member is still live. */export async function principalLive(engine: BrainEngine, row: Pick<WakeRow, 'principal_kind' | 'principal_id' | 'member_id'>): Promise<boolean> {if (row.principal_kind === 'oauth_client') {@@ -111,7 +114,9 @@ export async function principalLive(engine: BrainEngine, row: Pick<WakeRow, 'priif (live.length === 0) return false;}if (!row.member_id) return true;- const identity = await memberIdentityFor(engine, { principal: { kind: row.principal_kind, id: row.principal_id } });+ // GST-363: a watch from a stdio server started with --stdio-member re-checks that member, not config mcp.stdio_member.+ const registered = row.principal_kind === 'local_stdio' && row.principal_id === STDIO_REGISTRATION_PRINCIPAL;+ const identity = await memberIdentityFor(engine, { principal: { kind: row.principal_kind, id: row.principal_id }, ...(registered ? { stdioMember: row.member_id } : {}) });return identity.includes(`member:${row.member_id}`);}diff --git a/src/mcp/dispatch.ts b/src/mcp/dispatch.tsindex 84bfba7fe0..7694f3bfd9 100644--- a/src/mcp/dispatch.ts+++ b/src/mcp/dispatch.ts@@ -307,6 +307,8 @@ export interface DispatchOpts {surfaceCeiling?: 'verbs' | 'starter' | 'full';/** The stdio session surface (OperationContext.stdioSurface); its allow-set is the one `allowedOps` mirrors. */stdioSurface?: OperationContext['stdioSurface'];+ /** GST-363: OperationContext.stdioMember, from the stdio server's own argv (serve --stdio-member); no other transport sets it. */+ stdioMember?: string;/** Threaded into OperationContext.revealTools (stdio session tool reveal). */revealTools?: (names: string[]) => void;/**@@ -949,6 +951,7 @@ export function buildOperationContext(...(opts.explicitReadBinding ? { explicitReadBinding: opts.explicitReadBinding } : {}),...(opts.surfaceCeiling ? { surfaceCeiling: opts.surfaceCeiling } : {}),...(opts.stdioSurface ? { stdioSurface: opts.stdioSurface } : {}),+ ...(opts.stdioMember !== undefined && opts.transport === 'stdio' && !opts.auth ? { stdioMember: opts.stdioMember } : {}),...(opts.revealTools ? { revealTools: opts.revealTools } : {}),...(opts.writeWaitMs !== undefined ? { writeWaitMs: opts.writeWaitMs } : {}),...(opts.admissionOrigin ? { admissionOrigin: opts.admissionOrigin } : {}),@@ -1005,7 +1008,7 @@ export async function dispatchToolCall(audience = parseAudience(opts.onBehalfOf);attested = await resolveAttestedActor(engine, { channels: opts.actor, params: args, op: name, opShape: op,auth: opts.auth, transport: opts.transport, audienceAsserted: audience !== null });- access = attested?.access ?? await remoteCallerAccess(engine, opts.auth, privateSources, opts.transport, audience);+ access = attested?.access ?? await remoteCallerAccess(engine, opts.auth, privateSources, opts.transport, audience, opts.transport === 'stdio' && !opts.auth ? opts.stdioMember : undefined);} catch (e) {// GST-359: a call that names a person gets every failure here (a lock timeout reading its link included) in the// envelope QM reads, never a thrown call; anything else keeps the caller's own error path.diff --git a/src/mcp/server.ts b/src/mcp/server.tsindex aa0221010b..5c19d020e8 100644--- a/src/mcp/server.ts+++ b/src/mcp/server.ts@@ -329,7 +329,7 @@ function stdioSurfaceSession(*/const READ_ONLY_SERVE_NOTE = '[gbrain-serve] read-only: no persistence consumer, on-commit sync or sweep runs here; a read-write serve, jobs work or autopilot owns them.\n';-export async function startMcpServer(engine: BrainEngine, opts: { surface?: McpSurface; surfaceSource?: SurfaceSource; invalidSurfaceEnv?: string; sourceGuard?: boolean; onBootPhase?: (phase: string) => void; access?: McpAccess; advertise?: McpSurface } = {}) {+export async function startMcpServer(engine: BrainEngine, opts: { surface?: McpSurface; surfaceSource?: SurfaceSource; invalidSurfaceEnv?: string; sourceGuard?: boolean; onBootPhase?: (phase: string) => void; access?: McpAccess; advertise?: McpSurface; stdioMember?: string } = {}) {const config = loadConfig();const bootPhase = (phase: string) => { try { opts.onBootPhase?.(phase); } catch { /* diagnostic only */ } };// Refuse to serve a well-formed GBRAIN_SOURCE that no active source row@@ -417,7 +417,7 @@ export async function startMcpServer(engine: BrainEngine, opts: { surface?: McpS}, bootGatedReads(createSkillResources(engine, async () => {const scope = await resolveMcpStdioSourceScope(engine);return { remote: true, transport: 'stdio', sourceId: scope.sourceId,- localFederatedSourceIds: scope.localFederatedSourceIds, allowedOps: session.allowedOps, surface: session.surface, config: config ?? undefined };+ localFederatedSourceIds: scope.localFederatedSourceIds, allowedOps: session.allowedOps, surface: session.surface, config: config ?? undefined, ...(opts.stdioMember !== undefined ? { stdioMember: opts.stdioMember } : {}) };}), gate.awaitBoot));// FILE config plane only — stdio has no per-request list cycle, so a@@ -507,7 +507,7 @@ export async function startMcpServer(engine: BrainEngine, opts: { surface?: McpS// --source-guard (plugin lanes): thread the winning resolution tier so// dispatch can fail-close ambient-tier writes. Off (undefined) unless// the serve was started with the flag.- ...(opts.sourceGuard ? { sourceGuardTier: sourceScope.tier } : {}),+ ...(opts.sourceGuard ? { sourceGuardTier: sourceScope.tier } : {}), ...(opts.stdioMember !== undefined ? { stdioMember: opts.stdioMember } : {}),// v0.31 (eD3): _meta.brain_hot_memory injection so Claude Desktop /// Code see the brain's relevant hot memory automatically alongside// every tool-call response. Best-effort; absorbs errors.diff --git a/test/access-binding.test.ts b/test/access-binding.test.tsindex 55b78a91f0..dd92e1ad76 100644--- a/test/access-binding.test.ts+++ b/test/access-binding.test.ts@@ -34,6 +34,8 @@ import { __resetPrivateVisibilityCacheForTests } from '../src/core/search/privatimport { memberIdentityFor, STDIO_MEMBER_KEY } from '../src/core/access/caller.ts';import { addGroup, addMember, bindCredential, disableMember, enableMember, removeMember } from '../src/core/access/members.ts';import type { AuthInfo } from '../src/core/ops/contract.ts';+import { watchPrincipal } from '../src/core/ops/wakeshift.ts';+import { principalLive, STDIO_REGISTRATION_PRINCIPAL } from '../src/core/wakeshift/drain.ts';import { testBackends } from './helpers/test-backends.ts';import { isolatedPersistencePostgres } from './helpers/persistence-postgres.ts';@@ -182,6 +184,43 @@ for (const kind of testBackends()) {expect(await stdioGet(ALICE_SLUG)).not.toContain(CANARY);});+ test('GST-363: serve --stdio-member binds only that server; it wins over config, a disabled member reads as nobody with no config fallback, and nothing a caller sends binds it', async () => {+ const get = async (opts: Record<string, unknown>, args: Record<string, unknown> = {}) =>+ (await dispatchToolCall(engine, 'get_page', { slug: ALICE_SLUG, ...args }, { remote: true, transport: 'stdio', sourceId: SRC, takesHoldersAllowList: ['world'], ...opts })).content.map(c => c.text).join('\n');+ const who = async (opts: Record<string, unknown>) => JSON.parse((await dispatchToolCall(engine, 'whoami', {}, { remote: true, transport: 'stdio', sourceId: SRC, ...opts })).content[0]!.text).access;+ expect(await get({ stdioMember: 'alice-example' })).toContain(CANARY);+ expect(await get({})).not.toContain(CANARY);+ expect(await who({ stdioMember: 'alice-example' })).toMatchObject({ member: 'alice-example', groups: ['team-a'], bound_by: 'stdio_registration' });+ expect(await who({})).toMatchObject({ member: null, bound_by: 'none' });+ for (const args of [{ stdio_member: 'alice-example' }, { _meta: { stdio_member: 'alice-example' } }]) expect(await get({}, args)).not.toContain(CANARY);+ expect(await get({ transport: 'http', stdioMember: 'alice-example' })).not.toContain(CANARY);+ expect(await get({ auth: await verify(tokens.unbound!.token), stdioMember: 'alice-example' })).not.toContain(CANARY);+ await engine.setConfig(STDIO_MEMBER_KEY, 'alice-example');+ try {+ expect(await get({ stdioMember: 'bob-example' })).not.toContain(CANARY);+ const bob = await who({ stdioMember: 'bob-example' });+ expect(bob).toMatchObject({ member: 'bob-example', bound_by: 'stdio_registration' });+ expect(bob.note).toContain('its own --stdio-member wins');+ await disableMember(engine, 'bob-example');+ try {+ expect(await get({ stdioMember: 'bob-example' })).not.toContain(CANARY);+ const disabled = await who({ stdioMember: 'bob-example' });+ expect(disabled).toMatchObject({ member: null, bound_by: 'none' });+ expect(disabled.note).toContain('not an enabled member');+ expect(await memberIdentityFor(engine, { principal: { kind: 'local_stdio', id: 'registration' }, stdioMember: 'bob-example' })).toEqual([]);+ expect(await get({ stdioMember: 'ghost-example' })).not.toContain(CANARY);+ } finally { await enableMember(engine, 'bob-example'); }+ } finally { await engine.setConfig(STDIO_MEMBER_KEY, ''); }+ expect(await memberIdentityFor(engine, { principal: { kind: 'local_stdio', id: 'registration' }, stdioMember: 'alice-example' })).toContain('member:alice-example');+ const watch = await watchPrincipal({ engine, transport: 'stdio', remote: true, stdioMember: 'alice-example' } as never);+ expect(watch).toEqual({ kind: 'local_stdio', id: STDIO_REGISTRATION_PRINCIPAL, member: 'alice-example' });+ expect(await watchPrincipal({ engine, transport: 'stdio', remote: true } as never)).toEqual({ kind: 'local_stdio', id: 'local', member: null });+ const row = { principal_kind: 'local_stdio' as const, principal_id: STDIO_REGISTRATION_PRINCIPAL, member_id: 'alice-example' };+ expect(await principalLive(engine, row)).toBe(true);+ await disableMember(engine, 'alice-example');+ try { expect(await principalLive(engine, row)).toBe(false); } finally { await enableMember(engine, 'alice-example'); }+ });+test('whoami and grant_diagnosis over a legacy token report member, groups and may_act_for', async () => {const auth = await verify(tokens.alice!.token);const out = await dispatchToolCall(engine, 'whoami', {}, { remote: true, transport: 'http', auth, sourceId: SRC });diff --git a/test/access-writes.test.ts b/test/access-writes.test.tsindex 338f86a571..d69ac279f8 100644--- a/test/access-writes.test.ts+++ b/test/access-writes.test.ts@@ -327,6 +327,30 @@ for (const kind of testBackends()) {expect({ code: after.json.code }).toEqual({ code: 'page_not_found' });}, 240_000);+ test('GST-363: a stdio server started with --stdio-member writes as that member, ahead of config, and stamps it on the stored write', async () => {+ const call = async (op: string, params: Record<string, unknown>, stdioMember?: string) => {+ const out = await dispatchToolCall(engine, op, { ...params }, { remote: true, transport: 'stdio', sourceId: SRC, takesHoldersAllowList: ['world'], ...(stdioMember ? { stdioMember } : {}) });+ const text = out.content.map(c => c.text).join('\n');+ let json: Record<string, unknown> = {};+ try { json = JSON.parse(text); } catch { /* prose */ }+ return { isError: out.isError === true, json };+ };+ await engine.setConfig(STDIO_MEMBER_KEY, 'bob-example');+ try {+ expect((await call('append_page', { slug: ALICE_PAGE, text: 'Config bob cannot.', request_id: randomUUID() })).json.code).toBe('page_not_found');+ const requestId = randomUUID();+ const appended = await call('append_page', { slug: ALICE_PAGE, text: 'Registered alice wrote this.', request_id: requestId }, 'alice-example');+ expect({ isError: appended.isError, code: appended.json.code }).toEqual({ isError: false, code: undefined });+ const rows = await engine.executeRaw<{ member: string | null }>("SELECT authority->>'stdioMember' AS member FROM persistence_requests WHERE slug = $1 AND authority->>'stdioMember' IS NOT NULL", [ALICE_PAGE]);+ expect(rows.map(r => r.member)).toContain('alice-example');+ expect((await call('get_write_request', { request_id: requestId }, 'alice-example')).isError).toBe(false);+ expect((await call('get_write_request', { request_id: requestId }, 'bob-example')).isError).toBe(true);+ expect((await call('get_write_request', { request_id: requestId })).isError).toBe(true);+ } finally {+ await engine.setConfig(STDIO_MEMBER_KEY, '');+ }+ }, 240_000);+test('under a privacy hatch the links effect resolves a stdio writer bound to a reader as that member: its mention edge is kept', async () => {await engine.setConfig(STDIO_MEMBER_KEY, 'alice-example');try {diff --git a/test/cli-flag-equals.test.ts b/test/cli-flag-equals.test.tsindex 7503061a5a..55825d337b 100644--- a/test/cli-flag-equals.test.ts+++ b/test/cli-flag-equals.test.ts@@ -424,6 +424,7 @@ describe('#7619 split rules', () => {'src/core/sync-upstream.ts': 'git child argv','src/core/tailscale.ts': 'tailscale child argv','src/mcp/surface.ts': 'serve --access/--surface parsers read both forms (#7603); the entry splits the = form first',+ 'src/core/stdio-member-flag.ts': 'serve --stdio-member parser reads both forms; the entry splits the = form first, and setup and doctor read it back from a harness entry\'s args as written (GST-363)','src/core/direct-pool-profile.ts': 'pool profile reads serve --access in both forms from the raw argv before the gate','src/commands/access.ts': 'access has no EQUALS_READERS key, so the entry refuses every = form; flagValue and the --as guard also read it for a direct caller','src/commands/auth-binding.ts': 'the entry refuses --member=/--may-act-for= on auth (no EQUALS_READERS key); takeBindingFlags also reads the = form so a direct caller never drops a binding',diff --git a/test/fixtures/goldens/doctor/content-pglite-human.json b/test/fixtures/goldens/doctor/content-pglite-human.jsonindex 7a36b161f6..40603aa90d 100644--- a/test/fixtures/goldens/doctor/content-pglite-human.json+++ b/test/fixtures/goldens/doctor/content-pglite-human.json@@ -86,6 +86,7 @@" [INFO] access_policy_widening_held: Not applicable: no source has a folder rule."," [INFO] access_policy_invalid: Not applicable: no source has a folder rule."," [INFO] access_policy_store_mismatch: Not applicable: no source has a folder rule.",+ " [INFO] unlabeled_people_folders: Not applicable: this brain serves one person (fewer than two enabled members and no access.serves = several)."," [INFO] access_may_act_for_wildcard: Not applicable: no page names readers and no member exists."," [OK] rls: Skipped (PGLite — no PostgREST exposure, RLS not applicable)"," [OK] function_search_path: Every gbrain function that pins a search_path ends it with pg_temp",diff --git a/test/fixtures/goldens/doctor/content-pglite-json.json b/test/fixtures/goldens/doctor/content-pglite-json.jsonindex 750bbd7fd1..2de537e656 100644--- a/test/fixtures/goldens/doctor/content-pglite-json.json+++ b/test/fixtures/goldens/doctor/content-pglite-json.json@@ -1115,6 +1115,15 @@"severity": "info","status": "ok"},+ {+ "category": "brain",+ "elapsed_ms": "<volatile>",+ "message": "Not applicable: this brain serves one person (fewer than two enabled members and no access.serves = several).",+ "name": "unlabeled_people_folders",+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"+ },{"category": "brain","elapsed_ms": "<volatile>",diff --git a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json b/test/fixtures/goldens/doctor/hot-checks-pglite-json.jsonindex bfd0e615aa..b82f279632 100644--- a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json@@ -1186,6 +1186,15 @@"severity": "info","status": "ok"},+ {+ "category": "brain",+ "elapsed_ms": "<volatile>",+ "message": "Not applicable: this brain serves one person (fewer than two enabled members and no access.serves = several).",+ "name": "unlabeled_people_folders",+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"+ },{"category": "brain","elapsed_ms": "<volatile>",@@ -6290,6 +6299,15 @@"severity": "info","status": "ok"},+ {+ "category": "brain",+ "elapsed_ms": "<volatile>",+ "message": "Not applicable: this brain serves one person (fewer than two enabled members and no access.serves = several).",+ "name": "unlabeled_people_folders",+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"+ },{"category": "brain","elapsed_ms": "<volatile>",diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.jsonindex 31c451c6d6..e17e72cd7c 100644--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json@@ -1182,6 +1182,15 @@"severity": "info","status": "ok"},+ {+ "category": "brain",+ "elapsed_ms": "<volatile>",+ "message": "Not applicable: this brain serves one person (fewer than two enabled members and no access.serves = several).",+ "name": "unlabeled_people_folders",+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"+ },{"category": "brain","elapsed_ms": "<volatile>",@@ -6287,6 +6296,15 @@"severity": "info","status": "ok"},+ {+ "category": "brain",+ "elapsed_ms": "<volatile>",+ "message": "Not applicable: this brain serves one person (fewer than two enabled members and no access.serves = several).",+ "name": "unlabeled_people_folders",+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"+ },{"category": "brain","elapsed_ms": "<volatile>",diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.jsonindex c65c4b9d0c..b2c12c784a 100644--- a/test/fixtures/goldens/exports/types.json+++ b/test/fixtures/goldens/exports/types.json@@ -6827,6 +6827,7 @@"revealTools?: ((names: string[]) => void) | undefined","sessionId?: string | undefined","sourceId: string",+ "stdioMember?: string | undefined","stdioSurface?: StdioSurfaceState | undefined","subagentId?: number | undefined","surfaceCeiling?: \"verbs\" | \"starter\" | \"full\" | undefined",diff --git a/test/setup-serves-several.test.ts b/test/setup-serves-several.test.tsindex 8617d90ce2..85fe5b6277 100644--- a/test/setup-serves-several.test.ts+++ b/test/setup-serves-several.test.ts@@ -32,6 +32,8 @@ import { dispatchToolCall } from '../src/mcp/dispatch.ts';import { labelSeveral, receiptOk, servesStatus, type ServesReceipt } from '../src/commands/access-serves.ts';import { setupRerunArgv } from '../src/core/setup/launcher-lanes.ts';import { servesPreflight } from '../src/commands/setup-serves.ts';+import { refreshHookLaunchers } from '../src/core/setup/hook-launcher-refresh.ts';+import { ownedEntryFingerprint } from '../src/core/bootstrap/adopted-connections.ts';import { readdirSync } from 'node:fs';import { addMember } from '../src/core/access/members.ts';import { unlabeledPeopleFoldersEntry } from '../src/commands/doctor/checks/unlabeled-people-folders.ts';@@ -301,6 +303,18 @@ async function brainWithPages(b: Box): Promise<void> {expect((await gbrain(b, ['init', '--pglite', '--no-embedding', '--json'])).exitCode).toBe(0);for (const [slug, canary] of Object.entries(PAGES)) expect((await gbrain(b, ['put', slug, '--content', pageText(slug, canary)])).exitCode).toBe(0);}+const entry = (b: Box) => JSON.parse(readFileSync(join(b.home, '.claude.json'), 'utf8')).mcpServers.gbrain as { command: string; args: string[] };+const entryArgs = (b: Box) => entry(b).args;+/** setup's claude-code entry as it was before the launcher (#8426), still owned by its receipt, so post-upgrade rewrites it. */+function staleEntry(b: Box): void {+ const cfgPath = join(b.home, '.claude.json');+ const cfg = JSON.parse(readFileSync(cfgPath, 'utf8'));+ cfg.mcpServers.gbrain = { ...cfg.mcpServers.gbrain, command: b.bin };+ writeFileSync(cfgPath, JSON.stringify(cfg, null, 2));+ const receiptPath = join(b.home, '.gbrain-connection-claude-code-gbrain.json');+ const receipt = JSON.parse(readFileSync(receiptPath, 'utf8'));+ writeFileSync(receiptPath, JSON.stringify({ ...receipt, entry_hash: ownedEntryFingerprint(cfg.mcpServers.gbrain) }, null, 2));+}const stdioKey = async (b: Box) => { const r = await gbrain(b, ['config', 'get', 'mcp.stdio_member']); return r.exitCode === 0 ? r.stdout.trim() : ''; };function fakeOpenclaw(b: Box): string {const dir = join(b.root, 'oc-bin');@@ -329,7 +343,9 @@ describe('gbrain setup --serves (spawned, PGLite)', () => {await brainWithPages(b);const preview = await setup(b, ['claude-code', '--serves', 'several', '--members', 'alice-example,bob-example', '--stdio-member', 'alice-example', '--dry-run']);expect(preview.exitCode).toBe(0);- expect(preview.stdout).toContain('stdio would bind: every stdio MCP session on this brain');+ expect(preview.stdout).toContain('stdio this claude-code entry would start serve --stdio-member alice-example: only its sessions read as alice-example');+ expect(preview.stdout).toContain('serve --surface starter --advertise verbs --stdio-member alice-example');+ expect(existsSync(join(b.home, '.claude.json'))).toBe(false);expect(await stdioKey(b)).toBe('');const first = await setup(b, ['claude-code', '--serves', 'several', '--members', 'alice-example,bob-example']);expect(first.exitCode).toBe(0);@@ -339,7 +355,8 @@ describe('gbrain setup --serves (spawned, PGLite)', () => {expect(first.stdout).toContain(`key ${m}: ${join(b.home, '.gbrain', 'member-keys', `${m}.key`)} (minted, 0600; token member-${m})`);expect(first.stdout).toContain(`proof a read bound to ${m} sees its own folder (1 page(s)) and no page of another member's folder`);}- expect(first.stdout).toContain('stdio stdio sessions on this brain read only pages no rule restricts');+ expect(first.stdout).toContain("stdio this harness's stdio sessions read only pages no rule restricts");+ expect(entryArgs(b)).not.toContain('--stdio-member');expect(claudeMd(b)).not.toContain(SERVES_SEVERAL_LINE);expect(claudeMd(b)).toContain('apply your own access rules to what comes back');const again = await setup(b, ['claude-code', '--serves', 'several', '--members', 'alice-example,bob-example', '--json']);@@ -354,15 +371,22 @@ describe('gbrain setup --serves (spawned, PGLite)', () => {const owner = await setup(b, ['claude-code', '--serves', 'several', '--members', 'alice-example,bob-example', '--json']);expect(owner.exitCode).toBe(0);expect(owner.doc.serves).toMatchObject({ brain_serves: 'one', stdio: { member: null, action: 'unbound' } });- expect(owner.doc.serves.stdio.detail).toContain('stdio sessions on this brain read only pages no rule restricts');- expect(owner.doc.serves.stdio.detail).toContain('gbrain setup claude-code --serves several --stdio-member <member>');+ expect(owner.doc.serves.stdio.detail).toContain("this harness's stdio sessions read only pages no rule restricts");+ expect(owner.doc.serves.stdio.detail).toContain('gbrain setup claude-code --stdio-member <member>');expect(await stdioKey(b)).toBe('');const bound = await setup(b, ['claude-code', '--serves', 'several', '--members', 'alice-example,bob-example', '--stdio-member', 'alice-example', '--json']);expect(bound.exitCode).toBe(0);expect(bound.doc.serves).toMatchObject({ brain_serves: 'several', stdio: { member: 'alice-example', action: 'write' } });- expect(bound.doc.serves.stdio.detail).toContain('every stdio MCP session on this brain, from any harness on this host, now reads as alice-example, including pages only alice-example may read');- expect(await stdioKey(b)).toBe('alice-example');+ expect(bound.doc.serves.stdio.detail).toContain('this claude-code entry now starts serve --stdio-member alice-example: only its sessions read as alice-example, including pages only alice-example may read');+ expect(bound.doc.target.stdio_member).toBe('alice-example');+ expect(entryArgs(b).slice(-2)).toEqual(['--stdio-member', 'alice-example']);+ expect(await stdioKey(b)).toBe('');expect(claudeMd(b)).toContain(`- ${SERVES_SEVERAL_LINE}`);+ const carried = await setup(b, ['claude-code', '--json']);+ expect(carried.exitCode).toBe(0);+ expect(carried.doc.serves).toMatchObject({ mode: 'one', brain_serves: 'several', stdio: { member: 'alice-example', action: 'keep' } });+ expect(carried.doc.steps.find((s: any) => s.step === 'mcp')).toMatchObject({ action: 'keep' });+ expect(entryArgs(b).slice(-2)).toEqual(['--stdio-member', 'alice-example']);const receipts = setupReceipts(b);expect(receipts.length).toBeGreaterThan(0);for (const r of receipts) {@@ -371,7 +395,7 @@ describe('gbrain setup --serves (spawned, PGLite)', () => {}}, 480_000);- test('--stdio-member refuses without --serves several, off claude-code and codex, and on a host with OpenClaw; nothing is written', async () => {+ test('--stdio-member refuses an unknown member, off claude-code and codex, with --instructions-only or --no-stdio-member, and on a host with OpenClaw or Hermes; nothing is written', async () => {const b = box();await brainWithPages(b);for (const m of ROSTER) expect((await gbrain(b, ['access', 'member', 'add', m])).exitCode).toBe(0);@@ -380,29 +404,107 @@ describe('gbrain setup --serves (spawned, PGLite)', () => {mkdirSync(workspace);expect(existsSync(join(b.root, 'openclaw-state'))).toBe(false);const refusals: Array<[string[], string, Record<string, string>]> = [- [['claude-code', '--stdio-member', 'alice-example'], '--stdio-member needs --serves several', {}],[['openclaw', '--serves', 'several', '--members', ROSTER.join(','), '--workspace', workspace, '--stdio-member', 'alice-example'], 'claude-code or codex', {}],[['claude-code', '--instructions-only', '--serves', 'several', '--stdio-member', 'alice-example'], 'claude-code or codex', {}],- [['claude-code', '--serves', 'several', '--members', ROSTER.join(','), '--stdio-member', 'alice-example'], "OpenClaw's shared sessions", { PATH: `${fakeOpenclaw(b)}:${process.env.PATH}` }],- [['codex', '--serves', 'several', '--members', ROSTER.join(','), '--stdio-member', 'alice-example'], "Hermes's shared sessions", { HERMES_HOME: b.root }],+ [['claude-code', '--stdio-member', 'alice-example', '--no-stdio-member'], 'not both', {}],+ [['claude-code', '--stdio-member', 'Alice Example'], 'needs a member id', {}],+ [['claude-code', '--stdio-member', 'alice-example'], 'OpenClaw is installed on this host', { PATH: `${fakeOpenclaw(b)}:${process.env.PATH}` }],+ [['codex', '--serves', 'several', '--members', ROSTER.join(','), '--stdio-member', 'alice-example'], 'Hermes is installed on this host', { HERMES_HOME: b.root }],];for (const [args, says, env] of refusals) {const r = await gbrain(b, ['setup', ...args, '--gbrain-bin', b.bin], env);expect(r.exitCode).toBe(2);expect(r.stderr).toContain(says);+ if (says.endsWith('on this host')) expect(r.stderr).toContain('gbrain auth create <name> --member <id>');expect(await stdioKey(b)).toBe('');+ expect(existsSync(join(b.home, '.claude.json'))).toBe(false);}+ const unknown = await setup(b, ['claude-code', '--stdio-member', 'carol-example', '--json']);+ expect(unknown.exitCode).not.toBe(0);+ expect(unknown.stdout).toContain('not an enabled member of this brain');+ expect(unknown.stdout).toContain('alice-example, bob-example');+ expect(existsSync(join(b.home, '.claude.json'))).toBe(false);const labelled = await setup(b, ['openclaw', '--serves', 'several', '--members', ROSTER.join(','), '--workspace', workspace]);expect(labelled.stdout + labelled.stderr).not.toContain('reads as alice-example');expect(await stdioKey(b)).toBe('');}, 360_000);- test('--stdio-member refuses on a Postgres brain other machines can open, before reading or writing anything', () => {- const refused = servesPreflight({ serves: 'several', members: 'alice-example,bob-example', stdioMember: 'alice-example', dryRun: false }, '/nonexistent/gbrain', 'claude-code', true, false, false);- expect(refused).toMatchObject({ code: 'invalid_params' });- expect((refused as Error).message).toContain('every machine that opens it');+ test('codex keeps an entry member on a bare re-run and --no-stdio-member removes it on a several-person brain; a plugin-served harness and serve on a shared host refuse the flag', async () => {+ const b = box();+ await brainWithPages(b);+ for (const m of ROSTER) expect((await gbrain(b, ['access', 'member', 'add', m])).exitCode).toBe(0);+ const codexArgs = () => (Bun.TOML.parse(readFileSync(join(b.home, '.codex', 'config.toml'), 'utf8')) as any).mcp_servers.gbrain.args as string[];+ expect((await setup(b, ['codex', '--stdio-member', 'alice-example'])).exitCode).toBe(0);+ expect(codexArgs().slice(-2)).toEqual(['--stdio-member', 'alice-example']);+ const rerun = await setup(b, ['codex', '--json']);+ expect(rerun.exitCode).toBe(0);+ expect(rerun.doc.serves.stdio).toMatchObject({ member: 'alice-example', action: 'keep' });+ expect(codexArgs().slice(-2)).toEqual(['--stdio-member', 'alice-example']);+ const removed = await setup(b, ['codex', '--no-stdio-member', '--json']);+ expect(removed.exitCode).toBe(0);+ expect(removed.doc.serves.stdio).toMatchObject({ member: null, action: 'remove' });+ expect(codexArgs()).not.toContain('--stdio-member');+ expect(await stdioKey(b)).toBe('');++ mkdirSync(join(b.home, '.claude'), { recursive: true });+ writeFileSync(join(b.home, '.claude', 'settings.json'), JSON.stringify({ enabledPlugins: { 'gbrain@gbrain': true } }));+ const plugin = await gbrain(b, ['setup', 'claude-code', '--stdio-member', 'alice-example', '--gbrain-bin', b.bin]);+ expect(plugin.exitCode).toBe(2);+ expect(plugin.stderr).toContain("plugin serves this claude-code gbrain MCP server");+ expect(existsSync(join(b.home, '.claude.json'))).toBe(false);++ const serveRefusals: Array<[string[], string, Record<string, string>]> = [+ [['--stdio-member', 'alice-example', '--http'], 'binds a stdio serve only', {}],+ [['--stdio-member', 'Alice Example'], 'needs a member id', {}],+ [['--stdio-member', 'alice-example', '--stdio-member=bob-example'], 'was given 2 times', {}],+ [['--stdio-member', 'alice-example'], 'OpenClaw is installed on this host', { PATH: `${fakeOpenclaw(b)}:${process.env.PATH}` }],+ ];+ for (const [args, says, env] of serveRefusals) {+ const r = await gbrain(b, ['serve', ...args], env);+ expect(r.exitCode).not.toBe(0);+ expect(r.stderr).toContain(says);+ }+ }, 360_000);++ test('--stdio-member is checked against --members when this run labels them, and needs a brain otherwise; the engine no longer matters', () => {+ const outside = servesPreflight({ serves: 'several', members: 'alice-example,bob-example', stdioMember: 'carol-example', dryRun: false }, '/nonexistent/gbrain', 'claude-code', false, false);+ expect(outside).toMatchObject({ code: 'invalid_params' });+ expect((outside as Error).message).toContain('not one of the people in --members');+ const noBrain = servesPreflight({ stdioMember: 'alice-example', dryRun: false }, '/nonexistent/gbrain', 'codex', false, false);+ expect((noBrain as Error).message).toContain('this brain does not exist yet');+ expect(servesPreflight({ serves: 'several', members: 'alice-example,bob-example', stdioMember: 'alice-example', dryRun: true }, '/nonexistent/gbrain', 'claude-code', false, false)).toMatchObject({ roster: ROSTER, status: null });});+ test('upgrade paths carry an entry\'s --stdio-member forward and never add one: post-upgrade rewrites, setup re-runs from the receipt, --no-stdio-member removes it', async () => {+ const b = box();+ await brainWithPages(b);+ expect((await setup(b, ['claude-code', '--serves', 'several', '--members', ROSTER.join(','), '--stdio-member', 'alice-example'])).exitCode).toBe(0);+ const refresh = async () => { const lines: string[] = []; await withEnv({ ...CLEAN, HOME: b.home, GBRAIN_HOME: b.home }, () => refreshHookLaunchers((l) => lines.push(l))); return lines; };+ staleEntry(b);+ expect((await refresh()).join('\n')).toContain('now start gbrain from its own directory');+ expect(entryArgs(b).slice(-2)).toEqual(['--stdio-member', 'alice-example']);+ expect(entry(b).command).not.toBe(b.bin);+ for (const r of setupReceipts(b)) {+ const argv = setupRerunArgv('claude-code', r);+ expect(argv).not.toContain('--stdio-member');+ const rerun = await gbrain(b, [...argv.slice(1), '--json']);+ expect(rerun.exitCode).toBe(0);+ expect(entryArgs(b).slice(-2)).toEqual(['--stdio-member', 'alice-example']);+ }+ expect((await gbrain(b, ['apply-migrations', '--yes', '--no-autopilot-install'])).exitCode).toBe(0);+ expect(entryArgs(b).slice(-2)).toEqual(['--stdio-member', 'alice-example']);+ const removed = await setup(b, ['claude-code', '--serves', 'several', '--members', ROSTER.join(','), '--no-stdio-member', '--json']);+ expect(removed.exitCode).toBe(0);+ expect(removed.doc.serves.stdio).toMatchObject({ member: null, action: 'remove' });+ expect(removed.doc.serves.stdio.detail).toContain('removed --stdio-member alice-example from this claude-code entry');+ expect(entryArgs(b)).not.toContain('--stdio-member');+ staleEntry(b);+ await refresh();+ expect(entryArgs(b)).not.toContain('--stdio-member');+ expect(entry(b).command).not.toBe(b.bin);+ expect(await stdioKey(b)).toBe('');+ }, 480_000);+test('a brain setup cannot read refuses and writes nothing', async () => {const b = box();expect((await gbrain(b, ['init', '--pglite', '--no-embedding', '--json'])).exitCode).toBe(0);