ClaudeMods
☰
JA
● 0 人がオンライン ・閲覧 0 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 theonly1me

scope-guard

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

theonly1me@theonly1me

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

元の投稿の画像1
翻訳済み

この mod について

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
原文 / README

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.

Scope Guard preview

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.

How it works

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:

  • The file is not in your request, and Claude did not read or search it this turn.
  • The file is outside the project.
  • The change deletes or moves files.
  • The change rewrites most of a long file, or an edit removes 40 lines or more.
  • The file is the one that reaches the many-files limit for this turn (8 by default).

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.

How to use

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).

How to interact

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
  • Allow once lets this change run.
  • Allow for this task lets this file and its folder through until your next new request.
  • Stop refuses the change, and Claude reads why. Text typed under "Other" goes to Claude with the refusal.

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
  • 7 Pull back tells Claude to stay in scope and revert the change if the request does not need it. During a turn the note reaches Claude mid-turn; after the turn it becomes your next prompt.
  • 8 Fine clears the flag.
  • 9 Allow this folder clears every flag in that folder and stops new ones there for this task.

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.

Settings

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.

同名の他の作品

関連作品