/pstack:correct
Call when neededIn one lineFinds mistakes the AI keeps repeating and blocks them, with structure and types first and docs last.
- When to use
- You're correcting the same mistake for the second time.
/pstack:correct The AI keeps skipping the repository layer and calling the database client directlyJust asking vs. using it
The same request, typed plainly or with /pstack:correct. Here's what changes.
With /pstack:correctWhat the document says
4 sections, about 350 words, 2 min to read. Click a section to read it.
OpeningThe goal is to change the repo so the next agent, which sees only its open files and copies the nearest example, can't repeat the mistake.
- 1Find the mistake classesReads recent commits, reverts, review comments and agent instruction files, and groups the repeated mistakes into classes.
- 2Fix each class at the highest level that worksFixes each class at the highest of four levels: architecture, types and lint, behavior tests, then docs last.
- 3Fix and proveFixes the most frequent classes, one commit each, proving each check fails on a real past mistake, locally and in CI.
- 4Keep the rule tableKeeps a rule-to-enforcer table in the instruction file. The reply gives each class's evidence, its level, and why.
Wording worth borrowing
A few sentences from the original: what each one makes the AI do, why it works, and how you can borrow it.
Picture the laziest user
Assume every contributor is an agent that sees only the files it opened, copies the nearest example, and takes the shortest path that compiles.
- Makes the AI
- It shapes the repo for an AI that reads one file and copies the nearest example, so even shortcuts come out right.
- Why it works
- Spelling out the user's bad habits one by one lets the AI close each gap.
- Borrow it
- When the AI writes instructions, add: "Assume the reader only reads the first paragraph and copies the first example."
Rank the fixes strongest first
Fix each class at the highest level that works
- Makes the AI
- It first tries to make the mistake impossible, and only writes a reminder doc when nothing stronger works.
- Why it works
- Ordering the options by strength stops the AI from grabbing the easiest, weakest one first.
- Borrow it
- Rank the options: "First try a required field to block bad input, then a hint, and only then a written note."
Say why the weak fix fails
Nothing fails when an agent skips them.
- Makes the AI
- It knows docs can't stop a mistake, so it saves them for judgment calls.
- Why it works
- Naming the fix's weak spot in one line persuades better than "write fewer docs", so the AI steers clear on its own.
- Borrow it
- Give the reason with the rule: "Nobody gets an error for skipping a reminder email, so make the key step a required field."
Set a count as the bar
A class counts once it has happened twice.
- Makes the AI
- A mistake seen once doesn't trigger a big change; one seen twice does.
- Why it works
- A concrete count turns "keeps happening" into something the AI can count instead of judge.
- Borrow it
- Set a number: "When the same question comes up a second time, add the answer to the FAQ."
Full text
The SKILL.md the AI reads, as written.
descriptionFind the mistakes agents keep repeating in this repo and make each one impossible. Try architecture first, then types, then a lint whose error names the fix, then a test, and write docs last. Prove each check fails on a real past mistake. Repeat this each time the operator corrects you. Use for /pstack:correct.
Correct
The operator keeps correcting agents in this repo for the same mistakes. Change the repo so the next agent can't make them.
Assume every contributor is an agent that sees only the files it opened, copies the nearest example, and takes the shortest path that compiles. Design the repo so a change that looks right from one file is right for the whole repo.
Find the mistake classes
First, read recent commits, reverts, review comments, agent instruction files, and comments that explain workarounds. Group the mistakes into classes. A class counts once it has happened twice.
Fix each class at the highest level that works
- Eliminate it with architecture. Give each piece of state one owner and each task one supported way. Hide internals so the wrong import fails. Replace hand-synced lists with one source of truth. Delete old ways and dead code an agent would copy.
- Enforce it with types so the bad state can't be written. If bad code still compiles, add a lint or CI check whose error names the file, type, or function to use instead. If the pattern is already common, fail only when a change adds more.
- Test the behavior. Fix or delete any test that still passes when the behavior it checks breaks, or that fails when only the internals change.
- Write docs or agent rules last, only for judgment calls. Nothing fails when an agent skips them.
Fix and prove
Then fix the most frequent classes now, one commit each. Prove each new check fails on a real past mistake. Run the same command locally and in CI. Exceptions go on the offending line with a reason, an expiry date, and a human's approval.
Keep the rule table
Last, keep a table in the agent instruction file that pairs each rule with what enforces it. When the operator corrects you, fix the mistake and add the rule. If the rule was already there and nothing enforces it, that's a repeat, so fix it at the highest level in the same change. Drop a rule once its mistake can't happen.
Reply: each class with its evidence, the level you picked, and why a higher level didn't work.
Original by Lauren Tan (poteto), MIT license. Checked against the pstack mirror at 97de40d. View on GitHub