Built a tiny library after our AI confidently lied about a file that didn't exist

by

A few weeks back our internal AI CTO assistant told me it had

fixed a bug in a specific file — fake path, fake line number, said

with total confidence. That file never existed.

Turned out prompting alone doesn't reliably catch this, and having

a second AI review the first doesn't fully fix it either — same-

family models share blind spots.

So we built two small deterministic layers that sit outside the

model itself: a regex-based grounding check (no LLM call needed)

and a cross-family adversarial review with a hard guard against

the reviewer hallucinating its own flags.

Just open-sourced it — ~500 lines, zero deps, MIT.

Curious if others building with LLM agents have hit the same

"confidently wrong" problem, and how you're handling it.

2 views

Add a comment

Replies

Best

One more detail I didn't fit in the post — the trickiest part

wasn't catching the fabrication itself, it was making sure the

reviewer (the second AI checking the first) couldn't also just

hallucinate a false flag. We ended up requiring every flag to quote

the draft verbatim before we'd trust it — if the quote doesn't

match character-for-character, we drop the flag and log it as a

reviewer error instead.

Felt like a dumb-simple fix in hindsight, but we didn't think of it

until we caught the reviewer doing exactly that in production.

Anyone else running multi-agent review setups hit this? Curious if

there's a more elegant way to handle it than string-matching.