# biniamf/ai-reverse-engineering architecture

> Architecture diagram of the GitHub repository biniamf/ai-reverse-engineering, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/biniamf/ai-reverse-engineering
- Repository: https://github.com/biniamf/ai-reverse-engineering

## Overview

Rev·Deck is a local static-analysis workstation for examining binaries through Ghidra and asking an evidence-citing LLM copilot bounded questions. The user uploads a binary, confirms any plain-text warning, and starts an analysis job; the app proxies requests to Ghidra, then presents deterministic evidence and optional assistant workflows. The browser talks only to Flask. The graph preserves the distinct upload, analysis, evidence-browsing, and assistant stages, plus the tool/context layer. Some route wiring is inferred from the README because the sampled server excerpts are partial.

Main entry points: [`webui/app.py`](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/app.py) (API routes), [`webui/ghidra_assistant.py`](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/ghidra_assistant.py) (Assistant agent), [`webui/static/js/app.js`](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/static/js/app.js) (Workspace UI), [`webui/ghidra_client.py`](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/ghidra_client.py) (Ghidra client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser workspace"]
  node_web["Workspace UI<br/>[app.js]"]
  node_jobs["Job controls<br/>[jobs.js]"]
  node_analysis_ui["Evidence views<br/>[analysis.js]"]
  node_chat_ui["Chat workspace<br/>[chat.js]"]
end

subgraph group_server["Flask application"]
  node_flask["API routes<br/>[app.py]"]
  node_preflight["Upload checks<br/>[file_preflight.py]"]
  node_validation["Request validation<br/>[validation.py]"]
end

subgraph group_analysis["Analysis services"]
  node_ghidra_client["Ghidra client<br/>[ghidra_client.py]"]
end

subgraph group_assistant["Assistant runtime"]
  node_assistant_runtime["Assistant agent"]
  node_tools["Tool registry<br/>[tools.py]"]
  node_workflows["Workflow modes<br/>[workflows.py]"]
  node_context["Bounded context<br/>[context.py]"]
  node_citations["Citation handling<br/>[citations.py]"]
end

subgraph group_state["Application state"]
  node_chat_store[("Chat history<br/>[chat_store.py]")]
  node_cache["Summary cache<br/>[cache.py]"]
end

node_user(("Analyst"))
node_ghidra["Ghidra service"]
node_llm["LLM endpoint"]

node_user -->|"uses"| node_web
node_web -->|"creates"| node_jobs
node_web -->|"creates"| node_analysis_ui
node_web -->|"creates"| node_chat_ui
node_jobs -->|"job requests"| node_flask
node_analysis_ui -->|"evidence requests"| node_flask
node_chat_ui -->|"chat requests"| node_flask
node_flask -->|"checks uploads"| node_preflight
node_flask -->|"validates input"| node_validation
node_flask -->|"proxies analysis"| node_ghidra_client
node_ghidra_client -->|"requests analysis"| node_ghidra
node_flask -->|"runs chat"| node_assistant_runtime
node_assistant_runtime -->|"dispatches tools"| node_tools
node_assistant_runtime -->|"selects workflow"| node_workflows
node_assistant_runtime -->|"bounds messages"| node_context
node_assistant_runtime -->|"fetches evidence"| node_ghidra_client
node_assistant_runtime -->|"sends prompts"| node_llm
node_llm -->|"returns output"| node_assistant_runtime
node_assistant_runtime -->|"persists history"| node_chat_store
node_flask -->|"reads history"| node_chat_store
node_flask -->|"validates citations"| node_citations
node_flask -->|"uses summaries"| node_cache

click node_web "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/static/js/app.js"
click node_jobs "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/static/js/jobs.js"
click node_analysis_ui "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/static/js/analysis.js"
click node_chat_ui "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/static/js/chat.js"
click node_flask "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/app.py"
click node_preflight "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/file_preflight.py"
click node_validation "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/validation.py"
click node_ghidra_client "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/ghidra_client.py"
click node_assistant_runtime "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/ghidra_assistant.py"
click node_tools "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/tools.py"
click node_workflows "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/workflows.py"
click node_context "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/context.py"
click node_citations "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/citations.py"
click node_chat_store "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/chat_store.py"
click node_cache "https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/cache.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_jobs,node_analysis_ui,node_chat_ui toneBlue
class node_flask,node_preflight,node_validation toneAmber
class node_ghidra_client toneMint
class node_assistant_runtime,node_tools,node_workflows,node_context,node_citations toneRose
class node_chat_store,node_cache,node_user,node_ghidra,node_llm toneIndigo
```

## Components

### Browser workspace

- [Workspace UI](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/static/js/app.js): `webui/static/js/app.js`
- [Job controls](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/static/js/jobs.js): `webui/static/js/jobs.js`
- [Evidence views](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/static/js/analysis.js): `webui/static/js/analysis.js`
- [Chat workspace](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/static/js/chat.js): `webui/static/js/chat.js`

### Flask application

- [API routes](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/app.py): `webui/app.py`
- [Upload checks](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/file_preflight.py): `webui/file_preflight.py`
- [Request validation](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/validation.py): `webui/validation.py`

### Analysis services

- [Ghidra client](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/ghidra_client.py): `webui/ghidra_client.py`

### Assistant runtime

- [Assistant agent](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/ghidra_assistant.py): `webui/ghidra_assistant.py`
- [Tool registry](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/tools.py): `webui/tools.py`
- [Workflow modes](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/workflows.py): `webui/workflows.py`
- [Bounded context](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/context.py): `webui/context.py`
- [Citation handling](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/citations.py): `webui/citations.py`

### Application state

- [Chat history](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/chat_store.py): `webui/chat_store.py`
- [Summary cache](https://github.com/biniamf/ai-reverse-engineering/blob/main/webui/cache.py): `webui/cache.py`

### Other components

- **Analyst**
- **Ghidra service**
- **LLM endpoint**

## Connections

- Analyst → Workspace UI: uses
- Workspace UI → Job controls: creates
- Workspace UI → Evidence views: creates
- Workspace UI → Chat workspace: creates
- Job controls → API routes: job requests
- Evidence views → API routes: evidence requests
- Chat workspace → API routes: chat requests
- API routes → Upload checks: checks uploads
- API routes → Request validation: validates input
- API routes → Ghidra client: proxies analysis
- Ghidra client → Ghidra service: requests analysis
- API routes → Assistant agent: runs chat
- Assistant agent → Tool registry: dispatches tools
- Assistant agent → Workflow modes: selects workflow
- Assistant agent → Bounded context: bounds messages
- Assistant agent → Ghidra client: fetches evidence
- Assistant agent → LLM endpoint: sends prompts
- LLM endpoint → Assistant agent: returns output
- Assistant agent → Chat history: persists history
- API routes → Chat history: reads history
- API routes → Citation handling: validates citations
- API routes → Summary cache: uses summaries
