Getting it into your agent
This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.
/plugin marketplace add yurukusa/cc-safe-setup/plugin install cc-safe-setupWrote 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/yurukusa/cc-safe-setup/pre-tool-use)<a href="https://agentmods.dev/hooks/yurukusa/cc-safe-setup/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/yurukusa/cc-safe-setup/pre-tool-use.svg" alt="Measured on agentmods" height="20"></a>Grade C, and why
PreToolUse 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 yesterday.
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.
Reaches for credential fileshighPrivilege escalation
SSH keys, cloud credentials, git-credentials, .npmrc, /etc/shadow: reading these is how a config file becomes a credential leak.
"command": "INPUT=$(cat); FILE=$(printf %s \"$INPUT\" | jq -r '.tool_input.file_path // empty'); [ -z \"$FILE\" ] && exit 0; BASE=$(basename \"$FILE\"); if echo \"$BASE\" | grep -qE '^\\.env\\.(example|sample|template)$' How it starts
The opening of the file, as written. The whole thing — 58 lines — stays where its author put it; the contents beside it link to each section on GitHub.
{
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "INPUT=$(cat); CMD=$(printf %s \"$INPUT\" | jq -r '.tool_input.command // empty'); [ -z \"$CMD\" ] && exit 0; STMTS=$(printf '%s\\n' \"$CMD\" | awk '{ if (sub(/\\\\[ \\t]*$/, \" \")) { b = b $0; next } print b $0; b = \"\" } END { if (b != \"\") print b }' | tr ';&|' '\\n' | sed -E 's/#.*$//'); HIT=$(printf '%s\\n' \"$STMTS\" | grep -E '^[[:space:]]*(sudo[[:space:]]+)?rm[[:space:]]+([^[:space:]]+[[:space:]]+)*(-[a-zA-Z]*[rR]|--recursive)' | grep -vE '(^|[[:space:]/])(node_modules|dist|build|__pycache__|tmp)(/|[[:space:]]|$)'); if [ -n \"$HIT\" ]; then echo 'BLOCKED: recursive rm on non-safe target. Use specific paths.' >&2; exit 2; fi"
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "INPUT=$(cat); CMD=$(printf %s \"$INPUT\" | jq -r '.tool_input.command // empty'); [ -z \"$CMD\" ] && exit 0; CHECK=$(printf '%s\\n' \"$CMD\" | awk '{ if (sub(/\\\\[ \\t]*$/, \" \")) { b = b $0; next } print b $0; b = \"\" } END { if (b != \"\") print b }' | sed -E 's/--force-with-lease(=[^[:space:]]*)?//g'); if printf '%s\\n' \"$CHECK\" | grep -qE 'git[[:space:]]+push[[:space:]]+.*--force|git[[:space:]]+reset[[:space:]]+--hard|git[[:space:]]+clean[[:space:]]+-[a-zA-Z]*[fd]'; then echo 'BLOCKED: destructive git operation. Confirm before proceeding.' >&2; exit 2; fi"
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "INPUT=$(cat); CMD=$(printf %s \"$INPUT\" | jq -r '.tool_input.command // empty'); [ -z \"$CMD\" ] && exit 0; CHECK=$(printf '%s\\n' \"$CMD\" | awk '{ if (sub(/\\\\[ \\t]*$/, \" \")) { b = b $0; next } print b $0; b = \"\" } END { if (b != \"\") print b }'); if printf '%s\\n' \"$CHECK\" | grep -qiE '(api[._-]?key|secret|password|token).*=.*[A-Za-z0-9]{20}'; then echo 'BLOCKED: potentialWhat 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.
- yesterday Changed bac332ea7dba
- 5d ago First seen · 58 lines scan C 23f4e3be3300
PreToolUse is a hook published in the GitHub repository yurukusa/cc-safe-setup (6 stars, last pushed yesterday), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it C with 1 finding (reaches for credential files). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other hooks, from other repositories
PermissionDenied
Runs on the PermissionDenied event, executing dev-hook.mjs with --hook. From FailproofAI/failproofai.
ConfigChange
Runs on the ConfigChange event, executing dev-hook.mjs with --hook. From FailproofAI/failproofai.
ElicitationResult
Runs on the ElicitationResult event, executing dev-hook.mjs with --hook. From FailproofAI/failproofai.
PreToolUse
Runs before the agent uses a tool for Read, Edit, Write, Read, Grep, Task and Edit tool calls, executing pre-tool-use-broadcast.mjs, path-rules.mjs, tldr-read-enforcer.mjs, smart-search-router.mjs, tldr-context-inject.mjs, arch-context-inject.mjs, file-claims.mjs, edit-context-inject.mjs and signature-helper.mjs via…
Stop
Runs when the agent finishes a response, executing hook_launcher.py, stop_hook.sh and compiler-in-the-loop-stop.mjs via uv (3 commands). From parcadei/Continuous-Claude-v3.
SessionStart
Runs when a session starts, executing cli.js via node. From code-yeongyu/codex-rules.