Garry's Opinionated OpenClaw/Hermes Agent Brain
Upgrade to v0.60.37.0: Foundations 1
This release makes large PGLite brains fast without manual tuning, records who created each row, tracks which agent seat a captured session came from, moves legacy tokens to the same grant shape as OAuth clients, and adds a safe way to fast-forward a managed checkout. Most of it needs nothing from you. The steps below are the ones an agent or a script around gbrain should know about.
Grant changes and anything that spends money need the user's agreement. Never
run gbrain auth rescope with a grant flag or gbrain embed --stale --catch-up
on the user's behalf without asking. The repairs below are free.
Finish the migration.
gbrain upgraderuns it. To be sure, run on the brain host:gbrain apply-migrations --yes --no-autopilot-installFour schema migrations run (v193-v196): creation attribution columns and triggers, the worktree refresh checkpoint table, the unified grant columns on
access_tokens, and planner-statistics accounting (PGLite only). None rewrites existing rows. Restart everygbrain serve, autopilot and worker.Know that PGLite now analyzes itself. Import, managed sync, the cycle, the idle consumer and the first read after a big write re-analyze tables whose rows changed enough. If the user asks why a read paused for a second after a large import, this is it. To check or force it:
gbrain doctor # planner_stats_stale names each stale table gbrain repair planner-stats --apply # analyze the stale tables nowOpt out (not recommended; large PGLite brains get slow again):
gbrain config set planner.auto_analyze falseorGBRAIN_PLANNER_AUTO_ANALYZE=0.gbrain config set import.analyze_every_pages <n>changes the import cadence (0 turns it off).Use the new commands.
gbrain attribution <slug> [--fact <id>] [--take <row>] [--timeline <id>] [--versions]shows who created and who last changed a page or one of its facts, takes or timeline entries (admin read).origin: unrecordedmeans the row was written before this release or by a writer listed as unattributed indocs/architecture/system-of-record.md; it is not evidence of tampering.gbrain repair attribution-backfill(preview) and--applyfill attribution only where the write journal proves the writer. Free and resumable;gbrain repair --allincludes it.gbrain sources refresh <source-id>fast-forwards a managed checkout while writers wait, then syncs every source in the worktree. Use it when a managed sync says the upstream moved.--dry-runpreviews; an interrupted refresh prints its--resumeor--abandoncommand. Writes refused withworktree_refreshingduring a refresh: retry the same request id after about a second.gbrain auth rescope --token <name>|--id <uuid>|--client <client-id>changes a token's or OAuth client's sources, read sources, takes holders or operations in place. With no grant flag it prints the stored grants.gbrain auth rescope-tokenandgbrain auth permissions <name> set-takes-holdersstill work as aliases.gbrain auth rescope --migrate-legacy --dry-run, then without--dry-run, writes the unified grant columns for every token still on the old shape. It changes no effective grant, so it does not need the user's agreement, but tell them it ran. Tokens otherwise migrate on their next grant change. Doctorlegacy_token_grant_shapecounts the rest;legacy_token_grant_driftmeans an older gbrain edited a migrated token: ask the user which grant is right, then rungbrain auth rescope --token <name> --adopt-permissions(keep the JSON edit) or--adopt-columns(keep the columns).
Name agent seats when several agents share one brain. Captured sessions record a seat, and dream-synthesized pages carry
seat: <label>. By default each harness home gets its own hashed seat. To give this agent a readable name:gbrain bootstrap hooks --harness claude-code --seat <label> # or: gbrain bootstrap harness --seat <label>A re-install keeps the seat;
--no-seatclears it. Opt out of seat capture:--seat offorGBRAIN_SEAT=off. Codex, opencode and cloud carriers print where to setGBRAIN_SEATinstead.Handle exit 11 from
gbrain embed --stale. A run that stops at its 30-minute budget with chunks left now exits 11 (was 0) and prints the remaining count and the resume command. Failures still exit 1. Treat 11 as "partial, resume later". Draining the rest makes paid embedding calls: ask the user before runninggbrain embed --stale --catch-upDoctor
embeddingsshows the backlog and says "not applicable" on a keyless brain.Expect long syncs and slow boots to finish. A sync under its default or
GBRAIN_SYNC_MAX_RUNTIME_SECONDSdeadline keeps going while it makes progress and stops only afterGBRAIN_SYNC_STALL_ABORT_SECONDS(900) without progress, printingcode=sync_deadline_stopand the resume command.--hard-deadlineand--timeoutstay strict.gbrain serve's boot deadline counts time without progress, so a big brain's slow boot is not killed.Know about the
get_healthmemo. Repeatget_healthcalls within 30 seconds with no page or config change return memoized counters withcomputed_at.gbrain config set health.cache_ttl_ms 0(orGBRAIN_HEALTH_CACHE_TTL_MS=0) turns it off. Doctor always reads fresh.Verify:
gbrain doctor gbrain attribution <slug of a page written after the upgrade> # origin: request, with the writer namedIf a step fails, file an issue at https://github.com/garrytan/gbrain/issues with
gbrain doctoroutput and~/.gbrain/upgrade-errors.jsonlif it exists.