I was at dinner when a colleague pinged me: "the staging deploy is failing, can you check the test suite?"
I didn't have my laptop. I had my phone and a Telegram bot connected to my dev machine.
I typed: /cx fix the failing test in tests/auth.test.js
Codex started running on my desktop. Two minutes later, my phone buzzed: "Task completed. Fixed assertion in auth.test.js line 42 — expected token format was outdated."
I went back to dinner.
Here's exactly how to set this up in 5 minutes.
What You Need
-
CliGate running on your machine (
npx cligate@latest start) - Codex CLI or Claude Code installed (CliGate's Tool Installer tab can do this for you)
- A Telegram account
That's it. No cloud server. No public IP. No ngrok.
Step 1: Create a Telegram Bot (1 minute)
Open Telegram, search for @botfather, and send:
/newbot
Give it a name and username. BotFather gives you a token like:
7123456789:AAH1234abcdefghijklmnopqrstuvwxyz
Copy that token.
Step 2: Configure CliGate Channels (1 minute)
Open http://localhost:8081 and go to the Channels tab.
Under Telegram:
- Paste your bot token
- Set Default Runtime Provider to
codex(orclaude-code— your preference) - Set Working Directory to your project path, e.g.
/home/you/projects/my-app - Toggle Enabled on
- Click Save
CliGate starts polling Telegram immediately. No webhook URL needed — it uses long-polling mode.
Step 3: Pair Your Phone (30 seconds)
Open your Telegram bot and send any message, like "hello".
The bot responds with a pairing code:
Pairing required. Code: 847291
Go back to the CliGate dashboard. Enter the pairing code in the Channels tab. Done — your Telegram account is now authorized.
Step 4: Send Your First Task (30 seconds)
Now the fun part. Send a message to your bot:
/cx analyze the error handling in src/server.js and suggest improvements
That's it. Here's what happens:
- CliGate receives the message
-
/cxtells the supervisor to use Codex as the runtime - Codex spawns on your desktop in headless mode
- Events stream back to Telegram: progress, commands, file changes
- When Codex finishes, you get a summary in Telegram
Want Claude Code instead? Use /cc:
/cc refactor the database connection pool in src/db.js
The Commands You Actually Need
| Command | What it does |
|---|---|
/cx <task> |
Start a Codex session |
/cc <task> |
Start a Claude Code session |
/new |
Detach current session, next message starts fresh |
/new cx <task> |
Start a new Codex session immediately |
/new cc <task> |
Start a new Claude Code session immediately |
/cancel |
Stop the running task |
| (plain text) | Continue the current session — follow-up messages stay attached |
You don't need to prefix every message with /cx. After starting a session, plain follow-up messages go to the same agent:
You: /cx fix the failing tests
Bot: Task accepted. Session abc123 started with Codex.
Bot: [... progress events ...]
Bot: Task completed. Fixed 3 assertions.
You: also update the test snapshots
Bot: Sent follow-up to session abc123.
Bot: [... continues in the same session ...]
The Part I Didn't Expect: It Understands What You Mean
This isn't a dumb message relay. CliGate has a supervisor layer that understands intent.
Status queries:
You: status?
Bot: Current task "fix auth tests" running with Codex.
2 files changed, 1 command executed.
You can wait for completion or send /cancel.
It recognizes "status", "progress", "done?", "进展如何", "做到哪了" — and answers from the remembered task state instead of forwarding your question to Codex as a new prompt.
Wrap-up summaries:
You: summarize
Bot: Task "fix auth tests" completed with Codex.
Changed: tests/auth.test.js (updated 3 assertions)
You can ask for a revision or start a related task.
Task switching:
You: start a new task: add input validation to the signup endpoint
Bot: Task accepted. Session def456 started with Codex.
It knows "start a new task" means detach the current session and begin fresh — without you needing /new.
Approval Bridging — the Killer Feature
When Claude Code or Codex needs permission to edit a file, the request shows up in Telegram:
Bot: 🔒 Codex wants to run: npm test
[Approve] [Deny]
Tap Approve. The agent continues.
But here's the clever part: CliGate remembers your approval. If you approve editing files in /src/, future requests for files in that same directory get auto-approved within the same session. No more tapping "Approve" twenty times for twenty files in the same folder.
Also Works With Feishu (飞书)
If your team uses Feishu instead of Telegram, CliGate supports it too.
The difference: Feishu can run in WebSocket mode — meaning it works on your local machine without a public URL. No ngrok, no cloud, no firewall config. Set Feishu Open Platform event subscription to persistent connection mode, and CliGate connects directly.
Same commands, same supervisor intelligence, same approval bridging.
What the Architecture Looks Like
Your Phone (Telegram / Feishu)
│
▼
Channel Gateway (long-polling / WebSocket)
│
▼
Supervisor Agent Layer
├── Intent detection (new task / follow-up / status / wrap-up)
├── Approval policy engine (remembers scoped permissions)
└── Task memory (structured brief per conversation)
│
▼
Agent Runtime (session manager)
├── Codex (headless JSONL events)
└── Claude Code (stream-json protocol)
│
▼
CliGate Proxy Core → Upstream AI APIs
Your phone sends text. The supervisor figures out what to do. The runtime executes. Results come back to your phone. The proxy handles all the API routing underneath.
Honest Caveats
- Your desktop machine needs to be running for this to work (it's localhost, not cloud)
- Long-running tasks can time out if your machine sleeps
- Feishu WebSocket mode requires a Feishu developer app (free to create, but takes 5 more minutes)
- Multi-step tasks with lots of approval requests work better with the web dashboard than Telegram
Try It
npx cligate@latest start
Open localhost:8081 → Channels tab → add your Telegram bot token → pair your phone → send /cx hello world.
That's the whole setup.
What's your remote development workflow? Do you SSH from your phone, use VS Code remote, or just wait until you're back at your desk? I'm curious how others handle the "not at my computer but need to fix something" problem.
GitHub: github.com/codeking-ai/cligate
CliGate is open-source under AGPL-3.0. Not affiliated with Anthropic, OpenAI, Google, or Telegram.
Top comments (1)
Happy to walk through the setup if anyone gets stuck. What's your current 'not at my desk but
need to fix something' workflow?