Claude Code hook

agent-guard

Secret-leak guardrails for Claude Code and Codex, also usable as git hooks and in CI.

38 starsHooks Plugin marketplace Source

Install

Inside Claude Code
/plugin marketplace add JeongJaeSoon/agent-guard
From source
git clone https://github.com/JeongJaeSoon/agent-guard.git

From the README

Agent Guard

English · 한국어 · 日本語

A local-first guardrail that keeps AI coding agents from leaking your secrets.
Blocks risky .env reads, masks secret-like output, and scans changes before they reach Git. No hosted account, no telemetry.

Agent Guard is a local-first guardrail for Claude Code, Codex, Git hooks,
GitHub Actions, and direct shell use. It blocks common secret-exposure paths
before a supported tool runs, redacts supported tool output, and scans changed
files after mutations. It uses gitleaks and portable shell; it has no hosted
account, telemetry collector, or developer service.

It is a defense-in-depth boundary. Keep GitHub Secret Scanning, Push
Protection, review, and normal credential management in place. Agent Guard is
not a vault, DLP system, EDR, or credential rotator.

![Agent Guard in Claude Code: the agent's Bash cat and Read of a .env holding a private key are blocked, and the user's own ! cat .env prints the key as [REDACTED] (shell integration enabled)](docs/demo.gif)

Keep secrets out of Git

A key that lands in a commit lives in history long after you delete the file.
Agent Guard puts a gitleaks scan in front of the commit routes it hooks, so a
detected API key, token, or .env value is stopped before it enters history,
with CI behind it as a backstop:

The plugin scans what the commit would contain. That covers the index and also
the tracked changes Git stages by itself for git commit -a, --patch, or a
pathspec such as git commit , --include, or --only, and the
untracked files that --interactive can add. When an argument is only known at
run time, such as git commit $FLAGS, or the same command runs git add first,
the plugin scans every tracked change and untracked file, including ignored
files after git add -f. Shell code the command line…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
Shell
License
MIT
Last updated
3 November 2026
Topics
ai-agentsclaude-codeclaude-code-plugincodexdevsecopsgithub-actionsgitleakspre-commit-hooksecret-scanning

FAQ

What is agent-guard?

Secret-leak guardrails for Claude Code and Codex, also usable as git hooks and in CI. It is a hook for Claude Code, from JeongJaeSoon/agent-guard on GitHub.

How do I install agent-guard?

Run /plugin marketplace add JeongJaeSoon/agent-guard inside Claude Code, then follow the setup in the README.

Is agent-guard popular?

JeongJaeSoon/agent-guard has 38 GitHub stars and 0 forks. It was last updated on 3 November 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.