# vdmo/only-dgv-verifier architecture

> Architecture diagram of the GitHub repository vdmo/only-dgv-verifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vdmo/only-dgv-verifier
- Repository: https://github.com/vdmo/only-dgv-verifier
- Video tour (about a minute): https://gitdiagram.com/vdmo/only-dgv-verifier/video

## Overview

DGV is an enforcement gate between AI agents and tool actions: clients submit proposals, the gate evaluates policy, records and signs decisions, and issues a single-use token for allowed actions; execution produces a receipt. The repository also includes offline policy checking and decision replay, Python framework adapters, persistent storage, and a document/evidence subsystem. Edges are limited to README workflow statements and source-index references or excerpts; unsampled implementation details are not inferred.

Main entry points: [`native/dgv-gate/src/main.rs`](https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/main.rs) (HTTP Gate), [`native/only-lang/src/document_execute.rs`](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/document_execute.rs) (Document Execution), [`native/only-lang/src/document_manifest.rs`](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/document_manifest.rs) (Document Manifest), [`dgv_sdk.py`](https://github.com/vdmo/only-dgv-verifier/blob/main/dgv_sdk.py) (Python SDK)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gate["Decision Gate"]
  node_http_gate["HTTP Gate<br/>[main.rs]"]
  node_policy_eval["Policy Evaluation<br/>[lib.rs]"]
  node_check["Offline Policy Check<br/>[check.rs]"]
  node_decision_record["Signed Decisions<br/>[main.rs]"]
  node_token_exec["Token Execution<br/>[main.rs]"]
  node_replay["Decision Replay<br/>[replay.rs]"]
end

subgraph group_clients["Client Integrations"]
  node_sdk["Python SDK<br/>[dgv_sdk.py]"]
  node_langchain["LangChain Adapter<br/>[dgv_langchain.py]"]
  node_crewai["CrewAI Adapter<br/>[dgv_crewai.py]"]
end

subgraph group_persistence["Persistence"]
  node_storage_api["Storage Interface<br/>[lib.rs]"]
  node_sqlite[("SQLite Backend<br/>[sqlite.rs]")]
  node_postgres[("Postgres Backend<br/>[postgres.rs]")]
end

subgraph group_evidence["Documents And Evidence"]
  node_doc_manifest["Document Manifest"]
  node_c2pa["C2PA Reader<br/>[c2pa_read.rs]"]
  node_pir["PIR Watermark<br/>[pir_watermark.rs]"]
  node_doc_delivery["Document Delivery"]
  node_doc_governance["Document Governance"]
  node_doc_execute["Document Execution"]
  node_claims["Claims<br/>[claims.rs]"]
  node_evidence_pack["Evidence Pack<br/>[evidence_pack.rs]"]
  node_evidence_store[("Evidence Store<br/>[evidence_store.rs]")]
end

node_agent(("AI Agent"))
node_external_tool(("Protected Tool"))

node_agent -->|"proposes actions"| node_sdk
node_sdk -->|"calls API"| node_http_gate
node_http_gate -->|"evaluates policy"| node_policy_eval
node_http_gate -->|"signs decision"| node_decision_record
node_http_gate -->|"issues token"| node_token_exec
node_token_exec -->|"authorizes action"| node_external_tool
node_http_gate -->|"runs check"| node_check
node_http_gate -->|"runs replay"| node_replay
node_http_gate -->|"persists records"| node_storage_api
node_storage_api -->|"uses backend"| node_sqlite
node_storage_api -->|"uses backend"| node_postgres
node_langchain -->|"uses client"| node_sdk
node_crewai -->|"uses client"| node_sdk
node_doc_manifest -->|"reads metadata"| node_c2pa
node_doc_manifest -->|"checks watermark"| node_pir
node_doc_delivery -->|"uses manifest"| node_doc_manifest
node_doc_execute -->|"uses claims"| node_claims
node_doc_execute -->|"uses manifest"| node_doc_manifest
node_doc_execute -->|"uses delivery"| node_doc_delivery
node_doc_execute -->|"uses governance"| node_doc_governance
node_evidence_store -->|"writes packs"| node_evidence_pack

click node_sdk "https://github.com/vdmo/only-dgv-verifier/blob/main/dgv_sdk.py"
click node_langchain "https://github.com/vdmo/only-dgv-verifier/blob/main/dgv_langchain.py"
click node_crewai "https://github.com/vdmo/only-dgv-verifier/blob/main/dgv_crewai.py"
click node_http_gate "https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/main.rs"
click node_policy_eval "https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/lib.rs"
click node_check "https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/check.rs"
click node_decision_record "https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/main.rs"
click node_token_exec "https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/main.rs"
click node_replay "https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/replay.rs"
click node_storage_api "https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-storage/src/lib.rs"
click node_sqlite "https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-storage/src/sqlite.rs"
click node_postgres "https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-storage/src/postgres.rs"
click node_doc_manifest "https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/document_manifest.rs"
click node_c2pa "https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/c2pa_read.rs"
click node_pir "https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/pir_watermark.rs"
click node_doc_delivery "https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/document_delivery.rs"
click node_doc_governance "https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/document_governance.rs"
click node_doc_execute "https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/document_execute.rs"
click node_claims "https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/claims.rs"
click node_evidence_pack "https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/evidence_pack.rs"
click node_evidence_store "https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/evidence_store.rs"

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_http_gate,node_policy_eval,node_check,node_decision_record,node_token_exec,node_replay toneBlue
class node_sdk,node_langchain,node_crewai toneAmber
class node_storage_api,node_sqlite,node_postgres toneMint
class node_doc_manifest,node_c2pa,node_pir,node_doc_delivery,node_doc_governance,node_doc_execute,node_claims,node_evidence_pack,node_evidence_store toneRose
class node_agent,node_external_tool toneIndigo
```

## Components

### Decision Gate

- [HTTP Gate](https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/main.rs): `native/dgv-gate/src/main.rs`
- [Policy Evaluation](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/lib.rs): `native/only-lang/src/lib.rs`
- [Offline Policy Check](https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/check.rs): `native/dgv-gate/src/check.rs`
- [Signed Decisions](https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/main.rs): `native/dgv-gate/src/main.rs`
- [Token Execution](https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/main.rs): `native/dgv-gate/src/main.rs`
- [Decision Replay](https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-gate/src/replay.rs): `native/dgv-gate/src/replay.rs`

### Client Integrations

- [Python SDK](https://github.com/vdmo/only-dgv-verifier/blob/main/dgv_sdk.py): `dgv_sdk.py`
- [LangChain Adapter](https://github.com/vdmo/only-dgv-verifier/blob/main/dgv_langchain.py): `dgv_langchain.py`
- [CrewAI Adapter](https://github.com/vdmo/only-dgv-verifier/blob/main/dgv_crewai.py): `dgv_crewai.py`

### Persistence

- [Storage Interface](https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-storage/src/lib.rs): `native/dgv-storage/src/lib.rs`
- [SQLite Backend](https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-storage/src/sqlite.rs): `native/dgv-storage/src/sqlite.rs`
- [Postgres Backend](https://github.com/vdmo/only-dgv-verifier/blob/main/native/dgv-storage/src/postgres.rs): `native/dgv-storage/src/postgres.rs`

### Documents And Evidence

- [Document Manifest](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/document_manifest.rs): `native/only-lang/src/document_manifest.rs`
- [C2PA Reader](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/c2pa_read.rs): `native/only-lang/src/c2pa_read.rs`
- [PIR Watermark](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/pir_watermark.rs): `native/only-lang/src/pir_watermark.rs`
- [Document Delivery](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/document_delivery.rs): `native/only-lang/src/document_delivery.rs`
- [Document Governance](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/document_governance.rs): `native/only-lang/src/document_governance.rs`
- [Document Execution](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/document_execute.rs): `native/only-lang/src/document_execute.rs`
- [Claims](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/claims.rs): `native/only-lang/src/claims.rs`
- [Evidence Pack](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/evidence_pack.rs): `native/only-lang/src/evidence_pack.rs`
- [Evidence Store](https://github.com/vdmo/only-dgv-verifier/blob/main/native/only-lang/src/evidence_store.rs): `native/only-lang/src/evidence_store.rs`

### Other components

- **AI Agent**
- **Protected Tool**

## Connections

- AI Agent → Python SDK: proposes actions (evidence: `README.md`)
- Python SDK → HTTP Gate: calls API (evidence: `README.md`)
- HTTP Gate → Policy Evaluation: evaluates policy (evidence: `README.md`)
- HTTP Gate → Signed Decisions: signs decision (evidence: `README.md`)
- HTTP Gate → Token Execution: issues token (evidence: `README.md`)
- Token Execution → Protected Tool: authorizes action (evidence: `README.md`)
- HTTP Gate → Offline Policy Check: runs check (evidence: `README.md`)
- HTTP Gate → Decision Replay: runs replay (evidence: `README.md`)
- HTTP Gate → Storage Interface: persists records (evidence: `README.md`)
- Storage Interface → SQLite Backend: uses backend (evidence: `native/dgv-storage/src/lib.rs`)
- Storage Interface → Postgres Backend: uses backend (evidence: `native/dgv-storage/src/lib.rs`)
- LangChain Adapter → Python SDK: uses client (evidence: `dgv_langchain.py`)
- CrewAI Adapter → Python SDK: uses client (evidence: `dgv_crewai.py`)
- Document Manifest → C2PA Reader: reads metadata (evidence: `native/only-lang/src/document_manifest.rs`)
- Document Manifest → PIR Watermark: checks watermark (evidence: `native/only-lang/src/document_manifest.rs`)
- Document Delivery → Document Manifest: uses manifest (evidence: `native/only-lang/src/document_delivery.rs`)
- Document Execution → Claims: uses claims (evidence: `native/only-lang/src/document_execute.rs`)
- Document Execution → Document Manifest: uses manifest (evidence: `native/only-lang/src/document_execute.rs`)
- Document Execution → Document Delivery: uses delivery (evidence: `native/only-lang/src/document_execute.rs`)
- Document Execution → Document Governance: uses governance (evidence: `native/only-lang/src/document_execute.rs`)
- Evidence Store → Evidence Pack: writes packs (evidence: `native/only-lang/src/evidence_store.rs`)
