Scar helps AI coding agents avoid repeating old mistakes

Scar is a Git-based tool that helps AI coding agents avoid touching code that should stay the way it is. It records negative knowledge inside the codebase, such as failed approaches, intentionally unusual code, risky areas, and libraries that were removed before. When an AI agent like Claude Code is about to work on related files, PreToolUse hooks can show a warning at that exact moment. This can stop the agent from “fixing” code that looks strange but is important, bringing back old dependencies, or trying an approach that already failed. The main idea is to give the AI not only the current code, but also the history of why some choices were made.

Key points

  • Scar is meant to stop AI agents from repeating known mistakes in a codebase.
  • Negative knowledge includes failed attempts, intentional code choices, risky areas, and removed libraries.
  • Claude Code can receive warnings through PreToolUse hooks before it works on relevant code.
  • The workflow aims to add project history to AI-assisted development, not just current file contents.
  • For solo projects, it can reduce regressions and repeated explanation when using AI coding tools.

Quick term guide

AI coding agents
AI tools that can help write, edit, or organize software code.
AI coding agent
An AI tool that can write, edit, and run code from your instructions.
coding agents
AI programs designed to autonomously perform tasks like writing or fixing code.
negative knowledge
A record of what not to do, including failed approaches and risky code areas.
PreToolUse hooks
Checks that run just before an AI tool takes an action, so they can show a warning first.
dependencies
Other code, tools, or files that something needs in order to work.
AI coding tools
Programs like Claude, Cursor, or ChatGPT that write code for you when you describe what you want in plain language.
AI coding tool
Software that uses AI to help write, edit, or explain code.
Read original