Skip to content
  1. Skills at a glance
  2. Report, review, get smoother over time
  3. /pstack:correct

/pstack:correct

Call when needed

In 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.
Say it like this
/pstack:correct The AI keeps skipping the repository layer and calling the database client directly

Just asking vs. using it

The same request, typed plainly or with /pstack:correct. Here's what changes.

Just askingWith /pstack:correct
Adds another rule to the instructions file after each correction.Changes the architecture or types first so the wrong code can't be written.
Assumes a new check works once it is added.Proves each new check fails on a real past mistake.
Fixes only the spot in front of it when a mistake repeats.Treats a rule nothing enforces as a repeat and fixes it at a higher level.

What 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.

  1. 1Find the mistake classesReads recent commits, reverts, review comments and agent instruction files, and groups the repeated mistakes into classes.
  2. 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.
  3. 3Fix and proveFixes the most frequent classes, one commit each, proving each check fails on a real past mistake, locally and in CI.
  4. 4Keep the rule tableKeeps a rule-to-enforcer table in the instruction file. The reply gives each class's evidence, its level, and why.

See the wording worth borrowingRead the full text

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.

  1. 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."
  2. 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."
  3. 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."
  4. 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

  1. 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.
  2. 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.
  3. 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.
  4. 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

An unofficial beginner's guide to pstack, not its official docs. pstack is made by poteto; the official repo is the source of truth for commands and behavior. The original guide source is on GitHub.

Hosted by airali. Adapted from Xiaoxiaodong's MIT-licensed guide.