Opal: a VM for Claude Code That I Can Reach From My Phone
I keep a daily journal with an inbox for things I dictate on the go, and on most days that inbox stayed empty. Capturing was never the problem. Turning a fragment into a linked note needs an agent that knows the vault. So I built opal: a small always-on VM that runs Claude Code sessions, reachable from my phone. Here is why, how it hangs together, and what did not survive contact with reality.
Why a VM at all
My setup is described on How I work: one Markdown vault in Git, a daily journal as the hub, and agents that extract what is worth keeping. That loop works at my desk. On the phone it breaks in half. Obsidian on mobile writes into the inbox without trouble, but nothing runs the extraction afterwards.
So the requirement was simple: a Claude session that knows the vault and is awake when I am not at the desk. A desktop that sleeps in the evening cannot be that, and a Docker host with running workloads is the wrong place for a long-lived shell. A dedicated VM it is.
There was a second reason, and I will be honest about it: curiosity. The build is small enough that “let’s see if it holds” was justification enough.
What opal is
opal is a Proxmox VM running Ubuntu 24.04. It is created like everything else in my lab: OpenTofu defines the VM, an Ansible role installs the tooling, and a pipeline applies both. I decided early that there would be no hand-built VM, not even for a trial run. If opal breaks, I delete it and let the pipeline stamp out a new one, including Claude Code, herdr, a clone of the vault and the hooks described below.
It started small, with 2 vCPUs, 4 GB and 50 GB, and grew to 4 vCPUs, 8 GB and 100 GB once it became more than a capture box (more on that below).
How the phone gets in
The first version used three pieces, and two of them are still there:
- herdr owns the terminals. An SSH or mosh connection keeps a shell alive, but it cannot be taken over by a new client. If iOS kills the app, the process keeps running somewhere nobody can reach, and the next login starts a second Claude in the same clone. herdr holds the agent’s terminal, so any client can attach again. It also knows each agent’s state (working, blocked, done, idle), and on a phone “which session is waiting for me?” is the most valuable question there is.
- Tailscale gets me home.
opalis not a node on my tailnet. It sits on the home network, and the subnet routers I already run bring that network into the tailnet. The phone reachesopalthrough them, so there is no extra auth key and no extra node to look after. When the phone is on mobile data, the traffic goes through a Tailscale peer relay in my lab, which I describe in the next post. - A terminal app on the phone. This is the part that changed.
For the first three weeks that app was Termius over mosh, with the herdr TUI inside it. herdr switches to a one-column layout on narrow screens, and it worked, but it was a terminal on a phone: small keys, scrolling that fights the touch screen, and iOS dictation that broke off after a few characters.
At the end of November I moved to Herdr Mobile, the iPhone app from the herdr project. It does not show the herdr TUI. It connects over SSH to herdr-core (hc), a small server that holds terminals and reports the agent state of each one, and turns that into a native list of agents with their state and a terminal view for each. The difference in daily use is large. Within days, I noticed that I reach for it at home too, not only when I am away from the desk.
The move had a consequence I did not expect: the app sees only hc terminals, not the panes of the herdr TUI. So the Claude sessions on opal now run directly as hc terminals, and a small timer starts them after a boot. Termius and mosh are gone; Herdr Mobile is the only way in now.
Before Herdr Mobile I tried Moshi. As a plain terminal it is fine, but its optional server part installs a closed-source daemon next to the agent and sends prompt snippets to a third party. That is too much trust for a machine that holds credentials.
I also looked at Claude Code’s Remote Control, which puts the same session into the Claude app with voice input and buttons for permission prompts. I decided against it. The long-lived token I use on the VM cannot start Remote Control sessions, and while it is connected the transcript lives on Anthropic’s servers. A real shell also matters to me: I want to restart a session or look at git status myself when something hangs.
The real risk: three writers, one file
The build is not the hard part. Concurrency is. Three clients now write to main of the vault: my workstation, Obsidian on the phone, and opal. All three touch the same file, the daily journal. A dictation arrives on the phone, Obsidian syncs, and a session on opal with a stale checkout rewrites the inbox. The dictation is either a conflict or silently lost.
Instead of hoping that the model remembers the rules, I enforce them with Claude Code hooks:
- Before every prompt, the hook runs
git pull --rebase --autostash. - When a turn stops and the tree is dirty, the hook validates the notes, commits with an attribution trailer and pushes. On a rejected push it rebases again, and on a conflict it stops and reports instead of overwriting.
Both hooks live in the vault, so they travel with the clone. They only fire on the VM, tied to an environment variable that does not exist on my workstation.
From capture box to second workstation
The first version was deliberately cautious: a deploy key that can write to the vault repository and nothing else, so a hijacked phone session endangers a journal and not the infrastructure.
It did not stay like that. Once the box worked, I wanted it to do real work, so in early November I made it a second workstation with credentials for GitLab, the lab tooling and the MCP gateway. Two Claude sessions run in parallel, one per account, each in its own clone. Two clones, because the stop hook would otherwise commit half-finished changes of the other session.
That decision has a cost, and I made it knowingly. Both sessions run in auto mode and read content I did not write, such as clippings, mail and OCR text. A prompt injection in any of them could reach far more than a journal. I wrote down how to revoke the access, and I accepted the risk for now.
One practical detail: the MCP gateway normally logs in through a browser callback to localhost, which a phone cannot complete. A browser-less machine identity with a headers helper solved it. Since then, the sessions on opal use the gateway like the ones on my desktop.
Main and minions
On a phone I do not want to watch long work scroll by. So the session I talk to, which I call main, mostly decides and delegates. Longer jobs, and anything that writes and commits, go to minions: separate Claude Code sessions, each with a short brief, a smaller model and its own terminal. Main runs on Opus, the minions on Sonnet, or Haiku for small read-only checks. A minion reports back when it is done. It never starts minions of its own.
On opal every minion is an hc terminal with a label that marks it as a minion. That puts each one in the app as its own agent with its own state, next to the two main sessions, so I can open the one that is blocked and leave the others alone.
Notifications
The biggest gap after the first weeks was not on the screen. It was the moment I put the phone away. herdr shows a notice when an agent finishes, but only while the app is in front, and nothing on the VM can raise a notification on the phone.
So opal now pushes. A Claude Code hook on the stop and notification events sends a short message to a private channel in my self-hosted chat when a minion is done or waits for input. The message carries the host, the minion’s name, the status and the time, nothing from prompts or output. Main stays silent: I am usually already talking to it. The hook never blocks a turn, and without its webhook secret it simply does nothing.
The chat channel I describe further down would go the other way, from chat to agent. This is the half that was cheap to build, and it is the half I use every day.
Answers that fit a phone
The last change is not software, it is a rule. The vault’s agent instructions now have a short section for phone sessions: when the session runs on opal, or the messages look like phone input, answer first and briefly, use no wide tables, trim long output to the lines that matter, read typos generously and end with at most one question, with a proposed default. I type short messages with many typos on the phone, and a screen that is 45 to 60 columns wide punishes every wide table. The rule costs nothing and makes a bigger difference than any key binding.
What went wrong
- The first run needed several rounds. A new VM took six small fixes before the first clean pipeline run. The CPU type defaulted to one without the instructions the Claude installer needs, so the install aborted. A tag list was rendered as a string, and the log agent started before Docker existed. The lesson is old but still true: a new VM needs more than one pipeline run.
- A leftover from the first run rebooted the VM. One setting that the first rollout needed stayed on for
opalalone. Weeks later, every deploy of the hypervisor configuration restarted the VM, three times in one afternoon. That was also the first real restart test, and it showed a gap:hcbrought the terminals back, but as empty shells, the login script started the old herdr setup inside them, and the start timer saw the names taken and did nothing. Both are fixed now, and the timer replaces an idle shell with the session it should hold. - Two views that do not see each other. herdr on my desktop could list and read the sessions on
opal. Since those sessions moved tohc, the herdr TUI no longer sees them. The fix ishcon the laptop as well, withopaladded as a machine, so one picker lists the terminals on both. It works, but it is a second tool next to herdr, not one view. - Dictation in the terminal. iOS dictation broke off after a few characters inside Termius. A quick action worked around it, and with Termius gone the problem went with it.
- Colours. Claude sends only 24-bit colours, and mosh in my setup runs with 256. My guess was that Termius did not show 24-bit over mosh. I never confirmed it, and with Termius retired it no longer matters.
Sessions on two machines
Sessions on my desktop and on opal sometimes work on the same repository. In November that cost me: two merge requests for the same issue, a conflict in a tab bar and a branch that one session nearly took over while the other was still working on it.
The answer was to make opal visible from the desktop, first as a herdr machine in the sidebar and now through hc. The desktop session can list and read the agents on opal. By rule it only reads, and it sends a prompt only after I agreed. Before a minion on the desktop starts work on a branch it did not create, main checks whether opal is already on it. A small rule, and it solved most of the problem.
An idea that is not built: a chat channel
I want to hand the agent a job from a chat app and read the answer in the same thread, such as “take the latest inbox and work it off”. The draft uses a small MCP server that Claude Code starts itself, which pushes chat messages into the running session and replies through a tool. The connection would be outbound only, so nothing on opal listens for it.
I ruled out the obvious shortcut of typing chat text into the terminal. The answer would come back by scraping the screen, and chat text would arrive as keystrokes, so a message starting with /clear would run as a command. The fallback is a headless claude -p --resume per message. The feature is still a research preview, so I treat all of this as a plan and not as something that works. With the app and the push messages in place, the need is smaller than when I first wrote it down.
Does it work?
More than it did two weeks ago. The VM is stable, the sessions survive a reboot, and the phone reaches them from home and on mobile data. Much of my lab work in the last weeks ran through opal, some of it started from the phone: I write a few words to main, it hands the job to a minion, and the push tells me when to look again.
The question I started with is still open: does the inbox stop being empty? I have not run a clean week of measurement, and the inbox is emptied by every extraction, so an empty inbox now means two different things. What I can say is that the phone has become a place where I work, not only where I capture.
herdr is still a convenience and not a store. The source of truth is git, and every extraction is committed and pushed straight away. If herdr or hc disappears, I lose a reattach and no notes.
Further reading
- Claude Code On-The-Go: the same idea, Claude Code driven from a phone.
- doom-coding: a guide to coding from a smartphone.
- Multiagent coding is the future: on running several coding agents at once, the idea behind main and minions.
- Push events into a running session with channels: Claude Code’s channels push chat messages and alerts into a running session, the building block for the chat channel idea above.