Skip to main content

Audit your Claude Code agent architecture. Detect autonomy risks, observability gaps, and rule coverage issues.

Project description

Oaken AI Claude Agent Auditor

Audit your Claude Code agent architecture. Detect autonomy risks, observability gaps, and rule coverage issues before they cost you.

Built by Oaken AI based on the Stanford CS230 guest lecture on building with LLMs and Claude Code's internal architecture.

PyPI License: MIT

What It Does

Scans your Claude Code workspace and generates a visual HTML report showing:

  • Architecture Score (0-100) based on agent safety and observability patterns
  • Autonomy Risk — LOW / MEDIUM / HIGH based on permission settings and safety controls
  • Observability Coverage — which hooks are present vs. missing (tracing, session logging, memory preservation)
  • Problem Type Coverage — do your rules address domain knowledge gaps, context window limits, hallucinations, and difficulty of control?
  • Rule Overlap Detection — finds redundant rules wasting context budget
  • Agent Setup Analysis — skills, orchestration patterns, subagent delegation

Why This Matters

Agentic Claude Code systems can silently develop dangerous patterns: unconstrained autonomy, no tracing, overlapping rules that dilute each other, missing safeguards for hallucination or context overflow.

Common problems this tool catches:

  • Unconstrained autonomy: bypassPermissions or dontAsk mode with no deny rules — Claude can delete files, push code, send messages without confirmation
  • No agent tracing: Multi-step Task tool runs with no PostToolUse hooks — you can't debug what went wrong
  • Missing session logging: No Stop hook — session decisions are lost after every conversation
  • No memory preservation: PreCompact hook absent — important context silently dropped during long sessions
  • Rule redundancy: Two rules with 80% keyword overlap loaded every session, canceling each other out
  • Narrow problem coverage: Rules address hallucination control but ignore context limits — agent hits token walls silently

Requirements

  • Python 3.10+
  • Zero dependencies (pure Python stdlib)
  • Does NOT need to be installed inside your Claude Code workspace
  • Read-only analysis. Never modifies your files.

Install

pip install claude-agent-auditor

Usage

Run from anywhere. Point it at any Claude Code project directory.

# Scan current directory
claude-agent-auditor

# Scan a specific project
claude-agent-auditor /path/to/your/project

# Generate report and open in browser
claude-agent-auditor /path/to/your/project --open

# Also export raw metrics as JSON
claude-agent-auditor --json

# Save reports to a custom directory
claude-agent-auditor --output ./my-reports/

The tool looks for .claude/ in the target directory (and ~/.claude/ for global settings). It scans settings.json, rules, hooks, and skills. The report is saved to agent-audit/ inside the target directory by default.

Pro tip: After reviewing the report, feed it to your Claude Code instance:

"Read agent-audit/audit.html and implement the HIGH priority recommendations"

Claude can self-modify your settings, rules, and hooks based on the findings. Always review the changes before accepting.

Example Output

  Scanning: /home/user/my-project
  Output:   /home/user/my-project/agent-audit/

  Architecture Score:   58/100
  Autonomy Risk:        MEDIUM ⚠
  Observability:        33%
  Problem Types:        2/4 covered
  Agent Rules:          4
  Issues:               5
  Recommendations:      4

What It Checks

Autonomy & Permissions

Analyzes settings.json permission configuration:

Risk Condition
HIGH bypassPermissions mode or dontAsk with no deny/ask rules
MEDIUM dontAsk with some safety rules, or broad allows with no deny rules
LOW Balanced configuration with explicit deny/ask rules

Observability Hooks

Checks for six hooks across three priority tiers:

Priority Hook Purpose
CRITICAL PostToolUse: Task Trace every agent sub-task
CRITICAL Stop Log session decisions before they're lost
IMPORTANT PreCompact Preserve critical context before compaction
IMPORTANT SessionStart Initialize state and restore context
USEFUL PostToolUse: Write|Edit Audit file changes
USEFUL PostToolUse: Bash Log all executed commands

Problem Type Coverage (Stanford CS230 Framework)

Checks whether your rules address the four fundamental LLM problems identified in the Stanford CS230 guest lecture:

  • Domain Knowledge Gaps — Does the agent know enough? (RAG, context injection, domain rules)
  • Context Window Limits — Does it handle long conversations? (compaction, memory, summarization)
  • Hallucinations — Does it verify before acting? (verification, grounding, skepticism)
  • Difficulty of Control — Can you constrain its behavior? (deny rules, ask rules, scope limits)

Rule Architecture

  • Counts total rules and identifies agent-aware rules
  • Detects overlapping rule pairs using Jaccard similarity (threshold: 35%)
  • Reports which overlap pairs are wasting context budget

Agent Setup

  • Whether skills directory exists and how many skills are defined
  • Whether rules reference the Task tool (agent delegation)
  • Whether orchestration patterns are present (spawn, delegate, dispatch)
  • Whether subagent behavior rules exist

The Patterns

This tool checks your workspace against agent architecture patterns from Claude Code's framework and the Stanford CS230 LLM engineering principles:

  1. Autonomy Gates — Every permission expansion should have a corresponding safety rule
  2. Observability First — If you don't have traces, you can't debug your agent system
  3. Problem Coverage — Rules should explicitly address all four LLM failure modes
  4. Non-Overlapping Rules — Redundant rules dilute each other and waste context budget
  5. Orchestration Awareness — Multi-agent systems need explicit delegation and coordination rules

Also Check

If you haven't optimized your workspace's context and memory yet, start there first:

pip install claude-workspace-optimizer
claude-workspace-optimizer /path/to/your/project --open

The Workspace Optimizer handles memory visibility, context bloat, and rule tiering — foundational issues before agent architecture.

About Oaken AI

Oaken AI builds AI automation systems for businesses. From workspace optimization to full production AI pipelines.

Disclaimer

This tool is provided as-is with no warranty. Oaken AI and its contributors accept zero responsibility for any changes made to your workspace based on this tool's output. The report contains recommendations, not instructions. Always review changes before applying them. Back up your workspace before making modifications.

Author

Built by Benjamin Brown at Oaken AI.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_agent_auditor-0.2.0.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_agent_auditor-0.2.0-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file claude_agent_auditor-0.2.0.tar.gz.

File metadata

  • Download URL: claude_agent_auditor-0.2.0.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for claude_agent_auditor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e794c9c78f7cac9413120141f234862c3dd4afaaafa27aa89cc4278e0ad6b3c7
MD5 f2654d89f9102ea5cf74969d099fa56b
BLAKE2b-256 54ceb3d1ef1b55bb2e477f0830bb8b50c35056def45b9b31ae21d01fbdba50ec

See more details on using hashes here.

File details

Details for the file claude_agent_auditor-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_agent_auditor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4e0292693967205bf96b54ea86589ad41774cf787a97fd0ceed1eb3d8881538
MD5 27ac946e8b15b8580de4e30f7463b2cc
BLAKE2b-256 f931eeb07177147bc6dbb4c2080b6baa1ce307fcd1ad6abd04087aeabd7784f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page