# getasterisk/claudia architecture

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

- Interactive diagram: https://gitdiagram.com/getasterisk/claudia
- Repository: https://github.com/getasterisk/claudia

## Overview

1. **Overall shape**
   - `opcode` is a **desktop application** built with **Tauri 2**: a **React + TypeScript** frontend in `src/` and a **Rust backend** in `src-tauri/`.
   - The app is a local “control center” for **Claude Code**: it manages projects, interactive sessions, custom agents, MCP servers, usage analytics, and session checkpoints.

2. **Frontend shell and composition**
   - The UI entrypoints are `src/main.tsx` and `src/App.tsx`, with most of the application assembled from `src/components/`.
   - State is split across React contexts and stores (`src/contexts`, `src/stores`) plus a set of hooks and utility libraries in `src/hooks` and `src/lib`.
   - The frontend is a feature-rich shell, not just a thin view layer: it owns most of the user interaction flow, navigation, persistence of UI state, and rendering of session/agent outputs.

3. **Claude Code session workspace**
   - The core user-facing experience is session/project management around Claude Code data under `~/.claude/projects/`.
   - Components such as `ProjectList`, `SessionList`, `ClaudeCodeSession`, `SessionOutputViewer`, and `RunningClaudeSessions` indicate a workflow where users browse projects, inspect session history, resume or continue work, and view live output.
   - The data shown in the UI comes from local filesystem state and backend commands rather than a remote service.

4. **Agent subsystem**
   - `CCAgents`, `CreateAgent`, `Agents`, `AgentExecution`, `AgentRunsList`, and related components implement a custom-agent layer on top of Claude Code.
   - Agents have configurable prompts, model selection, permissions, and execution history.
   - The backend supports this through Rust command handlers in `src-tauri/src/commands/agents.rs` and process-management code, which suggests agents can run as isolated background processes instead of inside the main UI process.

5. **Checkpoint / timeline subsystem**
   - The `checkpoint/` backend module (`manager.rs`, `state.rs`, `storage.rs`) and UI pieces like `CheckpointSettings`, `TimelineNavigator`, and the checkpoint hooks indicate a versioning system for Claude sessions.
   - This subsystem stores checkpoint state locally, lets the UI navigate timelines/branches, and supports restore/fork behavior for sessions.
   - Architecturally, this is a distinct persistence and recovery boundary layered over session history.

6. **MCP server management**
   - `MCPManager`, `MCPServerList`, `MCPAddServer`, and `MCPImportExport` implement management of Model Context Protocol servers.
   - Backend command handlers in `src-tauri/src/commands/mcp.rs` likely broker local configuration, validation, and import/export of server definitions.
   - This is another local configuration boundary: the app acts as a registry and editor for external tool integrations used by Claude Code.

7. **Claude binary and command orchestration**
   - `src-tauri/src/claude_binary.rs` and `src-tauri/src/commands/claude.rs` suggest the app shells out to the Claude Code CLI and wraps it in a safer, structured interface.
   - Additional command modules like `slash_commands.rs`, `proxy.rs`, and `usage.rs` indicate the backend mediates several Claude-facing operations: command invocation, proxying, and usage collection.
   - The Rust backend therefore acts as the orchestration layer between the UI and the external Claude CLI/runtime.

8. **Process isolation and execution registry**
   - `src-tauri/src/process/registry.rs` and the `process/` module point to explicit lifecycle management for child processes.
   - This matters architecturally because background agents and session operations are not assumed to be in-process UI tasks; they are supervised, tracked, and isolated by the Rust layer.
   - The README’s security model aligns with this: the app emphasizes separate processes and permission control per agent.

9. **Persistence and local data model**
   - Local persistence is split between frontend and backend responsibilities.
   - Frontend services like `sessionPersistence.ts` and `tabPersistence.ts` preserve UI/session navigation state, while backend storage commands and checkpoint storage handle app/domain data.
   - `src/stores/sessionStore.ts` and `agentStore.ts` likely provide the in-memory app state that sits on top of these persisted sources.

