# chinmaynakwa/warrant. architecture

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

- Interactive diagram: https://gitdiagram.com/chinmaynakwa/warrant.
- Repository: https://github.com/chinmaynakwa/warrant.

## Overview

Warrant is a security-incident analysis product: analysts file incidents against Sysmon captures, run baseline or guarded model analysis, and inspect evidence-backed claims and evaluation results. The graph preserves the documented capture, slicing, validation, repair, dashboard, and evaluation capabilities. Some subsystems are represented by their exact directories because their implementation was not sampled; edges are limited to source-index references and README statements.

Main entry points: [`backend/guardrail/analyst.py`](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/analyst.py) (Incident analyst), [`backend/app.py`](https://github.com/chinmaynakwa/warrant./blob/main/backend/app.py) (HTTP application), [`frontend/app`](https://github.com/chinmaynakwa/warrant./tree/main/frontend/app) (Web pages), [`backend/guardrail/routes.py`](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/routes.py) (Run endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Analyst interface"]
  node_web["Web pages"]
  node_claimview["Claim graph<br/>[ClaimGraph.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_auth_ui["Session auth<br/>[auth.tsx]"]
  node_evaluation_page["Evaluation view<br/>[page.tsx]"]
  node_dashboard_page["Dashboard view<br/>[page.tsx]"]
  node_incident_page["Incident detail<br/>[page.tsx]"]
end

subgraph group_api["Application API"]
  node_app["HTTP application<br/>[app.py]"]
  node_auth_routes["Auth endpoints<br/>[auth.py]"]
  node_auth_logic["Auth services<br/>[auth.py]"]
  node_incident_routes["Incident endpoints<br/>[incidents.py]"]
  node_run_routes["Run endpoints<br/>[routes.py]"]
  node_dashboard["Dashboard data<br/>[dashboard.py]"]
  node_evaluation_api["Evaluation endpoint<br/>[evaluation.py]"]
end

subgraph group_analysis["Guardrail analysis"]
  node_incident_analyst["Incident analyst<br/>[analyst.py]"]
  node_slicer["Event slicing<br/>[slicer.py]"]
  node_prompt["Analysis prompt<br/>[prompt.py]"]
  node_llm["Ollama model<br/>[llm.py]"]
  node_answer["Answer parsing<br/>[answer.py]"]
  node_guard["Repair and filtering<br/>[guard.py]"]
  node_validator["Evidence validation<br/>[validator.py]"]
  node_evaluation["Evaluation metrics<br/>[evaluation.py]"]
  node_metrics["Run scoring<br/>[metrics.py]"]
end

subgraph group_data["Telemetry and persistence"]
  node_captures["Capture ingestion<br/>[ingest.py]"]
  node_incidents["Incident access<br/>[incidents.py]"]
  node_models[("Stored entities<br/>[models.py]")]
  node_database[("Database sessions<br/>[database.py]")]
end

node_security_analyst(("Security analyst"))

node_security_analyst -->|"uses"| node_web
node_web -.->|"requests"| node_api_client
node_web -.->|"displays claims"| node_claimview
node_web -.->|"authenticates"| node_auth_ui
node_app -->|"registers"| node_auth_routes
node_app -->|"registers"| node_incident_routes
node_app -->|"registers"| node_run_routes
node_app -->|"registers"| node_dashboard
node_app -->|"registers"| node_evaluation_api
node_auth_routes -->|"calls"| node_auth_logic
node_incident_routes -->|"checks ownership"| node_incidents
node_run_routes -->|"checks ownership"| node_incidents
node_run_routes -->|"starts analysis"| node_incident_analyst
node_incident_analyst -->|"uses"| node_slicer
node_incident_analyst -->|"uses"| node_prompt
node_incident_analyst -->|"calls"| node_llm
node_incident_analyst -->|"parses with"| node_answer
node_incident_analyst -->|"uses"| node_guard
node_incident_analyst -->|"validates with"| node_validator
node_incident_analyst -->|"loads incident"| node_incidents
node_incident_analyst -.->|"persists run"| node_models
node_evaluation -->|"runs scenarios"| node_incident_analyst
node_evaluation -->|"scores runs"| node_metrics
node_captures -->|"writes events"| node_models
node_models -->|"uses base"| node_database
node_evaluation_page -.->|"shows results"| node_incident_analyst
node_dashboard_page -.->|"shows summary"| node_dashboard
node_incident_page -->|"starts and views runs"| node_run_routes
node_incident_analyst -.->|"analyzes telemetry"| node_captures

click node_web "https://github.com/chinmaynakwa/warrant./tree/main/frontend/app"
click node_claimview "https://github.com/chinmaynakwa/warrant./blob/main/frontend/components/ClaimGraph.tsx"
click node_api_client "https://github.com/chinmaynakwa/warrant./blob/main/frontend/lib/api.ts"
click node_auth_ui "https://github.com/chinmaynakwa/warrant./blob/main/frontend/lib/auth.tsx"
click node_app "https://github.com/chinmaynakwa/warrant./blob/main/backend/app.py"
click node_auth_routes "https://github.com/chinmaynakwa/warrant./blob/main/backend/routes/auth.py"
click node_auth_logic "https://github.com/chinmaynakwa/warrant./blob/main/backend/auth.py"
click node_incident_routes "https://github.com/chinmaynakwa/warrant./blob/main/backend/routes/incidents.py"
click node_run_routes "https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/routes.py"
click node_dashboard "https://github.com/chinmaynakwa/warrant./blob/main/backend/dashboard.py"
click node_evaluation_api "https://github.com/chinmaynakwa/warrant./blob/main/backend/routes/evaluation.py"
click node_incident_analyst "https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/analyst.py"
click node_slicer "https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/slicer.py"
click node_prompt "https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/prompt.py"
click node_llm "https://github.com/chinmaynakwa/warrant./blob/main/backend/llm.py"
click node_answer "https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/answer.py"
click node_guard "https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/guard.py"
click node_validator "https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/validator.py"
click node_evaluation "https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/evaluation.py"
click node_metrics "https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/metrics.py"
click node_captures "https://github.com/chinmaynakwa/warrant./blob/main/backend/telemetry/ingest.py"
click node_incidents "https://github.com/chinmaynakwa/warrant./blob/main/backend/incidents.py"
click node_models "https://github.com/chinmaynakwa/warrant./blob/main/backend/models.py"
click node_database "https://github.com/chinmaynakwa/warrant./blob/main/backend/database.py"
click node_evaluation_page "https://github.com/chinmaynakwa/warrant./blob/main/frontend/app/evaluation/page.tsx"
click node_dashboard_page "https://github.com/chinmaynakwa/warrant./blob/main/frontend/app/dashboard/page.tsx"
click node_incident_page "https://github.com/chinmaynakwa/warrant./blob/main/frontend/app/incidents/%5Bid%5D/page.tsx"

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_claimview,node_api_client,node_auth_ui,node_evaluation_page,node_dashboard_page,node_incident_page toneBlue
class node_app,node_auth_routes,node_auth_logic,node_incident_routes,node_run_routes,node_dashboard,node_evaluation_api toneAmber
class node_incident_analyst,node_slicer,node_prompt,node_llm,node_answer,node_guard,node_validator,node_evaluation,node_metrics toneMint
class node_captures,node_incidents,node_models,node_database toneRose
class node_security_analyst toneIndigo
```

## Components

### Analyst interface

- [Web pages](https://github.com/chinmaynakwa/warrant./tree/main/frontend/app): `frontend/app`
- [Claim graph](https://github.com/chinmaynakwa/warrant./blob/main/frontend/components/ClaimGraph.tsx): `frontend/components/ClaimGraph.tsx`
- [API client](https://github.com/chinmaynakwa/warrant./blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`
- [Session auth](https://github.com/chinmaynakwa/warrant./blob/main/frontend/lib/auth.tsx): `frontend/lib/auth.tsx`
- [Evaluation view](https://github.com/chinmaynakwa/warrant./blob/main/frontend/app/evaluation/page.tsx): `frontend/app/evaluation/page.tsx`
- [Dashboard view](https://github.com/chinmaynakwa/warrant./blob/main/frontend/app/dashboard/page.tsx): `frontend/app/dashboard/page.tsx`
- [Incident detail](https://github.com/chinmaynakwa/warrant./blob/main/frontend/app/incidents/%5Bid%5D/page.tsx): `frontend/app/incidents/[id]/page.tsx`

### Application API

- [HTTP application](https://github.com/chinmaynakwa/warrant./blob/main/backend/app.py): `backend/app.py`
- [Auth endpoints](https://github.com/chinmaynakwa/warrant./blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [Auth services](https://github.com/chinmaynakwa/warrant./blob/main/backend/auth.py): `backend/auth.py`
- [Incident endpoints](https://github.com/chinmaynakwa/warrant./blob/main/backend/routes/incidents.py): `backend/routes/incidents.py`
- [Run endpoints](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/routes.py): `backend/guardrail/routes.py`
- [Dashboard data](https://github.com/chinmaynakwa/warrant./blob/main/backend/dashboard.py): `backend/dashboard.py`
- [Evaluation endpoint](https://github.com/chinmaynakwa/warrant./blob/main/backend/routes/evaluation.py): `backend/routes/evaluation.py`

### Guardrail analysis

- [Incident analyst](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/analyst.py): `backend/guardrail/analyst.py`
- [Event slicing](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/slicer.py): `backend/guardrail/slicer.py`
- [Analysis prompt](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/prompt.py): `backend/guardrail/prompt.py`
- [Ollama model](https://github.com/chinmaynakwa/warrant./blob/main/backend/llm.py): `backend/llm.py`
- [Answer parsing](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/answer.py): `backend/guardrail/answer.py`
- [Repair and filtering](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/guard.py): `backend/guardrail/guard.py`
- [Evidence validation](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/validator.py): `backend/guardrail/validator.py`
- [Evaluation metrics](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/evaluation.py): `backend/guardrail/evaluation.py`
- [Run scoring](https://github.com/chinmaynakwa/warrant./blob/main/backend/guardrail/metrics.py): `backend/guardrail/metrics.py`

### Telemetry and persistence

- [Capture ingestion](https://github.com/chinmaynakwa/warrant./blob/main/backend/telemetry/ingest.py): `backend/telemetry/ingest.py`
- [Incident access](https://github.com/chinmaynakwa/warrant./blob/main/backend/incidents.py): `backend/incidents.py`
- [Stored entities](https://github.com/chinmaynakwa/warrant./blob/main/backend/models.py): `backend/models.py`
- [Database sessions](https://github.com/chinmaynakwa/warrant./blob/main/backend/database.py): `backend/database.py`

### Other components

- **Security analyst**

## Connections

- Security analyst → Web pages: uses
- Web pages → API client: requests
- Web pages → Claim graph: displays claims
- Web pages → Session auth: authenticates
- HTTP application → Auth endpoints: registers (evidence: `backend/app.py`)
- HTTP application → Incident endpoints: registers (evidence: `backend/app.py`)
- HTTP application → Run endpoints: registers (evidence: `backend/app.py`)
- HTTP application → Dashboard data: registers (evidence: `backend/app.py`)
- HTTP application → Evaluation endpoint: registers (evidence: `backend/app.py`)
- Auth endpoints → Auth services: calls (evidence: `backend/routes/auth.py`)
- Incident endpoints → Incident access: checks ownership (evidence: `backend/routes/incidents.py`)
- Run endpoints → Incident access: checks ownership (evidence: `backend/guardrail/routes.py`)
- Run endpoints → Incident analyst: starts analysis (evidence: `backend/guardrail/routes.py`)
- Incident analyst → Event slicing: uses (evidence: `backend/guardrail/analyst.py`)
- Incident analyst → Analysis prompt: uses (evidence: `backend/guardrail/analyst.py`)
- Incident analyst → Ollama model: calls (evidence: `backend/guardrail/analyst.py`)
- Incident analyst → Answer parsing: parses with (evidence: `backend/guardrail/analyst.py`)
- Incident analyst → Repair and filtering: uses (evidence: `backend/guardrail/analyst.py`)
- Incident analyst → Evidence validation: validates with (evidence: `backend/guardrail/analyst.py`)
- Incident analyst → Incident access: loads incident (evidence: `backend/guardrail/analyst.py`)
- Incident analyst → Stored entities: persists run (evidence: `backend/guardrail/analyst.py`)
- Evaluation metrics → Incident analyst: runs scenarios (evidence: `backend/guardrail/evaluation.py`)
- Evaluation metrics → Run scoring: scores runs (evidence: `backend/guardrail/evaluation.py`)
- Capture ingestion → Stored entities: writes events (evidence: `backend/telemetry/ingest.py`)
- Stored entities → Database sessions: uses base (evidence: `backend/models.py`)
- Evaluation view → Incident analyst: shows results
- Dashboard view → Dashboard data: shows summary
- Incident detail → Run endpoints: starts and views runs
- Incident analyst → Capture ingestion: analyzes telemetry
