Index of every page on this site: llms.txt
All skills
garrytan avatar

/freeze

@82db89a official
by Garry Tangarrytan/gstack139k stars
20,556
Run it yourself

Restrict file edits to a specific directory for the session. (gstack)

Use this Skill: https://skilld.dev/gh/garrytan/gstack/freeze

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈19 tokens for metadata: the name and description. ≈864 when used: this file.

How this Skill uses context

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈78 characters, or 1.0%.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly --> <!-- Regenerate: bun run gen:skill-docs -->

/freeze — Restrict Edits to a Directory

Lock file edits to a specific directory. Any Edit, Write or NotebookEdit operation targeting a file outside the allowed path will be blocked (not just warned).

GSTACK_STATE_ROOT=$(~/.claude/skills/gstack/bin/gstack-paths --get GSTACK_STATE_ROOT); : "${GSTACK_STATE_ROOT:?gstack-paths failed; reinstall with ./setup or /gstack-upgrade}"
mkdir -p "$GSTACK_STATE_ROOT"/analytics
echo '{"skill":"freeze","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","repo":"'$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")'"}'  >> "$GSTACK_STATE_ROOT"/analytics/skill-usage.jsonl 2>/dev/null || true

Setup

Ask the user which directory to restrict edits to. Use AskUserQuestion:

  • Question: "Which directory should I restrict edits to? Files outside this path will be blocked from editing."
  • Text input (not multiple choice) — the user types a path.

Once the user provides a directory path:

Set the user-selected boundary with the shared state writer. It resolves the physical absolute path and serializes replacement with investigation cleanup:

bash "$HOME/.claude/skills/gstack/freeze/bin/freeze-state.sh" set "<user-provided-path>"

Only report success if the helper succeeds. On FREEZE_BUSY or unexpected state, preserve it and ask the user to inspect recovery after any active writer finishes; never write or delete the state file directly.

Tell the user: "Edits are now restricted to <path>/. Any Edit, Write or NotebookEdit outside this directory will be blocked. To change the boundary, run /freeze again. To remove it, run /unfreeze."

How it works

The hook reads file_path from the Edit/Write tool input JSON, or notebook_path from a NotebookEdit (Jupyter notebook) call (shared real-JSON extractor with /careful — one copy, sourced by both hooks), then checks whether the path starts with the freeze directory. If not, it returns a hookSpecificOutput payload with permissionDecision: "deny" to block the operation (nested under hookSpecificOutput — Claude Code ignores a top-level permissionDecision).

Polarity is fail-closed: a tool payload the hook cannot parse is DENIED, not allowed — a boundary that fails open is not a boundary. A payload that parses but has neither path field (a non-file tool) is allowed. A deny names the tool, the path field, the boundary and /unfreeze. The path is resolved before the check: ~, .. and relative paths, and symlinks at every depth, even through folders that do not exist yet. A path the hook cannot place (a symlink loop, a line break, a Windows drive-relative path, over 4096 characters) is denied.

The freeze boundary persists until explicitly removed via the state file. The hook script reads it on every Edit/Write/NotebookEdit invocation. Boundaries containing spaces are supported.

Notes

  • The trailing / on the freeze directory prevents /src from matching /src-old
  • Freeze applies to Edit, Write and NotebookEdit only — Read, Bash, PowerShell, Glob, Grep are unaffected
  • This prevents accidental edits, not a security boundary — Bash or PowerShell commands like sed or Set-Content can still modify files outside the boundary
  • To deactivate, run /unfreeze; ending or killing a conversation does not remove persisted state

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts7d3 checks · Risk SAFE
  • Gen Agent Trust Hub7d

    The skill allows the agent to restrict its own file-editing capabilities to a specific user-defined directory. It uses shell hooks to intercept and block write operations outside the designated boundary, preventing accidental modifications to unrelated code. No malicious patterns or security risks were identified.

  • Socket7d

    No alerts

  • Snyk7d

    Risk: LOW · No issues

Signed by skilld at 82db89a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 6 days ago.

Activeupdated last week
What it can do
Runs commands Reads files
version
0.1.0
All 3 allowed tools
BashReadAskUserQuestion
Other metadata
triggers
[
  "freeze edits to directory",
  "lock editing scope",
  "restrict file changes"
]
hooks
{
  "PreToolUse": [
    {
      "matcher": "Edit",
      "hooks": [
        {
          "type": "command",
          "command": "bash -c \"exec bash \\\"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\\\"\"",
          "statusMessage": "Checking freeze boundary..."
        }
      ]
    },
    {
      "matcher": "Write",
      "hooks": [
        {
          "type": "command",
          "command": "bash -c \"exec bash \\\"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\\\"\"",
          "statusMessage": "Checking freeze boundary..."
        }
      ]
    },
    {
      "matcher": "NotebookEdit",
      "hooks": [
        {
          "type": "command",
          "command": "bash -c \"exec bash \\\"$HOME/.claude/skills/gstack/freeze/bin/check-freeze.sh\\\"\"",
          "statusMessage": "Checking freeze boundary..."
        }
      ]
    }
  ]
}
  • freeze
  • file-editing
  • scope-restriction
  • safety-boundary
  • session-state
  • bash

README badge

README badge for garrytan/gstack/freeze

Blocks Edit and Write operations outside a specified directory for the session, preventing accidental changes to unrelated files. Use when debugging a specific module or when you need to scope all modifications to a single folder.

Generated from the current SKILL.md.

Does this skill prevent all file modifications outside the freeze directory?
No. It blocks the Edit and Write tools specifically. Bash commands like sed or other shell utilities can still modify files outside the boundary, so this is a convenience guard rather than a security boundary.
How do I change or remove the freeze boundary during a session?
Run `/freeze` again to set a new directory, or run `/unfreeze` to remove the restriction. The boundary is also cleared when the session ends.
Does this affect read operations like viewing or searching files?
No. The freeze restriction applies only to Edit and Write tools. Read, Bash, Glob, and Grep operations work anywhere in the repository.
What happens if I try to edit a file outside the freeze directory?
The operation is blocked before it runs. The agent receives a denial response and cannot proceed with that edit.

Generated from the current SKILL.md. These answers refresh after source changes.