A personal AI assistant that responds to your iMessages using Claude. Features semantic memory, self-modification capabilities, web search, image processing, and more.
- iMessage Integration - Responds to texts automatically
- Semantic Memory - Remembers context using vector search (ChromaDB + Gemini embeddings)
- Smart Context - Only includes relevant history, not just "last 5 messages"
- Auto-Compaction - Summarizes old conversations to stay within token limits
- Self-Modification - Can update its own code when asked
- Web Search - DuckDuckGo integration
- Image Processing - Analyze, edit, and generate images via Gemini
- Browser Automation - Screenshot pages, fill forms (optional, requires Playwright)
- Reminders - Set one-time or recurring reminders
- Build Projects - Create multi-file projects on request
- macOS (for iMessage access)
- Python 3.9+
- Node.js (for Claude Code CLI)
- Claude Code CLI (
npm install -g @anthropic-ai/claude-code) - Full Disk Access permission (to read iMessage database)
- Gemini API key (free at https://makersuite.google.com/app/apikey)
Clone with your preferred agent name as the directory:
# Example: name it "jarvis", "friday", "max", etc.
git clone https://github.com/therobfoster/claude-imessage-agent.git jarvis
cd jarvisOr use the default name:
git clone https://github.com/therobfoster/claude-imessage-agent.git
cd claude-imessage-agentThe agent uses Claude Code to generate responses:
# Install Node.js if not already installed
brew install node
# Install Claude Code CLI
npm install -g @anthropic-ai/claude-code
# Authenticate (opens browser)
claudepython3 setup.pyThis will:
- Ask for your agent's name
- Install Python dependencies (tiktoken, chromadb, google-generativeai)
- Ask for your Gemini API key
- Configure allowed senders (phone numbers/emails that can message the agent)
- Set permission levels (what needs approval vs. auto-approve)
- Create necessary directories
The agent needs to read ~/Library/Messages/chat.db:
- Open System Preferences > Privacy & Security > Full Disk Access
- Click the + button
- Add Terminal (or your terminal app: iTerm, VS Code, etc.)
- Restart your terminal
The agent sends replies through the macOS Messages app using AppleScript. It automatically uses whatever iCloud account is signed in - no additional configuration needed.
- Open the Messages app
- Sign in with your Apple ID (if not already signed in)
- Verify you can send/receive iMessages manually
If Messages works normally, the agent will use the same account to send replies.
python3 agent.pyOr run in debug mode for verbose logging:
AGENT_DEBUG=1 python3 agent.pyOnce running, send an iMessage from an allowed sender. The agent will:
- Detect your message
- Search semantic memory for relevant context
- Generate a response using Claude
- Send the reply via iMessage
| Message | What Happens |
|---|---|
| "Remember my wifi password is hunter2" | Saves to permanent memory |
| "Remind me to call mom tomorrow at 2pm" | Sets a reminder |
| "What's the weather in NYC?" | Searches the web |
| "Build me a Python script that..." | Creates files (needs approval by default) |
| "Update yourself to add a new feature" | Self-modifies (needs approval by default) |
| "What's trending on TikTok?" | Searches TikTok trends |
The agent uses XML tags internally. You don't need to use these directly:
<REMEMBER>- Save facts<REMINDER>- Set reminders<WEB_SEARCH>- Search the web<BUILD>- Create projects<MODIFY_SELF>- Update agent code<IMAGE_ANALYZE>/<IMAGE_EDIT>/<IMAGE_GENERATE>- Image processing
{
"agent_name": "Jarvis",
"allowed_senders": ["+1234567890", "you@icloud.com"],
"poll_interval": 10,
"permissions": {
"auto_approve_commands": false,
"auto_approve_builds": false,
"auto_approve_self_modify": false,
"auto_approve_file_writes": false
}
}| Permission | Default | Description |
|---|---|---|
auto_approve_commands |
false | Shell commands (ls, cat, etc.) |
auto_approve_builds |
false | Multi-file project creation |
auto_approve_self_modify |
false | Agent updating its own code |
auto_approve_file_writes |
false | Writing files outside workspace |
Set to true to skip approval prompts.
{
"gemini_api_key": "your-api-key-here"
}python3 agent.py # Run the agent
python3 agent.py --stats # Show memory system statistics
python3 agent.py --reindex # Rebuild vector store from scratch
python3 agent.py --help # Show helpLogs are saved to logs/agent.log with automatic rotation (10MB max, 5 backups).
View live logs:
tail -f logs/agent.logAgent/
├── agent.py # Main agent
├── token_counter.py # Token estimation
├── memory_manager.py # Vector storage + semantic search
├── memory_flush.py # Pre-compaction memory save
├── compaction.py # Auto-summarization
├── setup.py # Interactive setup
├── config/
│ ├── user_config.json # Your settings (gitignored)
│ ├── secrets.json # API keys (gitignored)
│ ├── personality.md # System prompt (customizable)
│ └── FEATURES.md # Agent capabilities manifest
├── memory/
│ ├── knowledge.json # Permanent facts
│ ├── reminders.json # Active reminders
│ ├── conversation_log.jsonl # Chat history
│ └── chroma/ # Vector database
├── logs/
│ └── agent.log
└── workspace/ # Files created by the agent
Only one instance can run at a time. Kill the existing one:
pkill -f "python.*agent.py"
rm -f .agent.pid- Check Full Disk Access is granted
- Verify sender is in
allowed_senderslist - Check
logs/agent.logfor errors
Rebuild the vector store:
python3 agent.py --reindex- Only responds to
allowed_senders- unknown numbers are ignored - API keys stored in
config/secrets.json(gitignored) - Dangerous commands require approval by default
- Self-modification requires approval by default
MIT