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/fmarzochi/egc/pre-tool-usegit clone --depth 1 https://github.com/Fmarzochi/EGCWrote 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/fmarzochi/egc/pre-tool-use)<a href="https://agentmods.dev/hooks/fmarzochi/egc/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/fmarzochi/egc/pre-tool-use.svg" alt="Measured on agentmods" height="20"></a>Grade A, and why
PreToolUse 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 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.
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.
Copies of this mod
4 near-identical copies found in the catalogue:
- PostToolUse — 91% identical, 117 lines differ
- PostToolUseFailure — 91% identical, 138 lines differ
- UserPromptSubmit — 88% identical, 117 lines differ
- SessionStart — 86% identical, 128 lines differ
How it starts
The opening of the file, as written. The whole thing — 145 lines — stays where its author put it; the contents beside it link to each section on GitHub.
{
"PreToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "node -e \"const p=require('path');const r=(()=>{var e=process.env.EGC_PLUGIN_ROOT||process.env.ECC_PLUGIN_ROOT||process.env.GEMINI_PLUGIN_ROOT;if(e&&e.trim())return e.trim();var p=require('path'),f=require('fs'),h=require('os').homedir(),d=p.join(h,'.gemini'),q=p.join('scripts','lib','utils.js');if(f.existsSync(p.join(d,q)))return d;for(var s of [['egc'],['egc@egc'],['marketplace','egc'],['everything-gemini'],['everything-gemini@everything-gemini'],['marketplace','everything-gemini']]){var l=p.join(d,'plugins',...s);if(f.existsSync(p.join(l,q)))return l}try{for(var g of ['egc','everything-gemini']){var b=p.join(d,'plugins','cache',g);for(var o of f.readdirSync(b,{withFileTypes:true})){if(!o.isDirectory())continue;for(var v of f.readdirSync(p.join(b,o.name),{withFileTypes:true})){if(!v.isDirectory())continue;var c=p.join(b,o.name,v.name);if(f.existsSync(p.join(c,q)))return c}}}}catch(x){}return d})();const s=p.join(r,'scripts/hooks/plugin-hook-bootstrap.js');process.env.GEMINI_PLUGIN_ROOT=r;process.argv.splice(1,0,s);require(s)\" node scripts/hooks/run-with-flags.js pre:budget-check scripts/hooks/pre-budget-check.js minimal,standard,strict",
"timeout": 5
}
],
"description": "Budget guardian: check token/cost limits before every tool call. Warn or block when budget is near exhausted.",
"id": "pre:budget-check"
},
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "node -e \"const p=require('path');const r=(()=>{var e=process.env.EGC_PLUGIN_ROOT||process.env.ECC_PLUGIN_ROOT||process.env.GEMINI_PLUGIN_ROOT;if(e&&e.trim())return e.trim();var p=require('path'),f=require('fs'),h=require('os').homedir(),d=p.join(h,'.gemini'),q=p.join('scripts','lib','utils.js');if(f.existsSync(p.join(d,q)))return d;for(var s of [['egc'],['egc@egc'],['markeWhat else hooks.json configures
This page is one entry in a file that holds 8. 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.
- yesterday First seen · 145 lines scan A 6a32255fc2c6
PreToolUse is a hook published in the GitHub repository Fmarzochi/EGC (48 stars, last pushed yesterday), licensed Apache-2.0. 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. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other hooks, from other repositories
PostToolUse
Runs after a tool call finishes for create_file, write_file, edit_file, replace_string, multi_replace and create_directory tool calls, executing post-edit-commit-reminder.sh and post-tool-session-log.sh via bash (2 commands). From jghiringhelli/forgecraft-mcp.
PreToolUse
Runs before the agent uses a tool for run_in_terminal tool calls, executing pre-exec-safety.sh and pre-exec-health-injector.sh via bash (2 commands). From jghiringhelli/forgecraft-mcp.
Stop
Runs when the agent finishes a response, executing stop-session-summary.sh via bash. From jghiringhelli/forgecraft-mcp.
PostToolUse
Runs after a tool call finishes for Write and Edit tool calls, executing format_and_lint.sh. From supabase/supabase.
SessionStart
Runs when a session starts, executing on-start.js via node. From google-gemini/gemini-cli.
SessionStart
Runs when a session starts on startup, executing install_pkgs.sh. From supabase/supabase.