Skip to content

Blackfrost-AI/Clauseforge-ai

Repository files navigation

ClauseForge

AI-powered legal document automation. Fills court forms, generates pleadings, validates jurisdiction-specific formatting — all via natural language.

License: MIT Python 3.11+ Flask Gemini

The Problem

Paralegals and pro-se litigants spend hours manually filling court forms that vary across 50 states, 3,000+ counties, and thousands of court types. A single typo in a case number or a misformatted address can get a filing rejected. Commercial legal automation (Clio, MyCase, LegalZoom) locks this capability behind $100+/mo subscriptions.

The Solution

ClauseForge uses Google Gemini to intelligently map plain-English case facts to fillable PDF fields. Select your jurisdiction (state -> county -> court type), describe the case, and get a validated, court-ready PDF.

Features

  • PDF Support — Upload any fillable court form (Family, Civil, Probate, Small Claims)
  • Gemini Field Mapping — Natural-language input translated to structured form data
  • Jurisdiction Engine — 50 states, county-level court rules, format validators
  • Legal Validator — Case numbers, party names, addresses, caption formatting
  • No Data Retention — Uploads processed in-memory, nothing persisted without consent
  • Docker Deploy — One-command production deployment

Quick Start

git clone https://github.com/tlancas25/clauseforge.git
cd clauseforge
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env   # add your GEMINI_API_KEY
python app.py

Open http://localhost:5000

Install as Claude Code Plugin

/plugin marketplace add tlancas25/clauseforge

Architecture

+-------------+    +--------------+    +-------------+
|  PDF Upload | -> | PDF Extractor| -> | Field Map   |
+-------------+    +--------------+    +-------------+
                                             |
+-------------+    +--------------+    +-------------+
|  Filled PDF | <- |  PDF Filler  | <- |Gemini Mapper|
+-------------+    +--------------+    +-------------+
      |                                      |
+-------------+                       +-------------+
|   Validator | <---------------------| Jurisdiction|
+-------------+                       +-------------+

Tech Stack

Layer Tool
Backend Flask 3.0
PDF Processing PyMuPDF 1.23.8
AI Google Generative AI (Gemini)
Frontend Bootstrap 5 + Vanilla JS
Testing pytest + pytest-flask
Deployment Docker + Gunicorn

Project Structure

clauseforge/
+-- app.py                      # Flask entry point
+-- services/
|   +-- pdf_extractor.py        # PDF field extraction
|   +-- gemini_service.py       # AI field mapping
|   +-- pdf_filler.py           # PDF form filling
|   +-- legal_validator.py      # Legal format validation
+-- templates/index.html        # Main UI
+-- static/css/style.css
+-- static/js/app.js
+-- tests/                      # pytest suite
+-- .claude-plugin/             # Claude Code plugin manifest
+-- skills/clauseforge/         # Behavioral SKILL.md
+-- .cursor/rules/              # Cursor IDE support
+-- Dockerfile
+-- requirements.txt
+-- CLAUDE.md                   # AI pair-programming context

Testing

pytest tests/ -v

Disclaimer

ClauseForge is a drafting tool, not legal advice. Output must be reviewed by a licensed attorney before filing. Not a substitute for legal counsel. The author assumes no liability for filings made using this tool.

License

MIT (c) Terrell Lancaster. See LICENSE for details.

Contact

Built by Terrell Lancaster — Cloud Security Architect, AI Infrastructure Engineer, Claude Code Operator.

About

AI legal document automation. Fills court PDF forms, generates pleadings, validates jurisdiction-specific formatting across all 50 states using Google Gemini. Flask + Python. MIT licensed, built with Claude Code.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors