A Python-based automation system that allows you to send commands to the Cursor IDE via SMS using Google Voice's email-to-SMS gateway. Send coding requests from your phone and receive automated responses back via SMS.
The complete workflow: Phone SMS → Google Voice Gateway → Email → Local Machine → Cursor IDE → File Output → Email → Google Voice Gateway → Phone SMS
- Email Handler: Monitors Gmail inbox for Google Voice SMS notifications
- Cursor Automation: Controls Cursor IDE using pyautogui and AppleScript
- File Watcher: Monitors for output files created by Cursor's AI agent
- Orchestrator: Coordinates all components and handles the complete workflow
- macOS (required for AppleScript-based Cursor automation)
- Python 3.7+
- Cursor IDE installed and accessible
- Google Voice account set up with SMS forwarding to email
- Gmail account with App Password authentication
- Active internet connection
git clone <repository-url>
cd sms-2-cursorpython3 -m venv venv
source venv/bin/activate # On macOS/Linuxpip install -r requirements.txtcp .env.example .envEdit .env with your specific configuration:
# Gmail Configuration (use a dedicated account)
EMAIL_ADDRESS=your-dedicated-email@gmail.com
EMAIL_PASSWORD=your-gmail-app-password
IMAP_SERVER=imap.gmail.com
SMTP_SERVER=smtp.gmail.com
# Google Voice Configuration
PHONE_NUMBER=1234567890
GOOGLE_VOICE_EMAIL=txt.voice.google.com
# Cursor IDE Configuration
CURSOR_SHORTCUT=cmd+i
OUTPUT_DIRECTORY=/absolute/path/to/your/cursor/project
# Optional: Timing Configuration
POLL_INTERVAL=2
FILE_WATCH_TIMEOUT=300- Create a dedicated Gmail account (recommended for security)
- Enable 2-Factor Authentication:
- Go to Google Account settings
- Security → 2-Step Verification → Turn On
- Generate App Password:
- Security → 2-Step Verification → App passwords
- Select "Mail" and generate password
- Use this App Password (not your regular password) in
.env
- Set up Google Voice account at voice.google.com
- Configure SMS forwarding:
- Settings → Messages
- Enable "Get email notifications"
- Enable "Forward messages to email"
- Set forwarding address to your dedicated Gmail account
- Verify SMS forwarding by sending a test message to your Google Voice number
- Install Cursor IDE from cursor.sh
- Open your project in Cursor
- Verify hotkey: Ensure
Cmd+Iopens the AI agent panel (or configure different shortcut in.env) - Test automation: Make sure Cursor is responsive and the agent panel opens properly
- Create project directory if it doesn't exist
- Set absolute path in
OUTPUT_DIRECTORYenvironment variable - Ensure write permissions for the automation system
- Test file creation by manually creating a test file in the directory
# Activate virtual environment
source venv/bin/activate
# Start the orchestrator
python main.pyYou should see output similar to:
2024-01-20 10:30:15 - __main__ - INFO - Starting SMS to Cursor orchestrator...
2024-01-20 10:30:15 - __main__ - INFO - Monitoring SMS from: txt.voice.google.com
2024-01-20 10:30:15 - __main__ - INFO - Output directory: /path/to/your/project
-
Send SMS to your Google Voice number from your regular phone
-
Include coding requests like:
- "Add error handling to the login function"
- "Create a new React component for user profile"
- "Fix the bug in the payment processing module"
- "Add TypeScript types to the API endpoints"
-
Wait for response (typically 30-60 seconds depending on complexity)
Simple request:
SMS: "Add console.log statements to debug the user authentication flow"
Response: "Added 3 console.log statements in auth.js for debugging user login, token validation, and session creation."
Complex request:
SMS: "Create a new React hook for managing user preferences with localStorage persistence"
Response: "Created useUserPreferences hook in hooks/useUserPreferences.js with get/set methods, localStorage sync, and TypeScript types."
| Variable | Required | Default | Description |
|---|---|---|---|
EMAIL_ADDRESS |
✅ | - | Gmail address for SMS gateway |
EMAIL_PASSWORD |
✅ | - | Gmail App Password |
PHONE_NUMBER |
✅ | - | Your 10-digit phone number |
GOOGLE_VOICE_EMAIL |
✅ | txt.voice.google.com |
Google Voice email domain |
OUTPUT_DIRECTORY |
✅ | - | Absolute path to Cursor project |
CURSOR_SHORTCUT |
❌ | cmd+i |
Hotkey to open Cursor agent panel |
POLL_INTERVAL |
❌ | 2 |
Email check interval (seconds) |
FILE_WATCH_TIMEOUT |
❌ | 300 |
Max wait time for Cursor response (seconds) |
IMAP_SERVER |
❌ | imap.gmail.com |
IMAP server for email |
SMTP_SERVER |
❌ | smtp.gmail.com |
SMTP server for email |
Logs are written to both console and sms2cursor.log file with the following levels:
- INFO: Normal operation, SMS received/sent
- DEBUG: Detailed automation steps
- ERROR: Failed operations, connection issues
- WARNING: Recoverable issues, timeouts
- Continuously polls Gmail IMAP for new messages from
txt.voice.google.com - Filters messages by your phone number for security
- Extracts SMS content from Google Voice email format
- Tracks processed emails to avoid duplicates
- Uses AppleScript to activate and focus Cursor IDE
- Detects if agent panel is already open using multiple methods
- Sends enhanced prompts that include file output instructions
- Handles various UI states and error conditions
- Monitors project directory for output files created by Cursor
- Waits for file content to stabilize before reading
- Implements timeout handling for non-responsive requests
- Cleans up temporary files after processing
- Truncates responses to manageable SMS length (with smart truncation)
- Sends replies via SMTP to Google Voice email gateway
- Maintains email threading for proper conversation flow
- Includes error handling and retry logic
- Use dedicated Gmail account to isolate SMS automation
- Phone number filtering prevents unauthorized access
- App Passwords provide secure authentication without exposing main password
- No sensitive data should be included in SMS commands
- Keep machine running and logged in during operation
- Cursor IDE must remain accessible and responsive
- Stable internet connection required for email polling
- macOS focus/activation may require user interaction permissions
- SMS character limits - responses truncated to ~10,000 characters
- Processing time - complex requests may take 60+ seconds
- macOS only - pyautogui + AppleScript combination requires macOS
- Single session - one SMS request processed at a time
"Configuration error: Missing required configuration"
- Verify all required fields in
.envare filled - Check for typos in environment variable names
- Ensure no extra spaces or quotes around values
"IMAP connection failed"
- Verify Gmail App Password is correct
- Check if 2FA is enabled on Gmail account
- Ensure Gmail account allows "Less secure app access" or use App Password
"Cursor application not found"
- Make sure Cursor IDE is installed and in Applications folder
- Verify Cursor is not renamed or in custom location
- Check macOS permissions for automation/accessibility
"Timeout waiting for output file"
- Increase
FILE_WATCH_TIMEOUTin configuration - Check if Cursor agent is responding to prompts
- Verify
OUTPUT_DIRECTORYpath is correct and writable
"No new SMS emails found"
- Test Google Voice SMS forwarding to email
- Check Gmail spam/promotions folders
- Verify phone number format (10 digits, no dashes)
Enable debug logging by modifying utils.py:
logging.basicConfig(level=logging.DEBUG, ...)Test individual components:
# Test email connection
python -c "from email_handler import EmailHandler; from config import Config; eh = EmailHandler(Config()); print('IMAP:', eh.connect_imap()); print('SMTP:', eh.connect_smtp())"
# Test Cursor activation
python -c "from cursor_automation import CursorAutomation; from config import Config; ca = CursorAutomation(Config()); print('Cursor activated:', ca.activate_cursor())"- Reduce
POLL_INTERVALfor faster SMS response (but higher resource usage) - Use SSD storage for faster file operations
- Close unnecessary applications to ensure Cursor gets focus reliably
- Optimize Cursor agent by keeping relevant files open and context clear
- Monitor log files for errors or unusual patterns
- Update dependencies periodically with
pip install -r requirements.txt --upgrade - Clean old log files to prevent disk space issues
- Test email connectivity if experiencing delivery issues
- Check Cursor IDE updates that might change UI or hotkeys
- Monitor Google Voice changes that could affect email formatting
- Update Python dependencies for security patches
This project is provided as-is for educational and personal use. Please ensure compliance with Terms of Service for Google Voice, Gmail, and Cursor IDE when using this automation system.
For bugs, feature requests, or improvements:
- Check existing issues and logs for similar problems
- Test with minimal configuration to isolate issues
- Include relevant log snippets and configuration (with sensitive data removed)
- Describe expected vs actual behavior clearly