by op7418
Bridge Claude Code / Codex to IM platforms — chat with AI coding agents from Telegram, Discord, or Feishu/Lark.
# Add to your Claude Code skills
git clone https://github.com/op7418/Claude-to-IM-skillname: claude-to-im description: | This skill bridges Claude Code to IM platforms (Telegram, Discord, Feishu/Lark). It should be used when the user wants to start a background daemon that forwards IM messages to Claude Code sessions, or manage that daemon's lifecycle. Trigger on: "claude-to-im", "start bridge", "stop bridge", "bridge status", "查看日志", "启动桥接", "停止桥接", or any mention of IM bridge management. Subcommands: setup, start, stop, status, logs, reconfigure, doctor. argument-hint: "setup | start | stop | status | logs [N] | reconfigure | doctor" allowed-tools:
You are managing the Claude-to-IM bridge.
User data is stored at ~/.claude-to-im/.
First, locate the skill directory by finding this SKILL.md file:
**/skills/**/claude-to-im/SKILL.md to find its path, then derive the skill root directory from it.Parse the user's intent from $ARGUMENTS into one of these subcommands:
| User says (examples) | Subcommand |
|---|---|
| setup, configure, 配置 | setup |
| start, start bridge, 启动, 启动桥接 | start |
| stop, stop bridge, 停止, 停止桥接 | stop |
| status, bridge status, 状态 | status |
| logs, logs 200, 查看日志, 查看日志 200 | logs |
| reconfigure, 修改配置 | reconfigure |
| doctor, diagnose, 诊断 | doctor |
Extract optional numeric argument for logs (default 50).
IMPORTANT: Before asking users for any platform credentials, first read SKILL_DIR/references/setup-guides.md to get the detailed step-by-step guidance for that platform. Present the relevant guide text to the user via AskUserQuestion so they know exactly what to do.
Bridge Claude Code / Codex to IM platforms — chat with AI coding agents from Telegram, Discord, or Feishu/Lark.
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)
↕ Bot API
Background Daemon (Node.js)
↕ Claude Agent SDK or Codex SDK (configurable via CTI_RUNTIME)
Claude Code / Codex → reads/writes your codebase
chmod 600, auto-redacted in all logs/claude-to-im setup, that's itNo comments yet. Be the first to share your thoughts!
setupRun an interactive setup wizard. Collect input one field at a time using AskUserQuestion. After each answer, confirm the value back to the user (masking secrets to last 4 chars only) before moving to the next question.
Step 1 — Choose channels
Ask which channels to enable (telegram, discord, feishu). Accept comma-separated input. Briefly describe each:
Step 2 — Collect tokens per channel
For each enabled channel, read SKILL_DIR/references/setup-guides.md and present the relevant platform guide to the user. Collect one credential at a time:
Step 3 — General settings
Ask for runtime, default working directory, model, and mode:
claude (default), codex, auto
claude — uses Claude Code CLI + Claude Agent SDK (requires claude CLI installed)codex — uses OpenAI Codex SDK (requires codex CLI; auth via codex auth login or OPENAI_API_KEY)auto — tries Claude first, falls back to Codex if Claude CLI not found$CWDclaude or auto: claude-sonnet-4-20250514 (default), claude-opus-4-6, claude-haiku-4-5-20251001. When runtime is codex: user can specify any model supported by their Codex setup.code (default), plan, askNote on AskUserQuestion: If AskUserQuestion is not available (e.g., in Codex), fall back to explaining the setup steps and ask the user to create ~/.claude-to-im/config.env manually based on the example at SKILL_DIR/config.env.example.
Step 4 — Write config and validate
mkdir -p ~/.claude-to-im/{data,logs,runtime,data/messages}~/.claude-to-im/config.env with all settings in KEY=VALUE formatchmod 600 ~/.claude-to-im/config.envcurl -s "https://api.telegram.org/bot${TOKEN}/getMe" — check for "ok":truecurl -s -X POST "${DOMAIN}/open-apis/auth/v3/tenant_access_token/internal" -H "Content-Type: application/json" -d '{"app_id":"...","app_secret":"..."}' — check for "code":0[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+startRun: bash "SKILL_DIR/scripts/daemon.sh" start
Show the output to the user. If it fails, tell the user:
doctor to diagnose: /claude-to-im doctor/claude-to-im logsstopRun: bash "SKILL_DIR/scripts/daemon.sh" stop
statusRun: bash "SKILL_DIR/scripts/daemon.sh" status
logsExtract optional line count N from arguments (default 50).
Run: bash "SKILL_DIR/scripts/daemon.sh" logs N
reconfigure~/.claude-to-im/config.envSKILL_DIR/references/setup-guides.md and present the relevant guide for that field/claude-to-im stop then /claude-to-im start to apply the changes."doctorRun: bash "SKILL_DIR/scripts/doctor.sh"
Show results and suggest fixes for any failures. Common fixes:
cd SKILL_DIR && npm installcd SKILL_DIR && npm run buildsetup~/.claude-to-im/config.env — survives across sessionsCTI_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)npx skills add op7418/Claude-to-IM-skill
git clone https://github.com/op7418/Claude-to-IM-skill.git ~/.claude/skills/claude-to-im
Clones the repo directly into your personal skills directory. Claude Code discovers it automatically.
If you prefer to keep the repo elsewhere (e.g., for development):
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
If you use Codex, clone directly into the Codex skills directory:
git clone https://github.com/op7418/Claude-to-IM-skill.git ~/.codex/skills/claude-to-im
Or use the provided install script for automatic dependency installation and build:
# Clone and install (copy mode)
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
# Or use symlink mode for development
bash ~/code/Claude-...