PostToolUse

An automatic follow-up action that runs after an agent edits, creates, or changes a file.

In plain words
What is it for?
Triggering a Python-based graph update after edits to watched source files in a project with an existing graph file.
Why use it?
It keeps related generated information up to date after file changes, when the watched file types and required data are present.

Hook for Claude Code

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/vit129/agy-plugin-cc/post-tool-use
Clone the repo
git clone --depth 1 https://github.com/Vit129/agy-plugin-cc

Made for: Claude Code.

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 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Security

Grade A, and why

PostToolUse scanned grade A 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 2d 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

"command": "python3 -c \"\nimport json, os, sys, subprocess\nfrom pathlib import Path\ntry:\n from graphify.watch import _WATCHED_EXTENSIONS\n d = json.load(sys.stdin)\n t = d.get('tool_input', d)\n fp = t.get('file_path
.claude/settings.json · 13 lines

What it actually says

{
  "PostToolUse": [
    {
      "matcher": "Edit|Write|MultiEdit",
      "hooks": [
        {
          "type": "command",
          "command": "python3 -c \"\nimport json, os, sys, subprocess\nfrom pathlib import Path\ntry:\n    from graphify.watch import _WATCHED_EXTENSIONS\n    d = json.load(sys.stdin)\n    t = d.get('tool_input', d)\n    fp = t.get('file_path') or t.get('path') or t.get('target_file') or t.get('TargetFile')\n    if fp:\n        p = Path(fp)\n        try:\n            p = p.resolve().relative_to(Path.cwd().resolve())\n        except Exception:\n            pass\n        if p.suffix.lower() in _WATCHED_EXTENSIONS:\n            parts = p.parts\n            if not (any(part.startswith('.') for part in parts) or 'graphify-out' in parts):\n                if os.path.exists('graphify-out/graph.json'):\n                    cmd = [sys.executable, '-m', 'graphify.watch', '--trigger', '.']\n                    kw = dict(stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL, close_fds=True)\n                    if os.name == 'nt':\n                        flags = 0x00000008 | 0x00000200\n                        try:\n                            subprocess.Popen(cmd, creationflags=flags | 0x01000000, **kw)\n                        except OSError:\n                            subprocess.Popen(cmd, creationflags=flags, **kw)\n                    else:\n                        subprocess.Popen(cmd, start_new_session=True, **kw)\nexcept Exception:\n    pass\n\" 2>/dev/null || true"
        }
      ]
    }
  ]
}
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. 2d ago First seen · 13 lines scan A e577a8a52f7a

Subscribe to this mod's changes

PostToolUse is a hook published in the GitHub repository Vit129/agy-plugin-cc (5 stars, last pushed 9d 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 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.