PostToolUse

PostToolUse is a hook for coding agents from Fmarzochi/EGC. Its token cost is not measured, scanned A, a copy of PreToolUse, Apache-2.0.

A post-tool-use hook that runs utility commands after selected coding-agent actions finish. Hooks are automatic actions tied to events in an agent workflow.

In plain words
What is it for?
Use it to trigger scripts after Bash commands, edits, writes, or web-fetch operations.
Why use it?
It automates follow-up work after commands or file edits, so routine checks do not depend on manual steps.

Hook

One of 8 entries in hooks.json — they are configured in one file and arrive 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/fmarzochi/egc/post-tool-use
Clone the repo
git clone --depth 1 https://github.com/Fmarzochi/EGC

Wrote 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.

agentmods badge for PostToolUse

README.md
[![agentmods](https://agentmods.dev/badge/hooks/fmarzochi/egc/post-tool-use.svg)](https://agentmods.dev/hooks/fmarzochi/egc/post-tool-use)
Your own site
<a href="https://agentmods.dev/hooks/fmarzochi/egc/post-tool-use"><img src="https://agentmods.dev/badge/hooks/fmarzochi/egc/post-tool-use.svg" alt="Measured on agentmods" height="20"></a>
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 91% copy Near-identical to another mod in the catalogue.
Security

Grade A, and why

PostToolUse 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.

Origin

This is a copy

91% identical to PreToolUse — 117 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.

hooks/hooks.json · 126 lines

How it starts

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

{
  "PostToolUse": [
    {
      "matcher": "Bash",
      "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/post-bash-dispatcher.js",
          "async": true,
          "timeout": 30
        }
      ],
      "description": "Consolidated Bash postflight dispatcher for logging, PR, and build notifications",
      "id": "post:bash:dispatcher"
    },
    {
      "matcher": "Edit|Write|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'],['marketplace','egc'],['everything-gemini'],['everything-gemini@everyth

Read the full file on GitHub · 126 lines

Same file

What 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.

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 · 126 lines scan A cf45d36a43ed

Subscribe to this mod's changes

PostToolUse is a hook published in the GitHub repository Fmarzochi/EGC (48 stars, last pushed today), 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. It is 91% identical to PreToolUse, differing in 117 lines, and is treated as a copy.