ClaudeCodeMod

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.

In Claude Code
/plugin marketplace add Singh-AP/awesome-claude-mods
/plugin install file-guard@awesome-claude-mods
Open the repo

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

The file-guard example on the author's GitHub page
Screenshot of the author's GitHub page.

What it hooks into

  • session.startWhen a session starts
  • tool.callAround a tool call, where it can hold one
  • command.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
Repo
Singh-AP/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

Other mods in Safety

slopsquat-guardSingh-APHolds a commandHolds a package install and checks the name against its registry, so a hallucinated or typosquatted package does not install.command-explainerSingh-APDraws a plain-English line and a risk level on the permission prompt, so you can see what the command does before you approve it.secret-guardarasovicHolds a commandHides API keys and private keys before the model or the transcript sees them, blocks credential files and commands that print secrets, and shows what it caught.guardrailsarasovicHolds a commandHolds Cloudflare write commands, attribution lines in commits and pull requests, and branch names that start with claude/.guardrails-liteedtrackaiHolds a commandHolds a read of a secret .env file, a git force-push, and a recursive rm on /, ~, or $HOME. .env.example, .env.sample, and .env.template are allowed.injection-guardSingh-APStrips hidden characters from tool output and marks results that carry instructions aimed at Claude, so they reach it as untrusted data.collision-guardnateherkaiHolds a commandHolds an edit to a file another open chat changed in the last 30 minutes, and asks you to proceed, move this chat to a worktree, or cancel.recording-modenateherkaiHolds a commandMasks keys, personal details, and business figures on screen while you record, hides results from mail, chat, and finance tools, and keeps private files closed.secret-boxray-amjadHolds a commandOpens a masked box when Claude needs a key, writes the key to .env, and gives Claude a placeholder; any key a tool prints comes back as a placeholder too.secret-shieldSingh-APHolds a commandReplaces API keys, tokens, private keys, and passwords in tool output with a redaction marker before the model or the transcript sees them.transcript-redactorray-amjadSwaps secrets and email addresses in the session for stable placeholders, and puts the real value back on the way into Bash, Write, and Edit.safe-deletecharlie947Holds a commandMoves the files Claude deletes to the Bin instead, toasts a receipt, and /undo-delete puts the last batch back.
All 73 in Safety