[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-10725":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":9,"pushedAt":9,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":15,"starSnapshotCount":15,"syncStatus":37,"lastSyncTime":38,"discoverSource":39},10725,"Claude-to-IM-skill","op7418\u002FClaude-to-IM-skill","op7418","Bridge Claude Code \u002F Codex to IM platforms — chat with AI coding agents from Telegram, Discord, or Feishu\u002FLark.",null,"TypeScript",2702,306,11,59,0,7,36,221,34,101.46,"MIT License",false,"main",true,[26,27,28,29,30,31,32,33],"chatbot","claude","claude-code","discord","feishu","lark","skill","telegram","2026-06-12 04:00:52","# Claude-to-IM Skill\n\nBridge Claude Code \u002F Codex to IM platforms — chat with AI coding agents from Telegram, Discord, Feishu\u002FLark, QQ, or WeChat.\n\n[中文文档](README_CN.md)\n\n> **Want a desktop GUI instead?** Check out [CodePilot](https:\u002F\u002Fgithub.com\u002Fop7418\u002FCodePilot) — 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.\n\n---\n\n## How It Works\n\nThis 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.\n\n```\nYou (Telegram\u002FDiscord\u002FFeishu\u002FQQ\u002FWeChat)\n  ↕ Bot API\nBackground Daemon (Node.js)\n  ↕ Claude Agent SDK or Codex SDK (configurable via CTI_RUNTIME)\nClaude Code \u002F Codex → reads\u002Fwrites your codebase\n```\n\n## Features\n\n- **Five IM platforms** — Telegram, Discord, Feishu\u002FLark, QQ, WeChat — enable any combination\n- **Interactive setup** — guided wizard collects tokens with step-by-step instructions\n- **Permission control** — tool calls require explicit approval via inline buttons (Telegram\u002FDiscord) or text `\u002Fperm` commands \u002F quick `1\u002F2\u002F3` replies (Feishu\u002FQQ\u002FWeChat)\n- **Streaming preview** — see Claude's response as it types (Telegram & Discord)\n- **Session persistence** — conversations survive daemon restarts\n- **Secret protection** — tokens stored with `chmod 600`, auto-redacted in all logs\n- **Zero code required** — install the skill and run `\u002Fclaude-to-im setup`, or tell Codex `claude-to-im setup`\n\n## Prerequisites\n\n- **Node.js >= 20**\n- **Claude Code CLI** (for `CTI_RUNTIME=claude` or `auto`) — installed and authenticated (`claude` command available)\n- **Codex CLI** (for `CTI_RUNTIME=codex` or `auto`) — `npm install -g @openai\u002Fcodex`. Auth: run `codex auth login`, or set `OPENAI_API_KEY` (optional, for API mode)\n\n## Installation\n\nChoose the section that matches the AI agent product you actually use.\n\n### Claude Code\n\n#### Recommended: `npx skills`\n\n```bash\nnpx skills add op7418\u002FClaude-to-IM-skill\n```\n\nAfter installation, tell Claude Code:\n\n```text\n\u002Fclaude-to-im setup\n```\n\nIf you want WeChat specifically, you can also say:\n\n```text\n帮我接微信\n```\n\n#### Alternative: clone directly into Claude Code skills\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fop7418\u002FClaude-to-IM-skill.git ~\u002F.claude\u002Fskills\u002Fclaude-to-im\n```\n\nClaude Code discovers it automatically.\n\n#### Alternative: symlink for development\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fop7418\u002FClaude-to-IM-skill.git ~\u002Fcode\u002FClaude-to-IM-skill\nmkdir -p ~\u002F.claude\u002Fskills\nln -s ~\u002Fcode\u002FClaude-to-IM-skill ~\u002F.claude\u002Fskills\u002Fclaude-to-im\n```\n\n### Codex\n\n#### Recommended: use the Codex install script\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fop7418\u002FClaude-to-IM-skill.git ~\u002Fcode\u002FClaude-to-IM-skill\nbash ~\u002Fcode\u002FClaude-to-IM-skill\u002Fscripts\u002Finstall-codex.sh\n```\n\nFor local development with a live checkout:\n\n```bash\nbash ~\u002Fcode\u002FClaude-to-IM-skill\u002Fscripts\u002Finstall-codex.sh --link\n```\n\nThe install script places the skill under `~\u002F.codex\u002Fskills\u002Fclaude-to-im`, installs dependencies, and builds the daemon.\n\nAfter installation, tell Codex:\n\n```text\nclaude-to-im setup\n```\n\nIf you want WeChat specifically, you can also say:\n\n```text\n帮我接微信桥接\n```\n\n#### Alternative: clone directly into Codex skills\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fop7418\u002FClaude-to-IM-skill.git ~\u002F.codex\u002Fskills\u002Fclaude-to-im\ncd ~\u002F.codex\u002Fskills\u002Fclaude-to-im\nnpm install\nnpm run build\n```\n\n### Verify installation\n\n**Claude Code:** Start a new session and type `\u002F` — you should see `claude-to-im` in the skill list. Or ask Claude: \"What skills are available?\"\n\n**Codex:** Start a new session and say `claude-to-im setup`, `start bridge`, or `帮我接微信桥接`.\n\n## Updating the Skill\n\nChoose the update flow that matches both your AI agent product and your installation method.\n\n### Claude Code\n\nIf you installed with `npx skills`, re-run:\n\n```bash\nnpx skills add op7418\u002FClaude-to-IM-skill\n```\n\nIf you installed via `git clone` or symlink:\n\n```bash\ncd ~\u002F.claude\u002Fskills\u002Fclaude-to-im\ngit pull\nnpm install\nnpm run build\n```\n\nThen tell Claude Code:\n\n```text\n\u002Fclaude-to-im doctor\n\u002Fclaude-to-im start\n```\n\n### Codex\n\nIf you installed with the Codex install script in copy mode:\n\n```bash\nrm -rf ~\u002F.codex\u002Fskills\u002Fclaude-to-im\nbash ~\u002Fcode\u002FClaude-to-IM-skill\u002Fscripts\u002Finstall-codex.sh\n```\n\nIf you installed with `--link` or cloned directly into the Codex skills directory:\n\n```bash\ncd ~\u002F.codex\u002Fskills\u002Fclaude-to-im\ngit pull\nnpm install\nnpm run build\n```\n\nThen tell Codex:\n\n```text\nclaude-to-im doctor\nstart bridge\n```\n\n## Quick Start\n\n### 1. Setup\n\n**Claude Code**\n\n```text\n\u002Fclaude-to-im setup\n```\n\n**Codex**\n\n```text\nclaude-to-im setup\n```\n\nThe wizard will guide you through:\n\n1. **Choose channels** — pick Telegram, Discord, Feishu, QQ, WeChat, or any combination\n2. **Enter credentials** — the wizard explains exactly where to get each token, which settings to enable, and what permissions to grant\n3. **Set defaults** — working directory, model, and mode\n4. **Validate** — tokens are verified against platform APIs immediately\n\n### 2. Start\n\n**Claude Code**\n\n```text\n\u002Fclaude-to-im start\n```\n\n**Codex**\n\n```text\nstart bridge\n```\n\nThe daemon starts in the background. You can close the terminal — it keeps running.\n\n### 3. Chat\n\nOpen your IM app and send a message to your bot. Claude Code \u002F Codex will respond through the bridge.\n\nWhen Claude needs to use a tool (edit a file, run a command), you'll see a permission prompt with **Allow** \u002F **Deny** buttons right in the chat (Telegram\u002FDiscord), or a text `\u002Fperm` command prompt \u002F quick `1\u002F2\u002F3` replies (Feishu\u002FQQ\u002FWeChat).\n\n## Commands\n\nAll commands are run inside Claude Code or Codex:\n\n| Claude Code | Codex (natural language) | Description |\n|---|---|---|\n| `\u002Fclaude-to-im setup` | \"claude-to-im setup\" \u002F \"配置\" | Interactive setup wizard |\n| `\u002Fclaude-to-im start` | \"start bridge\" \u002F \"启动桥接\" | Start the bridge daemon |\n| `\u002Fclaude-to-im stop` | \"stop bridge\" \u002F \"停止桥接\" | Stop the bridge daemon |\n| `\u002Fclaude-to-im status` | \"bridge status\" \u002F \"状态\" | Show daemon status |\n| `\u002Fclaude-to-im logs` | \"查看日志\" | Show last 50 log lines |\n| `\u002Fclaude-to-im logs 200` | \"logs 200\" | Show last 200 log lines |\n| `\u002Fclaude-to-im reconfigure` | \"reconfigure\" \u002F \"修改配置\" | Update config interactively |\n| `\u002Fclaude-to-im doctor` | \"doctor\" \u002F \"诊断\" | Diagnose issues |\n\n## Platform Setup Guides\n\nThe `setup` wizard provides inline guidance for every step. Here's a summary:\n\n### Telegram\n\n1. Message `@BotFather` on Telegram → `\u002Fnewbot` → follow prompts\n2. Copy the bot token (format: `123456789:AABbCc...`)\n3. Recommended: `\u002Fsetprivacy` → Disable (for group use)\n4. Find your User ID: message `@userinfobot`\n\n### Discord\n\n1. Go to [Discord Developer Portal](https:\u002F\u002Fdiscord.com\u002Fdevelopers\u002Fapplications) → New Application\n2. Bot tab → Reset Token → copy it\n3. Enable **Message Content Intent** under Privileged Gateway Intents\n4. OAuth2 → URL Generator → scope `bot` → permissions: Send Messages, Read Message History, View Channels → copy invite URL\n\n### Feishu \u002F Lark\n\n1. Go to [Feishu Open Platform](https:\u002F\u002Fopen.feishu.cn\u002Fapp) (or [Lark](https:\u002F\u002Fopen.larksuite.com\u002Fapp))\n2. Create Custom App → get App ID and App Secret\n3. **Batch-add permissions**: go to \"Permissions & Scopes\" → use batch configuration to add all required scopes (the `setup` wizard provides the exact JSON)\n4. Enable Bot feature under \"Add Features\"\n5. **Events & Callbacks**: select **\"Long Connection\"** as event dispatch method → add `im.message.receive_v1` event\n6. **Publish**: go to \"Version Management & Release\" → create version → submit for review → approve in Admin Console\n7. **Important**: The bot will NOT work until the version is approved and published\n\n### QQ\n\n> QQ currently supports **C2C private chat only**. No group\u002Fchannel support, no inline permission buttons, no streaming preview. Permissions use text `\u002Fperm ...` commands. Image inbound only (no image replies).\n\n1. Go to [QQ Bot OpenClaw](https:\u002F\u002Fq.qq.com\u002Fqqbot\u002Fopenclaw)\n2. Create a QQ Bot or select an existing one → get **App ID** and **App Secret** (only two required fields)\n3. Configure sandbox access and scan QR code with QQ to add the bot\n4. `CTI_QQ_ALLOWED_USERS` takes `user_openid` values (not QQ numbers) — can be left empty initially\n5. Set `CTI_QQ_IMAGE_ENABLED=false` if the underlying provider doesn't support image input\n\n### WeChat \u002F Weixin\n\n> WeChat currently uses QR login, single-account mode, text-based permissions, and no streaming preview.\n\n1. Run the local QR helper from your installed skill directory:\n   - Claude Code default install: `cd ~\u002F.claude\u002Fskills\u002Fclaude-to-im && npm run weixin:login`\n   - Codex default install: `cd ~\u002F.codex\u002Fskills\u002Fclaude-to-im && npm run weixin:login`\n2. The helper writes `~\u002F.claude-to-im\u002Fruntime\u002Fweixin-login.html` and tries to open it in your browser automatically\n3. Scan the QR code with WeChat and confirm on your phone\n4. On success, the linked account is stored in `~\u002F.claude-to-im\u002Fdata\u002Fweixin-accounts.json`\n5. Running the helper again replaces the previously linked WeChat account\n\nAdditional notes:\n\n- `CTI_WEIXIN_MEDIA_ENABLED` controls inbound image\u002Ffile\u002Fvideo downloads only\n- Voice messages only use WeChat's own built-in speech-to-text text\n- If WeChat does not provide `voice_item.text`, the bridge replies with an error instead of downloading\u002Ftranscribing raw voice audio\n- Permission approvals use text `\u002Fperm ...` commands or quick `1\u002F2\u002F3` replies\n\n## Architecture\n\n```\n~\u002F.claude-to-im\u002F\n├── config.env             ← Credentials & settings (chmod 600)\n├── data\u002F                  ← Persistent JSON storage\n│   ├── sessions.json\n│   ├── bindings.json\n│   ├── permissions.json\n│   └── messages\u002F          ← Per-session message history\n├── logs\u002F\n│   └── bridge.log         ← Auto-rotated, secrets redacted\n└── runtime\u002F\n    ├── bridge.pid          ← Daemon PID file\n    └── status.json         ← Current status\n```\n\n### Key components\n\n| Component | Role |\n|---|---|\n| `src\u002Fmain.ts` | Daemon entry — assembles DI, starts bridge |\n| `src\u002Fconfig.ts` | Load\u002Fsave `config.env`, map to bridge settings |\n| `src\u002Fstore.ts` | JSON file BridgeStore (30 methods, write-through cache) |\n| `src\u002Fllm-provider.ts` | Claude Agent SDK `query()` → SSE stream |\n| `src\u002Fcodex-provider.ts` | Codex SDK `runStreamed()` → SSE stream |\n| `src\u002Fsse-utils.ts` | Shared SSE formatting helper |\n| `src\u002Fpermission-gateway.ts` | Async bridge: SDK `canUseTool` ↔ IM buttons |\n| `src\u002Flogger.ts` | Secret-redacted file logging with rotation |\n| `scripts\u002Fdaemon.sh` | Process management (start\u002Fstop\u002Fstatus\u002Flogs) |\n| `scripts\u002Fdoctor.sh` | Health checks |\n| `SKILL.md` | Claude Code skill definition |\n\n### Permission flow\n\n```\n1. Claude wants to use a tool (e.g., Edit file)\n2. SDK calls canUseTool() → LLMProvider emits permission_request SSE\n3. Bridge sends inline buttons to IM chat: [Allow] [Deny]\n4. canUseTool() blocks, waiting for user response (5 min timeout)\n5. User taps Allow → bridge resolves the pending permission\n6. SDK continues tool execution → result streamed back to IM\n```\n\n## Troubleshooting\n\nRun diagnostics:\n\n```\n\u002Fclaude-to-im doctor\n```\n\nThis checks: Node.js version, config file existence and permissions, token validity (live API calls), log directory, PID file consistency, and recent errors.\n\n| Issue | Solution |\n|---|---|\n| `Bridge won't start` | Run `doctor`. Check if Node >= 20. Check logs. |\n| `Messages not received` | Verify token with `doctor`. Check allowed users config. |\n| `Permission timeout` | User didn't respond within 5 min. Tool call auto-denied. |\n| `Stale PID file` | Run `stop` then `start`. daemon.sh auto-cleans stale PIDs. |\n\nSee [references\u002Ftroubleshooting.md](references\u002Ftroubleshooting.md) for more details.\n\n## Security\n\n- All credentials stored in `~\u002F.claude-to-im\u002Fconfig.env` with `chmod 600`\n- Tokens are automatically redacted in all log output (pattern-based masking)\n- Allowed user\u002Fchannel\u002Fguild lists restrict who can interact with the bot\n- The daemon is a local process with no inbound network listeners\n- See [SECURITY.md](SECURITY.md) for threat model and incident response\n\n## Development\n\n```bash\nnpm install        # Install dependencies\nnpm run dev        # Run in dev mode\nnpm run typecheck  # Type check\nnpm test           # Run tests\nnpm run build      # Build bundle\n```\n\n## License\n\n[MIT](LICENSE)\n","Claude-to-IM Skill 是一个连接 Claude Code 或 Codex 与即时通讯平台（如 Telegram、Discord、Feishu\u002FLark、QQ 和微信）的桥梁，让用户能够通过聊天方式与 AI 编码助手进行互动。项目采用 TypeScript 开发，支持多种即时通讯平台的组合使用，并提供交互式设置向导、权限控制、流式预览等功能，确保了用户数据的安全性和会话的连续性。适用于需要在不同即时通讯工具上便捷地获取代码编写帮助的开发者或团队，无需编写任何额外代码即可快速部署和使用。",2,"2026-06-11 03:29:53","top_topic"]