Awesome-claude-skills claude-code-telegram

install
source · Clone the upstream repo
git clone https://github.com/clawdbot520/awesome-claude-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/clawdbot520/awesome-claude-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/claude-code-telegram" ~/.claude/skills/clawdbot520-awesome-claude-skills-claude-code-telegram && rm -rf "$T"
manifest: claude-code-telegram/SKILL.md
source content

Claude Code Telegram(cct)

將 Claude Code 接入 Telegram,透過 Bot 進行互動式對話。


為什麼需要

傳統方式Telegram 方式
只能在本機 Terminal隨時隨地用手機聊
出門無法使用通勤也能用
無法串流回應支援串流回應
session 不持續session 持續對話

檔案結構

scripts/
  install.sh                                   ← 一鍵安裝腳本
  cct                                          ← cct binary(Bun 編譯,60MB,無 source)
  com.clawdbot520.claude-code-telegram.plist  ← launchd 設定
  .env.template                               ← 設定檔範本
  dispatch.sh                                 ← Claude Code Bridge 派任腳本
  on-stop.sh                                  ← Claude Code Stop hook

安裝(新環境)

前置需求

  • macOS
  • ~/.local/bin/claude
    (Claude Code binary)已安裝
  • Telegram Bot Token(從 @BotFather 取得)
  • 你的 Telegram User ID(從 @userinfobot 取得)

一鍵安裝

cd scripts
bash install.sh

安裝腳本會自動:

  1. 複製
    cct
    binary →
    ~/.local/bin/cct
  2. 建立
    ~/.cct/
    workspace 並產生
    .env
  3. 安裝 launchd plist(路徑自動替換為當前用戶)
  4. 安裝 Claude Code Bridge(
    dispatch.sh
  5. 安裝 Stop hook(
    on-stop.sh
  6. 啟動 cct 服務

安裝後設定

填入 Bot Token:

nano ~/.cct/.env

必填欄位:

TELEGRAM_BOT_TOKEN=你的_bot_token
TELEGRAM_ALLOWED_USERS=你的_telegram_user_id

加入 Stop hook

~/.claude/settings.json
):

{
  "hooks": {
    "Stop": [{ "hooks": [{ "type": "command", "command": "~/.claude/hooks/on-stop.sh", "timeout": 30 }] }]
  }
}

重啟 cct 讓設定生效:

launchctl unload ~/Library/LaunchAgents/com.clawdbot520.claude-code-telegram.plist
launchctl load ~/Library/LaunchAgents/com.clawdbot520.claude-code-telegram.plist

常用操作

查看狀態

launchctl list | grep claude-code-telegram
ps aux | grep cct | grep -v grep
tail -20 ~/.cct/cct.log

啟動 / 停止

# 啟動
launchctl load ~/Library/LaunchAgents/com.clawdbot520.claude-code-telegram.plist

# 停止
launchctl unload ~/Library/LaunchAgents/com.clawdbot520.claude-code-telegram.plist

手動測試

cd ~/.cct && env -u CLAUDECODE ~/.local/bin/cct .

重要坑點

1. Nested Session 問題

在 Claude Code TUI 內直接跑 cct 會被保護機制擋住。launchd 啟動沒問題,手動跑要加

env -u CLAUDECODE

2. 更新 Antigravity 前要先停 cct

cct 收到 Telegram 訊息可能喚醒 Antigravity,導致更新失敗。更新前:

launchctl unload ~/Library/LaunchAgents/com.clawdbot520.claude-code-telegram.plist
# 更新完成後
launchctl load ~/Library/LaunchAgents/com.clawdbot520.claude-code-telegram.plist

3. KeepAlive

plist 設有

KeepAlive = true
,cct 掛掉自動重啟,重開機自動啟動。

4. cct 無 source code

cct binary 是 Bun 編譯產物,source 已遺失。binary 已存放在

scripts/cct
,這是唯一備份,請妥善保存。