Choosing a HiveMind Database Backend

July 31, 2026 · View on GitHub

Three first-party HiveMind database plugins ship under the hivemind.database entry-point group. They implement the same AbstractDB contract. The right pick depends on operational constraints, not feature differences.

hivemind-json-db-pluginhivemind-sqlite-databasehivemind-redis-database
StorageSingle JSON fileSingle SQLite DB fileRedis (single instance or cluster)
External daemonnonenoneRedis server
Encryption at restoptional AES-GCM (password=...)optional via sqlcipher extraTLS in transit; encryption at rest is Redis-side
Concurrent writerssingle-processsingle-process (SQLite WAL: multi-reader, single-writer)multi-process / multi-host
Indexed lookup on name / api_keylinear scan (O(n))indexed (O(log n) via column index)indexed (Redis sets + optional RediSearch)
Whole-file rewrite on commityesno (in-place SQL UPDATE)no (per-key SET)
Hand-editable on diskyes (any editor / jq)with sqlite CLIwith redis-cli
VCS-friendlyyesbinary blobn/a
Suitable for ≥ 10k clientsnoyesyes
Suitable for write-churnnoyesyes
Operationally minimalyesyesno (Redis to run / monitor / back up)
Multi-host fleetnonoyes

When to pick each

hivemind-json-db-plugin

  • Single HiveMind node.
  • Few dozen to a few thousand clients.
  • Static or slowly-changing fleet (provisioned once, edited rarely).
  • You want to cat, grep, git diff the database.
  • Dev / staging / CI environments.
  • Minimal containers that need no sqlite3 C lib or Redis daemon.

This is the default for hivemind-core and the right starting point unless you already know you have constraints that rule it out.

hivemind-sqlite-database

  • Single host, but write-heavy or large.
  • Indexed lookups on name / api_key matter (e.g. auth path on every connection).
  • You need encryption at rest with a real key-management story. Install the [cipher] extra and use sqlcipher.
  • You want WAL-mode multi-reader concurrency (read-only consumers can share with a live writer).

hivemind-redis-database

  • Multi-process or multi-host HiveMind deployments.
  • Shared client DB across a fleet (one Redis serving N HiveMind instances).
  • You already run Redis for other workloads and want one less data store to operate.
  • You need pub-sub or cache integration with HiveMind's client state.

Migration paths

All three implement the same AbstractDB, so moving data between them is a small Python script:

from hivemind_plugin_manager import DatabaseFactory

src = DatabaseFactory.create("hivemind-json-db-plugin")
dst = DatabaseFactory.create("hivemind-sqlite-db-plugin")

for client in src:
    if client.api_key == "revoked":
        continue   # skip tombstones, or copy them if you prefer
    dst.add_item(client)
dst.commit()

Then change database.module in server.json and restart. Keep the source DB until you're confident the destination holds.

JsonDB is the cheapest source to migrate from because its contents are already JSON. See Operations → Migration to another backend.

What's identical across backends

  • Client dataclass shape: same fields, same property shims, same metadata semantics.
  • The v1→v2 schema migration applies to all three (each implements AbstractDB.migrate() for its own storage shape; user-visible outcome is the same).
  • CLI behaviour from hivemind-core (add-client, list-clients, delete-client, etc.) is backend-independent.
  • Policy chain consumption: admission control and the OVOSAgentPolicy skill/intent blacklists work identically.

If you change backends, no application-level code should need to change. The differences are all operational.


← Troubleshooting · Home · Contributing →