Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge remote-tracking branch 'origin/master' into mcp-verify-member-write

garrytan31d77b2e33ef
diff --cc CHANGELOG.md
index 53aa83222e,61479dd5f1..2e0199fc9e
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -10,15 -10,26 +10,35 @@@ credits are retained; no result has bee
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
+## [Unreleased]
+
+**`gbrain mcp verify` now passes its write check on a credential bound to a member.** The verifier's test fact was always sent with `visibility: "world"`, which `remember` refuses for a member credential, so every member-bound connection showed "write" and "write_readback" as failed even when it was set up correctly. A member-bound credential now saves the test fact the way a member's own saves go by default. It is kept private on that member's page, where no other member reads it. The verifier reads the fact back and withdraws it, as before. A credential bound to no member still shares its test fact explicitly, so a brain whose `facts.default_visibility` is private still reads it back. Page mode (`coding-agent` profiles and credentials with direct-write prefixes) had a second mistake: its `put_page` call passed a `title` parameter the tool doesn't declare, so every page-mode write was refused. The title now goes in the page's frontmatter. The same fixes apply to the verify step inside `gbrain connect … --install`.
+
+### Itemized changes
+
+- `src/core/harness/verify.ts`: the fact-mode write reads the credential's bound member from `whoami` (`access.member`) and sends `visibility: "world"` only when there is none. The page-mode `put_page` drops the undeclared `title` parameter for a frontmatter title.
+- Tests: `test/harness-verify-member-credential.test.ts` covers a non-owner member, the owner and an unbound credential, in fact mode and page mode, on PGLite and Postgres (repo-less). It also checks that a member's fixture is private on its member page and unreadable by another member, and that an unbound credential passes under a private `facts.default_visibility`.
+
+ ## [0.60.693.0] - 2026-11-12
+
+ **The brain owner's own agents can now withdraw a private fact the brain host saved.** A credential bound to the brain owner (`gbrain access owner set`) reads private facts, but its `forget` refused one the host had saved with `visibility: "private"` and said only the brain host could withdraw it. Now, speaking for itself, the owner's credential (or a stdio server started with `--stdio-member <owner>`) withdraws a private fact it reads when the page that holds it is one the credential can already write. The fact is struck in the page's file on a brain with a Git repository, and on a strict source a fact held for an entity with no page is struck in `memory/unattributed`, so a rebuild from Git keeps it withdrawn. Three things stay as they were. A fact on a `visibility: private` page, on a page whose readers leave the owner out or on another member's page is still withdrawn on the brain host (`gbrain forget <id>`). A fact the owner confirmed or curated still asks the owner first (`forget_requires_owner`). Member credentials, attested calls (`x-qm-actor`), audiences, subagent jobs, slug-fenced clients and unbound connections get exactly the answers they got before.
+
+ **The owner's agents can also withdraw a fact on a page that lists the owner as a reader.** Since 0.60.682.0 the owner's `recall` shows facts on a page whose `readable_by` names the owner, but its `forget` and `forget_fact` answered `not_found` for them. Now they withdraw such a fact, private or shared, when the owner's credential may also write that page and the page of the entity the fact is about, if it has one, is one the owner reads the same way. The owner opt-in that lets the owner read pages kept to other members (`gbrain access owner reads-restricted on`) does not extend to `forget`: those facts are still withdrawn on the brain host. Every caller that is not the owner speaking for itself gets the answer it got before.
+
+ **A member's save no longer reveals that a claim it never read was withdrawn.** When the brain host or the owner withdrew a claim, a member that later saved the same claim on its own member page was refused with `fact_withdrawn`, which told it that a claim it could never read had existed and been forgotten. Now that save succeeds and gets the same reply it would get if the other claim had never existed. The fact is the member's own, it stays active, and the member's `recall` returns it. A save is still refused when the member could read what was withdrawn, which means a fact it forgot itself, its own copy that the brain host's `forget` withdrew, or for the owner, a fact it reads anywhere. A schema migration changes the two database guards that mark a newly saved row as withdrawn so a row on a member page is marked only by that page's own withdrawals; it rewrites no rows. Brains with and without a Git repository behave the same way.
+
+ ### Itemized changes
+
+ - `src/core/persistence/memory-mutations.ts`, `forget-prepare.ts`: the owner's `forget` reaches a fact on a page that names it as a reader (`ownerReachesFact`): that page, and the fact's entity page where one exists, must pass GST-2490's owner read rule (`ownerReadPolicyFragment` in `search/private-visibility.ts`, the opt-in off) and the read rule a member write is held to, for the owner's identity. Preparation re-resolves that identity from the stored principal and checks the fact again under the publication's locks, so a page that drops the owner from its readers after submission refuses `not_found`.
+ - `src/core/facts/single-prepare.ts`: a remote save onto a member page meets the page's own withdrawals and a withdrawal of another subject only when a withdrawn row is one the page's member reads (`memberPageWithdrawal`). Callers in `memory-prepare.ts` and `ops/qm-memory.ts` pass `remote`.
+ - `src/core/facts/withdrawal-schema.ts`, `insert-guard-schema.ts` and a new schema migration make the insert guards mark a row on a member page only by that page's own withdrawals; `access/member-facts.ts` (`withdrawalCoversFactSql`) and `facts/embedding-identity.ts` treat such a row as covered by its own page's withdrawals only. A withdrawal still expires every matching row, member pages included, when it is made.
+ - Tests: `test/owner-facts-d1-gst2346.test.ts` (the owner's forget on a page that names it, the nine non-owner caller shapes and a member reader unchanged, the opt-in, preparation from the stored principal and under locks, the managed-brain file; the member's save compared byte for byte after a host and an owner withdrawal, and the refusals that stay); PGLite and Postgres.
+
+ - `src/core/persistence/memory-mutations.ts`: `forget` and `forget_fact` let the owner speaking for itself through for a private fact off every member and scope page, on a page no remote writer is kept from, and mark the stored request. The refusal that names the brain host now tells the owner what its credential does withdraw.
+ - `src/core/persistence/forget-prepare.ts`, `src/core/persistence/page-visibility.ts`: preparation judges the owner again from the stored principal (`storedOwnerSpeaksForItself`), and once more under the publication's locks. A writer that is no longer the enabled owner, or that named an actor, an audience, a subagent or a slug fence, reads the fact as any remote caller does and gets `not_found`.
+ - Guards kept: the same claim active on a page kept from remote writers refuses `claim_linked` and withdraws nothing; a more trusted fact files the `forget_requires_owner` proposal, which stores the fact's id and tier only.
+ - Docs: access designations, `MEMORY_VERBS_v1.md`, the access key-files entry; behavior-change notice.
+ - Tests: `test/owner-facts-d1-gst2346.test.ts` (the owner's forget and forget_fact, every other caller shape unchanged, the trust proposal and its accept, preparation from the stored principal, the managed-brain file) and `test/remember-strict-held-gst2492.test.ts` (a held private fact on a strict source, with a rebuild); PGLite and Postgres.
## [0.60.692.0] - 2026-11-12
**On a source whose pages are canonical in Git, every fact writer now commits a fact with no page of its own to Git, and doctor and a new repair find the ones an older gbrain left in the database only.** In the last release only `remember` did this. Google loops, fact extraction, the managed facts writer and an owner releasing a quarantined fact now also commit a fact with no entity, or for an entity with no page, as a row of `memory/unattributed`. Before, they kept it in the database only, where a rebuild from Git lost it, or were refused with `git_home_required` once that page existed. Sources that are not strict, and brains with no Git repository, behave as before.