# athena-cyber1/athena architecture

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

- Interactive diagram: https://gitdiagram.com/athena-cyber1/athena
- Repository: https://github.com/athena-cyber1/athena

## Overview

Athéna is a conversational cyber assistant whose main workflow sends a user’s chat through the Next.js API to a Python agent pipeline. The agent plans and performs actions, checks evidence, and formats a final response; LLM completion is supporting rather than authoritative. The documented product also includes file ingestion, training endpoints, MCP tools, browser automation, and optional local-PC command execution. Several links among unsampled subsystems are documented only at the service/API level, so the graph avoids asserting their internal call paths.

Main entry points: [`mini-services/llm-chat/athena/agent/agent.py`](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/agent.py) (Agent loop), [`mini-services/llm-chat/serveur.py`](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/serveur.py) (HTTP service), [`src/app/api/chat/route.ts`](https://github.com/athena-cyber1/athena/blob/main/src/app/api/chat/route.ts) (Chat API), [`mini-services/llm-chat/athena/memory/store.py`](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/memory/store.py) (Memory and RAG)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_ui["Chat interface<br/>[page.tsx]"]
  node_chat_api["Chat API<br/>[route.ts]"]
  node_security["Origin security<br/>[secu.ts]"]
  node_file_api["File API<br/>[route.ts]"]
  node_mcp_api["MCP API<br/>[route.ts]"]
  node_training_api["Training API<br/>[route.ts]"]
  node_browser_api["Browser API<br/>[route.ts]"]
  node_exec_api["PC command API<br/>[route.ts]"]
end

subgraph group_agent["Agent pipeline"]
  node_agent_loop["Agent loop<br/>[agent.py]"]
  node_planning["Planning and policy<br/>[planner.py]"]
  node_observation["Observation<br/>[observer.py]"]
  node_agent_state["Agent state<br/>[state.py]"]
  node_subagent["Sub-agent<br/>[sous_agent.py]"]
  node_skills["Skills<br/>[skills.py]"]
  node_voice["Response voice<br/>[voix.py]"]
end

subgraph group_knowledge["Knowledge and tools"]
  node_memory[("Memory and RAG<br/>[store.py]")]
  node_mcp_tools["MCP tools<br/>[mcp.py]"]
end

subgraph group_services["Local services"]
  node_http["HTTP service<br/>[serveur.py]"]
  node_llm_engine["LLM engine<br/>[engine.py]"]
  node_bridge["LLM bridge<br/>[index.ts]"]
  node_local_agent["Local agent<br/>[index.js]"]
end

subgraph group_verification["Verification"]
  node_verification["Verification checks<br/>[canari.py]"]
end

node_user(("User"))
node_model_provider{{"Model providers"}}

node_user -->|"sends chat"| node_ui
node_ui -.->|"submits messages"| node_chat_api
node_chat_api -->|"checks origin"| node_security
node_chat_api -->|"forwards chat"| node_http
node_http -->|"calls run_agent"| node_agent_loop
node_agent_loop -->|"uses planning"| node_planning
node_agent_loop -->|"uses observer"| node_observation
node_agent_loop -->|"uses state"| node_agent_state
node_agent_loop -->|"uses sub-agent"| node_subagent
node_agent_loop -->|"uses skills"| node_skills
node_agent_loop -->|"formats response"| node_voice
node_agent_loop -.->|"requests completion"| node_llm_engine
node_llm_engine -->|"requests completion"| node_bridge
node_bridge -.->|"routes model requests"| node_model_provider
node_agent_loop -->|"reads and records"| node_memory
node_agent_loop -->|"checks output"| node_verification
node_file_api -.->|"proxies file requests"| node_http
node_http -->|"stores file records"| node_memory
node_mcp_api -.->|"proxies MCP requests"| node_http
node_http -.->|"exposes MCP operations"| node_mcp_tools
node_agent_loop -->|"uses MCP tools"| node_mcp_tools
node_training_api -.->|"proxies training"| node_http
node_http -->|"records training pairs"| node_memory
node_browser_api -->|"proxies browser actions"| node_local_agent
node_user -->|"confirms command"| node_exec_api
node_exec_api -->|"forwards command"| node_local_agent

click node_ui "https://github.com/athena-cyber1/athena/blob/main/src/app/page.tsx"
click node_chat_api "https://github.com/athena-cyber1/athena/blob/main/src/app/api/chat/route.ts"
click node_security "https://github.com/athena-cyber1/athena/blob/main/src/lib/secu.ts"
click node_http "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/serveur.py"
click node_agent_loop "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/agent.py"
click node_planning "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/planner.py"
click node_observation "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/observer.py"
click node_agent_state "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/state.py"
click node_subagent "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/sous_agent.py"
click node_skills "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/skills.py"
click node_voice "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/voix.py"
click node_llm_engine "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/llm/engine.py"
click node_bridge "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-bridge/index.ts"
click node_memory "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/memory/store.py"
click node_file_api "https://github.com/athena-cyber1/athena/blob/main/src/app/api/files/route.ts"
click node_mcp_api "https://github.com/athena-cyber1/athena/blob/main/src/app/api/mcp/route.ts"
click node_mcp_tools "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/tools/mcp.py"
click node_training_api "https://github.com/athena-cyber1/athena/blob/main/src/app/api/entrainer/route.ts"
click node_browser_api "https://github.com/athena-cyber1/athena/blob/main/src/app/api/browser/route.ts"
click node_local_agent "https://github.com/athena-cyber1/athena/blob/main/mini-services/local-agent/index.js"
click node_exec_api "https://github.com/athena-cyber1/athena/blob/main/src/app/api/exec/route.ts"
click node_verification "https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/verification/canari.py"

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_ui,node_chat_api,node_security,node_file_api,node_mcp_api,node_training_api,node_browser_api,node_exec_api,node_user toneBlue
class node_agent_loop,node_planning,node_observation,node_agent_state,node_subagent,node_skills,node_voice toneAmber
class node_memory,node_mcp_tools toneMint
class node_http,node_llm_engine,node_bridge,node_local_agent toneRose
class node_verification,node_model_provider toneIndigo
```

## Components

### Web application

- [Chat interface](https://github.com/athena-cyber1/athena/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Chat API](https://github.com/athena-cyber1/athena/blob/main/src/app/api/chat/route.ts): `src/app/api/chat/route.ts`
- [Origin security](https://github.com/athena-cyber1/athena/blob/main/src/lib/secu.ts): `src/lib/secu.ts`
- [File API](https://github.com/athena-cyber1/athena/blob/main/src/app/api/files/route.ts): `src/app/api/files/route.ts`
- [MCP API](https://github.com/athena-cyber1/athena/blob/main/src/app/api/mcp/route.ts): `src/app/api/mcp/route.ts`
- [Training API](https://github.com/athena-cyber1/athena/blob/main/src/app/api/entrainer/route.ts): `src/app/api/entrainer/route.ts`
- [Browser API](https://github.com/athena-cyber1/athena/blob/main/src/app/api/browser/route.ts): `src/app/api/browser/route.ts`
- [PC command API](https://github.com/athena-cyber1/athena/blob/main/src/app/api/exec/route.ts): `src/app/api/exec/route.ts`

### Agent pipeline

- [Agent loop](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/agent.py): `mini-services/llm-chat/athena/agent/agent.py`
- [Planning and policy](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/planner.py): `mini-services/llm-chat/athena/agent/planner.py`
- [Observation](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/observer.py): `mini-services/llm-chat/athena/agent/observer.py`
- [Agent state](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/state.py): `mini-services/llm-chat/athena/agent/state.py`
- [Sub-agent](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/sous_agent.py): `mini-services/llm-chat/athena/agent/sous_agent.py`
- [Skills](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/skills.py): `mini-services/llm-chat/athena/agent/skills.py`
- [Response voice](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/agent/voix.py): `mini-services/llm-chat/athena/agent/voix.py`

### Knowledge and tools

- [Memory and RAG](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/memory/store.py): `mini-services/llm-chat/athena/memory/store.py`
- [MCP tools](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/tools/mcp.py): `mini-services/llm-chat/athena/tools/mcp.py`

### Local services

- [HTTP service](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/serveur.py): `mini-services/llm-chat/serveur.py`
- [LLM engine](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/llm/engine.py): `mini-services/llm-chat/athena/llm/engine.py`
- [LLM bridge](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-bridge/index.ts): `mini-services/llm-bridge/index.ts`
- [Local agent](https://github.com/athena-cyber1/athena/blob/main/mini-services/local-agent/index.js): `mini-services/local-agent/index.js`

### Verification

- [Verification checks](https://github.com/athena-cyber1/athena/blob/main/mini-services/llm-chat/athena/verification/canari.py): `mini-services/llm-chat/athena/verification/canari.py`

### Other components

- **User**
- **Model providers**

## Connections

- User → Chat interface: sends chat (evidence: `README.md`)
- Chat interface → Chat API: submits messages
- Chat API → Origin security: checks origin (evidence: `src/app/api/chat/route.ts`)
- Chat API → HTTP service: forwards chat (evidence: `README.md`)
- HTTP service → Agent loop: calls run_agent (evidence: `mini-services/llm-chat/serveur.py`)
- Agent loop → Planning and policy: uses planning (evidence: `mini-services/llm-chat/athena/agent/agent.py`)
- Agent loop → Observation: uses observer (evidence: `mini-services/llm-chat/athena/agent/agent.py`)
- Agent loop → Agent state: uses state (evidence: `mini-services/llm-chat/athena/agent/agent.py`)
- Agent loop → Sub-agent: uses sub-agent (evidence: `mini-services/llm-chat/athena/agent/agent.py`)
- Agent loop → Skills: uses skills (evidence: `mini-services/llm-chat/athena/agent/agent.py`)
- Agent loop → Response voice: formats response (evidence: `mini-services/llm-chat/athena/agent/agent.py`)
- Agent loop → LLM engine: requests completion
- LLM engine → LLM bridge: requests completion (evidence: `mini-services/llm-chat/athena/llm/engine.py`)
- LLM bridge → Model providers: routes model requests (evidence: `README.md`)
- Agent loop → Memory and RAG: reads and records (evidence: `mini-services/llm-chat/athena/agent/agent.py`)
- Agent loop → Verification checks: checks output (evidence: `mini-services/llm-chat/athena/agent/agent.py`)
- File API → HTTP service: proxies file requests
- HTTP service → Memory and RAG: stores file records (evidence: `mini-services/llm-chat/serveur.py`)
- MCP API → HTTP service: proxies MCP requests
- HTTP service → MCP tools: exposes MCP operations (evidence: `mini-services/llm-chat/serveur.py`)
- Agent loop → MCP tools: uses MCP tools (evidence: `mini-services/llm-chat/athena/agent/agent.py`)
- Training API → HTTP service: proxies training
- HTTP service → Memory and RAG: records training pairs (evidence: `mini-services/llm-chat/serveur.py`)
- Browser API → Local agent: proxies browser actions (evidence: `src/app/api/browser/route.ts`)
- User → PC command API: confirms command (evidence: `README.md`)
- PC command API → Local agent: forwards command (evidence: `README.md`)
