openclaw-legal-counsel
v1.0.0
Published
AI-powered Legal Counsel Assistant - Contract drafting, review, risk analysis, and compliance management
Maintainers
Readme
OpenClaw Legal Counsel - AI Legal Assistant
AI-powered Legal Counsel Assistant for contract drafting, review, risk analysis, and compliance management.
Features
- Contract Drafting - Generate professional legal contracts from templates
- Contract Review - Analyze contracts for risks and missing clauses
- Risk Analysis - Identify legal risks and liability exposure
- Compliance Check - Verify compliance with regulations
- Legal Advice - Get general legal guidance on common issues
- Template Library - Pre-built templates for common contracts
Quick Start
Installation
# Clone the repository
git clone https://github.com/ZhenRobotics/openclaw-legal-counsel.git
cd openclaw-legal-counsel
# Install dependencies
npm install
# Make CLI executable
chmod +x agents/legal-cli.shBasic Usage
# Get help
./agents/legal-cli.sh help
# Draft an NDA
./agents/legal-cli.sh draft "NDA between Acme Corp and Tech Inc"
# Review a contract
./agents/legal-cli.sh review contract.pdf
# Analyze risks
./agents/legal-cli.sh analyze agreement.docx
# Check compliance
./agents/legal-cli.sh compliance
# Get legal advice
./agents/legal-cli.sh advice "What should be in an employee handbook?"
# List available templates
./agents/legal-cli.sh templatesAvailable Contract Templates
1. NDA (Non-Disclosure Agreement)
Use Case: Protect confidential information when sharing with partners, contractors, or employees.
Key Features:
- Definition of confidential information
- Obligations of receiving party
- Return of materials clause
- Duration and survival terms
./agents/legal-cli.sh draft "NDA between Acme Corp and John Doe"2. Service Agreement
Use Case: Engage contractors or service providers for professional services.
Key Features:
- Scope of services
- Payment terms
- Intellectual property rights
- Termination clauses
- Limitation of liability
./agents/legal-cli.sh draft "service agreement for web development"3. Employment Agreement
Use Case: Hire full-time employees with clear terms and conditions.
Key Features:
- Position and duties
- Compensation and benefits
- Confidentiality obligations
- Intellectual property assignment
- Non-compete clause
- Termination provisions
./agents/legal-cli.sh draft "employment agreement for Software Engineer"4. Consulting Agreement
Use Case: Engage independent consultants for specialized projects.
Key Features:
- Independent contractor relationship
- Scope of work and deliverables
- Payment structure
- IP ownership
- Confidentiality
- Non-solicitation
./agents/legal-cli.sh draft "consulting agreement for business strategy"Core Features
1. Contract Drafting
Generate professional contracts from templates with automatic placeholder filling.
Example:
./agents/legal-cli.sh draft "NDA between Acme Corp and Tech Inc"Output:
- Formatted contract document (Markdown)
- Saved to
output/directory - Includes all essential clauses
- Ready for customization and review
2. Contract Review
Analyze existing contracts for potential issues.
What it checks:
- Missing essential clauses (termination, liability, dispute resolution)
- Identified legal risks (unlimited liability, one-sided terms)
- Key term analysis
- Overall contract score
Example:
./agents/legal-cli.sh review /path/to/contract.pdf3. Risk Analysis
Identify legal risks and prioritize mitigation strategies.
Risk Categories:
- High Priority: Critical risks requiring immediate attention
- Medium Priority: Important risks to address
- Low Priority: Minor concerns
Example:
./agents/legal-cli.sh analyze /path/to/document.docx4. Compliance Check
Verify compliance with regulations and standards.
Compliance Areas:
- GDPR (data privacy)
- Employment law
- Industry-specific regulations
- Corporate governance
Example:
./agents/legal-cli.sh compliance --jurisdiction US --industry tech5. Legal Advice
Get general legal guidance on common questions.
Example:
./agents/legal-cli.sh advice "What clauses should I include in a partnership agreement?"CLI Commands
Main Commands
| Command | Description | Example |
|---------|-------------|---------|
| draft <type> | Draft a new contract | draft "NDA between A and B" |
| review <file> | Review existing contract | review contract.pdf |
| analyze <file> | Analyze legal risks | analyze agreement.docx |
| compliance | Check compliance | compliance |
| advice <question> | Get legal guidance | advice "employment law question" |
| templates | List available templates | templates |
| help | Show help information | help |
| version | Show version | version |
Aliases
d=draftr=reviewa=analyzec=compliance
Use Cases
Startup Founder
Scenario: Starting a new company and need legal documents
# 1. Draft NDA for potential investors
./agents/legal-cli.sh draft "NDA between MyStartup Inc and Investor"
# 2. Create employment agreement for first hire
./agents/legal-cli.sh draft "employment agreement for CTO"
# 3. Draft service agreement for contractors
./agents/legal-cli.sh draft "service agreement for design services"
# 4. Check compliance
./agents/legal-cli.sh compliance --jurisdiction DelawareSmall Business Owner
Scenario: Need to review and update existing contracts
# 1. Review vendor contract
./agents/legal-cli.sh review vendor-contract.pdf
# 2. Analyze risks in partnership agreement
./agents/legal-cli.sh analyze partnership-agreement.docx
# 3. Get advice on employee handbook
./agents/legal-cli.sh advice "What should I include in employee handbook?"Consultant/Freelancer
Scenario: Create professional service agreements
# 1. Draft consulting agreement
./agents/legal-cli.sh draft "consulting agreement for marketing services"
# 2. Create NDA for client projects
./agents/legal-cli.sh draft "NDA with ClientName"
# 3. Review client's proposed contract
./agents/legal-cli.sh review client-contract.pdfProject Structure
openclaw-legal-counsel/
├── agents/
│ ├── legal-agent.ts # Main AI agent
│ └── legal-cli.sh # CLI tool
├── templates/
│ └── contracts/ # Contract templates
│ ├── NDA.md
│ ├── service_agreement.md
│ ├── employment.md
│ └── consulting.md
├── output/ # Generated contracts
├── docs/ # Documentation
├── package.json
└── README.mdCustomizing Templates
Template Placeholders
Templates use {{PLACEHOLDER}} syntax for dynamic content:
**Date:** {{DATE}}
**Party A:** {{PARTY_A}}
**Party B:** {{PARTY_B}}
**Jurisdiction:** {{JURISDICTION}}Creating Custom Templates
- Create a new
.mdfile intemplates/contracts/ - Add placeholders using
{{NAME}}syntax - Use the template name (filename without .md) with the
draftcommand
Example template structure:
# CONTRACT TITLE
**Date:** {{DATE}}
**Between:**
- **Party A:** {{PARTY_A}}
- **Party B:** {{PARTY_B}}
## 1. TERMS
{{CUSTOM_TERMS}}
## SIGNATURES
**{{PARTY_A}}**
Signature: ________________________
**{{PARTY_B}}**
Signature: ________________________API Usage
Use programmatically in your Node.js applications:
import { handleRequest, parseInput } from './agents/legal-agent';
// Parse natural language input
const request = parseInput("Draft an NDA between Acme and Tech Inc");
// Handle request
const response = await handleRequest(request);
console.log(response.message);
if (response.success) {
console.log('Contract path:', response.data.contract_path);
}Configuration
Environment Variables
# Optional: Set default jurisdiction
export DEFAULT_JURISDICTION="United States"
# Optional: Set default output directory
export LEGAL_OUTPUT_DIR="./output"Custom Settings
Edit agents/legal-agent.ts to customize:
- Default terms and values
- Risk analysis rules
- Compliance check criteria
- Template paths
Best Practices
For Contract Drafting
- Review carefully - Always review generated contracts before use
- Customize - Adapt templates to your specific situation
- Get legal advice - Consult a licensed attorney for important contracts
- Update regularly - Keep templates current with law changes
For Contract Review
- Provide context - Include jurisdiction and industry information
- Check all risks - Review all identified risks, not just high-priority
- Verify completeness - Ensure all necessary clauses are present
- Seek clarification - Ask for legal advice on unclear terms
For Risk Analysis
- Prioritize - Address high-priority risks first
- Document - Keep records of identified risks and mitigations
- Regular reviews - Periodically reassess risks
- Professional review - Have an attorney review high-risk situations
Limitations and Disclaimer
This Tool Does NOT:
- Replace qualified legal counsel
- Provide legal advice for specific situations
- Guarantee legal compliance
- Create attorney-client privilege
- Provide jurisdiction-specific expertise
This Tool DOES:
- Provide general legal information
- Generate starting-point contract drafts
- Identify common legal issues
- Offer educational guidance
- Save time on routine legal tasks
Legal Disclaimer
This tool provides general legal information, not legal advice.
The information and documents generated by this tool are for educational and informational purposes only. They do not constitute legal advice and should not be relied upon as such. Laws vary by jurisdiction and change frequently.
Always consult with a licensed attorney:
- Before signing any legal document
- For advice on specific legal matters
- To ensure compliance with applicable laws
- To protect your legal rights
The creators and contributors of this tool:
- Make no warranties about accuracy or completeness
- Accept no liability for use of generated documents
- Recommend professional legal review for all contracts
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add templates or improve functionality
- Test thoroughly
- Submit a pull request
Areas for Contribution
- Additional contract templates
- Enhanced risk analysis algorithms
- Jurisdiction-specific compliance rules
- Multi-language support
- Integration with legal databases
Roadmap
v1.1 (Planned)
- [ ] PDF export for contracts
- [ ] More contract templates (partnership, licensing, etc.)
- [ ] Enhanced AI-powered clause suggestions
- [ ] Multi-jurisdiction support
v1.2 (Planned)
- [ ] Integration with Claude API for better analysis
- [ ] Document comparison tool
- [ ] Contract version tracking
- [ ] Email notifications for contract deadlines
v2.0 (Future)
- [ ] Web interface
- [ ] Document database/repository
- [ ] Collaboration features
- [ ] E-signature integration
Support
Documentation
Getting Help
- Open an issue on GitHub
- Check existing issues and discussions
- Review the FAQ
Commercial Support
For enterprise features, custom templates, or professional support, contact the maintainers.
License
MIT License - see LICENSE file for details.
Acknowledgments
- Built on OpenClaw platform
- Inspired by the need for accessible legal tools
- Contract templates based on industry standards
Made with ⚖️ by OpenClaw
Remember: This tool is a starting point, not a replacement for professional legal counsel.
