Reddit dev shares a state-patch recipe that stops agents looping and burning credits
Designer-Material633 · reddit · 2026-12-02
A developer's agent kept redoing the same step and eating credits — not because the model was dumb, but because it re-read its entire memory every step until it looped.
His paste-ready fix:
- Keep state in one store: store[stateid] = {"v": int, "data": dict}
- Planner passes only stateid + what changed, never full state
- Executor returns only a patch; on version mismatch, raise and stop instead of silently overwriting
- Load only keys in plan.needs, never loadall()
- Planner owns plan/needs, Executor owns status/result; fail fast on conflict
More from coding & agent
- Recreating a Blade Runner scene in Unreal Engine 5 with Claude, full breakdown — op7418 · 2026-12-02
- Delvetown launches private Spaces and groups with first-class agent support on AT Protocol — lfschiavo · 2026-12-02
- Amazon Ergo now available on Kiro, hands-on testing imminent — FlolightC · 2026-12-02
- Sentry CEO: Claude Code remote control is half-baked and can't start new remote sessions — zeeg · 2026-12-02
- Cloudflare's Search for Agents: a better search box for crawling agents, not a better model — krishnan · 2026-12-02
- Neo4j's Relate: 453 commits in 11 days, 365 AI co-authored — a graph DB for agent memory — JeremyCMorgan · 2026-12-02