2025-07-27 22:59:51 +08:00
# Claude Code Remote
2025-07-27 02:22:12 +08:00
2025-07-27 22:59:51 +08:00
Control [Claude Code ](https://claude.ai/code ) remotely via email. Start tasks locally, receive notifications when Claude completes them, and send new commands by simply replying to emails.
2025-07-27 02:22:12 +08:00
2025-07-28 01:22:06 +08:00
< div align = "center" >
### 🎥 Watch Demo Video
2025-07-28 01:23:51 +08:00
< a href = "https://youtu.be/_yrNlDYOJhw" >
< img src = "./CCRemote_demo.png" alt = "Claude Code Remote Demo" width = "100%" >
< br >
< img src = "https://img.shields.io/badge/▶-Watch%20on%20YouTube-red?style=for-the-badge&logo=youtube" alt = "Watch on YouTube" >
< / a >
2025-07-28 01:22:06 +08:00
< / div >
2025-07-28 01:19:08 +08:00
2025-07-27 22:59:51 +08:00
> 🐦 Follow [@Jiaxi_Cui](https://x.com/Jiaxi_Cui) for updates and AI development insights
2025-07-27 02:22:12 +08:00
2025-07-27 22:59:51 +08:00
## ✨ Features
2025-07-27 02:22:12 +08:00
2025-07-27 22:59:51 +08:00
- **📧 Email Notifications**: Get notified when Claude completes tasks
- **🔄 Email Control**: Reply to emails to send new commands to Claude
- **📱 Remote Access**: Control Claude from anywhere with just email
- **🔒 Secure**: Whitelist-based sender verification
- **📋 Multi-line Support**: Send complex commands with formatting
2025-07-27 02:22:12 +08:00
2025-07-27 22:59:51 +08:00
## 🚀 Quick Start
2025-07-27 02:22:12 +08:00
2025-07-27 22:59:51 +08:00
### 1. Install
2025-07-27 02:22:12 +08:00
```bash
2025-07-27 22:33:32 +08:00
git clone https://github.com/JessyTsui/Claude-Code-Remote.git
cd Claude-Code-Remote
2025-07-27 15:27:24 +08:00
npm install
2025-07-27 22:28:44 +08:00
```
2025-07-27 22:59:51 +08:00
### 2. Configure Email
2025-07-27 22:28:44 +08:00
2025-07-27 22:33:32 +08:00
```bash
2025-07-27 22:59:51 +08:00
# Copy example config
2025-07-27 22:47:34 +08:00
cp .env.example .env
2025-07-27 22:59:51 +08:00
# Edit with your email credentials
2025-07-27 22:47:34 +08:00
nano .env
```
2025-07-27 22:59:51 +08:00
**Required settings:**
2025-07-27 22:28:44 +08:00
```env
2025-07-27 22:33:32 +08:00
SMTP_USER=your-email@gmail.com
2025-07-27 22:28:44 +08:00
SMTP_PASS=your-app-password
2025-07-27 22:47:34 +08:00
IMAP_USER=your-email@gmail.com
2025-07-27 22:28:44 +08:00
IMAP_PASS=your-app-password
2025-07-27 22:33:32 +08:00
EMAIL_TO=your-notification-email@gmail.com
ALLOWED_SENDERS=your-notification-email@gmail.com
2025-07-27 22:59:51 +08:00
SESSION_MAP_PATH=/your/path/to/Claude-Code-Remote/src/data/session-map.json
2025-07-27 02:22:12 +08:00
```
2025-07-27 22:59:51 +08:00
📌 **Gmail users** : Use [App Passwords ](https://myaccount.google.com/security ), not your regular password.
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
### 3. Configure Claude Code Hooks
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
Add to `~/.claude/settings.json` :
2025-07-27 22:28:44 +08:00
```json
{
"hooks": {
"Stop": [{
"matcher": "*",
"hooks": [{
"type": "command",
2025-07-27 22:59:51 +08:00
"command": "node /your/path/to/Claude-Code-Remote/claude-remote.js notify --type completed",
2025-07-27 22:28:44 +08:00
"timeout": 5
}]
}],
"SubagentStop": [{
"matcher": "*",
"hooks": [{
"type": "command",
2025-07-27 22:59:51 +08:00
"command": "node /your/path/to/Claude-Code-Remote/claude-remote.js notify --type waiting",
2025-07-27 22:28:44 +08:00
"timeout": 5
}]
}]
}
}
```
2025-07-27 22:59:51 +08:00
### 4. Start
2025-07-27 22:28:44 +08:00
```bash
2025-07-27 22:59:51 +08:00
# Start email monitoring
2025-07-27 22:28:44 +08:00
npm run relay:pty
2025-07-27 22:33:32 +08:00
2025-07-27 22:59:51 +08:00
# In another terminal, start Claude Code
2025-07-27 22:28:44 +08:00
tmux new-session -d -s my-project
tmux attach -t my-project
claude
```
2025-07-27 22:59:51 +08:00
## 🎮 How It Works
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
1. **Use Claude normally** in tmux session
2. **Get email notifications** when Claude completes tasks
3. **Reply to emails** with new commands
4. **Commands execute automatically** in Claude
2025-07-27 22:28:44 +08:00
2025-07-28 14:56:41 +08:00
📖 **Detailed Email Reply Guide** : [English ](./HOW_TO_USE_EMAIL_REPLY_EN.md ) | [中文 ](./HOW_TO_USE_EMAIL_REPLY.md )
2025-07-27 22:59:51 +08:00
### Example Email Flow
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
**📩 Notification received:**
2025-07-27 22:33:32 +08:00
```
2025-07-27 22:59:51 +08:00
Subject: Claude Code Remote Task Complete [#ABC123]
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
Claude completed: "Analyze the code structure"
[Claude's full response...]
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
Reply to send new commands.
2025-07-27 02:22:12 +08:00
```
2025-07-27 22:59:51 +08:00
**📨 Your reply:**
2025-07-27 02:22:12 +08:00
```
2025-07-27 22:59:51 +08:00
Please optimize the performance and fix any bugs you find.
2025-07-27 02:22:12 +08:00
```
2025-07-27 22:59:51 +08:00
**⚡ Result:** Your command automatically executes in Claude!
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
## 💡 Use Cases
2025-07-27 15:27:24 +08:00
2025-07-27 22:59:51 +08:00
- **Remote Code Reviews**: Start reviews at office, continue from home via email
- **Long-running Tasks**: Monitor progress and guide next steps remotely
- **Multi-location Development**: Control Claude from anywhere without VPN
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
## 🔧 Commands
2025-07-27 22:28:44 +08:00
2025-07-27 02:22:12 +08:00
```bash
2025-07-27 22:59:51 +08:00
# Test functionality
node claude-remote.js test
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
# Check status
2025-07-27 22:47:34 +08:00
node claude-remote.js status
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
# View pending commands
node claude-remote.js commands list
2025-07-27 02:22:12 +08:00
2025-07-27 22:59:51 +08:00
# Manage sessions
2025-07-27 15:27:24 +08:00
tmux list-sessions
2025-07-27 22:59:51 +08:00
tmux attach -t session-name
2025-07-27 02:22:12 +08:00
```
2025-07-27 22:59:51 +08:00
## 🔍 Troubleshooting
2025-07-27 22:28:44 +08:00
2025-07-27 22:59:51 +08:00
**Email not working?**
```bash
node claude-remote.js test # Test email setup
2025-07-27 22:28:44 +08:00
```
2025-07-27 22:59:51 +08:00
**Commands not injecting?**
2025-07-27 22:28:44 +08:00
```bash
2025-07-27 22:59:51 +08:00
tmux list-sessions # Check if session exists
grep ALLOWED_SENDERS .env # Verify sender whitelist
2025-07-27 22:28:44 +08:00
```
2025-07-27 22:59:51 +08:00
**Hooks not triggering?**
2025-07-27 22:28:44 +08:00
```bash
2025-07-27 22:59:51 +08:00
node claude-remote.js notify --type completed # Test manually
2025-07-27 15:27:24 +08:00
```
2025-07-27 22:59:51 +08:00
## 🛡️ Security
2025-07-27 22:33:32 +08:00
2025-07-27 22:59:51 +08:00
- ✅ **Sender Whitelist** : Only authorized emails can send commands
- ✅ **Session Isolation** : Each token controls only its specific session
- ✅ **Auto Expiration** : Sessions timeout automatically
2025-07-27 15:27:24 +08:00
2025-07-27 22:59:51 +08:00
## 🤝 Contributing
2025-07-27 15:27:24 +08:00
2025-07-27 22:59:51 +08:00
Found a bug or have a feature request?
2025-07-27 02:22:12 +08:00
2025-07-27 22:59:51 +08:00
- 🐛 **Issues** : [GitHub Issues ](https://github.com/JessyTsui/Claude-Code-Remote/issues )
- 🐦 **Updates** : Follow [@Jiaxi_Cui ](https://x.com/Jiaxi_Cui ) on Twitter
- 💬 **Discussions** : Share your use cases and improvements
2025-07-27 02:22:12 +08:00
2025-07-27 22:59:51 +08:00
## 📄 License
2025-07-27 02:22:12 +08:00
2025-07-27 22:59:51 +08:00
MIT License - Feel free to use and modify!
2025-07-27 02:22:12 +08:00
---
2025-07-27 22:59:51 +08:00
**🚀 Make Claude Code truly remote and accessible from anywhere!**
⭐ **Star this repo** if it helps you code more efficiently!
2025-07-27 02:22:12 +08:00
2025-07-27 22:59:51 +08:00
> 💡 **Tip**: Share your remote coding setup on Twitter and tag [@Jiaxi_Cui](https://x.com/Jiaxi_Cui) - we love seeing how developers use Claude Code Remote!