Incursa Codex Telegram lets you talk to a local Codex CLI session from a private Telegram chat. It runs on your own machine, stores state locally, and only accepts messages from allowlisted Telegram users.
Use it when you want to start, steer, and inspect Codex work from your phone without exposing your whole machine to Telegram users.
Demo
Watch a two-minute private-chat demo showing a local Codex session controlled from Telegram with project selection, text prompts, and voice input.
For the available Telegram buttons and menus, see the menus and button reference.
Runtime Modes
The service has a small set of operating modes:
- Start it with no arguments in an interactive terminal to open the bootstrap/admin menu.
- Start it with
--runto skip the menu and run the hosted services directly. - Start it with
--menuto force the bootstrap/admin menu. - Use private chat first, then trusted group roots or forum topics only after the private flow works.
- Use docs/usage.md for the user-facing output modes:
Compact,Verbose,LiveCard, andFinalOnly.
Configuration And Secrets
The main configuration file is src/Incursa.Codex.Telegram/appsettings.json. Keep local values in one of these places:
appsettings.Local.json- User secrets
- Environment variables
- An operator-managed secret store
Keep these out of version control:
- Telegram bot tokens.
- OpenAI API keys.
- Local Codex auth state.
appsettings.Local.json.- Local debug traces and private transcripts.
Repository Layout
The main folders and files are:
src/Incursa.Codex.Telegram: the console host, Telegram routing, Codex integration, configuration, and runtime services.tests/Incursa.Codex.Telegram.Tests: unit and integration-style tests for commands, state, queueing, output, and Telegram behavior.docs/: source-authored operator, maintainer, and command documentation.scripts/: local release, publish, fuzz, mutation, and secret-scan scripts.specs/: repository-native requirements and architecture notes.fuzz/corpus/: checked-in Telegram fuzz seeds.docs.site.jsonand.github/workflows/sync-docs.yml: the docs mirror manifest and sync workflow.
Download
Download the latest release binary for your operating system:
| Platform | Download | Checksum |
|---|---|---|
| Windows x64 | codex-telegram-win-x64.exe | sha256 |
| Linux x64 | codex-telegram-linux-x64 | sha256 |
| macOS arm64 | codex-telegram-osx-arm64 | sha256 |
All releases are listed at GitHub Releases.
What You Need
Before starting, have these ready:
- A Telegram account.
- A Telegram bot token from
@BotFather. - A local Codex CLI installation that already works in a terminal.
- At least one local repository or workspace directory you want Codex to use.
- Optional: an OpenAI API key for voice-note transcription. Install
ffmpegonly if Telegram audio must be transcoded; Telegram voice notes commonly need it.
This app does not bundle Codex, Telegram credentials, or OpenAI credentials. If you use voice notes, any required audio transcoder must already exist on the machine running the bot.
For Codex CLI setup, use OpenAI's official Codex CLI docs.
Quick Start
Start by creating a Telegram bot, then follow the complete setup path for your operating system.
Create A Telegram Bot
In Telegram:
- Open a chat with
@BotFather. - Send
/newbot. - Choose a display name.
- Choose a username ending in
bot. - Copy the bot token.
Keep the token private. Anyone with the token can control the bot account.
Recommended BotFather settings for a first private-chat release:
- Use
/setdescriptionand/setabouttextto explain that this bot controls a local Codex installation. - Keep group joins disabled unless you intentionally want group support.
- Keep privacy mode enabled unless you intentionally need ordinary group text routed to Codex.
- Add commands later after the private-chat flow works.
Copy-paste BotFather text, command lists, and privacy recommendations are in BotFather setup.
BotFather gives you the bot token, but it cannot give you your personal Telegram user ID. On first run, Codex Telegram can validate the bot token, show a random setup code in the terminal, wait for one private message containing that code, and save your user ID automatically.
Windows
Use this path if the bot will run on Windows x64.
- Download
codex-telegram-win-x64.exeandcodex-telegram-win-x64.exe.sha256from the latest release. - Optional but recommended: verify the checksum before renaming or moving the file.
Get-FileHash .\codex-telegram-win-x64.exe -Algorithm SHA256 Get-Content .\codex-telegram-win-x64.exe.sha256
- Put the binary in a stable folder.
New-Item -ItemType Directory -Force C:\tools\codex-telegram | Out-Null Move-Item .\codex-telegram-win-x64.exe C:\tools\codex-telegram\codex-telegram.exe Set-Location C:\tools\codex-telegram
- Confirm Codex works locally before involving Telegram.
- Start the setup menu from the app folder.
- Complete the first-run wizard.
Use these values as a starting point:
Telegram bot token: <token from BotFather>
Telegram polling: enabled
Admin user ID: let the wizard capture it by sending one private Telegram message to the bot
Codex executable path: leave blank if codex is on PATH, otherwise set the full codex.exe path
Workspace root: C:\src
Default working directory: C:\src\your-repo
OpenAI transcription: only if you want voice notes
Local data root: leave blank unless you need a custom state folder
The app writes appsettings.Local.json beside the executable by default. Keep that file local and untracked. If the executable-local file is missing and your launch directory has appsettings.Local.json, the app uses the launch-directory file.
- Start normal operation with the menu skipped.
.\codex-telegram.exe --run
Keep that terminal open, or run the app under your preferred Windows service manager.
- In the private Telegram chat, run the first private Codex session.
/doctor
/projects
/project add C:\src\your-repo
/new release-demo
Summarize this repository and tell me the next safest setup check to run.
/tail
At this point you have a working private Telegram chat connected to a local Codex session.
Linux
Use this path if the bot will run on Linux x64.
- Download
codex-telegram-linux-x64andcodex-telegram-linux-x64.sha256from the latest release. - Or download both files directly with
curl.
curl -fL -o codex-telegram-linux-x64 https://github.com/incursa/codex-telegram/releases/latest/download/codex-telegram-linux-x64 curl -fL -o codex-telegram-linux-x64.sha256 https://github.com/incursa/codex-telegram/releases/latest/download/codex-telegram-linux-x64.sha256
- Optional but recommended: verify the checksum before renaming or moving the file.
shasum -a 256 -c ./codex-telegram-linux-x64.sha256
- Put the binary in a stable folder and mark it executable.
mkdir -p ~/tools/codex-telegram mv ./codex-telegram-linux-x64 ~/tools/codex-telegram/codex-telegram chmod +x ~/tools/codex-telegram/codex-telegram cd ~/tools/codex-telegram
- Confirm Codex works locally before involving Telegram.
- Start the setup menu from the app folder.
- Complete the first-run wizard.
Use these values as a starting point:
Telegram bot token: <token from BotFather>
Telegram polling: enabled
Admin user ID: let the wizard capture it by sending one private Telegram message to the bot
Codex executable path: leave blank if codex is on PATH, otherwise set the full codex path
Workspace root: /home/you/src
Default working directory: /home/you/src/your-repo
OpenAI transcription: only if you want voice notes
Local data root: leave blank unless you need a custom state folder
The app writes appsettings.Local.json beside the executable by default. Keep that file local and untracked. If the executable-local file is missing and your launch directory has appsettings.Local.json, the app uses the launch-directory file.
- Start normal operation with the menu skipped.
Keep that terminal open, or run the app under systemd, tmux, screen, or another process supervisor.
- In the private Telegram chat, run the first private Codex session.
/doctor
/projects
/project add /home/you/src/your-repo
/new release-demo
Summarize this repository and tell me the next safest setup check to run.
/tail
At this point you have a working private Telegram chat connected to a local Codex session.
macOS
Use this path if the bot will run on Apple Silicon macOS.
- Download
codex-telegram-osx-arm64andcodex-telegram-osx-arm64.sha256from the latest release. - Or download both files directly with
curl.
curl -fL -o codex-telegram-osx-arm64 https://github.com/incursa/codex-telegram/releases/latest/download/codex-telegram-osx-arm64 curl -fL -o codex-telegram-osx-arm64.sha256 https://github.com/incursa/codex-telegram/releases/latest/download/codex-telegram-osx-arm64.sha256
- Optional but recommended: verify the checksum before renaming or moving the file.
shasum -a 256 -c ./codex-telegram-osx-arm64.sha256
- Put the binary in a stable folder and mark it executable.
mkdir -p ~/tools/codex-telegram mv ./codex-telegram-osx-arm64 ~/tools/codex-telegram/codex-telegram chmod +x ~/tools/codex-telegram/codex-telegram cd ~/tools/codex-telegram
- If macOS blocks the binary because it was downloaded from the internet, verify the checksum first. If you trust the release, remove the quarantine attribute.
xattr -d com.apple.quarantine ~/tools/codex-telegram/codex-telegram- Confirm Codex works locally before involving Telegram.
- Start the setup menu from the app folder.
- Complete the first-run wizard.
Use these values as a starting point:
Telegram bot token: <token from BotFather>
Telegram polling: enabled
Admin user ID: let the wizard capture it by sending one private Telegram message to the bot
Codex executable path: leave blank if codex is on PATH, otherwise set the full codex path
Workspace root: /Users/you/src
Default working directory: /Users/you/src/your-repo
OpenAI transcription: only if you want voice notes
Local data root: leave blank unless you need a custom state folder
The app writes appsettings.Local.json beside the executable by default. Keep that file local and untracked. If the executable-local file is missing and your launch directory has appsettings.Local.json, the app uses the launch-directory file.
- Start normal operation with the menu skipped.
Keep that terminal open, or run the app under launchd, tmux, screen, or another process supervisor.
- In the private Telegram chat, run the first private Codex session.
/doctor
/projects
/project add /Users/you/src/your-repo
/new release-demo
Summarize this repository and tell me the next safest setup check to run.
/tail
At this point you have a working private Telegram chat connected to a local Codex session.
Voice Notes
Voice notes are optional. The bot downloads Telegram audio, transcribes it with OpenAI, shows the transcript, and sends only the transcribed text to the active Codex session. Codex does not receive raw Telegram audio.
Voice note requirements:
OpenAI:ApiKeyorOPENAI_API_KEY.- A transcription-capable
OpenAI:Model. ffmpegonly when the downloaded audio is not in a format OpenAI accepts directly. Telegram voice notes commonly arrive as OGG/OPUS, so installffmpegor configureOpenAI:FfmpegPathfor reliable voice-note support.
If ffmpeg is missing when a voice note needs conversion, the bot leaves the Codex session untouched and replies with setup guidance instead of failing silently.
Suggested first voice test:
Please review the current project and tell me the three most important setup risks. Keep it concise and do not edit files.
After a successful test, you should see the transcription in Telegram before the Codex response starts.
Day-To-Day Commands
| Command | Use |
|---|---|
/doctor |
Explain authorization, routing, active project/session, workspace roots, queue state, and next action. |
/help |
Show the built-in command summary. |
/whoami |
Show Telegram user, chat, and topic IDs for setup and troubleshooting. |
/version |
Show the running app version. |
/trust |
Trust the current group or forum chat for allowlisted users. |
/projects |
List known local project directories. |
/project add <path> |
Add and select a repository or workspace. |
/project current |
Confirm the active project for this Telegram conversation. |
/new [name] |
Create and select a fresh Codex session; omit the name to auto-generate one from the active project. |
/sessions |
Show active and Telegram-managed sessions. |
/sessions all [count] |
Show older Codex history. |
/use <sessionId> |
Resume an existing session. |
/send <text> |
Explicitly send text when privacy mode or chat type prevents normal auto-routing. |
/steer <text> |
Add guidance to a currently active turn. |
/queue |
View queued prompts for the conversation, then edit, delete, or send one now. |
/model |
Show or change the active session model. |
/thinking |
Show or change reasoning effort. |
/goal |
Show or change the active session goal. |
/status |
Show active session status, including compact Codex usage when available. |
/usage |
Show five-hour and weekly Codex usage, with reset times. |
/tail [lines] |
Show recent output and keep following the session; defaults to 40 lines. |
/outbound |
Inspect delayed or batched Telegram output. |
/stop |
Gracefully stop a session. |
/restart confirm |
Show standalone-process restart guidance. |
/topic ... |
Manage forum-topic sessions in allowed supergroups. |
For a fuller operator guide, see docs/usage.md. For every command, parameter, and expected behavior, see docs/command-reference.md.
How Output Delivery Works
Telegram output is rate-limited and batched so active Codex sessions do not flood your chat.
Practical rules:
- Use
/tailbefore assuming Telegram scrollback contains the full transcript. - Use
/outboundif messages seem delayed. - Use
/usagewhen you need current five-hour and weekly Codex usage percentages and reset times. - Batched messages are concatenated with simple spacing and preserve multi-line content, including numbered lists and headings.
- If the local outbound buffer is compacted, the bot sends an explicit compaction notice.
- Terminal turn events are tracked internally; the bot no longer emits a standalone completion marker into the chat.
Local State And Safety
The app stores local state under CodexTelegram:Workspace:DataRoot. By default, that is the user's application data folder.
State includes:
projects.jsontelegram-state.json- Per-thread manifests
Secrets should stay in appsettings.Local.json, user secrets, environment variables, or another secret store. Secrets are not supposed to be written to the state files.
Security rules:
- Keep
TelegramBot:AllowedUserIdsnarrow. - Keep
TelegramBot:AllowedChatIdsempty unless you intentionally want config-managed group or forum-topic access. - Set explicit workspace roots and a default working directory before enabling polling.
- Review Codex sandbox and approval settings before exposing sensitive repositories.
- Rotate the BotFather token if it is exposed.
Supported Modes
Private chat is the recommended first setup path. Trusted groups and forum topics are also supported conversation scopes.
Groups and forum topics require:
- An allowed Telegram user.
- A trusted group chat, either from
TelegramBot:AllowedChatIdsor/trustsent in that chat by an allowlisted user. - BotFather privacy settings that match the desired behavior.
- Topic-management rights if the bot should create forum topics.
Start privately first. Then use a trusted group root as a single project/session lane, or use forum topics when one group needs multiple independent sessions.
Local Validation
Run these commands from the repository root:
dotnet restore CodexTelegram.slnx dotnet build CodexTelegram.slnx -c Release -m:1 --no-restore dotnet test tests\Incursa.Codex.Telegram.Tests\Incursa.Codex.Telegram.Tests.csproj -c Release --no-build --no-restore -m:1 .\scripts\Test-ReleaseReadiness.ps1 -Runtime win-x64 -SkipPublish git diff --check
Release And Versioning
The repository publishes self-contained release binaries through scripts\Publish.ps1 and .github/workflows/publish.yml.
Release tags that start with v produce GitHub Releases with Windows x64, Linux x64, and macOS arm64 assets, plus SHA-256 checksum files and a copied LICENSE.txt.
Before a public release, run the repo-native release gate and the live Telegram checklist:
.\scripts\Test-ReleaseReadiness.ps1 -Runtime win-x64
Then follow docs/manual-test-plan.md against the exact commit or published asset being released.
Documentation Ownership
The docs/ tree is source-authored documentation.
The docs sync workflow uses docs.site.json and .github/workflows/sync-docs.yml to mirror that tree into incursa-docs/src/content/docs/open-source/codex-telegram/. Edit the source files in this repository, not the mirrored copies in incursa-docs.
Known Gaps
- Live Telegram behavior still needs a real bot account and real credentials for validation.
- Group and forum-topic support is supported but higher risk than private chat; validate it separately before calling a release ready.
- Voice-note support depends on OpenAI and, when transcoding is needed,
ffmpeg. - The mirrored documentation tree is generated from this repository and should not be edited directly in the central docs repo.
Support And Security
For general open-source project questions, contact oss@incursa.com.
For security issues, use GitHub private vulnerability reporting when it is enabled for this repository. If that is unavailable, contact security@incursa.com. Do not include secrets, private transcripts, exploit details, or local credential paths in public issues.
More Documentation
User and operator docs:
- Getting started guide
- Documentation index
- Day-to-day usage
- Operations
- BotFather setup
- Command reference
- Menus and button reference
- Security
Developer and maintainer docs: