parent so it inherits config and credentials
from another realm. Resolution walks a single chain that always ends at the
reserved global realm.
This is what lets you sign in once and have every workspace pick up the
credential, share an MCP server or hook across many realms, and override one
model default in a child without redeclaring the rest.
The chain
Resolution for any realmhead produces an ordered chain:
-
A realm config doc may declare a parent edge:
-
A realm with no explicit
parentthat is not itselfglobalimplicitly parents toglobal. Soglobalis the universal default head of every realm chain — it is always the tail when it is configured. -
globalis the root: it may not declare a parent.
default realm:
shared credentials and config belong in a named parent or in global.
Resolution is fail-closed and panic-free:
An absent head realm is not an error on the non-explicit path: the chain is
just
[head] (contributing nothing) plus the implicit global tail, then the
env-default fallback applies as before. An explicitly named realm that does not
exist still errors.
What inherits and what does not
State never inherits. Config inherits.
- State is realm-local (no inheritance): sessions, SQLite/JSONL session
stores, event stores, ops snapshots, and the
.rkat/projection are all keyed by the consuming (head) realm. A child realm never sees a parent’s sessions or leases. - Config inherits down the chain: models, MCP servers, hooks, skills, limits, and auth bindings are composed parent-first with child-wins.
Credentials: reads inherit, writes are strict-owner
Credential resolution follows the chain, but writing a credential does not.- Reads inherit: a child realm can resolve a binding defined in a parent or
in
global. This is what makes a single sign-in usable everywhere. - Writes are strict-owner:
auth loginand config writes go to the realm that owns the binding (the realm whose config section defines it). You cannot write into an inherited binding’s doc from a child. Attempting to persist a credential for a child realm whose binding is inherited is rejected with a typed error naming the owning realm. config get/config setuse the raw head store (a read/write split), so an inherited entry is read through composition but never flattened into the child’s own doc on write. A read-modify-write cannot accidentally copy inherited entries down into the child.
Owning-realm provenance
When a binding is resolved, its identity records the realm that owns it (where it is defined), not the realm that requested it. So an inherited binding defined inglobal and used from realm team resolves and persists its token
under global, not team. This keeps the credential’s on-disk namespace and
its lease keyed to a single owning realm.
Provenance keys the realm-namespaced lease/
TokenKey (the OAuth-lease and
command-freshness leases). The resolved credential material for Env,
inline-secret, and command-output sources is realm-agnostic — an inherited
env-source binding yields the same credentials regardless of owning realm.MCP servers and hooks: add or override, never remove
A child realm composes MCP servers, hooks, and skill sources over its parents:- MCP servers are keyed by name: a child adds new servers and can override a same-named parent server, while inheriting the rest.
- Hooks append parent-first, then child (parents run before child hooks).
- Skill sources append parent-first; a child shadows a colliding source by identity without dropping the rest.
[tools] or [hooks] table does not delete
inherited entries — emptiness is not removal.
The global realm and single sign-in
global is a normal configured realm (unlike the ephemeral env_default
fallback), but it has two special properties:
- It is the implicit tail of every realm chain.
- Its config document is home-rooted at
~/.rkat/config.toml, a single well-known location, not a per-workspace file.
rkat auth login provisions the global realm in that home-rooted doc — both
the credential token and the [realm.global] binding section. Because global
is the tail of every chain, that single sign-in is inherited by every workspace
realm, across workspaces, with no per-realm re-login.
Migration from dev
Earlier versions persisted logins under a dev realm. On the run path, Meerkat
performs a one-time, idempotent migration to global:
- The credential token is copied from
dev:<binding>toglobal:<binding>when the global target is absent (no-clobber). - The matching
[realm.global]binding section is provisioned in the home-rooted global doc so the migrated token is resolvable.
See also
- Realms — identity and storage model
- Auth and bindings — credential resolution
- Configuration — realm-scoped config and merge
- Auth guide — login, OAuth, and per-binding usage
