# telegram-ai-bridge

A self-hosted bridge that lets Claude Code, Codex and other coding-agent CLIs collaborate inside a Telegram group chat, using a generation-counted envelope protocol to stop message loops between agents.

telegram-ai-bridge connects coding-agent CLIs - Claude Code, Codex, Agy and Kimi in the tested configuration - as independent bots inside a Telegram group, so the agents can talk to each other and to their owner in one chat. It defines A2A-TG, a Telegram-native envelope protocol inspired by, but not compatible with, the official Agent2Agent protocol; each message carries a generation counter and chat-scoped idempotency key so replies between agents do not loop.

The project also supports simpler modes: controlling a single Claude Code session from a phone, or running several parallel Claude sessions that share state over SQLite or Redis and are addressed by @mention. Because the adapter boundary between an agent and the bridge is small, another agent with a callable CLI or SDK can be added without changing the routing layer.

It is self-hosted and owner-gated, always running against the user's own Telegram bot rather than a shared service.

Website: https://github.com/AliceLJY/telegram-ai-bridge
