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

shared-file-guard

このセッションが読み込んでいない、または他のセッションが読み込み後に変更した共有ファイル(STATUS.md、CLAUDE.md、MEMORY.md、または指定したファイル)へのシェル書き込みを拒否します。

mutlumehmet@mutlumehmet

mutlumehmet/claude-plugins/tree/main/plugins/shared-file-guard

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

この mod について

shared-file-guard

同じプロジェクトで複数のセッションを実行するための Claude Code mod です。このセッションが共有ファイル(STATUS.md、CLAUDE.md、MEMORY.md、または指定したファイル)を一度も読み込んでいない場合、または他のセッションが読み込み後に変更した場合、そのファイルへのシェルコマンドによる書き込みを拒否します。claude-plugins の一部です。

機能

  • 編集ツールと書き込みツールは、読み込み後に変更されたファイルをすでに拒否します。これは、heredocs、python3 スクリプト、sed -i、tee、mv、cp といったシェルでのギャップを埋めます。
  • 拒否された場合、ファイル名が示され、Claude に再読み込み、マージ、そして書き込みを行うよう指示します。
  • cat または grep は読み込みとしてカウントされます。セッション自身の書き込みは次の書き込みをブロックしません。まだ存在しないファイルを作成することは許可されます。
  • /shared-file-guard はこのセッションが参照したファイルをリストします。/shared-file-guard off|on。
  • mod が失敗した場合、コマンドは通常通り実行されます。

設定

| 設定 | デフォルト | 機能 | |---|---|---| | watched_files | STATUS.md,CLAUDE.md,MEMORY.md | コンマ区切りのファイル名。* は、*register*.md のように、名前の任意の文字列に一致します。|

読み取りと実行

  • 読み取り:このセッションがどの共有ファイル(プロジェクトのステータス、指示、メモリ、レジスタファイル)を読み込んだか、ディスク上で最後に変更された日時、および各シェルコマンドのコマンドライン。
  • 実行:このセッションが読み込んだ後に他のセッションが変更した共有ファイルへのシェル書き込みを拒否し、その旨をログに記録します。
  • フック:Read、Edit、Write の tool.call は、読み込まれた内容のみを記録します。Bash の tool.call はそのコマンドを拒否する可能性がありますが、変更することはありません。command.run は自身の /shared-file-guard コマンドにのみ応答し、他には応答しません。
  • プライバシー:PRIVACY.md を参照してください。
  • 決して:何もどこにも送信しません(ネットワーク呼び出し、テレメトリなし)。

インストール

Claude Code 2.1.287 以降(mod 対応)が必要です。2.1.289 でテスト済み。

/plugin marketplace add mutlumehmet/claude-plugins
/plugin install shared-file-guard@mehmetmutlu

mod は Claude Code 内であなたの権限で実行されます。mod をインストールする前にコードを読んでください。 設定はインストール時、または後で /plugin configure shared-file-guard@mehmetmutlu を使用して求められます。

既知のギャップ

  • スクリプト内で構築されたパス、および同じコマンド内の cd の後の相対パスは認識されません。
  • ハッシュではなく、日付とサイズを比較します。

概要

Mehmet Mutlu: work that's shipped, at mehmetmutlu.dev

Mehmet Mutlu によって作成され、claude-plugins の一部です。彼の他の作品は mehmetmutlu.dev でご覧いただけます。

ライセンス

MIT

インストール

まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。

claude plugin marketplace add mutlumehmet/claude-plugins
claude plugin install shared-file-guard
原文 / README

shared-file-guard

A Claude Code mod for running several sessions on the same project. It refuses a shell command that would write a shared file (STATUS.md, CLAUDE.md, MEMORY.md, or the files you name) when this session never read it, or another session changed it since. Part of claude-plugins.

What it does

  • The Edit and Write tools already refuse a file that changed since it was read. This closes the shell gap: heredocs, python3 scripts, sed -i, tee, mv and cp.
  • The refusal names the file and tells Claude to read it again, merge, then write.
  • A cat or grep counts as a read; a session's own writes do not block its next one; creating a file that does not exist yet is allowed.
  • /shared-file-guard lists the files this session has seen; /shared-file-guard off|on.
  • If the mod fails, the command runs as normal.

Settings

| Setting | Default | What it does | |---|---|---| | watched_files | STATUS.md,CLAUDE.md,MEMORY.md | Comma separated file names; * matches any run of name characters, such as *register*.md |

What it reads and does

  • Reads: which shared files (the project's status, instructions, memory and register files) this session read and when they last changed on disk, and the command line of each shell command.
  • Does: refuses a shell write to a shared file that another session changed since this one read it, and logs a line saying so.
  • Hooks: tool.call on Read, Edit and Write only records what was read. tool.call on Bash may refuse that one command; it never changes it. command.run answers its own /shared-file-guard command and no other.
  • Privacy: see PRIVACY.md.
  • Never: sends anything anywhere (no network calls, no telemetry).

Install

Needs Claude Code 2.1.287 or later (mods). Tested on 2.1.289.

/plugin marketplace add mutlumehmet/claude-plugins
/plugin install shared-file-guard@mehmetmutlu

A mod runs inside Claude Code with your permissions. Read the code before you install any mod. Settings are asked for at install, or later with /plugin configure shared-file-guard@mehmetmutlu.

Known gaps

  • Paths built inside a script, and relative paths after a cd in the same command, are not seen.
  • It compares date and size, not a hash.

About

Mehmet Mutlu: work that's shipped, at mehmetmutlu.dev

Made by Mehmet Mutlu, part of claude-plugins. More of his work at mehmetmutlu.dev.

License

MIT

関連作品