wx-cli-wechat-local-data

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

wx-cli: WeChat Local Data CLI

wx-cli: 微信本地数据命令行工具

Skill by ara.so — Devtools Skills collection.
Query and export local WeChat data (messages, contacts, moments, favorites, public account articles) from the command line. Built in Rust with a daemon architecture that caches decrypted databases for millisecond-level responses.
ara.so 提供的技能——开发工具技能合集。
从命令行查询并导出本地微信数据(消息、联系人、朋友圈、收藏、公众号文章)。基于 Rust 构建,采用守护进程架构,缓存解密后的数据库以实现毫秒级响应。

What it does

功能介绍

wx-cli
provides a command-line interface to your local WeChat data without network calls. It:
  • Scans WeChat's memory to extract database encryption keys
  • Maintains a background daemon that caches decrypted databases (reuses cache if mtime unchanged)
  • Queries messages, contacts, groups, moments (SNS), favorites, and public account articles
  • Extracts and decodes image attachments (.dat files)
  • Returns structured JSON with metadata about data freshness
Key features:
  • Zero-dependency single binary
  • Fully local (no data leaves your machine)
  • AI-friendly JSON output with
    meta
    wrapper for freshness/source info
  • Supports incremental queries (
    new-messages
    returns only messages since last check)
wx-cli
提供命令行接口访问你的本地微信数据,无需网络请求。它可以:
  • 扫描微信内存提取数据库加密密钥
  • 维持后台守护进程,缓存解密后的数据库(若文件修改时间未变则复用缓存)
  • 查询消息、联系人、群组、朋友圈(SNS)、收藏及公众号文章
  • 提取并解码图片附件(.dat 文件)
  • 返回包含数据新鲜度元信息的结构化 JSON
核心特性:
  • 零依赖单二进制文件
  • 完全本地化(数据不会离开你的设备)
  • 适配 AI 的 JSON 输出,带有
    meta
    包装层提供新鲜度/来源信息
  • 支持增量查询(
    new-messages
    仅返回自上次检查后的新消息)

Installation

安装方法

npm (recommended, cross-platform):
bash
npm install -g @jackwener/wx-cli
macOS / Linux (curl):
bash
curl -fsSL https://raw.githubusercontent.com/jackwener/wx-cli/main/install.sh | bash
Windows (PowerShell as Administrator):
powershell
irm https://raw.githubusercontent.com/jackwener/wx-cli/main/install.ps1 | iex
npm(推荐,跨平台):
bash
npm install -g @jackwener/wx-cli
macOS / Linux(curl):
bash
curl -fsSL https://raw.githubusercontent.com/jackwener/wx-cli/main/install.sh | bash
Windows(以管理员身份运行 PowerShell):
powershell
irm https://raw.githubusercontent.com/jackwener/wx-cli/main/install.ps1 | iex

Initial Setup

初始设置

Keep WeChat running, then initialize (one-time):
保持微信运行,然后执行一次性初始化:

macOS

macOS

Ad-hoc signing is required to scan WeChat's memory:
bash
undefined
需要临时签名才能扫描微信内存:
bash
undefined

1. Sign WeChat (once per WeChat update)

1. 签名微信(每次微信更新后需执行一次)

codesign --force --deep --sign - /Applications/WeChat.app
codesign --force --deep --sign - /Applications/WeChat.app

2. Reset TCC privacy records (required after re-signing)

2. 重置 TCC 隐私记录(重新签名后必需)

for s in ScreenCapture Camera Microphone AppleEvents AddressBook
SystemPolicyDocumentsFolder SystemPolicyDownloadsFolder SystemPolicyDesktopFolder; do tccutil reset "$s" com.tencent.xinWeChat done
for s in ScreenCapture Camera Microphone AppleEvents AddressBook
SystemPolicyDocumentsFolder SystemPolicyDownloadsFolder SystemPolicyDesktopFolder; do tccutil reset "$s" com.tencent.xinWeChat done

3. Restart WeChat and wait for full login

3. 重启微信并等待完全登录

killall WeChat && open /Applications/WeChat.app
killall WeChat && open /Applications/WeChat.app

4. Initialize wx-cli

4. 初始化 wx-cli

sudo wx init

If `codesign` reports `signature in use`:

