A simplified fork of Claude-Code-Remote focused on Telegram + tmux workflow. Control Claude Code remotely from your phone — just send a message, get a clean reply. No tokens, no complex commands.
What's Different from the Original
| Feature | Original | This Version |
|---|---|---|
| Send commands | /cmd TOKEN command |
Just type your message |
| Notifications | Verbose (project, token, question, response, buttons) | Clean Claude response only |
| Multi-instance | All Claude instances trigger notifications | Only the designated tmux session triggers |
| Response content | Raw terminal output with UI artifacts | Filtered, clean text |
| Startup | Multiple manual steps | One-click ./start.sh |
Prerequisites
- Node.js >= 14.0.0
- tmux (
brew install tmux) - ngrok (
brew install ngrok) with a free account - terminal-notifier (optional, for macOS desktop notifications:
brew install terminal-notifier)
Quick Start
1. Clone & Install
git clone https://github.com/sunxvecong/Claude-Code-Remote-Tel.git
cd Claude-Code-Remote-Tel
npm install2. Create Telegram Bot
- Open Telegram, search for
@BotFather - Send
/newbot, follow the prompts - Save the Bot Token you receive
3. Get Your Chat ID
Search for @userinfobot on Telegram, send it a message, it will reply with your Chat ID.
4. Configure
Edit .env and fill in:
TELEGRAM_BOT_TOKEN=your-bot-token TELEGRAM_CHAT_ID=your-chat-id TELEGRAM_WHITELIST=your-chat-id SESSION_MAP_PATH=/full/path/to/Claude-Code-Remote-Tel/src/data/session-map.json
5. Configure ngrok
ngrok config add-authtoken YOUR_NGROK_AUTHTOKEN
6. Configure Claude Code Hooks
Add to ~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "if [ -n \"$TMUX\" ]; then node /full/path/to/Claude-Code-Remote-Tel/claude-hook-notify.js completed; fi",
"timeout": 5
}
]
}
]
}
}The
if [ -n "$TMUX" ]check ensures only the Claude instance running inside tmux triggers notifications. Other Claude instances on your machine will not send Telegram messages.
7. Create Symlinks (macOS with Homebrew)
If you installed tmux and terminal-notifier via Homebrew on Apple Silicon:
sudo ln -sf /opt/homebrew/bin/tmux /usr/local/bin/tmux sudo ln -sf /opt/homebrew/bin/terminal-notifier /usr/local/bin/terminal-notifier
This ensures hook scripts (which run via /bin/sh) can find these commands.
8. Launch
This one command will:
- Create a tmux session named
claude-teland start Claude in it - Start ngrok tunnel (port 3001)
- Automatically set the Telegram webhook URL
- Start the webhook server
Daily Usage
Start everything
cd ~/Claude-Code-Remote-Tel && ./start.sh
View Claude conversation
tmux attach -t claude-tel
Press Ctrl+B then D to detach (Claude keeps running).
Send commands from Telegram
Just type your message to the bot. That's it.
What you'll see
You: analyze this code for bugs
Bot: ✅ Claude-Code-Remote-Tel
I've analyzed the code and found 3 potential issues...
How It Works
┌──────────┐ ┌─────────┐ ┌──────────┐ ┌─────────────┐
│ Telegram │ ──> │ ngrok │ ──> │ Webhook │ ──> │ tmux: │
│ App │ │ tunnel │ │ Server │ │ claude-tel │
│ │ <── │ │ <── │ (:3001) │ <── │ (Claude) │
└──────────┘ └─────────┘ └──────────┘ └─────────────┘
│
Stop Hook ───────┘
(only if $TMUX is set)
- You send a message on Telegram
- Telegram forwards it to your ngrok public URL
- The webhook server receives it and injects the text into the tmux session
- Claude processes it and responds in the terminal
- When Claude stops, the Stop hook fires, captures the response from tmux
- The response is sent back to you on Telegram
Command Formats
All three formats are supported:
| Format | Example | Description |
|---|---|---|
| Direct message | analyze this code |
Recommended. Injects directly to tmux |
| Token shorthand | H6XFF125 analyze this code |
Uses session token |
| Full command | /cmd H6XFF125 analyze this code |
Original format |
Troubleshooting
Telegram bot doesn't respond
- Check if ngrok is running:
curl http://127.0.0.1:4040/api/tunnels - Check if webhook server is running:
curl http://127.0.0.1:3001/health - Restart with
./start.sh
Duplicate notifications
- Make sure the hook in
settings.jsonuses the$TMUXcheck - Restart all Claude instances after changing
settings.json
"Tmux session not found" error
- Verify session exists:
tmux list-sessions - Session should be named
claude-tel
Response contains terminal artifacts
- The tmux-monitor filters most UI elements automatically
- If you see new artifacts, add filter patterns in
src/utils/tmux-monitor.js
ngrok URL changed after restart
- Run
./start.shagain — it automatically re-sets the webhook URL
Customization
Change tmux session name
Edit these three places:
start.sh— change allclaude-telreferencessrc/channels/telegram/webhook.js— line withinjectCommand(messageText, 'claude-tel')- Rename existing session:
tmux rename-session -t old-name new-name
Adjust response length
In src/channels/telegram/telegram.js, find substring(0, 500) and change the limit.
Credits
Based on Claude-Code-Remote by JessyTsui. Simplified for Telegram-only usage with cleaner notifications and direct messaging support.
License
MIT