Built by @loganinthefuture with Claude Code
I text myself from my phone. Claude responds in the same thread. Not a chatbot — a full agent. It reads files, writes code, searches the web, understands images. It knows my projects, my preferences, my calendar. It's basically a chief of staff that lives in iMessage.
About 10 minutes. You need a Mac, Python 3 (ships with macOS), and Claude Code CLI installed.
The bot reads your Messages database, which macOS protects. Open System Settings → Privacy & Security → Full Disk Access, click +, press Cmd+Shift+G, type /usr/bin/python3, and add it.
This is the one step that trips people up. If you skip it, everything else will look right but the bot will silently fail to read your messages.
git clone https://github.com/loganhc-09/imessage-claude-bot.git
cd imessage-claude-bot
cp .env.example .env
Edit .env with your details:
APPLE_ID=you@icloud.com
PHONE_NUMBER=+15551234567
CLAUDE_WORKSPACE=/path/to/your/project
CLAUDE_PATH=/usr/local/bin/claude
The CLAUDE_WORKSPACE is where Claude Code operates from — wherever your CLAUDE.md lives. This is how the bot knows your context.
Open Messages on your phone and text yourself. Just send anything — "hey" works. This creates the iMessage thread the bot monitors. You only need to do this once.
python3 imessage-bot.py
Text yourself from your phone. Wait a few seconds. Claude responds in the same thread. That's it.
The repo includes a launchd plist so the bot runs in the background and survives restarts:
# Edit the plist with your paths first
cp com.claude.imessage-bot.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.claude.imessage-bot.plist
# Check logs
tail -f /tmp/imessage-bot.log
/new
/status
Every single one of these cost me at least an hour. The bot handles all of them automatically, but if something's not working, check here first.
iMessage creates separate threads for your email and phone number. You'll text from one, the bot will reply to the other, and you'll think it's broken. That's why .env has both APPLE_ID and PHONE_NUMBER — the bot monitors both and replies to whichever you texted from.
When launchd restarts Python, FDA can take a few seconds to activate. The bot retries automatically for up to 2.5 minutes. If you see "authorization denied" in the error log, give it a minute — it usually resolves itself.
Messages sent via AppleScript store text in a binary blob (NSAttributedString typedstream) instead of the normal text column. Most tutorials don't mention this. The bot includes a custom parser for Apple's undocumented binary format. If messages seem to disappear, this is why.
Images live in ~/Library/Messages/Attachments/ which requires FDA. Your Python process has FDA, but Claude CLI subprocess doesn't. So the bot copies images to /tmp/ before passing paths to Claude. This happens automatically — you just send a photo and Claude sees it.
Messages from your phone sync to your Mac via iCloud — usually within seconds, sometimes 30-60+. If the bot doesn't respond, make sure Messages.app on your Mac is open. That helps.
You're texting yourself, so the bot's own replies appear as new messages. Without protection, it processes its own responses forever. We prevent this with MD5 hash tracking and ROWID advancement. It's handled, but it's the kind of thing that makes you question your life choices at 2am when you're debugging it.
~/Library/Messages/chat.db every 3 seconds for new messages in your self-chat threadstext column or the attributedBody binary blob (Apple's undocumented typedstream format)/tmp/ where Claude can read them--resume, so context carries across textsNo network APIs. No third-party services. ~150 lines of Python. Everything runs on your Mac.
This is where it stops being a chatbot and starts being yours. Create a CLAUDE.md in your workspace with your context — who you are, what you're working on, how you think, what you care about. The bot loads this on every new session. Mine has my projects, my intellectual threads, my cognitive patterns, even my energy cycles. Claude uses all of it.
Set LOG_DIR in .env to save daily conversation logs. But the real move is giving Claude a memory/ folder it can read and write to. Mine tracks people, companies, discussion queues, meeting notes, follow-ups. It remembers so I don't have to.
With a good CLAUDE.md and a memory system, Claude stops being reactive and starts being proactive. Morning briefings. Meeting prep. Follow-up tracking. Research on demand. The interface is just texting — but what's behind it is a full operating system that knows your work.