# Telegram Claude + Codex: Remote Coding Agents via Telegram

Run coding agents on your server from your phone.

A Telegram bot that runs coding agents on your own server from your phone. Send a message, watch the work stream back into the chat, and approve the plan with a button: no terminal, no SSH.

## Tags

TypeScript, Bun, Telegram Bot, Claude Code, OpenAI Codex, AI, grammy, Groq

![Telegram chat running a coding agent, with plan approval buttons](https://lxbpjvrr41.ufs.sh/f/6KZjuRTQYJxHIndwqxeD4mh8cu39QUEVvM0jCpqogftBHWKs)

## At a glance

- **Role:** Solo build
- **Status:** Open source, personal tool
- **Runs on:** Your own VPS, beside the code it edits
- **Scope:** Telegram bot, two agent CLIs, sessions per project

## In the chat

### Projects

The bot keeps a list of project directories and switches between them from an inline keyboard. The active project stays pinned in the chat, old pins are removed, and each project holds its own session per provider.

### Voice

Voice notes go to Groq Whisper (`whisper-large-v3-turbo`) and the transcript goes straight to the active agent. Talk a task in on a walk, read the result back.

### Compose

`/compose` batches several messages into one prompt: text, voice, forwarded messages, files, photos. `/send` dispatches the batch, `/cancel` discards it. Useful for pulling context out of other chats before you ask for anything.

### Provider switch

`/provider` swaps between Claude Code and OpenAI Codex at runtime. `/status`, `/help`, and the pinned project message all show which one is live.

## The message pipeline

One TypeScript app on Bun, deployed on the VPS next to the projects it manages. Messages go through a sequential queue, so two arriving at once never race:

1. Telegram delivers a message or a voice note.
2. Voice becomes text via Groq Whisper.
3. The text is routed to the active project's session for the current provider.
4. The bot spawns that provider's CLI as a child process and streams its output back.
5. The final response is sent and the session stays open for follow-ups.

`/status` and the response footers carry the git branch and open PR, so you know what the agent is standing on before you send the next message.

## Deployment

It runs as a systemd service: restarts on failure, comes back after a reboot. The bot token and the project paths come from the environment. The agent CLI is spawned only when there is work, so an idle bot costs almost nothing.

## Stack

TypeScript on Bun for the runtime. grammy for the Telegram side, with middleware for the queue and the keyboards. Claude Code CLI as the default agent, OpenAI Codex CLI as the optional second. Groq SDK for transcription. systemd to keep it alive.

## Links

- Project page: https://andrey-markin.com/projects/telegram-claude
- All projects: https://andrey-markin.com/projects.md
- GitHub: https://github.com/Mark-Life/telegram-claude-codex
- Contact: https://andrey-markin.com/#contact
