codex-telegram-bridge
codex-telegram-bridge lets a local assistant inspect and control Codex threads, and lets you keep working through Telegram when you explicitly mark yourself away.
The product rule is simple:
- when you are present at your computer, Codex does not send Telegram notifications
- when you run
away on, Codex updates go to Telegram - replying directly to a bridge-sent Telegram message sends that reply back to the originating Codex thread
away offstops outbound Telegram notifications again
Hermes is optional. It uses the local MCP server when you ask an agent to inspect, reply to, or approve Codex work. Hermes and MCP do not own Telegram notification delivery.
You do not need Hermes for the default product flow. A normal install is Codex plus Telegram plus the local daemon. Add Hermes only if you also want a Hermes agent to call the bridge tools directly.
Core Product Surface
- Product setup:
setup - Presence gate:
away on,away off,away status - Direct Telegram transport:
telegram setup/status/test/disable - Telegram remote controls:
/away_on,/away_off,/status,/project,/projects,/new_thread,/inbox,/waiting,/recent,/settings - Proactive daemon:
daemon run/install/start/stop/status/logs - Project registry:
projects list/add/import/remove - Thread inspection:
threads,show,waiting,inbox - Thread actions:
reply,approve
Advanced commands such as sync, follow, watch, new, fork, archive, unarchive, and watch --exec remain available for local automation and maintenance, but they are hidden from default help and are not the recommended OSS onboarding path.
Optional Agent Adapter
MCP is an optional local adapter for Hermes and other trusted agent clients. It exposes only doctor, threads, inbox, waiting, show, reply, and approve through codex-telegram-bridge mcp.
MCP does not send proactive notifications, install the daemon, configure Telegram, read Telegram updates, or expose the advanced event stream. Use setup, away, and the daemon for the Telegram product flow.
Install
Build locally:
Install the binary:
Install from Git:
Download a prebuilt archive from GitHub Releases when a tagged release is available.
Run through the wrapper without installing:
The wrapper prefers target/release/codex-telegram-bridge, falls back to target/debug/codex-telegram-bridge, and builds the release binary on first use.
If you need a manual recovery template instead of the interactive setup path, copy examples/config.example.json to ~/.codex-telegram-bridge/config.json, replace the placeholder values, and keep the file mode user-only (chmod 600 ~/.codex-telegram-bridge/config.json). For token-only setup from environment, see examples/telegram.env.example.
Quick Start
Inspect your local Codex and bridge setup:
Configure Telegram and the daemon in one command:
No Hermes setup is required for Telegram notifications or Telegram replies.
For non-interactive setup:
Test Telegram delivery:
Turn on remote notifications when you leave your computer:
Turn them off when you are back:
Optional: if you want Hermes to control Codex when you ask it directly:
Restart Hermes after registration so it reconnects to MCP servers and discovers the codex_* tools.
How It Works
setup writes ~/.codex-telegram-bridge/config.json with user-only permissions, clears any existing Telegram webhook for the bot token, installs the local daemon service unless disabled, and can optionally register the Hermes MCP server.
The daemon runs locally. Each cycle:
- syncs Codex thread state
- checks the local away state
- enqueues new notification events only when away is on
- sends queued events to Telegram
- processes Telegram replies and approval button callbacks
Inbound Telegram replies are processed whenever the daemon is running. The away gate only controls outbound notifications.
Telegram notifications use a compact header, keep Codex's answer body verbatim, and omit internal thread ids. To continue the conversation remotely, use Telegram's Reply action on the specific Codex notification.
Telegram-created threads run in an explicit registered project working directory. Set the current project from Telegram with /project <id>, inspect choices with /projects, or manage the registry locally with codex-telegram-bridge projects ....
Use a Telegram bot token dedicated to this bridge. Telegram update delivery should have one owner.
Commands
Setup And Doctor
Useful setup flags:
--chat-id <id>: skip/startpairing--allowed-user-id <id>: restrict inbound replies/buttons to one Telegram user--no-install-daemon: write config without installing a service--no-start-daemon: install without starting the service--register-hermes: also runhermes mcp add--dry-run: print the planned shape without changing files or services
Presence Gate
away on starts a new away session. The daemon only sends events observed after that session started, so old waiting threads do not flood Telegram when you leave. away off clears pending outbound notifications so delayed retries do not notify you after you return.
Telegram
See docs/telegram.md.
Release mechanics are documented in docs/releasing.md.
Projects
Use the project registry to give Telegram-created threads deterministic working directories. projects import suggests entries from observed Codex thread cwd values in the local state cache; projects add is the explicit source of truth.
Daemon
daemon install writes a user service:
- macOS:
~/Library/LaunchAgents/com.hanifcarroll.codex-telegram-bridge.plist - Linux:
~/.config/systemd/user/com.hanifcarroll.codex-telegram-bridge.service
Inspect And Act On Threads
Follow And Watch
watch --exec is for trusted local automation. It pipes each event to the command on stdin.
Optional Hermes MCP
The MCP server exposes doctor, threads, inbox, waiting, show, reply, and approve tools, plus thread resources and safe prompts.
See docs/hermes.md.
Event Schema
The stream is newline-delimited JSON. Common event types include:
watch_startedthread_waitingthread_completedthread_status_changedturn_starteditem_starteditem_completednotificationfollow_startedfollow_snapshotfollow_turn_startedthread_error
Example thread_waiting event:
Notes
- Hook commands are arbitrary local code. Only run trusted commands with
watch --exec. - MCP tools can read and mutate local Codex threads. Only register this server with trusted local agents.
- The Telegram bot token is stored in the local bridge config and redacted from command output.
doctoris the fastest way to verify that the Codex binary and bridge configuration are discoverable from your environment.