Skip to main content
Back to blogCopy Markdown
·14 min read
·claude codeaiagentsiosandroid

Claude Code cloud sessions with an iOS app: what fits

I set up Claude Code cloud sessions for an iOS, Android and web monorepo. Against a warm local cache, the same small task cost about 9x more in the cloud. →

Óscar Gallego

Software engineer · Málaga

A closed laptop sends a thread to a glass cabinet in the sky where mechanical hands sort green cards, while a stone and a wooden apple stay behind on the desk
On this page

Short answer: Claude Code cloud sessions run on an Ubuntu box, so anything Apple stays on your Mac. In my monorepo that rules out the whole iOS app, and also the Swift package that holds the pure logic, because it imports frameworks Linux doesn’t have. What does fit: the website, Android JVM tests, docs and research that needs no secrets, though Gradle only worked once I gave it Java 25 and a Maven Central mirror. With the promo credit gone since November 4, all of it draws from the same plan limit as your local sessions. I couldn’t find a published measurement of cloud versus local usage, so I ran one: the same small task cost about 9x more in the cloud than locally with a warm cache, almost all of it a fixed cost every session pays at startup.

On Sunday night I set up a cloud environment for Rydger, the motorcycle and car app I build solo: native iOS in SwiftUI, native Android in Kotlin and a Next.js site, all in one monorepo. The plan was simple. My Mac is already packed with worktrees and parallel agents, and I wanted to push the work that doesn’t need the Mac off to the cloud.

First thing I learned: my core Swift package, the one that exists precisely to keep pure logic away from SwiftUI, can’t build in the cloud. “Pure” turned out to mean “pure as long as you’re on a Mac.” It imports CoreLocation, CryptoKit, Compression and CoreGraphics. Ubuntu has none of them.

Without the credit, the cloud draws from the same limit as everything else

Worth getting straight first, because I keep hearing “now that it’s included in the subscription,” and that’s not quite it. Cloud sessions were already part of Pro and Max during the beta. What changed was the money around them.

On September 23 they came out of preview under a new name, “cloud sessions,” with a promotion: a $100 credit on Pro and $250 on Max, claimable until October 7 and good until November 4. While it lasted, cloud usage was paid by the credit and didn’t touch your plan limit.

That credit ran out at the end of November 4, and anyone who never claimed it was on their plan limit all along. The docs are blunt about it now: a cloud session counts toward your plan’s usage limits alongside the rest of your Claude and Claude Code usage, with no separate charge for the VM. They add the part that matters most to a solo dev: running tasks in parallel eats into your limit in proportion. Ten cloud sessions cost about ten times one, even though none of them is on your laptop.

Setting it up for iOS, Android and web takes one script and one hook

The machine is Ubuntu 24.04 with roughly 4 vCPUs, 16 GB of RAM and 30 GB of disk, per the environments docs. It ships Node 20, 21 and 22, OpenJDK 21 with Gradle, Python and gh. My repo needed almost everything else: Node 24 and pnpm for the site, the Android SDK with platform 37, and the exact Gradle distribution the wrapper pins.

I ended up splitting it in two:

  • The environment’s setup script. You load it into the environment settings, which keep their own copy (I keep the original in the repo), and it runs before Claude starts. It installs Node 24, pnpm and the Android SDK, and unzips the Gradle distribution into the exact folder gradlew looks in, which is a base-36 MD5 hash of the URL. If it finishes in about five minutes, Anthropic snapshots the disk and later sessions start with everything installed. The snapshot expires after seven days or when you change the script or the allowed domains.
  • A SessionStart hook in .claude/settings.json. This one lives in the repo and runs every session, so it has to be fast: it writes the env vars, creates Gradle’s local.properties, turns on the git hooks and runs pnpm install on every new session and skips it on resume when package.json, the lockfile and the script itself are unchanged. The docs kill it at 600 seconds unless you set another timeout.

The Gradle part of the setup script is the least obvious, so here is its core. base36_md5 stands in for what the real script does with one python3 -c call: a four-line program that turns the URL’s MD5 into base 36.

url="https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip"
dir="/root/.gradle/wrapper/dists/gradle-${GRADLE_VERSION}-bin/$(base36_md5 "$url")"
mkdir -p "$dir"
curl -fsSL "$url" -o "$dir/gradle-${GRADLE_VERSION}-bin.zip"
unzip -q -o "$dir/gradle-${GRADLE_VERSION}-bin.zip" -d "$dir"
rm -f "$dir/gradle-${GRADLE_VERSION}-bin.zip"
touch "$dir/gradle-${GRADLE_VERSION}-bin.zip.ok"  # the wrapper only checks this marker

