diff --git a/legal_shield/README.md b/legal_shield/README.md new file mode 100644 index 0000000..663eb39 --- /dev/null +++ b/legal_shield/README.md @@ -0,0 +1,45 @@ +# Legal Shield Engine + +Local-first, deterministic utility bill auditing and contradiction engine for German rental law (BGB, BetrKV, BGH jurisprudence). + +## Philosophy & Architecture + +- **Zero Cloud / Local-First:** Designed to run self-hosted (Docker / CLI). +- **Separation of Concerns:** + - **LLM Layer:** Used strictly as an unformatted OCR-to-JSON text extractor. + - **Deterministic Rule Engine:** Hardcoded Python logic executing strict statutory rules (no LLM hallucinations in legal decision-making). +- **Evidence-Based:** Cross-references lease agreements, prior bills, and municipal utility tax notices against statutory allocation keys. + +--- + +## Project Structure + +``` +legal_shield/ +├── models.py # Dataclasses for LeaseContext, BillPeriod, CostItem, AuditViolation +├── rules.py # Statutory rules (Grundsteuer proportionality, BetrKV exclusions) +├── reconciler.py # Multi-year reconciliation & offsetting (§ 387 BGB) +├── generator.py # DIN 5008 formal legal objection letter generator +└── engine_v2.py # Main CLI auditor connecting to Paperless-ngx API +``` + +--- + +## Quickstart & Development + +### Prerequisites +- Python 3.11+ +- Access to a Paperless-ngx instance (or local JSON backup) +- OpenRouter API key (for structured text extraction) + +### Installation +```bash +git clone https://git.infra.mintel.me/mmintel/legal-shield.git +cd legal-shield +pip install requests +``` + +### Running the Audit +```bash +python3 legal_shield/engine_v2.py +```