Wechat logo

Wechat

Community
chengmarc
wechat

在本地查询、导出微信 4.1+ 聊天记录为 AI 可读文本 —— 支持双人会话、群聊、以及按消息量排名的重要联系人排名。当用户想导出、搜索或分析自己的微信聊天记录,或为其他 skill(前任.skill / 同事.skill 等)准备聊天记录原材料时使用。

Overview

Publisherchengmarc
Repositorywechat-to-ai
Skill namewechat
Stars
40
Forks
6
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by chengmarc on GitHub. Read the source before you install it.

Installation

Install the Wechat AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/chengmarc/wechat-to-ai/tree/main/skills/wechat
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/chengmarc/wechat-to-ai.git /tmp/wechat-to-ai
mkdir -p .claude/skills
cp -r /tmp/wechat-to-ai/skills/wechat .claude/skills/wechat
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Wechat in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Wechat on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Wechat is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

微信聊天记录导出

把微信 4.1+ 的聊天记录构建为本地可读数据库,再导出为 AI 可读文本。全程本机运行,数据不离机。 所有功能都是插件自带二进制 dist\core.exe 的子命令;完整参数用 <命令> --help 查看。

所有命令都是 PowerShell。 若第一条命令被权限提示拦住,不要改用 Bash 重写(& 与 $env: 在 Bash 下不成立),而是告诉用户:「这个插件的命令要用 PowerShell 跑,请在权限提示里选『允许』 (有『始终允许』就选它)。」获准后从第 1 步重新开始。

1. 前置检查(每次会话第一步)

powershell
& "$env:CLAUDE_PLUGIN_ROOT\dist\core.exe" preflight

看末尾的 NEXT_STEP=:

NEXT_STEP做什么
ready / setup进入第 2 步
reinstall插件文件缺失(多半被杀毒软件删了):请用户放行后重新安装插件

2. 准备数据(每个导出请求前必跑)

每个导出请求开始前都先跑一次 setup,即使 NEXT_STEP=ready:数据库是快照, 不重建就没有新消息。同一请求里连续导出多个对象,开头跑一次即可。

setup 从已登录的微信进程里现场恢复账号方案并重建数据库;方案只在内存里、不落盘,所以需要微信在运行且已登录 (无需管理员权限)。先告诉用户:

我先刷新一下数据:从你已登录的微信里重建可读数据库。保持微信登录即可,无需操作,稍等片刻。

然后后台运行(run_in_background),等完成通知:

powershell
& "$env:CLAUDE_PLUGIN_ROOT\dist\core.exe" setup
最后一行 SETUP_RESULT=处理
done重跑 preflight,确认 NEXT_STEP=ready 后进入第 3 步
not_running请用户打开电脑版微信并登录,完成后重跑 setup
no_key微信多半没登录:请用户确认已登录后重跑 setup
no_db_dir找不到微信数据目录:请用户在 微信设置 → 文件管理 找到 ...\xwechat_files\<wxid>\db_storage,设为环境变量 WECHAT_DB_DIR 后重跑
build_failed转述输出里「导出所需的库构建失败」那一行,请用户保持微信登录后重跑 setup
error插件不完整:请用户重新安装插件

没拿到 done 时不要用旧数据导出,除非用户明确同意。杀毒软件(如 Windows Defender)可能报警,需要用户手动放行。

3. 按意图导出

用户想要…流程
与某个人的双人聊天A
某个群的聊天B(要做成发回微信群的中文总结,导出后接 wechat-summary skill)
和谁聊得最多 / 联系人排名C
只给了一个名字,没说是人还是群 / 只想看有哪些匹配先 find(见下)

时间参数(A、B):不加时间参数 = 最近 1 天(昨天 0 点至今)。起点三选一:--days N | --since YYYY-MM-DD | --all(全部历史,用户要「全部」「完整」「所有」聊天记录时用);--until YYYY-MM-DD(包含当天)可与任一组合。 时区默认 GMT+8,用 --tz 调整。--threshold 秒数:间隔超过它就另起一个时间段标题(默认 3600)。

两种导出的发送者都直接取自微信的记录:用户自己为 【用户】,系统消息(撤回、拍一拍等)为 【系统】; 双人会话的对方为 【对方】,群成员显示昵称,无法识别的为 【?】。

A. 双人会话 / B. 群聊

<关键词> 取用户对此人 / 此群的称呼(匹配备注名或微信昵称的任一部分):

powershell
& "$env:CLAUDE_PLUGIN_ROOT\dist\core.exe" export_private <关键词> [时间参数]    # A
& "$env:CLAUDE_PLUGIN_ROOT\dist\core.exe" export_chatroom <关键词> [时间参数]   # B

导出命令自己把聊天内容写进文件,屏幕上只有进度和结果行。按最后一行 EXPORT_RESULT= 处理:

EXPORT_RESULT=处理
done完成:把 OUTPUT= 的文件路径告诉用户
ambiguous输出列出了全部匹配 [序号]:把名称、昵称 / 备注和消息分布列给用户选,再在同一条命令末尾加 --pick <序号> 重跑
not_found告诉用户没找到,请换一个关键词(备注名或昵称的一部分)
empty告诉用户该会话在该时间段内没有消息
先 find
powershell
& "$env:CLAUDE_PLUGIN_ROOT\dist\core.exe" find <关键词>

同时搜联系人和群聊,分两段列出匹配及消息分布,段内 [序号] 即对应导出命令的 --pick。按末尾两行处理:

PRIVATE_MATCHES= / CHATROOM_MATCHES=处理
都是 0同 not_found
只有一个非 0用该段标题里的导出命令(A 或 B)按上面流程导出
都非 0把两段的名称列给用户选,再用所选段的导出命令加 --pick <序号> 导出

C. 联系人排名

powershell
& "$env:CLAUDE_PLUGIN_ROOT\dist\core.exe" export_contacts

--threshold N(最低消息数,默认 50)| --include-chatrooms(同时列出群聊)。 结果行同上:done → 告诉用户 OUTPUT= 的路径;empty → 没有达到阈值的联系人。

硬性规则

  • 导出命令不要加重定向(>、2>、2>&1),也不要传 --out:文件路径由命令自己决定并打印在 OUTPUT=。
  • 导出文件不要读进上下文,除非下一步(如 wechat-summary)需要它的内容。
  • 准备 / 刷新数据一律用后台 setup。

Frequently asked questions

What does the Wechat AI skill do?

在本地查询、导出微信 4.1+ 聊天记录为 AI 可读文本 —— 支持双人会话、群聊、以及按消息量排名的重要联系人排名。当用户想导出、搜索或分析自己的微信聊天记录,或为其他 skill(前任.skill / 同事.skill 等)准备聊天记录原材料时使用。

Why use Wechat on TypingMind?

Because you install it once and use it with any model. Wechat is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Wechat in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/chengmarc/wechat-to-ai/tree/main/skills/wechat. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Wechat?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Wechat?

As many as you like. As long as a model supports skills, you can use Wechat with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Wechat AI skill free?

It is published on GitHub by chengmarc. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