Before pasting anything, an agent tested both pieces in an Ubuntu 24.04 Docker container on my Mac. According to its log, setup took 74 seconds the first time and 63 the second. The hook took 11 seconds on the first session, all pnpm install, and nothing on resume. It caught two bugs that would have cost me hours in the cloud: the npm installing pnpm found the wrong Node on PATH, and the image had no xz to unpack Node.

My proxy fix got in the way; Maven Central was the real problem

In the cloud, all outbound traffic goes through a security proxy. The docs warn that some package managers don’t get along with it and name Bun. Since Java ignores HTTPS_PROXY, on Sunday an agent and I handed the proxy to sdkmanager as flags and to Gradle as properties in ~/.gradle/gradle.properties.

The first real session showed that, for Gradle, none of that was needed, and it was actively hurting. Every Java process printed Picked up JAVA_TOOL_OPTIONS with the proxy host, port and trust store already set: the cloud hands them to Java on its own and keeps them current. The environments doc doesn’t mention it. My hand-written port, on the other hand, went stale when the container restarted and overrode the right one. The hook now writes it only when JAVA_TOOL_OPTIONS doesn’t carry the proxy.

Apart from my own stale port, two other things broke Gradle. A session I started to test the environment found all three and opened a PR with the fixes: my build asks for a Java 25 daemon, the VM ships Java 21, and Gradle can’t download one because api.foojay.io is blocked, so the setup script now installs it with apt. The second was worse: Maven Central returns 429 Too Many Requests to the cloud’s shared addresses. In my first batch of five sessions, four failed on it and the fifth cut off without answering; later, even a single session failed. That PR had already raised Gradle’s retries on a 429, and it wasn’t enough.

What worked was a cloud-only Gradle init script that puts Google’s mirror of Maven Central first. *.googleapis.com is already on the default allowlist, so the environment needs no change:

// ~/.gradle/init.d/cloud-maven-mirror.gradle, installed by the hook in the cloud only
def mirror = 'https://maven-central.storage-download.googleapis.com/maven2/'
beforeSettings { settings ->
    settings.pluginManagement.repositories { maven { name = 'MavenCentralMirror'; url = mirror } }
    settings.dependencyResolutionManagement.repositories { maven { name = 'MavenCentralMirror'; url = mirror } }
}

The repositories in settings.gradle.kts stay behind it as fallbacks. Locally, with an empty Gradle cache, the build passed with 1,019 requests to the mirror and 2 to Maven Central. In the cloud, the next five sessions all answered PASS.

One proxy detail that is documented, and that breaks workflows: it rejects GitHub’s GraphQL API with a 403. gh pr and gh issue use GraphQL, so they fail. You have to go through gh api against the REST API. If you have skills or scripts that open issues with gh issue create, they won’t work in the cloud.

Apple stays on the Mac, Swift package included

No Xcode, no simulator, no xcodebuild. I expected that. The core Swift package I didn’t. The docs put swift.org on the default allowlist, so I could install Swift for Linux in the setup script, but it’s pointless while the package imports Apple frameworks.

My fix for now is the boring one: the script that runs all my checks before a push now notices it isn’t on macOS and skips swift test with a warning. That way a cloud agent can touch Android without the check failing on something it can’t run. Any change to the Apple side still needs swift test on the Mac before it merges.

The real fix would be splitting the package: a Foundation-only core, the Apple bits behind #if canImport, and swift-crypto instead of CryptoKit. I haven’t done it. First I want to know how much of the package is actually pure, because if it’s under half, the refactor isn’t worth it.

What I do send it

With Apple out, I’m left with work that needs neither the Mac nor any key:

  • Website changes. Next.js with pnpm, the easy case.
  • Android JVM tests. Gradle unit tests and lint don’t need an emulator.
  • Docs audits. Checking ADRs and docs against the code and opening a PR with whatever drifted.
  • Research that reads outside content. I’d rather that happen on a machine that doesn’t hold my Android keystore or the Google Play service account. In the cloud, GitHub credentials and “network secrets” are injected outside the VM, but environment variables and the setup script are readable by anyone using the environment, so my keys stay on the Mac.

The docs recommend planning locally and executing in the cloud: save the plan to a file in the repo, push, and run claude --cloud "Execute the plan in docs/plan.md". Makes sense, since the VM starts from scratch every time and has to reread the repo and my CLAUDE.md, which isn’t short.

