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.
npx agentmods add hooks/jeongjaesoon/agent-guard/session-startgit clone --depth 1 https://github.com/JeongJaeSoon/agent-guardWrote 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.
[](https://agentmods.dev/hooks/jeongjaesoon/agent-guard/session-start)<a href="https://agentmods.dev/hooks/jeongjaesoon/agent-guard/session-start"><img src="https://agentmods.dev/badge/hooks/jeongjaesoon/agent-guard/session-start.svg" alt="Measured on agentmods" height="20"></a>Grade A, and why
SessionStart 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.
This is a copy
91% 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.
How it starts
The opening of the file, as written. The whole thing — 14 lines — stays where its author put it; the contents beside it link to each section on GitHub.
{
"SessionStart": [
{
"matcher": "startup|resume|clear|compact",
"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-session-start'",
"timeout"What else hooks.json configures
This page is one entry in a file that holds 5. Installing the file brings all of them; each is measured and scanned on its own page.
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.
- 3d ago First seen · 14 lines scan A 971b39d81dab
SessionStart 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 91% identical to PreToolUse, differing in 8 lines, and is treated as a copy.
Other hooks, from other repositories
PostToolUse
Runs after a tool call finishes for Edit, Write, Edit, Write, MultiEdit and Bash tool calls, executing format-and-lint.sh (2 commands). From chainloop-dev/chainloop.
SessionStart
Runs when a session starts, running chainloop trace hook claude session-start. From chainloop-dev/chainloop.
PreToolUse
Runs before the agent uses a tool for Bash and Bash tool calls, executing check-shell.sh (2 commands). From chtnnh/know-code.
PostToolUse
Runs after a tool call finishes for Write, Edit, Bash and Read tool calls, executing run.sh via bash. From MilindGaharwar/fettle.
PostToolUse
Runs after a tool call finishes for Bash tool calls, executing tbd-closing-reminder.sh via bash. From jlevy/supply-chain-hardening.
SessionStart
Runs when a session starts, executing ensure-gh-cli.sh and tbd-session.sh via bash (2 commands). From jlevy/supply-chain-hardening.