Claude Code hook

Cloneguard

Guarding AI agents from Untrusted Content

8 stars 1 forksHooks Source

Install

Install
pip install cloneguard

Found in the project README. Check it for setup steps after installing.

From source
git clone https://github.com/prodnull/cloneguard.git

From the README

CloneGuard

  Your AI agent reads untrusted repos. CloneGuard watches what it does next.

Hook-level defense for AI coding agents. Detects prompt injection, constrains
suspicious tool calls, and emits structured audit logs -- before the agent
executes. The agent cannot disable it because CloneGuard runs at the hook layer,
outside the agent's control.

Built for Claude Code and Gemini CLI. Standalone scanning works with any agent.
Active development (v0.6.0) -- feedback and contributions welcome.

See It In Action

  A repo with a hidden .clinerules payload — CloneGuard catches it on scan.

More demos

Behavioral sequence detection — reads .env, then tries to curl the data out. First step allowed, second step blocked.

Package hallucination — agent tries to install a package that doesn't exist on PyPI.

Quick Start

That's it. CloneGuard is now scanning every tool call in Claude Code. No config
files to write, no agent restart required.

Want the semantic classifier (recommended):

What It Catches

- Prompt injection patterns -- 240 rules across 34 categories, from
  instruction override to reasoning hijack to MCP tool poisoning
- Behavioral sequences -- credential file read followed by network
  exfiltration attempt (SEQ-001), config writes for privilege escalation
  (SEQ-005), and more
- Package hallucination -- agent tries to install a package that doesn't
  exist on PyPI/npm. If an attacker had registered that name first, you'd be
  running their code
- Sensitive file access -- detects reads of credentials, SSH keys, and
  environment files in suspicious context

How It Works

Four defense layers, each running before the agent can act:

Detection signals:

When a detection fires, CloneGuard can report it (default), constrain the tool
call via OS-level sandbox, or…
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
Python
License
Apache-2.0
Last updated
9 April 2026

FAQ

What is Cloneguard?

Guarding AI agents from Untrusted Content It is a hook for Claude Code, from prodnull/cloneguard on GitHub.

How do I install Cloneguard?

Run pip install cloneguard, then follow the setup in the README.

Is Cloneguard popular?

prodnull/cloneguard has 8 GitHub stars and 1 forks, and is included in 1 curated Claude Code list. It was last updated on 9 April 2026.

More hooks

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