Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge commit 'f8bc749ec3e251206f5bf41dc62fd64401c43f5c' into capy/gbra190-g4-fact-fences

garrytan97c8a8ed6622
diff --cc docs/architecture/system-of-record.md
index 683235ba9c,cc61608607..6cf9e6db90
--- a/docs/architecture/system-of-record.md
+++ b/docs/architecture/system-of-record.md
@@@ -241,10 -241,9 +241,10 @@@ or a physical projection that leaves at
- `src/core/embedding-dim-check.ts` (1): embedding columns only (physical projection).
- `src/core/extract/receipt-writer.ts` (1): the extraction receipt page runs in `maintenanceTransaction`.
- `src/core/facts/backstop.ts` (1): the facts backstop's DB-only fallbacks insert each fact through one helper, in `maintenanceTransaction` at the extraction's derived tier; managed brains publish through the facts request preparer.
- - `src/core/facts/conversation-publication.ts` (4): the managed conversation-facts preparer clears each member page's prior rows and inserts its frozen entry (or a blocked outcome row) inside the coordinator publication of its admitted batch request, clearing only for a complete replacement (#7013); the unmanaged writer runs the same publication in `maintenanceTransaction`. Its page clear also expires the rows `gbrain facts relink --conversation` linked (after deleting the previous clear's expired copies), inside the same transaction (#6764).
+ - `src/core/facts/conversation-publication.ts` (6): the managed conversation-facts preparer clears each member page's prior rows and inserts its frozen entry (or a blocked outcome row) inside the coordinator publication of its admitted batch request, clearing only for a complete replacement (#7013); the unmanaged writer runs the same publication in `maintenanceTransaction`. Its page clear also expires the rows `gbrain facts relink --conversation` linked (after deleting the previous clear's expired copies), inside the same transaction (#6764). The segmented incremental run, unmanaged only, re-anchors moved windows' facts and stamps fresh rows' windows (`source_window`) in the same `maintenanceTransaction`.
- `src/core/facts/conversation-relink.ts` (1): `gbrain facts relink --conversation`: a `managed_maintenance_conversation_relink` request on managed brains; the unmanaged relink runs in `writeDerivedFacts` (`maintenanceTransaction`).
- `src/core/facts/derivation-inputs.ts` (3): `hideDerivedRows` expires derived facts, deactivates derived takes and soft-deletes derived pages inside the purge's coordinated transaction, attributed to the purge request.
+- `src/core/facts/fence-fact-append.ts` (1): `prepareFenceFactAppend` inserts the facts row of a fence row the request's page file holds, in its caller's coordinated publication after the page row (remember and its callers).
- `src/core/facts/fence-write.ts` (1): the markdown-first fence reconcile insert runs in `maintenanceTransaction` (its page body mirror goes through `facts/file-body-guard.ts`).
- `src/core/facts/file-body-guard.ts` (2): the #6982 checked body mirror (`replaceStoredBody`: the page_versions row and the body refresh, under the page row lock) runs in its caller's `maintenanceTransaction` (fence write, unfenced-facts fence, phantom redirect, forget, proposal supersede).
- `src/core/facts/forget.ts` (4): the legacy fence expiry, withdrawal and strike-through each run in `maintenanceTransaction` (nested inside a caller's coordinated write, they keep its actor).
diff --cc scripts/page-body-readers-baseline.tsv
index b4dc734347,4172725847..9baaa5bd4b
--- a/scripts/page-body-readers-baseline.tsv
+++ b/scripts/page-body-readers-baseline.tsv
@@@ -208,10 -221,9 +221,11 @@@ src/core/facts-fence.ts factsFenceSecti
src/core/facts-fence.ts factsFenceView field INLINE inline arm; a segmented page reads its fences from its marker segments (segmentedFactsFenceView)
src/core/facts/backstop.ts runFactsBackstop field STREAM
src/core/facts/backstop.ts runPipeline field STREAM
+ src/core/facts/conversation-window-extract.ts regularPageVersionToken field STREAM
src/core/facts/drain.ts estimateBacklogUsd sql META
src/core/facts/eligibility.ts isFactsBackstopEligible field LEAD
+src/core/facts/fence-fact-append.ts prepareFenceFactAppend call:serializePageToMarkdown SEGW assertInlineBody first
+src/core/facts/fence-fact-append.ts prepareFenceFactAppend field SEGW assertInlineBody before the fence write
src/core/facts/file-body-guard.ts fileBodyMatchesStored field SEGW a segmented page reads NULL inline columns, never matches, and the caller holds it (nothing written)
src/core/facts/file-body-guard.ts mirroredBody field NONE the parsed checkout file body, not a page row
src/core/facts/file-body-guard.ts readStoredBody sql SEGW reads the inline columns only; a segmented page reads NULL and every caller holds it
@@@ -397,8 -442,11 +444,9 @@@ src/core/persistence/links-maintenance.
src/core/persistence/links-preparation.ts prepareAutomaticLinks field STREAM reads the incoming parsed page, not a stored body
src/core/persistence/loop-fact-retirement.ts prepareLoopFactRetirement call:serializePageToMarkdown SEGW
src/core/persistence/loop-fact-retirement.ts prepareLoopFactRetirement field SEGW
+ src/core/persistence/manual-links.ts prepareManualLinkMutation call:serializePageToMarkdown SEGW wholeBodySnapshot first: a segmented page within 24 MiB is read back whole, a larger one refuses
src/core/persistence/memory-mutations.ts planRememberTarget call:serializePageToMarkdown SEGW
src/core/persistence/memory-mutations.ts planRememberTarget field STREAM
-src/core/persistence/memory-prepare.ts prepareMemoryMutation call:serializePageToMarkdown SEGW assertInlineBody first
-src/core/persistence/memory-prepare.ts prepareMemoryMutation field SEGW assertInlineBody before the fence write
src/core/persistence/origin-twins.ts readOriginClaimants sql STREAM #6948 twin verdict: md5 of an inline body; a segmented page (compiled_truth NULL) reads NULL and holds content_differs, so missing evidence never matches
src/core/persistence/overwritten-edits.ts CONTENT_COLUMNS sql STREAM selects body_storage beside the inline body columns; a segmented version or page has NULL bodies and its overwrite is reported unknown (reason segmented), never compared or restored
src/core/persistence/overwritten-edits.ts overwriteContent field STREAM returns null for a segmented row (body_storage segmented or NULL compiled_truth); the scan reports that overwrite unknown (reason segmented)
diff --cc src/core/behavior-change-notice.ts
index 104753cfb7,1dc8641e37..a92361a8d1
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@@ -1237,10 -1262,42 +1262,46 @@@ export const BEHAVIOR_CHANGES: Readonly
{ since: '0.60.433.0', text: 'Hermes transcript import keeps the answers a user gave in a `clarify` form (answered responses of a submitted form, or the answers a timed-out form had already locked) as user turns, each after its question as the assistant\'s turn. A Hermes session imported before re-renders on its next import scan when it holds such answers, which can run fact extraction for that page again (#7396).' },
{ since: '0.60.433.0', text: 'Fact subject inference links more facts and fewer wrong ones: a currency code next to an amount (`CHF 80`) and a record label opening a sentence (`Invoice ...`, `Work session ...`) no longer block a fact that names one person or company, and an entity introduced only as an example (`including X notes`, `for example, X`) is never chosen as the subject. A page named like the code or label still competes. A sentence that opens with `For example, X ...` no longer takes X as its subject (#7405).' },
{ since: '0.60.433.0', text: '`gbrain think` gives reasoning models from gpt-5 on 16,000 output tokens behind any provider or router prefix, as it already did for gpt-5 and the o-series on their own provider; gpt-6 ids get it too. Before, those got 4,000 and long answers came back truncated (`LLM_OUTPUT_TRUNCATED`). Providers bill the tokens used, not the cap (#7421).' },
+ { since: '0.60.435.0', text: 'A search for a full name with a short first name ("Matt Example") now finds the page titled "Matthew Example", and back (Bob and Robert, Liz and Elizabeth and the other common given-name groups): the title arm also matches the other forms of the given name, and the title boost counts them as a title match. When no title holds every word of a query of up to four words, the title arm\'s any-word retry now puts titles holding the rarest word first instead of tying them with titles that hold only a common word (#7471).' },
+ { since: '0.60.435.0', id: 'keyword_or_rarity', text: 'When no page holds every word of a keyword search of up to four words, the any-word retry of the keyword arm now ranks pages holding the rarest query words first, instead of ranking pages that repeat a common word above the few that hold a rare one. The strict all-words search and longer queries are unchanged.' },
+ // GBRA-156 (exact identity lookup, same release as the #7471 row). `since` is stamped at the merge slot.
+ { since: '0.60.435.0', id: 'whois_exact_identity', text: 'New read operation `whois` (CLI `gbrain whois <email or name>`, MCP tool `whois`): an exact identity lookup for agents triaging email or calendar. It returns the entity pages whose frontmatter `email`/`emails`, title or declared alias equals the query, ignoring case, accents and surrounding quotes, labels each match `email`, `title` or `alias`, sets `ambiguous` when more than one page matches, and returns an empty list, never a search fallback, when none does. Remote callers see only their granted sources and no private or quarantined page. Nothing existing changes.' },
+ // GBRA-190 connectors wave. `since` is stamped at the merge slot.
+ { since: '0.60.437.0', text: 'Chat-connector syncs stop instead of retrying through a block: a bot challenge on any status (the `cf-mitigated: challenge` header, a challenge page on a 5xx, a redirect to a Cloudflare challenge) now ends the run as `forbidden`; a 429 that outlasts its four retries, or asks for a `Retry-After` over two minutes, ends it as the new status `rate_limited` without fetching the remaining conversations; and five conversation fetches in a row failing with a server error or no response stop it as `partial` with `stopReason: consecutive_fetch_failures`. The next sync resumes from the same place (#7482).' },
+ { since: '0.60.437.0', text: 'A chat-connector cookie or token holding a line break, NUL, another control character or a non-ASCII character is refused before any request (`invalid_header_value`): `connectors auth` reports it and `connectors sync` returns `auth_required` with that hint and stamps the auth error. A request that fails before a response is reported by its error code (`ECONNREFUSED`, `TypeError`), never by the runtime\'s message, so a header value can never be echoed into probe output, sync hints or logs (#7483).' },
+ // GBRA-133 G2 (superseded remote blobs). `since` is stamped at the merge slot.
+ { since: '0.60.438.0', text: '`gbrain git commit-push` now keeps this machine\'s version of a file the remote changed back to a version this checkout already had at that path and later replaced (a stale clone or writer pushing an old copy, often inside a merge), instead of stopping with `integrate_conflict`. It reads the last 200 commits that changed the file. The push lists those files in `superseded_remote_paths` and the merge message names them. A version this checkout never had, a remote deletion and a file named with `--resolve` still conflict; when both kinds meet, `integrate_conflict` lists only the real conflicts and `detail.superseded` names the others.' },
+ // GBRA-60 G5 (authored writes get a markdown form). `since` is stamped at the merge slot.
+ { since: '0.60.441.0', text: 'On a managed brain, `add_link` and `remove_link` now edit a `## Links` table in the page\'s Markdown (one row per target, type and source, between `<!--- gbrain:links:begin -->` and `end` markers) through the page-mutation door, and the edge in the database is derived from that row, so a manual edge survives a rebuild from Git. Calling `add_link` again on an existing row without `context` or dates keeps the stored ones. Manual edges recorded before this release stay in the database as they were. Unmanaged brains are unchanged.' },
+ { since: '0.60.441.0', text: 'On a managed brain, `remove_link` no longer deletes an edge that the page\'s own text creates (a link, wikilink or frontmatter field): it keeps it and returns `derived_from_text` with a message saying to edit the page text (`edit_page`) instead.' },
+ { since: '0.60.441.0', text: 'On a managed brain, `extract_entities` writes the entity\'s timeline bullet into the entity page\'s Markdown through the page door, and the backlink to the source page is the link inside that bullet rather than a database-only edge.' },
+ // GBRA-197 lane A (#7514). `since` is stamped at the merge slot.
+ { since: '0.60.443.0', text: 'On a managed brain, an atom batch whose write did not commit is now reported as a write failure: each item in `gbrain dream --drain --json` carries the request id (`gbrain write-request -- <id>` explains it) and the refusal code, and a batch of such items no longer stops the drain as `provider_failure` (code `atom_drain_provider_failure`, `transient`, retryable). After 3 such failures on the same content the page or transcript is held (`held_failed`, doctor `extract_atoms_held_failed` with its receipt and retry command) instead of failing every window; no model call is made for it, and an explicit retry runs it again. An extraction whose model reply repeats an atom title now publishes one atom for that title instead of failing the whole batch.' },
+ // #7516 (GBRA-197 lane B). `since` is stamped at the merge slot.
+ { since: '0.60.443.0', text: 'A managed conversation-facts batch whose receipt lost its stored intent (a `purged_content` refusal the journal redacts, a purge, or receipt compaction) no longer sticks its pages. `gbrain extract-conversation-facts` derived the same batch request id again, so every run paid a model call, failed with `idempotency_conflict` (or got the old failure back) and inserted nothing. The batch now publishes under its pages\' next attempt after one more model call, and the next run makes none. A crashed run that resubmits the same batch still replays its receipt.' },
+ // GBRA-197 (#7515 chat-connector hardening). `since` is stamped at the merge slot.
+ { since: '0.60.443.0', text: 'Chat-connector syncs no longer refresh and retry after a 403: a 403 with a JSON error body or a `www-authenticate` header ends the run as `auth_required` at once, and a redirect is never followed (the session cookie only goes to the provider\'s own origin) and ends it as `auth_required` too. ChatGPT\'s token refresh now goes through the same client, so it is paced, counted and refused the same way: a refused refresh reports `forbidden`, `rate_limited` or `auth_required` instead of being ignored, and `gbrain connectors auth` stops there instead of probing. Re-copy the cookie when a sync reports `auth_required`.' },
+ { since: '0.60.443.0', text: '`gbrain connectors sync --all` now syncs only providers whose `connectors.<p>.auto_sync` is on and names each one it skips; a queued `connector-sync` job rechecks `auto_sync` when it starts and returns `skipped` if it was turned off. A host cron running `connectors sync --all` for a provider without `auto_sync` stops syncing it: turn `auto_sync` on, or run `gbrain connectors sync <provider>`, which still syncs either way.' },
+ { since: '0.60.443.0', text: 'Every chat-connector sync is bounded: at most 10,000 requests per run (5,000 per Claude organization, and at most 10 Claude organizations listed), list pages cut to the page size asked for, and new `--max-requests N` and `--deadline <90s|30m|2h>` flags on `gbrain connectors sync`. A run that reaches a bound ends `partial` with `stopReason` `max_requests` or `deadline`, keeps what it imported and holds the watermark; run `gbrain connectors sync <provider>` again (without `--full`) to continue.' },
+ { since: '0.60.444.0', text: '`gbrain git commit-push` takes `-m` more than once, like `git commit`: each `-m` is a new paragraph of the message (a second `-m` carries a trailer). With `--path <dir>` below the checkout top, the paths after `--` are now relative to `<dir>` (like `git -C`), as its help said; they used to be read relative to the checkout top. The commit step that `gbrain repair frontmatter`, `gbrain repair content`, `gbrain repair file-drift` and the legacy fence repair (`gbrain sources status`, doctor `fence_integrity`) print for a legacy source is now `gbrain git commit-push --path <root> -m <subject> [-m <trailer>] -- <paths>`, which takes the writer lock, commits only those paths, merges remote commits and pushes, instead of a bare `git add` plus `git commit` (the frontmatter step named no paths on its commit, so it also committed anything else staged). In a checkout with no Git remote at all (none configured and the branch names none), `gbrain git commit-push -m <msg> -- <paths>` now commits the named paths locally under the commit lock (outcome `committed_local` with `no_remote: true`, exit 0) and says nothing was pushed; it used to refuse `git_unavailable` and commit nothing. `--push-only`, `--pending`, `--branch`, `--resolve`/`--expect-remote` and `--require-clean` are refused there (`commit_paths_invalid`), and a branch that names a missing remote still refuses `git_unavailable`.' },
+ // GBRA-60 G6 (strict git-canonical sources are door-only). `since` is stamped at the merge slot.
+ { since: '0.60.445.0', text: 'On a brain whose writes are not managed, a direct import into a source configured `canonical: git` (`gbrain import` of markdown, code or an image, the streamed large-page import, and `extract_entities` creating or updating entity pages) is now refused with `strict_requires_managed` before anything is written, because only the managed writer commits a git-canonical source through its one door. Other sources and managed brains are unchanged.' },
+ { since: '0.60.445.0', text: 'On a managed brain, maintenance writers publish one commit per run instead of one per page: a dream patterns or concept republish batch, the entity stubs and timeline bullets of one `extract_entities` call, and one atom generation (its new atoms, activation and retirements) each publish in one transaction and one git commit. Each page still keeps its own request, receipt and failure; a page that fails no longer holds back the rest. `brainstorm --save` on a managed brain now reports its page as accepted and pending (exit 10) with the receipt to poll.' },
+ { since: '0.60.445.0', text: 'On a source configured `canonical: git`, a dream synthesis page is checked against its transcript and stamped with provenance before it is written, so a quote the model invented never reaches git history, and a world concept its provenance covers is published once at world. A connector page marked private, and a private calendar event, is stored database-only and never committed.' },
+ // GBRA-95 G7a (declared database-only classes). `since` is stamped at the merge slot.
+ { since: '0.60.448.0', id: 'git_canonical_declared_classes', text: '`gbrain sources git-gap` now declares every page of a source without a checkout `database_only_source` instead of counting it as not compared. On a git-canonical source (`config.canonical = "git"`, off by default and set by nothing yet), private, alias-private and lineage-private pages, `storage.db_only` directories, never-filed derive folders and ignored paths keep no file in Git (no file, no commit, no Git effect), a page turning private is published as the commit that removes its file, and a write that would commit a private page (`git_private_commit_refused`), store an undeclared page without a file (`git_home_required`), commit a file under an LFS rule without `storage.git_lfs` (`git_lfs_not_enabled`) or come from a writer without the git protocol (`git_protocol_required`) is refused.' },
+ { since: '0.60.452.0', id: 'starter_tools_list_params_gbra156', text: 'The starter MCP tool list is about 27% smaller: it leaves out parameters MCP callers cannot use (local-only, server-set provenance) and rarely needed ones (legacy, admin, versioned skill catalog, image and code search, tuning and recovery knobs with safe defaults). Every left-out parameter is still accepted, and `request_tools {tools: [names]}` now returns each tool\'s full schema with every optional parameter, also on a server capped at starter. Memory verb descriptions no longer start with `MEMORY VERB (v1):`. The verbs and full surfaces list every parameter as before.' },
+ { since: '0.60.452.0', id: 'sources_not_readable_gbra156', text: 'An unscoped `search`, `query`, `recall` or `list_pages` from a token or agent connection with no source grant that comes back empty, while every source it can read holds no page and other sources do, now carries a `sources_not_readable` notice (kind degraded). It says the empty result is not proof of absence, never names a hidden source, and its fix is `gbrain sources federate <source>` on the brain host, or a grant for the token. Granted tokens and OAuth clients never get it.' },
+ { since: '0.60.452.0', id: 'sources_add_federation_warning_gbra156', text: '`gbrain sources add` without `--federated` or `--no-federated` now warns on stderr that the new source is not federated, so a remote token or agent connection with no source grant cannot read its pages, and names `gbrain sources federate <id>` and `gbrain auth rescope --token <name> --sources <id>`. The stored default is still non-federated.' },
+ // GBRA-187 harness-eval items (HARN-2, HARN-5). `since` is stamped at the merge slot.
+ { since: '0.60.456.0', id: 'skillpack_skill_name', text: 'list_brain_skillpack now names each skill `name` instead of `slug`, and get_skill with source_id returns `name` too, matching the get_skill parameter it feeds. A skill name is not a page slug; clients that read `skills[].slug` read `skills[].name` instead.' },
+ { since: '0.60.456.0', id: 'openclaw_core_scaffold', text: '`gbrain skillpack scaffold --harness openclaw` now installs five brain-first skills (query, brain-ops, capture, data-loss-gate, resolve-before-asking) instead of the full bundle, because OpenClaw lists every workspace skill in every prompt. `--all` installs the full bundle; existing workspaces are not changed.' },
+ { since: '0.60.457.0', id: 'strict_landed_before_row_receipt', text: 'On a source configured `canonical: git`, a write whose door commit landed in Git before its database row and that then ends without committing (its grant revoked before the replay) now keeps `outcome.persistence = {git_state: committed, git_commit, landed_before_row: true}` on its receipt instead of an empty outcome, because the indexer will import those committed bytes. Other sources are unchanged.' },
+ { since: '0.60.459.0', id: 'claim_refuses_broken_worktree_link', text: 'Claiming a directory as a canonical worktree (a source add or claim with a path) now refuses `git_worktree_link_broken` when the directory is a linked Git worktree whose checkout moved or whose repository entry was pruned; it used to claim it, and its door commits would have gone nowhere. Run git worktree repair from the repository, or add the worktree again, then rerun.' },
+ // GBRA-190 G4 (fact fences). `since` is stamped at the merge slot.
+ { since: 'TBD', text: 'A legacy fact row whose `notability` or `confidence` is empty (a long-lived database whose column lost its NOT NULL) is now adopted into its page\'s `## Facts` table with the column default (notability `medium`, confidence 1) instead of being refused as unadoptable (`parse`) on every run, which held its page out of fact reconciliation and booked an `integrity_guard` halt each cycle. The fence cell is written first and the row derives its values from it. A row with no kind or visibility is still refused.' },
+ { since: 'TBD', text: '`gbrain repair duplicate-facts` keeps the copy that is a row of a page\'s `## Facts` table over an older database-only copy of the same fact, so the legacy copy is superseded onto the fence row instead of holding it (which left the legacy row unfenced and its page out of fact reconciliation). With no fenced copy it still keeps the oldest row. It stays preview-first and explicit.' },
+ { since: 'TBD', text: 'Dream consolidation on a managed brain now closes a fenced fact in its page: the closing `valid_until` is written into the fact\'s row in the entity page\'s `## Facts` fence, published with the take, and the database row takes its value from that cell, so a later sync or re-import keeps the fact closed. Before, only the database row was closed and the next re-import of the page reopened it. A fact with no fence row is still closed in the database. A fenced fact whose fence row is on another page is left open. Facts an earlier release closed in the database only are not changed (GBRA-190).' },
];
/** The newest disclosed change's release: the notice id moves only when a release adds rows. */