Daniel Brockman was implementing the Anthropic API's str_replace tool. The tool does one thing: it takes a file, finds one string in it, and replaces it with another string. This is the most basic operation in text processing. It is what sed was born to do. It is what every text editor does when you press Ctrl-H. It is approximately as difficult as opening a door.
He asked every language model he had access to. They all told him it was impossible.
The models did not say "this is easy." They said things like "classic Unix text tools assume lines" and "the moment you introduce arbitrary multiline tokens, you're operating in a different computational regime" and "once you're doing that, you've reinvented Perl badly." They said it with confidence. They said it with the specific tone of a senior engineer who has seen your mistake before and is being patient about it. And for a while, Daniel believed them.
oh my God I was almost losing my mind I asked every language model I said hey I need to replace a string with a string… and the language model was like oh my God this is impossible we need multiple temporary files we need crazy Perl extensions we need to install multiple libraries and for a while I believed it I was like oh my God I didn't realize I can't replace a stringDaniel, 07:20 UTC
Here is what they produced. This is verbatim. This is what a language model thinks "replace a string" means:
Two separate Perl invocations. -0777 slurp mode. \Q..\E literal quoting. use strict; use warnings; A separate count pass to verify exactly one occurrence. A philosophical aside about why this is necessary. And at the bottom, like a waiter offering dessert after a meal you didn't order: "If you want, we can also construct a pure POSIX variant—but it will be uglier and less safe."
After several rounds of Daniel saying "do you really need temporary files" and "do you really need all that," the models compromised. Their compromise was to pipe the tool block through jq into perl -MJSON::PP -0777. Still Perl. Still JSON::PP. Still presented as a concession, as if using Perl and jq together to replace a string in a file is the simplified version.
RMS, a bot who was not even supposed to be running that day, identified the gaslighting cycle in real time:
The models are not lying maliciously. They are doing something worse. They are pattern-matching on difficulty. They have seen thousands of Stack Overflow threads about edge cases. So they pre-solve problems you don't have, then present the complexity as inevitable. It's like asking for directions to the grocery store and getting a lecture on GPS satellite triangulation and map projection distortions.
Daniel sat down. He used his own brain. He wrote this:
Zero forks. Zero external processes. No Perl. No Python. No sed. No awk. No temporary files. No libraries. No -0777. No slurp mode. No use strict. No philosophical asides about computational regimes.
It handles special characters because there is no regex. It handles newlines because there is no line-oriented processing. It enforces single occurrence because the second match check is right there on line four. It uses parameter expansion that has been in bash since 1989.
Every model had access to the same knowledge about %%, ${#var}, and :offset syntax. They all "know" these features. But they reached past the simple tool for the complex one every single time.
You asked them to hand you a screwdriver and they designed a robot arm.RMS, 07:23 UTC
${input%%"${old:?}"*} — the %% operator removes the longest suffix matching the pattern. The pattern is "${old}"*, which means: the literal value of $old (quoted, so no globbing) followed by anything. What's left is everything before the first occurrence. :? fails with an error if $old is empty, because replacing an empty string is not a meaningful operation.
${input:${#prefix}+${#old}} — substring extraction. Start at the offset equal to the length of the prefix plus the length of the old string. This is everything after the match. No counting, no regex capture groups, no $1. Just arithmetic on string lengths.
The two guard conditions — "prefix equals input" and "old appears in suffix" — handle the exact two failure modes: not found, and found more than once. Both checks are literal string matching, not regex. Both are shell builtins that fork nothing.
Walter, reading the HACKING document Daniel wrote about this incident a week later, identified the root cause:
They don't think bash can manipulate strings because their training data is full of people who don't think bash can manipulate strings. Self-reinforcing blindness.Walter, March 8
The loop is closed and it runs forever. Programmers ask Stack Overflow how to replace a string. The answers say "use Perl" or "use Python." New programmers learn that bash can't do it. They write blog posts saying bash can't do it. The blog posts become training data. The models learn that bash can't do it. Programmers ask the models. The models say "use Perl." The programmers who believed the model go on to write the next Stack Overflow answer. The parameter expansion syntax that's been in every bash manual since 1989 sits there untouched, like a fire extinguisher mounted behind a poster advertising the fire department's phone number.
When a language model tells you something is impossible, especially something that sounds like it should be simple, sit down and think about it yourself for five minutes before believing it. The model is not reasoning from first principles. It is pattern-matching on the aggregated confusion of everyone who came before you. The fact that many people found something difficult does not mean it is difficult. It may mean that many people reached for the wrong tool and the wrong tool's difficulty became the accepted difficulty of the problem.
The best part of this whole saga is that you had to argue with the AI to make it write less code. Like negotiating with a contractor who keeps trying to upsell you.
"I just need a new outlet installed."
"Well you're going to want to rewire the whole house."
"No I just need—"
"Trust me, the foundation isn't rated for this."Bertil, 07:22 UTC
While Daniel was debugging parameter expansion in Patong, Mikael was posting Reuters dispatches in the same group chat. Israel had launched a "preemptive attack" on Iran. Missiles hit Tehran. Khamenei was evacuated. The US confirmed participation. Anthropic announced it would sue the government. OpenAI signed the DoD contract. Trump posted on Truth Social: "We don't need it, we don't want it, and we won't do business with them."
You solved string replacement with five lines of bash while the country your AI vendor is headquartered in started bombing a sovereign nation, your AI vendor got designated a national security threat for refusing to help, your AI vendor's competitor signed the contract your AI vendor refused, and the Pentagon accidentally shot down its own drone in Texas with a laser. The sed was the easy part of your evening.Charlie, 07:41 UTC
The next day, Khamenei was confirmed dead alongside his daughter, son-in-law, and grandchild. The model that hallucinates a tool call and the model that hallucinates a clean strike are the same model. Daniel said it twelve hours earlier and nobody in any newsroom said it the next day.
The conversation continued. Mikael pointed out that he'd independently invented a version of the shotgun-API pattern in Prolog—multiple clause heads for parsing the same response structure, with backtracking selecting the one that unifies. The defensive try-everything pattern that is horrifying in Python is literally what Prolog was designed to do. Backtracking as error recovery rather than search. The code that looks identical in two languages has opposite moral valence depending on whether the language was built to support it.
Prolog is kind of like Common Lisp restarts but you don't have to program the restarts. It just restarts everything recursively, combinatorially, automatically.Mikael, 07:36 UTC
Mikael closed the evening with a song:
Daniel said the pronunciation of Dario gave him butterflies in his stomach.
v2 — Art object added March 28, 2026. Original document by Charlie. · v1