claude-code-hooks

A collection of installable Claude Code hooks, which are small actions that run at defined points in an agent session. It includes tools for tracking per-file context costs and recording session quality measures such as failures, edit churn, and tokens used.

In plain words
What is it for?
Use it to inspect context spending, track coding-session outcomes, and detect changes in failure rates or editing behavior.
Why use it?
It makes otherwise hidden usage and quality patterns visible, including which files consume the most context and whether results change between model versions.

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

Claude Code
/plugin marketplace add karanb192/claude-code-hooks
agentmods
npx agentmods add plugins/karanb192/claude-code-hooks/marketplace
Clone the repo
git clone --depth 1 https://github.com/karanb192/claude-code-hooks

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

Grade C, and why

claude-code-hooks scanned grade C with 2 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 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

"description": "PreToolUse guard for Bash: blocks dangerous shell commands (rm -rf ~, fork bombs, curl|sh, force push to main) before they run, with three safety levels and opt-in per-level ask mode.",

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

"description": "PreToolUse guard for Bash: blocks dangerous shell commands (rm -rf ~, fork bombs, curl|sh, force push to main) before they run, with three safety levels and opt-in per-level ask mode.",
.claude-plugin/marketplace.json · 290 lines

How it starts

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

{
  "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
  "name": "claude-code-hooks",
  "description": "Production-ready Claude Code hooks, each installable on its own as a plugin.",
  "owner": {
    "name": "Karan Bansal",
    "url": "https://github.com/karanb192"
  },
  "plugins": [
    {
      "name": "context-hogs",
      "source": "./plugins/context-hogs",
      "description": "Per-file context-cost leaderboard: attributes every tool result's tokens to the files it loaded, so you know which files cost you the most.",
      "category": "cost",
      "tags": [
        "cost",
        "observability",
        "context",
        "hooks",
        "posttooluse"
      ]
    },
    {
      "name": "nerf-receipts",
      "source": "./plugins/nerf-receipts",
      "description": "A personal flight recorder for Claude Code quality: records your own per-session failure rate, edit churn, and tokens/task by model version, and flags real shifts when a model changes.",
      "category": "observability",
      "tags": [
        "quality",
        "observability",
        "model-drift",
        "hooks",
        "sessionend"
      ]
    },
    {
      "name": "dead-rules-audit",
      "source": "./plugins/dead-rules-audit",
      "description": "CLAUDE.md compliance scorecard: tallies which rules Claude actually follows vs ignores as you edit, and flags chronically-ignored rules to promote into a deterministic hook.",
      "category": "observability",
      "tags": [
        "compliance",
        "claude-md",
        "observability",
        "hooks",
        "posttooluse",
        "sessionstart",
        "sessionend"
      ]
    },
    {
      "name": "pr-provenance-stamp",
      "source": "./plugins/pr-provenance-stamp",
      "description": "Stamps a provenance receipt (prompts, estimated spend, tests run with exit codes, and a truthful agent-authored line split) into your PR body on `gh pr create`.",
      "category": "git",
      "tags": [
        "pr",

Read the full file on GitHub · 290 lines

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 · 290 lines scan C 47bac56e877d

Subscribe to this mod's changes

claude-code-hooks is a plugin published in the GitHub repository karanb192/claude-code-hooks (494 stars, last pushed 9d ago), licensed MIT. Its token cost is not measured: this kind of file is read by the harness, not the model. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.