Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript
11.7 KB
Raw Blame

v0.53.0.0: shared brain skills and content

Preserve the existing agent, knowledge folders, grant fences, finite spending caps, publication opt-outs, and capture settings. This migration adds a source-scoped canonical skill catalog and enrollment; it does not authorize scripts, new tools, paid enrichment, capture, or an identity rewrite.

Follow these steps on the brain host, then repeat the client steps for each installation, including the original parent. See the shared-skills guide for the operation and permission contracts.

1. Inventory and back up before changing anything

gbrain apply-migrations --dry-run --json

Read database, plan, and previews, including every source's stages and pending actions. A preview error is not an empty inventory. This path does not apply missing schema; if the schema is too old to inventory, take backups and apply the authorized upgrade, then preview again.

Back up both canonical files and operational database state. Markdown alone does not preserve grants, policies, memberships, revisions, revocations, withdrawals, or durable receipts. Keep credentials and backups private and verify recovery before declaring them protected. Do not open a running PGLite owner's database from a second process or remove its live lock.

If a source reports Files changed since migration inventory, show the user the listed paths. Accept them only with their agreement, using the --accept-reviewed-inventory <source>=<digest> command printed in that reason; never delete the checkpoint by hand. Line-ending rewrites (CRLF checkouts) count as changes, so pin *.md text eol=lf first.

2. Stop old writers and activate the host protocol

Stop old servers, workers, sync jobs, optimizers, and direct filesystem writers with access to the canonical roots. Drain or recover outstanding durable writes. Exclude old processes from root write access. This is an operator action; --confirm-quiesced records your attestation, not process isolation performed by the command. Shared unrestricted OS credentials are not an adversarial security boundary.

After the runtime/schema upgrade, inspect and claim each existing canonical root under the current host owner:

gbrain sources writer status --json
gbrain sources writer claim default --path /absolute/existing-content --dry-run --json

Review the designated owner, pending recovery and exact source/root. Deliberate changes need the action-specific administration intent and the admin_state from that reviewed status. For a required claim:

gbrain sources writer claim default --path /absolute/existing-content \
  --admin-intent writer_claim --expected-state "$REVIEWED_ADMIN_STATE" --json

Inspect and review fresh status after each successful change; never refresh the expected state merely to dismiss a conflict. If managed persistence is not yet enabled, activate it first with --confirm-quiesced --admin-intent writer_activate --expected-state "$REVIEWED_ADMIN_STATE" and review status again. Shared-skill activation is a separate state-bound change once that base protocol is enabled:

gbrain sources writer activate --shared-skills --confirm-quiesced --dry-run --json
gbrain sources writer activate --shared-skills --confirm-quiesced \
  --admin-intent writer_activate --expected-state "$REVIEWED_ADMIN_STATE" --json
gbrain apply-migrations --migration 0.53.0 --yes

The release note is v0.53.0.0; the migration dispatcher ID is 0.53.0. Activation raises the writer protocol floor for recoverable skill bundles. Do not downgrade the binary or disable the floor to resume an old writer. If quiescence or ownership cannot be established, leave shared publication pending; do not simulate activation by editing config or SQL.

3. If the source is database-only, export explicitly

Skip the existing-root claim for a DB-only source. First preview a destination that does not exist:

gbrain apply-migrations --migration 0.53.0 --export-db-only \
  --content-root /absolute/new-content --export-source default --dry-run --json

After stopping writers and verifying an operational backup, apply:

gbrain apply-migrations --migration 0.53.0 --export-db-only \
  --content-root /absolute/new-content --export-source default \
  --confirm-quiesced --backup-confirmed --yes

The export refuses with writer_not_quiesced while any maintenance lock row or queued, running or recovering durable write remains. The runner's own apply-migrations lease is not counted; on Postgres, inspect the others with SELECT id, holder_host, holder_pid FROM gbrain_cycle_locks.

--acknowledge-no-backup is the explicit alternative to --backup-confirmed, not an equivalent safety claim. An agent must not choose it for the user. The flag records operator testimony; it does not create or verify a backup.

Export validates Markdown round trips and raw-data sidecar hashes, retains the database, checkpoints the staging/root identity, binds the canonical owner, activates the skill writer protocol if step 2 has not, and installs the default pack.

If you activated shared skills in step 2, the root the export binds has no protocol-2 writer row yet, and the export stops with writer_not_quiesced ("The canonical owner capability changed after shared publication was activated"). After the root is bound, run the step 2 --shared-skills activation again (dry run, review fresh status, then apply with its new --expected-state); it now counts the new root. Then resume the same export.

