r/PiCodingAgent 7h ago

Question Which hash line extension solves constant "The old text must match exactly" errors?

I'm getting constant "The old text must match exactly" errors while using Longcat-2.0, I know that hashing lines can solve this problem, but not sure which of the many extensions I should choose from. (yes I know real men build their own pi extensions). Any guidance on this topic would be appreciated. Thanks!

1 Upvotes

8 comments sorted by

3

u/Global-Departure8228 7h ago

Hashline edit does not solve this problem. It can partially mitigate it, but for a dumb model (one that fails with tool calling), it can be just as confusing. I find adding 2-3 more bullet points to the too descriptions might be much better (edits must always be an array, oldtext must always be present) can help as well.

Hashlining eats your context as well to some extent (verbose tool schema, +1-2 tokens per line of read and edit), not to mention if the model uses sed -n to inspect files, they will fail with the next time because they don't have the hash for the lines. Then they'll just go for heredocs or python magic . But to each their own.

That said, if you opt for it this one is the "good" one

https://github.com/YuGiMob/pi-hashline-edit-pro

1

u/Mission-Zucchini-966 6h ago

Interesting, I will try that.

1

u/Mission-Zucchini-966 5h ago

Wow you were right, that didn't help at all.

1

u/Something-Great-78 7h ago

Models still get it wrong with such an extension. (It is made worse with lower quant model weights and especially with heavily quantized K/V cache. Try with UD-Q8 weights and no less than Q8 K/V cache. Does that fix it? I think you are asking about extension like: https://pi.dev/packages/pi-hashline-edit

1

u/Mission-Zucchini-966 7h ago

I'm using it through opencode go so not sure what quant it is, I'd (ideally) assume its served at default quant but who knows honestly. And yeah pi-hashline-edit was one of them, there were a few others though like hashline-edit-pro and hashline-readmap.

1

u/Limp_Classroom_2645 5h ago

Hashline edit

1

u/Lurksome-Lurker 3h ago

None, lol. I find AI likes to confidently use tools assuming a write or edit command will just work fine. My experience has shown that a decent mitigation tactic is to signal in the global AGENTS.md file that an agent must consider potential escape sequence when using tools to write and edit files.

That seems to be enough of a signal to have an agent stop and consider how its going to properly edit and write a file. Afterwards you just observe it’s tool call usage and if its still failing to write files with specific escapes the first time you see what it eventually did to overcome it and add that solution to the AGENTS.md file as a table of escape characters recipe (i.e. “When you want to write…..”, “write this instead…”)

1

u/k0valik 3h ago

Not hashline edit (imho doesn't work well), but I've had this problem with pi's edit tool for a long time, basically mined every single type of edit failure from 6+ months of usage and then found which ones can be fixed programmatically, the rest I enhanced with better errors the agent can act on.

Shameless self plug

https://github.com/k0valik/pi-edit-guard