Control Claude Code remotely via email、discord、telegram. Start tasks locally, receive notifications when Claude completes them, and send new commands by simply
Control Claude Code remotely via email、discord、telegram. Start tasks locally, receive notifications when Claude completes them, and send new commands by simply
Control Claude Code remotely via multiple messaging platforms. Start tasks locally, receive notifications when Claude completes them, and send new commands by simply replying to messages.
Supported Platforms:
Follow @Jiaxi_Cui for updates and AI development insights
System Requirements:
git clone https://github.com/JessyTsui/Claude-Code-Remote.git
cd Claude-Code-Remote
npm installnpm run setup.env~/.claude/settings.json.env,见下方“手动配置”npm run setup)# Copy example config
cp .env.example .env
# Edit with your email credentials
nano .envRequired email settings:
EMAIL_ENABLED=true
[email protected]
SMTP_PASS=your-app-password
[email protected]
IMAP_PASS=your-app-password
[email protected]
[email protected]
SESSION_MAP_PATH=/your/path/to/Claude-Code-Remote/src/data/session-map.jsonGmail users: Use App Passwords, not your regular password.
Quick Setup:
chmod +x setup-telegram.sh
./setup-telegram.shManual Setup:
Required Telegram settings:
TELEGRAM_ENABLED=true
TELEGRAM_BOT_TOKEN=your-bot-token-here
TELEGRAM_CHAT_ID=your-chat-id-here
TELEGRAM_WEBHOOK_URL=https://your-ngrok-url.app
SESSION_MAP_PATH=/your/path/to/Claude-Code-Remote/src/data/session-map.jsonOptional Telegram settings:
# Force IPv4 connections to Telegram API (default: false)
# Enable this if you experience connectivity issues with IPv6
TELEGRAM_FORCE_IPV4=trueNetwork Configuration Notes:
TELEGRAM_FORCE_IPV4=true:Required LINE settings:
LINE_ENABLED=true
LINE_CHANNEL_ACCESS_TOKEN=your-token
LINE_CHANNEL_SECRET=your-secret
LINE_USER_ID=your-user-idnpm run setup 时需要)Create hooks configuration file:
Method 1: Global Configuration (Recommended)
# Add to ~/.claude/settings.json
{
"hooks": {
"Stop": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "node /your/path/to/Claude-Code-Remote/claude-hook-notify.js completed",
"timeout": 5
}]
}],
"SubagentStop": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "node /your/path/to/Claude-Code-Remote/claude-hook-notify.js waiting",
"timeout": 5
}]
}]
}
}Method 2: Project-Specific Configuration
# Set environment variable
export CLAUDE_HOOKS_CONFIG=/your/path/to/Claude-Code-Remote/claude-hooks.jsonNote: Subagent notifications are disabled by default. To enable them, set
enableSubagentNotifications: truein your config. See Subagent Notifications Guide for details.
claude-code --config /path/to/your/claude/settings.jsontmux new-session -d -s claude-session
tmux attach-session -t claude-session
claude-code --config /path/to/your/claude/settings.jsonDetach: Ctrl+B 然后 D
Note: Interactive setup 已合并 hooks 到
~/.claude/settings.json。若跳过,请确保手动配置 hooks。
# Automatically starts all enabled platforms
npm run webhooks
# or
node start-all-webhooks.jsFor Email:
npm run daemon:start
# or
node claude-remote.js daemon startFor Telegram:
npm run telegram
# or
node start-telegram-webhook.jsFor LINE:
npm run line
# or
node start-line-webhook.jsQuick Test:
# Test all notification channels
node claude-hook-notify.js completed
# Should receive notifications via all enabled platformsFull Test:
Email:
Simply reply to notification email with your command
No special formatting requiredTelegram: ✅ NEW
Click smart button to get format:
Personal Chat: /cmd TOKEN123 your command here
Group Chat: @bot_name /cmd TOKEN123 your command hereLINE:
Reply to notification with: Your command here
(Token automatically extracted from conversation context)Local fallback (no tmux)
INJECTION_MODE=pty:命令通过 PTY/智能粘贴注入,不依赖 tmux Email Notification Options
Subagent Activities in Email
By default, email notifications only show the execution trace. You can optionally enable a separate subagent activities summary section:
// In your config/config.json
{
"showSubagentActivitiesInEmail": true // Default: false
}When enabled, emails will include:
Since the execution trace already contains all information, this feature is disabled by default to keep emails concise.
Execution Trace Display
You can control whether to include the execution trace in email notifications:
// In your email channel configuration
{
"email": {
"config": {
"includeExecutionTrace": false // Default: true
}
}
}true (default): Shows a scrollable execution trace section in emailsfalse: Removes the execution trace section entirely from emailsThis is useful if you find the execution trace too verbose or if your email client has issues with scrollable content.
npm run setup # Interactive wizard to create .env and merge hooks into ~/.claude/settings.json# Test all notification channels
node claude-hook-notNo open issues yet, or sync has not completed.