This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Initial setup:
./setup.sh- Interactive SMS notification setup wizard - Reconfigure:
./setup.sh --reconfigure- Modify existing configuration - Test configuration:
./setup.sh --test-config- Validate current SMS settings
- Start all features:
./start.sh- Enable SMS notifications and auto-resume, start daemons - Stop all features:
./stop.sh- Disable features and stop background daemons
- Run comprehensive tests:
./sms/test-sms.sh- Full test suite - Send test SMS:
$CC_TOOLS_DIR/sms/sms-sender.sh "Test message" "completion" - Test SMS sender:
$CC_TOOLS_DIR/sms/sms-sender.sh --test
- Start SMS receiver:
$CC_TOOLS_DIR/sms/sms-receiver.sh --daemon & - Check messages once:
$CC_TOOLS_DIR/sms/sms-receiver.sh --check-once - Test rate limit simulation:
$CC_TOOLS_DIR/auto_resume/rate-limit-monitor.sh --simulate-429
- Test configuration:
$CC_TOOLS_DIR/setup.sh --test-config- Validate all system settings - Run specific tests:
$CC_TOOLS_DIR/sms/test-sms.sh --basic- Configuration tests$CC_TOOLS_DIR/sms/test-sms.sh --messages- Messages app tests$CC_TOOLS_DIR/sms/test-sms.sh --hooks- Hook configuration tests$CC_TOOLS_DIR/sms/test-sms.sh --integration- Send test SMS
- Monitor logs:
tail -f $CC_TOOLS_DIR/logs/cc-tools.log - Check daemon status:
ps aux | grep -E "(sms-receiver|rate-limit-monitor)"
- Required environment variable:
CC_TOOLS_DIRmust point to the claude-code-tools directory - Dependencies:
jq, macOS Messages app, Terminal with Full Disk Access
The system integrates with Claude Code through a unified hook in .claude/settings.json:
- Unified CC Hook (
cc-hook.sh): Handles both SMS notifications and auto-resume functionality- Processes Stop and Notification events
- Sends SMS for task completions, errors, input requests, and rate limits
- Detects API rate limits and saves state for automatic resumption
- Legacy hooks (
sms-hook.sh,auto-resume-hook.sh) available for reference
- sms-sender.sh: AppleScript-based SMS sending via macOS Messages app
- sms-receiver.sh: Monitors Messages database for incoming SMS commands
- screenshot.sh: Captures terminal window screenshots for SMS status updates
- rate-limit-monitor.sh: Background daemon that monitors for rate limit expiration
- logging.sh: Centralized logging to
$CC_TOOLS_DIR/logs/cc-tools.log - send-to-claude.sh: Sends commands to Claude Code terminal sessions
JSON configuration shared across all Claude Code projects:
{
"user_phone": "+1234567890",
"contacts": ["+1234567890"],
"sms_enabled": true,
"auto_resume": true,
"max_message_length": 160,
"screenshot_enabled": false
}Defines Claude Code hooks that trigger SMS and auto-resume functionality.
- Uses AppleScript to send SMS/iMessage through macOS Messages
- Monitors SQLite database at
~/Library/Messages/chat.dbfor incoming replies - Requires Full Disk Access permission for terminal applications
- Detects terminal application (Terminal, iTerm, iTerm2) and window/session
- Stores terminal configuration in
config.jsonfor command routing - Uses AppleScript to send commands to specific terminal sessions
- Unified hook handling both SMS notifications and auto-resume functionality
- Event-driven architecture responding to Stop and Notification events
- Automatic API limit detection and rate limit state management
- Timeout handling for hook execution
Stores rate limit information for auto-resume:
{
"expires_at": 1234567890
}- PID files in
$CC_TOOLS_DIR/logs/for background daemons - Daemon lifecycle managed by
start.shandstop.sh - Automatic cleanup and restart capabilities
- Contact-based authorization: Only configured phone numbers can send commands
- Commands processed only from authorized contacts in
config.json - No network services - uses local Messages app and AppleScript
- Logs stored in
$CC_TOOLS_DIR/logs/for debugging