Skip to main content

CCGram — Control AI Coding Agents from Telegram

CI PyPI License

Control AI coding agents from your phone. Walk away mid-session. Keep monitoring and responding from Telegram—without losing terminal access.

Why CCGram?

AI coding agents run in your terminal. Other Telegram bots wrap agent SDKs into isolated API sessions you can't resume in your terminal. CCGram is different. It sits on top of your terminal multiplexer (tmux, herdr, or agterm), not any agent SDK. Your agent process stays exactly where it is—your session is the source of truth.

This means:

  • Desktop to phone, mid-conversation — walk away and keep monitoring from Telegram
  • Phone back to desktop, anytime — attach to your terminal and you're back with full scrollback
  • Multiple sessions in parallel — each Telegram topic maps to a separate tmux window, guarded Herdr agent session, or agterm session

How It Works

graph LR
  subgraph phone["📱 Telegram Topics (Group or Private Chat)"]
    direction TB
    T1["💬 api — Claude"]
    T2["💬 ui — Codex"]
    T3["💬 data — Gemini"]
    T4["💬 ops — Shell"]
    T5["💬 lab — Pi"]
  end

  subgraph bridge["⚡ CCGram"]
    direction TB
    B1["read output\n(transcripts + terminal)"]
    B2["send keystrokes\n(tmux / herdr / agterm)"]
    B3["instant notifications\n(Claude hooks)"]
  end

  subgraph machine["🖥️ Your Machine — tmux / herdr / agterm"]
    direction TB
    W1["window @0 · claude"]
    W2["window @1 · codex"]
    W3["window @2 · gemini"]
    W4["window @3 · bash"]
    W5["window @4 · pi"]
  end

  phone -- "messages / voice" --> bridge
  bridge -- "responses / live view" --> phone
  bridge <--> machine

  style phone fill:#e8f4fd,stroke:#0088cc,stroke-width:2px,color:#333
  style bridge fill:#fff8e1,stroke:#f9a825,stroke-width:2px,color:#333
  style machine fill:#f0faf0,stroke:#2ea44f,stroke-width:2px,color:#333

Each Telegram topic maps to one tmux window. With Herdr, it maps instead to one guarded agent session: agent.list is the sole identity source and CCGram persists only an opaque herdr-session-v1-… target, never a tab, pane, or terminal ID. Every Herdr agent topic is pane-qualified as <workspace> ▸ <tab> ▸ <pane>, so its label remains stable when siblings join or leave the tab. Every action reads a fresh agent.list record and fails closed for missing, malformed, sessionless, or legacy bindings. Duplicate canonical targets are quarantined while unrelated sessions remain operational. Legacy locator bindings require explicit rebind and are never inferred from names. A session can still change after that guard and before Herdr dispatches, so delivery is not atomic and may be indeterminate after this post-guard race. With agterm, each topic maps to one durable agterm session UUID.


What You Can Do

  • Bind agents to topics — one agent per group or private-chat topic; create via directory browser
  • Auto-detect providers — Supports Claude Code, Codex, Gemini, Pi, and Shell simultaneously
  • Monitor live — Terminal screenshots on demand or auto-refresh every 5 seconds
  • Send commands — Slash commands, voice messages (transcribed via Whisper), or raw shell input
  • Run multiple agents in parallel — each topic independent; run different agents at once
  • Recover gracefully — Resume, continue, or start fresh if a session crashes
  • Send workspace files — Share files to Telegram via /send (glob, path, or substring search)
  • Action toolbar — Provider-specific buttons for common actions (Screenshot, Mode, Esc, Enter, etc.)
  • Direct choices — Answer supported numbered and yes/no agent prompts with one tap

Delivery and Sync Safety

CCGram losslessly combines only eligible consecutive transcript text deliveries for the same chat, topic, window, role, and source session. It preserves each item's formatting and keeps tool updates, media, status updates, and other boundaries separate. The status bubble shows queue progress; at a severe backlog (100 pending items or an oldest item aged 5 minutes), its inline Jump to live action requires confirmation and posts a skipped-range notice. The raw provider transcript is never deleted. Delivery is at-least-once, so a Telegram failure or restart before acknowledgement can repeat a transcript message rather than silently losing it.

/sync can clean up only locally recorded, eligible retired topics. It never discovers or enumerates arbitrary Telegram topics; an active or rebound topic is protected before any cleanup request. See the delivery, backlog, and Sync guide for boundaries, safety guarantees, and Telegram admin permissions.


Quick Start

Install:

uv tool install ccgram          # recommended
# or: pipx install ccgram | brew install alexei-led/tap/ccgram

Telegram setup:

  1. Create a bot via @BotFather — full instructions
  2. Choose one topic setup:
    • Private chat: Enable Topics for the bot in BotFather. Topic 1 is the control topic.
    • Group: Add the bot to a Topics-enabled group and promote it to Admin.
  3. Create ~/.ccgram/.env:
TELEGRAM_BOT_TOKEN=your_bot_token_here
ALLOWED_USERS=your_telegram_user_id
# Group setup only:
CCGRAM_GROUP_ID=your_telegram_group_id

Get your user ID from @userinfobot. For a group, get its ID via @RawDataBot and prefix the Peer ID with -100.

Run:

ccgram

Open the configured group or private bot chat. Create a topic and send a message. The directory browser appears. Pick a project directory and an agent (Claude, Codex, Gemini, Pi, or Shell).

Prerequisites: Python 3.14+, tmux, herdr, or agterm, and one agent CLI. CCGram does not modify agent SDKs.

Herdr setup

