Wechat Channel Agents banner
legendtkl legendtkl

Wechat Channel Agents

Development community

Description

wechat channel for agents, such as claude code, codex

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

WeChat Channel Agents

微信 bot 桥接服务,支持一个或多个微信 bot 账号,并在每个 bot 中同时接入 **Claude Code** 和 **Codex** 两个 AI agent,用户可通过命令实时切换。

Demo screenshot

功能特性

  • 双 Agent 支持 — 同一个微信 bot 同时接入 Claude Code(Anthropic)和 Codex(OpenAI)
  • 多账号支持 — 支持多个微信 bot 账号同时在线,消息从接入账号原路回复
  • 实时切换 — 发送 /claude/codex 即可切换 agent,切换时保留另一端的会话状态
  • 会话持久化 — 每个「bot 账号 + 微信用户」独立维护双 agent session,重启后可恢复
  • 安全防护 — 内置危险命令拦截(rm -rf、sudo 等),支持用户白名单
  • 媒体支持 — 支持图片、文件、视频的上传下载(CDN 加解密)
  • 长文分片 — 自动将超长回复按 4000 字符分片发送

快速开始

前置条件

  • Node.js >= 22
  • 微信账号(需 >= 8.0.50 版本,支持 iLink Bot)
  • Claude Code 服务端(ANTHROPIC_BASE_URL)
  • Codex 配置(~/.codex/config.toml)

安装

git clone https://github.com/legendtkl/wechat-channel-agents.git
cd wechat-channel-agents
npm install

配置

  1. 复制配置模板:
cp config.example.json config.json
cp .env.example .env
  1. 编辑 .env,填入 Claude Code 凭证:
ANTHROPIC_BASE_URL=http://your-server:13654/
ANTHROPIC_AUTH_TOKEN=sk-xxx
  1. 按需修改 config.json
{
  "defaultAgent": "claude",
  "wechat": {
    "baseUrl": "https://ilinkai.weixin.qq.com",
    "botType": "3"
  },
  "codex": {
    "sandboxMode": "danger-full-access",
    "workingDirectory": "/path/to/your/project"
  },
  "stateDir": "~/.wechat-agents",
  "allowedUsers": [],
  "adminUsers": ["your_wechat_user_id"],
  "logLevel": "INFO"
}

启动

npm run dev

终端会显示二维码,用微信扫码登录。登录成功后即可在微信中与 bot 对话。

如需在运行中新增更多 bot 账号,可使用管理员命令 `/login`,终端会再次显示二维码并将新账号接入当前服务。

使用方式

命令 说明
/claude 切换到 Claude Code
/codex 切换到 Codex
/reset 重置当前 agent 会话
/status 查看当前 agent 类型和会话信息
/help 显示所有可用命令
/cwd 修改工作目录
/login 管理员新增一个 bot 账号,终端扫码后接入
/logout 管理员登出所有 bot 账号,清除本地凭证并停止服务
普通文本 发送给当前 agent 处理

默认使用 Claude Code。切换 agent 时,另一端的会话不会丢失,可随时切回继续。 多账号模式下,每个「bot 账号 + 微信用户」拥有独立的 agent 会话和 `contextToken`,不会在不同 bot 账号之间串上下文。