# jholhewres/devclaw architecture

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

- Interactive diagram: https://gitdiagram.com/jholhewres/devclaw
- Repository: https://github.com/jholhewres/devclaw

## Overview

DevClaw is a Go-based AI agent backend for teams, exposed through a CLI, WebUI, messaging channels, and an MCP server. The primary workflow is an interface submitting a request to the assistant, which uses an LLM and tools, incorporates persistent memory, and returns a response through that interface. The graph also preserves documented integrations and major subsystems. Source excerpts show selected wiring; README statements support the broader product branches, while unsampled implementation details and their internal call paths are omitted.

Main entry points: [`pkg/devclaw/copilot/assistant.go`](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/assistant.go) (Assistant agent loop), [`pkg/devclaw/webui/server.go`](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/webui/server.go) (WebUI server and API), [`cmd/devclaw/commands/chat.go`](https://github.com/jholhewres/devclaw/blob/master/cmd/devclaw/commands/chat.go) (CLI commands), [`web/src/App.tsx`](https://github.com/jholhewres/devclaw/blob/master/web/src/App.tsx) (Dashboard and setup UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI commands<br/>[chat.go]"]
  node_webui["WebUI server and API<br/>[server.go]"]
  node_webapp["Dashboard and setup UI<br/>[App.tsx]"]
  node_gateway["OpenAI-compatible gateway<br/>[handlers.go]"]
end

subgraph group_agent["Agent runtime"]
  node_assistant["Assistant agent loop<br/>[assistant.go]"]
  node_context["Context routing<br/>[context_router.go]"]
  node_llm["LLM providers and failover<br/>[llm.go]"]
  node_tools["Agent tools<br/>[tool_executor.go]"]
  node_subagents["Concurrent subagents<br/>[subagent.go]"]
end

subgraph group_integrations["Channels and integrations"]
  node_channels["Channel manager<br/>[manager.go]"]
  node_channeladapters["Messaging adapters<br/>[channel.go]"]
  node_mcp["MCP server<br/>[server.go]"]
  node_plugins["Plugin system<br/>[registry.go]"]
  node_skills["Skills catalog<br/>[catalog.go]"]
  node_media["Media service<br/>[service.go]"]
end

subgraph group_state["State and persistence"]
  node_memory[("Persistent memory<br/>[store.go]")]
  node_sessions[("Sessions and workspaces<br/>[session.go]")]
  node_database[("SQLite and PostgreSQL backends<br/>[factory.go]")]
end

subgraph group_operations["Operations and security"]
  node_oauth["OAuth credentials<br/>[token_manager.go]"]
  node_scheduler["Scheduled jobs<br/>[scheduler.go]"]
  node_vault["Encrypted secrets vault<br/>[vault.go]"]
  node_sandbox["Execution sandbox<br/>[runner.go]"]
end

node_users(("Team users and clients"))

node_users -->|"submit requests"| node_cli
node_users -->|"use dashboard"| node_webapp
node_users -->|"message agent"| node_channeladapters
node_webapp -.->|"call API"| node_webui
node_cli -->|"submit prompts"| node_assistant
node_gateway -->|"execute agent"| node_assistant
node_webui -.->|"serve assistant API"| node_assistant
node_channeladapters -->|"register channels"| node_channels
node_channels -.->|"deliver messages"| node_assistant
node_assistant -->|"build context"| node_context
node_context -->|"retrieve memories"| node_memory
node_assistant -->|"request completion"| node_llm
node_assistant -->|"invoke tools"| node_tools
node_assistant -->|"delegate tasks"| node_subagents
node_assistant -.->|"maintain sessions"| node_sessions
node_sessions -.->|"persist state"| node_database
node_memory -.->|"store memory"| node_database
node_assistant -.->|"expose MCP tools"| node_mcp
node_assistant -.->|"load extensions"| node_plugins
node_assistant -.->|"use skills"| node_skills
node_assistant -.->|"process media"| node_media
node_assistant -.->|"access secrets"| node_vault
node_assistant -.->|"run commands"| node_sandbox
node_scheduler -.->|"trigger jobs"| node_assistant
node_webui -->|"manage provider auth"| node_oauth

click node_cli "https://github.com/jholhewres/devclaw/blob/master/cmd/devclaw/commands/chat.go"
click node_webui "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/webui/server.go"
click node_webapp "https://github.com/jholhewres/devclaw/blob/master/web/src/App.tsx"
click node_gateway "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/gateway/handlers.go"
click node_assistant "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/assistant.go"
click node_context "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/context_router.go"
click node_llm "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/llm.go"
click node_tools "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/tool_executor.go"
click node_subagents "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/subagent.go"
click node_memory "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/memory/store.go"
click node_sessions "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/session.go"
click node_database "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/database/factory.go"
click node_channels "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/channels/manager.go"
click node_channeladapters "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/channels/channel.go"
click node_mcp "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/mcp/server.go"
click node_plugins "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/plugins/registry.go"
click node_skills "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/skills/catalog.go"
click node_media "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/media/service.go"
click node_oauth "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/oauth/token_manager.go"
click node_scheduler "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/scheduler/scheduler.go"
click node_vault "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/vault.go"
click node_sandbox "https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/sandbox/runner.go"

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_webui,node_webapp,node_gateway,node_users toneBlue
class node_assistant,node_context,node_llm,node_tools,node_subagents toneAmber
class node_channels,node_channeladapters,node_mcp,node_plugins,node_skills,node_media toneMint
class node_memory,node_sessions,node_database toneRose
class node_oauth,node_scheduler,node_vault,node_sandbox toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/jholhewres/devclaw/blob/master/cmd/devclaw/commands/chat.go): `cmd/devclaw/commands/chat.go`
- [WebUI server and API](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/webui/server.go): `pkg/devclaw/webui/server.go`
- [Dashboard and setup UI](https://github.com/jholhewres/devclaw/blob/master/web/src/App.tsx): `web/src/App.tsx`
- [OpenAI-compatible gateway](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/gateway/handlers.go): `pkg/devclaw/gateway/handlers.go`

### Agent runtime

- [Assistant agent loop](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/assistant.go): `pkg/devclaw/copilot/assistant.go`
- [Context routing](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/context_router.go): `pkg/devclaw/copilot/context_router.go`
- [LLM providers and failover](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/llm.go): `pkg/devclaw/copilot/llm.go`
- [Agent tools](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/tool_executor.go): `pkg/devclaw/copilot/tool_executor.go`
- [Concurrent subagents](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/subagent.go): `pkg/devclaw/copilot/subagent.go`

### Channels and integrations

- [Channel manager](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/channels/manager.go): `pkg/devclaw/channels/manager.go`
- [Messaging adapters](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/channels/channel.go): `pkg/devclaw/channels/channel.go`
- [MCP server](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/mcp/server.go): `pkg/devclaw/mcp/server.go`
- [Plugin system](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/plugins/registry.go): `pkg/devclaw/plugins/registry.go`
- [Skills catalog](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/skills/catalog.go): `pkg/devclaw/skills/catalog.go`
- [Media service](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/media/service.go): `pkg/devclaw/media/service.go`

### State and persistence

- [Persistent memory](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/memory/store.go): `pkg/devclaw/copilot/memory/store.go`
- [Sessions and workspaces](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/session.go): `pkg/devclaw/copilot/session.go`
- [SQLite and PostgreSQL backends](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/database/factory.go): `pkg/devclaw/database/factory.go`

### Operations and security

- [OAuth credentials](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/oauth/token_manager.go): `pkg/devclaw/oauth/token_manager.go`
- [Scheduled jobs](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/scheduler/scheduler.go): `pkg/devclaw/scheduler/scheduler.go`
- [Encrypted secrets vault](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/copilot/vault.go): `pkg/devclaw/copilot/vault.go`
- [Execution sandbox](https://github.com/jholhewres/devclaw/blob/master/pkg/devclaw/sandbox/runner.go): `pkg/devclaw/sandbox/runner.go`

### Other components

- **Team users and clients**

## Connections

- Team users and clients → CLI commands: submit requests (evidence: `README.md`)
- Team users and clients → Dashboard and setup UI: use dashboard (evidence: `README.md`)
- Team users and clients → Messaging adapters: message agent (evidence: `README.md`)
- Dashboard and setup UI → WebUI server and API: call API
- CLI commands → Assistant agent loop: submit prompts (evidence: `cmd/devclaw/commands/chat.go`)
- OpenAI-compatible gateway → Assistant agent loop: execute agent (evidence: `pkg/devclaw/gateway/handlers.go`)
- WebUI server and API → Assistant agent loop: serve assistant API
- Messaging adapters → Channel manager: register channels
- Channel manager → Assistant agent loop: deliver messages
- Assistant agent loop → Context routing: build context (evidence: `README.md`)
- Context routing → Persistent memory: retrieve memories (evidence: `pkg/devclaw/copilot/context_router.go`)
- Assistant agent loop → LLM providers and failover: request completion (evidence: `README.md`)
- Assistant agent loop → Agent tools: invoke tools (evidence: `README.md`)
- Assistant agent loop → Concurrent subagents: delegate tasks (evidence: `README.md`)
- Assistant agent loop → Sessions and workspaces: maintain sessions
- Sessions and workspaces → SQLite and PostgreSQL backends: persist state
- Persistent memory → SQLite and PostgreSQL backends: store memory
- Assistant agent loop → MCP server: expose MCP tools
- Assistant agent loop → Plugin system: load extensions
- Assistant agent loop → Skills catalog: use skills
- Assistant agent loop → Media service: process media
- Assistant agent loop → Encrypted secrets vault: access secrets
- Assistant agent loop → Execution sandbox: run commands
- Scheduled jobs → Assistant agent loop: trigger jobs
- WebUI server and API → OAuth credentials: manage provider auth
