guard

guard is a command for Claude Code from nyldn/claude-octopus. It costs 11 tokens per session (506 once invoked), scanned C, a copy of octo-guard, MIT.

A command that turns on two safety controls for a coding session: warnings before destructive commands and an editing boundary for one directory.

In plain words
What is it for?
Use it when working in a sensitive codebase or when edits should be limited to a directory such as src/auth or packages/core.
Why use it?
It reduces the risk of deleting data or changing files outside the part of the project you intend to work on.

Command for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: positional $N argument.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is /octo:guard ./packages/core.

Part of the octo plugin — 70 skills, 106 commands, 10 agents, 18 hooks shipped together

Good fit Use it when working in a sensitive codebase or when edits should be limited to a directory such as src/auth or packages/core.

Compare 6 commands from other repositories ↓
About the project

Claude Octopus is an orchestration project that sends research, design, and coding tasks to Claude Code and other AI model providers so their results can be compared. Developers use it for multi-model work, disagreement detection, reviews, persistent context, and an optional workflow that moves from discovery through delivery. The catalogue entries are its commands, skills, agents, instructions, hooks, plugins, and settings.

nyldn/claude-octopus · 4,062 stars · on GitHub · reddit.com

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/nyldn/claude-octopus
agentmods
npx agentmods add commands/nyldn/claude-octopus/guard

Made for: Claude Code.

Or install octo, the plugin that ships this one along with the rest of its 70 skills, 106 commands, 10 agents, 18 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for guard

README.md
[![agentmods](https://agentmods.dev/badge/commands/nyldn/claude-octopus/guard/github.svg)](https://agentmods.dev/commands/nyldn/claude-octopus/guard)
Your own site
<a href="https://agentmods.dev/commands/nyldn/claude-octopus/guard"><img src="https://agentmods.dev/badge/commands/nyldn/claude-octopus/guard/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for guard

Your own site · 80×15
<a href="https://agentmods.dev/commands/nyldn/claude-octopus/guard"><img src="https://agentmods.dev/badge/commands/nyldn/claude-octopus/guard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 11 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 506 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 92% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00011 $0.00506
Opus 5 $0.00005 $0.00253
Sonnet 5 $0.00002 $0.00101
Haiku 4.5 $0.00001 $0.00051

Measured 9d ago against content hash a82ad7d185ab, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade C, and why

guard scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- **Careful mode**: Warns before destructive Bash commands (rm -rf, DROP TABLE, git push --force, etc.)
Origin

This is a copy

92% identical to octo-guard — 3 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

commands/guard.md · 76 lines

What it actually says

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):
_OCTO_SESSION_ID="${CLAUDE_CODE_SESSION_ID:-${CLAUDE_SESSION_ID:-$$}}"
echo "active" > "/tmp/octopus-careful-${_OCTO_SESSION_ID}.txt"
  1. Activate freeze mode (edit boundary enforcement):
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 restriction
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 76 lines · 11 tokens per session scan C a82ad7d185ab

Subscribe to this mod's changes

guard is a command published in the GitHub repository nyldn/claude-octopus (4,062 stars, last pushed yesterday), licensed MIT. It adds 11 tokens to every session and 506 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). It is 92% identical to octo-guard, differing in 3 lines, and is treated as a copy.