guard

A read-only command that checks a shell command against abcd's hazard registry before it runs. A hazard registry is a list of command patterns that may be unsafe.

In plain words
What is it for?
Checking whether a proposed shell command should be allowed, warned about, or blocked, and reporting the matched hazard and its plain-language reason.
Why use it?
It helps identify commands that could cause damage or unexpected changes before they are executed, without changing anything itself.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/intentdriven/abcd/guard
Clone the repo
git clone --depth 1 https://github.com/intentdriven/abcd
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,643 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found 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 $0.00030 $0.01643
Opus 5 $0.00015 $0.00822
Sonnet 5 $0.00006 $0.00329
Haiku 4.5 $0.00003 $0.00164

Measured yesterday against content hash 196e80e85e45, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

guard scanned grade B 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 yesterday.

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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

guard does not name (`sudo -u bob <hazard>` is seen; the bundled short form
commands/guard.md · 140 lines

How it starts

The opening of the file, as written. The whole thing — 140 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/abcd:guard shell-hazard check

Decide whether a shell command is safe to run, using abcd's hazard registry — the bundled hazard entries merged with this repo's .abcd/guard.json. This command performs zero writes.

check — decide one command

Pass the candidate on stdin, inside a quoted-delimiter heredoc:

"${CLAUDE_PLUGIN_ROOT}/abcd" guard check --json <<'ABCD_GUARD_EOF'
<the command line, verbatim, on one or more lines>
ABCD_GUARD_EOF

Never interpolate the candidate into --command "…". The shell expands a double-quoted argument before abcd ever starts, so a candidate containing $(…) or a backtick would execute at check time — the exact moment the check exists to prevent — and an embedded " would break the quoting outright. The quoted delimiter (<<'ABCD_GUARD_EOF', quotes included) switches expansion off, so the candidate reaches the guard as written. Use --command only for a literal you typed yourself.

Then report the JSON to the user:

  • verdictallow, warn, or block.
  • entry_id, tier — which hazard matched, and how severe it is.
  • why — the plain-language reason, written for a non-expert.
  • successor — the safe form to run instead.
  • matches — every entry the command tripped, blockers first.

Exit codes: 0 for allow and warn, 1 for a block, 2 when the guard could not be evaluated at all (an unparsable command line, or a .abcd/guard.json that does not load). Treat 2 as a fault to report, never as a clearance.

On a block, do not run the command. Tell the user the why, then run the successor instead — the refusal is the lesson, so pass it on in full. On a warn, the command may run; surface the warning first so the user can stop it.

hook — the host adapter

"${CLAUDE_PLUGIN_ROOT}/abcd" guard hook

Reads a host pre-tool-use hook payload on stdin and applies the same decision before a shell command executes. It is invoked by the plugin's hook manifest, not by hand; a blocker returns the host's blocking status with the successor and the why as the message, and a warn or an allow lets the command run.

Read the full file on GitHub · 140 lines

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. yesterday First seen · 140 lines · 30 tokens per session scan B 196e80e85e45

Subscribe to this mod's changes

guard is a command published in the GitHub repository intentdriven/abcd (3 stars, last pushed 2d ago), licensed MIT. It adds 30 tokens to every session and 1,643 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other commands, from other repositories