mlx-optiq
OptiQ Code · terminal coding agent

A coding agent for your local model.

It drives whatever optiq serve is serving, a 4-bit quant on your MacBook or a 27B on a Mac Studio, through a read, edit, run-tests loop right in your terminal. Offline. Private. Yours.

$ pip install mlx-optiq
$ optiq code
optiq code · ~/my-project
OptiQ Code running a task in the terminal
How it works

The same loop a cloud agent runs. On your machine.

Describe a change. OptiQ Code plans, edits, and runs your tests, turn after turn, until the suite is green, pausing for your approval on anything that writes.

01 · READ

Ground it

Searches and reads the files it needs, so the change is grounded in your actual code.

02 · EDIT

Make the change

Writes a precise diff, or rewrites a whole file when that is cleaner. You approve it.

03 · TEST

Run the suite

Runs your tests and reads the pass/fail count, so progress is measured, not guessed.

04 · REPEAT

Close the loop

Feeds the failures back and tries again, until the tests pass or you stop it.


Built for local models

Where a weak model breaks, the harness holds.

A small model often reasons its way to the right fix and then loses it on the mechanics. OptiQ Code spends its engineering on exactly those failure modes, so the model you can actually run still lands the change.

When the modelloses the diff on its final turn
OptiQ Codesalvages the working git diff on every exit path. It never returns an empty patch.
When the modelbotches an exact-match edit, again and again
OptiQ Codestops the retries and asks for a full-file rewrite instead of dead-ending on one file.
When the modelreads in circles or repeats itself
OptiQ Codetrips a stall nudge: make one small, testable change, then run the tests.
When the modelwrites a tool call as text, not a structured call
OptiQ Codeheals it into a real call. A format slip does not cost a turn.

On real bugs

A valid patch, every time.

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, and produced a valid patch on every task. A comparable-budget baseline came up empty on 40%. That reliability is the point; a stronger local quant does the rest.

36%
resolved · SWE-bench-Lite · 4B
0%
empty patches · OptiQ Code
40%
empty patches · baseline
Bring your best local model OptiQ Code drives whatever you serve, so it improves as your model does. For the best results, use the OptiQ quant with the highest Capability Score your Mac can run; in general Qwen3.6-27B-OptiQ-4bit is the best pick.

The interface

You stay in the loop.

A session banner that scrolls away, an open prompt, inline tool markers, and single-Enter approval before anything writes to your files. Or hand it the keys with auto mode.

OptiQ Code session start
Session start
OptiQ Code running a task
Running a task
OptiQ Code approval prompt
Approval

Quickstart

Serve a model. Point Code at your repo.

i

Serve a model

--idle-timeout frees the RAM when you step away and reloads on the next turn.

terminalbash
$ optiq serve --model mlx-community/Qwen3.6-27B-OptiQ-4bit --idle-timeout 300
ii

Launch in a repo

Zero config, it discovers the served model. Describe the change; approve edits with a single Enter, or run auto.

terminalbash
$ cd my-project && optiq code
iii

Or run it headless

Auto-approve, run to completion, print the diff, exit non-zero if the goal was not met.

terminalbash
$ optiq code -p "Fix the failing test in parser.py"
$ optiq code -c            # resume the last session
$ optiq code export -o s.jsonl
Where to next The OptiQ Code guide covers approval modes, sessions, the tool set, and headless use in full.

Run a coding agent that's yours.

No cloud, no API key, no per-token bill. Your model, your machine, your code.