--- name: correct description: Find the mistakes agents keep repeating in this repo and make each one impossible. Tries architecture first, then types, then a lint or CI check whose error names the fix, then a test, and docs last, and proves each new check fails on a real past mistake. Use for /correct, "agents keep doing X", or after correcting the same mistake twice. license: MIT metadata: author: lyddonb version: "0.1.0" upstream: "pstack correct @ ccb5507, test step updated from 246bc50 (MIT, Lauren Tan)" --- # Correct The human 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. ## 1. Find the mistake classes Read recent commits, reverts, review comments, agent instruction files (`AGENTS.md`, `CLAUDE.md`, rules folders), and comments that explain workarounds. Group the mistakes into classes. A class counts once it has happened twice. If the user named a mistake, start there. ## 2. Fix each class at the highest level that works 1. **Architecture** removes it: one owner per piece of state, one supported way per task, internals hidden so the wrong import fails, one source of truth instead of hand-synced lists, and old ways deleted so nobody copies them. 2. **Types** make the bad state unwritable. If bad code still compiles, add a **lint or CI check** whose error message names the file, type or function to use instead. If the bad pattern is already common, fail only when a change adds more. 3. **A test** of 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. **Docs or agent rules**, last, and only for judgment calls. Nothing fails when an agent skips a rule. ## 3. Fix and prove Fix the most frequent classes now, one commit each. Prove each new check fails on a real past mistake (check out the old commit or reapply the bad diff). Run the same command locally and in CI. Exceptions go on the offending line with a reason and an expiry date. ## 4. Keep the rule table Keep a table in the repo's agent instruction file that pairs each rule with what enforces it. When the human corrects you, fix the mistake and add the rule. If the rule was already there and nothing enforced it, that's a repeat: enforce it at the highest level in the same change. Drop a rule once its mistake can't happen anymore. Section 2 still comes first: a class that architecture, types or a lint can remove is fixed there. Of the classes left, one a diff can show (it is visible in which files changed, or in a changed line) becomes an item in the repo's checklist, `.agents/checklist.json`, in place of its row in the table. **verify-work** then prints it only for a change that could repeat it, with the check to run. Replay the item before you keep it: it must fire on the commit that made the mistake. The **verify-work** skill's `references/checklist.md` has the format. A class no diff shows stays in the table. **Reply:** each class with its evidence, the level you chose, and why a higher level didn't work.