install

An installation command for adding prompt-injection defender hooks to a Claude Code project. Prompt injection is text that tries to make an agent ignore its intended instructions.

In plain words
What is it for?
Use it to choose a Python or TypeScript implementation, select project or user-wide installation, copy the required files, and update Claude settings.
Why use it?
It guides setup of protections that inspect prompts and tool activity for suspicious instructions, reducing the need to configure the defenses by hand.

Command 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 commands/lasso-security/claude-hooks/install
Clone the repo
git clone --depth 1 https://github.com/lasso-security/claude-hooks

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 711 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00711
Opus 5 $0.00000 $0.00356
Sonnet 5 $0.00000 $0.00142
Haiku 4.5 $0.00000 $0.00071

Measured 2d ago against content hash 296bc875f948, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

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

Reads agent configuration directorieslowAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- For user-wide: update `~/.claude/settings.json`

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

.claude/commands/install.md · 88 lines

How it starts

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

Install Prompt Injection Defender

Install the prompt injection defender hooks into your Claude Code project.

Instructions

Guide me through installing the prompt injection defender. Ask me:

  1. Which implementation? Python (uv) or TypeScript (bun)
  2. Installation scope? Project-only or user-wide
  3. Which tools to monitor? All recommended tools or let me select

Installation Steps

After gathering my preferences:

  1. Check prerequisites

    • For Python: Verify uv is installed (which uv)
    • For TypeScript: Verify bun is installed (which bun)
  2. Copy hook files

    • Copy the appropriate hook implementation to my project or user config
    • For project: .claude/hooks/prompt-injection-defender/
    • For user-wide: ~/.claude/hooks/prompt-injection-defender/
  3. Copy patterns.yaml

    • Place patterns.yaml alongside the hook script
    • This file contains all detection patterns
  4. Update settings configuration

    • IMPORTANT: Check if .claude/settings.local.json exists first
    • If settings.local.json exists, merge hooks into THAT file (it takes precedence over settings.json)
    • If only settings.json exists, merge hooks there
    • Use the template from python-settings.json or typescript-settings.json
    • Adjust paths based on installation scope
    • For user-wide: update ~/.claude/settings.json

    Settings precedence (highest to lowest):

    1. .claude/settings.local.json (local project - overrides all below)
    2. .claude/settings.json (project settings)
    3. ~/.claude/settings.json (user settings)
  5. Restart Claude Code

    • CRITICAL: Hooks are captured at session startup
    • Tell the user they MUST restart Claude Code for hooks to take effect
    • Exit the current session and start a new one
  6. Verify installation

    • After restart, run a quick test to ensure the hook is working
    • Read a test file with known injection patterns
    • Use /hooks command to verify hooks are loaded

Read the full file on GitHub · 88 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 · 88 lines · 0 tokens per session scan A 296bc875f948

Subscribe to this mod's changes

install is a command published in the GitHub repository lasso-security/claude-hooks (264 stars, last pushed 7mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 711 tokens. A static security scan graded it A with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.