Skip to content

dvelton/counselos

Counsel_OS

   ____                          _       ___  ____
  / ___|___  _   _ _ __  ___  ___| |     / _ \/ ___|
 | |   / _ \| | | | '_ \/ __|/ _ \ |    | | | \___ \
 | |__| (_) | |_| | | | \__ \  __/ |    | |_| |___) |
  \____\___/ \__,_|_| |_|___/\___|_|_   \___/|____/

⚠️ Proof-of-concept experiment built with GitHub Copilot CLI, not for production use ⚠️

Mission Control for In-House Legal Teams

License: MIT Self-Hosted Privacy-First TypeScript

Counsel_OS is a self-hosted platform for in-house legal teams. Nineteen integrated modules covering a spectrum of legal work -- contracts, litigation, transactions, compliance, matter management, spend analytics, research, and knowledge management -- running on your own infrastructure. AI capabilities are powered by a model running locally on your hardware by default, with optional cloud AI providers labeled and gated.


Table of Contents


The Power at a Glance

Counsel_OS replaces the patchwork of spreadsheets, shared drives, and disconnected SaaS tools that most legal departments rely on. Every module is integrated, searchable, and designed by and for practicing lawyers.

Document Intelligence

Module What It Does
Contract Analyzer AI-powered clause extraction, risk scoring, and playbook comparison. Upload any contract and get a structured breakdown of key terms, obligation tracking, and deviation analysis against your negotiation playbook.
Redlining Assistant Side-by-side document diff with AI-suggested redlines and negotiation talking points. Compare drafts, generate markup, and export clean or redlined versions.
Privilege Log Generator Automatically extract document metadata, apply AI-assisted privilege classification, and export production-ready privilege logs in Excel format.

Litigation

Module What It Does
Case Timeline Builder Build interactive chronologies with document-linked events. Drag-and-drop timeline editing, date range filtering, and export to presentation-ready formats.
Discovery Dashboard Full document review workflow with coding panels, reviewer workload management, production set tracking, and review progress analytics.
Deposition Prep Workbench Organize exhibits, generate AI-suggested examination questions by theme, build witness outlines, and manage deposition logistics in one workspace.

Transactional

Module What It Does
Deal Room Manage due diligence checklists, track closing conditions, coordinate signature pages, and maintain a complete audit trail of deal activity.
Board Resolution Drafter 16+ resolution templates with variable substitution, AI-assisted drafting, unanimous written consent support, and board book generation.
Entity Management Maintain corporate org charts, officer and director registries, filing deadline calendars, and jurisdiction-specific compliance requirements.

Compliance

Module What It Does
Regulatory Tracker Monitor regulatory developments, generate AI summaries of new rules, assess impact on your organization, and track implementation status.
Policy Library Version-controlled policy repository with approval workflows, employee acknowledgment tracking, scheduled review reminders, and change history.
Training Tracker Manage compliance training programs, track completion rates, issue certifications, and generate audit-ready completion reports.

Productivity

Module What It Does
Matter Management Full matter lifecycle management with Kanban and list views, budget tracking, deadline management, team assignment, and status reporting.
Legal Hold Manager Issue, track, and audit litigation holds with custodian management, acknowledgment tracking, periodic reminders, and release workflows.
Spend Analytics Parse and manage outside counsel invoices, visualize spend by matter/firm/practice area, analyze rate trends, and track budget health.
Research Notebook AI-assisted legal research workspace with citation management, IRAC-structured memo generation, and a searchable research archive.

Knowledge Management

Module What It Does
Precedent Library Searchable repository of templates, approved clauses, and prior work product with version control and usage analytics.
FAQ Bot AI-powered knowledge base that answers recurring internal legal questions using your organization's own policies, templates, and prior guidance.
Intake Portal Structured legal request forms with auto-routing to the right team member, SLA tracking, status visibility for requestors, and intake analytics.

See It in Action

Dashboard

Counsel_OS Dashboard