10. **Usage analytics and monitoring**
   - The `UsageDashboard` UI and `src/lib/analytics/*` form a local analytics subsystem for cost/token tracking.
   - This appears to be a client-side analytics pipeline with consent handling, event types, and resource monitoring, not a cloud analytics service.
   - It is a distinct reporting layer fed by usage data from Claude sessions and/or backend command output.

11. **UI feature modules and editing tools**
   - Several UI subsystems support the main workflows: CLAUDE.md editing, file picking, markdown preview, prompt composition, top-level tab management, and session output visualization.
   - These are mostly presentational and interaction-heavy components, but they matter architecturally because they define the user’s route through the app: discover projects, inspect sessions, edit instructions, run agents, review outputs.

12. **Optional web-server / alternate runtime boundary**
   - The presence of `src-tauri/src/web_server.rs`, `web_main.rs`, and `web_server.design.md` suggests a secondary serving/runtime path beyond the standard Tauri desktop shell.
   - This likely exists to support a local web-hosted mode, embedded preview, or shared backend serving architecture.
   - For a diagram, treat it as an alternate entrypoint around the same backend domain logic rather than a separate product.

13. **Build, packaging, and platform concerns**
   - The repo is cross-platform and ships through Tauri packaging, with Rust/Cargo on the backend and Bun/Vite on the frontend.
   - GitHub Actions workflows cover Linux, macOS, tests, and releases; platform-specific native dependencies are documented in the README.
   - The repository boundary is therefore “desktop app + local services + packaged installers,” not a web deployment.

14. **Key architectural boundary to diagram**
   - The most important boundary is between:
     - **React UI state and views**
     - **Tauri Rust commands / local orchestration**
     - **External local dependencies**: Claude Code CLI, filesystem (`~/.claude`), child processes, and local storage.
   - Most feature flows follow the same pattern: the UI invokes a Tauri command, the Rust backend reads/writes local state or launches a process, and results are streamed back into React components for display.

Main entry points: [`src-tauri/src/commands/mod.rs`](https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/mod.rs) (Command layer), [`src/App.tsx`](https://github.com/getasterisk/claudia/blob/main/src/App.tsx) (Root app), [`src/components/ClaudeCodeSession.tsx`](https://github.com/getasterisk/claudia/blob/main/src/components/ClaudeCodeSession.tsx) (Session workspace), [`src-tauri/src/commands/claude.rs`](https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/claude.rs) (Claude cmds)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React UI"]
  node_app_shell["App shell<br/>react-entry<br/>[main.tsx]"]
  node_app_root["Root app<br/>ui-composition<br/>[App.tsx]"]
  node_session_workspace["Session workspace<br/>session-ui"]
  node_project_browser["Project browser<br/>project-ui<br/>[ProjectList.tsx]"]
  node_session_history["Session history<br/>session-ui<br/>[SessionList.tsx]"]
  node_live_output["Live output<br/>session-viewer"]
  node_agent_workspace["Agent workspace<br/>agent-ui<br/>[Agents.tsx]"]
  node_agent_runs["Agent runs<br/>agent-history<br/>[AgentRunsList.tsx]"]
  node_checkpoint_ui["Checkpoint UI<br/>timeline-ui"]
  node_mcp_ui["MCP manager<br/>config-ui<br/>[MCPManager.tsx]"]
  node_usage_ui["Usage dashboard<br/>analytics-ui<br/>[UsageDashboard.tsx]"]
  node_state_layer["Client state<br/>react-state<br/>[sessionStore.ts]"]
end

subgraph group_backend["Tauri Rust"]
  node_commands_mod["Command layer<br/>tauri-commands<br/>[mod.rs]"]
  node_claude_cmds["Claude cmds<br/>command-handlers<br/>[claude.rs]"]
  node_agent_cmds["Agent cmds<br/>agent-backend<br/>[agents.rs]"]
  node_mcp_cmds["MCP cmds<br/>config-backend<br/>[mcp.rs]"]
  node_checkpoint_core["Checkpoint core<br/>timeline-store<br/>[manager.rs]"]
  node_process_registry["Process registry<br/>process-supervision<br/>[registry.rs]"]
  node_claude_binary["Claude binary<br/>cli-wrapper<br/>[claude_binary.rs]"]
  node_storage_cmds["Storage cmds<br/>local-storage<br/>[storage.rs]"]
end

subgraph group_runtime["Local Runtime"]
  node_filesystem[("Claude files<br/>local-filesystem")]
  node_claude_cli(("Claude Code<br/>external-cli"))
end

node_app_shell -->|"mounts"| node_app_root
node_app_root -->|"composes"| node_session_workspace
node_app_root -->|"composes"| node_agent_workspace
node_app_root -->|"composes"| node_mcp_ui
node_app_root -->|"composes"| node_usage_ui
node_app_root -->|"composes"| node_checkpoint_ui
node_session_workspace -->|"shows"| node_project_browser
node_session_workspace -->|"shows"| node_session_history
node_session_workspace -->|"renders"| node_live_output
node_session_workspace -->|"reads state"| node_state_layer
node_agent_workspace -->|"shows"| node_agent_runs
node_agent_workspace -->|"reads state"| node_state_layer
node_mcp_ui -->|"calls"| node_commands_mod
node_checkpoint_ui -->|"calls"| node_commands_mod
node_usage_ui -->|"calls"| node_commands_mod
node_commands_mod -->|"routes"| node_claude_cmds
node_commands_mod -->|"routes"| node_agent_cmds
node_commands_mod -->|"routes"| node_mcp_cmds
node_commands_mod -->|"routes"| node_checkpoint_core
node_commands_mod -->|"routes"| node_storage_cmds
node_claude_cmds -->|"wraps"| node_claude_binary
node_claude_cmds -->|"supervises"| node_process_registry
node_agent_cmds -->|"supervises"| node_process_registry
node_agent_cmds -->|"invokes"| node_claude_binary
node_checkpoint_core -->|"stores"| node_filesystem
node_mcp_cmds -->|"persists"| node_filesystem
node_storage_cmds -->|"reads/writes"| node_filesystem
node_claude_binary -->|"executes"| node_claude_cli
node_project_browser -->|"reads"| node_filesystem
node_session_history -->|"reads"| node_filesystem
node_live_output -->|"subscribes"| node_claude_cmds
node_agent_runs -->|"observes"| node_process_registry

click node_app_shell "https://github.com/getasterisk/claudia/blob/main/src/main.tsx"
click node_app_root "https://github.com/getasterisk/claudia/blob/main/src/App.tsx"
click node_session_workspace "https://github.com/getasterisk/claudia/blob/main/src/components/ClaudeCodeSession.tsx"
click node_project_browser "https://github.com/getasterisk/claudia/blob/main/src/components/ProjectList.tsx"
click node_session_history "https://github.com/getasterisk/claudia/blob/main/src/components/SessionList.tsx"
click node_live_output "https://github.com/getasterisk/claudia/blob/main/src/components/SessionOutputViewer.tsx"
click node_agent_workspace "https://github.com/getasterisk/claudia/blob/main/src/components/Agents.tsx"
click node_agent_runs "https://github.com/getasterisk/claudia/blob/main/src/components/AgentRunsList.tsx"
click node_checkpoint_ui "https://github.com/getasterisk/claudia/blob/main/src/components/TimelineNavigator.tsx"
click node_mcp_ui "https://github.com/getasterisk/claudia/blob/main/src/components/MCPManager.tsx"
click node_usage_ui "https://github.com/getasterisk/claudia/blob/main/src/components/UsageDashboard.tsx"
click node_state_layer "https://github.com/getasterisk/claudia/blob/main/src/stores/sessionStore.ts"
click node_commands_mod "https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/mod.rs"
click node_claude_cmds "https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/claude.rs"
click node_agent_cmds "https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/agents.rs"
click node_mcp_cmds "https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/mcp.rs"
click node_checkpoint_core "https://github.com/getasterisk/claudia/blob/main/src-tauri/src/checkpoint/manager.rs"
click node_process_registry "https://github.com/getasterisk/claudia/blob/main/src-tauri/src/process/registry.rs"
click node_claude_binary "https://github.com/getasterisk/claudia/blob/main/src-tauri/src/claude_binary.rs"
click node_storage_cmds "https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/storage.rs"

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_app_shell,node_app_root,node_session_workspace,node_project_browser,node_session_history,node_live_output,node_agent_workspace,node_agent_runs,node_checkpoint_ui,node_mcp_ui,node_usage_ui,node_state_layer toneBlue
class node_commands_mod,node_claude_cmds,node_agent_cmds,node_mcp_cmds,node_checkpoint_core,node_process_registry,node_claude_binary,node_storage_cmds toneAmber
class node_filesystem,node_claude_cli toneMint
```

## Components

### React UI

Desktop shell, feature views, and client-side state.

- [App shell](https://github.com/getasterisk/claudia/blob/main/src/main.tsx): react-entry · Bootstraps the desktop UI and top-level layout. · `src/main.tsx`
- [Root app](https://github.com/getasterisk/claudia/blob/main/src/App.tsx): ui-composition · Assembles navigation, panels, and feature modules. · `src/App.tsx`
- [Session workspace](https://github.com/getasterisk/claudia/blob/main/src/components/ClaudeCodeSession.tsx): session-ui · Project/session browsing, live output, and session history views. · `src/components/ClaudeCodeSession.tsx`
- [Project browser](https://github.com/getasterisk/claudia/blob/main/src/components/ProjectList.tsx): project-ui · Lists Claude Code projects and sessions from local data. · `src/components/ProjectList.tsx`
- [Session history](https://github.com/getasterisk/claudia/blob/main/src/components/SessionList.tsx): session-ui · Selects and navigates session records and replayable output. · `src/components/SessionList.tsx`
- [Live output](https://github.com/getasterisk/claudia/blob/main/src/components/SessionOutputViewer.tsx): session-viewer · Renders streamed messages and session output. · `src/components/SessionOutputViewer.tsx`
- [Agent workspace](https://github.com/getasterisk/claudia/blob/main/src/components/Agents.tsx): agent-ui · Creates, runs, and inspects custom Claude Code agents. · `src/components/Agents.tsx`
- [Agent runs](https://github.com/getasterisk/claudia/blob/main/src/components/AgentRunsList.tsx): agent-history · Shows agent execution state and run history. · `src/components/AgentRunsList.tsx`
- [Checkpoint UI](https://github.com/getasterisk/claudia/blob/main/src/components/TimelineNavigator.tsx): timeline-ui · Timeline navigation and checkpoint controls for sessions. · `src/components/TimelineNavigator.tsx`
- [MCP manager](https://github.com/getasterisk/claudia/blob/main/src/components/MCPManager.tsx): config-ui · Edits, imports, and lists local MCP server definitions. · `src/components/MCPManager.tsx`
- [Usage dashboard](https://github.com/getasterisk/claudia/blob/main/src/components/UsageDashboard.tsx): analytics-ui · Shows local token and cost analytics. · `src/components/UsageDashboard.tsx`
- [Client state](https://github.com/getasterisk/claudia/blob/main/src/stores/sessionStore.ts): react-state · Shared stores, contexts, and hooks for UI behavior and persistence. · `src/stores/sessionStore.ts`

### Tauri Rust

Local orchestration, commands, storage, and process supervision.

- [Command layer](https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/mod.rs): tauri-commands · Entry point for the Rust command handlers exposed to the UI. · `src-tauri/src/commands/mod.rs`
- [Claude cmds](https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/claude.rs): command-handlers · Wraps Claude CLI invocation, proxying, slash commands, and usage queries. · `src-tauri/src/commands/claude.rs`
- [Agent cmds](https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/agents.rs): agent-backend · Handles agent lifecycle, execution, and process-mediated runs. · `src-tauri/src/commands/agents.rs`
- [MCP cmds](https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/mcp.rs): config-backend · Validates and persists MCP server configuration. · `src-tauri/src/commands/mcp.rs`
- [Checkpoint core](https://github.com/getasterisk/claudia/blob/main/src-tauri/src/checkpoint/manager.rs): timeline-store · Manages checkpoint state, storage, and restore/fork logic. · `src-tauri/src/checkpoint/manager.rs`
- [Process registry](https://github.com/getasterisk/claudia/blob/main/src-tauri/src/process/registry.rs): process-supervision · Tracks and isolates child processes started by the app. · `src-tauri/src/process/registry.rs`
- [Claude binary](https://github.com/getasterisk/claudia/blob/main/src-tauri/src/claude_binary.rs): cli-wrapper · Resolves and shells out to the Claude Code CLI. · `src-tauri/src/claude_binary.rs`
- [Storage cmds](https://github.com/getasterisk/claudia/blob/main/src-tauri/src/commands/storage.rs): local-storage · Backend storage entry point for local app data. · `src-tauri/src/commands/storage.rs`

### Local Runtime

External tools and filesystem boundaries the app controls.

- **Claude files**: local-filesystem · Local Claude project data, checkpoints, config, and persisted state.
- **Claude Code**: external-cli · External CLI/runtime used for sessions and agent execution.

## Connections

- App shell → Root app: mounts · Bootstraps the main application shell.
- Root app → Session workspace: composes · Surfaces the primary session workflow.
- Root app → Agent workspace: composes · Surfaces agent management and execution.
- Root app → MCP manager: composes · Surfaces MCP configuration tools.
- Root app → Usage dashboard: composes · Surfaces analytics and usage reporting.
- Root app → Checkpoint UI: composes · Exposes timeline and checkpoint controls.
- Session workspace → Project browser: shows · Browses local Claude projects.
- Session workspace → Session history: shows · Lists session history for a selected project.
- Session workspace → Live output: renders · Displays streamed and archived session output.
- Session workspace → Client state: reads state · Uses shared client state and persistence hooks.
- Agent workspace → Agent runs: shows · Displays execution history and current runs.
- Agent workspace → Client state: reads state · Uses shared client state and settings.
- MCP manager → Command layer: calls · Invokes backend command handlers through Tauri.
- Checkpoint UI → Command layer: calls · Requests checkpoint operations from the backend.
- Usage dashboard → Command layer: calls · Fetches usage data and analytics summaries.
- Command layer → Claude cmds: routes · Dispatches Claude-facing operations.
- Command layer → Agent cmds: routes · Dispatches agent lifecycle operations.
- Command layer → MCP cmds: routes · Dispatches MCP configuration operations.
- Command layer → Checkpoint core: routes · Dispatches checkpoint and timeline operations.
- Command layer → Storage cmds: routes · Dispatches local storage operations.
- Claude cmds → Claude binary: wraps · Uses the CLI wrapper to invoke Claude Code.
- Claude cmds → Process registry: supervises · Tracks spawned work and long-lived tasks.
- Agent cmds → Process registry: supervises · Runs agents as isolated child processes.
- Agent cmds → Claude binary: invokes · Uses Claude Code as the execution backend.
- Checkpoint core → Claude files: stores · Persists checkpoint state and timeline data locally.
- MCP cmds → Claude files: persists · Reads and writes MCP server definitions locally.
- Storage cmds → Claude files: reads/writes · Accesses local app data and session artifacts.
- Claude binary → Claude Code: executes · Shells out to the external Claude Code CLI.
- Project browser → Claude files: reads · Loads project/session listings from local files.
- Session history → Claude files: reads · Reads session history and checkpoint metadata.
- Live output → Claude cmds: subscribes · Consumes backend-delivered session output and events.
- Agent runs → Process registry: observes · Displays tracked agent process state.
