# ChatLab

> Open-source, local-first desktop app and CLI that analyzes chat history from messaging apps using SQL and AI agents.

ChatLab is an open-source, local-first tool for analyzing exported chat history from messaging apps. It ships as an Electron desktop app and as a Node.js CLI, and combines visual analytics with AI agents. Chat data and settings stay in a local database, and the latest listed release is v0.37.5.

## What It Is

ChatLab imports exported conversations, normalizes them into a unified data model, and lets users explore them with visual views, a SQL engine, and AI agents. The README lists support for WhatsApp, LINE, QQ, Discord, Instagram, Telegram, iMessage, and Google Chat, with Messenger and KakaoTalk coming next. Custom adapters are described for other chat software.

## How the Workflow Runs

The README describes five stages: format detection, stream parsing, local persistence, SQL plus AI query, and visualization. Stream parsing and multi-worker processing are intended to keep imports responsive at million-message scale. The visual views cover trends, time patterns, interaction frequency, rankings, relationships, message types, topics, and language.

## AI Agents and Privacy

The AI layer uses an agent with function calling (24+ tools per the README) to search, summarize, and analyze chat records. The site states that analysis runs locally and works offline, with AI features as the exception; it recommends local models if hardware supports them. Raw conversations are not uploaded to a cloud by default.

## Ways to Run It

The desktop client includes auto-import and local API services. The CLI (chatlab-cli, requires Node.js 20 or newer) can start an API with a web UI, run headless for scripts and AI agents, or run as a background service on macOS and Linux. The site says the CLI includes MCP protocol and AI agent integration. The project is licensed under AGPL-3.0.

## Features
- Local-first chat analysis with data kept on-device
- Stream parsing and multi-worker processing for million-message histories
- AI agent with function calling (24+ tools)
- Visual views for trends, timing, relationships, message types, topics and language
- Standardized chat data format with custom adapters
- SQL query engine over chat data
- Desktop app with auto-import and local API
- CLI with headless API mode and background service
- MCP protocol and AI agent integration via CLI

## Integrations
WhatsApp, LINE, QQ, Discord, Instagram, Telegram, iMessage, Google Chat, MCP

## Platforms
WINDOWS, MACOS, LINUX, WEB, API, CLI

## Pricing
Open Source

## Version
v0.37.5

## Links
- Website: https://chatlab.fun
- Documentation: https://docs.chatlab.fun/
- Repository: https://github.com/ChatLab/ChatLab
- EveryDev.ai: https://www.everydev.ai/tools/chatlab