The dashboard provides an at-a-glance overview of your legal department: active matters, pending requests, upcoming deadlines, and recent team activity.

Contract Analyzer

Counsel_OS Contract Analyzer

Upload any contract and get instant AI-powered clause extraction, risk scoring, and playbook comparison. Every finding is linked to the source text.

Matter Management -- Kanban View

Counsel_OS Matter Management Kanban

Track every legal matter across its lifecycle. Switch between list and board views, drag matters between status columns, and see your team's workload at a glance.

Spend Analytics

Counsel_OS Spend Analytics

Visualize outside counsel spend across matters, firms, and practice areas. Track budgets, spot trends, and identify cost-saving opportunities.

AI Configuration

Counsel_OS AI Configuration


Security and Privacy

Counsel_OS was designed from the ground up for the security and confidentiality requirements of legal work.

Your Data, Your Servers, Your Control

Principle Implementation
Local-only storage All data is stored in a SQLite database file on your server. There is no external database dependency and no cloud storage.
No telemetry Counsel_OS sends zero telemetry, analytics, or usage data anywhere. There are no tracking pixels, no anonymous usage reports, no crash reporting services. Nothing.
No phone-home The application makes zero outbound network requests unless you explicitly configure a cloud AI provider and explicitly trigger an AI action.
Offline capable With a local model for AI, Counsel_OS is fully functional with no internet connection whatsoever.
AI is opt-in per action Every AI analysis requires an explicit user click, and cloud providers display a data flow warning before each request.
Cloud AI clearly labeled When a cloud AI provider is configured, every AI action displays a clear warning that data will leave your network. The UI distinguishes local and cloud AI at every touchpoint.
Encryption at rest File storage supports encryption at rest. Database encryption is available via SQLCipher configuration.
Role-based access control Granular RBAC with support for admin, attorney, paralegal, and read-only roles. Permissions are enforced at the API layer.
Complete audit trail Every action -- document access, matter updates, AI queries, user logins -- is logged in an immutable audit trail with timestamps and user attribution.
No third-party services Counsel_OS loads no external scripts, fonts, stylesheets, or resources. No CDN. No external analytics. The application is entirely self-contained.

What Counsel_OS Does Not Do

  • Does not include any analytics, tracking, or fingerprinting code
  • Does not require an internet connection (except for optional cloud AI)
  • Does not load external fonts, scripts, or stylesheets
  • Does not use cookies for tracking (session cookies only for authentication)
  • Does not store data anywhere other than your server's filesystem

For a detailed security architecture review, see docs/security.md.


Architecture

+-----------------------------------------------------------+
|                     Your Browser                          |
|             (Nothing installed, just a URL)               |
+----------------------------+------------------------------+
                             | HTTPS
+----------------------------+------------------------------+
|                    Counsel_OS Server                       |
|  +----------+ +----------+ +----------+ +-----------+    |
|  | Next.js  | |  tRPC    | |WebSocket | |   Auth    |    |
|  |  UI/SSR  | |   API    | |  Collab  | |  (Local)  |    |
|  +----------+ +----------+ +----------+ +-----------+    |
|  +----------+ +----------+ +----------+                   |
|  |    AI    | | Document | |  Search  |                   |
|  |  Engine  | | Pipeline | |  (FTS5)  |                   |
|  +----+-----+ +----------+ +----------+                   |
|       |       +----------------------+                    |
|       |       |   SQLite Database    |  All data stays    |
|       |       |   + File Storage     |  on YOUR server    |
|       |       +----------------------+                    |
+-------+--------------------------------------------------+
        | (optional, user-configured)
+-------+------------------------+
|  Ollama (localhost)            |  <-- Default: 100% local
|  --- OR ---                    |
|  OpenAI / Anthropic /          |  <-- Optional: cloud AI
|  Azure OpenAI                  |
+--------------------------------+

Technology Stack

