Dev.to AI 🤖 Ai 👁 0 📖 4 min read

How I built a second opinion for my AI companion's voice replies: 1 extra call, 4 verdicts, and the same model judging its own draft

How I built a second opinion for my AI companion's voice replies: 1 extra call, 4 verdicts, and the same model judging its own draft Ankita AI is the desktop AI assistant I build as a side project, by Krish Verma — and

How I built a second opinion for my AI companion's voice replies: 1 extra call, 4 verdicts, and the same model judging its own draft

Ankita AI is the desktop AI assistant I build as a side project, by Krish Verma — and the worst thing it can do in voice mode is not fail. Failing is honest: it says it couldn't do the thing. The worst thing is succeeding out loud when nothing happened. "Music is playing" while the room is silent. A wrong chat message sits on screen where you can re-read it; a spoken lie reaches you while your hands are busy, and you believe it until the silence gives it away.

So every voice reply now goes through a second opinion before it is displayed or spoken: a check that the draft is actually supported by what the tools did. It lives in src/core/voice-completion.mjs, wired into the voice worker as the turn's responsePolicy, and it has one job — stop the companion claiming effects it never produced.

Receipts, not memories

The checker does not trust the model's account of its own turn. The worker records every tool call as a receipt — requested(), started(), observed() — with the tool name, the arguments, the result text, and an ok flag. When the draft reply is ready, review() sends the request, the draft, the last 6 context messages, and at most the 16 most recent receipts to a second /chat/completions call on the same planner.

The check is deliberately small: 1,024 output tokens, an 8-second timeout, 3,000 characters per field, and the whole input capped at 24 KB. If the input is bigger than that, the check does not clip it and judge the remainder — it refuses, and the draft is never spoken.

The model must return exactly one of four verdicts — ANSWER, COMPLETE, CONTINUE, BLOCKED — model decisions, never phrase matching. The interesting part is the rules around them, enforced in code rather than left to the judge's mood:

  • Discovery and bookkeeping can never prove an effect. find_tools, write_todos and recall are on a NON_WORK_TOOLS list: a turn whose only receipts are lookups cannot come back COMPLETE, no matter what the judge says. If the verdict is COMPLETE with no successful receipt from a real tool, it is downgraded to CONTINUE.
  • A page opening is not playback, and command submission is not verified app state. That line is in the check prompt itself, because those are exactly the claims a voice assistant loves to make.
  • BLOCKED needs evidence too: at least one finished receipt, or the verdict becomes CONTINUE — the model may not declare a blocker it never attempted.

A CONTINUE verdict buys exactly one correction. The worker gets a single instruction — continue the same task with real tools, do not repeat completed side effects, and do not just promise future action — and the corrected draft is checked again. One correction, then the turn ends INCOMPLETE: completed actions are kept, the unsupported claim is not.

The flaw I already found

Here is the part I am least happy with, and it is baked into the design: the judge is the same model that wrote the draft. Same planner, same client, same route — the defendant grading its own homework. A model that hallucinated an effect into the draft can hallucinate the receipt into the verdict, and nothing in the pipeline notices.

It gets worse one level down. The checker judges receipts, but a receipt is itself a claim from a tool, not an observation of the world. A tool that returns success without the effect happening produces a perfectly valid receipt, and the checker will happily stamp the draft COMPLETE. The prompt knows this — that is why "command submission is not verified app state" is written into it — but knowing it and catching it are different things.

And the honest fallbacks are dead ends for the user. If the check times out, returns garbage, or the input is too big, the verdict is CHECK_UNAVAILABLE: completion could not be confirmed, completed actions were kept, draft withheld. Correct, and completely unhelpful in the moment — the user asked for music, got silence, and a sentence explaining that nothing was confirmed.

The cost is real too: one extra model call on every voice turn, 1,024 tokens of output, just to ask "did I actually do that?" Typed chat does not run the check at all — only voice pays for it, because only voice lies out loud.

Seventeen tests cover this in test/core/voice-completion.test.mjs, including the two I care about most: an erroneous COMPLETE verdict cannot approve zero actual work, and a malformed check fails closed without ever exposing the draft. The guardrails hold. The shared brain does not.

So the question I keep coming back to: would you give the judge a different, cheaper model — an independent brain that does not share the planner's blind spots, but also does not know its tools as well — or keep the same planner and accept that the checker can only catch the lies the model is willing to admit? And is one correction the right number, or should an unsupported draft get a second chance before the turn dies?

The code is in Ankita on GitHub, and the project page is at ankita-sable.vercel.app. Tell me I'm wrong: where would this break first — the shared judge, the lying receipt, or the one-correction limit?

— Krish Verma, creator of Ankita AI

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.