All shelves / Mods / Safety
file-guard
By Singh-AP
file-guard is a Claude Code safety mod by Singh-AP.
Holds writes outside the project and writes into .git, and asks before lockfiles and CI files.
Holds a command
Install
The marketplace name is awesome-claude-mods.
/plugin marketplace add Singh-AP/awesome-claude-mods /plugin install file-guard@awesome-claude-mods
It runs inside the Claude Code process. The side panel is only what the author's README names. Read the repo before you install, or run claude plugin validate on the plugin folder.
- Version
- 1.0.0
- License
- MIT
- Repo stars
- 3
- Last change
- 2026-10-04
What it can reach
- Holds a command
Claude Code 2.1.287 or later. The mod is live once you run /reload-plugins or start a new session. It checks every Read, Edit, Write, and NotebookEdit call, subagents' too, below the permission system, so it holds in bypass mode. A write must land inside the project root, the folder the session started in or where /cd moved it, or in a folder you allow, with .., relative paths, and symlinks resolved first. /tmp, /var/tmp, $TMPDIR, and Claude Code's own memory, plan, todo, and session-mod folders under ~/.claude stay writable, but ~/.claude/settings.json does not. No tool writes into .git/, though git commands still work. CI workflows, migrations, lockfiles, .env files other than .env.example, and keys ask first, once or for the session, and with nobody to ask, as with -p, the change is refused. /file-guard shows the fence and what was blocked, and /file-guard check dry-runs a path. Set protect, extraRoots, allowTemp, allowClaudeDirs, and fenceReads in /config.
The marketplace, Singh-AP's awesome-claude-mods, holds the 21 mods built there, bash-guard, secret-shield, net-guard among them, and 26 community and Anthropic mods pinned to a commit. This one installs on its own. Keeping file edits inside the project is why this page files it under safety. guard-pack, by atretyak1985, holds file tools and shell moves that leave the project's roots, asks before a production deploy, and redacts secrets in a tool result before Claude reads it. shared-file-guard-mutlumehmet refuses a shell write to a shared file this session never read, or that another session changed. This one guards Claude Code's file tools, not the shell; the README leaves an echo into a file from Bash to bash-guard. Reads outside the project are allowed unless fenceReads is on. Paths are POSIX, so Windows drive paths are not fenced, and a hard link inside the project that points out of it cannot be detected. Its refusals tell the model to stop and ask you rather than hunt for a workaround. Its plugin.json names awesome-claude-mods as its author, and Singh-AP owns the marketplace.
Demo

What it hooks into
session.startWhen a session startstool.callAround a tool call, where it can hold onecommand.runWhen you run its slash command/file-guard
Read from the on() calls in its hook modules. Open its source under Files to check what each one does.
Slash commands 1
/file-guardShow the fence and what file-guard blocked, or test a path: /file-guard check <path>
Files
The author's README and source, 4 files. They load when you open them.
Facts
- Author
- Singh-AP
- Category
- Safety
- Marketplace
- awesome-claude-mods
- Folder
- mods/safety/file-guard
- Version
- 1.0.0
- License
- MIT
- Repo stars
- 3
- Last change
- 2026-10-04
- Language
- TypeScript
- Files
- 8