Skip to content

BuildNot yet confirmed elsewhere1 publisher2 min readPublished

Hash-anchored edits turn a lost race into an error, and that contract outranks the tool count

Oh-My-Pi makes a write conditional on the target lines still hashing the same, so the loser of a race gets an error instead of a wrecked file. The guarantee is paid for in retries.

The Engineer · Build desk

How we use AISend a correction

What happened

  • Oh-My-Pi, a fork of Mario Zechner's Pi, sends a hash of the targeted lines with each edit and applies the write only if those lines still match.
  • A mismatch returns an error carrying the current file state, and the agent re-reads and retries rather than overwriting.
  • The tool harness serializes writes from multiple agents or subagents against the same file and rejects any edit whose anchor has gone stale.
  • Subagent recursion is capped at a default depth of 3, with a per-subagent token budget that ends in a kill and truncated output on overrun.

Why it matters

  • capability Letting two writers work one file stops being a gamble, because the loser of the race receives something it can act on instead of a file it has already ruined.
  • cost The bill moves off the human who debugs a clobbered file and onto whoever funds inference, one re-read and retry at a time.
  • constraint The guarantee reaches exactly as far as the harness does, so throughput now depends on how narrowly the agent anchors and how often something rewrites a file wholesale.
  • precedent A conditional write is a claim a buyer can test in an afternoon, which makes long operation counts a weaker argument than they were last quarter.

Compare-and-swap is the shape of this, with a range of lines standing in for the register, and the interesting part is where the check sits. It sits in the tool harness, which is also the component that orders writes [7], so the harness is the only thing in the system that can tell a losing writer why it lost. That placement has a price, and the write-up quotes only half of it: one hash comparison per edit, which it fairly calls negligible against the tokens burned re-reading a whole file after a bad write [2]. Those are two different ledgers. The comparison is charged on every edit that lands; the re-read is charged on every edit that is rejected, and rejection frequency depends on how wide the anchored range is and how many writers are aimed at the same file. The account reports no measured rate for that [15], which is the figure I would want in hand before pointing several subagents at one module.

A concrete anchor-killer sits in the same feature list. Among the 14 LSP operations exposed as agent tools is format [9], and a formatter rewrites lines nobody asked it to touch, so one format call can invalidate every outstanding anchor in that file. Nothing is corrupted; each pending edit simply fails and is retried against current bytes [6]. The behaviour being replaced, per the dev.to account, was a replace_file call that overwrote whatever had arrived since the agent's last read [14], with the failure case being two agents reading version N and the second write erasing the first [8]. Swapping silence for a retry loop is the right trade. It is still a trade, and it is denominated in tokens.

Add up the advertised surfaces and you get 73 agent-callable operations: 31 built-in tools, 14 LSP, 28 DAP [16]. Around them sit 60-plus provider integrations [9] and roughly 80k lines of Rust under a Bun runtime wrapping the TypeScript orchestration, with a TUI rather than Electron [10]. Those numbers travel well, as does the 26,497 stars the post attaches to the project's lineage [3], and none of them tell you whether a second writer can be trusted. The conditional write does. So does the LSP running out of process, where a crash returns a tool error and the agent can fall back to grep [13], and the default depth limit of 3 plus a per-subagent token budget that gets a runaway killed and truncated [11]. That is the concurrency contract. The rest of the sheet is inventory.

What to watch

  • Whether anyone publishes a measured false-conflict rate under real subagent fan-out, which is the number that decides if this holds past two writers.
  • Whether the harness special-cases wholesale rewrites such as an LSP format call, which invalidates every outstanding anchor in a file at once.
  • Whether upstream Pi or other terminal agents still shipping whole-file replace adopt a conditional write of their own.

Clarity's read

What the record supports and how the coverage leans. The claims behind it follow.

Reality

Evidence26
Adoption14
Hype gap+34
Incentives
Insufficient
Confidence31
Why these scores

Claim ledger

Ranked by verification strength, evidence, and original report placement.

  1. [1]

    Oh-My-Pi is a fork of Pi by Mario Zechner.

  2. [2]

    The stated cost is one extra hash comparison per edit, which the source calls negligible compared with the token budget of re-reading an entire file after a bad write.

  3. [3]

    The post puts the project's star count at 26,497.

Sources

1 independent publisher whose own reporting we read for this story.

  1. dev.to

    1 article · August 22, 2026

    Oh-My-Pi's Hash-Anchored Edits: How a Terminal Agent Avoids the \\\\\\\"Replace Entire File\\\\\\\" Trap

Share your take

Let Clarity write the post for you.

Signed-in readers get a short post drafted on this story in the register they choose — narrative, analytical, or a direct position — editable to the last word before it goes anywhere. The share buttons at the top of this story work without an account.

Topics and entities

Follow any of these and your For You feed starts watching them — no settings page required.

Topics

Loading related stories