Forensic consent-compliance audit engine. Deterministic by design.
Project description
consent-engine
Forensic agent that compares cookie + tag enforcement against user consent preferences. Built for enterprises facing privacy-litigation demand letters.
Scans any web page with consent pre-set to reject all (S3 forensic methodology), captures every network request, then asks five questions:
- What fires pre-consent (on landing)?
- What fires post-accept?
- What fires post-reject?
- Is GPC (Global Privacy Control) being honored?
- Is Consent Mode (Basic or Advanced) wired correctly?
Returns a structured audit result, an HTML report, an executive summary, and a client-ready Marp slide deck.
Why "engine" not "agent"
The audit is deterministic. Decisions are made at build time, not at runtime. The LLM writes the executive summary; everything else is code. That distinction (credit to Fred Pike's "Consent Chaos" talk at MeasureSummit May 2026) is the thing that makes the output legally defensible instead of plausibly-correct.
| Agentic | Deterministic | |
|---|---|---|
| When decisions are made | At runtime | At build time |
| Behavior | Probabilistic, flexible | Reproducible |
| Spec | Implicit | Explicit |
| Testability | Hard to test, hard to prove | Easy to test, debug, verify |
The eight-tool pipeline below is all deterministic. A small agentic chat
surface (consent-engine chat) sits on top for "why is this tag firing"
follow-up questions, grounded in the audit result + raw network log.
Architecture
┌──────────────────────────────────────────────────────────┐
│ POST /audit { url } │
└─────────────────────────────┬────────────────────────────┘
▼
┌──────────────────────────────────────────────────────────────────┐
│ tool_01 GTM container parser (JSON / live network interception) │
│ tool_02 Violation classifier (S2 inconclusive vs S3 definitive) │
│ tool_03 Playwright browser scanner (consent pre-set) │
│ tool_04 HAR analyzer │
│ tool_05 Vendor library lookup (custom + Open Cookie DB) │
│ tool_06 Server-side GTM detector │
│ tool_06b Pixel detector (out-of-GTM tracking) │
│ tool_07 Knowledge-base retriever (markdown wiki, no vector DB) │
│ tool_08 Report + slide deck generator (LLM exec summary only) │
└─────────────────────────────────────┬────────────────────────────┘
▼
┌────────────────────────────────────────────────┐
│ audit_result.json + report.html + deck.md │
└────────────────────────────────────────────────┘
Full flow with sample inputs/outputs: see docs/scenarios.md.
Three ways to run it
1. CLI
uvx consent-engine audit https://example.com
# Writes: ./out/<audit_id>/report.html
# ./out/<audit_id>/audit_result.json
# ./out/<audit_id>/evidence.jsonl ← every captured network request
# ./out/<audit_id>/deck.marp.md
Install: pip install consent-engine or uvx consent-engine (zero-install).
2. Claude Code skill
mkdir -p ~/.claude/skills && cp -r .claude/skills/consent-audit ~/.claude/skills/
Then in any Claude Code conversation:
Audit https://example.com for consent compliance.
The skill drives the engine, surfaces findings inline, and lets you ask follow-up questions grounded in the captured evidence.
3. MCP server
uvx consent-engine-mcp
# Then add to Claude Desktop config:
# "consent-engine": { "command": "uvx", "args": ["consent-engine-mcp"] }
Exposes audit_url, read_audit_result, and query_evidence as MCP tools.
4. FastAPI service
docker build -t consent-engine . && docker run -p 8080:8080 consent-engine
# POST http://localhost:8080/audit { "url": "https://example.com" }
Drop-in Cloud Run / Fly / Railway deployable.
Real-world stakes
This isn't an academic project. Demand-letter law firms have built a pipeline around exactly the failure modes this tool detects:
"We went to your website, clicked decline, and yet we saw tags firing, traffic going to LinkedIn, to Google Analytics, to Meta. You have violated our privacy. Pay us $10,000, $15,000, $25,000, $50,000." — Fred Pike, describing the inbound wave that drove him to build a similar tool.
CCPA fines are $2,500 per non-intentional violation, $7,500 per intentional
violation. CIPA (California Invasion of Privacy Act) wiretap claims are
running $5,000 per violation in active class actions against retailers,
healthcare systems, and B2B SaaS marketing sites. See
data/wiki/enforcement/lawsuit-surge.md for the case file.
Develop
uv sync
uv run playwright install chromium
uv run pytest tests/ -v # one happy-path test per tool
uv run ruff check src/ # lint clean
uv run mypy src/ # types clean
Customize for your stack
The audit engine is configurable by data, not code:
- Add a new CMP (the system ships with OneTrust): drop a detector in
src/consent_engine/tools/cmp_detector.pyand a regional behavior profile indata/wiki/concepts/. - Add a vendor to the lawsuit-annotated library:
edit
data/vendor_library/vendors.json(priority lookup) or the Open Cookie Database CSV (fallback). - Add jurisdictional context (a new state, country, or sector): drop a
markdown page in
data/wiki/regulations/and updatedata/wiki/index.md.
No vector database, no embeddings, no fine-tuning. The whole knowledge layer is markdown — version it like any other code.
What this doesn't do
- Does not submit anything anywhere. It's a read-only forensic tool.
- Does not modify your GTM container. Use the companion
gtm-ga4-syncfor tag provisioning. - Does not produce legal advice. Outputs are evidence for legal counsel.
License
MIT. See LICENSE.
Credits
Built by Kenneth Buchanan.
Architecture decisions credit Fred Pike's "Consent Chaos: Using AI to Build Consent Systems That Still Break" at MeasureSummit, May 2026 — particularly the agentic-vs-deterministic split, the glass-box reporting pattern, and the per-audit chat surface. Lawsuit-surge documentation pulls from Stephanie Balaconis (Lifesight), Denis Golubovskyi (Stape), and Phil Pearce's MeasureSummit talks on attribution, signal quality, and the consent enforcement landscape.
The Open Cookie Database (~3,200 entries) is included under the project's permissive license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file consent_engine-0.4.1.tar.gz.
File metadata
- Download URL: consent_engine-0.4.1.tar.gz
- Upload date:
- Size: 315.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a60655bf38e8eff9efc3148d90e59e0ff1681b572d01e354d8f6b6fb61cae995
|
|
| MD5 |
a8b42d671937b33c467e20c239fd3d3c
|
|
| BLAKE2b-256 |
d948bafe22c2adf862d1d94ecdc96cc704b41db6adf0f3b7105d3fab4eddc8a4
|
Provenance
The following attestation bundles were made for consent_engine-0.4.1.tar.gz:
Publisher:
release.yml on kb223/consent-engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
consent_engine-0.4.1.tar.gz -
Subject digest:
a60655bf38e8eff9efc3148d90e59e0ff1681b572d01e354d8f6b6fb61cae995 - Sigstore transparency entry: 1569230854
- Sigstore integration time:
-
Permalink:
kb223/consent-engine@742040feb1e1b3e38ddab94c3eaa9db182b652a6 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/kb223
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@742040feb1e1b3e38ddab94c3eaa9db182b652a6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file consent_engine-0.4.1-py3-none-any.whl.
File metadata
- Download URL: consent_engine-0.4.1-py3-none-any.whl
- Upload date:
- Size: 582.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0018970728d0f01dd274aa9caf06c796bcaec92a94a64602b83f4c23e2bf8a7e
|
|
| MD5 |
7145d79ae8a682cf95d842820cb01bec
|
|
| BLAKE2b-256 |
875dd4f046688e95dc430c8e603386fccd4cba67223b3f019212dafb44d81076
|
Provenance
The following attestation bundles were made for consent_engine-0.4.1-py3-none-any.whl:
Publisher:
release.yml on kb223/consent-engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
consent_engine-0.4.1-py3-none-any.whl -
Subject digest:
0018970728d0f01dd274aa9caf06c796bcaec92a94a64602b83f4c23e2bf8a7e - Sigstore transparency entry: 1569230861
- Sigstore integration time:
-
Permalink:
kb223/consent-engine@742040feb1e1b3e38ddab94c3eaa9db182b652a6 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/kb223
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@742040feb1e1b3e38ddab94c3eaa9db182b652a6 -
Trigger Event:
push
-
Statement type: