I Moved 22 AI Agents Off the Cloud. The Model Was the Easy Part. A practitioner moved 22 personal AI agents off cloud APIs to a local Mac Studio with an M3 Ultra and 256 GB of unified memory, completing the cutover on September 21 ahead of a September 25 deadline, and reported that selecting the local model was the smallest part of the work. In a 24-task pack covering structured output, grounded answers, reasoning, small coding problems, permission decisions and multi-step tool use, GPT-OSS 120B through Ollama passed 23 of 24 tasks, a public Qwen3.8 27B build on MLX passed 19, and Qwen3 Coder 30B through Ollama passed 16, with no configuration passing the original gate. The author routed every app through a single gateway alias, local-auto, with deterministic code filtering candidates by capability, memory budget, runtime verification and availability before the small local decision model Laya chooses among them, and banned automatic cloud fallback except for the frontier models Astra and Fable under explicit per-task approval. I wanted my everyday AI work running on my own machine: the agents that manage my projects, the coding assistant I talk to all day, and the thing that decides which model handles a request. I gave myself until Friday, September 25. The cutover landed on the 21st. Picking a local model turned out to be the smallest part of the job. The Setup Two rules going in. Ordinary work runs local, period. And the two frontier models I'd still allowed myself, Astra and Fable, need an explicit approval tied to a specific task. A local model struggling with something doesn't get to quietly ship that task to a cloud API on its own. No automatic fallback, ever. The pieces: ClaudeClaw is the app that coordinates my personal agents. An agent is a model plus instructions, tools, and a job. My install has 22 of them. OpenCode is the interactive coding harness. Between those apps and the models sits a gateway, and Laya is a small local decision model the gateway consults for some of its choices. The hardware is a Mac Studio with an M3 Ultra and 256 GB of unified memory, which means these results say nothing about your laptop. It also doesn't mean I could stop thinking about memory. The OS, loaded models, and in-flight requests all want space at once, and one model alone sits at 64 GB. Three deliverables: give Laya bounded jobs inside ClaudeClaw, move ordinary agent inference local, and rebuild the gateway to pick a local model per request. One user, real backups, real tests, a rollback drill, and no long trial period. I'd rather use it and fix what actually breaks. What's Actually Going On The first surprise was how many places call a model. Changing the model in the main chat window was a fraction of it. There were agent defaults, scheduled jobs, dashboard chat, helper calls, summaries, a model-selection command, child processes, and fallback behavior. Some paths assumed a cloud model would always be there; others had one local model hardcoded. A workflow can look local while a helper quietly hits a remote service, or start local and switch providers after a failure. "Local-first" isn't a setting. It's an inventory. The second surprise was that choosing a model is really four questions. Can it produce a useful answer? Can it follow an exact output format? Can it request a tool correctly, read the result, and keep going? And can the installed runtime actually serve it reliably within the machine's limits? I screened five installed configurations, then ran three through a 24-task pack: structured output, grounded answers, reasoning, small coding problems, permission decisions, and multi-step tool use. Strict scoring: GPT-OSS 120B through Ollama passed 23 of 24. A public Qwen3.8 27B build on MLX passed 19. Qwen3 Coder 30B through Ollama passed 16. Those are scores for those configurations on those tasks, not a model ranking. Runtimes and cold-start conditions differed. And nobody passed the original gate. GPT-OSS's one miss was a tool call with missing id where the fixture expected the literal missing . Arguably a fixture ambiguity. I kept the failure anyway. A changed test deserves a new run, not a revised story about the old one. The other failures were more instructive: right answer, wrong field names; a coding constraint ignored; an answer given without doing the required lookup. A human reads the intent. Software depending on an exact contract can't. So GPT-OSS 120B became the general-use pick, with Coder 30B as the faster alternative. Later serving checks proved the runtime could run both correctly, which is a different claim from "this model solves the task." I try not to let the two blur. The Fix Every app now sends requests to one gateway alias, local-auto . No agent is permanently married to a model. Before Laya sees anything, deterministic code drops candidates that aren't allowed or can't handle the request: missing capability, over the memory budget, unverified runtime, or unavailable. Laya picks among what's left, and the gateway re-checks before execution. A model can help choose between permitted options. It can't grant itself permission, raise its own memory allowance, or authorize a cloud call. If Laya is unsure or down, the gateway falls back to a permitted local model. If nothing qualifies, it refuses, and refusal beats overloading the box or breaking the policy . On a held-out routing replay, Laya made 37 acceptable decisions out of 40 against 33 for the deterministic baseline: 15 direct picks, 17 fallbacks, 8 correctly blocked as unavailable. The 40 include paired preferences on the same tasks, so it isn't 40 independent wins. Routing latency also ran over my 100 ms target on a busy host, so timeout and fallback stayed mandatory. Memory admission got its own rewrite. "Free RAM" alone was too conservative, since macOS uses spare memory for reclaimable file cache. Counting everything as reclaimable was too aggressive. The gateway now credits a bounded slice of cache, holds back an 8 GiB host reserve and a 2 GiB per-request workspace, caps resident models at 180 GiB combined, and admits one generation at a time. In serving checks, Coder peaked around 21.8 GB resident and GPT-OSS around 64.5 GB. Which model is best and whether it fits right now are two different decisions. Token counting had to be exact, and it had to count what the backend actually renders: system instructions, history, tool descriptions, template formatting, not just the visible message. GPT-OSS made this annoying because the standalone tokenizer didn't support its architecture, so I bound the count to the native runner's verified tokenizer and tied it to the exact runtime and model identity. Then an Ollama update changed the runtime, and the config checks refused the stale evidence, which is their job. I pinned a durable Ollama 0.34.2 outside the auto-updating app and requalified both models: five token-parity checks and five serving cases each, with tools, streaming, and inputs past 28,000 tokens, against a 32,768-token context and a 4,096-token output cap. Cloud approval is a receipt, not a toggle. It binds the allowed model, the task, a prompt digest, a 15-minute expiry, and a turn limit. One use. A failed cloud attempt burns it. Memory in the other sense, the stuff my agents remember, needed its own migration. ClaudeClaw stores embeddings, and you can't mix vectors from two embedding models even when the arrays are the same length. I rebuilt the index on local Nomic v1.5: all 2,371 production memories, prepared on the side, activated in one transaction, every old vector kept for rollback, after a rehearsal on a copied database. What broke that had nothing to do with models iCloud had evicted dependency files and a model checkpoint under Documents, so startup reads stalled. Fix: durable local storage, originals preserved, hashes verified. Don't run inference out of a synced folder. The AI code-review gate reported no findings on a PR while reading two of four changed files. The two it skipped were deletions. The review had discussed them, but the follow-up question about which files it read dropped them. A positive review isn't proof the review happened. I fixed how that evidence is requested, split big PRs into smaller ones, and verified the merged tree matched the full implementation. OpenCode retried on its own. A real 503 fixture showed the session layer retrying with the SDK's retry count set to zero. For an assistant with tools, retrying uncertain work can repeat an action. The wrapper now owns request identity, cancellation, and terminal errors instead of trusting a provider flag. And the first post-cutover health probe timed out because it hit unauthenticated localhost while the dashboard binds to authenticated Tailscale. The service was fine. Sometimes the failed test is the bug. Why This Matters The finished system is substantially local, not sealed. Speech transcription and Gemini Live voice are off until I qualify a local replacement local speech output still works . Laya's recovery advice failed its evaluation and stays off; the old bounded recovery rules still run. My gbrain knowledge base still uses its Gemini embedding path, on purpose, because it has lifecycle problems I didn't want to entangle. And I did no cost study. Local inference costs hardware, power, storage, and my time. I did this for control over model use and where my data goes, not for a savings number I can't back up. What I got is a workflow that follows a policy I can inspect. Apps ask for local inference, the gateway decides what can run, approvals gate the exceptions, and the request journal shows which backend did the work. Every failure above is still in the evidence, so I can fix the parts that bite in practice. If you're considering the same move on smaller hardware, start with one model. Dynamic selection earns its keep only when you have several verified options that differ in ways that matter. Quick Reference - Inventory every model call first: defaults, scheduled jobs, helpers, summaries, child processes, fallbacks. Cloud leaks live in the helpers. - Decide up front what data may leave the machine and what an approved exception looks like. Bind approvals to a task, not a session. - Build a small task pack with checkable outcomes: one exact-format task, one tool-use task, one the system must refuse. Keep the failures in the score. - Separate "the runtime can serve it" from "the model solves it." Qualify both. - Separate "best candidate" from "fits under current load." Admission is its own check. - Pin the runtime. An auto-update invalidates tokenizer proof. - Never mix embeddings from two models. Rebuild, activate atomically, keep the old vectors. - Don't run models or dependencies out of an iCloud-synced folder. Found this useful? I share practical lessons from my systems engineering journey at As The Geek Learns https://astgl.substack.com . Frequently Asked Questions What does “local-first” mean for a fleet of AI agents? It means every ordinary request runs on-device by default, with no automatic path to a cloud model. In this cutover, “local-first” meant auditing every call site defaults, cron jobs, helpers, fallbacks , not just the main chat window. How do you choose which local model to run if you’re moving off cloud APIs? Test with a bounded task pack that includes structured output, tool use, and a refusal case, then score strictly and keep the failures. In this case GPT-OSS 120B passed 23 of 24 tasks; two runner-up configurations passed 19 and 16. Can a local routing model grant itself cloud access or more memory? No. A deterministic gateway layer filters candidates before the routing model sees them, and rechecks after it decides. The routing model can pick among permitted options; it can’t authorize a cloud call or raise its own memory allowance. How much unified memory does a 120B-parameter local model actually use? In serving checks on a Mac Studio, GPT-OSS 120B peaked around 64.5 GB resident, while a 30B coding model peaked around 21.8 GB. Actual usage depends on context length, concurrency, and the runtime. What happens if no local model qualifies for a request? The gateway refuses the request rather than exceeding the memory budget or silently reaching a cloud model. Refusal is treated as the correct outcome when no permitted option fits, not as a failure to route around. Why does pinning the runtime version matter for local LLM setups? An auto-updated runtime can silently invalidate tokenizer and serving proof gathered against the old version. In this cutover, an Ollama update forced re-qualifying both models from scratch after pinning a fixed version outside the auto-updating app. Is it safe to run local AI models or their dependencies from an iCloud-synced folder? No. iCloud can evict files it considers reclaimable, including model checkpoints and dependency files, causing stalled or failed startup reads. Store inference dependencies and checkpoints in durable local storage instead.