通过微信机器人接管 Codex,实现随时随地编码
codex-go 是一款基于 Codex 的远程编码工具。通过微信机器人接管 Codex 会话,你可以在手机上批准权限请求、查看 AI 回复、启动/切换会话,真正做到随时随地编码。内置 Skills 自动注入和微信通知通道,Codex 可以主动向你的微信推送消息。
前往 Releases 下载对应平台的文件:
| 平台 | 文件 |
|---|---|
| Windows | codex-go-windows-amd64.exe |
| macOS (Intel) | codex-go-darwin-amd64 |
| macOS (Apple Silicon) | codex-go-darwin-arm64 |
| Linux | codex-go-linux-amd64 |
下载后直接运行即可,首次启动会自动创建默认配置。
- 微信远程控制 — 通过微信消息启动/停止/切换 Codex 会话
- 权限审批 — 实时处理 Codex 的工具使用权限请求(批准/拒绝/回答提问)
- Web 管理面板 — 仪表盘、会话列表、实时聊天、日志查看、系统设置
- 会话管理 — 新建/恢复/删除会话,查看对话历史和消息数量
- Codex 输出推送 — 将 AI 回答、工具调用实时推送到微信
- WebSocket 实时推送 — 浏览器实时接收会话状态和权限事件
- Skills 系统 — 管理和注入 Skills 到项目会话,支持从 Codex 导入
- Bot API — 本地 HTTP API,供外部应用通过 codex-go 发送微信消息
- 权限模式 — 支持 5 种权限模式:逐一询问、接受编辑、自动批准、跳过权限检查、只读模式
- Go 1.22+
- Node.js 20+
- 已安装并登录 Codex
- 拥有 iLink Bot API 访问权限的微信账号
# 安装前端依赖
cd web && npm install
# 构建前端
npm run build
# 构建 Go 二进制文件
cd .. && go build -o codex-go ./cmd/codex-go/# 首次运行(会自动在 ~/.codex-go/config.json 创建默认配置)
./codex-go
# 服务将在 http://localhost:18080 启动
# 打开浏览器扫描微信二维码并配置 Codex CLI 路径配置文件路径:~/.codex-go/config.json
| 字段 | 类型 | 说明 |
|---|---|---|
web_port |
int | Web 服务端口(默认:18080) |
permission_mode |
string | Codex 权限模式(default/acceptEdits/auto/bypassPermissions/plan) |
codex_cli_path |
string | Codex CLI 可执行文件路径 |
auto_find_codex |
bool | 启动时自动检测 Codex CLI |
codex_env_vars |
string | Codex 的额外环境变量(dotenv 格式) |
push_types |
string[] | 推送通知类型:permission, codex_response, tool_use, session_status |
| 指令 | 说明 |
|---|---|
/help |
查看可用指令 |
/sessions |
列出最近会话 |
/switch <id> |
切换会话 |
/status |
查看当前会话状态 |
/stop |
停止当前会话 |
/y [数量/all] |
批准权限请求 |
/n [数量/all] |
拒绝权限请求 |
/r <回答> |
回答 AskUserQuestion 提问 |
codex-go 支持在会话启动时自动注入 Skills 到项目的 .codex/skills/ 目录。内置 wechat-notify Skill,可通过 Web 设置页面启用/禁用 Skills,或从 Codex 的 ~/.codex/skills/ 导入。
Skills 注入时机在 Codex 启动之前,确保会话能正确识别项目级 Skills。
codex-go 提供本地 HTTP API,供外部应用通过 codex-go 发送微信消息:
| 端点 | 说明 |
|---|---|
POST /api/v1/wechat-bot/send/text |
发送文本消息 |
POST /api/v1/wechat-bot/send/image |
发送图片 |
POST /api/v1/wechat-bot/send/file |
发送文件 |
POST /api/v1/wechat-bot/send/video |
发送视频 |
端口号从 ~/.codex-go/config.json 的 web_port 字段读取。
┌─────────────┐ HTTP/WS ┌──────────────┐ stdin/stdout ┌────────────┐
│ 微信客户端 │ ◄──────────────► │ codex-go │ ◄────────────────► │ Codex │
│ (手机) │ │ (Web + Bot) │ stream-json │ (CLI进程) │
└─────────────┘ └──────┬───────┘ └────────────┘
│
▼
┌──────────────┐
│ Web 管理界面 │
│ (React + SPA) │
└──────────────┘
- 后端: Go, Gin, WebSocket
- 前端: React 19, TypeScript, Vite, Tailwind CSS 4
- 协议: Codex JSON-RPC / stream-json(标准输入/输出)
- 微信接入: iLink Bot API(
ilinkai.weixin.qq.com) - 数据存储: BoltDB(嵌入式键值数据库)
本项目采用 MIT License 开源协议。








