Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By karanb192v1.1.0MITIn 1 marketplace
Flags hidden or hostile directives in CLAUDE.md and rules files before Claude acts on them. A finding locks the session, denying every prompt and tool call until the file is fixed or the lock cleared.
Trending plugins
7-day copy clicks
Run automatically on Claude Code events. Claude doesn't decide.
1 critical · 2 cautions to review before installing
A hook runs before every tool call and can block or approve it
A hook runs when Claude uses the Bash tool
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Prompt-injection tripwire for instruction files: audits CLAUDE.md and
.claude/rules/*.md(the files read at session start and those that load later), and locks the session when a file carries hidden or hostile directives.
The hook scans instruction files for invisible Unicode smuggling (zero width characters, tag characters, invisible operators, variation-selector runs; the TrapDoor supply-chain signature), bidi overrides, decode-and-execute constructs, directives to read or exfiltrate secret material, curl|sh, and directives that make the agent rewrite its own hook or settings configuration. Each finding names the rule and the line (and column, for invisible characters) so a human can inspect the file; quoted excerpts are sanitized so the report itself cannot smuggle text into the transcript.
InstructionsLoaded has no decision control on current Claude Code builds (verified live: exit code ignored, even the universal continue: false ignored), so detection and enforcement are split. A finding writes a per-session lockdown flag (and still emits continue: false for builds that honor it); the same script registered on UserPromptSubmit and PreToolUse then blocks every prompt and denies every tool call for that session, so the poisoned instructions are never acted on. This is the win of the plugin: one install wires all three arms instead of three manual settings.json registrations.
Claude Code fires InstructionsLoaded for the files it reads at session start before a plugin's hooks are registered, so as a plugin the hook never sees those loads. The first UserPromptSubmit or PreToolUse of each session therefore audits the start-up files itself and locks before the model acts: the managed-policy CLAUDE.md, CLAUDE.md and rules/ in the Claude config directory (~/.claude, or CLAUDE_CONFIG_DIR when set), and in the working directory and every parent CLAUDE.md, CLAUDE.local.md, .claude/CLAUDE.md, AGENTS.md and .claude/rules/, plus their @ imports up to five hops. A rule with a non-empty paths: list in its frontmatter loads only when Claude works on a matching file, so it is left to its InstructionsLoaded event (and does not count toward the limits below). This runs once per session, whether the hook is installed as a plugin or through settings.json; files that load later (a nested CLAUDE.md, a path-matched rule) are audited by InstructionsLoaded as they load.
This fallback reads the files as they are on disk at the first prompt or tool call. If a file changed between Claude Code loading it and that call, the hook audits the new bytes, not the ones already in context. An InstructionsLoaded hook registered through settings.json receives the loaded content itself, so register it there too if that window matters to you.
/plugin marketplace add karanb192/claude-code-hooks # once per machine
/plugin install instructions-audit@claude-code-hooks
Restart Claude Code, done. (Or from a shell: claude plugin install instructions-audit@claude-code-hooks.)
| Event | Runs | What happens |
|---|---|---|
| InstructionsLoaded (no matcher: every load reason is audited) | sync | Audits files that load during the session (as a plugin, the session-start loads fire before the hook registers; see below). Audits the loaded content (falls back to reading file_path when the payload has no inline content). On a finding: logs, reports via systemMessage and stderr, writes the per-session lock flag, and emits continue: false + stopReason for builds that honor them. Clean files return {}. |
| UserPromptSubmit | sync (must decide before the prompt) | On the first prompt or tool call of a session, audits the start-up instruction files and locks on a finding. If the session is locked, blocks the prompt (decision: "block") with a notice naming the poisoned file, the first rule that fired, and the flag file to delete. Unlocked sessions pass untouched. |
| PreToolUse (no matcher: every tool call is checked) | sync (must decide before the tool runs) | Same start-up audit (for a session that begins with a tool call) and the same lock check; a locked session gets permissionDecision: "deny" on every tool call. Unlocked sessions pass untouched. |
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub karanb192/claude-code-hooks --plugin instructions-auditPlugins from other owners that cover similar ground