AivexaNewsSearch
AI news for builders and product teamsChecked every hour

Coding From the Himalayas With an Offline AI Agent

Collected Oct 27, 2026

A principal engineer at Thomson Reuters, writing for Latent Space, documented a fully offline coding-agent workflow: the open-source agent OpenCode 1.19.4 driving the open-weight model Qwen3.5 9B, served on the same Mac by Ollama, with Wi-Fi and every other connection switched off before the actual coding task. The author, who lives in the foothills of the Himalayas where network and power outages are routine, wanted to know how much of a normal coding-agent workflow survives without internet. The answer in the walkthrough was a working loop: read a local file, propose an edit, request permission, run the test suite, and pass all five tests.

The stack has three parts. Ollama runs the model and exposes an OpenAI-compatible API on localhost at port 11434. OpenCode is the terminal-based agent that reads project files, proposes edits and runs commands such as tests, with permission prompts before edits or shell commands. Qwen provides the weights, which can be downloaded and run on the laptop itself. The project configuration, opencode.json, points both the main model and the small helper model at Qwen3.5 9B, enables only the local provider, blocks web tools and asks for approval before file edits or shell commands. Ollama was started with the host pinned to 127.0.0.1:11434, cloud features disabled, and a 65,536-token context. Aider, which also supports Ollama, is named as an alternative for a guided-editing style.

Model choice was driven by published numbers from Qwen's model card, not laptop measurements. Qwen3.5 4B scores 55.8 on LiveCodeBench v6, which tests code generation on programming problems, and 50.3 on BFCL-V4, which tests function calling and matters when a model must pick a tool and fill in its arguments. Qwen3.5 9B scores 65.6 and 66.1 respectively. The open-weight gpt-oss-20b scores 74.6 on LiveCodeBench v6, with no BFCL-V4 figure reported. Download sizes scale roughly as you would expect: 3.3 to 4.0 GB for the 4B, 6.6 to 7.6 GB for the 9B used here, and 17 to 20 GB for the 27B. Those are disk figures, not RAM; the article cites a 12 to 16 GB memory budget for a 6.6 GB 9B build, and notes the 64k-token context plus other open applications can push requirements higher. In practice, a developer on a 16 GB laptop is likely to feel that pressure, which is my reading rather than a measured claim.

OpenCode's own track record comes from a research preprint, The Scaffold Effect in Coding Agents, which compared OpenCode, Goose and OpenHands-SDK on 50 Terminal-Bench Pro tasks using two cloud models. With Qwen3.6 Plus, Goose passed 48 percent (confidence interval 34 to 62 percent), while OpenCode and OpenHands-SDK each passed 50 percent (36 to 64 percent). With MiniMax M2.5, Goose passed 38 percent (24 to 52 percent) and the other two passed 46 percent (32 to 60 percent). The authors caution that most of these differences were not statistically clear. The study also reported that OpenCode used roughly 40 times Goose's tokens per solved task. Token appetite is worth weighing: in a local setup, every token is compute on your own machine, so a chatty scaffold may translate into noticeably slower runs even when it edits well. Those runs used cloud APIs and different models, so they say nothing directly about local Qwen3.5 9B performance.

The worked example is deliberately small. A Python script sums five expenses including a refund; the correct total is 25.50, but the starter prints 8.00 because it overwrites its total each iteration instead of accumulating. Three of five unittest cases fail: decimal arithmetic, refunds, and the sample expenses. Empty and single-item inputs already pass. The first prompt asked the agent to read the file and run the tests and explain the bug without editing anything. OpenCode read the source, searched for tests, and initially proposed pytest even though the project uses the built-in unittest, which the permission prompt let the author catch. The lesson there is concrete: name the exact test command in the prompt.

Connectivity checks came next. With Wi-Fi off, a curl to the local Ollama tags endpoint still returned the downloaded qwen3.5:9b model, while a HEAD request to an external address failed with a host resolution error. Then the real task: fix the bug so existing tests pass, without changing tests or installing anything, and run the tests and explain the fix. Qwen proposed a single-character-style change from assignment to accumulation (total += Decimal(amount)), requested edit permission, and ran the five tests successfully. The author then exited OpenCode and reran the suite manually: five passes, the source containing the accumulating line, and the test file untouched. The running program should print 25.50.

Two further exercises ship with the companion project but have not yet been run offline by the author: a CSV report that groups rows by product and computes quantities and revenue, with seven tests covering grouping, decimal arithmetic, ordering and empty input; and an already-running log analyzer with bugs in error counting and slowest-request selection, also with seven tests including malformed lines and empty input. Both are pitched as richer checks because they require completing a function rather than a one-line repair.

The practical guidance is mostly about preparation, and it holds regardless of which agent or model you pick. Download dependencies and keep the documentation you need on disk before disconnecting; the examples use only the Python standard library, so their tests need no package downloads, but real projects will. Launch the exact configuration once while online so required runtime pieces are cached, then reuse the same command, model and settings offline. Give the agent the precise test command. Keep tasks focused, review the diff, and run the original tests yourself rather than trusting the agent's summary. Watch memory pressure. And document the retries and permission prompts, not just the green output.

What this does not show matters too. A one-line fix says little about how a 9B model handles a large repository, an unfamiliar framework, or long multi-file changes, and the author says as much. The offline workflow also assumes the project, its dependencies and its test tooling are all present locally; fetching a new package or looking something up on the web still requires a connection. My own read is that this setup fits interruption-tolerant work, like explaining unfamiliar code, diagnosing a failing test or a contained refactor, better than greenfield feature work where a developer would otherwise lean on web search.

Why it matters: developers who work from unreliable networks, travel frequently, or have data-residency constraints now have a documented, reproducible path to a coding agent that reads files, edits code and runs tests with the network physically off, using a 7 GB-class open-weight model on ordinary laptop hardware. The trade-offs are real, though: weaker published coding scores than larger open-weight options, meaningful RAM headroom, and one agent scaffold reported to spend far more tokens than a competitor. For product teams, the interesting signal is that the agent layer and the model layer are separable, so an offline mode built around a local OpenAI-compatible endpoint is plausibly a configuration change rather than a rewrite, though that is inference from this single walkthrough rather than a demonstrated product capability.

Read at Latent Space

Based on reporting from the original publisher. Visit the source for full context and later updates.

Publisher excerpt

How to set up and run an offline coding agent using OpenCode, Ollama and Qwen.