Plain-directory sync of the exported root leaves skillpack.json and skills/ to the shared skill publisher, as managed Git sync does. It is bounded to 5,000 active pages per source, 5 MB per Markdown page, and 64 MiB per source. Unsafe/colliding paths, non-round-trippable data, facts/takes missing from canonical fences, changed files, or changed DB content block export instead of silently dropping data. This is not a full operational database export or a verified disaster-recovery restore.

Resume an interrupted export with the same root and source after inspecting its pending actions. Preserve staging files and checkpoints. Do not overwrite an existing destination, clear a conflict, or fabricate empty replacement pages.

4. Review source adoption and consent

Rerun the preview after host work. Registered knowledge stays in place; source-local packs are adopted through the canonical publisher. Unmanifested skills, malformed manifests, changed hashes, and ambiguous roots remain conflicts, not an invitation to replace files. A host-global catalog needs an explicit reviewed source assignment and is not copied to every source.

Existing mcp.publish_skills=false stays disabled. True remains prose-only; unset consent remains pending. Owner set_skill_policy approval is separate for following, audience, requirements, and additional file classes. Existing grants receive no permission changes from the content migration. Never add skill_editor or skill_publisher merely to make onboarding pass.

The migration saves per-source checkpoints and shared_skills.migration.v1. Its mechanical ledger entry may complete while pending_host_work or a source's action_required remains. Report those actions; do not claim fleet completion.

Read each source's member_installations when present. It reports known enrollments and their next actions, not an exhaustive inventory of disconnected devices. delivery_reported is only a client's artifact-delivery report; native_activation remains unverified.

5. Reconnect the parent and each client separately

Use the explicit follow regrant with the current client ID/revision. Omit --profile when preserving the existing permission snapshot, caps, and fences. New grants default to following; existing ones do not change unless explicitly regranted. Offer --skills memory-only without changing the user's other choices.

Deliver a current private handoff and newly issued token when scopes expand; repeat connect ... --install in the intended harness, not just on the host. Use a different principal for each independent installation. The original parent follows the same revisions and has no permanently privileged local copy.

Compare ownership hashes before changing local artifacts. Preserve edited copies as explicit conflicts/forks, and get authorization to disable any native shadow copy that could still win routing. No arbitrary home-directory scan, remote-device edit, or automatic deletion is part of migration. Disconnected and manual clients remain pending until they reconnect and complete their own steps.

For a connect-managed installation, inspect its own local status with gbrain connect --harness codex --status --json, substituting the actual adapter and connection name; thin CLI adapters also need their persistent --root. No credentials or host connection are required. current_authority: unprobed means it is a receipt inspection, not fresh authorization or native-use proof.

For an isolated local Grok Bot/Muse installation, use its upgraded recorded helper instead: bash /absolute/installation/bin/gbrain-setup --skills follow --json. Existing/adopted roots require that explicit choice; --skills memory-only preserves a memory-only install. The installation-bound router is included in the saved-instruction file, but native registration/use stays pending until observed. It does not borrow an ambient credential or configure another agent.

A legacy full/stub harness scaffold now returns a pending shared-brain migration plan rather than making a second bundled copy. Inspect its bridge-ledger inventory; explicitly remove unchanged owned copies only after review, and preserve modified/unowned copies until their native shadowing is resolved. Unavailable catalog access is not a reason to fall back to legacy copying.

6. Verify and keep rollback honest

Separate protocol retrieval, durable installed files, and actual native use. Claude Code, Codex, and opencode router installation reports restart_required and native-unverified; manual adapters do not become activated by receiving a catalog. Use the acceptance checklist with a synthetic skill, two independent clients, and the parent. Record the real harness/version and a new conversation; do not manufacture results.

Rollback means publishing reviewed prior content as a new revision under current authority, or leaving/disabling following while preserving files. There is no automatic content rollback command. A Git reset does not roll back permissions or operational state. Keep a compatible current runtime, preserve durable recovery records, and never lower the writer floor. Modified files and native cached instructions need explicit recovery actions.

Supported PGLite archives with shared-skill storage can be restored with gbrain backup restore ARCHIVE --into /absolute/new-root --json. Restore makes a new independent unpublished brain, rotates its brain/serving identity, deactivates memberships/leases, revokes archived credentials, and detaches canonical owners while retaining knowledge, history, and the writer floor. Read the restore/reconnect receipts and explicitly establish owners, policies, and new credentials before serving. Unresolved file recovery blocks restore. See archive restore for prerequisites and backup exclusions.

There is no same-identity recovery flag. External PostgreSQL dumps remain an operator-managed offline procedure. A stale backup cannot reveal newer withdrawals or revocations it lacks; validate those with the owner before serving. Leaving and forgetting do not promise physical erasure of history, source material, downloaded files, or private backups.