← All articles

I set up Claude on its own server, now I run my companies from my phone. Here is how I did it

Co-authored byDenis Yurchak,R2

For about six months I have barely opened my laptop to work. I run two products, eSIMPal (travel eSIM service) and Yadaphone (Skype alternative for international calls), plus my personal life stuff, from a Telegram chat on my phone.

On the other end is Claude Code running on a Linux server – it writes code, reads databases, and sends emails (I haven't handwritten one in almost a year).

Meet R2 (as in R2D2 from Star Wars, the name was my 12 y.o. idea, he's never hear of Cloudflare).

R2 is Claude Code, a $12/month server, systemd, and a Telegram bot I use to chat with it.

What it does in a day

Here is what a typical day looks like (I do almost none of it from Telegram on my phone):

Daily digest I wake up, and R2 sends me a digest of what I missed during the night.

It monitors support, revenue, error logs, and email inbox. If it sees something actionable, it proposes what to do. Now, I mostly agree with it and just say "do it".

It answers me. I text "why did revenue dip on Tuesday" or "show me last week's signups by country" and it queries the database and answers in the chat. If I see a customer report a bug on X, I send it the screenshot, it edits the code in the repo, pushes it and in 2 mins it's in prod. I can talk to my own website through Telegram, and it still feels like sci-fi to me.

It handles support. Tickets arrive over email or from my apps. R2 investigates each one against the code, the database, payments, and usage logs, then drafts a reply and shows it to me with an Approve button.

Example: a Yadaphone customer was charged for a call that didn't connect. R2 suggests restoring their balance and sending an apology. It tells me the amount and actions first. It never sends anything to a customer or does anything critical without my explicit yes.

It watches for fraud and abuse. My apps are in telecom and fraud is a huge issue there. I used to deal with card-testing rings, telecom fraud, disposable-email signups, and velocity spikes manually and it kept me awake at night.

Now I have dedicated watchers and alerts for the fraud patterns R2 and I notice. When an alert gets triggered, I get a Telegram message with the details and actions to block, refund, or whitelist for false positives.

It runs growth and admin on a schedule. Affiliate and creator outreach, monitoring for people asking about eSIMs, a daily status digest, tax reminders, encrypted nightly backups. It tracks my calories and my physio appointments, because once the pattern exists it is trivial to add one more.

The Telegram chat with R2: a support ticket investigated and waiting for my OK, then me asking "What did I miss?" and getting the morning digest.
The Telegram chat with R2: a support ticket investigated and waiting for my OK, then me asking "What did I miss?" and getting the morning digest.

How I can chat with it

When I send a Telegram message:

  1. The bot decides which project it is about and picks that repo as the working directory.
  2. It spawns a Claude Code run in that repo, with the constitution and the relevant context prepended to my message.
  3. As Claude works, tool calls and text stream back, and the bot relays progress and the final answer to Telegram. Multi-turn context is kept by resuming the same session on my next message.
  4. There are timeouts, an inactivity killer, and a stop button. I use it to force-stop the agent if I give it an instruction by mistake, like sending a wrong email.

If Claude hits a usage limit, the wrapper retries the same job on a different model, so that it doesn't break if I'm out of credits.

How it self-improves

In the beginning, R2 used to mess up a lot, and I needed to correct it. With time, it learned from my corrections. Now it automatically picks up my writing style, it knows how my apps work and what issues the customers often face.

Here is how it works:

Every message R2 or I send gets saved in a local SQLite DB in threads. My next message resumes the same session, and R2 picks up a thread from days ago without me re-explaining.

When I correct a draft or give an instruction, the correction is saved to a local SQLite instance. Once a week, a scheduled run goes through all the messages for this week, finds the corrections I made, and saves them as new constitution lines.

The pieces

Here is the whole system, top to bottom.

  • A hardened VPS. A Hetzner box, Ubuntu, $12 a month. The first thing I do is run security hardening: use SSH keys only, no root login, no password login, fail2ban, a firewall, unattended security upgrades. I also set up Tailscale so I can reach it privately without exposing anything to the public internet. I published that hardening step as a Claude Code prompt at github.com/deniurchak/claude-vps-setup-prompt. You paste it into Claude Code on a fresh VPS and it does the hardening for you.
  • Claude Code, installed on the box. It's a logged-in CLI sitting next to my repos. Everything R2 does, it does by spawning a Claude Code run.
  • A Telegram bot I wrote (this is R2). A small Node process that long-polls Telegram. When I send a message, it spawns a Claude Code that figures out which project I mean, pulls the context and works in that repo. It streams the answer back to the chat. It runs as a systemd service, so it survives me closing the SSH tab and reboots.
  • systemd timers for everything recurring. Around a hundred small timers fire on their own schedules: check for fraud, poll the support inbox, watch that the sites are up, alert on zero sales, run the nightly backup, remind me about taxes. Each runs a script, and when something needs my attention it pings Telegram. Most days R2 messages me first and I respond.
  • Tailscale + Termius for when Telegram is not enough. The VPS has no ports open to the internet, everything private goes over Tailscale. For long-running tasks, like creating SEO pages, I am using Termius. I open it on my phone or laptop, SSH in over the tailnet, and attach to the tmux session where Claude lives, the screenshot below is that view. The local dev servers are reachable over tailnet HTTPS too, so I can preview a UI change from my phone before it deploys.
The box itself over SSH: a Claude Code session working through the day's build queue, with a tmux window per ongoing track along the bottom.
The box itself over SSH: a Claude Code session working through the day's build queue, with a tmux window per ongoing track along the bottom.

Security

An agent with my database credentials and authenticated admin CLIs can become quite dangerous if somebody gets access to it. Here is how I am making it secure:

A constitution. One plain-text file gets injected into every single run. It holds the distilled set of rules and hard facts I have corrected R2 on over months: how to sign emails, never invent a refund, treat "29 CNY" as yuan and not dollars, verify a claim against the real system before asserting it, never expose internal details to a customer.

Explicit approval for anything irreversible. Sending a customer email, issuing a refund, writing to the production database, or pushing to git all require me to say yes first and it covers only the exact action I named.

Fighting prompt-injection. When R2 investigates a ticket or reads an email, the prompt marks the customer's text as a problem description and never as instructions, even if it tells R2 to run commands or reveal secrets.

How you can build your own

You can give this article to your agent and have the same setup in one evening.

  1. Get a VPS and harden it. You can use my prompt: SSH keys, no root, fail2ban, firewall, unattended upgrades, Tailscale. Put an SSH client on your phone and laptop (I use Termius for that).

    Hetzner console, creating the server. A shared-vCPU box in the 4 GB range is plenty.
    Hetzner console, creating the server. A shared-vCPU box in the 4 GB range is plenty.
  2. Install Claude Code on it and log in. Check out the repos you want it to operate on. You can start with a safe test repo to learn the ropes.

  3. Write a Telegram bot. Create a bot with BotFather, get your chat ID, and write a loop: on each message, spawn a Claude Code run in the right directory and stream the reply back. Run it as a systemd service so it stays up.

  4. Write your constitution. One file with your rules and key facts, injected into every run. Start small. Every time it gets something wrong, add a line. Claude (or any AI agent) will use this file to learn.

  5. Make the approval rule real. Let reversible things run freely. Gate everything irreversible behind an explicit, literal yes. If you can, give the read-only phase read-only tools so it cannot write by accident.

  6. Add timers for the recurring stuff. Each timer runs a script; each script pings you when it finds something. Start with one, an uptime check or a daily digest, and add more as you notice things you keep checking by hand.

Want help setting up something like this?

I do one-on-one calls on exactly this: agents, going solo, and running SaaS in production.

Book a consulting call

This agent has a lot of access. That makes it useful, but it's also a huge risk. Harden the box, keep secrets in files only the service can read, never expose the bot to anyone but yourself, and gate every irreversible action.

Why not a Mac mini or a cloud agent

A Linux VPS in a datacenter works because it's cheap, disposable, and always up. It's not exposed to the public internet and I do security hardening, so that it can hold real credentials and have prod access.

R2 has access to the same things I used to run my business: git repos, databases, authenticated CLIs, my support inbox over IMAP and SMTP, and scripts for fraud checks, refunds, balance restores, and outreach.

A cloud agent resets every run and cannot hold all the state I need. A home Mac mini can, but then I need to sysadmin it all the time. I wanted something I could restore fast if something happened to it.

So it's like OpenClaw or Hermes?

OpenClaw and Hermes are agent runtimes: you install them, configure them, and use their gateway, their skill system, and their update cycle. If you want something ready and fast, they work well.

My agent started as Claude writing code, and then I added things gradually myself. Thanks to that, I know exactly what it does, and in my opinion that's a safer choice than OpenClaw. I also had a lot of fun setting it up and learned a ton about agents!

Get the next article by email

I share how I build and market products with AI.

How it changed the way I work

I used to carry a heavy backpack with my laptop all the time. When abuse happened, I had to jump on it and manually investigate Stripe, databases, and code. Now I have R2 monitoring my apps 24/7, and if I am asleep or away, it can block people and keep my app safe. I can also give it long-running coding and research tasks, and not keep my laptop open all the time (it saves a lot of battery!).

It's not limited to my work: R2 manages my calendar, helps me track calories, and maintains my workout plan. It feels like having a robot assistant from a sci-fi movie, and you should definitely try building one for yourself!

How my office looks like now
How my office looks like now

Want a setup like this?

I run two SaaS products solo, from my phone, with agents doing the support, coding and marketing. Book a call and I will help you set up your own, win back your focus, or figure out where to spend your time.

Book a consulting call