CCGram supports Herdr socket protocols 14–20. Later and otherwise unknown protocol versions are attempted with a warning for forward compatibility; individual command failures still surface if the protocol is not usable. Telegram rate limiting uses a protected PTB adapter seam and is therefore tested against and constrained to python-telegram-bot>=22.6,<22.7. Install Herdr's integration before launching an agent that needs a native session identity:

herdr integration install pi
herdr integration install antigravity-cli

Restart an already-running agent after installation. Antigravity receives a native Herdr session identity after its first prompt creates a conversation.

Start new agents, or restart already-running agents, after installing the integration so they publish their agent_session identity. Then set CCGRAM_MULTIPLEXER=herdr and run ccgram hook --install as usual.

agterm setup

agterm is macOS-native. Install agterm, then use Help > Install Command Line Tool to put agtermctl on PATH. Start agterm and confirm that agtermctl can reach its control socket. Set AGTERM_SOCKET only when the default socket is not the one to use.

Set CCGRAM_MULTIPLEXER=agterm. CCGram adopts sessions from the ccgram workspace by default; set CCGRAM_AGTERM_WORKSPACES to a comma-separated list of workspace names, or * for all workspaces. Run ccgram doctor to verify the CLI and control socket.

Platform Support

CCGram supports Linux, macOS, and WSL2. Native Windows is not supported. The agterm backend is macOS-native.

On Windows, install and run CCGram inside WSL2. Install tmux or herdr and the agent CLI inside the WSL distribution; use agterm only on macOS.

Native Windows does not provide the Unix file locking, signal handling, and terminal multiplexer features that CCGram requires.


Documentation

  • Guides — CLI reference, configuration, delivery/backlog safety, /sync, voice transcription, multi-instance setup, session recovery, testing
  • Providers — Claude Code, Codex, Gemini, Pi, Shell; transcript delivery, session modes, LLM config, custom commands, git worktrees
  • Architecture — delivery queue, transcript watermark, and provider/three-backend multiplexer design

Optional Features

Web Dashboard — Live terminal (xterm.js), transcript search, multi-pane grid in Telegram. Disabled by default. Enable here.


Development

git clone https://github.com/alexei-led/ccgram.git && cd ccgram
uv sync --extra dev
make check         # lint, format, typecheck, test
make test-e2e      # end-to-end tests (requires agent CLIs; see docs/guides.md#e2e-tests)

License

MIT

Release files for ccgram 4.9.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ccgram 4.9.7
File Size Uploaded
ccgram-4.9.7.tar.gz 16.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ccgram 4.9.7
File Interpreter ABI Platform
ccgram-4.9.7-py3-none-any.whl Python 3 none any Details

Total release size: 32.5 MB

Release files / ccgram-4.9.7.tar.gz

Download URL ccgram-4.9.7.tar.gz
Size 16.6 MB
Tags Source
SHA-256 checksum
How to use checksums
5926ac1e77ab1e88cc206788eb52789a7aa113414e3a835f5935e886998bf182
BLAKE2b-256 checksum
How to use checksums
2b5954d0cd60f83cf264911401488705dc8bee8051699eacf61756fe128ecd2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release files / ccgram-4.9.7-py3-none-any.whl

Download URL ccgram-4.9.7-py3-none-any.whl
Size 15.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
cce37d4da768f2b1ac4037148f3d7b8a6de6120e38e0ed433af6ec43aef0f628
BLAKE2b-256 checksum
How to use checksums
8f3984b62c1a9ac59aa9fa55d8efacc15ec56af87e996306171d0f15025a0253
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release history Release notifications | RSS feed

4.12.3

2 release files

4.12.2

2 release files

4.12.1

2 release files

4.12.0

2 release files

4.11.4

2 release files

4.11.3

2 release files

4.11.2

2 release files

4.11.1

2 release files

4.11.0

2 release files

4.10.5

2 release files

4.10.4

2 release files

4.9.8

2 release files

This release

4.9.7 This release

2 release files

4.9.6

2 release files

4.9.5

2 release files

4.9.4

2 release files

4.9.3

2 release files

4.9.2

2 release files

4.9.1

2 release files

4.9.0

2 release files

4.8.0

2 release files

4.7.1

2 release files

4.7.0

2 release files

4.6.8

2 release files

4.6.7

2 release files

4.6.6

2 release files

4.6.5

2 release files

4.6.4

2 release files

4.6.3

2 release files

4.6.2

2 release files

4.6.1

2 release files

4.6.0

2 release files

4.5.3

2 release files

4.5.2

2 release files

4.5.1

2 release files

4.5.0

2 release files

4.4.2

2 release files

4.4.1

2 release files

4.4.0

2 release files

4.3.11

2 release files

4.3.10

2 release files

4.3.9

2 release files

4.3.7

2 release files

4.3.6

2 release files

4.3.5

2 release files

4.3.4

2 release files

4.3.3

2 release files

4.3.2

2 release files

4.3.1

2 release files

4.3.0

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.6.0

2 release files

3.5.2

2 release files

3.5.1

2 release files

3.5.0

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.3

2 release files

3.3.2

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.3

2 release files

3.1.2

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.9

2 release files

3.0.8

2 release files

3.0.7

2 release files

3.0.6

2 release files

3.0.5

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.11.3

2 release files

2.11.2

2 release files

2.11.1

2 release files

2.11.0

2 release files

2.10.0

2 release files

2.9.0

2 release files

2.8.2

2 release files

2.8.1

2 release files

2.8.0

2 release files

2.7.2

2 release files

2.7.1

2 release files

2.7.0

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.5

2 release files

2.3.4

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page