Command & Control Bot — manage AI coding agents from Telegram via tmux
Project description
CCBot — Command & Control Bot
Control AI coding agents from your phone. CCBot bridges Telegram to tmux — monitor output, respond to prompts, and manage sessions without touching your computer. Supports Claude Code, Codex CLI, and Gemini CLI.
Why CCBot?
AI coding agents run in your terminal. When you step away — commuting, on the couch, or just away from your desk — the session keeps working, but you lose visibility and control.
CCBot fixes this. The key insight: it operates on tmux, not any agent's SDK. Your agent process stays exactly where it is, in a tmux window on your machine. CCBot reads its output and sends keystrokes to it. This means:
- Desktop to phone, mid-conversation — your agent is working on a refactor? Walk away and keep monitoring from Telegram
- Phone back to desktop, anytime —
tmux attachand you're back in the terminal with full scrollback - Multiple sessions in parallel — Each Telegram topic maps to a separate tmux window, each can run a different agent
Other Telegram bots wrap agent SDKs to create isolated API sessions that can't be resumed in your terminal. CCBot is different — it's a thin control layer over tmux, so the terminal remains the source of truth.
How It Works
graph LR
subgraph phone["📱 Telegram Group"]
T1["💬 Topic: api"]
T2["💬 Topic: ui"]
T3["💬 Topic: docs"]
end
subgraph machine["🖥️ Your Machine — tmux"]
W1["⚡ window @0<br>claude ↻ running"]
W2["⚡ window @1<br>codex ↻ running"]
W3["⚡ window @2<br>gemini ↻ running"]
end
T1 -- "text →" --> W1
W1 -. "← responses" .-> T1
T2 -- "text →" --> W2
W2 -. "← responses" .-> T2
T3 -- "text →" --> W3
W3 -. "← responses" .-> T3
style phone fill:#e8f4fd,stroke:#0088cc,stroke-width:2px,color:#333
style machine fill:#f0faf0,stroke:#2ea44f,stroke-width:2px,color:#333
style T1 fill:#fff,stroke:#0088cc,stroke-width:1px,color:#333
style T2 fill:#fff,stroke:#0088cc,stroke-width:1px,color:#333
style T3 fill:#fff,stroke:#0088cc,stroke-width:1px,color:#333
style W1 fill:#fff,stroke:#2ea44f,stroke-width:1px,color:#333
style W2 fill:#fff,stroke:#2ea44f,stroke-width:1px,color:#333
style W3 fill:#fff,stroke:#2ea44f,stroke-width:1px,color:#333
Each Telegram Forum topic binds to one tmux window running an agent CLI. Messages you type in the topic are sent as keystrokes to the tmux pane; the agent's output is parsed from session transcripts and delivered back as Telegram messages.
Features
Session control
- Send messages directly to your agent topic
/commandsshows commands supported by that topic's provider (Claude/Codex/Gemini)- Forwarded slash commands report provider mismatch errors (for example Claude-only
/costin Codex) - Command menu auto-switches per user/chat to the active topic provider after interaction
- Interactive prompts (AskUserQuestion, ExitPlanMode, Permission) rendered as inline keyboards
- Codex edit approvals are reformatted for Telegram readability (compact summary + short preview, with approval choices preserved)
- Codex
/statusreplies include a bot-side transcript snapshot (session + token/rate-limit stats) when Codex does not emit a normal transcript message - Multi-pane support — auto-detects blocked panes, surfaces prompts,
/panescommand for overview - Terminal screenshots — capture the current pane (or any specific pane) as a PNG image
- Sessions dashboard (
/sessions) — overview of all sessions with status and kill buttons
Real-time monitoring
- Assistant responses, thinking content, tool use/result pairs, and command output
- Live status line showing what the agent is currently doing
- MarkdownV2 formatting with automatic plain text fallback
Session management
- Directory browser for creating new sessions from Telegram
- Auto-sync: create a tmux window manually and the bot auto-creates a matching topic
- Fresh/Continue/Resume recovery when a session dies
- Message history with paginated browsing (
/history) - Persistent state — bindings and read offsets survive restarts
Multi-provider support
- Claude Code (default), OpenAI Codex CLI, and Google Gemini CLI
- Per-topic provider selection — different topics can use different agents simultaneously
- Auto-detects provider from externally created tmux windows
- Provider-aware recovery (Continue/Resume buttons adapt to each provider's capabilities)
Extensibility
- Global Telegram menu includes bot commands + default provider commands (with
↗prefix); provider-scoped menus auto-refresh per chat/user/topic context with Telegram-scope fallbacks - Multi-instance support — run separate bots per Telegram group on the same machine
- Configurable via environment variables
Quick Start
Prerequisites
- Python 3.14+
- tmux — installed and in PATH
- At least one agent CLI —
claude(default),codex, orgeminiinstalled and authenticated
Install
# Recommended
uv tool install ccbot
# Alternatives
pipx install ccbot # pipx
brew install alexei-led/tap/ccbot # Homebrew (macOS)
Configure
- Create a Telegram bot via @BotFather
- Enable Topics in your bot (BotFather > Bot Settings > Groups > Topics in Groups > Enable)
- Add the bot to a Telegram group that has Topics enabled
- Create
~/.ccbot/.env:
TELEGRAM_BOT_TOKEN=your_bot_token_here
ALLOWED_USERS=your_telegram_user_id
Get your user ID from @userinfobot on Telegram.
Install hooks (Claude Code only)
ccbot hook --install
This registers 7 Claude Code hooks (SessionStart, Notification, Stop, SubagentStart, SubagentStop, TeammateIdle, TaskCompleted) for automatic session tracking, instant interactive UI detection, real-time status updates, and agent team notifications. Not needed for Codex or Gemini — those providers are auto-detected from running processes.
If hooks are missing, ccbot warns at startup with the fix command. Hooks are optional — terminal scraping works as fallback.
Run
ccbot
Open your Telegram group, create a new topic, send a message — a directory browser appears. Pick a project directory, choose your agent (Claude, Codex, or Gemini), then choose session mode (✅ Standard or 🚀 YOLO), and you're connected.
Documentation
See docs/guides.md for CLI reference, configuration, upgrading, multi-instance setup, session recovery, and more.
Acknowledgments
CCBot started as a fork of ccbot by six-ddc, who created the original Telegram-to-Claude-Code bridge. This project has since been rewritten and developed independently with multi-provider support, topic-based architecture, interactive UI, and a comprehensive test suite. Thanks to six-ddc for the initial idea and implementation.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ccbot-1.6.0.tar.gz.
File metadata
- Download URL: ccbot-1.6.0.tar.gz
- Upload date:
- Size: 15.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e4f5f85053deceb42178be9be2147376d216f302faa3ec55302d15efda05391
|
|
| MD5 |
7282df079402159fe416979fa859902b
|
|
| BLAKE2b-256 |
7192bd1074cb197d3205192d510892873dcbfea570cf049a891277eb9e503974
|
Provenance
The following attestation bundles were made for ccbot-1.6.0.tar.gz:
Publisher:
release.yml on alexei-led/ccbot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ccbot-1.6.0.tar.gz -
Subject digest:
9e4f5f85053deceb42178be9be2147376d216f302faa3ec55302d15efda05391 - Sigstore transparency entry: 1017697830
- Sigstore integration time:
-
Permalink:
alexei-led/ccbot@6236621b8a128b5cc2b0253a9b4feb3f6bd079ef -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/alexei-led
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6236621b8a128b5cc2b0253a9b4feb3f6bd079ef -
Trigger Event:
push
-
Statement type:
File details
Details for the file ccbot-1.6.0-py3-none-any.whl.
File metadata
- Download URL: ccbot-1.6.0-py3-none-any.whl
- Upload date:
- Size: 15.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57a1c37d54d1b4797142733c7ca9fecce69df81c724547bcb5e23353e74326b9
|
|
| MD5 |
ddd4ad937e3fa2997984c85983c53de9
|
|
| BLAKE2b-256 |
60ef3b6cf95328f2c72fdee13fac3ef74690f93754449c24d8dc8addeb3ee679
|
Provenance
The following attestation bundles were made for ccbot-1.6.0-py3-none-any.whl:
Publisher:
release.yml on alexei-led/ccbot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ccbot-1.6.0-py3-none-any.whl -
Subject digest:
57a1c37d54d1b4797142733c7ca9fecce69df81c724547bcb5e23353e74326b9 - Sigstore transparency entry: 1017697841
- Sigstore integration time:
-
Permalink:
alexei-led/ccbot@6236621b8a128b5cc2b0253a9b4feb3f6bd079ef -
Branch / Tag:
refs/tags/v1.6.0 - Owner: https://github.com/alexei-led
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6236621b8a128b5cc2b0253a9b4feb3f6bd079ef -
Trigger Event:
push
-
Statement type: