Stop

A stop hook that runs a shell check when the coding agent finishes a response. It locates the available agent-guard version and handles cases where the guard tool cannot be run.

In plain words
What is it for?
Use it to check agent-guard at the end of each response. The input does not describe the guard's actual security rules.
Why use it?
It provides a final infrastructure check and can warn when the guard is missing instead of silently ignoring the failure.

Hook

Part of the agent-guard plugin — 2 skills, 2 commands, 5 hooks shipped together

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 hooks/jeongjaesoon/agent-guard/stop
Clone the repo
git clone --depth 1 https://github.com/JeongJaeSoon/agent-guard

Or install agent-guard, the plugin that ships this one along with the rest of its 2 skills, 2 commands, 5 hooks.

Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan A 0 findings. Scan, not verified.
Origin 81% copy Near-identical to another mod in the catalogue.
Security

Grade A, and why

Stop scanned grade A with 0 findings 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 3d ago.

A static scan of the commands this hook runs, not an audit. A hook is shell that executes on your machine at the event it names, which is why every command in it is printed with what was found.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

81% identical to PreToolUse — 8 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.

plugins/agent-guard/hooks/hooks.json · 14 lines

What it actually says

{
  "Stop": [
    {
      "matcher": "",
      "hooks": [
        {
          "type": "command",
          "command": "sh -c 'r=${CLAUDE_PLUGIN_ROOT:-}; b=${r%/*}; s=\"$b/current/bin/agent-guard\"; x=; if [ -n \"$r\" ]; then x=$(for c in \"$b\"/*/bin/agent-guard; do [ -x \"$c\" ] || continue; v=${c%/bin/agent-guard}; printf \"%s\\\\t%s\\\\n\" \"${v##*/}\" \"$c\"; done | awk -F \"\\\\t\" \"\\$1 ~ /^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$/\" | sort -t. -k1,1n -k2,2n -k3,3n | tail -n 1 | cut -f 2-); fi; if [ -x \"$x\" ]; then v=${x%/bin/agent-guard}; v=${v##*/}; if [ ! -e \"$b/current\" ] || [ -L \"$b/current\" ]; then ln -sfn \"$v\" \"$b/current\" 2>/dev/null || :; fi; [ -L \"$b/current\" ] && [ -x \"$s\" ] && x=\"$s\"; fi; if [ ! -x \"$x\" ] && [ -x \"$r/bin/agent-guard\" ]; then x=\"$r/bin/agent-guard\"; fi; if [ ! -x \"$x\" ]; then mode=${AGENT_GUARD_INFRA_FAILURE_MODE:-open}; case \"$mode\" in closed) action=blocking ;; *) mode=open; action=continuing ;; esac; d=${AGENT_GUARD_WARNING_DIR:-${TMPDIR:-/tmp}/agent-guard-warnings-${UID:-user}}; p=; while IFS= read -r line || [ -n \"$line\" ]; do p=$p$line; done; i=${AGENT_GUARD_SESSION_ID:-}; if [ -z \"$i\" ] && command -v jq >/dev/null 2>&1; then i=$(printf %s \"$p\" | jq -r \".session_id // empty\" 2>/dev/null); fi; if [ -z \"$i\" ]; then case \"$p\" in *\\\"session_id\\\":\\\"*) i=${p#*\\\"session_id\\\":\\\"}; i=${i%%\\\"*}; case \"$i\" in \"\"|*[!A-Za-z0-9._:-]*) i= ;; esac ;; esac; fi; if [ -n \"$i\" ]; then i=$(printf %s \"$i\" | cksum); else i=ppid-${PPID:-0}; fi; k=\"$d/manifest-claude-$i-$mode\"; warn=1; if mkdir -p \"$d\" 2>/dev/null; then (umask 077; set -C; : >\"$k\") 2>/dev/null || warn=0; fi; [ \"$warn\" -eq 0 ] || echo \"agent-guard: CLAUDE_PLUGIN_ROOT env not set or no installed binary was found; $action because AGENT_GUARD_INFRA_FAILURE_MODE=$mode\" >&2; [ \"$mode\" = closed ] && exit 2; exit 0; fi; AGENT_GUARD_HOOK_HOST=claude \"$x\" hook-stop'",
          "timeout": 20
        }
      ]
    }
  ]
}
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. 3d ago First seen · 14 lines scan A 50af67cdccc1

Subscribe to this mod's changes

Stop is a hook published in the GitHub repository JeongJaeSoon/agent-guard (24 stars, last pushed 3d ago), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it A with 0 findings. It is 81% identical to PreToolUse, differing in 8 lines, and is treated as a copy.