Skip to main content

Claude Code security guard - an alternative Claude Code permission framework

Project description

claudeguard

claudeguard enhances Claude Code with automated security decisions using pattern matching and team-shareable profiles.

Why claudeguard?

Claude Code's permission prompts are great for security but repetitive for routine tasks. claudeguard automates common decisions while keeping you in control of sensitive operations.

How it works

claudeguard uses the PreToolUse Claude Code hook to intercept tool calls and override Claude Code's builtin permission logic

Features

  • Pattern matching: Edit(src/**), Bash(/git status/), Bash(rm -rf*)
  • Team sharing: Profiles stored in .claudeguard/profiles/
  • Zero config: Works immediately with sensible rules

Quick Start

# Install
uv tool install claudeguard

# Setup in your project
cd your-claude-code-project
claudeguard install

# Use Claude Code normally
claude

How It Works

claudeguard matches tool calls against rules in .claudeguard/profiles/default.yaml:

rules:
  - pattern: "Read(*)"
    action: allow
  - pattern: "Edit(*.md)"
    action: allow
  - pattern: "Bash(/git (status|diff)/)"
    action: allow
  - pattern: "Edit(src/**)"
    action: ask
  - pattern: "Bash(rm -rf*)"
    action: deny
  - pattern: "*"
    action: ask

First matching rule wins. Actions: allow, ask, deny.

Commands

  • claudeguard install - Setup in current project
  • claudeguard status - Show configuration
  • claudeguard create-profile - Create new profile
  • claudeguard list-profiles - List profiles
  • claudeguard switch-profile - Switch profile
  • claudeguard delete-profile - Delete profile
  • claudeguard uninstall - Remove from project

Pattern Examples

Pattern Matches Action
Read(*) All file reads allow
Edit(*.md) Markdown files allow
Bash(/git (status|diff)/) Safe git commands allow
Edit(src/**) Code files ask
Bash(rm -rf*) Destructive commands deny

Custom Profiles

Create profiles for different security levels:

# .claudeguard/profiles/strict.yaml
name: "strict-policy"
description: "Strict security for production"
rules:
  - pattern: "Read(*)"
    action: allow
  - pattern: "Edit(docs/**)"
    action: allow
  - pattern: "Edit(*)"
    action: ask
  - pattern: "Bash(/git (status|diff|log)/)"
    action: allow
  - pattern: "Bash(*)"
    action: deny
  - pattern: "*"
    action: deny

Development

git clone https://github.com/tarovard/claudeguard
cd claudeguard
uv sync                   # Install dependencies
uv run pre-commit install # Setup git hooks

# Test and lint
uv run pytest            # Run tests
uv run mypy src tests     # Type checking
uv run ruff check --fix . # Format and lint

License

MIT - see LICENSE file.

Contributing

Bug reports and feature requests welcome at GitHub Issues.

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

claudeguard-0.1.3.tar.gz (138.5 kB view details)

Uploaded Source

Built Distribution

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

claudeguard-0.1.3-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file claudeguard-0.1.3.tar.gz.

File metadata

  • Download URL: claudeguard-0.1.3.tar.gz
  • Upload date:
  • Size: 138.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.9

File hashes

Hashes for claudeguard-0.1.3.tar.gz
Algorithm Hash digest
SHA256 452df09a98479741f857e2dd3c910e1b49b4e55ce98d62acbf1d0aff70172958
MD5 b5a725e5228e22dd2eb1df419a198a2b
BLAKE2b-256 194aead1275bb80dd40bce615f8ee15c38ddba49678d5ade7c4f16cd57f29b91

See more details on using hashes here.

File details

Details for the file claudeguard-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for claudeguard-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 78cddc5a60322d375d9a294c4c5680c04df1a9c32a1d7792712338ee4a4fcf06
MD5 f6d99503ba8e437765c1199dd429ea3e
BLAKE2b-256 39daf69bd8cbff2b1cb182a553c32e76ae7c362a067ef0131325601f660a3d9a

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