# openlair/dr-claw architecture

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

- Interactive diagram: https://gitdiagram.com/openlair/dr-claw
- Repository: https://github.com/openlair/dr-claw

## Overview

Dr. Claw is a local-first, model-agnostic AI research workspace. A researcher enters through the authenticated workspace, selects a project and starts a chat or research task; the backend routes agent work to a provider and manages project/session data. The product also includes research automation, skills, news discovery, references, compute resources, and project tools. The map uses the README for product capabilities and the supplied excerpts and source index for implementation links; several feature internals were not sampled, so uncertain connections are omitted or marked unverified.

Main entry points: [`server/index.js`](https://github.com/openlair/dr-claw/blob/main/server/index.js) (HTTP and Socket Server), [`server/openrouter.js`](https://github.com/openlair/dr-claw/blob/main/server/openrouter.js) (OpenRouter Provider), [`src/components/chat/view/ChatInterface.tsx`](https://github.com/openlair/dr-claw/blob/main/src/components/chat/view/ChatInterface.tsx) (Chat Interface), [`src/utils/api.js`](https://github.com/openlair/dr-claw/blob/main/src/utils/api.js) (API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Research Workspace"]
  node_app["Authenticated App<br/>[App.tsx]"]
  node_workspace_ui["Workspace UI"]
  node_chat_ui["Chat Interface<br/>[ChatInterface.tsx]"]
  node_chat_stream["Realtime Chat State"]
  node_sidebar["Project Sidebar"]
  node_api_client["API Client<br/>[api.js]"]
end

subgraph group_agent_runtime["Agent Runtime"]
  node_http_server["HTTP and Socket Server<br/>[index.js]"]
  node_provider_router["Agent Providers<br/>[claude-sdk.js]"]
  node_gemini_provider["Gemini Provider<br/>[gemini-cli.js]"]
  node_openrouter_provider["OpenRouter Provider<br/>[openrouter.js]"]
  node_codex_provider["Codex Provider<br/>[openai-codex.js]"]
end

subgraph group_project_state["Projects and State"]
  node_project_sessions["Project and Sessions<br/>[projects.js]"]
  node_session_database[("Application Database<br/>[db.js]")]
end

subgraph group_research_tools["Research Capabilities"]
  node_auto_research["Auto Research<br/>[auto-research.js]"]
  node_skills["Research Skills<br/>[skillExpander.js]"]
  node_news["News Discovery<br/>[news.js]"]
  node_references["Reference Library"]
  node_compute["Compute Resources<br/>[local-gpu.js]"]
end

subgraph group_integrations["External Services"]
  node_model_services{{"Model Services"}}
  node_project_files["Research Project Files"]
end

node_researcher(("Researcher"))

node_researcher -->|"opens"| node_app
node_app -->|"loads"| node_workspace_ui
node_researcher -->|"starts research"| node_chat_ui
node_chat_ui -.->|"handles stream"| node_chat_stream
node_chat_ui -.->|"requests data"| node_api_client
node_sidebar -->|"requests sessions"| node_api_client
node_api_client -->|"calls API"| node_http_server
node_http_server -->|"loads projects"| node_project_sessions
node_http_server -->|"dispatches Codex"| node_codex_provider
node_http_server -.->|"dispatches agents"| node_provider_router
node_http_server -.->|"dispatches Gemini"| node_gemini_provider
node_http_server -.->|"dispatches OpenRouter"| node_openrouter_provider
node_provider_router -.->|"queries models"| node_model_services
node_gemini_provider -.->|"queries models"| node_model_services
node_openrouter_provider -.->|"queries models"| node_model_services
node_openrouter_provider -->|"reconciles sessions"| node_project_sessions
node_openrouter_provider -->|"initializes project"| node_project_files
node_project_sessions -.->|"uses metadata store"| node_session_database
node_researcher -->|"launches workflows"| node_auto_research
node_auto_research -->|"uses providers"| node_provider_router
node_researcher -->|"applies skills"| node_skills
node_researcher -->|"browses research"| node_news
node_researcher -.->|"manages references"| node_references
node_researcher -->|"uses local compute"| node_compute

click node_app "https://github.com/openlair/dr-claw/blob/main/src/App.tsx"
click node_workspace_ui "https://github.com/openlair/dr-claw/blob/main/src/components/app/AuthenticatedWorkspace.tsx"
click node_chat_ui "https://github.com/openlair/dr-claw/blob/main/src/components/chat/view/ChatInterface.tsx"
click node_chat_stream "https://github.com/openlair/dr-claw/blob/main/src/components/chat/hooks/useChatRealtimeHandlers.ts"
click node_sidebar "https://github.com/openlair/dr-claw/blob/main/src/components/sidebar/hooks/useSidebarController.ts"
click node_api_client "https://github.com/openlair/dr-claw/blob/main/src/utils/api.js"
click node_http_server "https://github.com/openlair/dr-claw/blob/main/server/index.js"
click node_provider_router "https://github.com/openlair/dr-claw/blob/main/server/claude-sdk.js"
click node_gemini_provider "https://github.com/openlair/dr-claw/blob/main/server/gemini-cli.js"
click node_openrouter_provider "https://github.com/openlair/dr-claw/blob/main/server/openrouter.js"
click node_codex_provider "https://github.com/openlair/dr-claw/blob/main/server/openai-codex.js"
click node_project_sessions "https://github.com/openlair/dr-claw/blob/main/server/projects.js"
click node_session_database "https://github.com/openlair/dr-claw/blob/main/server/database/db.js"
click node_auto_research "https://github.com/openlair/dr-claw/blob/main/server/routes/auto-research.js"
click node_skills "https://github.com/openlair/dr-claw/blob/main/server/utils/skillExpander.js"
click node_news "https://github.com/openlair/dr-claw/blob/main/server/routes/news.js"
click node_references "https://github.com/openlair/dr-claw/blob/main/src/components/references/view/ReferencesPanel.tsx"
click node_compute "https://github.com/openlair/dr-claw/blob/main/server/local-gpu.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_app,node_workspace_ui,node_chat_ui,node_chat_stream,node_sidebar,node_api_client toneBlue
class node_http_server,node_provider_router,node_gemini_provider,node_openrouter_provider,node_codex_provider toneAmber
class node_project_sessions,node_session_database toneMint
class node_auto_research,node_skills,node_news,node_references,node_compute toneRose
class node_model_services,node_project_files,node_researcher toneIndigo
```

## Components

### Research Workspace

- [Authenticated App](https://github.com/openlair/dr-claw/blob/main/src/App.tsx): `src/App.tsx`
- [Workspace UI](https://github.com/openlair/dr-claw/blob/main/src/components/app/AuthenticatedWorkspace.tsx): `src/components/app/AuthenticatedWorkspace.tsx`
- [Chat Interface](https://github.com/openlair/dr-claw/blob/main/src/components/chat/view/ChatInterface.tsx): `src/components/chat/view/ChatInterface.tsx`
- [Realtime Chat State](https://github.com/openlair/dr-claw/blob/main/src/components/chat/hooks/useChatRealtimeHandlers.ts): `src/components/chat/hooks/useChatRealtimeHandlers.ts`
- [Project Sidebar](https://github.com/openlair/dr-claw/blob/main/src/components/sidebar/hooks/useSidebarController.ts): `src/components/sidebar/hooks/useSidebarController.ts`
- [API Client](https://github.com/openlair/dr-claw/blob/main/src/utils/api.js): `src/utils/api.js`

### Agent Runtime

- [HTTP and Socket Server](https://github.com/openlair/dr-claw/blob/main/server/index.js): `server/index.js`
- [Agent Providers](https://github.com/openlair/dr-claw/blob/main/server/claude-sdk.js): `server/claude-sdk.js`
- [Gemini Provider](https://github.com/openlair/dr-claw/blob/main/server/gemini-cli.js): `server/gemini-cli.js`
- [OpenRouter Provider](https://github.com/openlair/dr-claw/blob/main/server/openrouter.js): `server/openrouter.js`
- [Codex Provider](https://github.com/openlair/dr-claw/blob/main/server/openai-codex.js): `server/openai-codex.js`

### Projects and State

- [Project and Sessions](https://github.com/openlair/dr-claw/blob/main/server/projects.js): `server/projects.js`
- [Application Database](https://github.com/openlair/dr-claw/blob/main/server/database/db.js): `server/database/db.js`

### Research Capabilities

- [Auto Research](https://github.com/openlair/dr-claw/blob/main/server/routes/auto-research.js): `server/routes/auto-research.js`
- [Research Skills](https://github.com/openlair/dr-claw/blob/main/server/utils/skillExpander.js): `server/utils/skillExpander.js`
- [News Discovery](https://github.com/openlair/dr-claw/blob/main/server/routes/news.js): `server/routes/news.js`
- [Reference Library](https://github.com/openlair/dr-claw/blob/main/src/components/references/view/ReferencesPanel.tsx): `src/components/references/view/ReferencesPanel.tsx`
- [Compute Resources](https://github.com/openlair/dr-claw/blob/main/server/local-gpu.js): `server/local-gpu.js`

### External Services

- **Model Services**
- **Research Project Files**

### Other components

- **Researcher**

## Connections

- Researcher → Authenticated App: opens (evidence: `README.md`)
- Authenticated App → Workspace UI: loads (evidence: `src/App.tsx`)
- Researcher → Chat Interface: starts research (evidence: `README.md`)
- Chat Interface → Realtime Chat State: handles stream
- Chat Interface → API Client: requests data
- Project Sidebar → API Client: requests sessions (evidence: `src/components/sidebar/hooks/useSidebarController.ts`)
- API Client → HTTP and Socket Server: calls API (evidence: `src/utils/api.js`)
- HTTP and Socket Server → Project and Sessions: loads projects (evidence: `server/index.js`)
- HTTP and Socket Server → Codex Provider: dispatches Codex (evidence: `server/index.js`)
- HTTP and Socket Server → Agent Providers: dispatches agents (evidence: `server/index.js`)
- HTTP and Socket Server → Gemini Provider: dispatches Gemini (evidence: `server/index.js`)
- HTTP and Socket Server → OpenRouter Provider: dispatches OpenRouter (evidence: `server/index.js`)
- Agent Providers → Model Services: queries models
- Gemini Provider → Model Services: queries models
- OpenRouter Provider → Model Services: queries models
- OpenRouter Provider → Project and Sessions: reconciles sessions (evidence: `server/openrouter.js`)
- OpenRouter Provider → Research Project Files: initializes project (evidence: `server/openrouter.js`)
- Project and Sessions → Application Database: uses metadata store (evidence: `server/projects.js`)
- Researcher → Auto Research: launches workflows (evidence: `README.md`)
- Auto Research → Agent Providers: uses providers (evidence: `server/routes/auto-research.js`)
- Researcher → Research Skills: applies skills (evidence: `README.md`)
- Researcher → News Discovery: browses research (evidence: `README.md`)
- Researcher → Reference Library: manages references
- Researcher → Compute Resources: uses local compute (evidence: `README.md`)
