Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Key files: Core Access
Subsystem index. 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.tsnormalizes frontmatterreadable_by(bare id =member:<id>,group:<g>, ASCII case fold, space trim; anything malformed is['!nobody']); it is the row twin of the SQLgbrain_access_readers()(test/access-principals.test.tsholds them equal). A BEFORE trigger keepspages.page_readersequal 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 untilgbrain 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 withaccess_member_disabled) andcaller.ts(remoteCallerAccess: the identity dispatch puts on the caller-access record; stdio binds throughserve --stdio-member, elsemcp.stdio_member; publication re-resolves from the stored principal; a binding lookup that fails never reads as unbound: a statement error throwsaccess_identity_unavailable(retryable,fix.next: wait), a transient failure (transientDatabaseFailure,transientInterruptioninpersistence/transient-retry.ts) or a non-statement failure is rethrown unchanged for the persistence consumer, and only a schema missingaccess_members,access_group_membersormember_idreads as unbound). Insearch/private-visibility.tsevery page fragment isaccessAllowedSqlAND the privacy part: plain fragments use the empty identity (over-hide, never leak),*ForCallerfragments the caller's, andGBRAIN_REMOTE_PRIVATE_PAGES,search.remote_private_pagesandgranted_sourcesrelax only the privacy part (privacyForCaller). GST-2490: an owner read (CallerAccess.lineagewithowner, read-only ops only) useslineageAccessSql: the owner's readers and folder rules as for any member, withgbrain_access_origin_hidden_for()(v304; per origingbrain_access_origin_closed_for()) in place of the every-caller lineage, so a derivative or fact passes when the owner reads every origin;ownerReadsRestricted(configaccess.owner_reads_restricted,owner.tssetOwnerReadsRestricted, local only) also passes pages kept to other members except another member's own member page and pending coverage.access check,who-can-read,whoami(ownerReadsRestrictedNotice) and doctoraccess_owner_reads_restrictedreport it; testtest/owner-reads-restricted.test.ts(both engines, database and access.yml rules). GBRA-108 (migration v305,v305-access-lineage-designs.ts):access_rules.covers_derived(default true) — a raw-only rule (folder-rules.tscovers_derived: false,rule add --raw-only; digest unchanged for covering rules; true→false is the held wideningderived_released, false→true the narrowingderived_covered) is dropped from an origin's rule set by the SQL functiongbrain_access_lineage_rules()insidegbrain_access_origin_restricted()and the 10-argumentgbrain_access_origin_closed_for(), so it keeps its pages but not their lineage (a page's own readers still close it; fact provenance filters judge withderived = true).access_members.kind(person|audience,members.tssetMemberKind, local only): an owner read carriesCallerAccess.audienceKindMembers, whose member pages pass the readers test and the member-page exemptions (audiencePages,notOtherMemberPageSql, thep_audience_pagesargument of the 9-argumentgbrain_access_origin_hidden_for()). Configaccess.members_read_lineage(lineage.ts, local only) setsCallerAccess.lineagefor any member read speaking for itself (caller.ts; never an audience of several or an unbound credential;withCallerAccessdrops it for several identities and keeps the owner opt-in and audience members owner-only). Cache keys:knobsHashxol=3andxak=,callerIdentityKeyowner_reads/audience_kind. Doctoraccess_lineage(checks/access-lineage.ts). Tests:test/access-raw-only-rules.test.ts,test/access-audience-members.test.ts,test/access-members-read-lineage.test.ts(both engines, both stores; fixturetest/helpers/access-lineage-fixture.ts). GBRA-108 design 1 (the labelled-only migration,schema-migrations/v*-access-labelled-only.ts):access_members.labelled_only(labelled-only.tssetMemberLabelledOnly, local only, refused on the owner withaccess_labelled_only_ownerfromowner.ts, whichsetOwneralso raises) setsCallerAccess.labelledOnly(caller.ts,actor.ts,as-preview.ts; fails closed to true when the table cannot be read).private-visibility.tslabelledOnlySqlANDspage_readers && identity OR folder_rule_ids && satisfiedintocallerAccessSql,callerReadersAllowedSql(a snapshot needs its own readers or a rule on the live page) and the fact filters (labelledOnlyFactSql: a fact on the caller's own member page while it names the member, or under member lineage a provenance page that passes; else FALSE); under member lineage a derived row may pass throughgbrain_access_origin_labelled_for()(every origin labelled, none missing). Remote read gates that are not caller-aware useremoteReadFloorSql/remoteProvenanceFloorSql(the plain fragment, plus the labelled-only conjunct only for a labelled-only caller);test/remote-read-floor.test.tslists the sites that keep the plain fragment.labelledOnlyFornever reports the configured owner, and dispatch refuses a scope read for a labelled-only person (scope-read.tsscopeReadLabelledOnlyRefused). The entity page of a fact is judged by the ordinary policy. Writes:persistence/page-visibility.ts(writerReadPolicySql,remoteLabelsChecked→assertLabelledOnlyCreate→access_labelled_only_unnamed),cli/enforced-member.tsmemberPageView. Cache keysxlo=1,labelled_only; doctoraccess_labelled_only_members(checks/access-labelled-only.ts). Test:test/access-labelled-only.test.ts(both engines, both storesA derivative of a page that names readers is otherwise hidden from every remote caller (originAllowedSql, which calls the SQL functiongbrain_access_origin_restricted()only for atom, question, concept, event orderived_fromrows, 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 NULLestimates almost no rows and sent restricted vector searches into nested-loop sequential scans. The index walk's page probe (INDEX_WALK_PAGE_COLUMNS) projectspage_readers. Configaccess.restrictions_present(set by a trigger, sticky) keeps every pre-A1 path on a brain with no restriction.check:remote-privacy-readskeeps the two relaxations read only inprivate-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.tsis the grammar (.gbrain/access.yml:rules:ofid,prefix,readable_by),classifyRulebook(each change is narrowing or widening; the target installs only the narrowing part) andmatchingRuleIds.policy.tsowns the one applied rulebook for both stores:access_rules(source-qualified ids), the append-onlyaccess_policy_revisionslog,access_pending_coverage(prefixes that read as nobody while a narrowing restamps, or while a committed file is invalid) andsources.config.access_store, persisted at the first rule and changed only bypolicy-migrate.ts(journaled inaccess_policy_migrations).proposeRevisioninstalls narrowing at once under a per-source row lock and holds widening forapplyApproved(plan_hash,preview_changed);restampSourcerewritespages.folder_rule_idsin id windows, then clears pending coverage under the lock; re-proposing the same rulebook finishes an interrupted restamp. A trigger stampsfolder_rule_idsfrom the SQL functiongbrain_access_folder_rules()on insert and on slug or source change, never from git on the serve path.policy-git.tsis the git store (files committed through the commit door, applied bysyncAccessPolicyAtfrom sync preflight and before and after every managed pass (performManagedSync: sync, drain,sources refresh, git conversion), read withgit showat the synced commit (GST-2331: every read underHARDENED_GIT_ARGSandNO_LAZY_FETCH_ENV, so a partial clone fetches nothing; a policy file the commit names that the clone lacks, or a history the replay cannot read, makes the source read as nobody until the objects are fetched: the problem names the exactgit cat-file -porgit log --first-parent -pthat fetches them, and the next sync applies the rules and clears the mark); a database with no revision yet replays each committedaccess.ymlsince theaccess.approvedbaseline, so a rebuild holds a removal a plain commit made);policy-transfer.tscarries the applied rulebook throughgbrain exportand installs it before any page ingbrain import;policy-notice.tsis theaccess_policy_pendingdegraded notice. Inprivate-visibility.ts,folderRulesAllowedSqlsits insideaccessAllowedSql(folder_rule_ids IS NULL OR folder_rule_ids <@ <satisfied ids>plus coverage conjuncts), so no hatch, grant or--asrelaxes it, and the unrestricted short form testsfolder_rule_ids IS NULLnext topage_readers IS NULL(v283 triggers setaccess.restrictions_presenton the first rule or pending prefix);caller.ts'sfolderAccessForfails 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.tsparses the audience a harness asserts (X-Gbrain-On-Behalf-Ofor 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 toaccess-audience-YYYY-Www.jsonl. Dispatch resolves it on every remote call throughcaller.ts(resolveAudienceIdentities: every entry must be in the credential's livemay_act_for, then name an enabled member or existing group); the caller-access record then carriesaudienceIdentities, andaccessAllowedForAllSqlneeds 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 asWriteAuthority.actingFor(re-resolved at publication) and agent jobs asgrant.actingFor. Every remote response carries_meta.access(appliedAccessSummary), whichwhoamireturns asaccess.applied; doctoraccess_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. Rooms (GST-2639):room.tsreads the shared chat an answer goes into (readRoomDeclaration: theX-Gbrain-Roomheader, request-level_meta.roomand aroomtool argument, which is stripped before the handler; the argument can only add people, a disagreement setsconflict; an empty or malformed channel isinvalid, never a refusal) andassessRoommarks a copy of a covered op's result (ROOM_COVERED_OPS) plus hot memory withroom_access: pages throughprivatePagesFilterForCallerunder the room's caller-access record (audienceCallerAccess, the audience branch ofremoteCallerAccess), facts throughfactVisibilitySqlandprivateProvenanceFilterUnderPolicy, with reasonsreaders,folder_rule,labelled_only,private_label,derived,personal_source(a page the room could otherwise read that sits in someone's personal source while the room holds anyone else:hiddenPersonalSources). It never throws, never narrows, reorders or fails the read (a failure, the 3 s deadline, more than 2,000 references or an uncovered op leave the body unchanged and mark items unknown), writes_meta.roomand the noticesroom_above_level,room_hints_unavailable,room_conflict, and appends a count-onlyroom_markedaudit row.resolveAudienceIdentitiestakesmayActFor: 'owner_room_assessment'to skipmay_act_forfor the owner's room only. Dispatch ignores a room on a trusted local call. Test:test/access-room.test.ts(both engines, repo-less). 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 orclient_credentials, read fromoauth_tokens.grant_type) andactor.ts.resolveAttestedActorruns in dispatch before any work: an invalid id refusesactor_not_attested(invalid_actor_id) before any lookup, then the right, the op list (attest_ops, defaultget_write_request,memory_recall,memory_write),acting_user= header (stripped), andactorCoverage(the one coverage test: live right plus a live link inaccess_member_linksto an enabled member, compared exactly) oractor_unlinked. GST-1158:scope-read.tsholdsSCOPE_READ_ACCESS(no identity, actor or audience; privacy never relaxed) andSCOPE_READ_OPS; dispatch runs an attested call to one of those ops that namessource_id/source_idsunder that record (attestedReadMode, which refuses__all__/all_sources), or as the person when the right'sattest_read(v298,--attest-read; over HTTPattestReadon/admin/api/access/attest) isperson, and handlers read the mode withcurrentReadMode. GST-2407:context_packis a scope read too: itsentity_refscount as naming sources,assertPackConfinedrefuses before any read a scope call withoutsource_id, with anentity_refsentry in another source or withsession_id, and the handler reads the named source as home (core block, pull brief, hot facts).attest_read = 'scope'refuses a call that names no actor (actor_required). Tests:test/qm-scope-read.test.ts(both engines),test/doctor-attest-read-shared-scope.test.ts. GBRA-284:member-sources.tsbinds a source to its member (access_member_sources, v299;gbrain access member source add|remove|list);attestedReadScope, called in dispatch for every attested call and inminions/tools/brain-allowlist.tsfor an attested job's tool calls, replaces the call's read grant with the grant minus personal sources bound to another member (every personal source under a scope read), so every resolver refuses or skips them like out-of-grant sources and nothing is added. Test:test/qm-personal-sources.test.ts(both engines).ACTOR_DEFERRED_OPS(capture,extract_facts, take writes,list_write_conflicts, and since GST-2249 W1 every page write;test/qm-attest-write-boundary.test.tsclassifies every attestable mutating operation) are never attestable: refused byparseAttestOps,bindCredential, every call and the stored re-check, which also re-checksattest_opsfor a queued write's operation and each job tool call. Under the header serve-http lists only attested tools and refusesresources/read.attestedCallerAccessis a one-member audience with privacy never relaxed (no granted sources, no hatch), never B'smay_act_forpath. Writes storeWriteAuthority.actingFor = {system, external_id, member}and jobsgrant.actor;storedActorIdentityre-resolves both throughactorCoverageand refuses when the member changed.linkMember/unlinkMember/listMemberLinksbackgbrain access member link|unlink|links;linkMemberByEmail(GST-1158) finds the member by its declared email (members.tsmemberByEmail:access_members.email, migration v301, case-folded, unique, cleared on removal;not_foundwhen none,email_ambiguouswhen several) and then links exactly aslinkMember, from the local CLI and the owner-session routes insrc/commands/serve-http-access.tsonly;--attest-actor/--attest-opsonauth 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 remoterememberfrom an attested actor or a lone-member credential (callerMember, never an audience of several) writes tomemory/members/<member>(memberFactPage;persistence/memory-prepare.tscreates the page withreadable_by: [member:<id>]),visibility: private,infer_entityoff, the entity kept asentity_slug, unless the call passesshare: true(GST-2243), which takes the ordinary world route to the subject's page; a member's explicitvisibility: "world"is refused inremember's validation (member_share_required), so a batch with one such item saves nothing. GST-2346 D1: the owner speaking for itself (ownerSpeaksForItself:CallerAccess.owner, no actor or audience, no subagent, no slug fence) takes the world route unless it passesvisibility: "private"or the page orfacts.default_visibilitymakes the default private (then its member page), is never refusedmember_share_required, and itsforgetof a fact off its member page takes the ordinary remote path when that path reads the fact. A fact off every member and scope page, on a page the owner reads under the GST-2490 rule with the opt-in off (ownerReadPolicyFragment) and may write as a member, a page whose readers name it included, with the fact's entity page judged the same way (ownerReachesFact,forget-prepare.ts), is withdrawn too: submission marks the requestowner_reach, and preparation judges the owner again from the stored authority (storedOwnerSpeaksForItself,page-visibility.ts), so a writer that is no longer the owner getsnot_found; a more trusted fact files theforget_requires_ownerproposal. A member id whose page slugslugifyPathwould 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 undermemory/members/go only to the caller's own page (assertMemberPageWriter, called fromops/context.tsenforceClientSlugFence, so every remote page write passes it; trusted local callers are unaffected). Reads widen a world-only fact list only bymemberFactAdmitSql(a private fact on the caller's own live member page whose readers and folder rules admit the caller;factVisibilitySqlinengine-sql/facts.tsandsearch/fact-relevance.ts), andprivateProvenanceFilterUnderPolicyjudges 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) andtrust/supersede-handlers.tsdedup, supersede and contest only within the member page, and no other write matches a fact there (onMemberPageSql); a remote save there meets only the page's own withdrawals and those of a claim its member reads (memberPageWithdrawal), and the insert guards mark a member-page row only by its page's own withdrawals (schema-migrations/*-member-page-withdrawal-scope.ts), so a claim the member never read cannot refuse or expire its save; consolidation skips facts whose page names readers (readersSourcedFactSql). Per-person keys:callerIdentityKeyjoins the hot-memory cache key (facts/meta-hook.ts,::xid=),callerSessionKeythedeltacursor (ops/facts.ts),sameAttestedActorgates receipts (persistence/authority.tsownRequestAccessible) and replays (persistence/journal.ts) on the stored actor, else the stored audience, andget_agent_joband the owner-fencedget_job,wait_job,get_job_progress,list_jobsandcancel_jobmatch the job'sgrant.actor(system, external id, member) andgrant.actingFor(the same distinct audience entries;jobActorSqlinminions/types.ts), so a job or receipt with an actor or audience reads as missing to the bare client and to other actors and audiences, and one with neither to every actor and audience. Tests:test/access-member-facts.test.ts(both engines),test/access-member-sweep.test.ts(every attestable op as Bob, the bare client and an unbound credential;test/helpers/member-sweep.ts),test/e2e/serve-http-member-sweep.test.ts(two members over a realserve --httpon a keyless repo-less brain).src/core/access/open-twins.ts(GST-2603) —openTwins(engine, pages, readers, cover): for the pages a label or rule preview changes, the live pages with the same slug in other sources that are not private by their own labels (privateSnapshotFilterFragment; no links are read) and that the empty identity or an enabled member outsidereaderspasses by its own readers and folder rules (readersAllowedSql,folderRulesAllowedSqlwithfolderAccessFor), since labels and rules apply per source. Read-only and bounded (OPEN_TWINS_PAGES1000 pages checked,OPEN_TWINS_LISTED50 named,countover all); never part of a preview hash. Callers:repair/visibility.ts(pages turning private, owner inside),repair/readers.ts(--readers),repair/private-labels.ts(--class restore) andcommands/access-rules.tspreviewRules(each narrowed rule's pages);cover(source, slugs)names the same repair or rule with--source <other>. Test:test/label-repair-derived-stamps-gst2603.test.ts.src/core/access/federation-exposure.ts(#8982) —remotePagesFederationExposes(engine, source): the live pages of a source that name no readers and no folder rule, that the read paths' privacy rules (privacyPartSql) do not hide from a no-grant connection (#9068; skipped whenremotePrivacyRelaxedsays an operator opted out), and whose live revision (pages.revision_principal_*) or any version (page_versions.write_principal_*) a token or OAuth client wrote (revoked or deleted included; no record keeps a credential's member at write time, so an unbound, rebound or deleted one counts and each example names its member now; a tag change moves the revision attribution without a version, hiding the earlier author): count, the first five slugs, and shell-quotedwho-can-read/access rule addcommands.remotePagesFederationExposesOrWarnruns it, after the change commits, only for a change that added the source to the no-grant floor (federate reads the prior state under the source row lock), and turns a failed read into a stderr warning, so the caller's federation never changes. Read bysources federate, the unmanagedsources restore(stderr;--jsonaspages_exposed) and the managedsource_lifecyclerestore result. Pinned bytest/sources-federate-member-pages.test.tsandtest/federation-exposure-private-9068.test.ts.src/core/access/serves.ts+src/commands/access-serves.ts(GST-363 PR 1) — whether a brain serves several people (brainServes: configaccess.servesone|severalwins, elseaccess.serves_derived, which migration v309's trigger keeps asseveralwhile 2+ members are enabled;sinceisaccess.serves_since, set once) andgbrain access serves [several --members a,b [--yes]]: preview, then config, members (kept when present), one folder rulepeople/<member>/per member throughaddFolderRules(access-rules.ts, therule addpreview-then-write path; a git store commits.gbrain/access.ymlthrough the commit door), and one read-write tokenmember-<id>per member throughauth-mint.ts(theauth createmint) 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. GBRA-585 D:--owner <id>(setup passes--owneror the login name,loginOwnerIdinsetup-serves.ts) names the owner when none is configured (member added when missing, thensetOwner), keeps a configured one, and lists live unbound tokens and OAuth clients inunboundwith theirauth rescope … --member <owner>command; it rebinds none. GBRA-585 A: keys it mints get thefederatedgrant kind frommemberKeyReadSources(open-pages.ts: the run's source,companywhen it exists, every source federated now); a kept key namedmember-<id>that already holds a list for the run's source gains new sources throughrescopeLegacyTokenand never loses one; any other kept key is untouched.receipt.reads(andreadsLines) names the list and the company page and call counts; setup'sservesAfterLayoutre-runs the child after the layout step addscompanyin the same run. GBRA-585 C:servesPreflight(setup-serves.ts) runs the child as a preview on a brain that serves one person and refusessetup_history_choice_requiredthroughhistoryRefusalwhen itsopen_pagescount is above 0 or unreadable, unless--labelled-onlyor--open-historyis passed;OpenPages.archivecounts the openconversations/pages. With--labelled-onlyon a brain with thecompanysource,planCompanyRule(access-serves.ts) plansreceipt.company_rule: one rulecompany/in sourcecompanyreadable by the owner (required), the run's members and every enabled member that is not labelled-only, written throughaddFolderRules(database store on a repo-less brain, git first on a repo one); a re-run only adds readers, and that widening is recorded and held forgbrain access apply.GBRAIN_SETUP_ABORT_AFTER=serves-members|serves-rules|serves-keyis the crash seam. Doctor:checks/unlabeled-people-folders.tsfails apeople/<x>/folder with pages no rule covers on a several-person brain. Tests:test/setup-serves-several.test.ts(both engines),test/setup-serves-stdio-member.test.tsandtest/setup-serves-upgrade.test.ts(PGLite), shared setup intest/helpers/setup-serves-box.ts. GST-2670:src/core/access/open-pages.tscounts the pages every member's key reads (openPages:accessAllowedSqlwith the empty identity underwithoutCallerAccess, so it never depends on the caller; private pages split out unlessremotePrivacyRelaxedor a reading member'sprivate_pagesgrant opens their source; throwsopen_pages_unknownwhengbrain_access_state_unreadable(); Postgres runs it read-only underSET LOCAL statement_timeout), over the sources the bound tokens, OAuth clients and configmcp.stdio_memberbinding of enabled, non-labelled-only members other than the owner read (credentialReadSources,stdioReadSources), or every source when none reads one (doctor then reports information);SENSITIVE_PAGE_TYPES(grants/shared-exposure.ts) is the DM, chat, conversation and mail tier.readOpenPagesnever throws;ServesReceipt.open_pages/open_pages_errorcarry it in the preview and receipt (planned members counted against the source their keys will read, this run'speople/<member>/rules excluded),gbrain access servesprints it,--labelled-onlycallssetMemberLabelledOnlyafter the members step (the owner in the roster is BLOCKED), doctorchecks/open-shared-pages.tswarns on sensitive pages, andprintOpenPagesUpgradeNoticeruns in post-upgrade. Callers gate onbrainServes, so a one-person brain runs no query. Test:test/open-shared-pages.test.ts(both engines, repo-less).src/commands/repair-propose.ts(GST-2670 phase 2) —gbrain repair visibility --propose [--source <id>] [--out <dir>], preview only: gated onbrainServes(a one-person or pinned-one brain gets "nothing to propose" before any pages query), it reads the open pages throughopen-pages.tswithOpenScope/openPageSql/membersReadOpen(the same predicates as the count), takes each page'sparticipants,attendees,to,from,ccentries (Name <a@b>read as the address), matches each to an enabled member's declared email throughassertMemberEmail(exact, case-folded; anything else isunmatched), groups pages by source and reader set with the owner (ownerView) first, writes one slugs file per set (0600, split atREADERS_MAX_PAGES) under<configDir>/visibility-proposals/or--out(refused inside a git work tree withgitRootAbovefromaccess-serves.ts:repair_propose_dir_in_git), and prints therepair visibility --slugs-file --readerscommand per set and theaccess rule add --prefixcommand per folder ofSENSITIVE_PAGE_TYPESpages with no address list. Writes no label, rule, config or page.src/commands/repair.tsparses--propose/--out(only--source,--out,--jsonbeside it) and dispatches before the kind run. Test:test/repair-visibility-propose-gst2670.test.ts(both engines, repo-less).gbrain serve --stdio-member <id>(GST-363 PR 3) —parseStdioMemberFlag,registeredStdioMemberandwithStdioMemberlive insrc/core/stdio-member-flag.ts(kept out ofmcp-registration.tsso serve and doctor pick up no registration flags); serve passes the value tostartMcpServer, dispatch setsOperationContext.stdioMemberonly for an unauthenticated stdio call, andcaller.tsresolves it live ahead of configmcp.stdio_member(a disabled or unknown member reads as nobody, no fallback). Stored writes stamp it onWriteAuthority.stdioMember(jsonb, no migration); a stdio watch uses principal idregistrationso 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 andrefreshHookLauncherscarry it, andsetupRerunArgvnever names it.src/core/access/requester-scope.ts+src/commands/doctor/checks/unscoped-shared-reads.ts(GST-363 PR 2) — on a brain that serves several people (servesPolicyFrominsearch/private-visibility.ts, read from the request config snapshot: explicitaccess.serveswins, elseaccess.serves_derived; a brain pinnedonenever gates) a remote read from a connection bound to no member (no member identity, no audience, not attested, noreads_unscoped) is refusedrequester_scope_requiredbefore any work. Deny by default: every op notmutating: true, and every read-scope one (think), exceptREQUESTER_SCOPE_EXEMPTandOWN_JOB_OPSfor a non-admin credential;test/requester-scope.test.tspins the list and spies every handler.requesterScopeGateruns indispatchToolCallafter access resolves (attested calls exempt; an unreachable op keeps the unknown-tool envelope) and inbrain-allowlist.tsscopedJobAccessper job tool call; a bound caller's access is never changed.readsUnscoped/createdAtcome from the verifiers (token-binding.tscredentialScopeFields), elsecredentialScopeFor. Grace: 14 days fromaccess.serves_since(migration v309's trigger sets it once) for connections created at or before it (unknown creation and stdio count as old), with_meta.access.requester_scope;access.requester_scope_enforce false(hosted) gives the notice only. An unreadable policy (servesUnknown) is read once more (withServesReread); a second failure refusesrequester_scope_unknown(retryable).assertCredentialScopedrefuses unboundauth create/register-clientandPOST /admin/api/api-keys(credential_scope_required);--reads-unscoped [none]changes go to theaccess-reads-unscopedaudit file.unscopedConnectionsfeeds doctorunscoped_shared_reads,whoami(requesterScopeView) and post-upgrade.src/core/access/implicit-placement.ts(GBRA-585) —withImplicitPlacement: a trusted localput_page(remote === false,localSourceImplicit, nosource_idparam) on a brain that serves several people (brainServes) returnsplacement(source_id,picked_byone oflocal_path/brain_default/sole_non_default/seed_default,readersfromwhoCanRead, and anotenaming the--sourceandreadable_byfixes). Routing is unchanged; a one-person brain, a remote caller and a sourced put get nothing, and a failed read never fails the write. The live owner socket marks an unsourced CLI call implicit (provider.ts,DispatchOpts.localSourceImplicit). Test:test/put-implicit-placement-gbra585.test.ts.src/core/access/stdio-bind-route.ts+src/commands/doctor/checks/shared-stdio-binding.ts(GST-363 PR 2) —stdioBindRoute()is the one place that says how to bind an unbound stdio connection:gbrain setup claude-code|codex --stdio-member <id>for a harness one person uses (that harness entry, either engine), else a per-personserve --httpkey. The requester-scope refusal and notice,gbrain access owner's Bind-one line and whoami's unbound note read it. Doctorshared_stdio_bindingfails whenmcp.stdio_memberis set andsharedStdioHarness()(setup-serves.ts; ahermeson PATH counts only as a script, not React Native's compiled engine) finds OpenClaw or Hermes on a brain that serves several people (not applicable on a one-person brain); fixgbrain config unset mcp.stdio_member.requesterScopeRefuses()lets dispatch drop hot memory from the ops the gate does not cover for a connection it would refuse. Tests:test/shared-stdio-binding.test.ts.src/core/ops/qm-memory.ts(GST-359 D) — QM's memory provider pair.memory_recallreads the attested person's own last-24-hour facts on their member page (listFactsSincewithsourceMarkdownSlug), thenrankFactsByQuestionover the facts they may read, renders one plain line per fact (plainFactTextstrips fence and heading markers) and cuts at a line withinmax_chars(boundFactLines). A call that namessource_idorsource_ids(full surface only) reads as that scope instead:recallSourcesresolves them throughrequestSourceScope(a source outside the credential's grant ispermission_denied),SCOPE_READ_ACCESSempties 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_writevalidates 1-20 facts, derives each request id from uuidv5(member, idempotency_key) (memoryWriteRequestId) and saves throughremember's handler withctx.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 intostructuredContentand leaves the model text incontent; GST-1158 F2 does the same for an attested call to a contract v3 personal tool (QM_PERSONAL_OPS), keeping its JSON incontent(a list asstructuredContent.results; context_pack's text alone, like memory_recall), and dispatch measures that frame against the result cap again; each memory_recall fact carriesarm(ownorranked, F5) andown_page(GST-2407:member-facts.tsownMemberFactIds, the one set forget_fact's ownership gate also reads);unlinkedRecallResultis the empty success dispatch'sactorRefusalreturns for an unlinked person. Contract fixture:scripts/build-qm-memory-contract.tswritesdocs/contracts/qm-memory-provider/v1.json(frozen, byte-identical) andv2.json(the scope read and write;regen:allartifacts;v3.jsonadds the personal tools with frozen result shapes;v4.jsonadds memory_propose, each personal tool'sscope_readmarking andown_page;v5.jsonmarks context_packscope_read, v4's markings frozen asV4_SCOPE_READ_OPS). Scope writes (GST-1113):memory_write {source_id}saves onmemory/scopein a scope source listed in the credential'sattest_sources(migration v293, onaccess_tokensandoauth_clients);access/attest-sources.tsholdsperCallWriteSource(the one exemption from the one-write-source checks inpage-mutations.ts,memory-mutations.tsandpersistence/authority.ts, keyed to that slug and re-checked at publication throughactorCoverage(..., source)), the sticky marksources.config.qm_scope(set byapplyAttestSourcesunder row locks;isSourceFederatedignores federation on it),assertScopeSourceGrant(ininsertClientGrant,persistGrant,writeTokenGrantandinsertUnifiedToken) andwithoutScopeSources(a person recall never reads a scope source).member-facts.tsassertScopePageWriterkeeps other remote writers offmemory/scope. Tests:test/qm-scope-writes.test.ts(both engines),test/qm-memory-tools.test.ts(both engines),test/qm-personal-tools.test.ts(v3 tools over dispatch, both engines),test/qm-memory-contract.test.ts(drift),test/e2e/serve-http-qm-memory.test.ts(keylessserve --http).src/cli/enforced-member.ts+src/cli/enforced-member-classes.ts+src/cli/enforced-commit-push.ts: enforced member mode (guide). WithGBRAIN_ENFORCED_MEMBERset,enforcedGateinsrc/cli/main.tsclassifies the command before any dispatch (enforcedClassOf: read, write, allowed, silent or refused; anything unclassified is refused, exit 3,enforced_member_refused). An empty value, an unknown member or the owner id refuses everything. The gate classifies before help: a refused command refuses with--helptoo, and an allowed one prints only its static help.checkEnforcedOpArgsfirst refuses every write operation exceptget_write_requestwith reasonwrites_off(refuseWritesOff) when the brain's configaccess.enforced_member_writes(database only, read byenforcedWritesMode:checkedor unset,refuse_pages, elserefuse, also on a failed read) is notchecked, before any member, page or source lookup, andcheckEnforcedCommitPushrefuses a named-path commit the same way underrefusebefore any path lookup; then it refuses a named source (--source,--source-id,--source-ids) the member cannot read or that is not registered, alike. Reads go throughdispatchToolCall(with only the operation's declared params; the source travels as the call'ssourceId) withremote: true,transport: 'stdio',stdioMemberandenforcedMember: true(dispatch forceshidePrivate,owner: falseand no private-readable sources), minus other members' personal sources (hiddenPersonalSources; an explicit--sourcenaming one refuses), andnamesHiddenPagewithholds any output that still names a hidden page. Writes stay trusted local writes (ctx.remotefalse):checkEnforcedWriterefuses a target the member cannot read (memberPageView) and any label change, andrememberneeds--entitynaming a readable page (checkEnforcedRemember, the one decision point).write-requestanswers only ids in the member's receipt ledger (recordEnforcedReceipts,configDir()/enforced-member/<member>.receipts); any other id is swapped for a fresh one, so it answers as unknown. sync,sources refreshandgit commit-push(checked bycheckEnforcedCommitPush: every named path readable, no label or.gbrain/change, refused modes) run with output replaced by one line (withWithheldOutput, which also captures the fd-1 chain throughsetStdoutCapture);doctorprints only check names, statuses and counts (withDoctorCounts); sync andsources refreshtake only their listed flags and a readable source (syncSourceArg);entityand every coverage notice drop the mention coverage count (withoutCoverageCounts);timeline-addrefuses a gbrain fence marker;hooksucceeds silently. The warm CLI socket, the persistence delegate and the skill-resolver fast path are skipped under the mode. Tests:test/enforced-member.serial.test.ts,test/enforced-member-writes.serial.test.tsandtest/enforced-member-writes-setting.serial.test.ts(CLI subprocesses, both engines, repo-less and git; shared setup intest/helpers/enforced-member-brain.ts),test/enforced-member-classes.test.ts(every command and operation classified once),test/enforced-member-writes-off.test.ts(the switch's values and a failed read).