compliancegate.dev · Gilded Service

Gate AI-assisted code before it reaches git push.

Live alerts while you type, a pre-commit block on critical findings, and a pre-push loopback of the full session. Decisions land in SQLite, markdown, or Postgres — you pick the retention mode.

Works with Cursor Claude Code Copilot OpenRouter Ollama

ComplianceGate governance layer: Live Watch, pre-commit block, pre-push session audit, and HIPAA, PII, PCI rule packs
compliancegate / pre-commit
Medium High Critical

Linters catch syntax.
Nobody catches policy.

AI agents commit fast. PHI in a prompt, a PAN in a diff, an API key in a config file — and it is in git history before a human reviews the PR.

No audit trail

Chat history is not compliance evidence. You need decisions, severities, and overrides logged where your team can find them.

Review too late

PR review finds the HIPAA violation after the branch is shared. The gate belongs at commit and push, not at merge.

One-size policy docs

HIPAA, PCI, and PII need different checks. Enable modular packs instead of a 200-page doc nobody reads.

Five steps from edit to audit log.

01

Edit

AI or human changes land in your working tree.

02

Watch

Live alerts on critical and high findings.

03

Commit

Hook blocks on critical by default.

04

Push

Loopback review of the full session.

05

Audit

SQLite, markdown, or remote DB.

Heuristics first. LLM reasoning second.

Pattern scans for secrets, PAN, and PHI run locally even without an API key. When configured, an LLM reviews diffs with redaction before send.

01

compliancegate watch

Debounced file watcher flags findings while you code. Surfaces critical and high severity before you stage.

02

Pre-commit hook

Reviews staged diff against enabled rule packs. Records allow or block with reasoning. Threshold: block_commit_on: critical.

03

Pre-push loopback

Re-reviews accumulated session context before code leaves your machine. Threshold: block_push_on: high.

> compliancegate loopback
ok 4 reviews · 2 decisions · verdict fail
-> PUSH BLOCKED

OpenRouter, LangChain, and agent skills.

Heuristics always run locally. Add LLM reasoning via OpenRouter, optional two-stage LangChain review, and Cursor/Claude skills that speak the CLI.

OpenRouter

One key, many models

Route reviews through OpenRouter with model fallbacks. Diffs redacted before send.

provider: openrouter
model: anthropic/claude-3.5-sonnet
fallback_models: [openai/gpt-4o-mini]

compliancegate llm route · llm test

Agent skills

Cursor & Claude

compliancegate skill for hooked repos. compliance-review for standalone in-chat review without install.

npx compliancegate skills install --all-skills --all
npx compliancegate skills install --project

Installed automatically by npx compliancegate install

OpenRouter, LangChain, and agent skills.

Heuristics always run locally. Add LLM reasoning via OpenRouter, optional two-stage LangChain review, and Cursor/Claude skills that speak the CLI.

OpenRouter

One key, many models

Route reviews through OpenRouter with model fallbacks. Diffs redacted before send.

provider: openrouter
model: anthropic/claude-3.5-sonnet
fallback_models: [openai/gpt-4o-mini]

compliancegate llm route · llm test

Agent skills

Cursor & Claude

compliancegate skill for hooked repos. compliance-review for standalone in-chat review without install.

npx compliancegate skills install --all-skills --all
npx compliancegate skills install --project

Installed automatically by npx compliancegate install

Enable HIPAA, PII, or PCI only when scope applies.

Each pack ships rules and heuristic patterns. Sensitive packs default to local-first retention.

Base

Safe
SOC2 Secrets

Hardcoded credentials, auth changes, dependency risk. Enable in every repo.

  • API key and token patterns
  • eval/exec and SSL bypass

PII

Sensitive
GDPR CCPA

Personal data in logs, storage, and source. Local retention recommended.

  • SSN and email patterns
  • Cookie and tracking changes

HIPAA

Sensitive
PHI BAA

PHI in logs, prompts, and external LLM routing. Healthcare scope only.

  • Clinical field references
  • PHI sent to third-party APIs

PCI

Sensitive
PCI-DSS CDE

Cardholder data never stored or logged. Never synced raw to remote DB.

  • PAN and CVV patterns
  • Track data detection

What each check actually does

Two layers on every review: heuristic patterns scan added diff lines locally; LLM rules evaluate policy when an API key or Ollama is configured. Inspect any pack from the CLI.

Terminal compliancegate rules list compliancegate rules show pci
Pack Check Layer Severity Blocks at
base Possible hardcoded secret / credential leak Heuristic Critical Commit
base eval(), exec(), SSL verification disabled Heuristic High Push
base Auth changes need review note; no secrets in fixtures LLM rule Varies Per finding
pii SSN, email, phone, name/DOB field patterns Heuristic CriticalMedium Per finding
pii PII in logs, client storage, export endpoints LLM rule Varies Per finding
hipaa PHI/clinical field references in source Heuristic Medium
hipaa PHI routed to external LLM (OpenAI, Anthropic, etc.) Heuristic Critical Commit
hipaa PHI encryption, BAAs, audit trail, minimum necessary LLM rule Varies Per finding
pci PAN, CVV, magnetic stripe / track data patterns Heuristic Critical Commit
pci No card data in URLs, logs, or shared credentials LLM rule Varies Per finding

