# atomicbot-ai/atomic-agent architecture

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

- Interactive diagram: https://gitdiagram.com/atomicbot-ai/atomic-agent
- Repository: https://github.com/atomicbot-ai/atomic-agent

## Overview

Atomic Agent is a local-first desktop/CLI AI agent. Its main workflow accepts a request through the CLI/TUI, chat channels, or an embedding interface; configures a model and runtime; runs an agent loop that can use tools; and preserves session context on disk. The graph includes README-documented capabilities and source-index-supported runtime links. Several feature implementations were not sampled, so their internal call relationships are not inferred.

Main entry points: [`src/agent/agent-contract.ts`](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/agent/agent-contract.ts) (Agent loop), [`src/runtime/bootstrap.ts`](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/runtime/bootstrap.ts) (Runtime bootstrap), [`src/cli/index.ts`](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/cli/index.ts) (CLI), [`src/channels/telegram/inbound-handler.ts`](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/channels/telegram/inbound-handler.ts) (Chat channels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_cli["CLI<br/>[index.ts]"]
  node_channels["Chat channels<br/>[inbound-handler.ts]"]
end

subgraph group_runtime["Agent runtime"]
  node_config["Configuration<br/>[config-schema.ts]"]
  node_bootstrap["Runtime bootstrap<br/>[bootstrap.ts]"]
  node_turn["Turn controller<br/>[turn-controller.ts]"]
  node_agent["Agent loop<br/>[agent-contract.ts]"]
  node_approval["Command approval<br/>[dangerous-tool.ts]"]
end

subgraph group_models["Models and tools"]
  node_localmodels["Local model runtime<br/>[index.ts]"]
  node_profiles["Model profiles"]
  node_skills["Skills<br/>[index.ts]"]
  node_browser["Browser tools"]
  node_shell["Shell and file tools<br/>[guard-engine.ts]"]
end

subgraph group_state["Local state"]
  node_memory[("Memory and embeddings")]
  node_sessions[("Session state<br/>[session-state.ts]")]
  node_tasks[("Scheduled tasks<br/>[tasks-schedule.ts]")]
end

subgraph group_integrations["Interfaces and integrations"]
  node_mcp["MCP tools<br/>[mcp-manager.ts]"]
  node_http["HTTP API<br/>[http-server.ts]"]
  node_sidecar["Desktop sidecar<br/>[main.ts]"]
  node_external{{"Cloud model providers"}}
  node_import["Agent data import<br/>[index.ts]"]
end

node_user(("User"))

node_user -->|"submits request"| node_cli
node_user -->|"sends message"| node_channels
node_cli -->|"loads settings"| node_config
node_cli -.->|"starts runtime"| node_bootstrap
node_channels -->|"invokes loop"| node_agent
node_bootstrap -->|"reads settings"| node_config
node_bootstrap -->|"connects local model"| node_localmodels
node_bootstrap -->|"prepares profile"| node_profiles
node_bootstrap -->|"prepares skills"| node_skills
node_turn -->|"runs turn"| node_agent
node_agent -->|"uses session context"| node_sessions
node_agent -->|"uses memory"| node_memory
node_agent -->|"uses browser"| node_browser
node_agent -->|"runs approved commands"| node_shell
node_agent -->|"checks dangerous tools"| node_approval
node_agent -->|"calls external tools"| node_mcp
node_agent -->|"uses cloud models"| node_external
node_agent -->|"schedules follow-ups"| node_tasks
node_user -->|"embeds agent"| node_http
node_user -->|"uses desktop app"| node_sidecar
node_user -->|"imports agent data"| node_import

click node_cli "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/cli/index.ts"
click node_channels "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/channels/telegram/inbound-handler.ts"
click node_config "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/config/config-schema.ts"
click node_bootstrap "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/runtime/bootstrap.ts"
click node_turn "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/runtime/turn-controller.ts"
click node_agent "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/agent/agent-contract.ts"
click node_approval "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/approval/dangerous-tool.ts"
click node_localmodels "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/local-llm/index.ts"
click node_profiles "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/llm/model-profile-manager.ts"
click node_memory "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/memory/embeddings/embedding-client.ts"
click node_sessions "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/session/session-state.ts"
click node_tasks "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/tools/tasks/tasks-schedule.ts"
click node_skills "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/skills/index.ts"
click node_shell "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/tools/os/shell-command-guard/guard-engine.ts"
click node_mcp "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/mcp/mcp-manager.ts"
click node_http "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/http/http-server.ts"
click node_sidecar "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/sidecar/main.ts"
click node_import "https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/import/index.ts"

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_cli,node_channels,node_user toneBlue
class node_config,node_bootstrap,node_turn,node_agent,node_approval toneAmber
class node_localmodels,node_profiles,node_skills,node_browser,node_shell toneMint
class node_memory,node_sessions,node_tasks toneRose
class node_mcp,node_http,node_sidecar,node_external,node_import toneIndigo
```

## Components

### User interfaces

- [CLI](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/cli/index.ts): `src/cli/index.ts`
- [Chat channels](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/channels/telegram/inbound-handler.ts): `src/channels/telegram/inbound-handler.ts`

### Agent runtime

- [Configuration](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/config/config-schema.ts): `src/config/config-schema.ts`
- [Runtime bootstrap](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/runtime/bootstrap.ts): `src/runtime/bootstrap.ts`
- [Turn controller](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/runtime/turn-controller.ts): `src/runtime/turn-controller.ts`
- [Agent loop](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/agent/agent-contract.ts): `src/agent/agent-contract.ts`
- [Command approval](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/approval/dangerous-tool.ts): `src/approval/dangerous-tool.ts`

### Models and tools

- [Local model runtime](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/local-llm/index.ts): `src/local-llm/index.ts`
- [Model profiles](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/llm/model-profile-manager.ts): `src/llm/model-profile-manager.ts`
- [Skills](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/skills/index.ts): `src/skills/index.ts`
- **Browser tools**
- [Shell and file tools](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/tools/os/shell-command-guard/guard-engine.ts): `src/tools/os/shell-command-guard/guard-engine.ts`

### Local state

- [Memory and embeddings](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/memory/embeddings/embedding-client.ts): `src/memory/embeddings/embedding-client.ts`
- [Session state](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/session/session-state.ts): `src/session/session-state.ts`
- [Scheduled tasks](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/tools/tasks/tasks-schedule.ts): `src/tools/tasks/tasks-schedule.ts`

### Interfaces and integrations

- [MCP tools](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/mcp/mcp-manager.ts): `src/mcp/mcp-manager.ts`
- [HTTP API](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/http/http-server.ts): `src/http/http-server.ts`
- [Desktop sidecar](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/sidecar/main.ts): `src/sidecar/main.ts`
- **Cloud model providers**
- [Agent data import](https://github.com/AtomicBot-ai/atomic-agent/blob/main/src/import/index.ts): `src/import/index.ts`

### Other components

- **User**

## Connections

- User → CLI: submits request (evidence: `README.md`)
- User → Chat channels: sends message (evidence: `README.md`)
- CLI → Configuration: loads settings (evidence: `src/cli/index.ts`)
- CLI → Runtime bootstrap: starts runtime
- Chat channels → Agent loop: invokes loop (evidence: `src/channels/telegram/inbound-handler.ts`)
- Runtime bootstrap → Configuration: reads settings (evidence: `src/runtime/bootstrap.ts`)
- Runtime bootstrap → Local model runtime: connects local model (evidence: `src/runtime/bootstrap.ts`)
- Runtime bootstrap → Model profiles: prepares profile (evidence: `src/runtime/bootstrap.ts`)
- Runtime bootstrap → Skills: prepares skills (evidence: `src/runtime/bootstrap.ts`)
- Turn controller → Agent loop: runs turn (evidence: `src/runtime/turn-controller.ts`)
- Agent loop → Session state: uses session context (evidence: `src/agent/agent-contract.ts`)
- Agent loop → Memory and embeddings: uses memory (evidence: `src/agent/agent-contract.ts`)
- Agent loop → Browser tools: uses browser (evidence: `README.md`)
- Agent loop → Shell and file tools: runs approved commands (evidence: `README.md`)
- Agent loop → Command approval: checks dangerous tools (evidence: `src/agent/agent-contract.ts`)
- Agent loop → MCP tools: calls external tools (evidence: `README.md`)
- Agent loop → Cloud model providers: uses cloud models (evidence: `README.md`)
- Agent loop → Scheduled tasks: schedules follow-ups (evidence: `README.md`)
- User → HTTP API: embeds agent (evidence: `README.md`)
- User → Desktop sidecar: uses desktop app (evidence: `README.md`)
- User → Agent data import: imports agent data (evidence: `README.md`)