Layer Technology Purpose
Frontend Next.js 14+, React, TypeScript Server-rendered UI with client-side interactivity
Styling Tailwind CSS, shadcn/ui patterns Clean, accessible component library
API tRPC End-to-end type-safe API layer
Database Prisma + SQLite Zero-configuration relational database
Search SQLite FTS5 Full-text search across all modules
AI Ollama (local) Local LLM inference with no data leaving your network
AI (optional) OpenAI, Anthropic, Azure OpenAI Cloud AI providers with explicit opt-in
Real-time WebSocket Collaborative editing and live notifications
Auth Local credentials + optional SSO No dependency on external auth services

Quick Start (5 Minutes)

Prerequisites

  • Node.js 18+ (LTS recommended)
  • npm 9+ or pnpm
  • 4 GB RAM minimum (8 GB+ recommended if running Ollama locally)

Installation

# 1. Clone the repository
git clone https://github.com/your-org/counselos.git
cd counselos

# 2. Install dependencies
npm install

# 3. Set up the database
cp .env.example .env
npx prisma db push

# 4. (Optional) Install Ollama for local AI
# Visit https://ollama.com, install, then:
ollama pull llama3.1

# 5. Start Counsel_OS
npm run dev

Open http://localhost:3000 in your browser. Create your admin account on first launch and you are ready to go.


Detailed Setup for IT Teams

This section covers production deployment, infrastructure requirements, and operational considerations for IT teams deploying Counsel_OS within an organization.

System Requirements

Component Minimum Recommended
CPU 2 cores 4+ cores
RAM 4 GB 8 GB (16 GB with Ollama)
Storage 10 GB 50 GB+ (depends on document volume)
Node.js 18.x LTS 20.x LTS
OS Any (Linux, macOS, Windows) Linux (Ubuntu 22.04+, Debian 12+)

Production Build

# Build the optimized production bundle
npm run build

# Start the production server
npm start

The production server listens on port 3000 by default. Set the PORT environment variable to change this.

Docker Deployment

A production-ready Docker configuration is included. See the docker/ directory.

cd docker

# Start Counsel_OS and Ollama
docker compose up -d

# View logs
docker compose logs -f counselos

For details, see docker/docker-compose.yml.

Reverse Proxy (nginx)

For production deployments, run Counsel_OS behind a reverse proxy with TLS termination.

