# acunningham-ship-it/leakproof architecture

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

- Interactive diagram: https://gitdiagram.com/acunningham-ship-it/leakproof
- Repository: https://github.com/acunningham-ship-it/leakproof

## Overview

leakproof is a local-first secret and PII firewall for AI coding tools. Developers either run a tool through its local proxy, which scans outbound requests and monitors, redacts, or blocks them before forwarding, or install a Git hook to scan staged changes before commit. Both surfaces produce audit events that the watch dashboard reads. Scanning combines deterministic rules with an optional local-model pass. Edges reflect excerpts, SOURCE INDEX references, and README statements; adapters and some CLI routing details were not sampled, so uncertain connections are omitted or marked unverified.

Main entry points: [`src/leakproof/proxy/server.py`](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/proxy/server.py) (Egress proxy), [`src/leakproof/cli.py`](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/cli.py) (CLI commands), [`src/leakproof/scanner/__init__.py`](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/scanner/__init__.py) (Scan and redact), [`src/leakproof/hook/core.py`](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/hook/core.py) (Staged-change check)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_adapters["Tool adapters<br/>[adapters.py]"]
  node_hook_installer["Hook installer<br/>[install.py]"]
end

subgraph group_scan["Detection"]
  node_scanner["Scan and redact<br/>[__init__.py]"]
  node_rules["Rules and entropy<br/>[rules.py]"]
  node_semantic["Semantic scan<br/>[semantic.py]"]
end

subgraph group_surfaces["Firewall surfaces"]
  node_proxy["Egress proxy<br/>[server.py]"]
  node_hook["Staged-change check<br/>[core.py]"]
end

subgraph group_audit["Audit and review"]
  node_audit_log[("Audit log<br/>[audit.py]")]
  node_dashboard["Watch dashboard<br/>[dashboard.py]"]
  node_audit_demo["Demo event generator<br/>[audit_demo.py]"]
end

node_developer(("Developer"))
node_ai_tool["AI coding tool"]
node_model_api["Model API"]
node_ollama["Local Ollama"]
node_git(("Git commit"))

node_developer -->|"runs commands"| node_cli
node_cli -->|"starts proxy"| node_proxy
node_cli -.->|"launches tool"| node_adapters
node_adapters -.->|"sets base URL"| node_ai_tool
node_ai_tool -->|"sends requests"| node_proxy
node_proxy -->|"scans payload"| node_scanner
node_proxy -->|"records events"| node_audit_log
node_proxy -->|"forwards request"| node_model_api
node_developer -->|"installs hook"| node_hook_installer
node_hook_installer -->|"installs entry point"| node_hook
node_git -->|"checks staged changes"| node_hook
node_hook -->|"scans and redacts"| node_scanner
node_hook -->|"records findings"| node_audit_log
node_scanner -->|"runs detectors"| node_rules
node_scanner -->|"adds semantic findings"| node_semantic
node_semantic -->|"queries local model"| node_ollama
node_developer -->|"watches activity"| node_dashboard
node_dashboard -->|"reads events"| node_audit_log
node_audit_demo -->|"writes demo events"| node_audit_log
node_cli -->|"generates demo log"| node_audit_demo

click node_cli "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/cli.py"
click node_adapters "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/adapters.py"
click node_hook_installer "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/hook/install.py"
click node_scanner "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/scanner/__init__.py"
click node_rules "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/scanner/rules.py"
click node_semantic "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/scanner/semantic.py"
click node_proxy "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/proxy/server.py"
click node_hook "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/hook/core.py"
click node_audit_log "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/audit.py"
click node_dashboard "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/tui/dashboard.py"
click node_audit_demo "https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/audit_demo.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_cli,node_adapters,node_hook_installer toneBlue
class node_scanner,node_rules,node_semantic toneAmber
class node_proxy,node_hook,node_model_api toneMint
class node_audit_log,node_dashboard,node_audit_demo toneRose
class node_developer,node_ai_tool,node_ollama,node_git toneIndigo
```

## Components

### User entry points

- [CLI commands](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/cli.py): `src/leakproof/cli.py`
- [Tool adapters](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/adapters.py): `src/leakproof/adapters.py`
- [Hook installer](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/hook/install.py): `src/leakproof/hook/install.py`

### Detection

- [Scan and redact](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/scanner/__init__.py): `src/leakproof/scanner/__init__.py`
- [Rules and entropy](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/scanner/rules.py): `src/leakproof/scanner/rules.py`
- [Semantic scan](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/scanner/semantic.py): `src/leakproof/scanner/semantic.py`

### Firewall surfaces

- [Egress proxy](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/proxy/server.py): `src/leakproof/proxy/server.py`
- [Staged-change check](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/hook/core.py): `src/leakproof/hook/core.py`

### Audit and review

- [Audit log](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/audit.py): `src/leakproof/audit.py`
- [Watch dashboard](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/tui/dashboard.py): `src/leakproof/tui/dashboard.py`
- [Demo event generator](https://github.com/acunningham-ship-it/leakproof/blob/master/src/leakproof/audit_demo.py): `src/leakproof/audit_demo.py`

### Other components

- **Developer**
- **AI coding tool**
- **Model API**
- **Local Ollama**
- **Git commit**

## Connections

- Developer → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Egress proxy: starts proxy (evidence: `README.md`)
- CLI commands → Tool adapters: launches tool
- Tool adapters → AI coding tool: sets base URL
- AI coding tool → Egress proxy: sends requests (evidence: `README.md`)
- Egress proxy → Scan and redact: scans payload (evidence: `src/leakproof/proxy/server.py`)
- Egress proxy → Audit log: records events (evidence: `src/leakproof/proxy/server.py`)
- Egress proxy → Model API: forwards request (evidence: `README.md`)
- Developer → Hook installer: installs hook (evidence: `README.md`)
- Hook installer → Staged-change check: installs entry point (evidence: `src/leakproof/hook/install.py`)
- Git commit → Staged-change check: checks staged changes
- Staged-change check → Scan and redact: scans and redacts (evidence: `src/leakproof/hook/core.py`)
- Staged-change check → Audit log: records findings (evidence: `src/leakproof/hook/core.py`)
- Scan and redact → Rules and entropy: runs detectors (evidence: `src/leakproof/scanner/__init__.py`)
- Scan and redact → Semantic scan: adds semantic findings (evidence: `src/leakproof/scanner/__init__.py`)
- Semantic scan → Local Ollama: queries local model (evidence: `src/leakproof/scanner/semantic.py`)
- Developer → Watch dashboard: watches activity (evidence: `README.md`)
- Watch dashboard → Audit log: reads events (evidence: `src/leakproof/tui/dashboard.py`)
- Demo event generator → Audit log: writes demo events (evidence: `src/leakproof/audit_demo.py`)
- CLI commands → Demo event generator: generates demo log (evidence: `src/leakproof/cli.py`)
