# dgatom/dg-claw architecture

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

- Interactive diagram: https://gitdiagram.com/dgatom/dg-claw
- Repository: https://github.com/dgatom/dg-claw

## Overview

DG Claw runs self-hosted AI agents behind a web chat: a browser reaches the authenticated Web service, which routes messages to the appropriate persistent runner and its Claude Code or Codex session; replies return through the same path. The repository also includes agent administration, isolated agent resources, optional WhatsApp, document anonymization, and operational features such as task visibility, semantic memory, health checks, and emergency support. Unsampled subsystems are included where README capabilities establish their role; their internal wiring is not inferred.

Main entry points: [`panel/server.js`](https://github.com/dgatom/dg-claw/blob/main/panel/server.js) (Agent panel), [`web/server.js`](https://github.com/dgatom/dg-claw/blob/main/web/server.js) (DG Claw Web), [`runner/src/servidor.ts`](https://github.com/dgatom/dg-claw/blob/main/runner/src/servidor.ts) (Agent runner), [`web/lib/conversa.js`](https://github.com/dgatom/dg-claw/blob/main/web/lib/conversa.js) (Web conversation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Web access"]
  node_web["DG Claw Web<br/>[server.js]"]
  node_web_auth["Web authentication<br/>[auth.js]"]
  node_panel["Agent panel<br/>[server.js]"]
  node_panel_auth["Panel authentication<br/>[auth.js]"]
  node_web_chat["Web conversation<br/>[conversa.js]"]
  node_panel_chat["Panel conversation<br/>[conversa.js]"]
end

subgraph group_agents["Agents and sessions"]
  node_runner["Agent runner<br/>[servidor.ts]"]
  node_session_manager["Session manager<br/>[sessoes.ts]"]
  node_agent_container["Isolated agent container"]
  node_agent_vault["Per-agent key vault<br/>[cofre-agente.js]"]
end

subgraph group_operations["Agent operations"]
  node_apps["Agent applications<br/>[apps.js]"]
  node_task_desk["Task desk<br/>[mesa.js]"]
  node_semantic_memory["Semantic memory"]
  node_health["Health and safe mode<br/>[saude.js]"]
  node_emergency["Emergency support<br/>[socorro.js]"]
end

subgraph group_channels["User channels"]
  node_whatsapp["WhatsApp bridge<br/>[ponte.mjs]"]
end

subgraph group_capabilities["Product capabilities"]
  node_anonymize["Document anonymization<br/>[documentos.py]"]
  node_ooxml["Office document handling<br/>[ooxml.py]"]
  node_hidden_mode["Hidden display mode<br/>[anonimizar.js]"]
end

node_browser(("Browser user"))
node_proxy(("HTTPS proxy"))
node_model_cli(("Claude Code or Codex"))
node_whatsapp_user(("WhatsApp user"))

node_browser -->|"sends HTTPS"| node_proxy
node_proxy -->|"forwards requests"| node_web
node_web -->|"authenticates"| node_web_auth
node_web -->|"routes chat"| node_web_chat
node_web -->|"forwards messages"| node_runner
node_runner -->|"manages sessions"| node_session_manager
node_session_manager -->|"runs session"| node_model_cli
node_runner -->|"runs inside"| node_agent_container
node_web_chat -->|"returns replies"| node_browser
node_panel -->|"authenticates"| node_panel_auth
node_panel -.->|"routes conversation"| node_panel_chat
node_panel -->|"serves app data"| node_apps
node_apps -.->|"reads agent files"| node_agent_container
node_agent_container -.->|"uses isolated vault"| node_agent_vault
node_panel -.->|"shows task status"| node_task_desk
node_panel -.->|"offers memory search"| node_semantic_memory
node_panel -.->|"checks agent health"| node_health
node_panel -.->|"offers recovery guidance"| node_emergency
node_whatsapp_user -.->|"sends messages"| node_whatsapp
node_whatsapp -.->|"delivers messages"| node_runner
node_web -.->|"offers anonymization"| node_anonymize
node_anonymize -->|"handles Office formats"| node_ooxml
node_web -.->|"provides hidden mode"| node_hidden_mode

click node_web "https://github.com/dgatom/dg-claw/blob/main/web/server.js"
click node_web_auth "https://github.com/dgatom/dg-claw/blob/main/web/lib/auth.js"
click node_panel "https://github.com/dgatom/dg-claw/blob/main/panel/server.js"
click node_panel_auth "https://github.com/dgatom/dg-claw/blob/main/panel/lib/auth.js"
click node_web_chat "https://github.com/dgatom/dg-claw/blob/main/web/lib/conversa.js"
click node_panel_chat "https://github.com/dgatom/dg-claw/blob/main/panel/lib/conversa.js"
click node_runner "https://github.com/dgatom/dg-claw/blob/main/runner/src/servidor.ts"
click node_session_manager "https://github.com/dgatom/dg-claw/blob/main/runner/src/sessoes.ts"
click node_agent_vault "https://github.com/dgatom/dg-claw/blob/main/web/lib/cofre-agente.js"
click node_apps "https://github.com/dgatom/dg-claw/blob/main/panel/lib/apps.js"
click node_task_desk "https://github.com/dgatom/dg-claw/blob/main/web/lib/mesa.js"
click node_semantic_memory "https://github.com/dgatom/dg-claw/tree/main/scripts/memory_index"
click node_health "https://github.com/dgatom/dg-claw/blob/main/panel/lib/saude.js"
click node_emergency "https://github.com/dgatom/dg-claw/blob/main/panel/lib/socorro.js"
click node_whatsapp "https://github.com/dgatom/dg-claw/blob/main/canais/whatsapp/ponte.mjs"
click node_anonymize "https://github.com/dgatom/dg-claw/blob/main/anonimizar/documentos.py"
click node_ooxml "https://github.com/dgatom/dg-claw/blob/main/anonimizar/ooxml.py"
click node_hidden_mode "https://github.com/dgatom/dg-claw/blob/main/web/lib/anonimizar.js"

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_web,node_web_auth,node_panel,node_panel_auth,node_web_chat,node_panel_chat,node_browser,node_whatsapp_user toneBlue
class node_runner,node_session_manager,node_agent_container,node_agent_vault toneAmber
class node_apps,node_task_desk,node_semantic_memory,node_health,node_emergency toneMint
class node_whatsapp toneRose
class node_anonymize,node_ooxml,node_hidden_mode,node_proxy,node_model_cli toneIndigo
```

## Components

### Web access

- [DG Claw Web](https://github.com/dgatom/dg-claw/blob/main/web/server.js): `web/server.js`
- [Web authentication](https://github.com/dgatom/dg-claw/blob/main/web/lib/auth.js): `web/lib/auth.js`
- [Agent panel](https://github.com/dgatom/dg-claw/blob/main/panel/server.js): `panel/server.js`
- [Panel authentication](https://github.com/dgatom/dg-claw/blob/main/panel/lib/auth.js): `panel/lib/auth.js`
- [Web conversation](https://github.com/dgatom/dg-claw/blob/main/web/lib/conversa.js): `web/lib/conversa.js`
- [Panel conversation](https://github.com/dgatom/dg-claw/blob/main/panel/lib/conversa.js): `panel/lib/conversa.js`

### Agents and sessions

- [Agent runner](https://github.com/dgatom/dg-claw/blob/main/runner/src/servidor.ts): `runner/src/servidor.ts`
- [Session manager](https://github.com/dgatom/dg-claw/blob/main/runner/src/sessoes.ts): `runner/src/sessoes.ts`
- **Isolated agent container**
- [Per-agent key vault](https://github.com/dgatom/dg-claw/blob/main/web/lib/cofre-agente.js): `web/lib/cofre-agente.js`

### Agent operations

- [Agent applications](https://github.com/dgatom/dg-claw/blob/main/panel/lib/apps.js): `panel/lib/apps.js`
- [Task desk](https://github.com/dgatom/dg-claw/blob/main/web/lib/mesa.js): `web/lib/mesa.js`
- [Semantic memory](https://github.com/dgatom/dg-claw/tree/main/scripts/memory_index): `scripts/memory_index`
- [Health and safe mode](https://github.com/dgatom/dg-claw/blob/main/panel/lib/saude.js): `panel/lib/saude.js`
- [Emergency support](https://github.com/dgatom/dg-claw/blob/main/panel/lib/socorro.js): `panel/lib/socorro.js`

### User channels

- [WhatsApp bridge](https://github.com/dgatom/dg-claw/blob/main/canais/whatsapp/ponte.mjs): `canais/whatsapp/ponte.mjs`

### Product capabilities

- [Document anonymization](https://github.com/dgatom/dg-claw/blob/main/anonimizar/documentos.py): `anonimizar/documentos.py`
- [Office document handling](https://github.com/dgatom/dg-claw/blob/main/anonimizar/ooxml.py): `anonimizar/ooxml.py`
- [Hidden display mode](https://github.com/dgatom/dg-claw/blob/main/web/lib/anonimizar.js): `web/lib/anonimizar.js`

### Other components

- **Browser user**
- **HTTPS proxy**
- **Claude Code or Codex**
- **WhatsApp user**

## Connections

- Browser user → HTTPS proxy: sends HTTPS
- HTTPS proxy → DG Claw Web: forwards requests
- DG Claw Web → Web authentication: authenticates (evidence: `web/server.js`)
- DG Claw Web → Web conversation: routes chat (evidence: `web/server.js`)
- DG Claw Web → Agent runner: forwards messages
- Agent runner → Session manager: manages sessions (evidence: `runner/src/index.ts`)
- Session manager → Claude Code or Codex: runs session
- Agent runner → Isolated agent container: runs inside
- Web conversation → Browser user: returns replies
- Agent panel → Panel authentication: authenticates (evidence: `panel/server.js`)
- Agent panel → Panel conversation: routes conversation (evidence: `panel/server.js`)
- Agent panel → Agent applications: serves app data (evidence: `panel/server.js`)
- Agent applications → Isolated agent container: reads agent files
- Isolated agent container → Per-agent key vault: uses isolated vault
- Agent panel → Task desk: shows task status
- Agent panel → Semantic memory: offers memory search
- Agent panel → Health and safe mode: checks agent health
- Agent panel → Emergency support: offers recovery guidance
- WhatsApp user → WhatsApp bridge: sends messages
- WhatsApp bridge → Agent runner: delivers messages
- DG Claw Web → Document anonymization: offers anonymization
- Document anonymization → Office document handling: handles Office formats (evidence: `anonimizar/documentos.py`)
- DG Claw Web → Hidden display mode: provides hidden mode (evidence: `web/server.js`)
