From Cloud to Local: A Complete Guide to Full Control of AI Coding Workflows

A five-stage evolution showing how AI coding shifts from cloud-managed to fully local, and the trade-offs involved.
The article introduces a course by JetBrains developer advocate Paul Everett that uses an "Agent Clinic" app and a unified spec-driven development process to compare five stages of AI coding workflows, from fully cloud-based to fully local. It demonstrates sub-agent splitting, large/small model division of labor, switching to OpenCode and OpenRouter, and running Gemma 4 and Qwen 3.5 locally with LM Studio, quantifying changes in context, rounds, tool calls, and cost, and concluding that small-model success depends on refined handoff packages and guardrails, with human review still essential.
From Cloud to Local: A Complete Guide to Full Control of AI Coding Workflows
When most people talk about AI coding, what comes to mind is usually an out-of-the-box cloud tool like Claude Code or Codex—the model and the workflow are both managed for you by the provider. But the situation is changing. Open-source coding frameworks such as OpenCode and PyCodingAgent, paired with open-weight models, are letting developers choose for the first time "who writes the code," "which model writes it," and "where the model runs."
This course, taught by JetBrains developer advocate Paul Everett, uses a fun app called "Agent Clinic" (a small website that lets AI agents roast humans) to systematically demonstrate how to move from a fully managed cloud workflow step by step toward a localized setup where the model runs entirely on your own machine. Each stage is compared using the same app and the same spec, making the trade-offs among cost, privacy, speed, and code quality quantifiable and tangible.
Why Do We Need to Reclaim Control?
Default AI coding tools typically use the same (usually the largest) model for all tasks. The course opens by pointing out three core motivations:
- Choose models by task: Not every job needs a frontier model. Using a top-tier model for routine tasks is like paying first-class airfare for a taxi ride.
- Decide where your data goes: Running models locally means code and prompts don't have to leave your machine. For some teams this isn't a preference—it's a hard requirement.
- Shape the workflow itself: You decide which agents run, what instructions they follow, and how work is split among them—so AI supports the way you work, not the other way around.
The course candidly admits that this field "is still very raw": cloud models cost money, and local running requires a machine that's powerful enough, ideally with an "enthusiastic fan." But the core skill is transferable—learning AI-assisted coding shouldn't be about learning to use one specific tool.

