Garry's Opinionated OpenClaw/Hermes Agent Brain
Upgrade to v0.51.0.0: coordinated concurrent writes
This upgrade adds schema migrations 150–159, durable write receipts, canonical revisions and explicit writer activation. Update every process that writes to this brain as one coordinated upgrade. Preserve existing agent identity, source routing, access grants, capture settings and enrichment preferences.
Before changing the brain
This is an operator-approved coordinated topology upgrade, not an automatic repair
for owner_unavailable. Startup, scheduled maintenance and doctor --fix must
stop at read-only writer status and ask the operator before changing ownership or
managed mode. Follow the state-bound administration procedure in
docs/architecture/topologies.md; do not run it just because a data-path error
mentions missing ownership.
- Inventory HTTP and stdio servers, CLIs, sync workers, maintenance jobs, connectors and external file editors on every host. Stop older writers and wait for in-flight work to settle. An unreachable owner needs external fencing before a verified transfer; a stale heartbeat is insufficient.
- Verify restorable backups of canonical worktrees, including private/gitignored files, and the database. Withdrawal decisions, receipts, registrations, credentials and intentional DB-only knowledge cannot be rebuilt from Markdown. Keep the backups until post-upgrade verification succeeds.
- Record
gbrain sources list --json, current operation/source/slug grants and writer status. Keep credentials private. Do not replace revoked registrations or broaden grants to make an upgrade pass.
Upgrade and inspect
Upgrade the host binary and first-party clients using their existing installation method. If upgrading from before v0.50.5.0, also follow that release's security upgrade instructions in CHANGELOG.md, including service restarts and any named host-environment or guardrails-path corrections; preserve the existing authorization ceiling. Supported native validation covers Bun 1.3.11 and 1.3.13; source installs use the bundled native prebuild and require no compiler or install-time download. Missing native support must be corrected before ownership or publication.
gbrain apply-migrations --yes
gbrain sources writer status --probe --json
gbrain auth local-writer list --json
Migrations add canonical identity/revision guards, the journal and local principals, exact lease tokens, text-projection seals, recoverable effects, managed writer guards, source topology and complete version deletion state. Previously unverified search projections are withheld until sanitized rebuild. Direct page reads remain available.
PGLite binds its single installation and uses separate durable CLI and stdio registrations. A live resident owner receives supported CLI operations through authenticated private IPC; failed IPC does not authorize a second datastore open. Postgres allows multiple request servers, with one designated publishing host per canonical worktree. On that host, claim each configured filesystem source using its actual local path:
gbrain sources writer claim default --path /absolute/canonical/source \
--admin-intent writer_claim --expected-state <reviewed-admin-state> --json
Inspect every affected source, owner epoch, native capability and outstanding recovery record. Retain the admin_state fingerprint from reviewed writer status, and inspect again after every change. A stale fingerprint refuses rather than applying to changed topology. Resolve recovery before moving a source or activating. Intentional DB-only sources remain DB-only.
Activate after every writer is ready
The confirmation flag asserts that older binaries, external editors and maintenance writers are quiesced on every host. Preview first:
gbrain sources writer activate --confirm-quiesced --dry-run --json
After verifying all owners and the preview, activate and inspect the result:
gbrain sources writer activate --confirm-quiesced \
--admin-intent writer_activate --expected-state <reviewed-admin-state> --json
gbrain sources writer status --probe --json
The intent must match the action; --confirm-quiesced alone cannot activate. A TTY
and generic --yes are not authorization. Deliberate noninteractive provisioning
uses the same reviewed preconditions; stdio and remote callers remain refused.
Managed enforcement allows coordinated writers and refuses unsupported canonical mutation paths. An expired lease does not prove a stopped writer. Do not delete a live coordination file or edit SQL/metadata to bypass a refusal.
Verify clients and a canonical write
Read an existing page with content and retain its revision. For a new replacement, pass expected_revision and a newly generated UUID request_id. Omit both revision and force only when creating an absent page. Use force: true solely for an intentional overwrite.
Keep the same ID, operation, arguments and source across response loss or token refresh. Inspect its receipt or repeat the original verb until terminal. queued, running and recovering are accepted pending states, not successful completion. The synchronous wait is five seconds with one-second polling guidance; owner downtime does not expire work. A committed replay returns the original result. Conflicting intent under the same ID is rejected.
Verify that a committed write can be read at its returned revision or later, with matching content and tags. Check its independent Git/embedding/mirror effects through the receipt. Withdrawn facts remain inactive even while a filesystem mirror is pending; ordinary search withholds stale projections until rebuilding completes. Healing and rebuilding compare their original chunk set and indexing context before installation, so delayed work cannot erase a newer completed projection. Embedding completion commits vectors and their provenance/context stamps together. Contextual reindexing also checks the originating projection, stored generation and source policy; superseded work returns a retryable outcome without replacing chunk text. Unsealed nonempty projections must be rebuilt before contextual provider work. Complete protected fences are filtered before either body column is split into chunks; direct historical page reads retain withdrawn history.
New grants include receipt tools. Older saved operation snapshots do not widen. If a caller needs get_write_request, list_write_requests or cancel_write_request, preview a complete replacement operation list preserving existing grants, then apply it with auth rescope-client --if-version using the observed revision. Follow the exact receipt-grant example. The seven-tool memory surface instead recovers by repeating remember or forget with its original ID.
Recovery and rollback
Local gbrain delete <slug> --purge uses the same durable journal. It removes the recorded file before committing hard deletion; a removal failure retains the prior page state. Preserve the original request ID: replaying a completed purge returns its stored outcome and cannot delete a recreated page. Purge remains local-only, and does not remove copies in history, exports or other retained records.
Use writer status for the blocked request, owner epoch, queue age/capacity and exact next action. Temporary capacity pressure queues work; permanent IDs are never evicted to admit new work. Increase reviewed quotas when approaching capacity. Keep recovery files and prior bytes until the owner verifies cleanup.
Rollback to old writers is supported only before managed activation and accepted managed writes. Afterwards use forward repair, or a fully drained downgrade with verified canonical state and retained withdrawal/receipt records. Never infer a safe rollback from a lost response. An unexpected file change requires explicit recovery; do not overwrite it speculatively.
See concurrent writes and durable receipts for the complete contract, source lifecycle, transfer and diagnostic commands.
Say to your agent: "Coordinate the concurrent-write upgrade across my writers, preserve my grants and memory preferences, then verify one committed page and its receipt before resuming work."