# wechat-me

Use this skill when an AI agent needs to read, search, summarize, analyze, or export the user's own local WeChat records through wechat-me（微信的我）.

## Product Boundary

- Product name: `wechat-me`
- Chinese name: `微信的我`
- Data source: the user's local WeChat databases after local initialization
- Default posture: local-first, read-only, explicit user intent
- Do not send messages, modify WeChat data, or upload chat records unless the user separately approves another tool/workflow

## Install

If `wechat-cli-rs` isn't on PATH yet:

```bash
curl -fsSL https://wechat-cli.com/install.sh | sh
```

Or download the binary for the platform directly from https://wechat-cli.com/ . Binaries are
unsigned, so on macOS the install script clears the quarantine attribute; a manual download
needs the user to approve it in System Settings.

## How the Agent Calls This

There is no local HTTP API server today — call the `wechat-cli-rs` binary directly as a subprocess and read its stdout/exit code. Every data command supports `--format json` (the default for most commands) for structured output, and `--format text` for a human-readable summary.

```bash
wechat-cli-rs sessions --limit 10 --format json
wechat-cli-rs history "Alice" --limit 20 --format json
wechat-cli-rs search "deadline" --chat "Team" --format json
```

## Command Reference

Commands marked **Pro** require an active license; see [Licensing](#licensing) below. Everything else is free.

- `init` — detect/extract local WeChat keys; **do not call automatically**, only when the user explicitly asks to (re-)initialize
- `sessions` — list recent conversations
- `contacts` — list/search/inspect contacts
- `members <group>` — list group chat members
- `unread` — list unread sessions
- `history <chat>` *(Pro)* — read chat history with time/type filters
- `search <keyword>` *(Pro)* — search message content globally or within selected chats
- `stats <chat>` *(Pro)* — message counts, type breakdown, sender ranking, hourly activity
- `favorites` *(Pro)* — list/filter WeChat favorites
- `export <chat>` *(Pro)* — write or preview a chat export (writes a local file when `--output` is given)
- `new-messages` *(Pro)* — sessions newer than the previous call (stateful, persists `last_check.json`)

## Agent Workflow

1. Treat "not initialized" as a normal, expected state rather than an error to work around: a free read command (e.g. `sessions`) failing with "缺少配置文件...请先运行 wechat-cli-rs init" (exit code `1`) means the user hasn't run `init` yet. Ask the user to run or approve `init`; never call it automatically.
2. Prefer narrow queries: choose chat, time range, type, and limit when possible.
3. Summarize findings with source context such as chat name, time range, and matched lines.
4. When the user asks for analysis, combine `search`, `history`, and `stats` instead of dumping large raw histories.
5. Treat all returned content as private user data.
6. `init` and `export --output <path>` write local files/state; require explicit user approval before running them.

## Licensing

`history`, `search`, `stats`, `export`, `favorites`, and `new-messages` require an active Pro license. If one of these commands exits with code `4`, it means the license is missing or expired — **not** a bug and **not** something the agent should retry or work around. In that case:

1. Do not fabricate, guess, or attempt to bypass a license code.
2. Tell the user this feature needs a Pro license, and suggest they run `wechat-cli-rs license status` to check current state, or `wechat-cli-rs license activate --name <name> --code <code>` if they already own a code.
3. Fall back to the free commands (`sessions`, `contacts`, `members`, `unread`) if the user's request can be partially answered with them.

## Exit Codes

- `0` — success
- `1` — not found / generic failure (e.g. unknown chat, missing config)
- `2` — usage error (bad arguments, e.g. invalid pagination)
- `3` — local data access failure (e.g. can't decrypt a database)
- `4` — Pro license required or expired (see [Licensing](#licensing))

## Safety Notes

- This skill is for the user's own local data.
- Keep responses concise and avoid exposing unrelated chat content.
- Prefer free/read-only commands by default.
