npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

openclaw-legal-counsel

v1.0.0

Published

AI-powered Legal Counsel Assistant - Contract drafting, review, risk analysis, and compliance management

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.sh

Basic 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 templates

Available 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.pdf

3. 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.docx

4. 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 tech

5. 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 = draft
  • r = review
  • a = analyze
  • c = 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 Delaware

Small 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.pdf

Project 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.md

Customizing 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

  1. Create a new .md file in templates/contracts/
  2. Add placeholders using {{NAME}} syntax
  3. Use the template name (filename without .md) with the draft command

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

  1. Review carefully - Always review generated contracts before use
  2. Customize - Adapt templates to your specific situation
  3. Get legal advice - Consult a licensed attorney for important contracts
  4. Update regularly - Keep templates current with law changes

For Contract Review

  1. Provide context - Include jurisdiction and industry information
  2. Check all risks - Review all identified risks, not just high-priority
  3. Verify completeness - Ensure all necessary clauses are present
  4. Seek clarification - Ask for legal advice on unclear terms

For Risk Analysis

  1. Prioritize - Address high-priority risks first
  2. Document - Keep records of identified risks and mitigations
  3. Regular reviews - Periodically reassess risks
  4. 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:

  1. Fork the repository
  2. Create a feature branch
  3. Add templates or improve functionality
  4. Test thoroughly
  5. 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.