# rmjohnson12/ctf_agents architecture

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

- Interactive diagram: https://gitdiagram.com/rmjohnson12/ctf_agents
- Repository: https://github.com/rmjohnson12/ctf_agents

## Overview

CTF_Agents is an authorized CTF-solving framework. Its main workflow accepts a natural-language or structured challenge, parses and classifies it, routes work through a coordinator to a specialist, runs bounded tools or playbooks, and records evidence before reporting a verified result or failure. The graph also preserves recovery synthesis, persistent knowledge, live reporting, and the Hack The Box integration. Several subsystem links come from README descriptions; unsampled implementations are represented at their existing directory paths, without asserting internal call details.

Main entry points: [`agents/coordinator/coordinator_agent.py`](https://github.com/rmjohnson12/ctf_agents/blob/main/agents/coordinator/coordinator_agent.py) (Coordinator), [`agents/specialists`](https://github.com/rmjohnson12/ctf_agents/tree/main/agents/specialists) (Specialist agents), [`main.py`](https://github.com/rmjohnson12/ctf_agents/blob/main/main.py) (Structured CLI), [`core/runtime_synthesis.py`](https://github.com/rmjohnson12/ctf_agents/blob/main/core/runtime_synthesis.py) (Runtime synthesis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and routing"]
  node_natural_cli["Natural-language CLI<br/>[ask.py]"]
  node_structured_cli["Structured CLI<br/>[main.py]"]
  node_challenge_parser["Challenge parser"]
  node_coordinator["Coordinator"]
  node_registry["Agent registry<br/>[registry.py]"]
  node_classifier["Challenge classifier<br/>[classifier.py]"]
  node_reasoner["LLM reasoner<br/>[llm_reasoner.py]"]
end

subgraph group_agents["Challenge agents"]
  node_specialists["Specialist agents"]
  node_support_agents["Support agents"]
  node_base_agent["Agent interface<br/>[base_agent.py]"]
end

subgraph group_execution["Tools and recovery"]
  node_tool_runner["Tool runner<br/>[runner.py]"]
  node_python_tool["Python tool<br/>[python_tool.py]"]
  node_web_tools["Web tools"]
  node_runtime_synthesis["Runtime synthesis"]
end

subgraph group_state["Evidence and reporting"]
  node_knowledge_store[("Knowledge store<br/>[knowledge_store.py]")]
  node_trace_store[("Solve trace store")]
  node_result_manager[("Result persistence<br/>[result_manager.py]")]
  node_flag_utils["Flag validation<br/>[flag_utils.py]"]
  node_security["Target and data security<br/>[security.py]"]
  node_reporting_client["Progress reporter<br/>[client.py]"]
  node_reporting_service["Reporting service<br/>[server.py]"]
end

subgraph group_platform["Platform integration"]
  node_htb["Hack The Box integration"]
end

node_user(("CTF operator"))

node_user -->|"submits challenge"| node_natural_cli
node_user -->|"supplies JSON"| node_structured_cli
node_structured_cli -->|"parses input"| node_challenge_parser
node_structured_cli -->|"starts solve"| node_coordinator
node_coordinator -.->|"classifies challenge"| node_classifier
node_coordinator -->|"requests decisions"| node_reasoner
node_coordinator -.->|"routes to agents"| node_registry
node_registry -.->|"registers specialists"| node_specialists
node_coordinator -->|"dispatches work"| node_specialists
node_specialists -->|"implements interface"| node_base_agent
node_specialists -->|"uses web tools"| node_web_tools
node_specialists -->|"runs commands"| node_tool_runner
node_coordinator -->|"requests recovery"| node_runtime_synthesis
node_runtime_synthesis -->|"executes compute"| node_python_tool
node_runtime_synthesis -->|"fetches observations"| node_web_tools
node_coordinator -->|"uses shared knowledge"| node_knowledge_store
node_coordinator -->|"reads solve traces"| node_trace_store
node_coordinator -->|"persists results"| node_result_manager
node_specialists -->|"checks flags"| node_flag_utils
node_web_tools -->|"checks target access"| node_security
node_coordinator -->|"sends progress"| node_reporting_client
node_reporting_client -.->|"posts updates"| node_reporting_service
node_user -.->|"uses platform"| node_htb

click node_natural_cli "https://github.com/rmjohnson12/ctf_agents/blob/main/ask.py"
click node_structured_cli "https://github.com/rmjohnson12/ctf_agents/blob/main/main.py"
click node_challenge_parser "https://github.com/rmjohnson12/ctf_agents/blob/main/challenges/challenge_parser.py"
click node_coordinator "https://github.com/rmjohnson12/ctf_agents/blob/main/agents/coordinator/coordinator_agent.py"
click node_registry "https://github.com/rmjohnson12/ctf_agents/blob/main/agents/registry.py"
click node_classifier "https://github.com/rmjohnson12/ctf_agents/blob/main/core/decision_engine/classifier.py"
click node_reasoner "https://github.com/rmjohnson12/ctf_agents/blob/main/core/decision_engine/llm_reasoner.py"
click node_specialists "https://github.com/rmjohnson12/ctf_agents/tree/main/agents/specialists"
click node_support_agents "https://github.com/rmjohnson12/ctf_agents/tree/main/agents/support"
click node_base_agent "https://github.com/rmjohnson12/ctf_agents/blob/main/agents/base_agent.py"
click node_tool_runner "https://github.com/rmjohnson12/ctf_agents/blob/main/tools/common/runner.py"
click node_python_tool "https://github.com/rmjohnson12/ctf_agents/blob/main/tools/common/python_tool.py"
click node_web_tools "https://github.com/rmjohnson12/ctf_agents/tree/main/tools/web"
click node_runtime_synthesis "https://github.com/rmjohnson12/ctf_agents/blob/main/core/runtime_synthesis.py"
click node_knowledge_store "https://github.com/rmjohnson12/ctf_agents/blob/main/core/knowledge_base/knowledge_store.py"
click node_trace_store "https://github.com/rmjohnson12/ctf_agents/blob/main/core/knowledge_base/solve_trace_store.py"
click node_result_manager "https://github.com/rmjohnson12/ctf_agents/blob/main/core/utils/result_manager.py"
click node_flag_utils "https://github.com/rmjohnson12/ctf_agents/blob/main/core/utils/flag_utils.py"
click node_security "https://github.com/rmjohnson12/ctf_agents/blob/main/core/utils/security.py"
click node_reporting_client "https://github.com/rmjohnson12/ctf_agents/blob/main/core/reporting/client.py"
click node_reporting_service "https://github.com/rmjohnson12/ctf_agents/blob/main/core/reporting/server.py"
click node_htb "https://github.com/rmjohnson12/ctf_agents/tree/main/integrations/hackthebox"

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_natural_cli,node_structured_cli,node_challenge_parser,node_coordinator,node_registry,node_classifier,node_reasoner toneBlue
class node_specialists,node_support_agents,node_base_agent toneAmber
class node_tool_runner,node_python_tool,node_web_tools,node_runtime_synthesis toneMint
class node_knowledge_store,node_trace_store,node_result_manager,node_flag_utils,node_security,node_reporting_client,node_reporting_service toneRose
class node_htb,node_user toneIndigo
```

## Components

### Entry and routing

- [Natural-language CLI](https://github.com/rmjohnson12/ctf_agents/blob/main/ask.py): `ask.py`
- [Structured CLI](https://github.com/rmjohnson12/ctf_agents/blob/main/main.py): `main.py`
- [Challenge parser](https://github.com/rmjohnson12/ctf_agents/blob/main/challenges/challenge_parser.py): `challenges/challenge_parser.py`
- [Coordinator](https://github.com/rmjohnson12/ctf_agents/blob/main/agents/coordinator/coordinator_agent.py): `agents/coordinator/coordinator_agent.py`
- [Agent registry](https://github.com/rmjohnson12/ctf_agents/blob/main/agents/registry.py): `agents/registry.py`
- [Challenge classifier](https://github.com/rmjohnson12/ctf_agents/blob/main/core/decision_engine/classifier.py): `core/decision_engine/classifier.py`
- [LLM reasoner](https://github.com/rmjohnson12/ctf_agents/blob/main/core/decision_engine/llm_reasoner.py): `core/decision_engine/llm_reasoner.py`

### Challenge agents

- [Specialist agents](https://github.com/rmjohnson12/ctf_agents/tree/main/agents/specialists): `agents/specialists`
- [Support agents](https://github.com/rmjohnson12/ctf_agents/tree/main/agents/support): `agents/support`
- [Agent interface](https://github.com/rmjohnson12/ctf_agents/blob/main/agents/base_agent.py): `agents/base_agent.py`

### Tools and recovery

- [Tool runner](https://github.com/rmjohnson12/ctf_agents/blob/main/tools/common/runner.py): `tools/common/runner.py`
- [Python tool](https://github.com/rmjohnson12/ctf_agents/blob/main/tools/common/python_tool.py): `tools/common/python_tool.py`
- [Web tools](https://github.com/rmjohnson12/ctf_agents/tree/main/tools/web): `tools/web`
- [Runtime synthesis](https://github.com/rmjohnson12/ctf_agents/blob/main/core/runtime_synthesis.py): `core/runtime_synthesis.py`

### Evidence and reporting

- [Knowledge store](https://github.com/rmjohnson12/ctf_agents/blob/main/core/knowledge_base/knowledge_store.py): `core/knowledge_base/knowledge_store.py`
- [Solve trace store](https://github.com/rmjohnson12/ctf_agents/blob/main/core/knowledge_base/solve_trace_store.py): `core/knowledge_base/solve_trace_store.py`
- [Result persistence](https://github.com/rmjohnson12/ctf_agents/blob/main/core/utils/result_manager.py): `core/utils/result_manager.py`
- [Flag validation](https://github.com/rmjohnson12/ctf_agents/blob/main/core/utils/flag_utils.py): `core/utils/flag_utils.py`
- [Target and data security](https://github.com/rmjohnson12/ctf_agents/blob/main/core/utils/security.py): `core/utils/security.py`
- [Progress reporter](https://github.com/rmjohnson12/ctf_agents/blob/main/core/reporting/client.py): `core/reporting/client.py`
- [Reporting service](https://github.com/rmjohnson12/ctf_agents/blob/main/core/reporting/server.py): `core/reporting/server.py`

### Platform integration

- [Hack The Box integration](https://github.com/rmjohnson12/ctf_agents/tree/main/integrations/hackthebox): `integrations/hackthebox`

### Other components

- **CTF operator**

## Connections

- CTF operator → Natural-language CLI: submits challenge (evidence: `README.md`)
- CTF operator → Structured CLI: supplies JSON (evidence: `README.md`)
- Structured CLI → Challenge parser: parses input (evidence: `main.py`)
- Structured CLI → Coordinator: starts solve (evidence: `main.py`)
- Coordinator → Challenge classifier: classifies challenge
- Coordinator → LLM reasoner: requests decisions (evidence: `agents/coordinator/coordinator_agent.py`)
- Coordinator → Agent registry: routes to agents
- Agent registry → Specialist agents: registers specialists (evidence: `agents/specialists/web_exploitation/web_agent.py`)
- Coordinator → Specialist agents: dispatches work (evidence: `README.md`)
- Specialist agents → Agent interface: implements interface (evidence: `agents/base_agent.py`)
- Specialist agents → Web tools: uses web tools (evidence: `agents/specialists/web_exploitation/web_agent.py`)
- Specialist agents → Tool runner: runs commands
- Coordinator → Runtime synthesis: requests recovery (evidence: `agents/coordinator/coordinator_agent.py`)
- Runtime synthesis → Python tool: executes compute (evidence: `core/runtime_synthesis.py`)
- Runtime synthesis → Web tools: fetches observations (evidence: `core/runtime_synthesis.py`)
- Coordinator → Knowledge store: uses shared knowledge (evidence: `agents/coordinator/coordinator_agent.py`)
- Coordinator → Solve trace store: reads solve traces (evidence: `agents/coordinator/coordinator_agent.py`)
- Coordinator → Result persistence: persists results (evidence: `agents/coordinator/coordinator_agent.py`)
- Specialist agents → Flag validation: checks flags (evidence: `agents/specialists/reverse_engineering/reverse_agent.py`)
- Web tools → Target and data security: checks target access (evidence: `tools/web/dirsearch.py`)
- Coordinator → Progress reporter: sends progress (evidence: `agents/coordinator/coordinator_agent.py`)
- Progress reporter → Reporting service: posts updates
- CTF operator → Hack The Box integration: uses platform
