guard
The guard slash command activates two safety mechanisms simultaneously: careful mode, which requires confirmation before destructive bash commands like rm -rf or git push --force, and freeze mode, which restricts file edits to a specified directory. Use this combined safety configuration when working in sensitive or production-adjacent codebases where both destructive command warnings and edit boundaries are needed.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/nyldn/claude-octopus/HEAD/.claude/commands/guard.md -o ~/.claude/commands/guard.mdguard.md
# Guard Mode - Full Safety Activation
## Instructions
When the user invokes `/octo:guard <directory>`, activate both careful mode and freeze mode in a single command.
### Activation
1. Activate careful mode (destructive command warnings):
```bash
_OCTO_SESSION_ID="${CLAUDE_CODE_SESSION_ID:-${CLAUDE_SESSION_ID:-$$}}"
echo "active" > "/tmp/octopus-careful-${_OCTO_SESSION_ID}.txt"
```
2. Activate freeze mode (edit boundary enforcement):
```bash
freeze_dir="$(cd "$1" 2>/dev/null && pwd)" || freeze_dir="$1"
_OCTO_SESSION_ID="${CLAUDE_CODE_SESSION_ID:-${CLAUDE_SESSION_ID:-$$}}"
echo "${freeze_dir}" > "/tmp/octopus-freeze-${_OCTO_SESSION_ID}.txt"
```
### What It Does
Guard mode combines both safety primitives:
- **Careful mode**: Warns before destructive Bash commands (rm -rf, DROP TABLE, git push --force, etc.)
- **Freeze mode**: Blocks Edit/Write operations outside the specified directory
This is the recommended safety configuration for focused work in sensitive codebases.
### Usage
```
/octo:guard src/auth
/octo:guard ./packages/core
/octo:guard /absolute/path/to/module
```
After activation, confirm to the user:
```
🛡️ Guard mode activated:
⚠️ Careful: Destructive commands require confirmation
🔒 Freeze: Edits restricted to <resolved-path>
Use /octo:unfreeze to remove edit restriction.
```
### Argument Required
If invoked without a directory argument, activate only careful mode and ask about freeze:
```
⚠️ Careful mode activated (destructive command warnings).
Which directory should I restrict edits to? Example: /octo:guard src/auth
```
## When to Use
- Starting work in a production-adjacent codebase
- Debugging with maximum safety
- When you want both protections without two separate commands
## See Also
- `/octo:careful` — Activate only destructive command warnings
- `/octo:freeze` — Activate only edit boundary enforcement
- `/octo:unfreeze` — Remove freeze restrictionBackend architect for scalable API design, microservices, and distributed systems
Cloud architect for AWS/Azure/GCP infrastructure, IaC, FinOps, and multi-cloud strategies
Code review expert for quality analysis, security vulnerabilities, and production reliability
Database architect for data modeling, technology selection, schema design, and migration planning
Debugging specialist for errors, test failures, and unexpected behavior
Technical documentation architect for comprehensive system docs and architecture guides
Frontend developer for React, Next.js, responsive layouts, and accessible UI components
Performance engineer for optimization, observability, and scalable system performance