# harqer/artex architecture

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

- Interactive diagram: https://gitdiagram.com/harqer/artex
- Repository: https://github.com/harqer/artex

## Overview

ARTEX is a self-hosted, LLM-driven penetration-testing platform. An operator configures and starts a task; the planner decomposes its goal into intents, workers run tools against the target, and results update the task’s exploration graph and shared asset graph. Findings retain traffic evidence, while scope checks, interception approvals, and budgets constrain autonomous actions. The README documents this workflow and the two graphs; sampled source confirms key engine, ingestion, and persistence responsibilities, but not every runtime connection, so uncertain links are omitted.

Main entry points: [`agent/worker.go`](https://github.com/harqer/artex/blob/main/agent/worker.go) (Tool workers), [`server/server.go`](https://github.com/harqer/artex/blob/main/server/server.go) (HTTP API), [`db/exploration.go`](https://github.com/harqer/artex/blob/main/db/exploration.go) (Exploration graph), [`server/engine.go`](https://github.com/harqer/artex/blob/main/server/engine.go) (Task engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Product entry"]
  node_web["Web interface"]
  node_api["HTTP API<br/>[server.go]"]
end

subgraph group_execution["Task execution"]
  node_engine["Task engine<br/>[engine.go]"]
  node_planner["Goal planner<br/>[planner.go]"]
  node_worker["Tool workers<br/>[worker.go]"]
  node_scan["Scan ingestion<br/>[scan_ingest.go]"]
end

subgraph group_safety["Safety controls"]
  node_guard["Scope and approvals<br/>[guard.go]"]
  node_intercept["Interception<br/>[intercept.go]"]
  node_egress["Egress controls<br/>[egress.go]"]
end

subgraph group_records["Evidence and state"]
  node_assets[("Shared asset graph<br/>[assets.go]")]
  node_exploration[("Exploration graph<br/>[exploration.go]")]
  node_findings[("Findings<br/>[findings.go]")]
  node_traffic["Traffic capture<br/>[traffic.go]"]
  node_evidence["Evidence store<br/>[store.go]"]
  node_llmrec[("LLM records<br/>[llmrec.go]")]
end

subgraph group_interfaces["Interfaces"]
  node_chat["Chat bridge<br/>[router.go]"]
end

node_operator(("Operator"))
node_postgres[("PostgreSQL")]
node_llm["LLM providers"]
node_target(("Test target"))

node_operator -->|"uses"| node_web
node_web -->|"calls"| node_api
node_api -.->|"controls tasks"| node_engine
node_engine -->|"runs"| node_planner
node_engine -->|"dispatches"| node_worker
node_planner -->|"reads progress"| node_exploration
node_worker -->|"tests"| node_target
node_worker -->|"writes observations"| node_assets
node_worker -->|"writes results"| node_exploration
node_worker -->|"passes gates"| node_guard
node_worker -.->|"requests reasoning"| node_llm
node_scan -->|"inserts assets"| node_assets
node_scan -->|"records facts"| node_exploration
node_traffic -->|"supplies traffic"| node_evidence
node_evidence -->|"persists evidence"| node_postgres
node_assets -.->|"stores graph"| node_postgres
node_exploration -.->|"stores graph"| node_postgres
node_findings -->|"anchors proof"| node_evidence
node_egress -->|"consults rules"| node_intercept
node_chat -.->|"bridges chat"| node_api
node_llmrec -->|"records usage"| node_postgres
node_api -.->|"records calls"| node_llmrec

click node_web "https://github.com/harqer/artex/tree/main/web/src/app"
click node_api "https://github.com/harqer/artex/blob/main/server/server.go"
click node_engine "https://github.com/harqer/artex/blob/main/server/engine.go"
click node_planner "https://github.com/harqer/artex/blob/main/agent/planner.go"
click node_worker "https://github.com/harqer/artex/blob/main/agent/worker.go"
click node_scan "https://github.com/harqer/artex/blob/main/agent/scan_ingest.go"
click node_assets "https://github.com/harqer/artex/blob/main/db/assets.go"
click node_exploration "https://github.com/harqer/artex/blob/main/db/exploration.go"
click node_findings "https://github.com/harqer/artex/blob/main/db/findings.go"
click node_traffic "https://github.com/harqer/artex/blob/main/traffic/traffic.go"
click node_evidence "https://github.com/harqer/artex/blob/main/evidence/store.go"
click node_guard "https://github.com/harqer/artex/blob/main/guard/guard.go"
click node_intercept "https://github.com/harqer/artex/blob/main/intercept/intercept.go"
click node_egress "https://github.com/harqer/artex/blob/main/egress/egress.go"
click node_llmrec "https://github.com/harqer/artex/blob/main/llmrec/llmrec.go"
click node_chat "https://github.com/harqer/artex/blob/main/chatbridge/router.go"

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_api toneBlue
class node_engine,node_planner,node_worker,node_scan,node_postgres toneAmber
class node_guard,node_intercept,node_egress toneMint
class node_assets,node_exploration,node_findings,node_traffic,node_evidence,node_llmrec toneRose
class node_chat,node_operator,node_llm,node_target toneIndigo
```

## Components

### Product entry

- [Web interface](https://github.com/harqer/artex/tree/main/web/src/app): `web/src/app`
- [HTTP API](https://github.com/harqer/artex/blob/main/server/server.go): `server/server.go`

### Task execution

- [Task engine](https://github.com/harqer/artex/blob/main/server/engine.go): `server/engine.go`
- [Goal planner](https://github.com/harqer/artex/blob/main/agent/planner.go): `agent/planner.go`
- [Tool workers](https://github.com/harqer/artex/blob/main/agent/worker.go): `agent/worker.go`
- [Scan ingestion](https://github.com/harqer/artex/blob/main/agent/scan_ingest.go): `agent/scan_ingest.go`

### Safety controls

- [Scope and approvals](https://github.com/harqer/artex/blob/main/guard/guard.go): `guard/guard.go`
- [Interception](https://github.com/harqer/artex/blob/main/intercept/intercept.go): `intercept/intercept.go`
- [Egress controls](https://github.com/harqer/artex/blob/main/egress/egress.go): `egress/egress.go`

### Evidence and state

- [Shared asset graph](https://github.com/harqer/artex/blob/main/db/assets.go): `db/assets.go`
- [Exploration graph](https://github.com/harqer/artex/blob/main/db/exploration.go): `db/exploration.go`
- [Findings](https://github.com/harqer/artex/blob/main/db/findings.go): `db/findings.go`
- [Traffic capture](https://github.com/harqer/artex/blob/main/traffic/traffic.go): `traffic/traffic.go`
- [Evidence store](https://github.com/harqer/artex/blob/main/evidence/store.go): `evidence/store.go`
- [LLM records](https://github.com/harqer/artex/blob/main/llmrec/llmrec.go): `llmrec/llmrec.go`

### Interfaces

- [Chat bridge](https://github.com/harqer/artex/blob/main/chatbridge/router.go): `chatbridge/router.go`

### Other components

- **Operator**
- **PostgreSQL**
- **LLM providers**
- **Test target**

## Connections

- Operator → Web interface: uses (evidence: `README.md`)
- Web interface → HTTP API: calls
- HTTP API → Task engine: controls tasks
- Task engine → Goal planner: runs (evidence: `server/engine.go`)
- Task engine → Tool workers: dispatches (evidence: `server/engine.go`)
- Goal planner → Exploration graph: reads progress (evidence: `README.md`)
- Tool workers → Test target: tests (evidence: `README.md`)
- Tool workers → Shared asset graph: writes observations (evidence: `README.md`)
- Tool workers → Exploration graph: writes results (evidence: `README.md`)
- Tool workers → Scope and approvals: passes gates (evidence: `README.md`)
- Tool workers → LLM providers: requests reasoning
- Scan ingestion → Shared asset graph: inserts assets
- Scan ingestion → Exploration graph: records facts
- Traffic capture → Evidence store: supplies traffic (evidence: `evidence/store.go`)
- Evidence store → PostgreSQL: persists evidence (evidence: `evidence/store.go`)
- Shared asset graph → PostgreSQL: stores graph
- Exploration graph → PostgreSQL: stores graph
- Findings → Evidence store: anchors proof (evidence: `README.md`)
- Egress controls → Interception: consults rules (evidence: `egress/egress.go`)
- Chat bridge → HTTP API: bridges chat
- LLM records → PostgreSQL: records usage (evidence: `llmrec/llmrec.go`)
- HTTP API → LLM records: records calls
