Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript
5.9 KB
Raw Blame

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.

  1. Finish the migration. gbrain upgrade runs it. To be sure, run on the brain host:

    gbrain apply-migrations --yes --no-autopilot-install
    

    Four 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 every gbrain serve, autopilot and worker.

  2. 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 now
    

    Opt out (not recommended; large PGLite brains get slow again): gbrain config set planner.auto_analyze false or GBRAIN_PLANNER_AUTO_ANALYZE=0. gbrain config set import.analyze_every_pages <n> changes the import cadence (0 turns it off).

  3. 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: unrecorded means the row was written before this release or by a writer listed as unattributed in docs/architecture/system-of-record.md; it is not evidence of tampering.
    • gbrain repair attribution-backfill (preview) and --apply fill attribution only where the write journal proves the writer. Free and resumable; gbrain repair --all includes 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-run previews; an interrupted refresh prints its --resume or --abandon command. Writes refused with worktree_refreshing during 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-token and gbrain auth permissions <name> set-takes-holders still 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. Doctor legacy_token_grant_shape counts the rest; legacy_token_grant_drift means an older gbrain edited a migrated token: ask the user which grant is right, then run gbrain auth rescope --token <name> --adopt-permissions (keep the JSON edit) or --adopt-columns (keep the columns).
  4. 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-seat clears it. Opt out of seat capture: --seat off or GBRAIN_SEAT=off. Codex, opencode and cloud carriers print where to set GBRAIN_SEAT instead.

  5. 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 running

    gbrain embed --stale --catch-up
    

    Doctor embeddings shows the backlog and says "not applicable" on a keyless brain.

  6. Expect long syncs and slow boots to finish. A sync under its default or GBRAIN_SYNC_MAX_RUNTIME_SECONDS deadline keeps going while it makes progress and stops only after GBRAIN_SYNC_STALL_ABORT_SECONDS (900) without progress, printing code=sync_deadline_stop and the resume command. --hard-deadline and --timeout stay strict. gbrain serve's boot deadline counts time without progress, so a big brain's slow boot is not killed.

  7. Know about the get_health memo. Repeat get_health calls within 30 seconds with no page or config change return memoized counters with computed_at. gbrain config set health.cache_ttl_ms 0 (or GBRAIN_HEALTH_CACHE_TTL_MS=0) turns it off. Doctor always reads fresh.

  8. Verify:

    gbrain doctor
    gbrain attribution <slug of a page written after the upgrade>   # origin: request, with the writer named
    

    If a step fails, file an issue at https://github.com/garrytan/gbrain/issues with gbrain doctor output and ~/.gbrain/upgrade-errors.jsonl if it exists.