Garry's Opinionated OpenClaw/Hermes Agent Brain
version: 0.32.2 feature_pitch: headline: "Facts join the system-of-record — your hot memory now lives in markdown" description: "Backfills eligible legacy facts to existing canonical entity-page fences. Facts without a verified page or file remain in the database and need a database backup. Includes a 3-layer privacy strip and a CI gate for canonical write paths." recipe: null tiers: null
v0.32.2 Migration: facts join the system-of-record
What this is
This guide describes the current v0.32.2 orchestrator, including its safety
checks in v0.50.2.0. Eligible legacy facts are copied into a ## Facts
fence on an existing canonical entity page. Unresolved facts and other
DB-only knowledge are not reconstructible from Markdown alone; preserve a
restorable database backup as well as source files.
What the agent needs to do
For hosts with pending legacy facts:
- If upgrading from before v0.50.0.0, complete the
coordinated authorization cutover first. On a compatible
host, inspect
gbrain apply-migrations --listand preview the plan withgbrain apply-migrations --migration 0.32.2 --dry-run. After reviewing backups and affected sources, rungbrain apply-migrations --migration 0.32.2 --yes. - The orchestrator checks the schema, fences eligible facts, then verifies
that each page's fence and its indexed facts carry the same row numbers
(a duplicate active fence row may be indexed once; a page deleted after
all of its fenced rows expired is reported as
skipped_expired_no_page, not as drift, while a missing page with a live row still fails). Only live legacy rows with an existing source-scoped page and canonical file are eligible; on a brain without managed persistence, a database-only page (no recorded origin and no file at its slug path) is fenced in its database body when that write is database-only, and a source with a checkout but no owner andpersistence.unbound_writeunset leaves its rows asskipped_unbound_source. Missing targets are reported asskipped_no_page; no stub is created. Existing fence and database row numbers remain reserved. Row-number verification is not full content parity.--dry-runpreviews the migration plan; there is no--writeflag. - Dirty-tree refusal applies only to the source subtrees receiving writes.
If verification fails, inspect the reported drift before retrying. For a
wedged orchestrator,
gbrain apply-migrations --force-retry 0.32.2resets its retry marker; rerun the selected migration afterward.51is a schema migration number, not the orchestrator version accepted by--force-retry. - After completion:
git diffshows the new fences; user can commit them and the facts now live in git alongside the rest of the brain.
For brand-new v0.32.2 installs (rare):
The schema migration v51 creates the columns from the start (fresh-install parity via the v40 CREATE TABLE block). The v0_32_2 orchestrator has nothing to backfill (no legacy rows). Its schema, fencing, and verification phases complete without creating fact rows.
For thin-client installs:
Run migrations on the brain host, not the thin client. Host sources without
a local path are counted as skipped_no_local_path; their facts remain in
the database. Do not invent entity pages or delete unmatched facts to make
the migration appear complete.
Things that changed for the agent
gbrain forget <id>now rewrites markdown. Previouslygbrain forgetcalledengine.expireFact(id)which UPDATEd the DB only. After a rebuild of the database from the repo the forget would evaporate. v0.32.2 makes forget rewrite the fence: strikethrough the claim, setvalid_until=today, appendforgotten: <reason>to the context cell. New optional--reason <text>flag.MCP
get_pagestrips private fact rows for remote callers. Previously the strip fired only when the caller carried a takes- holders allow-list (a subagent privacy hole). v0.32.2 fires the strip wheneverctx.remote === true. Local CLI sees the full fence; subagent / remote MCP see world-only facts.The chunker strips private fact text.
chunkTextcallsstripFactsFence({keepVisibility:['world']})alongside the existingstripTakesFencebefore chunking. Private fact text never reachescontent_chunks.chunk_text, never gets embedded, never returned by search.CI invariant gate.
scripts/check-system-of-record.shis wired intobun run verify. It bans direct calls toengine.insertFact,addLink,addLinksBatch,addTimelineEntry,upsertTake,insertFacts,expireFactinsrc/+scripts/. Legitimate sites carry// gbrain-allow-direct-insert: <reason>comments on the same line. New code that tries to bypass the reconcile layer fails the build.New cycle phase
extract_factsruns betweenextractandrecompute_emotional_weight. Reconciles the DB facts index from the fence on every affected entity page. Empty-fence guard refuses to run while v0.31 legacy rows are pending the backfill (a belt to the orchestrator's suspenders).
Verification
After the agent runs the migration:
# Inspect migration status without applying other pending work
gbrain apply-migrations --list
# No fence write failures
test ! -f ~/.gbrain/facts.write_failures.jsonl || echo "WARN: some failures recorded"
# Each entity page with v0.31 facts now has a fence
ls people/ companies/ | head -5
grep -l 'gbrain:facts:begin' people/*.md | head -5
# Doctor passes
gbrain doctor
Things to NOT do
- Don't manually edit the v51 columns.
row_numandsource_markdown_slugare managed by the fence-write path. Edit the markdown fence instead; the cycle phase reconciles. - Don't call
engine.insertFact/expireFactfrom new code paths. The CI gate blocks it. If you genuinely need a direct write (e.g., for a new reconciler), add the// gbrain-allow-direct-insert: <reason>comment with a justification. - Don't delete the
facts.write_failures.jsonllog without reading it. It records pages where the fence parse-validate failed during a write; the .tmp file remains as quarantine evidence.
See also
docs/architecture/system-of-record.md— the canonical contract doc + the 3-layer privacy boundaryCHANGELOG.mdv0.32.2 entry — the release manifesto + numbersscripts/check-system-of-record.sh— the CI gate enforcing the rule going forward