Scope Guard - Stop AI scope creep in Claude Code
npx claudepluginhub atoolz/scope-guardDetects scope creep in AI coding sessions by comparing original intent with actual changes
"Add email OTP login" becomes a 12-file authentication framework. "Fix this type error" somehow requires restructuring half your app.
Sound familiar?
Scope Guard is a Claude Code plugin that detects when your AI coding agent goes beyond what you asked for - and stops it before completion.
This is the #1 complaint in the Claude Code community:
You: "Fix the typo in README.md"
Claude: *fixes typo*
*adds author to package.json*
*creates src/utils/helpers.js*
*updates CHANGELOG.md*
*refactors imports "while I'm here"*
You: "I just wanted the typo fixed..."
Real issues from the community:
┌─────────────────────────────────────────────────────────────────┐
│ YOU: "Fix the login validation bug" │
├─────────────────────────────────────────────────────────────────┤
│ │
│ CLAUDE TRIES TO: │
│ ├── Edit src/auth/login.ts ← Related to request │
│ ├── Edit src/auth/register.ts ← NOT requested │
│ ├── Create src/events/event-bus.ts ← NOT requested │
│ └── Edit package.json (new dep) ← NOT requested │
│ │
├─────────────────────────────────────────────────────────────────┤
│ SCOPE GUARD: │
│ │
│ ❌ BLOCKED - Scope creep detected │
│ │
│ • register.ts: Changes to registration flow not requested │
│ • event-bus.ts: New event system not part of bug fix │
│ • package.json: Added dependency without approval │
│ │
│ Original task: "Fix the login validation bug" │
│ Only login.ts changes are justified. │
│ │
└─────────────────────────────────────────────────────────────────┘
Inside Claude Code:
/plugins add https://github.com/andreahlert/scope-guard
That's it. Zero config. Zero API keys. Zero dependencies.
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ SUBMIT │ │ TRACK │ │ EVALUATE │
│ PROMPT │───▶│ CHANGES │───▶│ AT STOP │
└──────────────┘ └──────────────┘ └──────────────┘
│ │ │
▼ ▼ ▼
Captures your Silently logs Compares prompt
original request every file edit vs actual changes
+ git commit in background using git diff
| Hook | Script | What it does |
|---|---|---|
UserPromptSubmit | capture-prompt.js | Saves your prompt to session.json |
PostToolUse | track-change.js | Logs each Edit/Write to changes.log |
Stop | Agent hook | Runs git diff, evaluates scope alignment |
The Stop hook asks one question for each changed file:
"Is this file EXPLICITLY mentioned in the prompt?"
│
├── YES → Check if changes match what was asked
│
└── NO → Is it OBVIOUSLY required? (imports, types, tests)
│
├── YES → Allow
└── NO → SCOPE CREEP
Critical rule: Same folder ≠ related. "Change Header" does NOT permit Footer changes.
Official prompts.chat marketplace - AI prompts, skills, and tools for Claude Code
Open Design — local-first design app exposed to coding agents over MCP. Install once with your agent's plugin command and projects/files/skills are reachable through stdio.
Behavioral guidelines to reduce common LLM coding mistakes, derived from Andrej Karpathy's observations