Weixin Claude Bot banner
crazynomad crazynomad

Weixin Claude Bot

AI community

Description

通过微信消息远程操控 Claude Code —— 基于腾讯 iLink 协议的微信 AI Bot

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

weixin-claude-bot

通过微信消息远程操控 Claude Code —— 基于腾讯 iLink 协议的微信 AI Bot。

微信用户 ──► iLink 协议 ──► weixin-claude-bot ──► Claude Agent SDK ──► 本地文件系统
   ◄────────────────────────────────────────────────────────────────────────┘

在地铁上用微信让 Claude 帮你改代码、查日志、跑测试。

**这是一个实验教学项目**,配套视频讲解和完整教学文档。

**视频讲解**:[YouTube](https://youtu.be/-xCZ9KtaC04) | [B站](https://www.bilibili.com/video/BV18rXbBaEK7/)

**教学文档**:[docs/00-overview.md](docs/00-overview.md)(iLink 协议解析、架构设计、Claude Agent SDK 深度科普、踩坑记录等)

前置条件

依赖 最低版本 说明
Node.js 18+ 运行环境
Claude Code 已安装并登录 SDK 通过子进程调用 Claude Code CLI
Anthropic API Key Claude Code 登录时已配置
微信 手机端 扫码登录用

安装 Node.js

# macOS (Homebrew)
brew install node

# 或使用 nvm
nvm install 18

安装 Claude Code

npm install -g @anthropic-ai/claude-agent-sdk
claude  # 首次运行会引导登录 Anthropic 账号

安装

git clone https://github.com/crazynomad/weixin-claude-bot.git
cd weixin-claude-bot
npm install

依赖说明

**运行时依赖:**

包名 用途
@anthropic-ai/claude-agent-sdk Claude Agent SDK,通过子进程调用 Claude Code 的 agentic 能力
`weixin-ilink` 轻量 iLink 协议 SDK — QR 登录、消息收发、媒体上传,零运行时依赖
qrcode-terminal 在终端显示微信登录二维码

**开发依赖:**

包名 用途
typescript TypeScript 编译器
tsx TypeScript 即时执行(免编译运行 .ts)
@types/node Node.js 类型声明

快速开始

1. 扫码登录微信

npm run login

终端会显示二维码,用微信扫码并确认。登录凭证保存在 `~/.weixin-claude-bot/credentials.json`。

2. 配置(可选)

# 查看当前配置
npm run config

# 切换模型(完整 ID)
npm run config -- --model claude-sonnet-4-6       # 默认,速度与质量平衡
npm run config -- --model claude-opus-4-6          # 最强,适合复杂编程任务
npm run config -- --model claude-haiku-4-5-20251001  # 最快,适合简单对话

# 也可以用模型别名
npm run config -- --model sonnet                   # 等同 claude-sonnet-4-6
npm run config -- --model opus                     # 等同 claude-opus