# daadaismylife/revagent architecture

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

- Interactive diagram: https://gitdiagram.com/daadaismylife/revagent
- Repository: https://github.com/daadaismylife/revagent

## Overview

revagent is an autonomous Dreamhack reverse-engineering agent. A user supplies a challenge directory; the CLI starts a bounded ReAct solve loop that consults an OpenAI-compatible Qwen service and dispatches analysis, execution, solving, and verification tools. Findings persist in a case file and transcript; the run ends with a verified flag, an unsolved result, or a human runbook. The graph retains README-documented capabilities even where implementation excerpts were unavailable; those links cite the README rather than implying sampled code inspection.

Main entry points: [`revagent/tools/base.py`](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/base.py) (Tool context), [`revagent/agent.py`](https://github.com/daadaismylife/revagent/blob/main/revagent/agent.py) (ReAct agent), [`revagent/__main__.py`](https://github.com/daadaismylife/revagent/blob/main/revagent/__main__.py) (CLI and results), [`revagent/casefile.py`](https://github.com/daadaismylife/revagent/blob/main/revagent/casefile.py) (Case memory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Run entry"]
  node_cli["CLI and results<br/>[__main__.py]"]
  node_sandbox["Sandbox runner<br/>[sandbox.py]"]
end

subgraph group_loop["Agent loop"]
  node_agent["ReAct agent<br/>[agent.py]"]
  node_llm["Qwen client<br/>[llm.py]"]
  node_dispatch["Tool context<br/>[base.py]"]
end

subgraph group_memory["Run memory"]
  node_casefile["Case memory<br/>[casefile.py]"]
  node_context["Context compaction<br/>[context.py]"]
  node_console["Console logging<br/>[console.py]"]
  node_critic["Transcript critic<br/>[critic.py]"]
  node_detectors["Loop detectors<br/>[detectors.py]"]
  node_gate["Action gate<br/>[gate.py]"]
  node_truncate["Output truncation<br/>[truncate.py]"]
end

subgraph group_analysis["Reverse engineering"]
  node_decompile["Ghidra decompile<br/>[decompile.py]"]
  node_ghidra["Ghidra integration<br/>[ghidra.py]"]
  node_emulate_tool["Function oracle tool<br/>[emulate.py]"]
  node_emulate["Unicorn emulator<br/>[emulate.py]"]
end

subgraph group_execution["Challenge tools"]
  node_bash["Shell analysis<br/>[bash.py]"]
  node_run_binary["Binary runner<br/>[run_binary.py]"]
  node_run_gui["GUI runner<br/>[run_gui.py]"]
  node_solve_check["Constraint solver<br/>[solve_check.py]"]
  node_submit["Flag verification<br/>[submit_flag.py]"]
  node_runbook["Runbook handoff<br/>[handoff_runbook.py]"]
  node_notes["Notes tool<br/>[notes.py]"]
  node_summarize["Summarize tool<br/>[summarize.py]"]
  node_ask["Ask user tool<br/>[ask_user.py]"]
end

node_user(("Challenge user"))
node_model_service["Qwen vLLM"]

node_user -->|"starts solve"| node_cli
node_cli -->|"runs isolated"| node_sandbox
node_cli -->|"starts loop"| node_agent
node_cli -->|"loads client"| node_llm
node_cli -->|"tees output"| node_console
node_agent -->|"requests completion"| node_llm
node_llm -->|"streams prompts"| node_model_service
node_agent -->|"dispatches tools"| node_dispatch
node_agent -->|"records run state"| node_casefile
node_agent -->|"compacts history"| node_context
node_context -->|"updates memory"| node_casefile
node_agent -->|"requests critique"| node_critic
node_agent -->|"checks tool calls"| node_gate
node_gate -->|"uses signals"| node_detectors
node_agent -->|"truncates output"| node_truncate
node_dispatch -->|"exposes tool"| node_decompile
node_decompile -->|"invokes"| node_ghidra
node_dispatch -->|"exposes tool"| node_emulate_tool
node_emulate_tool -->|"calls oracle"| node_emulate
node_dispatch -->|"exposes tool"| node_bash
node_dispatch -->|"exposes tool"| node_run_binary
node_dispatch -->|"exposes tool"| node_run_gui
node_dispatch -->|"exposes tool"| node_solve_check
node_dispatch -->|"exposes tool"| node_submit
node_dispatch -->|"exposes tool"| node_runbook
node_dispatch -->|"exposes tool"| node_notes
node_dispatch -->|"exposes tool"| node_summarize
node_dispatch -->|"exposes tool"| node_ask
node_run_binary -->|"records observations"| node_casefile
node_run_gui -->|"records observations"| node_casefile
node_submit -.->|"returns run result"| node_cli

click node_cli "https://github.com/daadaismylife/revagent/blob/main/revagent/__main__.py"
click node_sandbox "https://github.com/daadaismylife/revagent/blob/main/revagent/sandbox.py"
click node_agent "https://github.com/daadaismylife/revagent/blob/main/revagent/agent.py"
click node_llm "https://github.com/daadaismylife/revagent/blob/main/revagent/llm.py"
click node_dispatch "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/base.py"
click node_casefile "https://github.com/daadaismylife/revagent/blob/main/revagent/casefile.py"
click node_context "https://github.com/daadaismylife/revagent/blob/main/revagent/context.py"
click node_console "https://github.com/daadaismylife/revagent/blob/main/revagent/console.py"
click node_critic "https://github.com/daadaismylife/revagent/blob/main/revagent/critic.py"
click node_detectors "https://github.com/daadaismylife/revagent/blob/main/revagent/detectors.py"
click node_gate "https://github.com/daadaismylife/revagent/blob/main/revagent/gate.py"
click node_truncate "https://github.com/daadaismylife/revagent/blob/main/revagent/truncate.py"
click node_decompile "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/decompile.py"
click node_ghidra "https://github.com/daadaismylife/revagent/blob/main/revagent/ghidra.py"
click node_emulate_tool "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/emulate.py"
click node_emulate "https://github.com/daadaismylife/revagent/blob/main/revagent/emulate.py"
click node_bash "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/bash.py"
click node_run_binary "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/run_binary.py"
click node_run_gui "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/run_gui.py"
click node_solve_check "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/solve_check.py"
click node_submit "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/submit_flag.py"
click node_runbook "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/handoff_runbook.py"
click node_notes "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/notes.py"
click node_summarize "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/summarize.py"
click node_ask "https://github.com/daadaismylife/revagent/blob/main/revagent/tools/ask_user.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_cli,node_sandbox,node_user toneBlue
class node_agent,node_llm,node_dispatch toneAmber
class node_casefile,node_context,node_console,node_critic,node_detectors,node_gate,node_truncate toneMint
class node_decompile,node_ghidra,node_emulate_tool,node_emulate toneRose
class node_bash,node_run_binary,node_run_gui,node_solve_check,node_submit,node_runbook,node_notes,node_summarize,node_ask,node_model_service toneIndigo
```

## Components

### Run entry

- [CLI and results](https://github.com/daadaismylife/revagent/blob/main/revagent/__main__.py): `revagent/__main__.py`
- [Sandbox runner](https://github.com/daadaismylife/revagent/blob/main/revagent/sandbox.py): `revagent/sandbox.py`

### Agent loop

- [ReAct agent](https://github.com/daadaismylife/revagent/blob/main/revagent/agent.py): `revagent/agent.py`
- [Qwen client](https://github.com/daadaismylife/revagent/blob/main/revagent/llm.py): `revagent/llm.py`
- [Tool context](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/base.py): `revagent/tools/base.py`

### Run memory

- [Case memory](https://github.com/daadaismylife/revagent/blob/main/revagent/casefile.py): `revagent/casefile.py`
- [Context compaction](https://github.com/daadaismylife/revagent/blob/main/revagent/context.py): `revagent/context.py`
- [Console logging](https://github.com/daadaismylife/revagent/blob/main/revagent/console.py): `revagent/console.py`
- [Transcript critic](https://github.com/daadaismylife/revagent/blob/main/revagent/critic.py): `revagent/critic.py`
- [Loop detectors](https://github.com/daadaismylife/revagent/blob/main/revagent/detectors.py): `revagent/detectors.py`
- [Action gate](https://github.com/daadaismylife/revagent/blob/main/revagent/gate.py): `revagent/gate.py`
- [Output truncation](https://github.com/daadaismylife/revagent/blob/main/revagent/truncate.py): `revagent/truncate.py`

### Reverse engineering

- [Ghidra decompile](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/decompile.py): `revagent/tools/decompile.py`
- [Ghidra integration](https://github.com/daadaismylife/revagent/blob/main/revagent/ghidra.py): `revagent/ghidra.py`
- [Function oracle tool](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/emulate.py): `revagent/tools/emulate.py`
- [Unicorn emulator](https://github.com/daadaismylife/revagent/blob/main/revagent/emulate.py): `revagent/emulate.py`

### Challenge tools

- [Shell analysis](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/bash.py): `revagent/tools/bash.py`
- [Binary runner](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/run_binary.py): `revagent/tools/run_binary.py`
- [GUI runner](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/run_gui.py): `revagent/tools/run_gui.py`
- [Constraint solver](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/solve_check.py): `revagent/tools/solve_check.py`
- [Flag verification](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/submit_flag.py): `revagent/tools/submit_flag.py`
- [Runbook handoff](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/handoff_runbook.py): `revagent/tools/handoff_runbook.py`
- [Notes tool](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/notes.py): `revagent/tools/notes.py`
- [Summarize tool](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/summarize.py): `revagent/tools/summarize.py`
- [Ask user tool](https://github.com/daadaismylife/revagent/blob/main/revagent/tools/ask_user.py): `revagent/tools/ask_user.py`

### Other components

- **Challenge user**
- **Qwen vLLM**

## Connections

- Challenge user → CLI and results: starts solve (evidence: `README.md`)
- CLI and results → Sandbox runner: runs isolated (evidence: `README.md`)
- CLI and results → ReAct agent: starts loop (evidence: `revagent/__main__.py`)
- CLI and results → Qwen client: loads client (evidence: `revagent/__main__.py`)
- CLI and results → Console logging: tees output (evidence: `README.md`)
- ReAct agent → Qwen client: requests completion (evidence: `revagent/agent.py`)
- Qwen client → Qwen vLLM: streams prompts (evidence: `README.md`)
- ReAct agent → Tool context: dispatches tools (evidence: `revagent/agent.py`)
- ReAct agent → Case memory: records run state (evidence: `revagent/agent.py`)
- ReAct agent → Context compaction: compacts history (evidence: `revagent/agent.py`)
- Context compaction → Case memory: updates memory (evidence: `revagent/context.py`)
- ReAct agent → Transcript critic: requests critique (evidence: `revagent/agent.py`)
- ReAct agent → Action gate: checks tool calls (evidence: `revagent/agent.py`)
- Action gate → Loop detectors: uses signals (evidence: `revagent/gate.py`)
- ReAct agent → Output truncation: truncates output (evidence: `revagent/agent.py`)
- Tool context → Ghidra decompile: exposes tool (evidence: `README.md`)
- Ghidra decompile → Ghidra integration: invokes (evidence: `revagent/tools/decompile.py`)
- Tool context → Function oracle tool: exposes tool (evidence: `README.md`)
- Function oracle tool → Unicorn emulator: calls oracle (evidence: `revagent/tools/emulate.py`)
- Tool context → Shell analysis: exposes tool (evidence: `README.md`)
- Tool context → Binary runner: exposes tool (evidence: `README.md`)
- Tool context → GUI runner: exposes tool (evidence: `README.md`)
- Tool context → Constraint solver: exposes tool (evidence: `README.md`)
- Tool context → Flag verification: exposes tool (evidence: `README.md`)
- Tool context → Runbook handoff: exposes tool (evidence: `README.md`)
- Tool context → Notes tool: exposes tool (evidence: `README.md`)
- Tool context → Summarize tool: exposes tool (evidence: `README.md`)
- Tool context → Ask user tool: exposes tool (evidence: `README.md`)
- Binary runner → Case memory: records observations (evidence: `README.md`)
- GUI runner → Case memory: records observations (evidence: `revagent/tools/run_gui.py`)
- Flag verification → CLI and results: returns run result
