Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By Singh-APv1.0.0MITIn 1 marketplace
Keeps Claude's file edits inside the project: refuses writes outside it (symlinks resolved), never lets a tool touch .git internals, and asks before it changes lockfiles, CI workflows, migrations or secrets.
Trending plugins
7-day copy clicks
Code that runs inside Claude Code on every session, as you, unsandboxed.
Claude Code asks for these when you enable the plugin. Sensitive values are stored in your system keychain.
Protected filesprotect
Comma-separated globs inside the project that ask before Claude changes them. ** crosses folders; a pattern without / matches the file name anywhere; !glob exempts.
stringdefault .github/workflows/**, **/migrations/**,…
Allow temp foldersallowTemp
Let Claude write to /tmp, /var/tmp and $TMPDIR.
1 critical to review before installing
JavaScript or TypeScript that runs inside Claude Code as you, unsandboxed. Read from its source, it sees, changes or blocks tool calls; reads files; reads environment variables (HOME, TMPDIR).
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Extra writable foldersextraRoots
Comma-separated folders outside the project that Claude may write to (~ allowed), e.g. ~/notes, ~/work/shared-config.
stringdefault
Fence reads toofenceReads
Also refuse Read calls outside the project and the folders above.
booleandefault false
Allow Claude's own foldersallowClaudeDirs
Let Claude write its memory, plans, todos and session mods under ~/.claude (never ~/.claude/settings.json).
booleandefault true
Keeps Claude's file edits inside the project. Writes outside it are refused (symlinks resolved),
.gitinternals are off limits, and lockfiles, CI workflows, migrations and secrets ask first.
● Write(/Users/me/.zshrc)
⎿ Error: file-guard refused to change this file: ~/.zshrc is outside this
project (~/code/shop). Keep your work inside the project. If this file
really has to be touched, tell the user why and let them do it, or ask
them to add the folder to file-guard's extraRoots option.
╭─ file-guard ─────────────────────────────────────────────────╮
│ file-guard: .github/workflows/deploy.yml is protected │
│ (matches .github/workflows/**). │
│ │
│ Edit .github/workflows/deploy.yml │
│ │
│ Allow this change? │
│ ❯ 1. Allow once │
│ 2. Allow this file for the session │
│ 3. Block it │
╰──────────────────────────────────────────────────────────────╯
An agent that can edit any file you can is one bad path away from your dotfiles, another repo, or ~/.claude/settings.json. file-guard checks every Read, Edit, Write and NotebookEdit call, including subagents' calls, below the permission system, so it holds in bypass mode too.
/cd moved it), or in a folder you allow. Every path is resolved first: .., relative paths and symlinks. So src/../../etc/hosts and a link pointing out of the repo are caught, and files that don't exist yet are placed through their nearest existing folder./tmp, /var/tmp and $TMPDIR are writable, and so are Claude Code's own memory, plan, todo and session-mod folders under ~/.claude. ~/.claude/settings.json is not..git is off limits. No tool writes into .git/ (hooks, config, refs). Git commands still work..env* (but not .env.example), keys. You can allow a change once or for the whole session. With nobody to ask (-p), the change is refused./file-guard shows the fence, the protected patterns and what was blocked. /file-guard check <path> dry-runs any path and shows where it really lands.fenceReads to fence them too./plugin marketplace add Singh-AP/awesome-claude-mods
/plugin install file-guard@awesome-claude-mods
Requires Claude Code 2.1.287 or later. Pairs well with bash-guard, which covers the shell.
Set these in /config, or under pluginConfigs in settings.json.
| Option | Default | What it does |
|---|---|---|
protect | workflows, migrations, lockfiles, .env*, keys, .git/** | Comma-separated globs inside the project that ask before a write. ** crosses folders, * and ? stay in one, a pattern without / matches the file name anywhere, and !glob exempts. |
extraRoots | empty | Comma-separated folders outside the project that Claude may write, e.g. ~/notes, ~/work/shared-config. |
allowTemp | true | Allow /tmp, /var/tmp and $TMPDIR. |
allowClaudeDirs | true | Allow ~/.claude/projects, plans, todos and dev-mods. |
fenceReads | false | Also refuse Read outside the fence. |
| Event / API | Why |
|---|---|
tool.call (Read, Edit, Write, NotebookEdit, MultiEdit) | Resolves the target, judges it, and returns { deny }, asks with $.ui.ask, or runs next(e) |
$.fs.stat(path, { resolve: true }) | Where a path really lands, links followed. This is the allow-list-on-realPath pattern the mods API recommends. |
$.session.root(), $.session.cwd(), $.env.get('HOME' / 'TMPDIR') | The fence and its exceptions |
command.run | /file-guard status and dry-run |
$.store | The all-time blocked count |
Path logic and the glob matcher (hooks/paths.ts, hooks/verdict.ts) are pure TypeScript with no $.
claude plugin test mods/safety/file-guard # 48 tests
echo x > ~/.zshrc in Bash is bash-guard's job, and a full sandbox's.7-day copy clicks
Plugins from other owners that cover similar ground
npx claudepluginhub singh-ap/awesome-claude-mods --plugin file-guardBuilt from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.