Your personal AI nerve center β one interface, a team of evolving experts.
Nerv is an open-source personal AI operating system that gives you a single point of contact (Telegram, Email, Slack, or any channel you want) to command a team of specialized AI agents. Unlike chatbots that forget and frameworks that burn your wallet, Nerv routes every task to the right model at the right cost β and its agents get smarter over time.
The problem: Current AI assistants are either expensive black boxes (ChatGPT, Claude Pro) or token furnaces that cost $18 overnight doing nothing (OpenClaw's heartbeat sending 120K tokens to check if it's daytime). You shouldn't need a PhD to set one up, and you shouldn't need a trust fund to run one.
Nerv's answer:
| Pain point | How Nerv solves it |
|---|---|
| π₯ Token waste | A local router classifies your message in ~200 tokens, then picks the cheapest model that can handle it |
| π Single model | Multi-agent: Coder, Researcher, Writer β or auto-create a new expert on the fly |
| π Agents forget | Agents are permanent team members. They evolve with their field β your tax advisor updates itself when tax law changes |
| π± Locked to one app | Channel-agnostic: Telegram today, Slack tomorrow, email next week. One adapter, zero core changes |
| π€― CLI-only setup | GUI desktop app (Tauri). Hardware auto-detection. One-click model install. Your grandma could set it up* |
*your grandma's results may vary
You (Telegram / Slack / Email / CLI / WebChat)
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β Gateway (Rust) β
β Adapters Β· Sender allow-list Β· Queue β
β Supervises the brain (restart, timeout)β
βββββββββββββββββββββββββββββββββββββββββββ€
β Router (Local model, ~200 tok) β
β Intent classify Β· Model select β
ββββββββββ¬βββββββββ¬βββββββββ¬βββββββββββββββ€
β Coder βResearchβ Writer β Auto-created β β Agent Pool
β Haiku βSonnet β Gemini β (on demand) β
ββββββββββ΄βββββββββ΄βββββββββ΄βββββββββββββββ€
β Context Manager (Python) β
β Budgeted window Β· NOT full history β
ββββββββββββββββββββ¬βββββββββββββββββββββββ€
β Memory β Capability Layer β
β Markdown files β Native Tools Β· MCP β
ββββββββββββββββββββ΄βββββββββββββββββββββββ
Key insight: OpenClaw sends your entire conversation history (~120K tokens) with every single message. Nerv sends a bounded window instead: the agent's system prompt, a long-term facts file, and only as many recent messages as fit the agent's token budget β oldest first to be dropped. Days that fall outside the window survive as rolling summaries generated off the reply path, so summarizing never adds latency to a reply.
Integration direction: Nerv should be MCP-first for external apps and services. If a stable MCP server already exists for Chrome, GitHub, Notion, or another system, Nerv should use that before adding a bespoke integration. Native tools remain critical for core local capabilities and as fallbacks.
Nerv is a working system, not a design doc. What exists today, and where to read it:
| Subsystem | Status | Where |
|---|---|---|
| Router β intent classification + model tier selection from a small dedicated prompt, with an offline eval harness | β Built | brain/nerv/router/, brain/nerv/eval.py |
| Orchestrator + Agent Factory β task dispatch, runtime policy injection, on-demand specialist agent creation | β Built | brain/nerv/orchestrator/ |
| Tool / function calling β decorator-based registry that derives JSON schemas from Python signatures; 33 registered tools | β Built | brain/nerv/tools/ |
| MCP client β connect to external MCP servers, with builtin presets (e.g. Chrome DevTools) and a diagnostics tool | β Built | brain/nerv/mcp/ |
| MCP server β exposes Nerv's own tools over MCP, so a host like the Claude Code CLI can drive Nerv | β Built | brain/nerv/mcp_server/ |
Guardrails β workspace sandbox policy (config, personal/ secrets, and code directories are protected even inside the workspace); every tool with requires_confirmation, outward-acting tools (shell, desktop_control, send_email) and any path escaping the sandbox are suspended into a cross-process, file-locked approval queue and only run on explicit confirm <id> |
β Built | brain/nerv/security/ |
Channel authorization β every channel with a remote sender requires an explicit allow-list. Telegram fails closed: an empty allowed_users authorizes nobody and the gateway refuses to start the adapter |
β Built | core/shared/src/config.rs, core/gateway/src/adapter/ |
Brain supervision β the JSON-RPC client fails in-flight requests when the brain dies, respawns it up to restart_max, and bounds every call with a timeout |
β Built | core/shared/src/brain_client.rs |
Agent memory β conversation history partitioned by day and by sender/channel scope (JSON Lines, append-only, file-locked across processes), a long-term facts.md shared by the owner across channels, and a context manager that assembles a token-budgeted window (system prompt + facts + newest-first history, truncated to fit) rather than replaying full history |
β Built | brain/nerv/memory/ |
| Context summarization β past days outside the recency window are kept as rolling summaries, generated off the reply path | β Built | brain/nerv/memory/summarizer.py |
Pluggable model backends β provider-prefix scheme (claude-cli: / local: / litellm:) so swapping providers is a config edit, not a code change |
β Built | brain/nerv/llm/ |
| Skills / Workflows β markdown skill guidelines and YAML workflows run by a native executor | β Built | brain/nerv/skills/, brain/nerv/workflows/ |
| Gateway β Rust daemon, channel adapters, IPC to the brain | β Built | core/ |
| GUI β Tauri desktop shell | π§ Early | gui/ |
| Agent evolution β self-updating agent knowledge with version history and rollback | π§ Partial | brain/nerv/evolution.py |
| Agent Store | π Roadmap | β |
| Vector retrieval / RAG | β Not built β memory is file-backed and summary-based by design | β |
Size: 8.8k lines of Python in brain/nerv/, 2.1k lines of Rust in core/, and 3.9k lines of Python tests. A CI workflow lives in .github/workflows/ci.yml; this README does not claim it is passing. Test counts (brain figure collected earlier; the Rust figures were re-run locally after the latest changes):
| Suite | Command | Tests |
|---|---|---|
| Brain | cd brain && uv run pytest |
205 |
| Core (Rust) | cd core && cargo test --workspace |
61 |
| GUI (Rust) | cd gui/src-tauri && cargo test |
9 |
CI also enforces ruff check, ruff format --check, cargo fmt --check, and
cargo clippy -D warnings.
No agent definitions ship with the repo (there is no agents/ preset directory); generated agents are written to personal/agents/.
No matching agent for your task? Nerv creates one on the spot, saves it, and reuses it next time. Over time you build a personal team of experts β from tax advisors to recipe planners.
Agents aren't disposable. They track their domain, update their knowledge when the field changes, and keep a version history you can roll back. Think of them as employees who read industry journals.
Nerv separates capability access from execution strategy:
- Capability Layer: Core local actions stay as native tools (
shell, files, memory, notifications). External apps and SaaS integrations should prefer MCP servers when available. - MCP-first Browsering: For interactive browser work, Nerv should prefer Chrome MCP (or another browser MCP server) over bespoke UI scripting. The current native
chrome_browserpath is an MVP fallback, not the long-term integration model. - Skills: Markdown guidelines that teach Agents how to think and evaluate (e.g., "How to review a resume").
- Workflows: Hardcoded YAML steps executed by a native
WorkflowExecutor. When an agent needs to perform a 10-step operational sequence, it delegates it to the Executor for predictability. Steps that need confirmation and have fixed arguments (the browser verbs) are approved once for the whole run: Nerv lists them and you replyconfirm <id>. A step whose arguments the model chooses while running stops the run until you confirm that step. - Parsimony Rule: Agents are instructed to prefer direct APIs and MCP-backed tools over heavy GUI automation. UI workflows are the fallback when lighter providers cannot complete the task.
A local model (free, runs on your machine) handles routing and heartbeats. Only complex tasks hit paid APIs. Model tiering:
| Tier | Model | Cost | Use case |
|---|---|---|---|
| 0 | Local Ollama (Qwen 7B) | $0 | Routing, simple Q&A, heartbeat |
| 1 | Gemini Flash / Groq Llama | Free tier | Code, summarization |
| 2 | Haiku / Gemini Pro | Low | Complex code, research |
| 3 | Sonnet / Opus | Market | Architecture, critical reasoning |
The backend is a config switch via a provider-prefix scheme on the model string
(claude-cli:<alias> | local:<ollama-model> | litellm:<model>). During the
current validation phase every tier runs on claude-cli:opus (your Claude Code
subscription β no API key, no per-token bill). The tiered local/cloud routing above
is the reserved target design: swap it back any time by editing models.tiers in
config β no code changes.
Telegram is just one adapter. The Gateway speaks a universal Message format. Adding a new channel = one new file, zero changes to the brain.
Each remote channel is gated by an allow-list, because the brain can run shell commands and read your filesystem. Conversation history is stored per sender, so two people on the same instance never see each other's messages.
~/.nerv/
βββ core/ β git clone this for a new user
βββ personal/ β your data, never leaves your machine
βββ evolving/ β auto-updating knowledge
Share your best agents with the community. Install a battle-tested "Legal Advisor" agent with one click. Like an app store, but for AI expertise.
β οΈ Nerv is currently in early active development. The core architecture is functional and we are building out additional integrations. Star the repo to follow along.
- macOS (Apple Silicon) or Linux
- Rust (latest stable)
- Python 3.11+ and uv
- A model backend β the default config uses the local Claude Code CLI (no API key). Ollama is only needed if you switch a tier to a
local:model;scripts/setup.shskips it unlessNERV_SETUP_OLLAMA=1. The script never pipes downloads into a shell and createsconfig.yamlwith mode 600.
git clone https://github.com/IShinji/Nerv.git
cd Nerv
# Setup python environment
cd brain
uv sync # add `--extra litellm` only if you use the dormant litellm: backend
# Run the test suite (205 tests, ~2s)
uv run pytest
# Run the gateway
cd ../core/gateway
cargo runNerv's tools can run shell commands and read your filesystem, so the Telegram
adapter refuses to start without an explicit allow-list. In config.yaml:
channels:
telegram:
enabled: true
bot_token: "<from @BotFather>"
allowed_users: ["123456789"] # your id β ask @userinfobotAn empty allowed_users authorizes nobody; the gateway logs an error and skips
the adapter rather than exposing an open bot.
config.yaml holds the bot token and allowed_users, and brain.python_command
is run as a program by the gateway. What protects it:
- The agent tools cannot read
config.yaml,personal/or~/.nerv, and writingconfig.yamlor the code directories needs yourconfirm <id>. setup.shcreatesconfig.yamlas mode 600, and the gateway warns at startup if it is group/world-accessible.- An unknown
python_commandlauncher is refused unlessNERV_ALLOW_CUSTOM_PYTHON_COMMAND=1is set in the environment.
Two habits worth keeping: read the target path before you confirm a write that
touches config or code, and keep the file at mode 600. To move the config out of the
project tree, point NERV_CONFIG at a file elsewhere (for example under ~/.nerv/).
Use an absolute path: the gateway and the brain both read that one file, but they run
in different working directories.
- Token is money β Every LLM call needs justification. If a lightweight local 3B model can do it, local does it.
- Local first β Your data (memory, configuration) never leaves your machine.
- If it doesn't exist, create it β Unknown task type? The Agent Factory will generate a specialist agent automatically.
- MCP-first for integrations β Prefer standard MCP servers for external tools and applications; keep native integrations for core local capabilities and fallback paths.
- Fully decoupled β Channels, models, capability providers, agents β all pluggable, nothing hardcoded.
| Layer | Technology | Why |
|---|---|---|
| Core / Gateway | Rust | Zero-GC background daemon, native perf, IPC handling |
| Brain / Agents | Python | AI ecosystem, ML integrations, dynamic typing |
| Local Models | Ollama | Dead simple local inference |
We welcome contributions in Rust, Python, and documentation.
- β Star this repo
- π Open issues β feature requests, architecture feedback, design ideas
- π§ PRs β feel free to submit pull requests
MIT β use it, fork it, build on it.
Nerv β Your specialized AI operating system.