{"slug": "coding-agent-for-local-models-on-a-mac", "title": "Coding agent for local models on a Mac", "summary": "OptiQ Code, a new terminal-based coding agent, runs entirely on local Mac models without cloud dependencies or per-token billing. It achieves a 36% resolve rate on SWE-bench-Lite with a 4B model and guarantees a valid patch on every task, addressing reliability gaps in smaller local models. The tool supports approval modes, session persistence, and headless operation for CI workflows.", "body_md": "# The best coding agent for local models on a Mac\n\nPoint it at a repo, describe a change, and watch a model you are running yourself edit the code and get the tests green. No cloud, no API key, no per-token bill.\n\nOptiQ Code is a coding agent that lives in your terminal and runs on your own model. It drives whatever `optiq serve`\n\nis serving, a 4-bit quant on your MacBook or a 27B on a Mac Studio, through the same read, edit, run-tests loop you would expect from a cloud agent. Everything stays on your machine.\n\n``` bash\n$ pip install mlx-optiq\n$ optiq serve --model mlx-community/Qwen3.6-27B-OptiQ-4bit --idle-timeout 300\n$ cd my-project && optiq code\n```\n\n## Why run the model yourself\n\nCloud coding agents are excellent. They also send your code to someone else's computer and bill you by the token. For plenty of work that trade is fine. For a private repo, an offline machine, or a long agent loop you would rather not meter, it is not. A local model drops the meter and the network. The catch has always been that local models are weaker, and weaker models fail in ways a strong one hides.\n\n## Built for the model you actually have\n\nA small model often reasons its way to the right fix and then loses it on the mechanics. A diff that will not apply. A turn spent re-reading the same file. An empty patch on the last step. OptiQ Code spends its engineering there, not on another prompt.\n\n**It never returns an empty patch.** Every way the loop can end salvages the working`git diff`\n\n. Out of turns, crashed, or stopped by the clock, your change still comes back.**It recovers from a bad edit.** When an exact-match edit keeps missing, the harness stops retrying and asks for a full-file rewrite instead of dead-ending.**It refuses to stall.** Reading without editing, or repeating itself, trips a nudge: make one small, testable change, then run the tests.**It tolerates messy output.** ANSI is stripped, and a tool call the model wrote as text instead of a structured call still runs.\n\n## Watch it edit itself\n\nThe honest test of a coding agent is whether it can work on its own code. Here OptiQ Code, driven by a local 27B, adds a feature to its own `tools.py`\n\nand turns a planted test green.\n\n## Proven on real bugs\n\nReliability here is a measured result, not a slogan. An initial version of OptiQ Code, driving a 4B local model, resolved 36% of a SWE-bench-Lite subset, a state-of-the-art result for a model that size. The resolve rate matters less than what sits underneath it: a valid patch on every task. A comparable-budget baseline came up empty on 40%. That gap is the point. A stronger local quant lifts the resolve rate, and the reliability is there from the start.\n\n## Approve every edit, or let it run\n\nRead-only tools always run. Anything that touches your files pauses for a single keystroke, so you stay in the loop by default. Trust the repo, or running unattended? Auto mode skips the prompts.\n\n## It remembers\n\nEvery run is saved per repo. Pick up where you left off with `optiq code -c`\n\nand the model keeps its context. Export any session as a shareable trace with `optiq code export`\n\n, handy for a bug report or for building a dataset from your own work.\n\n## Bring your best local model\n\nOptiQ Code drives whatever you serve, so it gets better as your model does. For the best results, use the OptiQ quant with the highest Capability Score your Mac can run. In general that is [Qwen3.6-27B-OptiQ-4bit](https://huggingface.co/mlx-community/Qwen3.6-27B-OptiQ-4bit).\n\n## Get started\n\n``` bash\n$ pip install mlx-optiq\n$ optiq serve --model mlx-community/Qwen3.6-27B-OptiQ-4bit --idle-timeout 300\n$ cd my-project && optiq code\n\n# or headless, for scripts and CI\n$ optiq code -p \"Fix the failing test in parser.py\"\n```\n\nThe [OptiQ Code guide](/docs/code/) covers approval modes, sessions, the tool set, and headless use. The [product page](/code) has the full picture.", "url": "https://wpnews.pro/news/coding-agent-for-local-models-on-a-mac", "canonical_source": "https://mlx-optiq.com/blog/optiq-code", "published_at": "2026-07-18 15:14:24+00:00", "updated_at": "2026-07-18 15:51:49.893950+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-tools", "developer-tools"], "entities": ["OptiQ Code", "Qwen3.6-27B-OptiQ-4bit", "SWE-bench-Lite", "MacBook", "Mac Studio"], "alternates": {"html": "https://wpnews.pro/news/coding-agent-for-local-models-on-a-mac", "markdown": "https://wpnews.pro/news/coding-agent-for-local-models-on-a-mac.md", "text": "https://wpnews.pro/news/coding-agent-for-local-models-on-a-mac.txt", "jsonld": "https://wpnews.pro/news/coding-agent-for-local-models-on-a-mac.jsonld"}}