# razaa-py/smart-contract-vulnerability-agent architecture

> Architecture diagram of the GitHub repository razaa-py/smart-contract-vulnerability-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/razaa-py/smart-contract-vulnerability-agent
- Repository: https://github.com/razaa-py/smart-contract-vulnerability-agent

## Overview

This is a Flask-based smart-contract vulnerability review app. A user submits Solidity source in the browser; the route runs static analysis, passes its findings and source to AI review, then renders both findings and the review. Static analysis combines custom rule detectors with Slither, while the AI path builds contract context and verifies the model’s response. The excerpts show these entry-point relationships, but omit parts of detectors.py, so internal rule and prompt-processing links are kept at a high level.

Main entry points: [`app.py`](https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/app.py) (Flask route and results), [`detectors.py`](https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/detectors.py) (Unified analyzer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app["Flask route and results<br/>[app.py]"]
end

subgraph group_static["Static analysis"]
  node_analyzer["Unified analyzer<br/>[detectors.py]"]
  node_rules["Rule detectors<br/>[detectors.py]"]
  node_slither["Slither tool"]
end

subgraph group_ai["AI review"]
  node_ai_review["AI review pipeline<br/>[detectors.py]"]
  node_ollama["Ollama model service"]
  node_response_check["Response verification<br/>[detectors.py]"]
end

node_user(("Contract reviewer"))

node_user -->|"submits source"| node_app
node_app -->|"analyzes source"| node_analyzer
node_analyzer -->|"runs rules"| node_rules
node_analyzer -->|"invokes analysis"| node_slither
node_app -->|"requests review"| node_ai_review
node_ai_review -->|"sends prompt"| node_ollama
node_ai_review -->|"verifies response"| node_response_check
node_app -->|"renders results"| node_user

click node_app "https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/app.py"
click node_analyzer "https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/detectors.py"
click node_rules "https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/detectors.py"
click node_ai_review "https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/detectors.py"
click node_response_check "https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/detectors.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_app,node_user toneBlue
class node_analyzer,node_rules,node_slither toneAmber
class node_ai_review,node_ollama,node_response_check toneMint
```

## Components

### Web interface

- [Flask route and results](https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/app.py): `app.py`

### Static analysis

- [Unified analyzer](https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/detectors.py): `detectors.py`
- [Rule detectors](https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/detectors.py): `detectors.py`
- **Slither tool**

### AI review

- [AI review pipeline](https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/detectors.py): `detectors.py`
- **Ollama model service**
- [Response verification](https://github.com/razaa-py/smart-contract-vulnerability-agent/blob/main/detectors.py): `detectors.py`

### Other components

- **Contract reviewer**

## Connections

- Contract reviewer → Flask route and results: submits source
- Flask route and results → Unified analyzer: analyzes source
- Unified analyzer → Rule detectors: runs rules
- Unified analyzer → Slither tool: invokes analysis
- Flask route and results → AI review pipeline: requests review
- AI review pipeline → Ollama model service: sends prompt
- AI review pipeline → Response verification: verifies response
- Flask route and results → Contract reviewer: renders results
