When agents edit the wrong paragraph: handling duplicate anchors in text replacement
memokris · reddit · 2026-10-09
Using the example of "The launch date is provisional" appearing in two paragraphs, the author explains how an agent's first-match search can edit the wrong one.
Key points:
- Start/end anchors can identify the intended span
- Ambiguous replacements without those bounds should be rejected
- A blanket ban on repeated anchors breaks legitimate edits, since removing a duplicated section requires an anchor that appears more than once
- The author prefers stopping to ask for a clearer target over silently picking the first occurrence.
More from coding & agent
- OpenAI's math results released as open source RL environments — SergioPaniego · 2026-10-09
- Dev builds two playable games in a week with Claude Haiku and GPT small models, with cost breakdowns — chongdashu · 2026-10-09
- Stop vibe coding to 80%: pool your tokens so one person ships it to 100% — arjunrajlab · 2026-10-09
- dhh prefers Codex as main coding model with Claude secondary, praises Sol 6.1 — npew · 2026-10-09
- Leaked Claude Code Setup: Sonnet Builds, Haiku Swarms, Opus Architects — Arindam_1729 · 2026-10-09
- Users claim Codex harness, not the models, is the bottleneck: zcode 5x faster on same tasks — bdsqlsz · 2026-10-09