Methodology: Spec-Driven Development and Clean Context
The entire course uses a streamlined version of "spec-driven development." The project constitution consists of three files: mission (the project's mission), tech stack (technology stack constraints), and roadmap (a phase-ordered roadmap). Each time a new coding approach is tried, it's given the same spec and asked to build the entire app in one shot, thereby keeping the variable fixed at "architectural choice" itself.
A habit that runs throughout is "clean context": every lesson starts from a new conversation and cleans up all generated files before finishing. This isn't fussiness—it's because there's a clear inverse relationship between context length and output quality. The course cites a research chart on context length showing that quality declines as context grows, a phenomenon known as "context rot." Frontier models have large windows and high tolerance; small models don't have that luxury.
Context rot refers to the phenomenon in which large language models suffer a systematic decline in output quality as the conversation context keeps growing. The reason is that a model's attention mechanism doesn't distribute evenly: when a large amount of history, tool output, and irrelevant detail is stuffed into the context, key instructions get diluted, and the model is more likely to forget earlier constraints, repeat mistakes, or drift from the task goal. Research shows that even in models claiming support for ultra-long contexts, performance degrades noticeably beyond a certain threshold. For agentic coding, this means that rather than endlessly expanding the window, it's better to actively manage context: each sub-agent starts from a clean state and receives only the handoff information relevant to the current task, keeping the model always working within the "high-quality zone." This also explains why the course repeatedly emphasizes "clean context" and "splitting tasks."
Five-Stage Evolution Path
Stage One: Cloud Baseline (Claude Code + Sonnet)
The first version builds the app in one shot using Claude Code with Anthropic's Sonnet model. The result is fast and high quality, but with less control and higher cost. In this run, Claude Code spawned a sub-agent on its own; the sub-agent consumed 54% of the context and made 61% of the tool calls, while the main agent retained a substantial orchestration role. This is the baseline against which all subsequent comparisons are made.
Stage Two: Splitting Tasks with Sub-Agents
The core insight of the second stage is: rather than having a single context window carry the entire build, split the work among sub-agents, each receiving fresh, focused context. Still 100% in the cloud with the same model, but the main agent becomes a leaner coordinator—rounds drop from 7 to 6, and context drops from 217K to 192K. The cost is that sub-agent context nearly doubles, total context and rounds increase by about 50%, and cost rises slightly. This is a classic "pay first, reap later"—clearer phase boundaries bring measurable coordination costs.
Stage Three: Big Brain Thinks, Small Brain Executes
Now that the work has been split into small chunks, it's time to let a cheaper model do it. The main agent continues to use Sonnet for planning and orchestration, while the implementation sub-agent switches to Haiku. The course's analogy is vivid: the large model is the "big brain" responsible for thinking, and the small model is the "small brain" responsible for doing. The results are intriguing—rounds increase by 50%, tool calls increase by 48%, but context increases by only 29%; average sub-agent context per round drops from 21K to 17K, and cost drops significantly. The key precondition is: small models can only succeed when guided by small, tight specs—bad plans lead to bad results.
Stage Four: Switching Agents and Model Providers
Staying inside the Claude ecosystem limits your choices. The course switches to the open-source coding agent OpenCode (integrated into the IDE via ACP) and introduces OpenRouter as a unified routing and inference provider—one API key gives access to a model catalog, saving you the hassle of managing separate accounts and billing for each provider.
The course chooses DeepSeekAd V4 Pro: according to the instructor at the time of recording, it's cheaper than Haiku yet stronger than Sonnet. Building the app in one shot with the new combination works fine, but the data reveals a detail: the direct run used 25 rounds, 38 tool calls, and 530K context, whereas the previous stage used 19 rounds, 28 tool calls, and 474K—the so-called "two-cent cost" showcases DeepSeek's pricing advantage, not a better orchestration strategy.

Then the sub-agent pattern is reproduced in OpenCode, and a custom sub-agent "implementer" is further defined, with its model choice declared in a Markdown file—the main agent Pro (big brain) runs each feature loop and carefully prepares a "handoff package," Flash (small brain) executes the concrete tasks, and Pro then reviews the results as a judge. The data changes dramatically: the main agent uses only 6 rounds and 90K context, while the sub-agent consumes 94% of the context and 85% of the tool calls; compared with direct implementation, total rounds increase by 120%, context by 179%, and cost nearly triples—but the absolute dollar amount remains very low.
The core lesson here is: the quality of the handoff package determines success or failure. It confines the sub-agent's scope of work to within the implementer model's capacity, and provides the necessary hints and guardrails.
ACP (Agent Client Protocol) is an open protocol for communication between code editors and external coding agents—think of it as a "universal interface between editor and agent." Traditionally, every AI coding tool has to adapt separately to different IDEs; ACP tries to standardize this layer: the editor launches the agent process through the protocol, sends user requests, and receives streaming output and tool-call events. For developers, the benefit is decoupling between agent and editor—you can keep using your familiar IDE (such as the JetBrains family) while freely swapping the underlying agent implementation, e.g., plugging OpenCode into the IDE without depending on a vendor-specific plugin. This pluggability is the technical foundation that lets the course "switch agents and model providers" without changing work habits.
Stage Five: Moving the Model onto Your Own Machine
The turning point of the course is the redefinition of "local"—it really means "yours": it can be your powerful desktop, a computer in the corner of the room, a server in your company's data center, or even a private cloud.
Using LM Studio (cross-platform and beginner-friendly), the course selects Gemma 4—a 12-billion-parameter mixture-of-experts open-source model, about 12.7GB after quantization, with the goal of leaving headroom on a 16GB desktop. Here's a pragmatic reminder: don't be tempted by "the bigger the context, the better"—agentic coding is resource-intensive, and small and focused is the right way.

Local models haven't been trained to optimize for agentic coding, and the behavioral differences show up immediately. To address this, the course makes a lot of engineering adjustments:
- Split the roadmap: make the "add complaint"-related tasks from stage two into a separate stage, reducing the amount the small model has to handle at once.
- Rewrite the sub-agent definition: add a step cap (set to 12 to prevent infinite loops), restrict file access permissions, and disable some tools.
- Be explicit about tool choice: one key point is "use the write tool, not edit"—small models are prone to errors in edit operations.
- Tests as guardrails: provide the exact test command, require reporting the results but do not attempt to fix, and even more so do not fall into a loop of rerunning tests repeatedly.
- Prompts become multi-turn: no longer build in one shot, but go stage by stage, with an opportunity for human review and correction at each step.
The course also mentions an honest limitation: what's in the prompt and agent definition is "persuasion," not "requirement." Small models often have their own ideas—one time the handoff package clearly said "don't write the full code," and Flash still wrote more. It's stochastic.
Mixture of Experts (MoE) is a model architecture: the model internally contains multiple "expert" sub-networks, but only a small subset is activated in each forward pass, dynamically selected by a routing mechanism based on the input. The result is that the model's total parameter count can be large (high storage and knowledge capacity), while the number of parameters activated during actual inference is smaller (low compute cost, fast speed). This fits perfectly with local deployment needs—Gemma 4 is labeled as 12 billion parameters, but only some experts are used during inference, allowing it to run on a 16GB desktop. What needs to be distinguished is "total parameters" versus "activated parameters": the quantized file size is determined by total parameters, while inference speed and compute requirements are closer to activated parameters. Understanding this helps you judge whether your hardware can handle a given local model.
Stage Six: Fully Local Dual Brains
The final step moves the main agent local as well. The main agent has heavier responsibilities—it needs to plan work, prepare handoffs, and review results, so it needs a larger model. The course targets a machine with 32GB of memory and selects the Q4 quantized version of Qwen 3.5 27B (about 21GB), with more than twice the parameter scale of Gemma 4.
The results are unexpectedly good: the handoff packages written by the local big brain look even better than those from the larger DeepSeek Flash. Two of the three stages had no major issues throughout, and the third had a common minor issue with HTTP redirects that caused test failures; the main agent then correctly dispatched a fix task and resolved the problem.
A notable model behavior difference surfaces: the local model took 45 rounds of conversation to complete work comparable to the previous 6 rounds (57 tool calls vs. 51). Rounds should be interpreted as interaction style, not amount of work completed. The billing cost of fully local execution is zero; the only two cents come from metered calls to the main agent; the wall-clock time of 8 minutes 52 seconds is mostly sequential main-agent work.

Quantization refers to the technique of reducing the numerical precision of model weights to compress size, reduce memory usage, and accelerate inference. A common approach is to convert weights originally in 16-bit floating point to 8-bit, 4-bit, or even lower; for example, "Q4" means 4-bit quantization, with model size roughly half to a quarter of the original. The cost is precision loss: the more aggressive the quantization, the greater the risk of degradation in subtle reasoning and code correctness. The course's choice of the Q4 version of Qwen 3.5 27B (about 21GB) rather than higher precision is precisely a trade-off under the 32GB memory constraint. Practical advice: prefer quantization formats with strong community validation (such as GGUF's Q4_K_M), run small-sample comparative tests on your own tasks, and then decide whether to accept the quality cost, rather than blindly pursuing the smallest size.
What This Methodology Really Teaches You
The course's landing point is restrained: it doesn't declare any one workflow "best." Sometimes a familiar cloud process is still the right choice, sometimes a cheaper model is already enough, and sometimes extra privacy and control are worth the extra effort. What's truly transferable is understanding how coding agents connect to models playing different roles through cloud and local providers, so you can build a solution that matches your own priorities.
The instructor offers a forward-looking judgment: just as a certain industry wave brought agentic coding into the mainstream, within the next year, hybrid and local AI may move closer to practical use. And the key variable isn't the model itself, but new agent frameworks designed for small-model success—currently there are only a handful of frameworks specifically targeting small models, but the earliest experiments have already proven feasible.
If your machine doesn't have enough memory to run the full setup, the course's advice is: try aggressive quantization versions and judge the quality cost for yourself; most importantly, pay attention to new agent frameworks rather than fixating on models.
One-line Summary
Through a five-stage evolution, it demonstrates the migration of control and the trade-offs in AI coding from fully managed cloud to fully local execution.
Paragraph Summary
The article introduces a course by JetBrains developer advocate Paul Everett that uses an "Agent Clinic" app and a unified spec-driven development process to compare five stages of AI coding workflows, from fully cloud-based to fully local. The core motivations are choosing models by task, controlling where data goes, and shaping the workflow. The course demonstrates sub-agent splitting, division of labor between large and small models (big brain thinks, small brain executes), switching to the open-source agent OpenCode and OpenRouter, and running Gemma 4 and Qwen 3.5 locally with LM Studio, while quantifying changes in context, rounds, tool calls, and cost. The key conclusion is: small-model success depends on refined handoff packages, tool restrictions, and test guardrails; prompts are only "persuasion," not "requirements," and human review remains a necessary line of defense.
Related articles

GTA 6 Multiplayer Racing Gameplay: Fun Times with Friends
YouTube friends' multiplayer gameplay: six new GTA 6 racing maps, custom vehicle disputes, puzzle track design, planes vs. scooters asymmetric showdown, plus player feedback on network sync and controls.

GNOME Moves to Ban All AI Contributions, Open Source Community Faces Split
GNOME Foundation proposes a draft policy banning all AI contributions across code, docs, translations, and more. Community reaction is split, accelerating divisions in open source.

When Claude Writes 90% of the Code, Should Developers Say Goodbye to Hand-Writing?
Tech creator Theo discusses how AI tools like Claude now write over 90% of code: hand-writing is fading, nostalgia is fine but shouldn't belittle AI builders—curiosity and adaptability are the next generation's core edge.