$ cat ~/map/pi-edit-guard.md
pi-edit-guard
A repair-and-match pipeline behind the built-in edit name that fixes malformed arguments and locates off-whitespace targets.
extensions✓ Sep 11
Facts
- repository
- github.com/k0valik/pi-edit-guard ↗
- GitHub Stars
- ★ 9
- Forks
- 2
- license
- MIT
- npm / mo
- —
- last push
- Oct 14, 2026
install
pi install npm:pi-edit-guard## TL;DR
A pi extension that overrides the built-in edit tool with an argument-repair and 14-pass match pipeline, fixing malformed edit calls and off-whitespace matches before they fail, plus an undo tool for recent edits.
## Key points
- $Argument repair fixes malformed calls before they reach validation: double-encoded JSON, field names from differently-shaped training data such as old_string instead of oldText, nested path objects that should be hoisted, and stringified edit arrays.
- $A 14-pass match chain finds the target text even when whitespace, indentation, escaping, or line ordering is wrong; median match time is 2 ms and p95 stays under 650 ms.
- $On 71 real failures mined from live sessions the built-in tool fails 65 times; edit-guard fully resolves 57, gives a precise diagnostic on the remaining 14, and never breaks an edit the built-in tool would have applied correctly.
- $An undo tool reverts the most recent edit-tool change per file, backed by an append-only JSONL store that survives sessions with FIFO eviction.
- $Both tools have killswitch settings — editOverrideEnabled for the edit override, undoEnabled for undo.
## FAQ
Q Does the model need to change how it calls edit?
No — extension tools win by name, so the model keeps calling edit exactly as it always has, with no prompt or tool-name changes.
Q Are the benchmark numbers reproducible?
Yes — pnpm replay, pnpm replay:live, and pnpm score rerun the corpora, with baselines pinned in the repository's docs/baselines directory.
## References
## Related entries
$ big-pi
Model-driven compression that summarizes completed phases into tiered blocks while Pi's JSONL transcript stays authoritative and untouched.
$ dsh-pi-agent
DeepSeek Harness (DSH) AgentFactory that swaps DSH's native agent loop for a headless pi --mode rpc child, so DSH's web UI, sessions, hooks, and presets keep working with pi's minimal prompt and four tools.
$ Pi Taste
Local preference-learning extension that distills accepted and rejected turns into one readable taste.md.
## Guides
Last updated: Sep 11, 2026