rx follows a microkernel architecture.
The kernel is small. Everything else is a plugin or adapter.
+--------------------------+
| Transport Layer |
+--------------------------+
| Kernel Core |
+--------------------------+
| Tool Runtime |
+--------------------------+
| State Backend |
+--------------------------+
| Environment Adapters |
+--------------------------+
Each layer has strict responsibilities.
The kernel owns:
- Autonomous reasoning loop
- Tool dispatch
- Iteration control
- Termination evaluation
- Event emission
- State coordination
The kernel does NOT own:
- Filesystem logic
- Shell execution details
- Network implementation
- Persistence engine details
- Transport protocols
The kernel depends only on traits/interfaces.
Tools are isolated execution units.
A tool:
- Performs side effects.
- Returns structured output.
- Does not mutate kernel state directly.
Minimal interface:
trait Tool {
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
async fn execute(&self, input: ToolInput) -> ToolOutput;
}Tools must be:
- Idempotent where possible
- Deterministic given same inputs
- Observable (inputs + outputs logged)
Kernel invokes tools through a registry.
State is append-only and event-driven.
Kernel interacts with state through an abstraction:
trait StateStore {
fn load(&self, goal_id: &GoalId) -> State;
fn append_event(&self, event: Event);
}Phase 1:
- In-memory store
Phase 2:
- SQLite-backed event log
Kernel must not assume storage implementation.
Transport delivers goals to the kernel.
Examples:
- CLI
- HTTP API
- Background daemon
- Distributed worker
Transport responsibilities:
- Accept input goal
- Stream events
- Handle cancellation
Transport does NOT:
- Contain business logic
- Execute tools
- Modify state directly
Adapters wrap:
- Local filesystem
- Shell
- Network
- External services
They are consumed by tools.
Kernel never touches environment directly.
- Transport submits goal.
- Kernel loads state.
- Kernel requests next action from model.
- Tool invoked via registry.
- Tool returns output.
- Kernel appends event.
- Termination evaluated.
- Repeat.
- Kernel remains small.
- Tools contain side effects.
- State is append-only.
- Every action is logged.
- No hidden global state.
- No tight coupling between layers.
If a component:
- Requires environment access → it is a tool.
- Persists data → it is state backend.
- Decides next action → it is kernel.
- Exposes input/output interface → it is transport.
If the kernel grows large, responsibilities are leaking.
- Embedding tool logic in kernel.
- Calling shell directly from kernel.
- Letting prompt define architecture.
- Coupling storage to business logic.
- Over-designing distributed features before Phase 2.
rx must:
- Run fully offline.
- Be restartable.
- Be checkpointable.
- Be explainable in one page.