Coding agent built from an empty while loop: phases lift success rate from 29% to 85%
tejaskumarlol · reddit · 2026-11-04
A developer documented building a coding agent harness from scratch with TypeScript and the Anthropic SDK on Claude Haiku 5.5: a while loop around one model call, an inner tool loop, 5 file/shell tools, step/token caps with a y/N gate before writes and bash, plus context management (prompt caching, truncating tool results over 12,000 chars, server compaction at 90k tokens).
The surprise: at 99% per-step success, a 122-step job in one long loop finishes only 29% of the time. Splitting it into short phases (fresh context each, returning a 5-line note, one retry each) lands near 85%. Compaction fixed cost but not success rate — only phases fixed both.
Swapping in IBM Granite 4 via Ollama's Anthropic-compatible endpoint worked with zero harness changes at $0 per call.
More from coding & agent
- Building a personal MCP book pipeline: discover, download, auto-translate to Kindle — vista8 · 2026-11-04
- Building an AI-powered find-download-translate-Kindle pipeline with MCP tools — vista8 · 2026-11-04
- GitHub Octoverse 2026 Ranks NousResearch's Hermes Agent #1 in Open-Source Engagement — Teknium · 2026-11-04
- Autonomous launches Lamp, a $699 open-source desktop companion robot with customizable skills — dee_hw · 2026-11-04
- $500 Claude plan burns a week of credits every 36 hours, user complains — StephanSturges · 2026-11-04
- FireFlash coding agent hits 46.2% on Terminal-Bench 4.0 at 30x lower cost — VioletNPeng · 2026-11-04