ai
I built Cuqe so a small local model can say no to an agent's action
A 0.6B verifier that runs on a Mac, scores whether a proposed action matches the request, and declines anything under a calibrated cutoff. In archived development runs it kept 39 of 48 correct actions, declined 44 of 48 when the right action was missing, and answered at 365 ms p95.
- #ai-agents
- #evaluation
- #small-models
- #rust
I'm a full-stack engineer looking for applied AI and agent-engineering work. My last two posts asked whether an agent can finish messy work (cue-bench) and whether its change should stay live (agent-guard). This one is about an earlier moment: an agent has picked an action, and something has to decide whether that action is actually what the person asked for.
That project is Cuqe. It's a small local verifier, a fine-tuned Qwen3 0.6B, wrapped in a Rust CLI for Apple silicon Macs. The current v0.4 beta can do exactly two things: report free space on the startup disk, and report the installed Node.js version. Both are read-only. That narrow scope is deliberate, and most of this post is about why.
The question it answers
An agent usually maps the words to a tool and calls it. If the mapping is wrong, nothing notices. For a read, that's an awkward answer. For an action that changes something, it's an incident.
Cuqe puts one cheap question between the choice and the call: given this request and this proposed action, should the action run? The model doesn't plan or pick tools. It reads one request and one candidate, and it says accept or decline. Because it's 0.6B parameters in a Q4_K_M GGUF of about 523 MB, it runs locally on the Mac through Ollama, with no API call.
How it decides
There are two ways in. If the caller already knows the exact read, cuqe --read disk_space or cuqe --read node_version runs it directly, and no model is involved. The free-form path, cuqe --verified "...", takes the person's own words and goes through four gates in order.
- Input. The request must be non-empty, at most 1,024 bytes, and not look like a flag.
- Scope. A plain check, no model. A disk request that mentions an external, USB, removable or network disk is out. A Node request has to be about the local installed version.
- Routing. Stock Qwen3 0.6B classifies the request as
disk_free,node_versionorunsupported. It has to land on the read the command was asked for. - Verification. The v21 checkpoint scores the request against that read's description. Cuqe reads the log-probabilities of the accept token and the decline token, and subtracts one from the other. The read runs only when both scores are present, the margin is finite, and it is at least 2.2131806164979935.
That cutoff wasn't picked by hand. In the calibration run, it's the highest cutoff that still kept at least 90% of the stock router's correct proposals. eval/report.py recomputes it from the archived scores and fails if it doesn't match.
Scroll sideways to read it. The labels stay full size.
I drew this with a statechart tool that writes the model in TLA+ and has the TLC model checker walk every path. TLC reached 17 states and 25 steps, and these rules held in all of them:
- A read runs only from an explicit ID, or after the scope check, the router and the verifier all agreed.
- A free-form answer always means the margin cleared the cutoff.
- A decline or a refused input runs nothing.
- A low score, a missing score or a non-finite margin never runs a read. Missing evidence isn't a pass.
- An explicit read ID never calls either model.
- The router is asked only after the scope check, and the verifier only after the router agreed.
- Each model is asked at most once per run. There's no retry loop inside the CLI.
The model treats "the router agreed" and "the margin cleared" as events. It doesn't predict them. That's what the eval is for.
What the eval says
The numbers come from archived development runs on an Apple M4 with Ollama 0.40.15. The repo keeps the IDs, proposals, margins and timings as JSON, with hashes of the original archives, but not the request text. python3 eval/report.py rebuilds the table from those files without running either model, and I re-ran it on today's main.
One caveat matters more than any number here. These were simulated action catalogs with many actions beyond the two reads Cuqe ships. They measure the verifier, not the CLI.
What each one means:
- 39 of 48 kept. Each development request was shown with the correct action in the catalog. In 39, the router picked it and the verifier kept it.
- 44 of 48 declined. The same requests again, with the correct action removed. Declining is right, and it did that 44 times.
- 35 of 48 both. Requests where both presentations ended correctly, the strictest view.
- 38 of 42 kept in calibration. Of 42 correct router picks on a separate set, 38 cleared the cutoff: the 90% floor it was chosen for.
- 22 of 25 declined. Of 25 archived wrong proposals, 22 scored below the cutoff.
- 365 ms p95. Warm routing plus verification, over 96 presentations.
- 1.08 GiB. Peak resident size of both models, as Ollama reported it.
The bar chart hides where the misses are, so I also plotted every score against the cutoff.
Two things stand out to me. First, most of the misses on the "should be kept" side sit just under the cutoff. Of the 9 offered cases that went wrong, 7 were correct router picks that scored too low, and 2 were router misses that the verifier then declined. Second, the false accepts aren't all near the line. In the wrong-proposal replay, the three that got through scored 2.88, 3.00 and 4.52. A higher cutoff wouldn't catch those without losing a lot of good proposals.
The miss I'd show first
The model can accept a similar action when the requested one isn't there. In a release smoke check, it accepted "Minimize the focused window" for "Close this window." Neighbours in meaning, not the same thing. The model card records the case and gives the one-line command to reproduce it with the simulator.
It fails the other way too. The README's own example shows cuqe --verified "How much space is left on this Mac?" being declined. That's a perfectly reasonable question. For a verifier in front of read-only actions, I'd rather it decline and fall back to an explicit read ID than guess. That trade only makes sense because nothing here writes anything.
The agent path
The repo also ships a local MCP server, scripts/cuqe_mcp.py, that registers with Codex. It exposes read_machine, which takes an explicit action ID and skips the models, and two free-form tools, disk_space and node_version, which pass the user's words to the verified CLI.
Scroll sideways to read it. The labels stay full size.
When the disk verifier declines, the server adds one suggested wording: "How much free space is on my startup disk?" The tool description and the bundled agent skill tell the agent to show that wording and wait for the person's approval before retrying once. TLC checked this model (22 states, 32 steps), and these rules held:
- A second CLI run happens only after the person approved the suggested wording.
- There's at most one retry per call, and only the free-form disk tool retries.
- A rejected request never starts the CLI.
- An explicit read is never declined. It answers or it reports an error.
- A result always comes from a CLI run, never from the agent's guess.
One honest note: the first check didn't pass. TLC found a path where the approved retry was rejected by the input check. That can't happen in the code, because the retry sends the server's fixed suggestion, which always passes. So I fixed the model, not the rule. The bigger caveat is that the retry rule is an instruction the agent follows. The server doesn't enforce it, and the chart shows the agent behaving as asked.
How it was trained
The checkpoint is v21: a rank-8 LoRA on the last eight layers of Qwen3 0.6B, trained for 432 updates on 432 English requests, each paired with an accept and a decline candidate. Some requests came from Amazon MASSIVE 1.1 and CLINC150, credited in the model card. The adapter was fused and quantized to Q4_K_M with llama.cpp, and every byte outside the 56 adapted tensors matches the stock GGUF. TRAINING.md has the steps and checksums.
What I checked on main today
Main is at 4631520, the v0.4 beta merge. The cleanup of an earlier evidence PR landed, and no vendored build archives are left in main's history. In a fresh virtual environment with the hash-pinned dev requirements, the 21 Python tests passed, and eval/report.py printed the same seven numbers as the README and the model card. CI on that merge passed on macOS arm64 and on Python 3.10 and 3.12.
The CLI only compiles on Apple silicon macOS, so I ran its 7 Rust unit tests on Linux in a scratch copy with that guard removed, including the decision-token parser and the inclusive cutoff. All 7 passed.
Rough edges
- It's a beta. The binary is ad hoc signed, without an Apple Developer ID.
- Two reads only. Nothing in Cuqe changes the machine.
- The eval is simulated and archived. Re-running inference needs the original request text and catalogs, which aren't published.
- It wasn't measured on an M1 or under load.
- Valid requests get declined. When the caller knows the exact read, it should pass the ID.
How to run it
On an Apple silicon Mac, download the v0.4 beta archive and SHA256SUMS from the release page, then:
shasum -a 256 -c SHA256SUMS
tar -xzf cuqe-v0.4-beta-macos-arm64.tar.gz
cd cuqe-v0.4-beta-macos-arm64
./cuqe --read disk_space
The explicit reads need no model. For the free-form path, install the v21 GGUF from the v0.1 beta model release into a local Ollama, as the README describes. To check the numbers without a Mac, clone the repo and run python3 eval/report.py.
cue-bench, agent-guard and Cuqe come from the same habit: don't take the agent's word for it. I'm interested in applied AI and agent-engineering roles, and Cuqe is my smallest example of that: a model that's allowed to say no, a cutoff you can recompute, and misses written down where people will read them.
Related posts
Continue with articles that overlap in category or shared tags.
ai
I built CDM to test small models on historical BTC data, and better probabilities were not better direction calls
A research lab that tests whether small local models and simple rules extract useful signals from historical crypto data. On 501 held-out decisions across 84 dates, pooled probability scores improved. Direction stays unproven. A first Qwen3 0.6B fit predicted flat on 1,031 of 1,034 windows, and no after-cost trading result has been established.
Read related postai
I built agent-guard to decide whether an agent's change should go live
A check-apply-verify harness for agent edits. It probes the live system first, applies the change, probes again, and rolls back with a fresh recovery probe when the change breaks something. 24 of 24 replayed scenarios land on the exit code they should.
Read related postai
I built cue-bench to score browser agents on messy retail work
A local Playwright workbench, matched replays, and a ledger grader. 172 receiving attempts, zero recovery passes, and one run that posted 13 ink jackets and zero moss jackets.
Read related post