Texting Claude Over iMessage

Date 11/30/2026
Tags Homelab Claude Code macOS

TL;DR I can text (or Discord DM) Claude Code from my phone, and it answers questions about my homelab by reading my server directly. It can't change anything until I reply "yes" to the exact command it wants to run.

---

Why text it?

Since building hub, my homelab is pretty good at telling me when something is wrong. A card goes red, an alert lands in Discord, and I know about it within a minute. What it can't do is tell me why. And that usually happens when I'm nowhere near my laptop.

I already use Claude Code at my desk to build and fix most of this stuff. So the question was: could I just text it? "Why is the Storage page red?" "What do the Karakeep logs say?" "Restart that container." From my phone, from anywhere, and get a real answer back.

The Apple ID problem

The plan was simple. I have an M1 Pro MacBook that stays plugged into ethernet at home (it already runs my local AI models). Give it its own Apple ID, sign it into Messages, and have a small program read new texts and hand them to Claude Code.

Then Apple wanted a second phone number to make a second Apple ID. Which I don't have. I looked at BlueBubbles and at forwarding a Google Voice number, and both felt like more moving parts than I wanted. So I took the quickest route: a private Discord bot named Jeeves. Only I'm in its server, it only answers me, and it only ever connects out to Discord, so there are no ports open on my network.

A few days later I did get a second Apple ID set up on the Mac, so iMessage went in alongside Discord. They're the same conversation, too. I can start something in Discord at my desk and finish it over text on the couch.

How it works

How the concierge works: a text or Discord DM reaches a bot on m1, which hands it to Claude Code. Claude Code reads buffalo through a read-only key, and changes things only through a second key after I reply yes. My phone, wherever I am iMessage a text to m1's own Apple ID Discord a DM to Jeeves, a private bot m1, an M1 Pro MacBook that never leaves the house iMessage reader its own copy of Bun, the only thing with Full Disk Access Bot Bun and the Agent SDK, one conversation, asks me to approve Claude Code its own folder of rules and a deny list it can't edit Replies go back the same way: AppleScript tells Messages to send, or the bot posts to Discord. buffalo: read anything a read-only SSH key; a small gate runs each command without a shell docker logs, journalctl, df, kubectl get buffalo: change things a second key, used only after I reply yes to that exact command no answer in 15 minutes is a no

The bot is a small TypeScript program run by Bun. Every message goes to Claude Code through the Agent SDK, which runs in its own folder on the Mac with its own CLAUDE.md and settings. That's where the rules live: what it can run without asking, what it has to ask about, and what it can never do.

Read anything, change nothing (without asking)

This was the part I cared about most. I want it to be able to dig through logs freely, but I don't want a text message to be able to break my server.

So it gets two SSH keys to buffalo. The first one can only run read-only commands. buffalo doesn't hand that key a shell, it passes each command to a tiny script that checks it against a list (docker ps/logs/stats, journalctl, df, git log, kubectl get, and so on) and runs it without a shell. Pipes, ;, &&, .env files and keys are all refused. It can also read hub's own cards over hub's API, so "why is this red?" gets the same data the dashboard sees.

The second key can do anything, and Claude Code has to ask me first, every time, with the exact command. On Discord that's an Allow / Deny button. Over iMessage it looks something like this:

Me:     karakeep looks stuck, can you restart it?
Jeeves: I'd like to run:
        ssh buffalo-admin docker restart karakeep
        Reply yes 4f2 to allow or no 4f2 to deny.
Me:     yes 4f2

The little code at the end matters. Without it, a "yes" I sent for one thing could approve something newer that I hadn't read yet. If I don't answer in 15 minutes, it's a no. And some things aren't even on the menu: sudo, rm -rf, reboots, disk changes, reading .env files or my messages, and editing its own rules.

Two Mac things that bit me

Full Disk Access. Messages keeps its history in a database that only a process with Full Disk Access can read. I really didn't want to give that to Bun, or to Claude Code, since then anything Claude ran could read every file on the Mac. So the iMessage reader runs from its own separate copy of the Bun binary, and that one copy is the only thing with access. It writes new messages to a file, and the bot (with no special access) picks them up from there.

"Not logged in." Claude Code keeps its login in the macOS keychain, and a process started over SSH can't read the keychain. So my first attempt, starting it over SSH, just failed. The fix was running the bot as a LaunchAgent in my normal login session, which also means it starts at login and restarts itself if it ever stops.

An idea inbox

My favorite side effect has nothing to do with fixing things. If I text "note an idea: ..." it adds a line to an inbox file on the Mac, no approval needed. Next time I sit down with Claude Code at my laptop, I tell it to pull in Jeeves's ideas and it folds them into the ideas list in hub's repo.

This post started as one of those texts. (Very meta, I know.)

The risks

It's not risk-free and I don't want to pretend it is. Anyone with my unlocked phone, my Discord account or my Apple ID could ask it things and approve changes. And logs, web pages and command output can contain text that tries to give it instructions. It's told to treat all of that as data, and changes still need my reply, but I read every request before I say yes. Discord DMs also aren't end-to-end encrypted, so I never send passwords or tokens that way.

What's next

  • Critical alerts by iMessage, so the important ones show up as a text instead of one more Discord notification.
  • Installing apt updates from a text, instead of an alert telling me to go run sudo apt upgrade myself.