realm_id is the only identity key for sharing or isolating state across surfaces.
Core rules
- Same
realm_idmeans shared sessions, config, and runtime metadata. - Different
realm_idmeans strict isolation, even from the same folder. - Backend (
sqlite,redb, orjsonl) is pinned once per realm viarealm_manifest.json. - Realms are opaque strings. Reuse the same value to collaborate across surfaces.
Surface defaults
| Surface | If realm_id is not provided |
|---|---|
CLI (rkat run/resume/sessions) | Workspace-derived stable realm (ws-...) |
RPC (rkat-rpc) | New opaque realm (realm-...) |
REST (rkat-rest) | New opaque realm (realm-...) |
MCP server (rkat-mcp) | New opaque realm (realm-...) |
| Python/TypeScript SDK | Whatever the spawned rkat-rpc process picks (new opaque realm unless realm_id is passed) |
Explicit sharing
Use the same realm everywhere:Backend pinning
On first use, a realm writes a manifest with backend choice. Later opens must honor it.| First open | Manifest pins |
|---|---|
--realm-backend sqlite | sqlite |
--realm-backend redb | redb |
--realm-backend jsonl | jsonl |
| No hint | sqlite when compiled, otherwise the current build default |
Default backend and same-realm sharing
When SQLite support is compiled in, new persistent realms default tosqlite.
sqliteis the recommended backend for the normal Meerkat operating mode where multiple processes share one realm.redbremains explicitly selectable for single-owner embedded workflows.jsonlremains explicitly selectable for inspectable file-based persistence.
Config and CAS
Config is realm-scoped and generation-based.config/getreturns:config,generation,realm_id,instance_id,backend,resolved_paths.config/setandconfig/patchaccept optionalexpected_generation.- Stale writes fail deterministically with generation conflict.
Why this solves multi-surface concurrency
- 100 RPC servers from the same folder without
realm_iddo not collide. - 100 agents across RPC/REST/MCP/CLI with the same
realm_idsee the same state. - CLI workspace ergonomics remain simple without forcing filesystem identity onto non-CLI surfaces.