server {
    listen 443 ssl http2;
    server_name legal.yourcompany.com;

    ssl_certificate     /etc/ssl/certs/legal.yourcompany.com.pem;
    ssl_certificate_key /etc/ssl/private/legal.yourcompany.com.key;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

HTTPS Configuration

Set the following environment variables when running behind TLS:

NEXTAUTH_URL=https://legal.yourcompany.com
SECURE_COOKIES=true

Backup Strategy

Counsel_OS stores all data in a SQLite database file and a local file storage directory. Back up both regularly.

#!/bin/bash
# Example: daily backup via cron
BACKUP_DIR="/backups/counselos"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
DB_PATH="./data/counselos.db"
FILES_PATH="./data/files"

mkdir -p "$BACKUP_DIR"

# SQLite online backup (safe even while the server is running)
sqlite3 "$DB_PATH" ".backup '$BACKUP_DIR/counselos_$TIMESTAMP.db'"

# Archive uploaded files
tar -czf "$BACKUP_DIR/files_$TIMESTAMP.tar.gz" "$FILES_PATH"

# Retain last 30 days
find "$BACKUP_DIR" -type f -mtime +30 -delete

Add this script to your crontab:

0 2 * * * /opt/counselos/backup.sh

Updating

# Pull the latest release
git pull origin main

# Install any new dependencies
npm install

# Apply database migrations
npx prisma db push

# Rebuild and restart
npm run build
npm start

Environment Variables

Variable Default Description
DATABASE_URL file:./data/counselos.db Path to the SQLite database
PORT 3000 Server port
NEXTAUTH_URL http://localhost:3000 Public URL of the application
NEXTAUTH_SECRET (generated) Secret for session encryption
OLLAMA_BASE_URL http://localhost:11434 Ollama API endpoint
OPENAI_API_KEY (none) Optional OpenAI API key
ANTHROPIC_API_KEY (none) Optional Anthropic API key
AZURE_OPENAI_ENDPOINT (none) Optional Azure OpenAI endpoint
AZURE_OPENAI_KEY (none) Optional Azure OpenAI key
FILE_STORAGE_PATH ./data/files Path for uploaded document storage
SECURE_COOKIES false Set to true when running behind HTTPS

AI Configuration

Counsel_OS supports multiple AI providers. You can switch providers at any time from Settings > AI Configuration in the web interface.

Local AI

Ollama is an example of a large language model that runs entirely on your hardware.

  1. Install Ollama from https://ollama.com
  2. Pull a model:
    ollama pull llama3.1          # General purpose, good balance
    ollama pull llama3.1:70b      # Higher quality, requires 40GB+ RAM
    ollama pull mistral            # Lighter alternative
  3. Counsel_OS auto-detects Ollama at localhost:11434. No additional configuration needed.

OpenAI

  1. Get an API key from https://platform.openai.com
  2. Set the environment variable: OPENAI_API_KEY=sk-...
  3. Select "OpenAI" in Settings > AI Configuration

Anthropic

  1. Get an API key from https://console.anthropic.com
  2. Set the environment variable: ANTHROPIC_API_KEY=sk-ant-...
  3. Select "Anthropic" in Settings > AI Configuration

Azure OpenAI

For organizations using Microsoft Azure:

  1. Deploy a model in your Azure OpenAI resource
  2. Set environment variables:
    AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
    AZURE_OPENAI_KEY=your-key
    AZURE_OPENAI_DEPLOYMENT=your-deployment-name
  3. Select "Azure OpenAI" in Settings > AI Configuration

Azure OpenAI keeps data within your Azure tenant, which may satisfy organizational data residency requirements.

For detailed configuration options, see docs/ai-configuration.md.


Customization

Module System

Counsel_OS is built with a modular architecture. Each module is a self-contained feature area with its own routes, API endpoints, database models, and UI components.

Enable or disable modules in your configuration:

// counselos.config.ts
export const config = {
  modules: {
    contractAnalyzer: true,
    redliningAssistant: true,
    caseTimelineBuilder: true,
    discoveryDashboard: false,    // Disable modules you don't need
    depositionPrep: false,
    // ...
  }
}

AI Prompt Templates

Every AI-powered feature uses customizable prompt templates. Override defaults to match your organization's standards:

data/prompts/
  contract-analysis.md      -- Clause extraction and risk scoring
  redline-suggestions.md    -- Redline generation style
  deposition-questions.md   -- Question generation approach
  memo-generation.md        -- IRAC memo structure and tone
  risk-scoring.md           -- Risk assessment criteria

UI Theming

Counsel_OS uses Tailwind CSS with CSS custom properties for theming. Customize your instance in tailwind.config.ts:

// tailwind.config.ts
export default {
  theme: {
    extend: {
      colors: {
        primary: { /* your brand colors */ },
        accent: { /* your accent colors */ },
      }
    }
  }
}

Custom Fields

Add custom fields to matters, contracts, and other entities through the Prisma schema:

// prisma/schema.prisma
model Matter {
  // ... existing fields
  customRegion     String?
  customBusinessUnit String?
  customPriority   Int?
}

Run npx prisma db push to apply schema changes.

For a full guide on building new modules, see docs/module-development.md.


Contributing

We welcome contributions from legal technologists, developers, and practicing lawyers. Whether you are fixing a typo, adding a feature, or building an entirely new module, your work helps the entire in-house legal community.

See CONTRIBUTING.md for guidelines on setting up a development environment, code style, and the pull request process.


License

Counsel_OS is released under the MIT License.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

Built for the lawyers who protect their organizations every day. Your work matters. Your tools should too.

About

CounselOS is Mission Control for In-House Legal Teams

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages