Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript
7.2 KB
Raw Blame

version: 0.46.3 feature_pitch: headline: "Switch embedding providers only after a preview and explicit approval." one_liner: "Inspect the brain, choose a supported target, preview the cost, then approve a resumable migration." user_action_required: false triggers: - "switch embedding provider" - "migrate my embeddings" - "switch reranker" - "unsupported embedding provider" - "search stopped working after a provider shutdown"

Explicit-consent embedding migration

gbrain migrate embeddings moves the primary text embedding space to a supported model on both PGLite and Postgres. It coordinates schema, config, invalidation and a resumable re-embed. Changing a provider identifier or dimension in config alone does not convert stored vectors.

The original v0.46.3 notice concerned a hosted provider that retired on 2026-09-04. That integration, its switch command and its provider-ID self-hosting workaround have been removed. This file retains the generic migration workflow, not the obsolete provider-specific playbook. Original instructions are preserved at Git revision 6040075c6cb95be5881cc2e1b76ef7d71f4e5d29 (retained on 2026-09-23).

No upgrade, warning or old pending action item authorizes this work. Migration can delete incompatible vectors and incur a full re-embedding bill. Keep a verified full backup and obtain explicit approval for the selected brain, target model, dimensions, reranker action and a finite total USD cap before proceeding.

1. Inspect the intended brain without spending

Resolve the brain first using brain routing. This operation affects all sources in that brain, not just the current source. Only the brain's owner should perform it; a mounted consumer asks the owner.

gbrain migrate embeddings --status

Inspect the actual column widths, NULL-vector counts, page-signature census, config planes and any in-flight marker. Do not infer completion from the environment or a configured model name. No stored provenance should be rewritten to make an old vector appear to belong to a new model.

GBRAIN_EMBEDDING_MODEL and GBRAIN_EMBEDDING_DIMENSIONS override file config for every process. Conflicting values make a live migration refuse. Review the env in workers, cron and shells; coordinate any changes with the owner. Do not use --ignore-env-override to bypass an unexplained mismatch.

2. Choose a supported target and preview

Voyage's new-install default is voyage:voyage-4 at 1024 dimensions. One VOYAGE_API_KEY covers its embeddings and voyage:rerank-2.5 reranker. OpenAI is another supported option; text-embedding-3-small can retain an existing width up to 1536. Retaining the width avoids a schema resize, not the re-embed required for a different vector space. Local providers require an explicitly selected model and its real output width.

Configure the chosen key securely in the environment or the provider's file-plane API-key setting. Never print or copy the key into an action report.

gbrain migrate embeddings --to voyage:voyage-4 --dim 1024 --dry-run

Show the plan to the user: affected brain and sources, old and new widths, chunk count, estimated spend (or unavailable estimate), reranker action, pending fact vectors and any content-tier downgrade. 1280 is not a valid Voyage width; supported widths are 256/512/1024/2048. A width change rebuilds the dim-pinned text columns and indexes; image/multimodal columns stay separate.

3. Obtain approval, quiesce writers, then run

Confirm the backup and coordinate stopping or draining embedding writers before the migration. Do not stop services without the owner's approval. The plan warns about concurrent jobs; migration locks are not permission to ignore another writer.

Only after approval, replace --dry-run with --yes and supply the operator-selected total cap. Replace <approved-total-usd> with that approved amount; never invent a cap from the estimate or a suggested command:

gbrain migrate embeddings --to voyage:voyage-4 --dim 1024 \
  --max-cost-usd <approved-total-usd> --yes

Without --yes, an interactive caller must confirm; a non-TTY caller exits 2. --yes and a spending posture do not waive the required finite nonnegative cap. Batch size is not a spending bound. Admission reserves conservative per-attempt ceilings, not the preview's character-based estimate; unknown pricing or a missing input ceiling can refuse before dispatch. The live run probes the target before invalidation. A failed probe does not authorize a fallback provider or a different model, and its prior authorization debit can remain.

--reranker auto is the default companion action. Review it in the plan, or explicitly choose --reranker off, --reranker keep, or a supported model such as --reranker voyage:rerank-2.5. A failed reranker probe keeps its prior config and reports switch_failed; it is not successful reranker migration. OpenAI has no reranker on its key, so do not silently enable a third provider.

4. Verify actual state

gbrain migrate embeddings --status

Check target widths, remaining chunks and eligible facts, projection blockers, signature census, in-flight state and the recorded smoke-check result. A converged config value alone is not proof. Semantic retrieval is degraded for content not yet re-embedded. After approval for any provider calls, search for a known page as a separate behavioral check; distinguish that check from the spend-free status output.

Migration repairs eligible active fact vectors, including missing, stale-model, stale-text and wrong-width vectors. It excludes expired, withdrawn, superseded and audit rows; a nonzero remaining count is not completion. For a separate source-scoped repair, preview first and follow fact-vector repair with its own explicit approval and cap.

Recovery and boundaries

  • Inspect status after a kill or partial failure, then resume the same approved target once its blocker is resolved. Already-correct chunks/facts are retained. Prior debits survive interruptions; increasing --max-cost-usd authorizes a larger total, not a fresh allowance. Never clear the marker to reset spending.
  • A different in-flight target refuses. Use --retarget only after explicit approval to abandon that target and review the new cost.
  • A lost or held lock means paused, not complete. Inspect the reported lock and jobs before retrying; do not clear another writer's lock.
  • --no-embed stages schema/config/invalidation but does not complete a migration. Resume through gbrain migrate embeddings with the same approved target and authorization so its durable cap and verification remain in force.
  • Custom embedding_columns have no automatic migration here. Changing their model labels does not convert their vectors. Plan a separate, explicitly approved replacement or removal with the owner.
  • A keyless brain with embeddings disabled does not need paid migration merely because it was upgraded. Preserve that opt-out.

See the full migration reference for the transaction, resume and config-plane contracts.