Skip to content

v0.1.0

Choose a tag to compare

@jfpedroza jfpedroza released this 16 Aug 07:10
· 8 commits to master since this release

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 execution
  • path_access: Control file system access for read/write operations

Action System

  • allow: Permit operation silently
  • warn: Show warning, continue with default permissions
  • ask: Require user confirmation
  • deny: Block operation completely
  • halt: Stop all processing
  • continue: Use Claude's default permission system

onfiguration Hierarchy

  1. Default Rules: Built-in security and performance rules
  2. User Config: ~/.config/claude-code-guardian/config.yml
  3. Project Shared: .claude/guardian/config.yml
  4. 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: Prevents git push --force, suggests --force-with-lease

Disabled:

  • performance.grep_suggestion: Recommends ripgrep over grep for better performance
  • performance.find_suggestion: Recommends rg --files over find -name for better performance

πŸ”§ Installation & Setup

Quick Start

  # Install from PyPI
  uvx claude-code-guardian

Configure Claude Code hooks in ~/.claude/settings.json or .claude/settings.json

{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "uvx claude-code-guardian hook"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "uvx claude-code-guardian hook"
          }
        ]
      }
    ]
  }
}

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