I’ve been building a local-first agentic assistant on an RX 7600 (gfx1102, ROCm 10.1) and
kept hitting the same class of failure: the model would say it called a tool without
calling it. After enough of those, I rebuilt the harness around four ideas and the failure
rate dropped sharply. Sharing the design because the individual pieces aren’t novel but the
combination is what made a small model usable.
The loop
observe → route → decide → act → verify → update
The runtime, not the model, owns the loop. The model only ever answers “which tool, with
what arguments” or “here’s the answer.” Every tool result is wrapped in untrusted-content
markers and re-read as data, never as instruction.
What actually broke, and the four fixes
1. Tool routing narrowed to one irrelevant tool.
The router is a regex filter that picks 3–5 tools out of 56 based on message wording.
“release date” matched the date trigger, so the model got offered only get_current_time
and truthfully replied “I don’t have that tool.” Fix: if the message contains a tool name
verbatim (e.g. “call deep_search”), always include it regardless of other matches.
2. Retry spiral.
A broken search backend returned the same error 20 times in one turn, burning the context
window. Fix: fingerprint (tool, args) and abort the turn after two identical failures with
a message that says “this is a configuration problem, not a retry problem.”
3. Hallucinated tool success.
The model wrote “I sent the email” with no tool call at all. Fix: the audit log is the
source of truth, not the model’s prose — and every write is snapshotted first so it’s
reversible. Confirmation-gated tools never auto-approve.
4. Context truncation mid-task.
Fixed 8K window plus a 40-message history meant long sessions silently lost state. Fix:
compaction at 85% of the window — summarise everything before the current user turn into a
structured block, keep the current turn verbatim, never cut a tool result from its parent
assistant message.
The reading pipeline (the part I’m least sure about)
Search returns snippets, which a small model can’t ground on. So deep_search fetches the
top 3 URLs in parallel, extracts markdown, chunks it, ranks chunks by query terms, then
makes one narrow call per chunk: “return only facts that answer this question, as JSON.”
The main model sees ~1–2 KB of cited bullets instead of ~150 KB of HTML. Everything except
that one call is deterministic Python, so failures are debuggable.
Numbers on the RX 7600
[8 GB VRAM, ROCm 10.1, Q4 quant]
- 4B slot: [X tok/s] generation, [Y tok/s] prompt
- 8B slot: [X tok/s] generation — fits at Q4 with 8K context
- deep_search end-to-end: [~25 s] for 3 pages, 2–3 s for plain web_search
- 90-case tool-selection suite: 82.2% overall; weakest category was web_fetch at 40% before
the router rewrite
What I’d want feedback on
- Is the per-chunk distill call the right granularity, or is page-level summarisation
cheaper for the same grounding quality? - Anyone running this on ROCm with a different gfx target seen different context ceilings?
Code, Modelfiles and the benchmark suite: [github.com/Bhavishya799/quill-cowork]
Committed at [your commit hash]. MIT.