System path mutation guard
A deterministic Claude Code PreToolUse gate that detects common copy, move, install, permission, metadata, directory, and stream-write commands whose static destination is an operating-system path.
Runs on
Scope
$npx @youdede/toolkit add system-path-mutation-guard --target claude-code
What it does
Block explicit file mutation commands targeting protected operating-system paths.
When it fires
- setup
- implementation
- operations
How it behaves
Recognize static command destinations under protected operating-system paths.
It does not write, repair, restore, or change permissions on system files.
It does not resolve dynamic shell paths or follow filesystem links.
It does not replace operating-system sandboxing or privilege separation.
Configuration
targets/claude-code/system-path-mutation-guard.mjs
- Version
- 1.0.0
- Requires
- Shell command guard
- Licence
- RiskThis automatic gate blocks explicit file mutation commands targeting protected operating-system paths; a false denial can interrupt legitimate work, but it does not execute the blocked action.
- Medium
- ModeHow it works: fixed rules, model instructions, or both.
- Deterministic only
- Behaviour
- Enforces, blocks on violation
- On failure
- Denies and blocks
- LatencyThe entrypoint handles one intercepted event to block explicit file mutation commands targeting protected operating-system paths without deferred work.
- Immediate
- Data retentionWhether data remains after use and who manages its storage.
- Not retained
Often used with
All in Security