Bridge Claude Code / Codex to IM platforms — chat with AI coding agents from Telegram, Discord, or Feishu/Lark.
npx skills add https://github.com/op7418/claude-to-im-skill --skill claude-to-imInstale esta skill com a CLI e comece a usar o fluxo de trabalho SKILL.md em seu espaço de trabalho.
Bridge Claude Code / Codex to IM platforms — chat with AI coding agents from Telegram, Discord, Feishu/Lark, QQ, or WeChat.
Want a desktop GUI instead? Check out CodePilot — a full-featured desktop app with visual chat interface, session management, file tree preview, permission controls, and more. This skill was extracted from CodePilot's IM bridge module for users who prefer a lightweight, CLI-only setup.
This skill runs a background daemon that connects your IM bots to Claude Code or Codex sessions. Messages from IM are forwarded to the AI coding agent, and responses (including tool use, permission requests, streaming previews) are sent back to your chat.
You (Telegram/Discord/Feishu/QQ/WeChat)
↕ Bot API
Background Daemon (Node.js)
↕ Claude Agent SDK or Codex SDK (configurable via CTI_RUNTIME)
Claude Code / Codex → reads/writes your codebase
/perm commands / quick 1/2/3 replies (Feishu/QQ/WeChat)chmod 600, auto-redacted in all logs/claude-to-im setup, or tell Codex claude-to-im setupCTI_RUNTIME=claude or auto) — installed and authenticated (claude command available)CTI_RUNTIME=codex or auto) — npm install -g @openai/codex. Auth: run codex auth login, or set OPENAI_API_KEY (optional, for API mode)Choose the section that matches the AI agent product you actually use.
npx skillsnpx skills add op7418/Claude-to-IM-skill
After installation, tell Claude Code:
/claude-to-im setup
If you want WeChat specifically, you can also say:
帮我接微信
git clone https://github.com/op7418/Claude-to-IM-skill.git ~/.claude/skills/claude-to-im
Claude Code discovers it automatically.
git clone https://github.com/op7418/Claude-to-IM-skill.git ~/code/Claude-to-IM-skill
mkdir -p ~/.claude/skills
ln -s ~/code/Claude-to-IM-skill ~/.claude/skills/claude-to-im
git clone https://github.com/op7418/Claude-to-IM-skill.git ~/code/Claude-to-IM-skill
bash ~/code/Claude-to-IM-skill/scripts/install-codex.sh
For local development with a live checkout:
bash ~/code/Claude-to-IM-skill/scripts/install-codex.sh --link
The install script places the skill under ~/.codex/skills/claude-to-im, installs dependencies, and builds the daemon.
After installation, tell Codex:
claude-to-im setup
If you want WeChat specifically, you can also say:
帮我接微信桥接
git clone https://github.com/op7418/Claude-to-IM-skill.git ~/.codex/skills/claude-to-im
cd ~/.codex/skills/claude-to-im
npm install
npm run build
Claude Code: Start a new session and type / — you should see claude-to-im in the skill list. Or ask Claude: "What skills are available?"
Codex: Start a new session and say claude-to-im setup, start bridge, or 帮我接微信桥接.
Choose the update flow that matches both your AI agent product and your installation method.
If you installed with npx skills, re-run:
npx skills add op7418/Claude-to-IM-skill
If you installed via git clone or symlink:
cd ~/.claude/skills/claude-to-im
git pull
npm install
npm run build
Then tell Claude Code:
/claude-to-im doctor
/claude-to-im start
If you installed with the Codex install script in copy mode:
rm -rf ~/.codex/skills/claude-to-im
bash ~/code/Claude-to-IM-skill/scripts/install-codex.sh
If you installed with --link or cloned directly into the Codex skills directory:
cd ~/.codex/skills/claude-to-im
git pull
npm install
npm run build
Then tell Codex:
claude-to-im doctor
start bridge
Claude Code
/claude-to-im setup
Codex
claude-to-im setup
The wizard will guide you through:
Claude Code
/claude-to-im start
Codex
start bridge
The daemon starts in the background. You can close the terminal — it keeps running.
Open your IM app and send a message to your bot. Claude Code / Codex will respond through the bridge.
When Claude needs to use a tool (edit a file, run a command), you'll see a permission prompt with Allow / Deny buttons right in the chat (Telegram/Discord), or a text /perm command prompt / quick 1/2/3 replies (Feishu/QQ/WeChat).
All commands are run inside Claude Code or Codex:
| Claude Code | Codex (natural language) | Description |
|---|---|---|
/claude-to-im setup |
"claude-to-im setup" / "配置" | Interactive setup wizard |
/claude-to-im start |
"start bridge" / "启动桥接" | Start the bridge daemon |
/claude-to-im stop |
"stop bridge" / "停止桥接" | Stop the bridge daemon |
/claude-to-im status |
"bridge status" / "状态" | Show daemon status |
/claude-to-im logs |
"查看日志" | Show last 50 log lines |
/claude-to-im logs 200 |
"logs 200" | Show last 200 log lines |
/claude-to-im reconfigure |
"reconfigure" / "修改配置" | Update config interactively |
/claude-to-im doctor |
"doctor" / "诊断" | Diagnose issues |
The setup wizard provides inline guidance for every step. Here's a summary:
@BotFather on Telegram → /newbot → follow prompts123456789:AABbCc...)/setprivacy → Disable (for group use)@userinfobotbot → permissions: Send Messages, Read Message History, View Channels → copy invite URLsetup wizard provides the exact JSON)im.message.receive_v1 eventQQ currently supports C2C private chat only. No group/channel support, no inline permission buttons, no streaming preview. Permissions use text
/perm ...commands. Image inbound only (no image replies).
CTI_QQ_ALLOWED_USERS takes user_openid values (not QQ numbers) — can be left empty initiallyCTI_QQ_IMAGE_ENABLED=false if the underlying provider doesn't support image inputWeChat currently uses QR login, single-account mode, text-based permissions, and no streaming preview.
cd ~/.claude/skills/claude-to-im && npm run weixin:logincd ~/.codex/skills/claude-to-im && npm run weixin:login~/.claude-to-im/runtime/weixin-login.html and tries to open it in your browser automatically~/.claude-to-im/data/weixin-accounts.jsonAdditional notes:
CTI_WEIXIN_MEDIA_ENABLED controls inbound image/file/video downloads onlyvoice_item.text, the bridge replies with an error instead of downloading/transcribing raw voice audio/perm ... commands or quick 1/2/3 replies~/.claude-to-im/
├── config.env ← Credentials & settings (chmod 600)
├── data/ ← Persistent JSON storage
│ ├── sessions.json
│ ├── bindings.json
│ ├── permissions.json
│ └── messages/ ← Per-session message history
├── logs/
│ └── bridge.log ← Auto-rotated, secrets redacted
└── runtime/
├── bridge.pid ← Daemon PID file
└── status.json ← Current status
| Component | Role |
|---|---|
src/main.ts |
Daemon entry — assembles DI, starts bridge |
src/config.ts |
Load/save config.env, map to bridge settings |
src/store.ts |
JSON file BridgeStore (30 methods, write-through cache) |
src/llm-provider.ts |
Claude Agent SDK query() → SSE stream |
src/codex-provider.ts |
Codex SDK runStreamed() → SSE stream |
src/sse-utils.ts |
Shared SSE formatting helper |
src/permission-gateway.ts |
Async bridge: SDK canUseTool ↔ IM buttons |
src/logger.ts |
Secret-redacted file logging with rotation |
scripts/daemon.sh |
Process management (start/stop/status/logs) |
scripts/doctor.sh |
Health checks |
SKILL.md |
Claude Code skill definition |
1. Claude wants to use a tool (e.g., Edit file)
2. SDK calls canUseTool() → LLMProvider emits permission_request SSE
3. Bridge sends inline buttons to IM chat: [Allow] [Deny]
4. canUseTool() blocks, waiting for user response (5 min timeout)
5. User taps Allow → bridge resolves the pending permission
6. SDK continues tool execution → result streamed back to IM
Run diagnostics:
/claude-to-im doctor
This checks: Node.js version, config file existence and permissions, token validity (live API calls), log directory, PID file consistency, and recent errors.
| Issue | Solution |
|---|---|
Bridge won't start |
Run doctor. Check if Node >= 20. Check logs. |
Messages not received |
Verify token with doctor. Check allowed users config. |
Permission timeout |
User didn't respond within 5 min. Tool call auto-denied. |
Stale PID file |
Run stop then start. daemon.sh auto-cleans stale PIDs. |
See references/troubleshooting.md for more details.
~/.claude-to-im/config.env with chmod 600npm install # Install dependencies
npm run dev # Run in dev mode
npm run typecheck # Type check
npm test # Run tests
npm run build # Build bundle