Next I want to try a nightly scheduled task that runs the JVM tests and the site build on master and opens an issue only when something fails. I don’t pay for GitHub Actions minutes, so it would be partial CI. Two catches: scheduled tasks are still in “research preview,” and the docs say they draw down subscription usage the same way interactive sessions do.

I measured it: the same task costs about 9x more in the cloud

Someone on X pointed out that the usage bar is too coarse for this, and they were right: my plan only shows a weekly bar. So I counted tokens. The task: run the Android JVM tests and answer PASS or FAIL, changing nothing. I ran it five times locally with claude -p and five in the cloud. I used the same model (Opus 5.5) and the same Android code on both sides, plus one uncounted warm-up run per side. The cloud clones master when it starts and other sessions pushed during the test, so the last two cloud runs started from newer commits, and the last one loaded one more skill into its prompt.

For the cloud side I used a trick that isn’t obvious: claude --teleport <id> -p "/context" pulls a cloud session’s transcript down to your machine without calling the model, and that transcript keeps the token counts of every response. I priced them with the per-token rates the CLI itself applied to the local runs, so both sides go through the same formula. It’s the CLI’s estimate, not your bill.

LocalCloud
Result5 PASS5 PASS
Cost per run (median)$0.028$0.265
Tokens written to cache (median)0about 29,000
First-call promptabout 60,000 tokensabout 86,000 tokens

Locally, with a warm prompt cache, a run only reads from it. The first of the five I counted still found it cold and cost $0.41, which is why I use medians. With means, the cloud comes out about 2.6x more expensive, not 9x. In the cloud, every session reuses about 62,000 cached tokens but writes another 24,000 fresh ones on its first call, even when I start them back to back. That write accounts for about $0.20 of the $0.27, and it’s a fixed cost per session. Most of what gets written after that is Gradle output, which is bigger in the cloud, partly because those JAVA_TOOL_OPTIONS lines repeat for every process. So the 29,000 in the table is the whole run, about 24,000 of it from the first call.

The limits, before anyone draws big conclusions. Five runs per side of a tiny task; on an hour-long task, a fixed $0.20 or so barely matters. Locally it ran headless with claude -p and the cloud ran interactive, so their system prompts aren’t identical. And I don’t know whether the plan limit is counted the same way these rates are. What it does make clear is that ten small tasks in ten cloud sessions don’t cost the same as ten local ones.

What I’m not sold on

Every session is slow. The five measured sessions took about five minutes each for a task that takes seconds on my Mac, because Gradle downloaded the test libraries and compiled from scratch. The disk snapshot already had Java 25, Gradle, the SDK and the build’s plugins, just not those libraries. The new setup script tries to preload them in whatever time is left of its five minutes, but I haven’t reloaded it into the environment yet, which is a manual step: changing the file in the repo doesn’t change the copy the environment keeps. I don’t know yet whether it has enough time.

It’s cheaper at home. Going by the numbers above, a small task on my Mac costs a fraction of what it costs in a fresh cloud session, and the Mac already runs several sessions in separate worktrees. The cloud wins when I close the laptop or kick something off from my phone, not when I’m sitting at the desk.

I find out late when it’s done. On Sunday my agent started a cloud session from the desktop app to test the environment, and the tool itself warns that the local session gets nothing back when a cloud session finishes. I have to go check.

Reviewing is still my job. Five tasks means five PRs to read, and on Android nobody has seen the screen, because there’s no emulator over there. For a solo dev the bottleneck isn’t launching tasks; it’s reviewing them.

Your first move

If your repo has parts that aren’t Linux, take inventory before you set anything up: which of your check commands need macOS, Windows or a device, and which don’t. Then write the setup script and test it in an ubuntu:24.04 container on your machine before pasting it into the environment. If it takes more than five minutes it won’t be cached, and every session pays for it in full.

Before you send the cloud a string of small tasks, measure one of yours with the teleport trick: if your starting prompt is big, so is the fixed cost of every session.

And the question I actually care about: what do you send to the cloud, and have you noticed it eating more of your limit than local, or taking away freedom through the sandbox, the domain allowlist or your missing tools?

Sources

Read on November 16, 2026.

Related reading: what happens when several agents share the iOS simulator locally.


P.S. If you build for Apple and you’ve already moved part of your code to Linux to test it in the cloud, tell me how on LinkedIn.

Share this article