name: guard
description: >-
Activate both careful mode and freeze mode together. Blocks destructive
commands and scope-locks editing to the specified pattern. Use for
production-critical debugging sessions.
argument-hint: ""
user-invocable: true
allowed-tools: Write, Read
Guard
Role: worker. Combined safety mode: careful + freeze.
You have been invoked with the /guard command.
Worker constraints
- Compose /careful + /freeze; introduce no new blocking behavior.
- Do not edit source.
- Be concise. Confirm both modes in one line each.
Parse Arguments
Arguments: $ARGUMENTS
- Positional:
<glob-pattern>(required) — glob pattern for files that ARE allowed to be edited
If no pattern is provided, display usage and exit:
Usage:
/guard <glob-pattern>Example:/guard src/auth/**— blocks destructive commands AND limits edits tosrc/auth/. Use/careful offand/unfreezeseparately to disable, or passoffto disable both.
If argument is off:
- Remove
hooks/careful-state.jsonandhooks/freeze-state.json - Display: "Guard mode OFF. All safety restrictions lifted."
Steps
1. Enable careful mode
Write to hooks/careful-state.json:
{
"active": true,
"enabled_at": "<ISO timestamp>"
}
2. Enable freeze mode
Write to hooks/freeze-state.json:
{
"active": true,
"allowed_patterns": ["<glob-pattern>"],
"frozen_at": "<ISO timestamp>"
}
3. Confirm
Display:
Guard mode ON.
- Destructive commands: BLOCKED
- File editing: Locked to
<pattern>Use
/guard offto disable both, or/careful off//unfreezeindividually.