Repository navigation
v0.1.0
Claude Code Guardian v0.1.0 π
claude-code-guardian is now available on PyPI!
π― What is Claude Code Guardian?
Claude Code Guardian is validation and permission system for Claude Code focused on controlling what Claude Code can
execute, read or write. Allowing users to define a set of rules to evaluate.
The system uses Claude Code hooks to enforce the rules.
β¨ Key Features
- Security Controls: Block dangerous commands and restrict file access
- Performance Optimization: Suggest better alternatives to common tools
- Policy Enforcement: Implement organization-wide development policies
- Hierarchical Configuration: Multi-layered configuration with team and personal overrides
π οΈ Core Components
Rule Types
pre_use_bash: Validate bash commands before executionpath_access: Control file system access for read/write operations
Action System
allow: Permit operation silentlywarn: Show warning, continue with default permissionsask: Require user confirmationdeny: Block operation completelyhalt: Stop all processingcontinue: Use Claude's default permission system
onfiguration Hierarchy
- Default Rules: Built-in security and performance rules
- User Config:
~/.config/claude-code-guardian/config.yml - Project Shared:
.claude/guardian/config.yml - Project Local:
.claude/guardian/config.local.yml
π¦ Default Rules
This initial release comes with 4 default rules:
Enabled:
security.git_access: Blocks direct write access to.git/security.git_commands: Preventsgit push --force, suggests--force-with-lease
Disabled:
performance.grep_suggestion: Recommendsripgrepovergrepfor better performanceperformance.find_suggestion: Recommendsrg --filesoverfind -namefor better performance
π§ Installation & Setup
Quick Start
# Install from PyPI
uvx claude-code-guardianConfigure Claude Code hooks in ~/.claude/settings.json or .claude/settings.json
Test installation
uvx claude-code-guardian rulesπ― CLI Commands
- claude-code-guardian: Show help and available commands
- claude-code-guardian hook: Hook execution (called by Claude Code)
- claude-code-guardian rules: Display configuration and rule diagnostics
π Debugging & Troubleshooting
- Comprehensive Logging: Rotating log files with debug support
- Configuration Diagnostics: View complete rule evaluation order
- Verbose Mode: Enable debug logging with --verbose flag
{ "hooks": { "SessionStart": [ { "matcher": "", "hooks": [ { "type": "command", "command": "uvx claude-code-guardian hook" } ] } ], "PreToolUse": [ { "matcher": "", "hooks": [ { "type": "command", "command": "uvx claude-code-guardian hook" } ] } ] } }