# shankarsai000/vigil architecture

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

- Interactive diagram: https://gitdiagram.com/shankarsai000/vigil
- Repository: https://github.com/shankarsai000/vigil

## Overview

VIGIL is a behavioral security and governance system for AI-agent pipelines, with an operational dashboard. Its documented flow takes agent activity through telemetry and risk evaluation, delegates enforcement to ArmorIQ, applies graduated containment, records evidence, and feeds confirmed incidents into policy improvement and approval. The graph also preserves major product capabilities such as lineage, budgets, attack-graph analysis, Telegram governance, and replay. Some subsystem links are based on README descriptions; unsampled implementation details are not inferred as direct calls.

Main entry points: [`backend/app/remediation/remediation.py`](https://github.com/shankarsai000/vigil/blob/main/backend/app/remediation/remediation.py) (Remediation), [`backend/main.py`](https://github.com/shankarsai000/vigil/blob/main/backend/main.py) (API gateway), [`backend/app/policies/armoriq_gate.py`](https://github.com/shankarsai000/vigil/blob/main/backend/app/policies/armoriq_gate.py) (ArmorIQ policy gate), [`frontend/src/App.tsx`](https://github.com/shankarsai000/vigil/blob/main/frontend/src/App.tsx) (VIGIL dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["Ingress and operations"]
  node_api["API gateway<br/>[main.py]"]
end

subgraph group_risk["Telemetry and risk"]
  node_detector["Threat detection<br/>[detector.py]"]
  node_outputscan["Output scanning<br/>[output_scanner.py]"]
  node_lineage["DIFC lineage<br/>[lineage.py]"]
  node_budgets["Exfiltration budgets<br/>[ledger.py]"]
  node_monitor["Runtime telemetry<br/>[monitor.py]"]
  node_attackgraph["Attack graph"]
  node_thresholds["Threshold configuration<br/>[thresholds.py]"]
end

subgraph group_governance["Policy and containment"]
  node_governance["Governance router"]
  node_gate["ArmorIQ policy gate<br/>[armoriq_gate.py]"]
  node_containment["Containment ladder"]
  node_remediation["Remediation<br/>[remediation.py]"]
  node_mirage["Mirage sandbox<br/>[mirage.py]"]
  node_slack["Slack approval channel<br/>[slack.py]"]
  node_telegram["Telegram governance"]
end

subgraph group_evidence["Audit and immunity"]
  node_registry[("Agent registry<br/>[registry.py]")]
  node_ledger[("Audit ledger<br/>[ledger.py]")]
  node_evidencebundle["Evidence bundles<br/>[bundle.py]"]
  node_immune["Policy immunity workflow<br/>[workflow.py]"]
  node_replay["Counterfactual replay<br/>[replay.py]"]
end

subgraph group_console["Operator console"]
  node_frontend["VIGIL dashboard<br/>[App.tsx]"]
  node_client["Dashboard API client<br/>[api.ts]"]
  node_store["Dashboard state<br/>[store.ts]"]
  node_proposals["Policy proposals view"]
end

node_agent(("Agent activity"))
node_browser(("Operator"))

node_agent -->|"sends activity"| node_api
node_api -->|"routes telemetry"| node_detector
node_detector -.->|"combines risk signals"| node_lineage
node_detector -.->|"scans outputs"| node_outputscan
node_lineage -->|"informs policy"| node_governance
node_budgets -.->|"informs policy"| node_governance
node_monitor -.->|"reports telemetry"| node_api
node_api -.->|"routes decisions"| node_governance
node_governance -->|"evaluates policy"| node_gate
node_gate -->|"records decisions"| node_registry
node_gate -->|"governs actions"| node_containment
node_containment -->|"routes shadow queries"| node_mirage
node_api -->|"dispatches response"| node_remediation
node_remediation -->|"requests decision"| node_gate
node_remediation -->|"logs incidents"| node_registry
node_remediation -->|"analyzes propagation"| node_attackgraph
node_remediation -.->|"requests approval"| node_telegram
node_remediation -.->|"records actions"| node_ledger
node_ledger -->|"seals evidence"| node_evidencebundle
node_registry -.->|"supplies incident records"| node_immune
node_immune -->|"replays candidates"| node_replay
node_replay -->|"routes verified rules"| node_slack
node_browser -->|"uses dashboard"| node_frontend
node_frontend -->|"loads and updates"| node_client
node_client -.->|"calls API"| node_api
node_frontend -->|"reads state"| node_store
node_frontend -->|"renders proposals"| node_proposals
node_proposals -->|"submits approvals"| node_client
node_telegram -->|"reads agent state"| node_registry
node_thresholds -.->|"provides thresholds"| node_gate

click node_api "https://github.com/shankarsai000/vigil/blob/main/backend/main.py"
click node_detector "https://github.com/shankarsai000/vigil/blob/main/backend/app/detection/detector.py"
click node_outputscan "https://github.com/shankarsai000/vigil/blob/main/backend/app/detection/output_scanner.py"
click node_lineage "https://github.com/shankarsai000/vigil/blob/main/backend/app/provenance/lineage.py"
click node_budgets "https://github.com/shankarsai000/vigil/blob/main/backend/app/budgets/ledger.py"
click node_monitor "https://github.com/shankarsai000/vigil/blob/main/backend/app/telemetry/monitor.py"
click node_attackgraph "https://github.com/shankarsai000/vigil/blob/main/backend/services/attack_graph_service.py"
click node_governance "https://github.com/shankarsai000/vigil/blob/main/backend/app/policies/governance_router.py"
click node_gate "https://github.com/shankarsai000/vigil/blob/main/backend/app/policies/armoriq_gate.py"
click node_containment "https://github.com/shankarsai000/vigil/blob/main/backend/app/policies/containment_ladder.py"
click node_remediation "https://github.com/shankarsai000/vigil/blob/main/backend/app/remediation/remediation.py"
click node_mirage "https://github.com/shankarsai000/vigil/blob/main/backend/app/runtime/mirage.py"
click node_registry "https://github.com/shankarsai000/vigil/blob/main/backend/app/runtime/registry.py"
click node_ledger "https://github.com/shankarsai000/vigil/blob/main/backend/app/runtime/ledger.py"
click node_evidencebundle "https://github.com/shankarsai000/vigil/blob/main/backend/app/evidence/bundle.py"
click node_immune "https://github.com/shankarsai000/vigil/blob/main/backend/app/immune/workflow.py"
click node_replay "https://github.com/shankarsai000/vigil/blob/main/backend/app/immune/replay.py"
click node_slack "https://github.com/shankarsai000/vigil/blob/main/backend/app/channels/slack.py"
click node_telegram "https://github.com/shankarsai000/vigil/blob/main/backend/services/telegram_service.py"
click node_frontend "https://github.com/shankarsai000/vigil/blob/main/frontend/src/App.tsx"
click node_client "https://github.com/shankarsai000/vigil/blob/main/frontend/src/api.ts"
click node_store "https://github.com/shankarsai000/vigil/blob/main/frontend/src/store.ts"
click node_proposals "https://github.com/shankarsai000/vigil/blob/main/frontend/src/components/PolicyProposalsView.tsx"
click node_thresholds "https://github.com/shankarsai000/vigil/blob/main/backend/app/runtime/thresholds.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_api toneBlue
class node_detector,node_outputscan,node_lineage,node_budgets,node_monitor,node_attackgraph,node_thresholds toneAmber
class node_governance,node_gate,node_containment,node_remediation,node_mirage,node_slack,node_telegram toneMint
class node_registry,node_ledger,node_evidencebundle,node_immune,node_replay toneRose
class node_frontend,node_client,node_store,node_proposals,node_agent,node_browser toneIndigo
```

## Components

### Ingress and operations

- [API gateway](https://github.com/shankarsai000/vigil/blob/main/backend/main.py): `backend/main.py`

### Telemetry and risk

- [Threat detection](https://github.com/shankarsai000/vigil/blob/main/backend/app/detection/detector.py): `backend/app/detection/detector.py`
- [Output scanning](https://github.com/shankarsai000/vigil/blob/main/backend/app/detection/output_scanner.py): `backend/app/detection/output_scanner.py`
- [DIFC lineage](https://github.com/shankarsai000/vigil/blob/main/backend/app/provenance/lineage.py): `backend/app/provenance/lineage.py`
- [Exfiltration budgets](https://github.com/shankarsai000/vigil/blob/main/backend/app/budgets/ledger.py): `backend/app/budgets/ledger.py`
- [Runtime telemetry](https://github.com/shankarsai000/vigil/blob/main/backend/app/telemetry/monitor.py): `backend/app/telemetry/monitor.py`
- [Attack graph](https://github.com/shankarsai000/vigil/blob/main/backend/services/attack_graph_service.py): `backend/services/attack_graph_service.py`
- [Threshold configuration](https://github.com/shankarsai000/vigil/blob/main/backend/app/runtime/thresholds.py): `backend/app/runtime/thresholds.py`

### Policy and containment

- [Governance router](https://github.com/shankarsai000/vigil/blob/main/backend/app/policies/governance_router.py): `backend/app/policies/governance_router.py`
- [ArmorIQ policy gate](https://github.com/shankarsai000/vigil/blob/main/backend/app/policies/armoriq_gate.py): `backend/app/policies/armoriq_gate.py`
- [Containment ladder](https://github.com/shankarsai000/vigil/blob/main/backend/app/policies/containment_ladder.py): `backend/app/policies/containment_ladder.py`
- [Remediation](https://github.com/shankarsai000/vigil/blob/main/backend/app/remediation/remediation.py): `backend/app/remediation/remediation.py`
- [Mirage sandbox](https://github.com/shankarsai000/vigil/blob/main/backend/app/runtime/mirage.py): `backend/app/runtime/mirage.py`
- [Slack approval channel](https://github.com/shankarsai000/vigil/blob/main/backend/app/channels/slack.py): `backend/app/channels/slack.py`
- [Telegram governance](https://github.com/shankarsai000/vigil/blob/main/backend/services/telegram_service.py): `backend/services/telegram_service.py`

### Audit and immunity

- [Agent registry](https://github.com/shankarsai000/vigil/blob/main/backend/app/runtime/registry.py): `backend/app/runtime/registry.py`
- [Audit ledger](https://github.com/shankarsai000/vigil/blob/main/backend/app/runtime/ledger.py): `backend/app/runtime/ledger.py`
- [Evidence bundles](https://github.com/shankarsai000/vigil/blob/main/backend/app/evidence/bundle.py): `backend/app/evidence/bundle.py`
- [Policy immunity workflow](https://github.com/shankarsai000/vigil/blob/main/backend/app/immune/workflow.py): `backend/app/immune/workflow.py`
- [Counterfactual replay](https://github.com/shankarsai000/vigil/blob/main/backend/app/immune/replay.py): `backend/app/immune/replay.py`

### Operator console

- [VIGIL dashboard](https://github.com/shankarsai000/vigil/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard API client](https://github.com/shankarsai000/vigil/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [Dashboard state](https://github.com/shankarsai000/vigil/blob/main/frontend/src/store.ts): `frontend/src/store.ts`
- [Policy proposals view](https://github.com/shankarsai000/vigil/blob/main/frontend/src/components/PolicyProposalsView.tsx): `frontend/src/components/PolicyProposalsView.tsx`

### Other components

- **Agent activity**
- **Operator**

## Connections

- Agent activity → API gateway: sends activity
- API gateway → Threat detection: routes telemetry (evidence: `backend/main.py`)
- Threat detection → DIFC lineage: combines risk signals
- Threat detection → Output scanning: scans outputs
- DIFC lineage → Governance router: informs policy
- Exfiltration budgets → Governance router: informs policy
- Runtime telemetry → API gateway: reports telemetry (evidence: `backend/main.py`)
- API gateway → Governance router: routes decisions (evidence: `backend/main.py`)
- Governance router → ArmorIQ policy gate: evaluates policy (evidence: `backend/app/policies/governance_router.py`)
- ArmorIQ policy gate → Agent registry: records decisions (evidence: `backend/app/policies/armoriq_gate.py`)
- ArmorIQ policy gate → Containment ladder: governs actions
- Containment ladder → Mirage sandbox: routes shadow queries
- API gateway → Remediation: dispatches response (evidence: `backend/main.py`)
- Remediation → ArmorIQ policy gate: requests decision (evidence: `backend/app/remediation/remediation.py`)
- Remediation → Agent registry: logs incidents (evidence: `backend/app/remediation/remediation.py`)
- Remediation → Attack graph: analyzes propagation (evidence: `backend/app/remediation/remediation.py`)
- Remediation → Telegram governance: requests approval
- Remediation → Audit ledger: records actions
- Audit ledger → Evidence bundles: seals evidence
- Agent registry → Policy immunity workflow: supplies incident records
- Policy immunity workflow → Counterfactual replay: replays candidates (evidence: `backend/app/immune/workflow.py`)
- Counterfactual replay → Slack approval channel: routes verified rules
- Operator → VIGIL dashboard: uses dashboard (evidence: `frontend/src/App.tsx`)
- VIGIL dashboard → Dashboard API client: loads and updates (evidence: `frontend/src/App.tsx`)
- Dashboard API client → API gateway: calls API
- VIGIL dashboard → Dashboard state: reads state (evidence: `frontend/src/App.tsx`)
- VIGIL dashboard → Policy proposals view: renders proposals (evidence: `frontend/src/App.tsx`)
- Policy proposals view → Dashboard API client: submits approvals (evidence: `frontend/src/components/PolicyProposalsView.tsx`)
- Telegram governance → Agent registry: reads agent state (evidence: `backend/services/telegram_service.py`)
- Threshold configuration → ArmorIQ policy gate: provides thresholds (evidence: `backend/app/policies/armoriq_gate.py`)
