Queries local WeChat messages, contacts, and chat history from the command line by decrypting SQLCipher databases via a Rust daemon. Useful for users who need to access their WeChat data without network requests.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
---
name: wx-cli-wechat-local-data
description: Query local WeChat data from the command line using a Rust daemon with SQLCipher decryption
triggers:
- query my WeChat messages
- search WeChat chat history
- get WeChat contacts from CLI
- read local WeChat data
- wx-cli setup and usage
- decrypt WeChat database
- WeChat unread messages command line
- export WeChat chat history
---
# wx-cli — WeChat Local Data CLI
> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.
`wx-cli` is a Rust-based CLI tool that queries your local WeChat data (messages, contacts, groups, favorites, stats) by scanning the WeChat process memory for SQLCipher keys and decrypting the local databases via a persistent background daemon.
---
## Architecture
wx (CLI) ──Unix socket──▶ wx-daemon (background process) │ ┌─────────┴──────────┐ DBCache Contact Cache (mtime-aware reuse)
- Daemon decrypts WeChat's SQLCipher 4 databases on first use, caches them in `~/.wx-cli/cache/`
- Subsequent calls reuse cached DBs if mtime is unchanged — millisecond responses
- All data stays local; no network calls
---
## Installation
### npm (recommended, all platforms)
```bash
npm install -g @jackwener/wx-cli
curl -fsSL https://raw.githubusercontent.com/jackwener/wx-cli/main/install.sh | bash
irm https://raw.githubusercontent.com/jackwener/wx-cli/main/install.ps1 | iex
git clone [email protected]:jackwener/wx-cli.git && cd wx-cli
cargo build --release
# Binary: target/release/wx (Windows: wx.exe)
sudo mv target/release/wx /usr/local/bin/
WeChat must be running and logged in before initializing.
# 1. Re-sign WeChat so wx-cli can read its memory (redo after WeChat updates)
codesign --force --deep --sign - /Applications/WeChat.app
# If you get "signature in use" error:
codesign --remove-signature "/Applications/WeChat.app/Contents/Frameworks/vlc_plugins/librtp_mpeg4_plugin.dylib"
codesign --force --deep --sign - /Applications/WeChat.app
# 2. Restart WeChat and wait for full login
killall WeChat && open /Applications/WeChat.app
# 3. Initialize (extracts encryption keys from memory)
sudo wx init
sudo wx init
wx init
wx sessions # Should show recent conversations
# Recent 20 sessions
wx sessions
# Sessions with unread messages
wx unread
# Filter by type: private, group, official_account, folded
wx unread --filter private,group
# New messages since last check (incremental)
wx new-messages
# Chat history (last 50 messages)
wx history "张三"
# Chat history with date range
wx history "AI群" --since 2026-04-01 --until 2026-04-15
# Full-text search across all chats
wx search "关键词"
# Search within a specific chat with date filter
wx search "会议" --in "工作群" --since 2026-01-01
# All contacts
wx contacts
# Search contacts by name
wx contacts --query "李"
# List group members
wx members "AI交流群"
# All favorites
wx favorites
# Filter favorites by type: text, image, article, card, video
wx favorites --type image
# Search favorites
wx favorites --query "关键词"
# Chat statistics
wx stats "AI群"
# Stats with date range
wx stats "AI群" --since 2026-01-01
# Export to Markdown
wx export "张三" --format markdown -o chat.md
# Export group chat as JSON with date range
wx export "AI群" --since 2026-01-01 --format json
# Default: YAML (token-efficient, human-readable)
wx sessions
# JSON output (for jq piping)
wx sessions --json
wx search "关键词" --json | jq '.[0].content'
wx new-messages --json
wx history "张三" --json | jq '[.[] | select(.sender == "张三")]'
wx daemon status
wx daemon stop
wx daemon logs --follow
All session/message output includes a chat_type field:
| Value | Meaning |
|---|---|
private | Direct/private messages |
group | Group chats |
official_account | Public accounts, subscription accounts, service accounts, system notifications (mphelper, qqsafe) |
folded | Folded subscriptions / folded group chats aggregation entries |
~/.wx-cli/
├── config.json # Configuration
├── all_keys.json # Database encryption keys
├── daemon.sock # Unix socket (Linux/macOS)
├── daemon.pid # Daemon PID file
├── daemon.log # Daemon log file
└── cache/
├── _mtimes.json # mtime index for cache invalidation
└── *.db # Decrypted SQLite databases
while true; do
wx new-messages --json | jq '.[] | "\(.sender): \(.content)"'
sleep 30
done
wx unread --json | jq 'group_by(.chat_type) | map({type: .[0].chat_type, count: length})'
wx contacts --json | jq -r '.[].name' | while read name; do
wx export "$name" --since 2026-01-01 --format markdown -o "exports/${name}.md"
done
wx search "项目" --in "工作群" --json | jq '[.[] | {time: .timestamp, sender: .sender, msg: .content}]'
if ! wx daemon status | grep -q "running"; then
sudo wx init
fi
WeChat 4.x encrypts local databases with SQLCipher 4 (AES-256-CBC + HMAC-SHA512, PBKDF2 256,000 iterations). WCDB caches the derived raw key in process memory as x'<64hex_key><32hex_salt>'.
wx-cli extracts keys by:
mach_vm_region + mach_vm_read) — requires sudo and ad-hoc code signature/proc/<pid>/mem scanning — requires sudoThe daemon then decrypts databases on demand and caches them with mtime tracking.
codesign --remove-signature "/Applications/WeChat.app/Contents/Frameworks/vlc_plugins/librtp_mpeg4_plugin.dylib"
codesign --force --deep --sign - /Applications/WeChat.app
# Check daemon logs
wx daemon logs
# Ensure WeChat is running and logged in, then re-init
wx daemon stop
sudo wx init
wx sessions
# Stop daemon to clear in-memory state
wx daemon stop
# Re-sign WeChat if updated
codesign --force --deep --sign - /Applications/WeChat.app
# Re-initialize
sudo wx init
# wx init requires root to read /proc/<pid>/mem
sudo wx init
# Cache invalidates automatically on DB mtime change
# Force refresh by stopping daemon
wx daemon stop
wx sessions # Daemon auto-restarts and re-reads
# Install skill for Claude Code / Cursor / Codex
npx skills add jackwener/wx-cli
# Install globally
npx skills add jackwener/wx-cli -g
After installation, the agent reads SKILL.md automatically to understand wx-cli usage.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
wechat-data, cli-tool, sqlcipher-decryption, local-database, rust-cli
/aradotso-trending-skills-37:wx-cli-wechat-local-datafrom aradotso-trending-skills-37
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /aradotso-trending-skills-37:wx-cli-wechat-local-data still runs it.
aradotso-trending-skills-37@cascade-ai-ml-agents-misc-1 is listed by joshuarweaver/cascade-ai-ml-agents-misc-1 — review the source before installing
npx claudepluginhub joshuarweaver/cascade-ai-ml-agents-misc-1 --plugin aradotso-trending-skills-37496 skills in this plugin
/3dsvg-interactive-reactTurn SVGs into interactive React 3D components using the 3dsvg library and visual editor/724-office-ai-agentSelf-evolving AI agent system with 26 tools, three-layer memory, MCP plugins, and 24/7 self-repair in pure Python./acgti-anime-persona-quizACG Type Indicator — MBTI-inspired anime character persona quiz built with Vue 3, TypeScript, and ViteOther plugins' skills for the same job