Idea
Add a /freeze skill that activates a PreToolUse hook on Edit and Write tool calls, hard-blocking any file modifications outside a declared directory. The scope is set by writing a path to ~/.trimkit/freeze-dir.txt and cleared when the skill is deactivated.
Goal
When debugging or investigating a specific part of a codebase, accidental edits to unrelated files are a real risk — especially when Claude is running autonomously. /freeze enforces scope discipline: you declare where work should happen, and edits outside that boundary are denied.
Example workflow
/freeze src/auth/
# Claude is now restricted to editing files under src/auth/
# Any Edit or Write call outside that path is hard-blocked with a clear message
/freeze off
# Scope restriction lifted
Implementation approach
- Add
skills/freeze/SKILL.md — skill prompt that:
- On activation: resolves the given path (handling symlinks via
pwd -P), writes it to ~/.claude/sysops/freeze-dir.txt, confirms to user
- On deactivation (
/freeze off): removes ~/.claude/sysops/freeze-dir.txt
- Add
hooks/check-freeze.sh — PreToolUse hook on Edit and Write tools that:
- Reads
~/.claude/sysops/freeze-dir.txt (if file doesn't exist, allows everything)
- Resolves the target file path and checks if it falls within the freeze boundary
- Returns
{"permissionDecision":"deny","message":"Edit blocked: outside freeze boundary (<path>). Run /freeze off to lift restriction."} if outside
- Register the hook in
settings/hooks.json scoped to the skill
- Update
install.sh accordingly
Notes
- Hard-block (deny), not warn-and-confirm — scope violations are never intentional during a freeze
- Gracefully allows everything when
freeze-dir.txt doesn't exist (no-op when skill is inactive)
- Pairs naturally with debugging workflows: activate before starting, deactivate when done
- Could later be extended to support multiple allowed paths
Idea
Add a
/freezeskill that activates aPreToolUsehook on Edit and Write tool calls, hard-blocking any file modifications outside a declared directory. The scope is set by writing a path to~/.trimkit/freeze-dir.txtand cleared when the skill is deactivated.Goal
When debugging or investigating a specific part of a codebase, accidental edits to unrelated files are a real risk — especially when Claude is running autonomously.
/freezeenforces scope discipline: you declare where work should happen, and edits outside that boundary are denied.Example workflow
Implementation approach
skills/freeze/SKILL.md— skill prompt that:pwd -P), writes it to~/.claude/sysops/freeze-dir.txt, confirms to user/freeze off): removes~/.claude/sysops/freeze-dir.txthooks/check-freeze.sh—PreToolUsehook onEditandWritetools that:~/.claude/sysops/freeze-dir.txt(if file doesn't exist, allows everything){"permissionDecision":"deny","message":"Edit blocked: outside freeze boundary (<path>). Run /freeze off to lift restriction."}if outsidesettings/hooks.jsonscoped to the skillinstall.shaccordinglyNotes
freeze-dir.txtdoesn't exist (no-op when skill is inactive)