cd /news/ai-agents/we-built-a-bug-fixing-ai-agent-with-… · home › topics › ai-agents › article
[ARTICLE · art-168187] src=discuss.huggingface.co ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

We built a bug-fixing AI agent with a state machine, not just a better prompt

A team's bug-fixing AI agent named Sherlock completed 13% of all company tasks over a recent 15-day window and finished 90 of its last 100 assigned tasks successfully, according to the team's writeup on DEV Community. The team attributes the reliability to a 10-stage state machine with two token-gated human approval checkpoints, disk-based state recovery via state.json, mandatory per-stage artifacts, and a self-review loop capped at 6 iterations. The team said the 90/100 figure depends on which tasks are routed to the agent and that reopen-rate data has not yet been published.

read2 min views2 publishedNov 12, 2026

"Our team rarely fixes routine bugs by hand anymore. A dedicated agent (we call him Sherlock) takes bugs straight from Slack, and over a recent 15-day window he completed 13% of all company tasks. Of his last 100 assigned tasks, 90 finished successfully.

The interesting part: that trust didn’t come from the model being smart. It came from making the workflow strict enough that being wrong is recoverable and visible.

What actually made it work:

A state machine, not a role prompt. “You are an expert engineer” prompts produce a different path every run. Sherlock follows 10 fixed stages and can’t skip ahead — even when the fix looks obvious. Diagnosis stage can’t touch product code. Period.

Two human gates with explicit tokens. First version had 7 approval checkpoints and our engineer became the bottleneck — approving fragments all day. We cut it to two: [START DEVELOPMENT] (allow code changes) and [SUBMIT FOR TESTING] (allow push/merge). “Looks good” and “continue” do not count as authorization — casual yes’s got misread too many times.

Every stage must produce an artifact. diagnosis.md, idea.md, plan.md, review-report.md. A chat message saying “diagnosis complete” has no authority. This killed the “I’m done” fibbing.

Interrupted sessions recover from disk, not chat history. All state lives in state.json. If a session dies mid-run, the next run reloads and continues. We tried reconstructing from conversation history — the agent hallucinated progress.

Self-review with a hard cap. After implementing, the agent reviews its own diff “clean-room” — as an independent reviewer. If it finds blocking issues it patches and re-reviews, max 6 iterations, then it stops and escalates to a human. Without the cap it patched itself in circles forever.

Screenshots at the decision point. For UI changes, before/after screenshots go directly in the conversation — not as file paths. A review I can do in 30 seconds gets approved correctly; one where I have to go dig through directories doesn’t.

Real example: a “list not scrollable” bug went Slack → structured task → 14 min autonomous diagnosis → 3 decisions for human → approved → 37 min implementation → PR + preview URL + screenshots. Two human decisions total.

Full writeup with the actual screenshots: [How to Build an AI Agent That Fixes Bugs Reliably: Practice in Sharkly - DEV Community](How to Build an AI Agent That Fixes Bugs Reliably: Practice in Sharkly - DEV Community)

Happy to answer questions about the state machine design — and honest about the limits too: the 90/100 is conditional on what kinds of tasks get routed to the agent, and we haven’t published reopen-rate data yet (that’s the next thing we’re measuring).

" voici le template as tu vraiment respecter ca ?

── more in #ai-agents 4 stories · sorted by recency
── more on @sherlock 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/we-built-a-bug-fixin…] indexed:0 read:2min 2026-11-12 · —