```bash
codesign --remove-signature "/Applications/WeChat.app/Contents/Frameworks/vlc_plugins/librtp_mpeg4_plugin.dylib"
codesign --force --deep --sign - /Applications/WeChat.app
sudo wx init

如果 `codesign` 报告 `signature in use`:

```bash
codesign --remove-signature "/Applications/WeChat.app/Contents/Frameworks/vlc_plugins/librtp_mpeg4_plugin.dylib"
codesign --force --deep --sign - /Applications/WeChat.app

Linux

Linux

bash
sudo wx init
bash
sudo wx init

Windows

Windows

Run PowerShell as Administrator:
powershell
wx init
Verify installation:
bash
wx sessions
If you see recent sessions, setup is complete. The daemon starts automatically on first command.
以管理员身份运行 PowerShell:
powershell
wx init
验证安装:
bash
wx sessions
如果能看到最近的会话,则设置完成。守护进程会在首次执行命令时自动启动。

Core Commands

核心命令

Messages & Sessions

消息与会话

bash
undefined
bash
undefined

Recent sessions (conversations)

最近的会话

wx sessions
wx sessions

Unread sessions only

仅显示未读会话

wx unread
wx unread

Filter unread (exclude official accounts and folded entries)

过滤未读会话(排除公众号和折叠条目)

wx unread --filter private,group
wx unread --filter private,group

New messages since last check (incremental)

自上次检查后的新消息(增量查询)

wx new-messages
wx new-messages

Chat history with a contact/group

与联系人/群组的聊天记录

wx history "张三" wx history "张三" -n 2000 # More messages wx history "AI群" --since 2026-04-01 --until 2026-04-15
wx history "张三" wx history "张三" -n 2000 # 获取更多消息 wx history "AI群" --since 2026-04-01 --until 2026-04-15

Search across all messages

搜索所有消息

wx search "关键词" wx search "关键词" -n 500 # More results wx search "会议" --in "工作群" --since 2026-01-01

**JSON output structure:**

```rust
// history, search, sessions, new-messages, stats, attachments
{
  "data": [...],
  "meta": {
    "status": "ok" | "possibly_stale" | "windowed",
    "unknown_shards": ["message_3.db"],  // If non-empty, run `wx init --force`
    "chat_latest_timestamp": "2026-05-16T12:34:56+08:00",
    "chat_latest_db": "message_2.db",
    "session_last_timestamp": "2026-05-16T14:20:00+08:00"
  }
}
Message fields:
json
{
  "time": "2026-05-16 10:23:45",
  "timestamp": 1715832225,
  "sender": "张三",
  "content": "消息内容",
  "type": "text",
  "chat_type": "private",
  "is_self": false
}
  • chat_type
    :
    private
    |
    group
    |
    official_account
    |
    folded
  • type
    :
    text
    |
    image
    |
    video
    |
    file
    |
    link
    |
    voice
    |
    system
    | etc.
Quoted messages: History/search output shows quoted replies with original context:
text
[引用] 当前回复
  ↳ 发送者: 被引用内容
wx search "关键词" wx search "关键词" -n 500 # 获取更多结果 wx search "会议" --in "工作群" --since 2026-01-01

**JSON 输出结构:**

```rust
// history, search, sessions, new-messages, stats, attachments
{
  "data": [...],
  "meta": {
    "status": "ok" | "possibly_stale" | "windowed",
    "unknown_shards": ["message_3.db"],  // 若不为空,请执行 `wx init --force`
    "chat_latest_timestamp": "2026-05-16T12:34:56+08:00",
    "chat_latest_db": "message_2.db",
    "session_last_timestamp": "2026-05-16T14:20:00+08:00"
  }
}
消息字段:
json
{
  "time": "2026-05-16 10:23:45",
  "timestamp": 1715832225,
  "sender": "张三",
  "content": "消息内容",
  "type": "text",
  "chat_type": "private",
  "is_self": false
}
  • chat_type
    :
    private
    |
    group
    |
    official_account
    |
    folded
  • type
    :
    text
    |
    image
    |
    video
    |
    file
    |
    link
    |
    voice
    |
    system
    | 其他类型
引用消息: 历史记录/搜索结果会显示带有原始上下文的引用回复:
text
[引用] 当前回复
  ↳ 发送者: 被引用内容

Contacts & Groups

联系人与群组

bash
undefined
bash
undefined

List contacts

列出联系人

wx contacts wx contacts --query "李" # Search by name
wx contacts wx contacts --query "李" # 按姓名搜索

List group members (prioritizes group nicknames)

列出群成员(优先显示群昵称)

