···4455## What is Ein
6677-Ein is a Rust-based AI agent framework with a client-server architecture. A gRPC server drives an LLM agent loop and executes tools implemented as pluggable WASM modules. Multiple model client plugins are supported (OpenRouter, Anthropic, OpenAI, Ollama). A terminal UI client (`ein-tui`) connects to the server and provides an interactive chat interface. Sessions are persisted to SQLite so conversations can be resumed across reconnects.
77+Ein is a Rust-based AI agent framework with a client-server architecture. A gRPC server drives an LLM agent loop and executes tools implemented as pluggable WASM modules. Multiple model client plugins are supported (OpenRouter, Anthropic, OpenAI, Ollama). A terminal UI client (`ein`) connects to the server and provides an interactive chat interface. Sessions are persisted to SQLite so conversations can be resumed across reconnects.
8899## Setup
10101111```bash
1212rustup target add wasm32-wasip2
1313cargo build # Build all crates
1414-cargo build -p ein-tui # Build just the TUI client
1414+cargo build -p ein # Build just the TUI client
1515cargo build -p eind # Build just the server
1616```
1717···4545cargo run --bin eind
46464747# Terminal 2 — start the TUI (connects to localhost:50051 by default)
4848-cargo run --bin ein-tui
4848+cargo run --bin ein
49495050# Optional: connect to a non-default server address
5151-cargo run -p ein-tui -- http://my-server:50051
5151+cargo run -p ein -- http://my-server:50051
5252```
53535454The server creates `~/.ein/sessions.db` on first run to persist session history.
···59596060```
6161┌─────────────────────────────┐ ┌──────────────────────────────┐
6262-│ ein-tui │ gRPC │ eind │
6262+│ ein │ gRPC │ eind │
6363│ │ (proto) │ │
6464│ Ratatui terminal UI │◄────────►│ Agent loop + tool executor │
6565│ Keyboard / render loop │ │ WASM plugin host │
···105105106106Database migrations live in `eind/migrations/`.
107107108108-### Client config (`crates/ein-tui/src/config.rs`)
108108+### Client config (`ein/src/config.rs`)
109109110110`ClientConfig` is loaded from (or created at) `~/.ein/config.json` on TUI startup. Structure mirrors `SessionConfig`. At startup the TUI shows a floating modal asking whether to add the current working directory to `allowed_paths` for that session; this is never persisted to `config.json`.
111111···129129130130**Plugin loading** (`src/tools.rs`): scans the plugin directory for `.wasm` files and instantiates each as a Wasmtime component. The filename stem (e.g. `ein_bash`) is used as the plugin's config identity to look up its entry in `plugin_configs`; global `allowed_paths`/`allowed_hosts` are merged with any plugin-specific overrides before the WASI context is built. After instantiation, `name()`/`schema()` are called to get the display name (e.g. `"Bash"`) and tool schema exposed to the model. In debug mode both tool and model client plugins are loaded from `./target/wasm32-wasip2/debug/`; in release mode tool plugins come from `~/.ein/plugins/tools/` and model client plugins from `~/.ein/plugins/model_clients/`.
131131132132-### TUI (`crates/ein-tui/`)
132132+### TUI (`ein/`)
133133134134-Six source files under `crates/ein-tui/src/`:
134134+Six source files under `ein/src/`:
135135136136| File | Role |
137137|------|------|
···4455```
66┌─────────────────────────────┐ ┌──────────────────────────────┐
77-│ ein-tui │ gRPC │ eind │
77+│ ein │ gRPC │ eind │
88│ │ (proto) │ │
99│ Ratatui terminal UI │◄────────►│ Agent loop + tool executor │
1010│ Session picker on startup │ │ WASM plugin host │
···2323cargo binstall --git https://github.com/mstallmo/ein ein
2424```
25252626-This installs both `ein-tui` (terminal UI) and `eind` (gRPC agent server). You can also install them individually:
2626+This installs both `ein` (terminal UI) and `eind` (gRPC agent server). You can also install them individually:
27272828```bash
2929-cargo binstall --git https://github.com/mstallmo/ein ein-tui
2929+cargo binstall --git https://github.com/mstallmo/ein ein
3030cargo binstall --git https://github.com/mstallmo/ein eind
3131```
3232···134134Start the TUI client in another:
135135136136```bash
137137-cargo run --bin ein-tui
137137+cargo run --bin ein
138138```
139139140140The TUI connects to `localhost:50051` by default. To connect to a different address:
141141142142```bash
143143-cargo run --bin ein-tui -- http://my-server:50051
143143+cargo run --bin ein -- http://my-server:50051
144144```
145145146146To enable debug logging to `~/.ein/tui.log`:
147147148148```bash
149149-cargo run --bin ein-tui -- --debug
149149+cargo run --bin ein -- --debug
150150```
151151152152On first connection a **session picker** modal appears. Use `↑`/`↓` to navigate, `Enter` to select:
···270270```
271271crates/
272272 ein-proto/ Protocol Buffer definitions (gRPC service + message types)
273273- eind/ gRPC server — agent loop, WASM plugin host, session persistence
274274- ein-tui/ Terminal UI client
273273+ein/ Terminal UI client
274274+eind/ gRPC server — agent loop, WASM plugin host, session persistence
275275packages/
276276 ein_tool/ WASM tool plugin interface (ToolPlugin trait, ToolDef, syscalls)
277277 ein_bash/ Bash tool plugin
···302302303303Sessions are persisted to `~/.ein/sessions.db`. Supplying a previously assigned `session_id` in `SessionConfig` causes the server to restore the full conversation history and resume as if the session never disconnected.
304304305305-### TUI modules (`crates/ein-tui/src/`)
305305+### TUI modules (`ein/src/`)
306306307307| File | Role |
308308|------|------|
···329329330330## Releasing
331331332332-Releases are fully automated via CI using [cargo-dist](https://axodotdev.github.io/cargo-dist/). Only the `crates/ein` meta-package is distributed — it includes both the `ein-tui` and `eind` binaries.
332332+Releases are fully automated via CI using [cargo-dist](https://axodotdev.github.io/cargo-dist/).
333333334334**1. Bump the version**
335335
···3344//! Ein TUI library.
55//!
66-//! Exposes [`run`] so both the standalone `ein-tui` binary and the `ein`
66+//! Exposes [`run`] so both the standalone `ein` binary and the `ein`
77//! meta-package binary can share the same entry-point without duplicating code.
8899mod app;
···9696 None
9797 };
98989999- info!(server_addr = %args.server_addr, "ein-tui starting");
9999+ info!(server_addr = %args.server_addr, "ein starting");
100100101101 // In release builds: download eind if absent, then register it as a
102102 // system service. Runs before raw mode so stdout is visible for progress.