Design principles
- Data over callbacks — module communication uses serialized JSON messages, not function pointers or trait objects
- Hot paths in-process — core routing and event merging happen in the main process; operational subsystems run as MCP modules
- Two modes — library mode (direct Rust calls) and RPC mode (JSON-RPC via stdio) for the same functionality
- Apps own policy, MobKit owns mechanism — applications decide who exists and who is wired; MobKit supplies the spawn, route, reconcile, persist, stream, and inspect machinery
High-level architecture
Crate structure
The core Rust crate is organized around explicit boundary modules:Module boundary
The module boundary layer provides two communication paths:MCP path (core modules)
Core modules expose MCP tools. The boundary callscall_module_mcp_tool_json with a tool name and arguments, receives a JSON response, and parses it into the expected type.
Subprocess path (custom modules)
Custom modules communicate over JSON lines on stdio. The boundary usesrun_process_json_line to send a request and read a response.
Event transport
The event transport merges two event sources: Events are sorted bytimestamp_ms. Same-timestamp events preserve source ordering (agent before module).
Supervisor design
The supervisor manages module processes with a simple state machine:HTTP composition
The runtime composes two Axum router layers:
Routers are merged into a single
axum::Router served on the configured port.
Dependencies
External crates
Meerkat crates
Security model
- Trusted modules — only modules declared in
mobkit.tomlare loaded - JWT validation — OIDC-based auth with local signature verification
- Email allowlist — access restricted to configured identities
- Non-ambient console credentials — console mutation routes expect bearer tokens or explicit SSE query tokens when auth is required
- Signed remote cross-mob contacts — TCP/UDS peer descriptors require real Ed25519 pubkeys; in-process wiring is authorized through the identity map
- Forged resolution detection — delivery validates routing resolutions against trusted store
- Rate limiting — per-route sliding window rate limits on delivery
See also
- Modules — module configuration
- Unified runtime guide — bootstrap details
- Decisions — policy enforcement
- Meerkat architecture — the companion runtime
