freeze

Restrict file edits to a specified directory using a PreToolUse hook.

9|1|Updated Apr 16, 2026
One-click install
npx skills add https://github.com/CarbeneAI/Forge --skill freeze-carbeneai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: freeze
Source: https://github.com/CarbeneAI/Forge/tree/main/.claude/skills/freeze
Command: npx skills add https://github.com/CarbeneAI/Forge --skill freeze-carbeneai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents accidental or unintended file modifications by restricting Edit and Write operations to a single, user-specified directory for the session, reducing the risk of touching unrelated code while debugging or making focused changes.

Core Features & Use Cases

  • Session-scoped edit boundary: Ask the assistant to set a freeze directory and all Edit/Write tool calls outside that path are blocked.
  • PreToolUse enforcement: A hook runs before Edit and Write tools to check the file_path and returns an explicit deny decision for out-of-bound paths.
  • Persistent, reversible state: The freeze boundary is saved to a session state file and can be changed with /freeze or removed with /unfreeze; useful when debugging, performing focused refactors, or working in sensitive areas of a repository.
  • Limitations: Read and non-Edit tools are unaffected and shell commands can still modify files outside the boundary, so this is a safety guard for tool-mediated edits rather than a full security sandbox.

Quick Start

Tell the assistant to freeze edits to /path/to/dir by providing the absolute path you want restricted for the session.

Frequently Asked Questions about freeze

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I restrict file edits to a specific directory during a coding session?

You can restrict file edits to a specific directory by setting a session-scoped freeze boundary that blocks Edit and Write operations on paths outside the specified folder. This prevents accidental modifications to unrelated code while debugging or refactoring.

How does a PreToolUse hook prevent unintended file modifications?

A PreToolUse hook intercepts Edit and Write tool calls, reads the file_path argument, and returns a deny decision if the path falls outside the configured freeze boundary. This mechanism enforces directory-scoped edit safety before any tool executes.

Can I use this edit control approach for focused refactoring in sensitive repositories?

Yes, you can use this directory restriction for focused refactoring in sensitive repositories. It scopes modifications to a single module or folder, reducing the risk of touching unrelated code during collaborative editing or debugging workflows.

What is the best way to lock down file edits to a single folder in bash?

The best way to lock down file edits in bash is using a shell check script paired with a PreToolUse hook. This combination validates file paths against a persisted freeze boundary file and denies out-of-bound edit operations.

What are the limitations of restricting file edits with a PreToolUse hook?

The main limitation is that Read and non-Edit tools remain unaffected, and shell commands can still modify files outside the boundary. This serves as a safety guard for tool-mediated edits rather than a full security sandbox.

How do I unfreeze or change the directory boundary after it has been set?

You can change or remove the directory boundary by running commands like /freeze to set a new path or /unfreeze to remove the restriction. The freeze state is persisted to a session state file, making it fully reversible.