2025-07-27 17:17:15 +08:00
# TaskPing - Intelligent Email Automation Assistant for Claude Code
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
TaskPing is an intelligent email automation tool that deeply integrates Claude Code with email systems. By monitoring email replies, it automatically inputs reply content into corresponding Claude Code sessions for execution, allowing you to remotely control Claude Code from anywhere via email.
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
## 🚀 Core Features
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
### 📧 Smart Email Notifications
- **Auto Detection**: Based on Claude Code official hooks mechanism, automatically identifies task completion and waiting input states
- **Real-time Notifications**: Automatically sends emails when tasks complete, including complete user questions and Claude responses
- **Session Binding**: Emails are bound to specific tmux sessions, ensuring replies go to the correct Claude Code window
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
### 🔄 Email Reply Auto-Execution
- **Remote Control**: Directly reply to emails, content automatically inputs into corresponding Claude Code sessions
- **Smart Injection**: Automatically detects tmux session state, precisely injects commands into correct windows
- **Duplicate Prevention**: Implements email deduplication mechanism to avoid processing the same email twice
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
### 🛡️ Stability Assurance
- **Single Instance**: Ensures only one email monitoring process runs, avoiding duplicate processing
- **State Management**: Comprehensive session state tracking and error recovery mechanisms
- **Security Verification**: Email source verification, ensures only authorized user replies are processed
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
## 📦 Quick Installation
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
### 1. Clone Project
2025-07-27 02:22:12 +08:00
```bash
2025-07-27 17:17:15 +08:00
git clone https://github.com/JessyTsui/TaskPing.git
2025-07-27 02:22:12 +08:00
cd TaskPing
2025-07-27 15:27:24 +08:00
npm install
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
### 2. Configure Email
2025-07-27 02:22:12 +08:00
```bash
2025-07-27 15:27:24 +08:00
npm run config
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
Follow prompts to configure your email information (SMTP and IMAP).
2025-07-27 15:27:24 +08:00
2025-07-27 17:17:15 +08:00
### 3. Configure Claude Code Hooks
Add the following content to the `hooks` section of `~/.claude/settings.json` :
2025-07-27 02:22:12 +08:00
```json
{
"hooks": {
"Stop": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "node /path/to/TaskPing/taskping.js notify --type completed",
"timeout": 5
}]
}],
"SubagentStop": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "node /path/to/TaskPing/taskping.js notify --type waiting",
"timeout": 5
}]
}]
}
}
```
2025-07-27 17:17:15 +08:00
### 4. Install Global claude-control Command
2025-07-27 02:22:12 +08:00
```bash
2025-07-27 15:27:24 +08:00
node install-global.js
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
### 5. Start Email Monitoring Service
2025-07-27 02:22:12 +08:00
```bash
2025-07-27 15:27:24 +08:00
npm run relay:pty
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
## 🎮 Usage
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
### 1. Create Claude Code Session
2025-07-27 15:27:24 +08:00
```bash
2025-07-27 17:17:15 +08:00
# Can run from any directory
2025-07-27 15:27:24 +08:00
claude-control --session project-name
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
### 2. Use Claude Code Normally
Have normal conversations with Claude in tmux session:
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
> Please help me analyze the code structure of this project
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
Claude responds...
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
### 3. Automatic Email Notifications
When Claude completes tasks, you'll receive email notifications containing complete conversation content.
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
### 4. Email Reply Control
Directly reply to emails with your next instruction:
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
Please continue optimizing code performance
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
### 5. Automatic Execution
Your reply will be automatically injected into the corresponding Claude Code session and executed.
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
## 🔧 Project Architecture
2025-07-27 02:22:12 +08:00
```
2025-07-27 15:27:24 +08:00
TaskPing/
├── src/
│ ├── channels/email/
2025-07-27 17:17:15 +08:00
│ │ └── smtp.js # SMTP email sending
2025-07-27 15:27:24 +08:00
│ ├── core/
2025-07-27 17:17:15 +08:00
│ │ ├── config.js # Configuration management
│ │ ├── logger.js # Logging system
│ │ └── notifier.js # Notification coordinator
2025-07-27 15:27:24 +08:00
│ ├── data/
2025-07-27 17:17:15 +08:00
│ │ ├── session-map.json # Session mapping table
│ │ └── processed-messages.json # Processed email records
2025-07-27 15:27:24 +08:00
│ ├── relay/
2025-07-27 17:17:15 +08:00
│ │ └── relay-pty.js # Email monitoring and PTY injection service
2025-07-27 15:27:24 +08:00
│ └── utils/
2025-07-27 17:17:15 +08:00
│ └── tmux-monitor.js # Tmux session monitoring
├── taskping.js # Main entry file
├── claude-control.js # Claude Code session management
├── start-relay-pty.js # Email monitoring service starter
└── install-global.js # Global installation script
2025-07-27 15:27:24 +08:00
```
2025-07-27 17:17:15 +08:00
## 🛠️ Core Technical Implementation
2025-07-27 15:27:24 +08:00
2025-07-27 17:17:15 +08:00
### Email Monitoring and Processing
- Uses `node-imap` to monitor IMAP mailbox for new emails
- Implements email deduplication mechanism (based on UID, messageId, and content hash)
- Asynchronous event handling to avoid race conditions
2025-07-27 15:27:24 +08:00
2025-07-27 17:17:15 +08:00
### Session Management
- Tmux session auto-detection and command injection
- Session state persistent storage
- Support for concurrent multi-session processing
2025-07-27 15:27:24 +08:00
2025-07-27 17:17:15 +08:00
### Notification System
- Automatically captures current tmux session's user questions and Claude responses
- Generates email notifications containing complete conversation content
- Supports multiple notification channels (desktop notifications, email, etc.)
2025-07-27 15:27:24 +08:00
2025-07-27 17:17:15 +08:00
## 🔍 Troubleshooting
2025-07-27 15:27:24 +08:00
2025-07-27 17:17:15 +08:00
### Email Duplicate Processing Issue
Ensure only one email monitoring process is running:
2025-07-27 02:22:12 +08:00
```bash
2025-07-27 17:17:15 +08:00
# Check running status
2025-07-27 15:27:24 +08:00
ps aux | grep relay-pty
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
# Stop all processes
2025-07-27 15:27:24 +08:00
pkill -f relay-pty
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
# Restart
2025-07-27 15:27:24 +08:00
npm run relay:pty
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
### Command Injection Failure
Check tmux session status:
2025-07-27 15:27:24 +08:00
```bash
2025-07-27 17:17:15 +08:00
# View all sessions
2025-07-27 15:27:24 +08:00
tmux list-sessions
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
# Check session content
2025-07-27 15:27:24 +08:00
tmux capture-pane -t session-name -p
2025-07-27 02:22:12 +08:00
```
2025-07-27 17:17:15 +08:00
### Email Configuration Issues
Test email connection:
2025-07-27 15:27:24 +08:00
```bash
2025-07-27 17:17:15 +08:00
# Test SMTP
2025-07-27 15:27:24 +08:00
node -e "
const config = require('./config/user.json');
console.log('SMTP Config:', config.email.config.smtp);
"
2025-07-27 17:17:15 +08:00
# Test IMAP
2025-07-27 15:27:24 +08:00
node -e "
const config = require('./config/user.json');
console.log('IMAP Config:', config.email.config.imap);
"
```
2025-07-27 17:17:15 +08:00
## 🎯 Use Cases
2025-07-27 15:27:24 +08:00
2025-07-27 17:17:15 +08:00
### Remote Programming Workflow
1. Start a Claude Code code review task at the office
2. Go home, receive email "Code review completed, found 3 issues"
3. Reply to email "Please fix the first issue"
4. Claude automatically starts fixing, sends email notification when complete
5. Continue replying to emails for next steps
2025-07-27 15:27:24 +08:00
2025-07-27 17:17:15 +08:00
### Long-running Task Monitoring
1. Start large project refactoring task
2. Claude completes modules step by step
3. Each stage completion sends email notification of progress
4. Guide next steps through email replies
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
## 🤝 Contributing
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
1. Fork this project
2. Create feature branch: `git checkout -b feature/new-feature`
3. Commit changes: `git commit -am 'Add new feature'`
4. Push branch: `git push origin feature/new-feature`
5. Submit Pull Request
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
## 📄 License
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
This project is licensed under the MIT License.
2025-07-27 02:22:12 +08:00
---
2025-07-27 17:17:15 +08:00
**Make Claude Code workflows smarter and more efficient!**
2025-07-27 02:22:12 +08:00
2025-07-27 17:17:15 +08:00
If this project helps you, please give us a ⭐!