wx members "AI交流群" wx members "AI交流群" --json # JSON with username/display/group_nickname/is_owner

**Member JSON structure:**

```json
{
  "username": "wxid_abc123",
  "display": "李四 (群昵称)",
  "contact_display": "李四",
  "group_nickname": "群昵称",
  "is_owner": false
}
wx members "AI交流群" wx members "AI交流群" --json # 返回包含用户名/显示名/群昵称/是否为群主的 JSON

**成员 JSON 结构:**

```json
{
  "username": "wxid_abc123",
  "display": "李四 (群昵称)",
  "contact_display": "李四",
  "group_nickname": "群昵称",
  "is_owner": false
}

Moments (SNS)

朋友圈(SNS)

Three separate commands for notifications vs. posts:
bash
undefined
三个独立命令分别处理通知与动态:
bash
undefined

Like/comment notifications (unread by default)

点赞/评论通知(默认显示未读)

wx sns-notifications wx sns-notifications --include-read -n 100
wx sns-notifications wx sns-notifications --include-read -n 100

Moments timeline (your feed)

朋友圈时间线(你的动态流)

wx sns-feed wx sns-feed --user "张三" -n 100 wx sns-feed --since 2026-04-01
wx sns-feed wx sns-feed --user "张三" -n 100 wx sns-feed --since 2026-04-01

Search moments content

搜索朋友圈内容

wx sns-search "关键词" wx sns-search "婚礼" --user "李四" --since 2023-01-01

**sns-notifications output:**

```json
{
  "type": "like" | "comment",
  "from_nickname": "张三",
  "content": "评论内容",
  "feed_preview": "原帖正文片段",
  "feed_author": "李四",
  "timestamp": 1715832225
}
sns-feed / sns-search output:
json
{
  "author": "张三",
  "content": "朋友圈正文",
  "media": [
    {
      "url": "...",
      "thumb": "...",
      "key": "...",
      "token": "...",
      "md5": "...",
      "enc_idx": 0,
      "size": 123456
    }
  ],
  "media_count": 1,
  "location": "北京",
  "timestamp": 1715832225
}
wx sns-search "关键词" wx sns-search "婚礼" --user "李四" --since 2023-01-01

**sns-notifications 输出:**

```json
{
  "type": "like" | "comment",
  "from_nickname": "张三",
  "content": "评论内容",
  "feed_preview": "原帖正文片段",
  "feed_author": "李四",
  "timestamp": 1715832225
}
sns-feed / sns-search 输出:
json
{
  "author": "张三",
  "content": "朋友圈正文",
  "media": [
    {
      "url": "...",
      "thumb": "...",
      "key": "...",
      "token": "...",
      "md5": "...",
      "enc_idx": 0,
      "size": 123456
    }
  ],
  "media_count": 1,
  "location": "北京",
  "timestamp": 1715832225
}

Public Account Articles

公众号文章

Official/subscription account articles are stored separately:
bash
undefined
公众号/订阅号文章单独存储:
bash
undefined

Recent articles

最近的文章

wx biz-articles wx biz-articles -n 200
wx biz-articles wx biz-articles -n 200

Filter by account name

按公众号名称过滤

wx biz-articles --account "返朴"
wx biz-articles --account "返朴"

Time range

时间范围筛选

wx biz-articles --since 2026-05-01 --until 2026-05-10
wx biz-articles --since 2026-05-01 --until 2026-05-10

Unread only (1 latest per account)

仅显示未读文章(每个公众号最新1篇)

wx biz-articles --unread
wx biz-articles --unread

Extract URLs

提取文章链接

wx biz-articles --json | jq '.[].url'

**Output fields:**

```json
{
  "account": "返朴",
  "account_username": "gh_abc123",
  "title": "文章标题",
  "url": "https://mp.weixin.qq.com/...",
  "digest": "摘要",
  "cover_url": "...",
  "time": "2026-05-16 10:00:00",
  "timestamp": 1715832000,
  "recv_time_str": "2026-05-16 10:01:23"
}
wx biz-articles --json | jq '.[].url'

**输出字段:**

```json
{
  "account": "返朴",
  "account_username": "gh_abc123",
  "title": "文章标题",
  "url": "https://mp.weixin.qq.com/...",
  "digest": "摘要",
  "cover_url": "...",
  "time": "2026-05-16 10:00:00",
  "timestamp": 1715832000,
  "recv_time_str": "2026-05-16 10:01:23"
}

Attachments (Images)

