Turn local tmux + Codex sessions on macOS into a Telegram control surface you can actually use from your phone.
One-line positioning:
- Keep your existing
ssh + tmux + Codexworkflow, and use Telegram only as the remote layer for status, approvals, and follow-up input.
- No workflow rewrite: keep using local
tmux + Codexinstead of switching to a browser dashboard or remote desktop - Actually remote-usable: not just logs, but approvals, interrupts, and follow-up input
- Clear multi-task control: one control topic plus task-specific topics for parallel work
- Phone-friendly by design: useful when you are away from your machine but still need to keep work moving
- Lower setup friction: one-command installer plus
launchdservice support
- people already running multiple Codex sessions in local
tmux - people who want to handle approvals, status checks, and follow-up input from Telegram
- people who want a private control surface, not a remote desktop and not a general bot framework
- check active windows and recent output
- continue existing Codex sessions from Telegram
- receive status changes and approval prompts
- handle common confirmation actions from a phone or another device
- macOS only
- Built around local
tmux - Requires local
codex,tmux,node, andpnpm - Recommended deployment model: private Telegram group + forum topics
- Private chat is useful for bootstrapping and debugging, but not the preferred long-term control surface
- The default bot UI is currently Chinese, but slash commands are available
- This is not a remote desktop and not a general Telegram bot framework
- auto-discover and track
tmuxpanes - read
~/.codex/sessionsto recover active session facts - Telegram control panel, status view, binding, and mode switching
- send follow-up text into existing Codex panes
- interrupt, common control keys, and approval actions
- automatically maintain a control topic and task-specific topics in forum groups
Recommended:
./scripts/install.sh --lang enThe installer will:
- check
tmux,node >= 22, andpnpm - install missing dependencies through Homebrew when possible
- check whether the
codexCLI exists - create
.env - prompt for
TELEGRAM_BOT_TOKEN - guide you through
telegram:discover - run
pnpm install - run
pnpm build - install the
launchdservice automatically if the Telegram allowlist is complete
- macOS
- Homebrew recommended
codexCLI already installed and logged in- a Telegram Bot token
Notes:
- if the script detects that
TELEGRAM_ALLOWED_CHAT_IDS,TELEGRAM_ALLOWED_USER_IDS, orTELEGRAM_CONTROL_CHAT_IDare still missing, it will stop at the configuration step instead of starting the bridge insecurely - you can also run
pnpm setup, but./scripts/install.sh --lang enis the best path for first-time users
If you prefer the manual route:
pnpm install
cp .env.example .envThen fill at least:
TELEGRAM_BOT_TOKEN=your_bot_tokenThen run:
pnpm telegram:discoverWithin 60 seconds, send one message to the bot in your target private group or private chat. The script will print:
chat iduser idchat typechat titleusername
Then write the discovered values back into .env:
TELEGRAM_ALLOWED_CHAT_IDS=
TELEGRAM_ALLOWED_USER_IDS=
TELEGRAM_CONTROL_CHAT_ID=With TELEGRAM_STRICT_SECURITY=true, the bridge refuses to start until these values are complete.
Development:
pnpm devBuild and start:
pnpm build
pnpm startDo not skip telegram:discover before your first real run. Getting chatId/userId right first saves a lot of debugging time.
Recommended production-style flow:
- add the bot to your target private group
- send
/chatinfoor the Chinese phrase当前信息 - send
/groupreadyor the Chinese phrase检查群准备 - send
/setcontrolor the Chinese phrase设为总控 - send the Chinese phrase
绑定最新窗口
It is recommended to keep TELEGRAM_ENABLE_FORUM_TOPICS=true, so the bridge can maintain a control topic plus task-specific topics automatically.
See:
Important defaults:
CODEX_SESSIONS_DIRdefaults to~/.codex/sessionsBRIDGE_DATA_DIRdefaults to.dataunder the repository rootTMUX_AUTO_BOOTSTRAPis disabled by defaultTMUX_BOOTSTRAP_SESSIONSandTMUX_BOOTSTRAP_LAYOUTare empty by default, so the bridge will not create fixed sessions automatically
Default security posture: lock first, then explicitly allow.
TELEGRAM_STRICT_SECURITY=trueby default- recommended usage is a private group, not a long-term private-chat-only control surface
- configure both
TELEGRAM_ALLOWED_CHAT_IDSandTELEGRAM_ALLOWED_USER_IDS - only allowed users should be able to set a chat as the runtime control chat
- disabling strict mode is only suitable for isolated testing
See docs/security.md for details.
If you want the bridge to create fixed tmux sessions at startup, explicitly enable it in .env:
TMUX_AUTO_BOOTSTRAP=true
PROJECT_ROOT=/Users/your-name/Dev
TMUX_BOOTSTRAP_SESSIONS=taskA,taskB
TMUX_BOOTSTRAP_LAYOUT=taskA:/Users/your-name/Dev/project-a,taskB:/Users/your-name/Dev/project-bIf you leave these variables empty, the bridge will not create sessions automatically.
Install:
./scripts/install.sh --lang enUninstall:
./scripts/uninstall.shIf you only want to remove the launchd service but keep local files:
pnpm setup:uninstallIf you also want to remove .env, .data, dist, and node_modules:
./scripts/uninstall.sh --purgeFor contributors:
pnpm test
pnpm typecheck
pnpm lint
pnpm buildThese do not require a real Telegram token or a real local .env.
- once the repository metadata is stable, fill in
repository,homepage, andbugsinpackage.json