A global CLI tool that runs a Telegram bot for controlling Codex CLI on your Mac.
npm install -g codexremote
codexremoteOn first run, codexremote asks for:
- Telegram Bot Token
- Allowed Telegram User ID
- Default Project Directory, optional
- Codex permission mode, default
full-access
It validates the Telegram bot token, saves config under ~/.codexremote/, starts the Telegram bot in the background, then exits.
npm install
npm link
npm test
npm run lint
codexremotecodexremote
codexremote config
codexremote start
codexremote stop
codexremote restart
codexremote status
codexremote logs
codexremote commands
codexremote resetCodexRemote stores user-level files here:
~/.codexremote/
config.json
state.json
projects.json
tasks.json
bot.log
codex-runs/
uploads/
codexremote.pid
config.json is written with 0600 permissions when the filesystem supports it. The Telegram token is not printed in full after setup.
Codex run logs are stored in ~/.codexremote/codex-runs/.
- Create a bot with BotFather.
- Run
codexremote. - Enter the bot token.
- Enter your Telegram user ID.
- Open Telegram and send
/start.
Only the configured Telegram user ID can use the bot.
CodexRemote automatically registers Telegram bot commands on startup using Telegram Bot API setMyCommands.
After the bot starts, open the Telegram chat and type / to see available commands.
You can manually refresh commands with:
codexremote commandsManual BotFather command configuration is not required.
/start
/help
/setproject /Users/me/Projects/app
/newproject <Project name>
/addproject <alias> <absolute_path>
/use <alias>
/removeproject <alias>
/current
/projects
/plan <task>
/note <message>
/pending
/approve
/reject
/codex <task>
/login
/logout
/authstatus
/sessions
/sessions all
/resume <session_id>
/resume_last <task>
/history
/task <id>
/retry <id>
/scripts
/setscript <name> <command>
/runscript <name>
/settings
/doctor
/dev
/preview
/stopdev
/cancel
/status
/log
/stop
CodexRemote uses slash commands plus contextual inline buttons. Persistent Telegram reply buttons are removed so the chat input stays clean.
Guided flows are available for adding projects, creating plans, running Codex directly, adding notes, entering settings, and saving uploaded files. Use /cancel to exit the current wizard.
Projects can be saved with aliases:
/newproject My App
/addproject seller /Users/me/Projects/seller-agent
/use seller
/removeproject seller
/newproject <Project name> creates a new folder, saves it as a project, and activates it immediately. It uses the configured default project directory when available, otherwise ~/Projects. Names are converted to safe folder aliases, for example My App becomes my-app.
/projects shows project buttons. Older project data containing plain paths is migrated automatically.
/setproject /Users/me/Projects/app
/plan create landing page hiển thị thông tin luật đá bóng sân 7 bằng tiếng Việt, giao diện rõ ràng
/pending
/note dùng responsive mobile, giao diện đơn giản, có các mục: số cầu thủ, thời gian thi đấu, lỗi phổ biến, phạt, thay người
/approve
/log
/plan asks Codex to create a plan only and saves it as the pending plan. /note adds instructions. /approve runs implementation using the original task, saved plan, and notes. /reject clears the pending plan.
If a pending plan exists and you send normal text outside a wizard, CodexRemote asks whether to add it as a note.
CodexRemote supports inline buttons for quick mobile actions.
After /plan, you can tap:
- Approve
- Reject
- View Pending Plan
- Latest Log
During a running task, you can tap:
- Status
- Stop
- Latest Log
Authentication messages show contextual buttons too:
- Login when Codex is signed out
- Logout when Codex is signed in
- Auth Status while login is in progress
All text commands still work.
After tasks finish, CodexRemote shows quick action buttons such as View Log, Retry, Run Tests, Build, Changed Files, and Ask Codex to Fix.
/codex implement the requested change and run reasonable validation
Direct execution skips the approval workflow.
CodexRemote supports authentication commands:
/login
/logout
/authstatus
/login uses:
codex login --device-authThe bot sends the login URL/code to Telegram. Open it in your browser, complete sign-in, and the bot confirms when Codex is authenticated.
/logout runs:
codex logout/authstatus runs:
codex login statusCodexRemote stores task history in ~/.codexremote/tasks.json.
/history
/task <id>
/retry <id>
History includes task mode, project, status, timestamps, exit code, log file, and a short summary. Retry reruns the saved task when possible.
Configure or auto-detect common scripts:
/scripts
/setscript test npm test
/runscript test
CodexRemote can detect scripts from package.json, Makefile, go.mod, pom.xml, and pyproject.toml. Quick action buttons use scripts named test and build.
/settings
/doctor
Settings buttons support permission mode, Codex binary, message limit, log throttle, default project, and refreshing Telegram command suggestions. Changes are persisted to ~/.codexremote/config.json.
/doctor checks common setup problems, including Codex CLI availability, permission mode, configured Telegram user, default project directory, and active project path.
Send a supported file to the bot to save it under ~/.codexremote/uploads/. The bot shows actions to plan with the file, run Codex with the file, save it into the active project, or ignore it.
Supported file types include .txt, .md, .json, .yaml, .yml, .js, .ts, .tsx, .jsx, .py, .java, .go, .xml, .html, .css, .png, .jpg, .jpeg, and .webp.
/dev
/preview
/stopdev
/dev runs the active project's dev script in the background and stores dev server state in ~/.codexremote/state.json. /preview shows the detected localhost URL when available.
CodexRemote scans Codex output for quota, rate limit, authentication, and token limit errors. If detected, the bot sends a clear explanation and marks task history with statuses such as quota_limited, rate_limited, auth_error, or token_limit.
CodexRemote supports two permission modes. Configure this with:
codexremote configSafer mode:
codex exec --cd PROJECT_DIR --sandbox workspace-write "TASK"Codex can write inside the project sandbox.
Full permission mode:
codex exec --cd PROJECT_DIR --dangerously-bypass-approvals-and-sandbox "TASK"Full-access disables sandbox and approval prompts. Codex runs with the same permissions as your macOS user. Use only on trusted machines and trusted projects.
CodexRemote can list and resume recent Codex sessions from Telegram without opening Codex's interactive terminal picker.
/sessions
/sessions all
/resume <session_id>
/resume_last tiếp tục sửa lỗi build và chạy npm test
/sessions scans ~/.codex/sessions/, shows recent sessions, and adds Resume buttons. Button callbacks use a short cache stored in ~/.codexremote/state.json.
/resume <session_id> runs Codex with that exact session id through codex exec resume. /resume_last <task> uses Codex's --last mode with a non-interactive prompt. CodexRemote never runs plain interactive codex resume from Telegram.
CodexRemote always launches Codex with stdin ignored:
stdio: ['ignore', 'pipe', 'pipe']The bot does not send follow-up input to Codex through stdin. User decisions happen through Telegram commands such as /note, /approve, and /reject.
codexremote resetReset stops the bot and removes saved config/state/project references. Logs are kept by default unless you confirm deleting them.
- One Telegram user.
- One Codex process at a time.
- No database, PM2, Docker, webhook mode, or multi-user support.
- Codex CLI must be installed before
/plan,/approve, or/codexcan run successfully.