Deterministic compliance document linter with regulation-traceable rules. 85 rules across 8 regulation families: SOC 2, GDPR, HIPAA, ISO 27001, BSA/AML, SEC, FINRA, SOX. Every rule cites primary legal source text. Zero LLM dependency.
Project description
Redline
Compliance documentation linter with deterministic, regulation-traceable rules. Every flag traces to a specific rule, which traces to a specific regulation paragraph. Zero LLM cost at runtime. Runs locally.
Upload 200 internal policy docs to ChatGPT? That violates your DLP policy. Run Redline locally instead.
The Problem
Compliance teams review documents manually. $200-$500/hour. Inconsistent. Slow. LLM-based review is non-deterministic, produces no audit trail, and creates DLP risk when documents contain sensitive information.
Redline generates deterministic rules from regulations once (LLM reads the regulation, outputs regex/keyword/structural rules). Those rules run in milliseconds on every document thereafter. Each flag is traceable to a regulation paragraph. Auditors can verify the rule set. Compliance teams get consistency.
How It Works
[Regulation text]
-> redline generate (LLM reads regulation once)
-> Deterministic Vale rules (regex, keywords, structural checks)
-> Human review + version tag
-> redline lint (runs in milliseconds, zero LLM cost)
-> Findings traceable to regulation paragraphs
Install
pip install redline-compliance
Requires Vale installed separately.
Quick Start
# Lint a document against all loaded regulations
redline lint policies/aml-policy.md
# Lint with AI semantic analysis (BYOK, optional)
redline lint policies/aml-policy.md --ai
# Generate rules from a new regulation
redline generate regulation-text.md --id SOC2 --authority AICPA
# Generate a gap report
redline report policies/aml-policy.md --format json
# Browse available regulations
redline regulations list
# Initialize config
redline init
Supported Regulations
| Regulation | Rules | Domain |
|---|---|---|
| BSA/AML | 6 rules | Financial crime |
| SEC Marketing Rule | 6 rules | Investment advisors |
| FINRA Communications | 5 rules | Broker-dealers |
| SOX Section 404 | 5 rules | Internal controls |
| SOC2 Trust Services | 10 rules | Security/compliance |
| GDPR | 10 rules | Data protection |
Plus common quality rules (plain language, sentence length, date formats, passive voice).
Rule Generation Pipeline
The differentiator: LLM generates rules, rules run deterministically.
# Point at any regulation text
redline generate hipaa-security-rule.md --id HIPAA --authority HHS
# Preview without writing files
redline generate hipaa-security-rule.md --id HIPAA --dry-run
# Output:
# vale-packages/FinCompliance/HIPAAVagueAccessControls.yml
# regulations/hipaa/hipaa.yml
# regulations/hipaa/hipaa_audit_trail.json
Each generated rule set includes:
- Vale rule files — deterministic, run in milliseconds
- Regulation YAML — maps rules to requirements with paragraph references
- Audit trail — which model generated which rule, when, from what source
Audit Trail
Every finding is traceable:
Finding: "adequate controls" flagged at line 47
Rule: FinCompliance.SOC2VagueAccessControls
Requirement: SOC2-CC6-01
Regulation: SOC 2 Trust Services Criteria, CC6.1
Authority: AICPA
Severity: error
Source: deterministic (confidence: 1.0)
An auditor can verify: the rule exists, it maps to CC6.1, and the token matched. No black box.
Architecture
redline/
├── cli/redline/
│ ├── cli.py # Typer CLI: lint, report, generate, regulations, init
│ ├── runner.py # Vale subprocess orchestrator + finding mapper
│ ├── generator.py # LLM-to-Vale rule generation pipeline
│ ├── ai.py # BYOK Claude semantic analysis (optional)
│ ├── registry.py # Regulation YAML loader + Vale rule index
│ ├── report.py # Gap report generation (JSON, Markdown)
│ └── config.py # .redline.yml config loader
├── vale-packages/FinCompliance/ # 42+ Vale rules
├── regulations/ # YAML requirement definitions
│ ├── bsa-aml/ # BSA/AML, CDD, CTR, SAR
│ ├── sec/ # SEC Marketing Rule
│ ├── finra/ # FINRA Communications
│ ├── sox/ # SOX Section 404
│ ├── soc2/ # SOC2 Trust Services (NEW)
│ └── gdpr/ # GDPR (NEW)
├── regulations-source/ # Source regulation texts
├── fixtures/ # Test documents (passing + failing)
└── tests/ # 49 tests
AI Semantic Analysis (Optional)
For requirements that can't be checked with patterns (e.g., "does this risk assessment methodology cover all required areas?"), Redline uses BYOK Claude with:
- 7 structured prompts per regulatory domain
- Confidence gating (default 0.7 threshold)
- Hallucination rejection (quoted text must appear in document)
- Findings marked as
source: aiwith confidence scores
export ANTHROPIC_API_KEY=sk-...
redline lint policies/aml-policy.md --ai
License
MIT
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 redline_compliance-1.0.0.tar.gz.
File metadata
- Download URL: redline_compliance-1.0.0.tar.gz
- Upload date:
- Size: 96.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
650aac9b3e8f2572c4792a6b29efc9a033289c1a8ae9cfbd33a37dcd50c2acd1
|
|
| MD5 |
d867c7def77924a53deb8875644bb3e0
|
|
| BLAKE2b-256 |
3854a0c1970b201ac71063f9fb2a300e62787f816d8c80252c6911ad3affd2fe
|
File details
Details for the file redline_compliance-1.0.0-py3-none-any.whl.
File metadata
- Download URL: redline_compliance-1.0.0-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
952249ce456686d76ad1c100865a7c9d334bfa75385c31a55a150dd197747a32
|
|
| MD5 |
332f928ce05ef7cdef52dad13f4b5ac6
|
|
| BLAKE2b-256 |
29492926e5e4e8e56ac964f1de547dc7c5af035a0e691f46cd0d1893ad7c690e
|