A Claude Code plugin that gives Claude persistent memory stored in a single portable .mv2 file, with no database required.
karanb192/claude-code-hooks
A collection of installable hooks for Claude Code that enforce safety guardrails, automation, cost tracking and notifications on agent tool calls.
- Stars
- 576
- Forks
- 49
- Open issues
- 6
- Last commit
- 5 days ago
What is it?
claude-code-hooks is a set of ready-to-use hooks for Claude Code, packaged as a plugin marketplace with 22 installable plugins. Hooks run at points such as PreToolUse and PostToolUse, where they can allow, deny, or modify a tool call, and the reason is returned to the agent. Because they run as separate processes outside the model, they apply regardless of what the prompt says.
The safety plugins block reads and exfiltration of .env and other secret files, pipe-to-shell installs, rm -rf on home directories, force pushes to main, and edits to the hook and settings configuration itself. Other plugins cover session logging to markdown, daily standup generation, test-tampering protection, automatic git staging, code formatting with ruff and prettier, context-cost tracking, and Slack notifications when Claude needs input. Most guards support a configurable safety level and an ask mode that prompts instead of blocking.
Each plugin installs with a single slash command, and each script also runs standalone when registered in settings.json. The project includes a test suite run on Node 18, 20 and 22, and a mapping against the OWASP LLM Top 10 2026.
Key features
- 01Blocks dangerous shell commands such as rm -rf on home directories, fork bombs and curl | sh.
- 02Prevents reading or exfiltrating .env files, SSH keys and cloud credentials.
- 03Protects the agent's own guardrail configuration from being modified during a session.
- 04Sends Slack alerts when Claude Code needs user input.
- 05Logs each session to markdown and generates daily standups from agent activity.
- 06Installs as individual plugins via the Claude Code marketplace or as standalone scripts.
Use cases
- Adding guardrails so an autonomous coding agent cannot delete files or force-push to main.
- Keeping secrets out of an agent's reach in repositories that contain .env files.
- Tracking session activity and token cost for a team using Claude Code daily.
- Getting notified on Slack when a long-running agent session is waiting for approval.
Quick start
- 1
Add the marketplace inside Claude Code (once)
/plugin marketplace add karanb192/claude-code-hooks - 2
Install the hook you want (example: context-hogs; replace the name with your choice)
/plugin install context-hogs@claude-code-hooks - 3
Restart Claude Code so the hook becomes active
Things to know
- Config-guard at its default high level also blocks claude plugin install, uninstall and disable, so install other plugins first or set CONFIG_GUARD_ALLOW=true for that call.
- The Config-Change payload schema is undocumented, so config-watch parses it defensively.
In collections
Topics
FAQ
- What is claude-code-hooks?
- A collection of installable hooks for Claude Code that enforce safety guardrails, automation, cost tracking and notifications on agent tool calls. claude-code-hooks is a set of ready-to-use hooks for Claude Code, packaged as a plugin marketplace with 22 installable plugins. Hooks run at points such as PreToolUse and PostToolUse, where they can allow, deny, or modify a tool call, and the reason is returned to the agent. Because they run as separate processes outside the model, they apply regardless of what the prompt says.
- Is claude-code-hooks free to use? What license does it have?
- claude-code-hooks is open source under the MIT license. Check the license terms before using it in commercial products.
- Is claude-code-hooks still maintained?
- Actively maintained. The last commit to claude-code-hooks was on Nov 2, 2026.
- What can I use claude-code-hooks for?
- Adding guardrails so an autonomous coding agent cannot delete files or force-push to main. Keeping secrets out of an agent's reach in repositories that contain .env files. Tracking session activity and token cost for a team using Claude Code daily. Getting notified on Slack when a long-running agent session is waiting for approval.
- How do I install claude-code-hooks?
- Add the marketplace inside Claude Code (once): /plugin marketplace add karanb192/claude-code-hooks Install the hook you want (example: context-hogs; replace the name with your choice): /plugin install context-hogs@claude-code-hooks Restart Claude Code so the hook becomes active
- Where can I get claude-code-hooks?
- The source code and installation instructions are on GitHub: https://github.com/karanb192/claude-code-hooks
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A plugin-based harness that gives Claude Code, Codex and other coding agents shared agents, skills, hooks, memory and security scanning.
A CLI and template catalog of ready-to-use agents, commands, settings, hooks and MCP integrations for configuring Claude Code.
A catalog of 28 portable Agent Skills that give Claude Code, Copilot, Codex and Cursor structured reasoning procedures for decisions, diagnosis and risk.
A Claude Code skill set that turns a GitHub Projects kanban board into an autonomous build, QA and review loop that returns merge-ready PRs.
A Claude Code plugin for Elixir/Phoenix with 26 specialist agents, Iron Laws enforcement, and Tidewave MCP integration for planning, implementing, and reviewing code.