Skip to main content

precommitEU

precommitEU

Catch EU regulatory violations at PR time, on your own machine, with zero data egress.

One local scanner, eight EU regulations: GDPR, the EU AI Act, NIS2, DORA, the Cyber Resilience Act, the Digital Services Act, the Digital Markets Act and the Data Act.

OpenSSF Best Practices REUSE status

Documentation  ·  Install  ·  Local UI  ·  CLI reference  ·  Model bundle  ·  precommit.eu

precommitEU scanning a Python project for GDPR violations

A real scan, unedited: about 80 seconds on an M-series MacBook, played back at 5×. models.py holds only a dataclass, so the detector clears it and the validator is never called. user_store.py mentions a sibling file, so the orchestrator takes over: it resolves UserProfile into models.py, finds that audit_line() interpolates a national ID and a home address, and confirms a GDPR Art. 32 violation on a log line that looks harmless on its own. Grep cannot find that one.

Replay this scan in your browser. No install, nothing to upload.

export PRECOMMITEU_MODELS_DIR=~/.precommiteu/models
precommiteu scan src/ --fail-on-findings

Local UI

New in 0.2. A local web UI ships with the package. Point it at a folder and watch the run: readiness checks, the plan, per-file progress and ETA, then confirmed findings and advisories. It drives the same scanner as a subprocess and writes nothing into the folder being scanned.

Findings from a local EU AI Act scan in the precommitEU UI

pip install "precommiteu[ui]"
precommiteu ui

That serves http://127.0.0.1:8787 and nothing else. You pick what to scan from the Target screen: a folder on this machine, or a repository URL it clones for you. The scanner never touches anything until you do.

Nothing else to install by hand either. The readiness screen installs what is missing where it can, and the regulation screen downloads adapter packs on demand, verifying each against the bundle checksums. One pack is active at a time; picking another switches it.

The Target screen knows what was already analysed: scan only the changed files, start clean and rescan everything, or forget the cached findings for that folder. The Settings screen shows where this machine keeps the model bundle, the scan cache and the reports, and moves any of the three without a restart. Available in English, Romanian, German, French and Italian.

Every screen, the download flow, pause versus stop, and what the UI sends over the network: Local UI.

The Zen of EU Code

  1. Put purpose before collection.
  2. Collect less than you could, and keep it for less time.
  3. Let people know what the system knows.
  4. Make consent a choice, not a trap.
  5. Give people working controls over their data.
  6. Protect what you keep, from design to update.
  7. Children deserve stronger defaults.
  8. Explain automated decisions before they become consequences.
  9. Build systems that fail safely, recover clearly, and report harm responsibly.
  10. Make switching, portability, and interoperability real.

Run precommiteu this to print it.

Quick start

brew install llama.cpp
pip install precommiteu "huggingface_hub[cli]"
hf download AlexandruGirlea/precommiteu-models base.gguf orchestrator.gguf gdpr/detector-adapter.gguf --local-dir ~/.precommiteu/models
export PRECOMMITEU_MODELS_DIR=~/.precommiteu/models
precommiteu scan src/

The models need 32 GB of RAM and about 23 GB of disk.

Linux, source and GPU builds, downloading more packs, air-gapped installs and uninstall: Installation.

hf download writes the bundle in the layout the scanner expects. Each adapter must sit in a directory named exactly after its pack, because the scanner resolves <models-dir>/<regulation>/detector-adapter.gguf:

~/.precommiteu/models/
├── orchestrator.gguf                # orchestrator and validator
├── base.gguf                        # detector base, shared by every regulation
├── gdpr/detector-adapter.gguf
└── eu_ai_act/detector-adapter.gguf  # one directory per pack you downloaded

A flat directory does not work: both shared models and every selected regulation's adapter are required. A missing file stops the scan.

precommiteu scan src/ --regulations gdpr,eu_ai_act    # several regulations
precommiteu scan --ci --fail-on-findings              # changed files only, gate the build

From Python

import os
from precommiteu import scan_paths

# Required unless you pass models_dir to scan_paths.
os.environ["PRECOMMITEU_MODELS_DIR"] = "~/.precommiteu/models"

