Sandbox
@gergomiklos/heyagent

Telegram bridge that sends messages between Claude Code, Codex, and your phone.

HeyAgent CLI connects a Telegram bot to Claude Code or Codex and keeps one local bridge process running. Messages from Telegram are forwarded to the active agent, and agent replies are sent back to Telegram, with support for switching providers, new sessions, and status checks.

94 stars13 forksJavaScriptUpdated 3mo ago
Who it's for

Builders who want to control Claude Code or Codex from Telegram and keep replies on their phone.

What it delivers

You can send prompts to your coding agent from Telegram and get the answers back in the same chat.

What it does

Bidirectional Telegram bridge

Forwards Telegram messages to the active agent and sends agent output back to the same chat.

Claude and Codex switching

Lets you switch the active provider with `/claude` and `/codex` in Telegram or the local CLI.

Session control

Supports resumed sessions, fresh sessions with `--new`, and explicit session ids with `--session`.

Local pairing setup

Pairs a bot and chat locally through phone setup or manual token entry, with no external storage.

Attachment forwarding

Passes documents, images, audio, voice notes, and videos through to the active provider.

Local CLI commands

Accepts `/ask`, `/say`, `/new`, `/stop`, `/status`, `/help`, and `/exit` from the terminal.

How to get it

  1. 1Run
    npm install -g heyagent

README

HeyAgent CLI

HeyAgent CLI is a bidirectional Telegram bridge for Claude Code and Codex. Send and receive Telegram messages with Codex or Claude (and switch any time).

Fully free, fully open source, and fully local — no server or external storage required.

v2 Update

Note: before v2, this project focused on notification integration for CLI coding agents.

Installation

npm install -g heyagent

Usage

# Resume latest session (default)
hey claude
hey codex

# Create new session
hey claude --new
hey codex --new

# Run with explicit session id
hey claude --session [SESSION-ID]   # resumes given session
hey codex --session [SESSION-ID]    # resumes given session

# Show local pairing/session status
hey status

# Reset Telegram setup (clears bot token + chat pairing)
hey reset

# Non-interactive reset
hey reset --yes

Setup and Pairing Flow

Start with hey claude or hey codex.

On first run, HeyAgent will:

  1. Ask for setup mode:
    • Phone setup (recommended) — scan one QR code and complete guided steps on your phone
    • Manual fallback — no tunnel required; paste the bot token directly into the terminal
  2. In phone setup mode, CLI starts a temporary local server exposed via a Cloudflare Quick Tunnel and shows a single QR code. (This same tool is handy for reaching your local dev environment from your phone.)
  3. Complete guided steps on phone:
    • Open BotFather
    • Create your own bot
    • Submit bot token
    • Open bot chat and press START
  4. CLI validates token, waits for pairing, and stores bot + chat locally.

Manual fallback avoids tunneling completely:

  1. Create your own bot
  2. Paste bot token into the terminal.
  3. CLI shows bot opening link/QR for pairing.

If recommended phone onboarding fails in your environment, install system cloudflared (for example brew install cloudflared) or choose manual fallback.

Telegram Commands

Inside Telegram:

  • /help list commands
  • /new force next prompt to run as a new session
  • /claude switch active provider to Claude
  • /codex switch active provider to Codex
  • /status show provider, directory, bot, session, and pairing
  • /stop stop current execution and clear queued messages

Any other text message is forwarded to the active agent. For voice input, keyboard dictation on your phone is recommended.

Local CLI Input

When running in an interactive terminal, HeyAgent also accepts live local input.

  • Plain text: run prompt through provider and send response to Telegram
  • /ask <prompt> same as plain text
  • /say <text> send raw message directly to Telegram
  • /new force next prompt to start a fresh session
  • /stop stop current execution and clear queued Telegram messages
  • /claude switch to Claude provider
  • /codex switch to Codex provider
  • /status print local bridge status
  • /help show local commands
  • /exit stop the running bridge

CLI logs are shown for inbound Telegram commands, local prompts, and outgoing messages.

Provider Execution

Default runtime:

  • claude --dangerously-skip-permissions -p --output-format json "<prompt>"
  • codex exec --dangerously-bypass-approvals-and-sandbox --json "<prompt>"

You can override default bypass behavior by passing explicit provider permission flags, for example:

  • hey claude --permission-mode acceptEdits
  • hey codex --full-auto

Session startup strategy:

  • --new force first prompt to start fresh session
  • --session <session-id> : resumes the session given by its id
  • default (no startup flag): same as --resume / --continue, resume latest in current provider/project

Notes

  • Fully local-served
  • Sleep prevention is always enabled while bridge is running.
  • Lid-close sleep is not reliably controllable by app-level code:
    • macOS: use clamshell mode setup (external power/display/input) for closed-lid operation.
    • Windows/Linux: requires OS power settings or admin-level policy changes.
  • Polling-only runtime (no webhooks).
  • One chat per running CLI process.
  • If you send new messages while a request is in progress, HeyAgent queues and groups those messages into the next run.
  • Telegram attachments are forwarded to the active provider (documents, images, audio, voice notes, and videos).
  • Config is stored at ~/.heyagent/config.json

License

MIT License - see LICENSE file for details.

Files in the repo

Repository payload12 top-level entries
  • .github
  • bin
  • src
  • .gitignore
  • .npmignore
  • .prettierignore
  • .prettierrc
  • eslint.config.js
  • LICENSE
  • package-lock.json
  • package.json
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k