附件(图片)

Image attachments are stored as
.dat
files that require decryption:
bash
undefined
图片附件以
.dat
文件存储,需要解密:
bash
undefined

1. List image attachments in a conversation

1. 列出会话中的图片附件

wx attachments "张三" wx attachments "AI群" --kind image -n 100 wx attachments "AI群" --since 2026-04-01 --until 2026-04-15
wx attachments "张三" wx attachments "AI群" --kind image -n 100 wx attachments "AI群" --since 2026-04-01 --until 2026-04-15

2. Extract a specific attachment by ID

2. 通过ID提取特定附件

wx extract <attachment_id> -o ~/Desktop/photo.jpg wx extract <attachment_id> -o /tmp/x.jpg --overwrite

**attachments output:**

```json
{
  "attachment_id": "opaque-id-123",
  "kind": "image",
  "type": 3,
  "local_id": 456,
  "timestamp": 1715832225,
  "time": "2026-05-16 10:23:45",
  "sender": "张三"
}
extract output:
json
{
  "md5": "abc123...",
  "dat_path": "/.../msg/attach/.../abc.dat",
  "dat_size": 123456,
  "output": "~/Desktop/photo.jpg",
  "output_size": 120000,
  "format": "jpg",
  "decoder": "v2"
}
Supported decoders:
  • legacy_xor
    : Early single-byte XOR (no magic header)
  • v1_aes
    : Fixed AES-128-ECB with hardcoded key
  • v2
    : AES + XOR with platform-derived keys
wx extract <attachment_id> -o ~/Desktop/photo.jpg wx extract <attachment_id> -o /tmp/x.jpg --overwrite

**attachments 输出:**

```json
{
  "attachment_id": "opaque-id-123",
  "kind": "image",
  "type": 3,
  "local_id": 456,
  "timestamp": 1715832225,
  "time": "2026-05-16 10:23:45",
  "sender": "张三"
}
extract 输出:
json
{
  "md5": "abc123...",
  "dat_path": "/.../msg/attach/.../abc.dat",
  "dat_size": 123456,
  "output": "~/Desktop/photo.jpg",
  "output_size": 120000,
  "format": "jpg",
  "decoder": "v2"
}
支持的解码器:
  • legacy_xor
    : 早期单字节异或(无魔法头)
  • v1_aes
    : 固定AES-128-ECB算法,使用硬编码密钥
  • v2
    : AES + 基于平台派生密钥的异或算法

Favorites & Statistics

收藏与统计

bash
undefined
bash
undefined

All favorites

所有收藏内容

wx favorites wx favorites --type image # Filter by type: text/image/article/card/video wx favorites --since 2026-01-01
wx favorites wx favorites --type image # 按类型筛选:text/image/article/card/video wx favorites --since 2026-01-01

Conversation statistics

会话统计

wx stats "AI群" # Message counts by sender (top 10) wx stats "AI群" --top 20 # More senders
undefined
wx stats "AI群" # 按发送者统计消息数量(前10名) wx stats "AI群" --top 20 # 显示更多发送者
undefined

Export

导出

bash
undefined
bash
undefined

Export to text file

导出到文本文件

wx export "张三" -o chat.txt
wx export "张三" -o chat.txt

Export to JSON

导出到JSON文件

wx export "AI群" -o chat.json --format json wx export "AI群" -o chat.json --format json --since 2026-04-01
undefined
wx export "AI群" -o chat.json --format json wx export "AI群" -o chat.json --format json --since 2026-04-01
undefined

Configuration

配置

Daemon Management

守护进程管理

The daemon starts automatically on first command. Manual control:
bash
undefined
守护进程会在首次执行命令时自动启动。手动控制:
bash
undefined

Check daemon status

检查守护进程状态

wx status
wx status

Stop daemon

停止守护进程

wx stop
wx stop

Restart daemon

重启守护进程

wx stop && wx sessions # Any query command restarts it
wx stop && wx sessions # 任何查询命令都会重启守护进程

Force re-initialize (re-scan WeChat memory)

强制重新初始化(重新扫描微信内存)

wx init --force
undefined
wx init --force
undefined

Environment Variables

环境变量

wx-cli reads configuration from standard WeChat data paths. No env vars required for normal operation.
Logging:
bash
undefined
wx-cli 从标准微信数据路径读取配置。正常运行无需设置环境变量。
日志:
bash
undefined

Enable debug logging (not typically needed)

