realm_id determines which config file is read and written.
Realm-scoped config
Every realm has its own config file and runtime state:config.toml(user settings)config_state.json(generation counter for CAS)realm_manifest.json(pinned backend + metadata)
- macOS:
~/Library/Application Support/meerkat/realms/<realm>/ - Linux:
~/.local/share/meerkat/realms/<realm>/ - Windows:
%APPDATA%\meerkat\realms\<realm>\
Effective precedence
For a given realm, effective settings are:- Built-in defaults
- Realm
config.toml - Environment overrides (secrets and supported runtime env overrides)
- Per-request runtime parameters (for example model/system prompt/tool toggles on create/resume calls)
Config APIs and CAS
RPC, REST, and MCP all expose the same config envelope:configgenerationrealm_idinstance_idbackendresolved_paths
config/setandconfig/patchaccept optionalexpected_generation- stale writes return generation conflict
Merge semantics
Meerkat uses two distinct update models:- Layered config loading (
defaults -> file -> env -> runtime) uses field-wise merge:
- scalar/option values: last non-default wins
- section values (for example
providers,store,comms,compaction): replace whole section - hook entries: append/extend
- Runtime patch APIs (
config/patch,PATCH /config) use RFC 7396 JSON merge-patch semantics.
config/set when replacing the whole config intentionally, and config/patch for surgical updates.
CLI behavior
CLI config commands operate on the selected realm:--realm, CLI uses the workspace-derived default realm (ws-...).
What about ~/.rkat/config.toml and .rkat/config.toml?
Those files still exist for compatibility and developer ergonomics (rkat init, legacy flows, and some layered hook loading behavior), but realm config is the canonical runtime configuration for CLI/RPC/REST/MCP surfaces.
Backend and storage settings
Session backend is pinned per realm inrealm_manifest.json (sqlite, redb, or jsonl).
--realm-backend only matters on first creation of a realm.
Compaction settings
Compaction runtime policy is configurable in realm config:session-compaction is enabled, AgentFactory maps these values into the runtime CompactionConfig.
