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

Claude Code プラグイン。Claude がリクエスト外のファイルを編集または削除したことを検出します。明確なドリフトは質問ダイアログで一時停止します。軽微なドリフトはプロンプトの上に「引き戻す」、「OK」、「フォルダを許可」キーとともにフラグが立てられます。
theonly1me/claude-code-mods/tree/main/plugins/scope-guard

Scope Guard は、最後の3つのプロンプトをタスクとして保持し、Edit、Write、NotebookEdit、およびファイル削除/移動のシェルコマンドを、まず安価なルール(リクエスト外のファイル、プロジェクト外のパス、削除/移動、大規模な書き換え、多数のファイル制限)に対してチェックします。フラグが立てられた変更は、スコープ内、軽微なドリフト、明確なドリフトに分類する確認モデルに送られます。明確なドリフトは、Claude Code の質問ダイアログで「一度許可」、「このタスクで許可」、「停止」の選択肢とともに待機します。軽微なドリフトは、プロンプトの上に「引き戻す」、「OK」、「フォルダを許可」キーとともに帯が表示されます。コマンド:/scope、/scope off、/scope on、/scope flag、/scope ask。設定:mode、confirmModel、manyFiles。claude plugin marketplace add theonly1me/claude-code-mods および claude plugin install scope-guard@claude-code-mods を介してインストールします。Claude Code 2.1.289 以降が必要です。
まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。
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.