Setup guides: Telegram · Discord · Codex
Need to shower? Grab groceries? Go workout? Walk back from campus? Not without agentmaxxing you aren't.
Enter afk on your laptop, leave your desk, and talk to Codex from your phone through Telegram or Discord. You can send prompts, approve commands, trust approvals for the session, view diffs, and come back to the same Codex thread when you reopen your laptop.
CodeAFK is intentionally small: your laptop, Codex, and a chat app. There is no hosted relay, web dashboard, account system, login, or cloud sync. Just keep your laptop and phone online.
Communicate through:
- Telegram
- Discord
Code with:
- Codex
Star the project to stay up-to-date on future platform updates! In development: Cursor
Use CodeAFK when Codex is already working and you need to leave your desk.
- Keep steering a task from your phone or send a completely new prompt.
- Approve or deny shell commands remotely.
- Use
Approve & Trustto reduce repeated prompts for the current session. - Read summaries and phone-friendly diffs when Codex finishes a turn.
- Write
.codeafk/handoff.mdwhen you need to continue in a GUI agent later. - Resume the same Codex thread when you get back for seamless real-world environment switching.
FYI: This is not a mobile IDE. It is a remote control for the Codex session on your own laptop.
For normal use, install CodeAFK globally:
npm install -g codeafkThat makes afk available from any project on your laptop.
cd /path/to/your/project
afkYou can also install it inside one project:
npm install codeafk
npx afkA local install only gives that one project a copy. In that project, run it with npx afk.
Pick the chat app you want to use:
Codex setup notes are here:
After setup, enter 'afk' from the repo you want Codex to work in:
cd /path/to/your/project
afkIf you configured both Telegram and Discord, bare afk asks which channel to use. To skip the prompt, choose one explicitly:
afk telegram
afk discord- Run
afkfrom your project folder and pre-select Telegram or Discord. - Leave your desk, or use your normal closed-lid setup if your Mac supports it.
- While away, on your phone, send
/sessionsin your chat of choice. - Pick a project.
- Pick an existing Codex chat session, or reply
new. - Text the bot like you would text Codex.
- Approve, trust, or deny commands when Codex asks.
- All code changes are sent to your phone as .html and .diff files for review.
- Press
Ctrl+Cwhen you are back at your laptop.
AFK prints a codex resume <thread-id> command when it stops. Run that to continue the same thread locally.
AFK also writes .codeafk/handoff.md when it stops. Use that file when you want a GUI agent, such as Cursor, to pick up after a CLI-driven session.
On macOS, AFK starts caffeinate while it is running. That helps prevent idle sleep during Away Mode.
Closed-lid behavior still depends on your Mac, power, network, and sleep settings. Test your own setup before relying on it for a long errand.
Phone commands:
/help Show AFK commands
/status Show current workspace, thread, and Codex state
/handoff Write .codeafk/handoff.md for a GUI handoff
/sessions Choose a project and Codex session
/switch Switch to another project/session when Codex is idle
Terminal commands:
afk Start Away Mode in the current workspace
afk telegram Start Away Mode with Telegram, skipping channel selection
afk discord Start Away Mode with Discord, skipping channel selection
afk init Pair AFK with a channel
afk init telegram Pair Telegram
afk init discord Pair Discord
afk stop Stop Away Mode from another terminal
afk resume Stop Away Mode and print the Codex resume command
afk status Show current AFK status
Remote sessions use Codex approval_policy="untrusted" by default. AFK shows approval buttons when Codex asks to run something outside its trusted set.
To use your existing Codex approval settings instead:
afk --accept-agent-configAFK stores pairing data locally at ~/.config/afk/config.toml. Bot tokens stay on your machine.
pnpm install
pnpm check
pnpm build
pnpm pack:dry-runGive codeafk a try! Feedback welcome.
Do NOT use afk while driving.