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" >
2025-08-01 13:31:54 +08:00
< img src = "./assets/CCRemote_demo.png" alt = "Claude Code Remote Demo" width = "100%" >
2025-07-28 01:23:51 +08:00
< 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-08-01 13:31:54 +08:00
- **📧 Email Notifications**: Get notified when Claude completes tasks 
2025-07-27 22:59:51 +08:00
- **🔄 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-08-01 13:31:54 +08:00
## 📅 Changelog
2025-08-01 16:36:33 +08:00
### August 2025
2025-08-01 14:49:48 +08:00
- **2025-08-01**: Implement terminal-style UI for email notifications ([#8](https://github.com/JessyTsui/Claude-Code-Remote/pull/8) by [@vaclisinc ](https://github.com/vaclisinc ))
- **2025-08-01**: Fix working directory issue - enable claude-remote to run from any directory ([#7](https://github.com/JessyTsui/Claude-Code-Remote/pull/7) by [@vaclisinc ](https://github.com/vaclisinc ))
2025-08-01 13:31:54 +08:00
### July 2025
2025-08-01 16:36:33 +08:00
- **2025-07-31**: Fix self-reply loop issue when using same email for send/receive ([#4](https://github.com/JessyTsui/Claude-Code-Remote/pull/4) by [@vaclisinc ](https://github.com/vaclisinc ))
2025-08-01 13:31:54 +08:00
- **2025-07-28**: Remove hardcoded values and implement environment-based configuration ([#2](https://github.com/JessyTsui/Claude-Code-Remote/pull/2) by [@kevinsslin ](https://github.com/kevinsslin ))
## 📋 TODO List
### Notification Channels
- [ ] **Discord & Telegram** : Bot integration for messaging platforms
- [ ] **Slack Workflow** : Native Slack app with slash commands
### Developer Tools
- [ ] **AI Tools** : Support for Gemini CLI, Cursor, and other AI tools
- [ ] **Git Automation** : Auto-commit, PR creation, branch management
### Usage Analytics
- [ ] **Cost Tracking** : Token usage and estimated costs
- [ ] **Performance Metrics** : Execution time and resource usage
- [ ] **Scheduled Reports** : Daily/weekly usage summaries via email
### Native Apps
- [ ] **Mobile Apps** : iOS and Android applications
- [ ] **Desktop Apps** : macOS and Windows native clients
## 🚀 Setup Guide
Follow these steps to get Claude Code Remote running:
### Step 1: Clone and Install Dependencies
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-08-01 13:31:54 +08:00
### Step 2: Configure Email Settings
2025-07-27 22:28:44 +08:00
2025-07-27 22:33:32 +08:00
```bash
2025-08-01 13:31:54 +08:00
# Copy the example configuration
2025-07-27 22:47:34 +08:00
cp .env.example .env
2025-08-01 13:31:54 +08:00
# Open .env in your editor
nano .env # or use vim, code, etc.
2025-07-27 22:47:34 +08:00
```
2025-08-01 13:31:54 +08:00
Edit the `.env` file with your email credentials:
2025-07-27 22:28:44 +08:00
```env
2025-08-01 13:31:54 +08:00
# Email account for sending notifications
2025-07-27 22:33:32 +08:00
SMTP_USER=your-email@gmail.com
2025-08-01 13:31:54 +08:00
SMTP_PASS=your-app-password # Gmail: use App Password, not regular password
# Email account for receiving replies (can be same as SMTP)
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-08-01 13:31:54 +08:00
# Where to send notifications
2025-07-27 22:33:32 +08:00
EMAIL_TO=your-notification-email@gmail.com
2025-08-01 13:31:54 +08:00
# Who can send commands (security whitelist)
2025-07-27 22:33:32 +08:00
ALLOWED_SENDERS=your-notification-email@gmail.com
2025-08-01 13:31:54 +08:00
# Path to session data (use absolute path)
SESSION_MAP_PATH=/your/absolute/path/to/Claude-Code-Remote/src/data/session-map.json
2025-07-27 02:22:12 +08:00
```
2025-08-01 13:31:54 +08:00
📌 **Gmail users** : Create an [App Password ](https://myaccount.google.com/security ) instead of using your regular password.
2025-08-01 14:49:48 +08:00
> Note: You may need to enable two-step verification in your google account first before create app password.
2025-08-01 13:31:54 +08:00
### Step 3: Set Up Claude Code Hooks
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
Open Claude's settings file:
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
```bash
# Create the directory if it doesn't exist
mkdir -p ~/.claude
# Edit settings.json
nano ~/.claude/settings.json
```
Add this configuration (replace `/your/absolute/path/` with your actual path):
2025-07-27 22:28:44 +08:00
```json
{
"hooks": {
"Stop": [{
"matcher": "*",
"hooks": [{
"type": "command",
2025-08-01 13:31:54 +08:00
"command": "node /your/absolute/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-08-01 13:31:54 +08:00
"command": "node /your/absolute/path/to/Claude-Code-Remote/claude-remote.js notify --type waiting",
2025-07-27 22:28:44 +08:00
"timeout": 5
}]
}]
}
}
```
2025-08-01 14:49:48 +08:00
> **Note**: Subagent notifications are disabled by default. To enable them, set `enableSubagentNotifications: true` in your config. See [Subagent Notifications Guide](./docs/SUBAGENT_NOTIFICATIONS.md) for details.
2025-08-01 13:31:54 +08:00
### Step 4: Test Your Setup
```bash
# Test email configuration
node claude-remote.js test
```
You should receive a test email. If not, check your email settings.
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
### Step 5: Start Claude Code Remote
**Terminal 1 - Start email monitoring:**
2025-07-27 22:28:44 +08:00
```bash
npm run relay:pty
2025-08-01 13:31:54 +08:00
```
2025-07-27 22:33:32 +08:00
2025-08-01 13:31:54 +08:00
Keep this running. You should see:
```
🚀 Claude Code Remote is running!
📧 Monitoring emails...
```
**Terminal 2 - Start Claude in tmux:**
```bash
# Create a new tmux session
tmux new-session -s my-project
# Inside tmux, start Claude
2025-07-27 22:28:44 +08:00
claude
```
2025-08-01 13:31:54 +08:00
### Step 6: You're Ready!
1. Use Claude normally in the tmux session
2. When Claude completes a task, you'll receive an email
3. Reply to the email with new commands
4. Your commands will execute automatically in Claude
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
### Verify Everything Works
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
In Claude, type:
```
What is 2+2?
```
2025-07-28 14:56:41 +08:00
2025-08-01 13:31:54 +08:00
Wait for Claude to respond, then check your email. You should receive a notification!
## 📖 How to Use
### Email Notifications
When Claude completes a task, you'll receive an email notification:
2025-07-27 22:28:44 +08:00
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-08-01 13:31:54 +08:00
Claude completed: "analyze the code structure"
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
[Claude's full response here...]
Reply to this email to send new commands.
2025-07-27 02:22:12 +08:00
```
2025-08-01 13:31:54 +08:00
### Sending Commands via Email Reply
1. **Direct Reply** : Simply reply to the notification email
2. **Write Command** : Type your command in the email body:
```
Please refactor the main function and add error handling
```
3. **Send** : Your command will automatically execute in Claude!
### Advanced Email Features
**Multi-line Commands**
2025-07-27 02:22:12 +08:00
```
2025-08-01 13:31:54 +08:00
First analyze the current code structure.
Then create a comprehensive test suite.
Finally, update the documentation.
2025-07-27 02:22:12 +08:00
```
2025-08-01 13:31:54 +08:00
**Complex Instructions**
```
Refactor the authentication module with these requirements:
- Use JWT tokens instead of sessions
- Add rate limiting
- Implement refresh token logic
- Update all related tests
```
### Email Reply Workflow
1. **Receive Notification** → You get an email when Claude completes a task
2. **Reply with Command** → Send your next instruction via email reply
3. **Automatic Execution** → The system extracts your command and injects it into Claude
4. **Get Results** → Receive another email when the new task completes
### Supported Email Clients
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
Works with any email client that supports standard reply functionality:
- ✅ Gmail (Web/Mobile)
- ✅ Apple Mail
- ✅ Outlook
- ✅ Any SMTP-compatible email client
2025-07-27 15:27:24 +08:00
Add full execution trace in email notifications (#11) (#14)
* Add configuration option to disable subagent notifications
- Added 'enableSubagentNotifications' config option (default: false)
- Modified notification handler to check config before sending subagent notifications
- Created documentation explaining the feature
- Updated README with note about subagent notifications
This addresses the issue where frequent subagent notifications can be distracting.
Users can now control whether they receive notifications when subagents stop/start.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add subagent activity tracking in completion emails
- Track subagent activities instead of sending individual notifications
- Include subagent activity summary in completion emails
- Update email templates to display subagent activities
- Add SubagentTracker utility to manage activity tracking
- Update documentation to explain the new behavior
This provides a better user experience by:
1. Reducing notification noise from frequent subagent activities
2. Still providing full visibility into what subagents did
3. Consolidating all information in the completion email
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Improve subagent activity details and documentation
- Enhanced activity capture to include up to 1000 characters (was 200)
- Improved email display format with better visual separation
- Added detection for initialization-only captures with helpful message
- Added configuration option for activity detail level
- Created comprehensive documentation explaining the timing limitation
- Added visual indicators for processing status
This addresses the issue where subagent outputs were truncated or only
showed initialization messages. Users now get better visibility into
what subagents are doing, with clear indication when full output is
available in tmux.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* delete redundant files and modify README
* Fix HTML escaping in email notifications
- Add _escapeHtml function to properly escape HTML entities in emails
- Escape user-generated content to prevent HTML tags from being hidden
- Fix issue where <developer> and other HTML-like strings disappeared in emails
- Apply escaping to both main email content and subagent activity summaries
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add full execution trace to email notifications
- Add getFullExecutionTrace method to capture complete terminal output
- Include execution trace in a scrollable section within emails
- Add CSS styling for visible scrollbars on desktop
- Clean trace output by removing command prompt boxes
- Add fallback message when trace is not available
This addresses issue #11 - providing transparency about task execution
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Redesign email notification UI with improved terminal aesthetics
- Reorganize content hierarchy: user request at top, response second, trace at bottom
- Preserve terminal-style commands ($ cat, $ claude-code execute, etc.)
- Remove redundant session info footer
- Implement smart execution trace capture from user input to completion
- Add TraceCapture utility to track user input timestamps
- Improve visual hierarchy while maintaining terminal aesthetics
- Use border colors (orange for user, green for success) for better distinction
- Make execution trace collapsible and de-emphasized
This improves readability while preserving the terminal charm of the project.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix execution trace filtering to show only recent activity
- Change filter logic to find LAST user input instead of first
- Search backwards through content to find most recent "> " prompt
- Only include content from that point forward
- Add fallback to show last 100 lines if no user input found
- This ensures trace shows only relevant recent execution, not entire history
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Remove duplicate content from execution trace
- Skip the first user input line (already shown in main content)
- Skip the last Claude response (already shown in main content)
- Only show intermediate execution steps and tool usage
- Clean up empty lines at beginning and end
- This avoids redundancy and focuses trace on execution details
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix execution trace to properly remove complete user input and output
- Track multi-line user input and skip all continuation lines
- Detect when user input ends (empty line or next command)
- Stop before the last Claude response to avoid truncation
- Only show intermediate execution steps between input and output
This ensures the trace shows the complete execution process without
duplicating content already displayed in the main sections.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix multi-line user input capture and trace filtering
- Capture complete multi-line user input (not just first line)
- Join continuation lines with spaces for proper display
- Preserve all execution details in trace (tool calls, outputs)
- Only skip user input and final response, keep everything in between
* Add configuration toggle for subagent activities in email
- Added 'showSubagentActivitiesInEmail' config option (default: false)
- Modified claude-remote.js to check config before including subagent activities
- Created documentation explaining the configuration
- Allows users to choose between concise emails (execution trace only) or detailed emails (both summaries)
This addresses the redundancy between execution trace and subagent activities summary,
giving users control over email content.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix Git merge conflict in email template and document subagent config
- Removed Git merge conflict markers from email text template
- Added documentation for showSubagentActivitiesInEmail config in README
- Explained that subagent activities are disabled by default for concise emails
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update README changelog for PR #10 and issue #11
- Added entry for subagent notifications configuration (PR #10)
- Added entry for execution trace feature (issue #11)
- Maintained chronological order in changelog
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* delete redundant files
* fix #15: add local database into .gitignore
* Fix execution trace display in email notifications
- Remove collapsible details tag for better email client compatibility
- Add configuration option to toggle execution trace display
- Fix HTML escaping issue for executionTraceSection variable
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Remove data files from git tracking
These session-specific data files should not be tracked in version control
as they are machine-specific and cause issues when pulling on other machines.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix typo(?) in changelog (#13)
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Naich <an.naich@gmail.com>
Co-authored-by: JessyTsui <51992423+JessyTsui@users.noreply.github.com>
2025-08-02 04:07:34 +08:00
### Advanced Configuration
**Email Notification Options**
1. **Subagent Activities in Email**
By default, email notifications only show the execution trace. You can optionally enable a separate subagent activities summary section:
```json
// In your config/config.json
{
"showSubagentActivitiesInEmail": true // Default: false
}
```
When enabled, emails will include:
- **Subagent Activities Summary**: A structured list of all subagent activities
- **Full Execution Trace**: The complete terminal output
Since the execution trace already contains all information, this feature is disabled by default to keep emails concise.
2. **Execution Trace Display**
You can control whether to include the execution trace in email notifications:
```json
// In your email channel configuration
{
"email": {
"config": {
"includeExecutionTrace": false // Default: true
}
}
}
```
- When `true` (default): Shows a scrollable execution trace section in emails
- When `false` : Removes the execution trace section entirely from emails
This is useful if you find the execution trace too verbose or if your email client has issues with scrollable content.
2025-08-01 13:31:54 +08:00
## 💡 Common Use Cases
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
- **Remote Development**: Start coding at the office, continue from home via email
- **Long Tasks**: Let Claude work while you're in meetings, check results via email
- **Team Collaboration**: Share Claude sessions by forwarding notification emails
## 🔧 Useful Commands
2025-07-27 22:28:44 +08:00
2025-07-27 02:22:12 +08:00
```bash
2025-08-01 13:31:54 +08:00
# Test email setup
2025-07-27 22:59:51 +08:00
node claude-remote.js test
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
# Check system status
2025-07-27 22:47:34 +08:00
node claude-remote.js status
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
# View tmux sessions
2025-07-27 15:27:24 +08:00
tmux list-sessions
2025-08-01 13:31:54 +08:00
tmux attach -t my-project
# Stop email monitoring
# Press Ctrl+C in the terminal running npm run relay:pty
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-08-01 13:31:54 +08:00
**Not receiving emails?**
- Run `node claude-remote.js test` to test email setup
- Check spam folder
- Verify SMTP settings in `.env`
- For Gmail: ensure you're using App Password
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
**Commands not executing?**
- Ensure tmux session is running: `tmux list-sessions`
- Check sender email matches `ALLOWED_SENDERS` in `.env`
- Verify Claude is running inside tmux
2025-07-27 22:28:44 +08:00
2025-08-01 13:31:54 +08:00
**Need help?**
- Check [Issues ](https://github.com/JessyTsui/Claude-Code-Remote/issues )
- Follow [@Jiaxi_Cui ](https://x.com/Jiaxi_Cui ) for updates
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!**
2025-07-28 15:24:51 +08:00
## ⭐ Star History
[](https://star-history.com/#JessyTsui/Claude-Code-Remote& Date)
2025-07-27 22:59:51 +08:00
⭐ **Star this repo** if it helps you code more efficiently!
2025-07-27 02:22:12 +08:00
2025-08-01 16:36:33 +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!