启用调试日志(通常不需要)

RUST_LOG=debug wx history "张三"
undefined
RUST_LOG=debug wx history "张三"
undefined

Common Patterns

常见使用场景

Monitor new messages in a script

脚本监控新消息

bash
#!/bin/bash
while true; do
  wx new-messages --json | jq -r '.data[] | "\(.time) \(.sender): \(.content)"'
  sleep 60
done
bash
#!/bin/bash
while true; do
  wx new-messages --json | jq -r '.data[] | "\(.time) \(.sender): \(.content)"'
  sleep 60
done

Export all conversations since date

导出指定日期后的所有会话

bash
for session in $(wx sessions --json | jq -r '.[].username'); do
  wx export "$session" -o "backup/${session}.json" --format json --since 2026-01-01
done
bash
for session in $(wx sessions --json | jq -r '.[].username'); do
  wx export "$session" -o "backup/${session}.json" --format json --since 2026-01-01
done

Search for keywords and extract context

搜索关键词并提取上下文

bash
wx search "项目" --json | jq -r '.data[] | "\(.time) [\(.sender)] \(.content)"'
bash
wx search "项目" --json | jq -r '.data[] | "\(.time) [\(.sender)] \(.content)"'

Get unread count per conversation

获取每个会话的未读消息数

bash
wx unread --json | jq '.[] | "\(.unread_count)\t\(.remark)"'
bash
wx unread --json | jq '.[] | "\(.unread_count)\t\(.remark)"'

Extract all images from a date range

提取指定日期范围内的所有图片

bash
undefined
bash
undefined

1. Get attachment IDs

1. 获取附件ID

wx attachments "旅行群" --since 2026-05-01 --json | jq -r '.data[].attachment_id' > ids.txt
wx attachments "旅行群" --since 2026-05-01 --json | jq -r '.data[].attachment_id' > ids.txt

2. Extract each

2. 逐个提取

mkdir -p images while read id; do wx extract "$id" -o "images/${id}.jpg" 2>/dev/null done < ids.txt
undefined
mkdir -p images while read id; do wx extract "$id" -o "images/${id}.jpg" 2>/dev/null done < ids.txt
undefined

Check data freshness in automation

在自动化流程中检查数据新鲜度

bash
result=$(wx history "张三" --json)
status=$(echo "$result" | jq -r '.meta.status')

if [ "$status" != "ok" ]; then
  echo "Warning: Data may be stale. Unknown shards:"
  echo "$result" | jq '.meta.unknown_shards'
  echo "Run: wx init --force"
fi
bash
result=$(wx history "张三" --json)
status=$(echo "$result" | jq -r '.meta.status')

if [ "$status" != "ok" ]; then
  echo "警告:数据可能已过期。未知分片:"
  echo "$result" | jq '.meta.unknown_shards'
  echo "请执行:wx init --force"
fi

Troubleshooting

故障排除

macOS: "Operation not permitted"

macOS:“操作不被允许”

bash
undefined
bash
undefined

Re-sign WeChat

重新签名微信

codesign --force --deep --sign - /Applications/WeChat.app
codesign --force --deep --sign - /Applications/WeChat.app

Reset TCC and reinitialize

重置TCC并重新初始化

for s in ScreenCapture Camera Microphone AppleEvents; do tccutil reset "$s" com.tencent.xinWeChat done killall WeChat && open /Applications/WeChat.app sudo wx init --force
undefined
for s in ScreenCapture Camera Microphone AppleEvents; do tccutil reset "$s" com.tencent.xinWeChat done killall WeChat && open /Applications/WeChat.app sudo wx init --force
undefined

macOS: "WeChat 想访问其他 App 的数据" popups

macOS:“微信想要访问其他App的数据”弹窗

This is a known side effect of re-signing. The popup occurs because macOS treats the re-signed WeChat as a different app accessing its old container. Click "Allow" to proceed. To avoid popups, you'd need to use official WeChat signature (which requires SSH-free local Terminal with Developer Tools TCC access).
这是重新签名后的已知副作用。macOS会将重新签名的微信视为不同的应用,访问其旧容器时会触发弹窗。点击“允许”继续。若要避免弹窗,需使用微信官方签名(这需要无SSH的本地终端并拥有开发者工具TCC权限)。

Windows: No decryption keys found

Windows:未找到解密密钥

bash
undefined
bash
undefined

Make sure WeChat is fully logged in

确保微信已完全登录

Run as Administrator

