Your agent made that mistake once.
Make it the last time.
Scarcheck turns a correction into a lesson only when there is evidence. It writes the lesson into every agent's rules file and adds a check that catches the repeat before it lands.
That command runs the whole loop in a throwaway repo (needs Go 1.25+).
Free and offline. Install a release on macOS or Linux, Windows through WSL.
Use pnpm. Never npm or yarn in this repo.
Writes native rules for
You already told your agent. Twice.
Rules files are advisory. Memory is local, single-tool and never cleaned. So the same mistake comes back on Monday, Wednesday and Friday.
“Every time a violation occurs, the rule is re-stated, strengthened, and re-documented. The next session violates it again.”
“Codex often self corrects its approach in its COT but never actually preserves the lessons.”
“Claude Code’s memory system is individual-only.”
Memory remembers everything. A lesson proves one thing.
Context files that grow forever can make agents worse and cost more. Scarcheck keeps a short list of rules that each earned their place, and drops the ones that stop paying rent.
Four steps from "no, not like that" to never again.
- 01 Correct
Fix it once
Correct the agent like you always do. When this session's shell records the commit, the hook can ask you to verify it. A commit it did not see is not treated as the fix.
- 02 Learn
Prove it
scar learndrafts a rule and a check, then replays history: the check must fail before the fix and pass after. No proof, no lesson. - 03 Compile
Tell every agent
scar compilewrites the lesson natively into CLAUDE.md, AGENTS.md, Cursor, Cline and Copilot rules, inside a block it owns. - 04 Catch
Stop the repeat
The check runs in pre-commit, CI and agent tool hooks. A repeat is blocked with the lesson and the fix, not a lecture.
bash cli/demo.sh in a throwaway repo.Features
Evidence or it did not happen
Every lesson links to the diff, test run or correction that justifies it. Unproven ideas stay drafts and never reach your rules.
A check per lesson
A grep, a file that must not exist, or any shell command. Fast enough for pre-commit, strict enough for CI.
One source, five rules files
Lessons live in .scarcheck/ as plain Markdown. Scarcheck compiles them to each agent's native format.
Shared with provenance
Who learned it, from which session, on which commit. Teams review lessons in pull requests like any other change.
Stale and conflict alerts
Lessons expire unless they keep catching mistakes. Contradictions get flagged before an agent picks one at random.
Offline, on your machine
The CLI works offline and sends nothing. Lessons, transcripts and your repository's files stay where they are.
A lesson is a file you can review in a PR.
Git-native: commit .scarcheck/ and your team has it. No service to run, nothing to sign in to.
- Rule, trigger, scope and expiry in front matter
- Evidence links you can click
- Checks that run anywhere a shell runs
# .scarcheck/lessons/L-142.md --- id: L-142 rule: Use pnpm. Never npm or yarn in this repo. scope: repo trigger: ["package.json", "tool:Bash"] status: verified evidence: - commit: a41f9e2 - correction: claude-code session 7f3c, turn 12 checks: - file-absent: [package-lock.json, yarn.lock] - block-command: "^(npm (i|install)|yarn add)\b" learned_by: alex@acme.dev review_after: 2027-01-23 --- The repo is a pnpm workspace. npm writes a lockfile pnpm ignores, so CI installs different versions. Fix: pnpm add <pkg> --filter <app>
Numbers, not promises.
24 real kinds of agent mistakes in 6 groups. Each case learns one lesson by replay, then tries the same mistake again, the same mistake written differently, and a normal change nearby. Run it yourself in about 20 seconds: cd bench && go run . -check.
Caught by scar check | Rule only in CLAUDE.md | |
|---|---|---|
| Repeats (same mistake) | 24 / 24 | 0 / 24 |
| Variants (written differently) | 23 / 24 | 0 / 24 |
| False alarms on clean changes | 0 / 24 | 0 / 24 |
The one miss is honest: yaml.load(x) versus yaml.load(x, Loader=SafeLoader) split over two lines cannot be told apart by a line-based grep. The CLAUDE.md column is not a model run: a rule there is advice the agent reads, and nothing runs it at commit time.
The agent hook adds about 20 to 25 ms per tool call with up to 100 lessons. At 1,000 lessons it passes its own 50 ms budget, because every call reads every lesson; an index is on the list.
Fewer words in context. More mistakes caught.
A 2026 study found context files did not improve task success on average and raised inference cost by over 20%. Scarcheck injects only verified lessons, inside a token budget you set.
Before you install it.
Does Scarcheck upload my code or my agent sessions?
No. The CLI reads your agent sessions on your machine to find corrections. Transcripts, diffs, lessons and your repository's files stay on it. The CLI sends nothing anywhere. Details are on the privacy page.
Why not write the rules files or hooks myself?
You can, and many teams do. Scarcheck does the upkeep: it turns a correction into a lesson only when there is evidence, writes one lesson into every agent's rules file, and adds a check that catches the repeat before it lands. Lessons stay plain files in your repo, so you can stop using Scarcheck at any time.
Which agents does it work with?
Claude Code, Codex, Cursor, Cline and GitHub Copilot. Each gets its own native rules file, compiled from the same lessons.
Can I use it today?
Yes. Scarcheck is early (v0.1). Download a release for macOS or Linux (Windows through WSL), or build the scar CLI from the GitHub repository with Go 1.25+, then follow the quickstart.
Teach it once.
Free and open source. Install it, then run scar init.