wechat-cli  by huohuoer

Query local WeChat data for AI agents

Created 2 weeks ago

New!

448 stars

Top 66.8% on SourcePulse

GitHubView on GitHub
Project Summary

This CLI tool provides local access to WeChat data, including chat history, contacts, and favorites, with a focus on integration into AI agents. It offers a secure, privacy-preserving method for querying personal WeChat data without cloud transmission, benefiting developers and power users needing programmatic access to their chat logs.

How It Works

The tool operates by accessing locally stored WeChat data, which is encrypted using SQLCipher. It extracts encryption keys by scanning the WeChat process memory during an init step. Subsequently, it performs on-the-fly, page-level AES-256-CBC decryption and caching, allowing direct querying of the SQLite databases. This approach ensures all data remains on the user's machine, enhancing privacy and security.

Quick Start & Requirements

  • Primary Install: npm install -g @canghe_ai/wechat-cli (Recommended, provides macOS arm64 binary).
  • Alternative Installs:
    • pip install wechat-cli (Requires Python >= 3.10).
    • From Source: git clone ... && cd wechat-cli && pip install -e .
  • Prerequisites: Node.js (for npm install), Python >= 3.10 (for pip/source). macOS requires granting Full Disk Access to the terminal application. Windows requires running in a terminal with sufficient privileges. Linux requires root access.
  • Setup Notes: macOS users may need to re-sign the WeChat application to resolve task_for_pid errors, a process described in the README.
  • Links: npm package, GitHub

Highlighted Details

  • AI-first design with JSON output by default, optimized for LLM agent tool calls.
  • Comprehensive functionality with 11 commands covering sessions, history, search, contacts, stats, export, and more.
  • Fully local operation, ensuring data privacy as encryption keys are extracted and decryption occurs on-the-fly without data leaving the machine.
  • Rich chat analytics, including top senders, message type breakdowns, and 24-hour activity charts.
  • Flexible export options to Markdown or plain text with time range filtering.

Maintenance & Community

The project is actively maintained, indicated by the latest npm version badge. No specific community channels (like Discord or Slack) or details on major contributors/sponsorships are provided in the README.

Licensing & Compatibility

The project is licensed under the Apache License 2.0. This license is permissive and generally compatible with commercial use and linking within closed-source projects.

Limitations & Caveats

Compatibility is sensitive to specific macOS versions (≥ 26.3.1) and WeChat for Mac versions (≤ 4.1.8.100); newer or older versions may not function correctly. macOS users must navigate potential process memory access restrictions (task_for_pid errors) which may require re-signing the WeChat application. The tool is strictly read-only and does not automate actions or modify WeChat data.

Health Check
Last Commit

2 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
0
Star History
473 stars in the last 18 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Ishaan Jaffer Ishaan Jaffer(Cofounder of LiteLLM), and
4 more.

chathub by chathub-dev

0.1%
11k
All-in-one chatbot client
Created 3 years ago
Updated 1 month ago
Feedback? Help us improve.