Default thresholds: block_commit_on: critical, block_push_on: high. Sensitive pack findings stay local unless you set sync_sensitive_findings: true. These gates assist review — they are not a compliance certification.

What a session report looks like.

Markdown audit trails written to .compliancegate/reports/ — not chat filler.

View sample session markdown
# Compliance Session Report — billing-api

## Findings
### [CRITICAL] Possible payment card number (PAN)
Pattern matched in added lines · framework: PCI-DSS
Recommendation: Remove PAN from source; use tokenization provider.

## Decisions
### pre-commit → block
1 files, heuristic + LLM review · verdict fail

## Review Log
- watch:billing/checkout.ts — verdict warn
- pre-commit — verdict fail — BLOCK

Pick where audit data lives.

Set storage.mode in config.yaml. One switch, five destinations.

sqlite

Local database

Full detail in .compliancegate/data/compliancegate.db. Sessions, decisions, findings, raw review context.

remote

Postgres / MySQL

Mirror metadata to your infrastructure. Sanitized by default — no diff prose or raw findings.

Compliance review content is sensitive. Treat it that way.

Stays local

  • Full diff summaries and finding descriptions
  • LLM reasoning and raw responses
  • File paths and line hints
  • Session markdown with full detail

Remote sync (optional)

  • Verdict, severity, framework tags only
  • Hashed descriptions — not prose
  • Basenames — not full paths
  • remote_payload: metadata_only by default

Commands mapped to the workflow.

compliancegate init

Install git hooks, scaffold config.yaml, and create storage directories for your chosen mode.

How do I install ComplianceGate?

npx, install script, or manual pip. Hooks run on every commit and push.

npx install

Recommended. Creates a venv, pip installs ComplianceGate, writes config, and installs hooks.

npx compliancegate install
npx compliancegate check

Node 18+ and Python 3.10+. Installs hooks, config, venv, and the compliancegate agent skill.

OpenRouter + LangChain

After install, set LLM routing in config.yaml.

compliancegate llm route
pip install 'compliancegate[langchain]'

Install script

Creates venv, copies config, installs hooks, sets storage mode.

git clone https://github.com/tedrubin80/compliancegate.git && cd compliancegate && bash scripts/install.sh --repo /path/to/your/project

Manual pip install

pip install -e /path/to/compliancegate && compliancegate init --mode sqlite_markdown
compliancegate watch

Agent skills

compliancegate skill for hooked repos; compliance-review for standalone review.

npx compliancegate skills install --all-skills

Install script also copies the CG skill to .cursor/skills/compliancegate/.

Rule packs

Edit config.yaml after init:

compliancegate rules list

Enable pii, hipaa, pci under compliance.rule_packs.

Remote retention

pip install 'compliancegate[postgres,mysql]'

Set CG_POSTGRES_URL and storage.mode: remote.

Emergency bypass

Logged when storage is enabled. Use sparingly.

CG_SKIP=1 git commit -m "hotfix"

LLM review: set OPENROUTER_API_KEY with provider: openrouter, or OPENAI_API_KEY / Ollama. Run compliancegate llm route to inspect. Alias: cg.

Common questions about ComplianceGate.

What is ComplianceGate?

A governance gap layer for AI-assisted development. It watches file changes, gates commit and push with policy review, and writes an audit trail to storage you control.

Do I need an LLM API key?

No for basic use. Heuristic pattern scanning runs locally. For LLM review, use OpenAI, OpenRouter (recommended — one key, many models), or Ollama. Diffs are redacted before external send when redact_before_send: true.

How do I route through OpenRouter?

Set provider: openrouter and OPENROUTER_API_KEY in config. Pick any OpenRouter model id (e.g. anthropic/claude-3.5-sonnet), optional fallback_models for automatic failover. Run compliancegate llm test to verify the route.

What is the LangChain pipeline?

Optional two-stage review: a reasoning model (e.g. Claude via OpenRouter) analyzes diffs against your enabled packs, then an analytical model produces structured findings JSON. Enable with langchain.enabled: true after pip install 'compliancegate[langchain]'.

How do agent skills work?

Two skills ship in the repo: compliancegate (CLI + hooks) and compliance-review (standalone). Run npx compliancegate skills install --all-skills --all for Cursor and Claude, or let npx compliancegate install copy the CG skill into your repo.

Does sensitive data leave my machine?

Not by default. Remote Postgres/MySQL sync uses metadata-only payloads. Full finding detail stays in local SQLite or markdown unless you explicitly change retention settings.

Is ComplianceGate free?

Yes. Open source on GitHub. You provide your own LLM API key if you want LLM review.

Install the gate before the next push.

Five minutes to hooks, config, and your first reviewed commit.