guard

Warns on destructive bash commands and restricts file edits to a chosen directory.

1|Updated Jul 23, 2026
One-click install
npx skills add https://github.com/sanjanb/my-agent-harness --skill guard-sanjanb
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: guard
Source: https://github.com/sanjanb/my-agent-harness/tree/main/skills/gstack-guard
Command: npx skills add https://github.com/sanjanb/my-agent-harness --skill guard-sanjanb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When working on production systems or live debugging sessions, a single accidental destructive command (rm -rf, DROP TABLE, force-push) or an edit to the wrong file can cause serious damage. This Skill combines two safety layers so risky operations are caught before they execute. ## Core Features & Use Cases - Destructive Command Warnings: Checks bash commands for dangerous patterns like rm -rf, DROP TABLE, force-push, and git reset --hard, warning before execution with an option to override. - Directory-Scoped Edit Boundary: Blocks file edits and writes outside a user-specified directory, enforced via a freeze state file. - Use Case: While hotfixing a bug on a production checkout, activate guard mode scoped to the service directory so the agent cannot accidentally wipe data or modify unrelated parts of the repository. ## Quick Start Ask the agent to enable guard mode and restrict edits to your target directory, for example: turn on full safety mode and lock edits to the src/payments folder.

Frequently Asked Questions about guard

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

FAQPage Schema
How do I prevent an AI agent from running destructive commands?▼

Enable guard mode, which checks every bash command for destructive patterns like rm -rf, DROP TABLE, force-push, and git reset --hard before execution. You receive a warning and can override if the command is intentional.

How to restrict file edits to a specific directory?▼

Guard mode asks which directory to restrict edits to, resolves it to an absolute path, and saves it to a freeze state file. All edits and writes outside that boundary are then blocked until you run /unfreeze.

What is the difference between guard, careful, and freeze modes?▼

Guard is the combination of careful and freeze in a single command. Careful only warns about destructive commands, freeze only enforces the edit boundary, and guard activates both protections together.

Does guard mode require other skills to be installed?▼

Yes, guard references hook scripts from the sibling careful and freeze skill directories. Both are installed together by the gstack setup script, so a standard gstack installation satisfies this dependency.

How do I turn off the edit boundary after enabling guard mode?▼

Run /unfreeze to remove the directory edit boundary while keeping the session active. To deactivate all protections entirely, simply end the session.