result = scan_paths(["src/"], regulations=("gdpr",))
for finding in result.findings:
    print(finding.regulation, finding.file,
          finding.probable_article_id, finding.description)

Full API reference, every parameter, the result schemas and streaming callbacks: Python library.

How it works

  • Your code never leaves your machine. All analysis runs on local llama-server processes the scanner starts and stops itself. No cloud, no telemetry, no network egress.
  • No finding without proof. A detector proposes candidates; a validator then has to locate the quoted evidence verbatim in your file, or the candidate is dropped. Confirmed findings cite the line. Candidates that fail validation are reported as advisories: clearly labeled, never gating. Only confirmed findings can fail a build.
  • Deterministic where it matters. Grammar-constrained model output, fixed budgets per file, suppression rules with auditable reasons.
  • Only what changed. Every file that completes cleanly is recorded, and the next scan of the same folder replays it instead of analysing it again, so a repository that took hours the first time takes minutes when a handful of files moved. The record is one small JSON file per folder and regulation under ~/.precommiteu/scans/; nothing is written into the folder you scan. --rescan-all forces a full pass. Reuse rules, change detection and CI behaviour: Incremental rescans.

Model bundle

precommitEU ships as two artifacts. The scanner is a pure-Python wheel on PyPI; the weights are published separately on Hugging Face at AlexandruGirlea/precommiteu-models (public, no token needed). pip install does not fetch them.

The repository holds eight model files: a 16.5 GiB orchestrator.gguf that runs the orchestrator and validator, a 4.36 GiB base.gguf that every detector adapter loads onto, plus a 77 MiB detector adapter per pack. You choose which adapters to download. Name the files you want, or omit them to take everything:

# shared models + GDPR only, about 22.5 GB
hf download AlexandruGirlea/precommiteu-models base.gguf orchestrator.gguf gdpr/detector-adapter.gguf --local-dir ~/.precommiteu/models

# add another pack later, the shared models are already there
hf download AlexandruGirlea/precommiteu-models eu_ai_act/detector-adapter.gguf --local-dir ~/.precommiteu/models

# everything, about 22.9 GB
hf download AlexandruGirlea/precommiteu-models --local-dir ~/.precommiteu/models

--regulations picks which downloaded packs to run. Every selected pack's adapter must be present; a missing adapter stops the scan before models load.

Air-gapped installs, checksum verification and uninstall: Installation.

Regulation packs

Eight EU regulations, shipped as six adapter packs. gdpr is the default and the sensible one for almost any product repo.

--regulations value Covers
gdpr (default) General Data Protection Regulation
eu_ai_act Artificial Intelligence Act
eu_data_act Data Act
dora Digital Operational Resilience Act
dsa Digital Services Act
cra_dma_nis2 Cyber Resilience Act, Digital Markets Act and NIS2
precommiteu scan src/ --regulations gdpr,eu_ai_act

Each adapter is trained on code its own regulation governs, so scanning with all six is noisier rather than more thorough. Application dates, what each pack is for, and how several packs run in one scan are in Regulation packs.

Detection quality

precommitEU is not built to catch everything. The bar it aims for is: flag more than half of the real violations, and be right about nine out of ten things it flags.

Historical results from local evaluation runs on my own codebases using the earlier shared-base setup, measured on confirmed findings (advisories excluded):

Pack Precision Recall False positive rate
gdpr 97% 98% 6%
eu_ai_act 97% 93% 5%
eu_data_act 97% 93% 5%
cra_dma_nis2 97% 93% 5%
dsa 90% 90% 15%
dora 100% 73% 0%

In those runs, every pack cleared both bars. dora was the most conservative and dsa the noisiest, but nothing here is a compliance guarantee - treat a clean scan as one useful signal, not as sign-off.

These numbers cover the earlier shared base model with per-regulation LoRA adapters. They have not been revalidated with the separate orchestrator.gguf validator introduced in 0.3.0.

In CI

The models need 32 GB of RAM, more than hosted CI runners have. Scans run in the precommitEU container on a Linux machine of your own, registered as a runner. After a one-time setup of that machine, the job is:

