🚧 PROJECT UNDER IDEATION/DEVELOPMENT 🚧
This project is currently in ideation/conceptual phase. The features described below represent our roadmap rather than current functionality. We welcome cross-functional contributors interested in colloborating on this applied project!
A fact-centered legal narrative generation system that uses Answer Set Programming (ASP) to guide Large Language Models in creating structured legal narratives for fee waiver applications.
The Problem with Standard LLMs for Legal Narratives:
Large Language Models (LLMs) excel at generating fluent text but have critical limitations in legal contexts:
- They tend to predict what sounds persuasive rather than what's factually accurate
- They often add creative embellishments or emotional details not present in the original facts
- They lack understanding of proper legal argumentation structure
- They can generate inconsistent or contradictory statements across longer narratives
- They can generate compound statements when it is not needed.
In legal settings where factual accuracy is a must such as fee waiver applications, these limitations can be damaging or even ethically problematic. Courts require strictly factual submissions without embellishment, and improper narrative structure can lead to denied applications.
TruLex addresses these challenges by using Answer Set Programming (ASP) to create rule-based frameworks that guide LLM output toward factually accurate, properly structured legal narratives.
TruLex aims to combine symbolic reasoning (ASP) with neural language generation (LLMs) to produce legally sound, fact-centered narratives that follow proper legal argumentation structures. Unlike purely LLM-based approaches that may produce creative embellishments, our goal is to ensure narratives remain strictly factual while optimizing their legal effectiveness.
- Fact-Centered Output: Maintain high factual adherence with minimal embellishment
- Legal Structure Guidance: Use ASP-generated outlines to ensure proper legal argumentation
- Constraint-Based Generation: Encode legal knowledge as logical constraints
- Measurable Quality: Include metrics for evaluating factual adherence and legal relevance
- Python 3.8+
- Clingo (Answer Set Programming solver)
- Access to an LLM API (OpenAI, DeepSeek, etc.)
-
Clone the repository:
git clone https://github.com/yourusername/TruLex.git cd TruLex -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install development dependencies:
pip install -r requirements-dev.txt
-
Set up your environment variables:
cp .env.example .env # Edit .env with your API keys and configuration
TruLex/
├── README.md # This file
├── requirements-dev.txt # Development dependencies
├── asp/ # Answer Set Programming components
│ └── legal_narratives.lp # Initial ASP program (planned)
├── llm/ # LLM integration components (planned)
│ └── prompts.py # Initial prompt templates
└── examples/ # Example tenant cases and structures
-
Phase 1 (Current): Project setup and initial ASP program development
- Establish repository structure
- Define initial ASP constraints for legal narratives
- Create evaluation framework
-
Phase 2: Core implementation
- Develop ASP solver integration
- Implement LLM narrative generation
- Create basic CLI interface
-
Phase 3: Web interface and API
- Develop Flask backend
- Create user-friendly web interface
- Implement RESTful API
-
Phase 4: Evaluation and refinement
- Test with real fee waiver scenarios
- Improve narrative quality based on feedback
- Optimize fact-centeredness metrics
We welcome contributions at this early stage! Here are some ways to get involved:
- Legal Expertise: Help define effective narrative structures for fee waiver applications
- ASP Development: Contribute to answer set programming constraints and rules
- LLM Integration: Help develop effective prompting strategies for fact-centered outputs
- Documentation: Improve our documentation and examples
To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
IMPORTANT: DO NOT SUBMIT OUTPUTS FROM THIS TOOL DIRECTLY TO COURTS TruLex is provided for informational, research and educational purposes only. Narratives generated by this tool are not legal advice and should not be submitted to any court or legal authority without thorough review and verification by a qualified legal professional. The system may generate inaccurate, incomplete, or inappropriate content despite our best efforts to ensure fact-centered outputs. Users bear full responsibility for verifying all information and ensuring compliance with court rules, legal ethical standards, and accuracy requirements. By using TruLex, you acknowledge that all outputs must be reviewed by a qualified legal professional before any submission to a court or legal proceeding. The developers of TruLex assume no liability for any consequences resulting from the use or misuse of this tool in legal proceedings.
For questions, feedback, or collaboration opportunities, please open an issue or connect with me on LinkedIn.
This project is licensed under the MIT License - see the LICENSE file for details (coming soon).