# abhinavdatta/neelima architecture

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

- Interactive diagram: https://gitdiagram.com/abhinavdatta/neelima
- Repository: https://github.com/abhinavdatta/neelima

## Overview

Neelima is a local-first desktop coding agent: users select a workspace and provider, send a task through the chat UI, review permission-gated tool calls, and receive changes that can be inspected or restored with Git checkpoints. Its main runtime spans the desktop interface, Tauri command boundary, agent/tool protocol, provider integrations, and workspace safety and persistence. The README documents the high-level flow; sampled source confirms key UI, agent, provider-webview, and workspace behavior. Some subsystem links rely on README documentation because their implementation excerpts were not provided.

Main entry points: [`src-tauri/src/agent.rs`](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/agent.rs) (Agent loop), [`ui/src/App.tsx`](https://github.com/abhinavdatta/neelima/blob/main/ui/src/App.tsx) (Application shell), [`ui/src/tauri.ts`](https://github.com/abhinavdatta/neelima/blob/main/ui/src/tauri.ts) (Command client), [`src-tauri/src/ui.rs`](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/ui.rs) (Desktop commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop interface"]
  node_app["Application shell<br/>[App.tsx]"]
  node_sidebar["Projects and tasks<br/>[Sidebar.tsx]"]
  node_chat["Chat and composer<br/>[Chat.tsx]"]
  node_workspace_ui["Workspace browser<br/>[FileTree.tsx]"]
  node_terminal_ui["Terminal panel<br/>[TerminalPanel.tsx]"]
  node_search_ui["Task search<br/>[SearchPane.tsx]"]
  node_provider_ui["Provider settings<br/>[SettingsModal.tsx]"]
  node_market_ui["Marketplace and automations"]
  node_store[("UI state store<br/>[store.ts]")]
  node_tauri_client["Command client<br/>[tauri.ts]"]
  node_commands["Desktop commands<br/>[ui.rs]"]
end

subgraph group_agent["Agent workflow"]
  node_agent_loop["Agent loop<br/>[agent.rs]"]
  node_protocol["Tool protocol<br/>[protocol.rs]"]
end

subgraph group_providers["Provider integrations"]
  node_providers_core["Provider dispatch<br/>[providers.rs]"]
  node_web_provider["Provider webview<br/>[webprov.rs]"]
  node_adapters["Provider adapters<br/>[adapters.rs]"]
  node_adapter_runtime["Injected adapter runtime<br/>[adapter_runtime.js]"]
  node_bridge["Provider bridge<br/>[bridge.rs]"]
end

subgraph group_workspace["Workspace and safety"]
  node_tools["Workspace file tools<br/>[tools.rs]"]
  node_workspace["Path confinement<br/>[workspace.rs]"]
  node_command_guard["Command safety<br/>[sec.rs]"]
  node_command_exec["Command execution<br/>[exec.rs]"]
end

subgraph group_local["Local state and services"]
  node_checkpoints[("Git checkpoints<br/>[checkpoints.rs]")]
  node_history[("Task history<br/>[history.rs]")]
  node_settings[("Settings store<br/>[settings.rs]")]
  node_terminal["PTY sessions<br/>[terminal.rs]"]
end

node_user(("User"))
node_web_chat["Provider web chat"]
node_local_models["Ollama and LM Studio"]

node_user -->|"uses"| node_app
node_app -->|"loads and updates"| node_store
node_app -->|"renders"| node_chat
node_app -->|"renders"| node_sidebar
node_app -->|"renders"| node_workspace_ui
node_user -->|"manages projects"| node_sidebar
node_sidebar -->|"invokes commands"| node_tauri_client
node_chat -->|"invokes commands"| node_tauri_client
node_user -->|"configures providers"| node_provider_ui
node_user -->|"browses files"| node_workspace_ui
node_user -->|"uses terminal"| node_terminal_ui
node_user -->|"searches tasks"| node_search_ui
node_user -->|"manages adapters"| node_market_ui
node_tauri_client -->|"dispatches commands"| node_commands
node_commands -->|"starts tasks"| node_agent_loop
node_commands -->|"manages sessions"| node_terminal
node_commands -->|"reads and saves"| node_settings
node_agent_loop -->|"parses tool calls"| node_protocol
node_agent_loop -->|"sends prompts"| node_providers_core
node_providers_core -->|"dispatches web requests"| node_web_provider
node_web_provider -->|"uses adapter"| node_adapters
node_web_provider -->|"injects runtime"| node_adapter_runtime
node_adapter_runtime -.->|"drives page"| node_web_chat
node_web_provider -->|"relays messages"| node_bridge
node_bridge -.->|"delivers replies"| node_agent_loop
node_providers_core -->|"sends requests"| node_local_models
node_agent_loop -.->|"requests approval"| node_chat
node_agent_loop -->|"executes tool calls"| node_tools
node_tools -->|"resolves confined paths"| node_workspace
node_agent_loop -->|"checks commands"| node_command_guard
node_agent_loop -->|"runs commands"| node_command_exec
node_command_exec -->|"uses workspace"| node_workspace
node_agent_loop -->|"snapshots writes"| node_checkpoints
node_agent_loop -->|"records transcripts"| node_history
node_provider_ui -.->|"loads and saves"| node_settings
node_search_ui -->|"searches history"| node_tauri_client
node_terminal_ui -->|"controls sessions"| node_tauri_client

click node_app "https://github.com/abhinavdatta/neelima/blob/main/ui/src/App.tsx"
click node_sidebar "https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/Sidebar.tsx"
click node_chat "https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/Chat.tsx"
click node_workspace_ui "https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/FileTree.tsx"
click node_terminal_ui "https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/TerminalPanel.tsx"
click node_search_ui "https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/SearchPane.tsx"
click node_provider_ui "https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/SettingsModal.tsx"
click node_market_ui "https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/MarketplacePane.tsx"
click node_store "https://github.com/abhinavdatta/neelima/blob/main/ui/src/store.ts"
click node_tauri_client "https://github.com/abhinavdatta/neelima/blob/main/ui/src/tauri.ts"
click node_commands "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/ui.rs"
click node_agent_loop "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/agent.rs"
click node_protocol "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/protocol.rs"
click node_providers_core "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/providers.rs"
click node_web_provider "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/webprov.rs"
click node_adapters "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/adapters.rs"
click node_adapter_runtime "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/adapter_runtime.js"
click node_bridge "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/bridge.rs"
click node_tools "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/tools.rs"
click node_workspace "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/workspace.rs"
click node_command_guard "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/sec.rs"
click node_command_exec "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/exec.rs"
click node_checkpoints "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/checkpoints.rs"
click node_history "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/history.rs"
click node_settings "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/settings.rs"
click node_terminal "https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/terminal.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,node_sidebar,node_chat,node_workspace_ui,node_terminal_ui,node_search_ui,node_provider_ui,node_market_ui,node_store,node_tauri_client,node_commands,node_user toneBlue
class node_agent_loop,node_protocol toneAmber
class node_providers_core,node_web_provider,node_adapters,node_adapter_runtime,node_bridge toneMint
class node_tools,node_workspace,node_command_guard,node_command_exec toneRose
class node_checkpoints,node_history,node_settings,node_terminal,node_web_chat,node_local_models toneIndigo
```

## Components

### Desktop interface

- [Application shell](https://github.com/abhinavdatta/neelima/blob/main/ui/src/App.tsx): `ui/src/App.tsx`
- [Projects and tasks](https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/Sidebar.tsx): `ui/src/components/Sidebar.tsx`
- [Chat and composer](https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/Chat.tsx): `ui/src/components/Chat.tsx`
- [Workspace browser](https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/FileTree.tsx): `ui/src/components/FileTree.tsx`
- [Terminal panel](https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/TerminalPanel.tsx): `ui/src/components/TerminalPanel.tsx`
- [Task search](https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/SearchPane.tsx): `ui/src/components/SearchPane.tsx`
- [Provider settings](https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/SettingsModal.tsx): `ui/src/components/SettingsModal.tsx`
- [Marketplace and automations](https://github.com/abhinavdatta/neelima/blob/main/ui/src/components/MarketplacePane.tsx): `ui/src/components/MarketplacePane.tsx`
- [UI state store](https://github.com/abhinavdatta/neelima/blob/main/ui/src/store.ts): `ui/src/store.ts`
- [Command client](https://github.com/abhinavdatta/neelima/blob/main/ui/src/tauri.ts): `ui/src/tauri.ts`
- [Desktop commands](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/ui.rs): `src-tauri/src/ui.rs`

### Agent workflow

- [Agent loop](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/agent.rs): `src-tauri/src/agent.rs`
- [Tool protocol](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/protocol.rs): `src-tauri/src/protocol.rs`

### Provider integrations

- [Provider dispatch](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/providers.rs): `src-tauri/src/providers.rs`
- [Provider webview](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/webprov.rs): `src-tauri/src/webprov.rs`
- [Provider adapters](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/adapters.rs): `src-tauri/src/adapters.rs`
- [Injected adapter runtime](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/adapter_runtime.js): `src-tauri/src/adapter_runtime.js`
- [Provider bridge](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/bridge.rs): `src-tauri/src/bridge.rs`

### Workspace and safety

- [Workspace file tools](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/tools.rs): `src-tauri/src/tools.rs`
- [Path confinement](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/workspace.rs): `src-tauri/src/workspace.rs`
- [Command safety](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/sec.rs): `src-tauri/src/sec.rs`
- [Command execution](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/exec.rs): `src-tauri/src/exec.rs`

### Local state and services

- [Git checkpoints](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/checkpoints.rs): `src-tauri/src/checkpoints.rs`
- [Task history](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/history.rs): `src-tauri/src/history.rs`
- [Settings store](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/settings.rs): `src-tauri/src/settings.rs`
- [PTY sessions](https://github.com/abhinavdatta/neelima/blob/main/src-tauri/src/terminal.rs): `src-tauri/src/terminal.rs`

### Other components

- **User**
- **Provider web chat**
- **Ollama and LM Studio**

## Connections

- User → Application shell: uses
- Application shell → UI state store: loads and updates (evidence: `ui/src/App.tsx`)
- Application shell → Chat and composer: renders (evidence: `ui/src/App.tsx`)
- Application shell → Projects and tasks: renders (evidence: `ui/src/App.tsx`)
- Application shell → Workspace browser: renders (evidence: `ui/src/App.tsx`)
- User → Projects and tasks: manages projects (evidence: `ui/src/components/Sidebar.tsx`)
- Projects and tasks → Command client: invokes commands (evidence: `ui/src/components/Sidebar.tsx`)
- Chat and composer → Command client: invokes commands (evidence: `ui/src/components/Chat.tsx`)
- User → Provider settings: configures providers
- User → Workspace browser: browses files
- User → Terminal panel: uses terminal
- User → Task search: searches tasks
- User → Marketplace and automations: manages adapters
- Command client → Desktop commands: dispatches commands
- Desktop commands → Agent loop: starts tasks (evidence: `src-tauri/src/ui.rs`)
- Desktop commands → PTY sessions: manages sessions (evidence: `src-tauri/src/ui.rs`)
- Desktop commands → Settings store: reads and saves (evidence: `src-tauri/src/ui.rs`)
- Agent loop → Tool protocol: parses tool calls (evidence: `src-tauri/src/agent.rs`)
- Agent loop → Provider dispatch: sends prompts (evidence: `src-tauri/src/agent.rs`)
- Provider dispatch → Provider webview: dispatches web requests (evidence: `src-tauri/src/providers.rs`)
- Provider webview → Provider adapters: uses adapter (evidence: `src-tauri/src/webprov.rs`)
- Provider webview → Injected adapter runtime: injects runtime
- Injected adapter runtime → Provider web chat: drives page
- Provider webview → Provider bridge: relays messages (evidence: `src-tauri/src/webprov.rs`)
- Provider bridge → Agent loop: delivers replies
- Provider dispatch → Ollama and LM Studio: sends requests
- Agent loop → Chat and composer: requests approval
- Agent loop → Workspace file tools: executes tool calls (evidence: `src-tauri/src/agent.rs`)
- Workspace file tools → Path confinement: resolves confined paths (evidence: `src-tauri/src/tools.rs`)
- Agent loop → Command safety: checks commands (evidence: `src-tauri/src/agent.rs`)
- Agent loop → Command execution: runs commands (evidence: `src-tauri/src/agent.rs`)
- Command execution → Path confinement: uses workspace (evidence: `src-tauri/src/exec.rs`)
- Agent loop → Git checkpoints: snapshots writes (evidence: `src-tauri/src/agent.rs`)
- Agent loop → Task history: records transcripts (evidence: `src-tauri/src/agent.rs`)
- Provider settings → Settings store: loads and saves
- Task search → Command client: searches history (evidence: `ui/src/components/SearchPane.tsx`)
- Terminal panel → Command client: controls sessions (evidence: `ui/src/components/TerminalPanel.tsx`)
