# ultimatixarup/jervis architecture

> Architecture diagram of the GitHub repository ultimatixarup/jervis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ultimatixarup/jervis
- Repository: https://github.com/ultimatixarup/jervis

## Overview

Jervis is a personal macOS agent: typed requests enter an in-process CLI or the HTTP API, then Claude’s agent loop consults memory, applies permission and confirmation policy, and invokes MCP tools. Telegram and voice are alternate clients of the HTTP service. The README documents additional MCP capabilities whose implementation was not sampled; their nodes show the documented subsystems, not verified internal behavior. Unsampled modules and dynamic configuration mean some relationships are omitted.

Main entry points: [`voice/jervis_voice/loop.py`](https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/loop.py) (Voice loop), [`brain/jervis_brain/agent.py`](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/agent.py) (Claude agent), [`brain/jervis_brain/mcp_client.py`](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/mcp_client.py) (MCP client pool), [`brain/jervis_brain/server.py`](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/server.py) (HTTP API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_brain["Agent brain"]
  node_http["HTTP API<br/>[server.py]"]
  node_agent["Claude agent<br/>[agent.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_prompts["Prompt assembly<br/>[prompts.py]"]
  node_memory[("Conversation memory<br/>[memory.py]")]
  node_guard["Permission guard<br/>[permissions.py]"]
  node_tracing["Turn tracing<br/>[tracing.py]"]
  node_pool["MCP client pool<br/>[mcp_client.py]"]
end

subgraph group_interfaces["User interfaces"]
  node_cli["Typed CLI<br/>[cli.py]"]
  node_telegram["Telegram bot<br/>[bot.py]"]
  node_telegram_api["Telegram API client<br/>[api.py]"]
end

subgraph group_mcp["MCP capabilities"]
  node_macos["Mac tools<br/>[server.py]"]
  node_claudecode["Claude Code delegation<br/>[server.py]"]
  node_ubereats["Uber Eats tools<br/>[server.py]"]
  node_imessage["iMessage tools"]
  node_mail["Mail tools"]
  node_bank["Bank tools"]
end

subgraph group_voice["Voice interaction"]
  node_voice_loop["Voice loop<br/>[loop.py]"]
  node_audio["Audio capture<br/>[audio.py]"]
  node_states["Voice state machine<br/>[states.py]"]
  node_stt["Speech recognition<br/>[stt.py]"]
  node_vad["Speech detection<br/>[vad.py]"]
  node_wake["Wake detection<br/>[wake.py]"]
  node_tts["Speech synthesis<br/>[tts.py]"]
  node_brain_client["Brain HTTP client<br/>[brain.py]"]
end

node_user(("User"))
node_telegram_service["Telegram service"]
node_claude["Anthropic Claude"]

node_user -->|"asks"| node_cli
node_user -->|"messages"| node_telegram
node_user -->|"speaks"| node_voice_loop
node_cli -->|"runs in-process"| node_agent
node_telegram -->|"polls and replies"| node_telegram_api
node_telegram_api -->|"calls API"| node_telegram_service
node_telegram -->|"requests turns"| node_http
node_voice_loop -->|"reads frames"| node_audio
node_voice_loop -->|"dispatches events"| node_states
node_voice_loop -->|"transcribes"| node_stt
node_voice_loop -->|"detects speech"| node_vad
node_voice_loop -->|"checks wake word"| node_wake
node_voice_loop -->|"speaks response"| node_tts
node_voice_loop -->|"sends turns"| node_brain_client
node_brain_client -->|"HTTP requests"| node_http
node_http -->|"handles ask and confirm"| node_agent
node_http -->|"builds runtime"| node_pool
node_http -->|"loads settings"| node_config
node_agent -->|"requests completions"| node_claude
node_agent -->|"uses prompts"| node_prompts
node_agent -->|"reads and updates"| node_memory
node_agent -->|"authorizes tools"| node_guard
node_agent -->|"dispatches tool calls"| node_pool
node_agent -->|"records spans"| node_tracing
node_pool -->|"starts and routes tools"| node_macos
node_pool -->|"starts and routes tools"| node_claudecode
node_pool -.->|"starts and routes tools"| node_ubereats
node_pool -.->|"starts configured server"| node_imessage
node_pool -.->|"starts configured server"| node_mail
node_pool -.->|"starts configured server"| node_bank

click node_cli "https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/cli.py"
click node_http "https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/server.py"
click node_agent "https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/agent.py"
click node_config "https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/config.py"
click node_prompts "https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/prompts.py"
click node_memory "https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/memory.py"
click node_guard "https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/permissions.py"
click node_tracing "https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/tracing.py"
click node_pool "https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/mcp_client.py"
click node_telegram "https://github.com/ultimatixarup/jervis/blob/jervis/telegram/jervis_telegram/bot.py"
click node_telegram_api "https://github.com/ultimatixarup/jervis/blob/jervis/telegram/jervis_telegram/api.py"
click node_voice_loop "https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/loop.py"
click node_audio "https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/audio.py"
click node_states "https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/states.py"
click node_stt "https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/stt.py"
click node_vad "https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/vad.py"
click node_wake "https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/wake.py"
click node_tts "https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/tts.py"
click node_brain_client "https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/brain.py"
click node_macos "https://github.com/ultimatixarup/jervis/blob/jervis/mcp/macos/jervis_mcp_macos/server.py"
click node_claudecode "https://github.com/ultimatixarup/jervis/blob/jervis/mcp/claudecode/jervis_mcp_claudecode/server.py"
click node_ubereats "https://github.com/ultimatixarup/jervis/blob/jervis/mcp/ubereats/jervis_mcp_ubereats/server.py"
click node_imessage "https://github.com/ultimatixarup/jervis/tree/jervis/mcp/imessage"
click node_mail "https://github.com/ultimatixarup/jervis/tree/jervis/mcp/mail"
click node_bank "https://github.com/ultimatixarup/jervis/tree/jervis/mcp/bank"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_http,node_agent,node_config,node_prompts,node_memory,node_guard,node_tracing,node_pool,node_user toneBlue
class node_cli,node_telegram,node_telegram_api toneAmber
class node_macos,node_claudecode,node_ubereats,node_imessage,node_mail,node_bank toneMint
class node_voice_loop,node_audio,node_states,node_stt,node_vad,node_wake,node_tts,node_brain_client toneRose
class node_telegram_service,node_claude toneIndigo
```

## Components

### Agent brain

- [HTTP API](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/server.py): `brain/jervis_brain/server.py`
- [Claude agent](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/agent.py): `brain/jervis_brain/agent.py`
- [Configuration](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/config.py): `brain/jervis_brain/config.py`
- [Prompt assembly](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/prompts.py): `brain/jervis_brain/prompts.py`
- [Conversation memory](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/memory.py): `brain/jervis_brain/memory.py`
- [Permission guard](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/permissions.py): `brain/jervis_brain/permissions.py`
- [Turn tracing](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/tracing.py): `brain/jervis_brain/tracing.py`
- [MCP client pool](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/mcp_client.py): `brain/jervis_brain/mcp_client.py`

### User interfaces

- [Typed CLI](https://github.com/ultimatixarup/jervis/blob/jervis/brain/jervis_brain/cli.py): `brain/jervis_brain/cli.py`
- [Telegram bot](https://github.com/ultimatixarup/jervis/blob/jervis/telegram/jervis_telegram/bot.py): `telegram/jervis_telegram/bot.py`
- [Telegram API client](https://github.com/ultimatixarup/jervis/blob/jervis/telegram/jervis_telegram/api.py): `telegram/jervis_telegram/api.py`

### MCP capabilities

- [Mac tools](https://github.com/ultimatixarup/jervis/blob/jervis/mcp/macos/jervis_mcp_macos/server.py): `mcp/macos/jervis_mcp_macos/server.py`
- [Claude Code delegation](https://github.com/ultimatixarup/jervis/blob/jervis/mcp/claudecode/jervis_mcp_claudecode/server.py): `mcp/claudecode/jervis_mcp_claudecode/server.py`
- [Uber Eats tools](https://github.com/ultimatixarup/jervis/blob/jervis/mcp/ubereats/jervis_mcp_ubereats/server.py): `mcp/ubereats/jervis_mcp_ubereats/server.py`
- [iMessage tools](https://github.com/ultimatixarup/jervis/tree/jervis/mcp/imessage): `mcp/imessage`
- [Mail tools](https://github.com/ultimatixarup/jervis/tree/jervis/mcp/mail): `mcp/mail`
- [Bank tools](https://github.com/ultimatixarup/jervis/tree/jervis/mcp/bank): `mcp/bank`

### Voice interaction

- [Voice loop](https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/loop.py): `voice/jervis_voice/loop.py`
- [Audio capture](https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/audio.py): `voice/jervis_voice/audio.py`
- [Voice state machine](https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/states.py): `voice/jervis_voice/states.py`
- [Speech recognition](https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/stt.py): `voice/jervis_voice/stt.py`
- [Speech detection](https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/vad.py): `voice/jervis_voice/vad.py`
- [Wake detection](https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/wake.py): `voice/jervis_voice/wake.py`
- [Speech synthesis](https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/tts.py): `voice/jervis_voice/tts.py`
- [Brain HTTP client](https://github.com/ultimatixarup/jervis/blob/jervis/voice/jervis_voice/brain.py): `voice/jervis_voice/brain.py`

### Other components

- **User**
- **Telegram service**
- **Anthropic Claude**

## Connections

- User → Typed CLI: asks (evidence: `README.md`)
- User → Telegram bot: messages (evidence: `README.md`)
- User → Voice loop: speaks (evidence: `README.md`)
- Typed CLI → Claude agent: runs in-process (evidence: `README.md`)
- Telegram bot → Telegram API client: polls and replies (evidence: `telegram/jervis_telegram/bot.py`)
- Telegram API client → Telegram service: calls API (evidence: `telegram/jervis_telegram/api.py`)
- Telegram bot → HTTP API: requests turns (evidence: `telegram/jervis_telegram/bot.py`)
- Voice loop → Audio capture: reads frames (evidence: `voice/jervis_voice/loop.py`)
- Voice loop → Voice state machine: dispatches events (evidence: `voice/jervis_voice/loop.py`)
- Voice loop → Speech recognition: transcribes (evidence: `voice/jervis_voice/loop.py`)
- Voice loop → Speech detection: detects speech (evidence: `voice/jervis_voice/loop.py`)
- Voice loop → Wake detection: checks wake word (evidence: `voice/jervis_voice/loop.py`)
- Voice loop → Speech synthesis: speaks response (evidence: `voice/jervis_voice/loop.py`)
- Voice loop → Brain HTTP client: sends turns (evidence: `voice/jervis_voice/loop.py`)
- Brain HTTP client → HTTP API: HTTP requests (evidence: `README.md`)
- HTTP API → Claude agent: handles ask and confirm (evidence: `brain/jervis_brain/server.py`)
- HTTP API → MCP client pool: builds runtime (evidence: `brain/jervis_brain/server.py`)
- HTTP API → Configuration: loads settings (evidence: `brain/jervis_brain/server.py`)
- Claude agent → Anthropic Claude: requests completions (evidence: `README.md`)
- Claude agent → Prompt assembly: uses prompts (evidence: `brain/jervis_brain/agent.py`)
- Claude agent → Conversation memory: reads and updates (evidence: `brain/jervis_brain/agent.py`)
- Claude agent → Permission guard: authorizes tools (evidence: `brain/jervis_brain/agent.py`)
- Claude agent → MCP client pool: dispatches tool calls (evidence: `brain/jervis_brain/agent.py`)
- Claude agent → Turn tracing: records spans (evidence: `brain/jervis_brain/agent.py`)
- MCP client pool → Mac tools: starts and routes tools (evidence: `brain/jervis_brain/mcp_client.py`)
- MCP client pool → Claude Code delegation: starts and routes tools (evidence: `brain/jervis_brain/mcp_client.py`)
- MCP client pool → Uber Eats tools: starts and routes tools (evidence: `README.md`)
- MCP client pool → iMessage tools: starts configured server (evidence: `README.md`)
- MCP client pool → Mail tools: starts configured server (evidence: `README.md`)
- MCP client pool → Bank tools: starts configured server (evidence: `README.md`)
