I built a little "police department" for my Claude Code subagents

Reddit r/AI_Agents Tools

Summary

A logging hook and CLI tool that records all tool calls and permission events from Claude Code agents into a session log, then replays the log to audit for misbehavior like unauthorized file reads or permission escalation. It is a catch-and-report flight recorder, not a blocker.

The idea is dead simple. It installs one logging hook in your \~/.claude/settings.json that records every tool call + permission event — from the main agent *and* every subagent — into a per-session log. Then there's a pd CLI that replays that log and tells you if anything misbehaved. Stuff like: did an agent read \~/.ssh, try to sudo something, edit its own .claude/settings.json to give itself more permissions, use a tool it wasn't supposed to, or wander off the task it was given. The thing I care most about, and the part I'd push back on if someone called it a "security tool": **it** **never** **blocks** **anything.** It's catch-and-report only. It's a flight recorder + a policescanner, not a firewall. If you actually want to *stop* an action, that's still Claude Code's permission prompts or an OS sandbox doing the work. Find it here
Original Article

Similar Articles

Show HN: A police department for your Claude Code agents

Hacker News Top

agent-pd is an open-source logging and monitoring tool for Claude Code agents that records all tool and permission events and replays them through deterministic detectors to catch rule violations, without blocking any actions.