以管理员身份运行

wx init --force
undefined
wx init --force
undefined

"unknown_shards" in meta output

meta输出中出现“unknown_shards”

WeChat may have created new
message_N.db
shards since initialization:
bash
wx init --force
微信可能在初始化后创建了新的
message_N.db
分片:
bash
wx init --force

Daemon not responding

守护进程无响应

bash
wx stop
wx sessions  # Restarts daemon
bash
wx stop
wx sessions  # 重启守护进程

Empty results but WeChat has data

微信有数据但查询结果为空

bash
undefined
bash
undefined

Force refresh all caches

强制刷新所有缓存

wx init --force
wx init --force

Check daemon status

检查守护进程状态

wx status
undefined
wx status
undefined

Image extraction fails with "unsupported decoder"

图片提取失败,提示“unsupported decoder”

On Linux, V2 image keys are not yet supported. Legacy XOR and V1 AES work. On macOS/Windows, ensure WeChat is running during
wx init
.
在Linux上,暂不支持V2图片密钥。Legacy XOR和V1 AES可正常使用。在macOS/Windows上,确保执行
wx init
时微信处于运行状态。

Advanced Usage

高级用法

Custom limit for large queries

自定义大查询的限制条数

bash
undefined
bash
undefined

Default limits are conservative to avoid overwhelming output

默认限制较为保守,避免输出过载

wx history "张三" -n 10000 wx search "keyword" -n 5000 wx sns-feed -n 500
undefined
wx history "张三" -n 10000 wx search "keyword" -n 5000 wx sns-feed -n 500
undefined

Filter messages by type

按消息类型筛选

bash
undefined
bash
undefined

Links, files, merged chat records, quoted messages

链接、文件、合并聊天记录、引用消息

wx history "AI群" --type link --json
wx history "AI群" --type link --json

Images only

仅显示图片

wx history "AI群" --type image --json
undefined
wx history "AI群" --type image --json
undefined

Include metadata in all outputs

在所有输出中包含元信息

bash
undefined
bash
undefined

Human-readable warnings go to stderr

人类可读的警告信息输出到stderr

wx history "张三" 2>&1 | grep "WARNING"
wx history "张三" 2>&1 | grep "WARNING"

Machine-readable meta in JSON stdout

机器可读的元信息在stdout的JSON中

wx history "张三" --json | jq '.meta'
wx history "张三" --json | jq '.meta'

Extended meta with per-shard details

包含分片详情的扩展元信息

wx history "张三" --with-meta --json | jq '.meta.per_shard_latest'
undefined
wx history "张三" --with-meta --json | jq '.meta.per_shard_latest'
undefined

Export with custom time windows

按自定义时间窗口导出

bash
wx export "项目群" -o q1-2026.json --format json \
  --since 2026-01-01 --until 2026-03-31
bash
wx export "项目群" -o q1-2026.json --format json \
  --since 2026-01-01 --until 2026-03-31

Integration with AI Agents

与AI Agent集成

wx-cli is designed for AI agent consumption:
  1. Install via skills:
    bash
    npx skills add jackwener/wx-cli
  2. Structured output: All query commands return JSON with
    {data, meta}
    wrapper
  3. Freshness indicators:
    meta.status
    tells agents if data may be stale
  4. Incremental queries:
    new-messages
    returns only messages since last check
  5. Error handling: Non-zero exit codes + stderr for errors; JSON always valid on stdout
Example agent prompt:
"Check my WeChat for any messages from 李四 in the last week mentioning '合同'"
Agent execution:
bash
wx search "合同" --in "李四" --since $(date -d '7 days ago' +%Y-%m-%d) --json
wx-cli 专为AI Agent使用设计:
  1. 通过skills安装:
    bash
    npx skills add jackwener/wx-cli
  2. 结构化输出: 所有查询命令返回带有
    {data, meta}
    包装层的JSON
  3. 新鲜度标识:
    meta.status
    告知Agent数据是否可能过期
  4. 增量查询:
    new-messages
    仅返回自上次检查后的新消息
  5. 错误处理: 非零退出码 + stderr输出错误信息;stdout始终返回有效JSON
示例Agent提示:
"检查我的微信中,过去一周内李四发送的提及‘合同’的消息"
Agent执行命令:
bash
wx search "合同" --in "李四" --since $(date -d '7 days ago' +%Y-%m-%d) --json

Documentation

文档

License

许可证

Apache-2.0
Apache-2.0