Flush Runner: fork-and-flush restarts for coding agents
A wrapper for Claude Code and Codex that clears chat history, keeps workspace checkpoints and branches retries. Heavy agent users pay.
Crowded · Clearing context gave 66% better results
Written for: Solo builder
Next step
Build a `flush` script that runs Claude Code from git worktree checkpoints with a handoff note and three forks scored by your tests, measure solve rate and cost on 10 of your own old bugs, and post the numbers as a Show HN and on r/ClaudeAI.
Why now
Vals AI found that agent teams cost up to 5.1x more for barely measurable gains, and Anthropic's own data shows quality flattening beyond ten agents. The cheaper lever is a better single-agent loop: fresh context, kept progress, branched retries. Sandboxes are now cheap (Agent37 customers average $0.37/month per sandbox), so running many snapshot branches is affordable. The ARIA paper adds a second lever: a cheap executor that calls a stronger model only when it gets stuck. Nobody ships these as a drop-in CLI for the agents people already use.
What became possible
Microsoft researchers found that autonomous agents get stuck in 'idea basins' as their chat context grows. Their Fork-and-Flush method clears the history but keeps the workspace, and got up to 66% better results on the same compute. A separate paper found that restoring full sandbox snapshots and branching from them beats retrying from scratch.
Three ways in
- flush CLI
Runs a task through Claude Code or Codex. At each checkpoint it commits to a git worktree, writes a short progress note, kills the session and starts a fresh one from the note. It forks N branches and keeps whichever one passes your tests.
- Customer
- Indie devs and small teams spending $100+ a month on coding agents
- Model
- Open-source CLI. Paid hosted runner on cheap sandboxes, billed per branch-hour
- Advisor escalation add-on
The executor runs on a cheap or local model. When tests stall for K attempts, it sends the workspace diff and progress note to a frontier model for one advice call, then flushes and continues.
- Customer
- Cost-sensitive agent users running local Qwen-class models
- Model
- Included in the paid tier, with a per-escalation token markup
- Flush benchmark report
A public, reproducible comparison of single-agent, flush and swarm setups on the user's own repo tasks, with cost per solved task.
- Customer
- Teams deciding whether to keep paying for multi-agent setups
- Model
- Free report that funnels users into the CLI
Competition
The benchmark report is probably the strongest wedge. Nobody seems to publish reproducible single-agent vs. flush vs. swarm comparisons on the user's own repo with cost per solved task. agent-eval and the Databricks write-up show there is demand, but they don't cover multi-agent setups. A free, credible benchmark could drive adoption of an escalation runner for local models, sold to users who care about cost or privacy. Expect Ralph-style plugins and Claude Code or Codex to add these features quickly.
Full competition notes (10 competitors)
The fresh-context restart loop is already a free, widely copied pattern: Ralph loops plus several handoff plugins. Best-of-N branching is built into Cursor and Codex cloud, h5i does test-verified selection across Claude Code and Codex, and Anthropic sells the advisor pattern as a first-party API. Developers who pay $100 a month or more already get most of this from free scripts or the tools they use now. A standalone flush CLI therefore looks hard to charge for. The space that still looks open is narrower. It combines three things none of the tools found here do together. First, the restart is triggered automatically when tests stop improving, not when the context fills up. Second, the executor is a local Qwen-class model, and the advisor is a frontier model from another vendor: Anthropic's advisor tool only pairs Claude models, and the local-to-frontier escalation found so far is blog posts, hackathon projects and generic routers. Third, every run is logged as honest cost per solved task. The benchmark report is probably the strongest wedge. Nobody seems to publish reproducible single-agent vs. flush vs. swarm comparisons on the user's own repo with cost per solved task. agent-eval and the Databricks write-up show there is demand, but they don't cover multi-agent setups. A free, credible benchmark could drive adoption of an escalation runner for local models, sold to users who care about cost or privacy. Expect Ralph-style plugins and Claude Code or Codex to add these features quickly.
- Ralph Wiggum loop (Geoffrey Huntley technique, plus the Claude Code plugin and community skills)
This is the flush idea already in common use. A bash loop restarts the agent with a fresh context on every iteration and rebuilds state from a plan file, a progress log and git commits. It is free, widely copied, and ships as an official Claude Code plugin based on a stop hook, plus many skills for both Claude Code and Copilot CLI.
- cc-handoff
Claude Code plugin. Running /handoff writes a progress document, and a SessionStart hook loads it into the next fresh session. This replaces /compact, which is the same as flush's write-a-note-and-restart step.
- claude-handoff
Standalone CLI that turns the latest Claude Code session into a handoff document for starting fresh. It works offline and can optionally add an LLM summary.
- h5i
Apache-2.0 tool that sends one task to Claude Code and Codex in sandboxed worktrees. A neutral verifier replays and tests each candidate, and the one verified result is merged. This is the closest open-source match to fork N branches and keep the one that passes tests.
- Cursor /best-of-n and worktrees
In Cursor 3, a staff forum reply describes /best-of-n, which runs one task across several models in separate worktrees and compares the results side by side. Big-company version of the branching feature.
- Codex cloud exec --attempts
Third-party write-up of OpenAI Codex cloud's built-in best-of-N: 1 to 4 independent attempts per task, each in its own container. I could not confirm this in official docs.
- Anthropic advisor tool
Official beta API feature. A cheaper Sonnet or Haiku executor calls an Opus advisor that reads the transcript and returns short advice, capped by max_uses. Anthropic reports higher SWE-bench scores at lower cost. It covers the escalation pattern for Claude models only, not local models.
- Conductor, Superset, Nimbalyst, Composio agent-orchestrator, Claude Code --worktree
A crowded group of tools for running many Claude Code and Codex sessions in isolated git worktrees. Most don't automatically pick a winner by tests, but they own the parallel-worktree workflow.
- SWE-Router / trajectory-based escalation for Codex CLI
Describes escalating from a cheap model to a frontier model when the agent isn't converging, triggered by a hook that tracks turns and circular reads. The idea is published but has no polished product yet. Commercial routers such as HybridRoute and Pioneer route local versus remote models per request.
- agent-eval skill and KiloBench
agent-eval runs Claude Code or Aider on YAML task definitions from your own repo, with a fresh worktree per run, and records pass/fail, cost and time. KiloBench reports cost to completion including retries. Together they cover much of the benchmark-report idea.
Checked 2026-10-13
Risks
- Anthropic and OpenAI could build context reset into their harnesses (Anthropic is already talking publicly about dynamic workflows)
- The 66% gain came from research tasks and may shrink on everyday bug fixes
- Agent CLIs change their interfaces often, so the wrapper needs constant maintenance
Strong team fit; market pull and open space are the weak point (6).
tech 7 · pull 6 · space 6 · fit 9 · build 8
Momentum of its main topic
Sources
- Clearing chat history helps AI agents find better solutionsThe Decoder
- Returning to Development States: When Full Sandbox Snapshots Help Coding AgentsarXiv
- AI agent teams waste massive tokens for barely measurable quality gains, research findsThe Decoder
- Launch HN: Agent37 (YC F26) – Low-cost agent sandboxes for running agentsHacker News
- Ask Your Advisor: Learning When to Consult Stronger Models in Agentic SystemsarXiv
- How Anthropic’s Dynamic Workflows Coordinate Claude AgentsLatent Space
What happened next
- +7d · 20 Oct 2026 nothing yet. No launches, funding announcements, acquisitions, or significant press coverage of Flush Runner or its component products (flush CLI, advisor escalation add-on, or flush benchmark report) were found after October 13, 2026. Existing agent tooling features like checkpointed retries and worktree checkpoints continue in development, but no new commercial product matching this opportunity has appeared.
Status history
- 2026-10-13 Flagged as buildable