# skygod07/rakshastra architecture

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

- Interactive diagram: https://gitdiagram.com/skygod07/rakshastra
- Repository: https://github.com/skygod07/rakshastra

## Overview

Rakshastra is an autonomous cybersecurity platform: analysts or connected channels submit security requests, the agent coordinates model-backed analysis and security tools, and the platform supports investigation, threat intelligence, and response. Its documented capabilities also include graph-based attribution and attack prediction, hybrid threat-intelligence RAG, UEBA, SOAR, a REST API, and x402 billing. The README supports the product-level flow; source-index references establish only the specific internal links cited below, so unsampled subsystems are shown without speculative connections.

Main entry points: [`agent/tool_executor.py`](https://github.com/skygod07/rakshastra/blob/main/agent/tool_executor.py) (Tool execution), [`run_agent.py`](https://github.com/skygod07/rakshastra/blob/main/run_agent.py) (Agent entry), [`gateway/platforms/api_server.py`](https://github.com/skygod07/rakshastra/blob/main/gateway/platforms/api_server.py) (REST API), [`agent/conversation_loop.py`](https://github.com/skygod07/rakshastra/blob/main/agent/conversation_loop.py) (Conversation loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_web["Web dashboard<br/>[App.tsx]"]
  node_tui["Terminal UI<br/>[App.tsx]"]
  node_cli["CLI<br/>[main.py]"]
  node_acp["ACP server<br/>[server.py]"]
end

subgraph group_ingress["Ingress and channels"]
  node_api["REST API<br/>[api_server.py]"]
  node_channels["Messaging channels<br/>[signal.py]"]
  node_gateway["Gateway daemon<br/>[run.py]"]
  node_payments["x402 billing<br/>[api_server.py]"]
end

subgraph group_agent["Agent runtime"]
  node_agent_entry["Agent entry<br/>[run_agent.py]"]
  node_conversation["Conversation loop"]
  node_model["Model adapters"]
  node_tool_dispatch["Tool execution<br/>[tool_executor.py]"]
  node_memory["Memory manager<br/>[memory_manager.py]"]
end

subgraph group_security["Security intelligence"]
  node_correlation["Footprint correlation"]
  node_attack_graph[("Attack graph<br/>[graph_engine.py]")]
  node_apt["APT attribution<br/>[apt_service.py]"]
  node_threat_rag[("Threat intel RAG")]
  node_ueba["Behavior analytics"]
  node_digital_twin["Blast radius"]
end

subgraph group_response["Response and evidence"]
  node_incident["Incident response"]
  node_soar["SOAR playbooks<br/>[soar_engine.py]"]
  node_evidence["Evidence handling<br/>[terminal_tool.py]"]
end

node_analyst(("Analyst"))

node_analyst -->|"submits request"| node_web
node_analyst -->|"submits request"| node_tui
node_analyst -->|"submits request"| node_cli
node_analyst -->|"submits request"| node_acp
node_analyst -->|"submits request"| node_api
node_channels -->|"bridges messages"| node_gateway
node_gateway -.->|"dispatches requests"| node_agent_entry
node_api -.->|"dispatches requests"| node_agent_entry
node_web -.->|"uses API"| node_api
node_tui -.->|"uses gateway"| node_gateway
node_acp -->|"exposes agent"| node_agent_entry
node_cli -.->|"starts agent"| node_agent_entry
node_agent_entry -.->|"runs loop"| node_conversation
node_conversation -->|"requests completion"| node_model
node_conversation -.->|"executes tools"| node_tool_dispatch
node_agent_entry -->|"manages memory"| node_memory
node_tool_dispatch -.->|"runs analysis"| node_correlation
node_tool_dispatch -.->|"runs analysis"| node_attack_graph
node_tool_dispatch -.->|"runs attribution"| node_apt
node_tool_dispatch -.->|"retrieves intelligence"| node_threat_rag
node_tool_dispatch -.->|"runs detection"| node_ueba
node_tool_dispatch -.->|"simulates impact"| node_digital_twin
node_tool_dispatch -.->|"supports response"| node_incident
node_tool_dispatch -.->|"runs playbooks"| node_soar
node_tool_dispatch -->|"uses terminal"| node_evidence
node_api -.->|"verifies payment"| node_payments

click node_web "https://github.com/skygod07/rakshastra/blob/main/web/src/App.tsx"
click node_tui "https://github.com/skygod07/rakshastra/blob/main/ui-tui/packages/rakshastra-ink/src/ink/components/App.tsx"
click node_cli "https://github.com/skygod07/rakshastra/blob/main/rakshastra_cli/main.py"
click node_acp "https://github.com/skygod07/rakshastra/blob/main/acp_adapter/server.py"
click node_api "https://github.com/skygod07/rakshastra/blob/main/gateway/platforms/api_server.py"
click node_channels "https://github.com/skygod07/rakshastra/blob/main/gateway/platforms/signal.py"
click node_gateway "https://github.com/skygod07/rakshastra/blob/main/gateway/run.py"
click node_agent_entry "https://github.com/skygod07/rakshastra/blob/main/run_agent.py"
click node_conversation "https://github.com/skygod07/rakshastra/blob/main/agent/conversation_loop.py"
click node_model "https://github.com/skygod07/rakshastra/blob/main/agent/anthropic_adapter.py"
click node_tool_dispatch "https://github.com/skygod07/rakshastra/blob/main/agent/tool_executor.py"
click node_memory "https://github.com/skygod07/rakshastra/blob/main/agent/memory_manager.py"
click node_correlation "https://github.com/skygod07/rakshastra/blob/main/rakshastra_core/intelligence/correlation_engine.py"
click node_attack_graph "https://github.com/skygod07/rakshastra/blob/main/rakshastra_core/intelligence/graph_engine.py"
click node_apt "https://github.com/skygod07/rakshastra/blob/main/services/apt_service.py"
click node_threat_rag "https://github.com/skygod07/rakshastra/blob/main/stage%202/rakshastra_core/intelligence/threat_intel_rag.py"
click node_ueba "https://github.com/skygod07/rakshastra/tree/main/rakshastra_core/intelligence"
click node_digital_twin "https://github.com/skygod07/rakshastra/blob/main/rakshastra_core/engines/digital_twin_engine.py"
click node_incident "https://github.com/skygod07/rakshastra/blob/main/rakshastra_core/engines/incident_response_engine.py"
click node_soar "https://github.com/skygod07/rakshastra/blob/main/rakshastra_core/engines/soar_engine.py"
click node_evidence "https://github.com/skygod07/rakshastra/blob/main/tools/terminal_tool.py"
click node_payments "https://github.com/skygod07/rakshastra/blob/main/gateway/platforms/api_server.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_web,node_tui,node_cli,node_acp toneBlue
class node_api,node_channels,node_gateway,node_payments toneAmber
class node_agent_entry,node_conversation,node_model,node_tool_dispatch,node_memory toneMint
class node_correlation,node_attack_graph,node_apt,node_threat_rag,node_ueba,node_digital_twin toneRose
class node_incident,node_soar,node_evidence,node_analyst toneIndigo
```

## Components

### User interfaces

- [Web dashboard](https://github.com/skygod07/rakshastra/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Terminal UI](https://github.com/skygod07/rakshastra/blob/main/ui-tui/packages/rakshastra-ink/src/ink/components/App.tsx): `ui-tui/packages/rakshastra-ink/src/ink/components/App.tsx`
- [CLI](https://github.com/skygod07/rakshastra/blob/main/rakshastra_cli/main.py): `rakshastra_cli/main.py`
- [ACP server](https://github.com/skygod07/rakshastra/blob/main/acp_adapter/server.py): `acp_adapter/server.py`

### Ingress and channels

- [REST API](https://github.com/skygod07/rakshastra/blob/main/gateway/platforms/api_server.py): `gateway/platforms/api_server.py`
- [Messaging channels](https://github.com/skygod07/rakshastra/blob/main/gateway/platforms/signal.py): `gateway/platforms/signal.py`
- [Gateway daemon](https://github.com/skygod07/rakshastra/blob/main/gateway/run.py): `gateway/run.py`
- [x402 billing](https://github.com/skygod07/rakshastra/blob/main/gateway/platforms/api_server.py): `gateway/platforms/api_server.py`

### Agent runtime

- [Agent entry](https://github.com/skygod07/rakshastra/blob/main/run_agent.py): `run_agent.py`
- [Conversation loop](https://github.com/skygod07/rakshastra/blob/main/agent/conversation_loop.py): `agent/conversation_loop.py`
- [Model adapters](https://github.com/skygod07/rakshastra/blob/main/agent/anthropic_adapter.py): `agent/anthropic_adapter.py`
- [Tool execution](https://github.com/skygod07/rakshastra/blob/main/agent/tool_executor.py): `agent/tool_executor.py`
- [Memory manager](https://github.com/skygod07/rakshastra/blob/main/agent/memory_manager.py): `agent/memory_manager.py`

### Security intelligence

- [Footprint correlation](https://github.com/skygod07/rakshastra/blob/main/rakshastra_core/intelligence/correlation_engine.py): `rakshastra_core/intelligence/correlation_engine.py`
- [Attack graph](https://github.com/skygod07/rakshastra/blob/main/rakshastra_core/intelligence/graph_engine.py): `rakshastra_core/intelligence/graph_engine.py`
- [APT attribution](https://github.com/skygod07/rakshastra/blob/main/services/apt_service.py): `services/apt_service.py`
- [Threat intel RAG](https://github.com/skygod07/rakshastra/blob/main/stage%202/rakshastra_core/intelligence/threat_intel_rag.py): `stage 2/rakshastra_core/intelligence/threat_intel_rag.py`
- [Behavior analytics](https://github.com/skygod07/rakshastra/tree/main/rakshastra_core/intelligence): `rakshastra_core/intelligence`
- [Blast radius](https://github.com/skygod07/rakshastra/blob/main/rakshastra_core/engines/digital_twin_engine.py): `rakshastra_core/engines/digital_twin_engine.py`

### Response and evidence

- [Incident response](https://github.com/skygod07/rakshastra/blob/main/rakshastra_core/engines/incident_response_engine.py): `rakshastra_core/engines/incident_response_engine.py`
- [SOAR playbooks](https://github.com/skygod07/rakshastra/blob/main/rakshastra_core/engines/soar_engine.py): `rakshastra_core/engines/soar_engine.py`
- [Evidence handling](https://github.com/skygod07/rakshastra/blob/main/tools/terminal_tool.py): `tools/terminal_tool.py`

### Other components

- **Analyst**

## Connections

- Analyst → Web dashboard: submits request (evidence: `README.md`)
- Analyst → Terminal UI: submits request (evidence: `README.md`)
- Analyst → CLI: submits request (evidence: `README.md`)
- Analyst → ACP server: submits request (evidence: `README.md`)
- Analyst → REST API: submits request (evidence: `README.md`)
- Messaging channels → Gateway daemon: bridges messages (evidence: `README.md`)
- Gateway daemon → Agent entry: dispatches requests
- REST API → Agent entry: dispatches requests
- Web dashboard → REST API: uses API
- Terminal UI → Gateway daemon: uses gateway
- ACP server → Agent entry: exposes agent (evidence: `acp_adapter/server.py`)
- CLI → Agent entry: starts agent
- Agent entry → Conversation loop: runs loop (evidence: `agent/conversation_loop.py`)
- Conversation loop → Model adapters: requests completion (evidence: `agent/conversation_loop.py`)
- Conversation loop → Tool execution: executes tools
- Agent entry → Memory manager: manages memory (evidence: `agent/memory_manager.py`)
- Tool execution → Footprint correlation: runs analysis
- Tool execution → Attack graph: runs analysis
- Tool execution → APT attribution: runs attribution
- Tool execution → Threat intel RAG: retrieves intelligence
- Tool execution → Behavior analytics: runs detection
- Tool execution → Blast radius: simulates impact
- Tool execution → Incident response: supports response
- Tool execution → SOAR playbooks: runs playbooks
- Tool execution → Evidence handling: uses terminal
- REST API → x402 billing: verifies payment
