theonly1me/claude-code-mods/tree/main/plugins/scope-guard

A Claude Code plugin that detects when Claude edits or deletes files outside your request. Clear drift pauses on a question dialog; milder drift is flagged above the prompt with pull-back, fine, and allow-folder keys.
theonly1me/claude-code-mods/tree/main/plugins/scope-guard

Scope Guard keeps your last three prompts as the task and checks Edit, Write, NotebookEdit, and file-deleting/moving shell commands against cheap rules first (off-request files, out-of-project paths, deletes/moves, large rewrites, many-files limit). Flagged changes go to a confirm model that classifies them as in scope, mild drift, or clear drift. Clear drift waits on Claude Code's question dialog with Allow once / Allow for this task / Stop; milder drift shows a band above the prompt with Pull back, Fine, and Allow folder keys. Commands: /scope, /scope off, /scope on, /scope flag, /scope ask. Settings: mode, confirmModel, manyFiles. Install via claude plugin marketplace add theonly1me/claude-code-mods and claude plugin install scope-guard@claude-code-mods. Requires Claude Code 2.1.289 or later.
Check the author's README for the marketplace and plugin name first. Commands may change as the repository evolves.
claude plugin marketplace add theonly1me/claude-code-mods claude plugin install scope-guard
Scope Guard notices when Claude starts to change things you did not ask for. Clear drift waits for your answer; milder drift is flagged above the prompt.

claude plugin marketplace add theonly1me/claude-code-mods
claude plugin install scope-guard@claude-code-mods
Register the marketplace once. Run /reload-plugins in an open session after installing. Requires Claude Code 2.1.289 or later; no build step or runtime dependencies.
Scope Guard keeps your last three prompts as the task. Before each Edit, Write, NotebookEdit, and each shell command that deletes or moves files (rm, git rm, mv, git mv), it checks cheap rules first:
A file your request names, a file Claude already changed this turn, and scratch files under /tmp never count. When the rules find enough, Sonnet 5.5 reads your task, what Claude said just before the change, and the change itself, and decides: in scope, mild drift, or clear drift. If the model call fails, the rules decide alone.
Install it and work as usual. Nothing shows until Claude drifts.
/scope: show the task Scope Guard keeps, the paths you allowed, and the recent flags./scope off and /scope on: stop or start the checks. The choice stays for the next sessions./scope flag: flag drift above the prompt but never stop Claude./scope ask: stop clear drift with a question again (the default).On clear drift, Claude waits on Claude Code's own question dialog:
Scope
Claude wants to delete docs/old.md, outside your request. The request is about math.js only. Allow it?
❯ 1. Allow once
2. Allow for this task
3. Stop
Milder drift runs, and a band above the prompt flags it:
▌ SCOPE Claude chose to edit README.md, which looks outside your request.
The README is related but the request was only about math.js.
7: Pull back 8: Fine 9: Allow the top folder type the number, Enter
Type the number and press Enter. When the prompt is empty and Claude is not streaming text, the number alone works too. The status line shows how many flags are open.
Change these in /plugin:
mode (ask): ask, flag, or off, as with the commands above.confirmModel (claude-sonnet-5-5): the model that confirms a drift the rules found.manyFiles (8): how many distinct files Claude may change in one turn before that counts as drift.Most changes never reach the model. Each change the rules flag costs one short confirm call at medium effort, and Claude waits for it (20 seconds at most) before the change runs.
See the marketplace README for configuration, privacy, updates, and removal.