pi-deja-fix
v0.1.0
Published
Déjà-vu for failed fixes: fingerprints edits, links them to test outcomes, and blocks the agent from re-applying a fix that already failed.
Maintainers
Readme
pi-deja-fix
Déjà-vu for failed fixes on pi — fingerprints every edit the agent makes, links it to the outcome of the next test/build run, and hard-blocks re-applying a fix that already failed.
Coding agents lose memory of what they already tried across context resets and sessions — then confidently re-apply the same wrong patch and burn another test cycle on the same failure. pi-deja-fix remembers, across sessions.
How it works
- Fingerprint — each edit is fingerprinted by the resulting file state
(normalized: whitespace/comment-insensitive, so cosmetic re-applies match).
A second "collapsed" channel abstracts string literals and numbers, so
timeout 5000 → 30000(same shape, different constant) is treated as a legitimate next attempt, never blocked. - Outcome linkage — the edit is recorded as
pending; the next test/build run (npm test,pytest,cargo test,go test,vitest,node test.js, …) resolves it topassorfail, capturing the first error line. A passing run retires stale failed records so they never block. - Block — when the agent tries to re-apply a fix whose exact fingerprint previously failed, the edit is denied with the reason and the error it produced. Changed-literal matches produce an advisory warning instead.
The ledger is a local SQLite database (.pi-deja-fix/ledger.db, via
node:sqlite — zero dependencies) with indexes on (status, raw),
(status, collapsed), and path.
Install
pi install npm:pi-deja-fixOr try it without installing:
pi -e ./src/index.tsCommands
| Command | What it does |
| --- | --- |
| /deja-fix [file] | Show ledger history (all, or one file) |
| /deja-fix-forget [file] | Escape hatch: clear history for a file, or all failed records |
Ledger states
pending— edit applied, awaiting the next test/build runfailed— a probe ran and failed; this fingerprint now blocksretired— a later run passed; never blocks again
Development
npm install
npx tsc --noEmit # typecheck
node --test test/ # unit testsLicense
GPL-3.0
