# agentesgrok/openclaw-salvador architecture

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

- Interactive diagram: https://gitdiagram.com/agentesgrok/openclaw-salvador
- Repository: https://github.com/agentesgrok/openclaw-salvador

## Overview

This is the OpenClaw Mythos backend: it serves a Claude-powered chat interface and an OpenAI-compatible API, with queued task execution as another route to Claude. The main flow is a client request into the server, prompt handling, streamed Claude CLI output, and a response to the client. Supporting capabilities include session context, task persistence and memory, health monitoring, and a runtime security scan. The README is empty; unsampled server sections limit confidence about some route wiring.

Main entry points: [`backend/server.js`](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/server.js) (HTTP and Socket server), [`backend/claude-query.js`](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/claude-query.js) (CLI query wrapper), [`backend/services/task-runner.js`](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/task-runner.js) (Task queue runner), [`backend/services/llm-proxy/openai-compat.js`](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/llm-proxy/openai-compat.js) (OpenAI-compatible API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["API and chat"]
  node_backend_server["HTTP and Socket server<br/>[server.js]"]
  node_openai_proxy["OpenAI-compatible API<br/>[openai-compat.js]"]
  node_session_context["Session context<br/>[sessionContext.js]"]
end

subgraph group_execution["Claude execution"]
  node_claude_query["CLI query wrapper<br/>[claude-query.js]"]
end

subgraph group_state["Tasks and state"]
  node_task_runner["Task queue runner<br/>[task-runner.js]"]
  node_task_file[("Task records<br/>[tasks.json]")]
  node_memory_store["Memory store<br/>[memory-store.js]"]
  node_memory_files[("Memory files")]
end

subgraph group_operations["Operations"]
  node_health_checker["Health checker<br/>[health-checker.js]"]
  node_security_scan["Security self-scan<br/>[self-scan.js]"]
end

node_chat_client(("Chat client"))
node_openclaw_client(("OpenClaw client"))
node_claude_cli["Claude Code CLI"]

node_chat_client -->|"sends chat"| node_backend_server
node_backend_server -->|"streams prompts"| node_claude_query
node_backend_server -->|"uses context"| node_session_context
node_backend_server -->|"dispatches tasks"| node_task_runner
node_openclaw_client -->|"sends completions"| node_openai_proxy
node_openai_proxy -->|"streams prompts"| node_claude_query
node_task_runner -->|"runs task prompts"| node_claude_query
node_claude_query -->|"spawns process"| node_claude_cli
node_task_runner -->|"persists tasks"| node_task_file
node_task_runner -->|"appends changelog"| node_memory_store
node_memory_store -->|"reads and writes"| node_memory_files
node_backend_server -->|"checks health"| node_health_checker
node_health_checker -->|"checks throttle"| node_claude_query
node_backend_server -->|"runs scan"| node_security_scan

click node_backend_server "https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/server.js"
click node_openai_proxy "https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/llm-proxy/openai-compat.js"
click node_session_context "https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/sessionContext.js"
click node_task_runner "https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/task-runner.js"
click node_claude_query "https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/claude-query.js"
click node_task_file "https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/data/tasks.json"
click node_memory_store "https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/memory-store.js"
click node_memory_files "https://github.com/agentesgrok/openclaw-salvador/tree/main/backend/data/memory"
click node_health_checker "https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/health-checker.js"
click node_security_scan "https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/security/self-scan.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_backend_server,node_openai_proxy,node_session_context,node_chat_client,node_openclaw_client toneBlue
class node_claude_query toneAmber
class node_task_runner,node_task_file,node_memory_store,node_memory_files toneMint
class node_health_checker,node_security_scan toneRose
class node_claude_cli toneIndigo
```

## Components

### API and chat

- [HTTP and Socket server](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/server.js): `backend/server.js`
- [OpenAI-compatible API](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/llm-proxy/openai-compat.js): `backend/services/llm-proxy/openai-compat.js`
- [Session context](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/sessionContext.js): `backend/sessionContext.js`

### Claude execution

- [CLI query wrapper](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/claude-query.js): `backend/claude-query.js`

### Tasks and state

- [Task queue runner](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/task-runner.js): `backend/services/task-runner.js`
- [Task records](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/data/tasks.json): `backend/data/tasks.json`
- [Memory store](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/memory-store.js): `backend/services/memory-store.js`
- [Memory files](https://github.com/agentesgrok/openclaw-salvador/tree/main/backend/data/memory): `backend/data/memory`

### Operations

- [Health checker](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/health-checker.js): `backend/services/health-checker.js`
- [Security self-scan](https://github.com/agentesgrok/openclaw-salvador/blob/main/backend/services/security/self-scan.js): `backend/services/security/self-scan.js`

### Other components

- **Chat client**
- **OpenClaw client**
- **Claude Code CLI**

## Connections

- Chat client → HTTP and Socket server: sends chat (evidence: `backend/server.js`)
- HTTP and Socket server → CLI query wrapper: streams prompts (evidence: `backend/server.js`)
- HTTP and Socket server → Session context: uses context (evidence: `backend/server.js`)
- HTTP and Socket server → Task queue runner: dispatches tasks (evidence: `backend/server.js`)
- OpenClaw client → OpenAI-compatible API: sends completions (evidence: `backend/services/llm-proxy/openai-compat.js`)
- OpenAI-compatible API → CLI query wrapper: streams prompts (evidence: `backend/services/llm-proxy/openai-compat.js`)
- Task queue runner → CLI query wrapper: runs task prompts (evidence: `backend/services/task-runner.js`)
- CLI query wrapper → Claude Code CLI: spawns process (evidence: `backend/claude-query.js`)
- Task queue runner → Task records: persists tasks (evidence: `backend/services/task-runner.js`)
- Task queue runner → Memory store: appends changelog (evidence: `backend/services/task-runner.js`)
- Memory store → Memory files: reads and writes (evidence: `backend/services/memory-store.js`)
- HTTP and Socket server → Health checker: checks health (evidence: `backend/server.js`)
- Health checker → CLI query wrapper: checks throttle (evidence: `backend/services/health-checker.js`)
- HTTP and Socket server → Security self-scan: runs scan (evidence: `backend/server.js`)