jobs:
  precommiteu:
    runs-on: [self-hosted, precommiteu]
    container:
      image: ghcr.io/alexandrugirlea/precommiteu:0.3.0
      volumes:
        - /opt/precommiteu/models:/models:ro
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: AlexandruGirlea/precommiteu@v0.3.0
        with:
          regulations: gdpr

--ci scans only the files changed against the merge-target branch. Exit code 1 on confirmed findings with --fail-on-findings, 0 when clean. The machine setup, GitLab, Azure DevOps, the full input list and every exit code are in CI integration.

Documentation

Guide Contents
Installation Requirements, per-platform install, model bundle download, CPU vs GPU, verify, uninstall
Local UI The six steps, downloading packs, pause vs stop, settings, what leaves the machine
CLI reference CLI usage, complete flag reference, reports, suppressions
Regulation packs The six packs, application dates, choosing packs, multi-regulation runs
CI integration The CI container, GitHub Actions, GitLab, Azure DevOps, exit codes
Python library Python API: scan_paths, scan_diff, schemas, callbacks
Report reference Report formats: JSON field reference, SARIF, summary, ledger
Ignoring and suppressing .eu-ignore, inline eu-ignore directives, audited precommiteu-ignore markers
Examples Worked scans, real output, common flag combinations
Troubleshooting Model paths, llama-server startup, empty scans, error messages

Rendered documentation site: https://alexandrugirlea.github.io/precommiteu/ Project site: https://precommit.eu

Disclaimer

precommitEU is free and fully open source under the Apache License 2.0, and is provided as is, without warranty or condition of any kind, express or implied, as set out in sections 7 and 8 of that license. Use is entirely at your own risk. There is no service level, no availability commitment and no guarantee of accuracy or fitness for any purpose.

It produces a compliance signal, not legal advice: it can report findings that are not violations and can miss violations that are present. Nothing it outputs establishes, certifies or evidences compliance with any regulation.

The author is not a lawyer and provides no legal, regulatory or compliance advice. This software does not replace legal analysis. To the maximum extent permitted by applicable law, Alexandru Girlea accepts no liability for any damages, losses, costs, regulatory outcome or misrepresentation arising from use of this software or reliance on its output. Have findings reviewed by qualified legal counsel before acting on them.

License

Apache License 2.0, see LICENSE, NOTICE and THIRD_PARTY_NOTICES.md. Copyright (c) 2026 Alexandru Girlea.

Everything precommitEU produces is Apache-2.0: the scanner, the per-regulation LoRA detector adapters, the GBNF grammars and the regulation knowledge packs, including everything in the model bundle. The base model weights (Qwen 2.5 Coder, Apache-2.0) and the llama-server binary (llama.cpp, MIT) are delivered separately and carry their own licenses.

Metadata

Release files for precommiteu 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for precommiteu 0.3.0
File Size Uploaded Provenance Actions
precommiteu-0.3.0.tar.gz 3.3 MB With provenance Details for precommiteu-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for precommiteu 0.3.0
File Interpreter ABI Platform Actions
precommiteu-0.3.0-py3-none-any.whl Python 3 none any Details for precommiteu-0.3.0-py3-none-any.whl

Total release size: 5.0 MB

Release files / precommiteu-0.3.0.tar.gz

Download URL precommiteu-0.3.0.tar.gz
Size 3.3 MB
Tags Source
SHA-256 checksum
How to use checksums
48db10e6b181305353b19edec6f14a7683c1e13eec65af627b4999b8e6766ba7
BLAKE2b-256 checksum
How to use checksums
7770799156c4d52a60a4b8defc877c1f277c9b26122e2375e10e437380cc9f0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / precommiteu-0.3.0-py3-none-any.whl

Download URL precommiteu-0.3.0-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
bf42b6a52ca12faa1b90e4adef251c4e6b810bc4d5ed0a380f1bbfff5d47a742
BLAKE2b-256 checksum
How to use checksums
81c99bab801a2bf33e92601340c5f2752487c5ce82b78adf769df4dabe970ade
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for precommiteu 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for precommiteu-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page