# thihal/consent-audit architecture

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

- Interactive diagram: https://gitdiagram.com/thihal/consent-audit
- Repository: https://github.com/thihal/consent-audit

## Overview

consent-audit is a browser-based consent and device-fingerprinting auditor. Its main workflow starts with a configured site or CLI request, runs isolated browser visits, captures consent-state evidence, classifies cookies and identifiers, checks findings, and writes JSON/Markdown reports. A second experiment compares selected identifiers across fresh contexts. The README also documents a Claude Code plugin/skill integration; its implementation details are not shown in the sampled source, so that branch is omitted.

Main entry points: [`consent_audit/audit.py`](https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py) (Audit orchestration), [`consent_audit/cli.py`](https://github.com/thihal/consent-audit/blob/main/consent_audit/cli.py) (CLI commands), [`consent_audit/browser.py`](https://github.com/thihal/consent-audit/blob/main/consent_audit/browser.py) (Browser context capture), [`sites/example.com.yaml`](https://github.com/thihal/consent-audit/blob/main/sites/example.com.yaml) (Site settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Invocation and configuration"]
  node_site_config["Site settings<br/>[example.com.yaml]"]
  node_cli["CLI commands<br/>[cli.py]"]
end

subgraph group_capture["Browser experiments"]
  node_orchestrator["Audit orchestration<br/>[audit.py]"]
  node_browser["Browser context capture<br/>[browser.py]"]
  node_three_state["Consent states<br/>[audit.py]"]
  node_isolated_contexts["Isolated contexts<br/>[audit.py]"]
end

subgraph group_analysis["Evidence analysis"]
  node_snapshot["Captured state<br/>[audit.py]"]
  node_classifiers["Cookie and host classification<br/>[parse.py]"]
  node_identity_parser["Identity cookie parsing<br/>[parse.py]"]
  node_fingerprint_check["Cross-context matching<br/>[audit.py]"]
  node_findings["Consent findings<br/>[audit.py]"]
end

subgraph group_output["Findings and reports"]
  node_reporter["Report rendering<br/>[report.py]"]
  node_reports["JSON and Markdown reports"]
end

node_engineer(("Engineer"))
node_website(("Target website"))

node_engineer -->|"invokes"| node_cli
node_engineer -->|"configures"| node_site_config
node_cli -->|"runs audit"| node_orchestrator
node_cli -->|"renders result"| node_reporter
node_site_config -->|"supplies settings"| node_orchestrator
node_orchestrator -->|"requests capture"| node_browser
node_browser -->|"visits"| node_website
node_orchestrator -->|"runs states"| node_three_state
node_orchestrator -->|"runs visits"| node_isolated_contexts
node_browser -->|"captures state"| node_snapshot
node_orchestrator -->|"builds records"| node_snapshot
node_orchestrator -->|"classifies cookies"| node_classifiers
node_orchestrator -->|"parses identifiers"| node_identity_parser
node_orchestrator -->|"compares IDs"| node_fingerprint_check
node_snapshot -->|"informs checks"| node_findings
node_classifiers -.->|"supports checks"| node_findings
node_identity_parser -.->|"extracts IDs"| node_fingerprint_check
node_orchestrator -->|"assembles findings"| node_findings
node_reporter -->|"writes formats"| node_reports

click node_site_config "https://github.com/thihal/consent-audit/blob/main/sites/example.com.yaml"
click node_cli "https://github.com/thihal/consent-audit/blob/main/consent_audit/cli.py"
click node_orchestrator "https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py"
click node_browser "https://github.com/thihal/consent-audit/blob/main/consent_audit/browser.py"
click node_three_state "https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py"
click node_isolated_contexts "https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py"
click node_snapshot "https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py"
click node_classifiers "https://github.com/thihal/consent-audit/blob/main/consent_audit/parse.py"
click node_identity_parser "https://github.com/thihal/consent-audit/blob/main/consent_audit/parse.py"
click node_fingerprint_check "https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py"
click node_findings "https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py"
click node_reporter "https://github.com/thihal/consent-audit/blob/main/consent_audit/report.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_site_config,node_cli toneBlue
class node_orchestrator,node_browser,node_three_state,node_isolated_contexts toneAmber
class node_snapshot,node_classifiers,node_identity_parser,node_fingerprint_check,node_findings toneMint
class node_reporter,node_reports toneRose
class node_engineer,node_website toneIndigo
```

## Components

### Invocation and configuration

- [Site settings](https://github.com/thihal/consent-audit/blob/main/sites/example.com.yaml): `sites/example.com.yaml`
- [CLI commands](https://github.com/thihal/consent-audit/blob/main/consent_audit/cli.py): `consent_audit/cli.py`

### Browser experiments

- [Audit orchestration](https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py): `consent_audit/audit.py`
- [Browser context capture](https://github.com/thihal/consent-audit/blob/main/consent_audit/browser.py): `consent_audit/browser.py`
- [Consent states](https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py): `consent_audit/audit.py`
- [Isolated contexts](https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py): `consent_audit/audit.py`

### Evidence analysis

- [Captured state](https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py): `consent_audit/audit.py`
- [Cookie and host classification](https://github.com/thihal/consent-audit/blob/main/consent_audit/parse.py): `consent_audit/parse.py`
- [Identity cookie parsing](https://github.com/thihal/consent-audit/blob/main/consent_audit/parse.py): `consent_audit/parse.py`
- [Cross-context matching](https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py): `consent_audit/audit.py`
- [Consent findings](https://github.com/thihal/consent-audit/blob/main/consent_audit/audit.py): `consent_audit/audit.py`

### Findings and reports

- [Report rendering](https://github.com/thihal/consent-audit/blob/main/consent_audit/report.py): `consent_audit/report.py`
- **JSON and Markdown reports**

### Other components

- **Engineer**
- **Target website**

## Connections

- Engineer → CLI commands: invokes (evidence: `README.md`)
- Engineer → Site settings: configures (evidence: `README.md`)
- CLI commands → Audit orchestration: runs audit (evidence: `consent_audit/cli.py`)
- CLI commands → Report rendering: renders result (evidence: `consent_audit/cli.py`)
- Site settings → Audit orchestration: supplies settings (evidence: `README.md`)
- Audit orchestration → Browser context capture: requests capture (evidence: `consent_audit/audit.py`)
- Browser context capture → Target website: visits (evidence: `consent_audit/browser.py`)
- Audit orchestration → Consent states: runs states (evidence: `README.md`)
- Audit orchestration → Isolated contexts: runs visits (evidence: `README.md`)
- Browser context capture → Captured state: captures state (evidence: `consent_audit/browser.py`)
- Audit orchestration → Captured state: builds records (evidence: `consent_audit/audit.py`)
- Audit orchestration → Cookie and host classification: classifies cookies (evidence: `consent_audit/audit.py`)
- Audit orchestration → Identity cookie parsing: parses identifiers (evidence: `consent_audit/audit.py`)
- Audit orchestration → Cross-context matching: compares IDs (evidence: `README.md`)
- Captured state → Consent findings: informs checks (evidence: `consent_audit/audit.py`)
- Cookie and host classification → Consent findings: supports checks (evidence: `consent_audit/audit.py`)
- Identity cookie parsing → Cross-context matching: extracts IDs (evidence: `consent_audit/audit.py`)
- Audit orchestration → Consent findings: assembles findings (evidence: `consent_audit/audit.py`)
- Report rendering → JSON and Markdown reports: writes formats
