{"id":30118380,"url":"https://github.com/woop/claude-command-guard","last_synced_at":"2026-05-16T08:34:02.347Z","repository":{"id":305348809,"uuid":"1022650328","full_name":"woop/claude-command-guard","owner":"woop","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-19T15:57:36.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-19T18:35:01.835Z","etag":null,"topics":["agentic","claude","claude-code","vibe-coding"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/woop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"security_validator.py","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-19T14:30:24.000Z","updated_at":"2025-07-19T15:57:40.000Z","dependencies_parsed_at":"2025-07-19T18:45:33.440Z","dependency_job_id":null,"html_url":"https://github.com/woop/claude-command-guard","commit_stats":null,"previous_names":["woop/claude-llm-guard"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/woop/claude-command-guard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woop%2Fclaude-command-guard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woop%2Fclaude-command-guard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woop%2Fclaude-command-guard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woop%2Fclaude-command-guard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/woop","download_url":"https://codeload.github.com/woop/claude-command-guard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woop%2Fclaude-command-guard/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269714817,"owners_count":24463468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic","claude","claude-code","vibe-coding"],"created_at":"2025-08-10T11:30:44.315Z","updated_at":"2026-05-16T08:33:57.297Z","avatar_url":"https://github.com/woop.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Claude Command Guard\n\nCommand safety hook for Claude Code that blocks dangerous bash commands.\n\n### How it works\n\n- **Hard blocks**: Always blocks obviously dangerous commands (`sudo rm`, `chmod 777`, `--no-verify`, etc.)\n- **LLM validation**: Uses Anthropic API to evaluate context-dependent commands (`rm -rf`, `gcloud`)  \n- **Pass-through**: All other commands allowed by default\n\nExamples:\n- ✅ `rm -rf build/` → Safe local directory\n- ❌ `rm -rf /usr` → System directory  \n- ✅ `gcloud projects list` → Read-only\n- ❌ `gcloud instances create` → Write operation\n- ❌ `git commit --no-verify` → Verification bypass\n\n### Setup\n\nRequires: [Claude Code](https://claude.ai/code), `uv`, and Anthropic API key.\n\n```bash\ngit clone https://github.com/woop/claude-command-guard.git \\\n  ~/.claude/hooks/claude-command-guard\n```\n\nAdd to `~/.claude/settings.json`:\n\n```json\n{\n  \"hooks\": {\n    \"beforeBash\": {\n      \"script\": \"uv run ~/.claude/hooks/claude-command-guard/security_validator.py\"\n    }\n  },\n  \"env\": {\n    \"ANTHROPIC_API_KEY\": \"your-key-here\"\n  }\n}\n```\n\n\n### Customize\n\nFork this repo and edit `HARD_BLOCK_RULES` and `LLM_VALIDATION_RULES`.\n\nExample hard block rule:\n```python\nHARD_BLOCK_RULES = {\n    r'sudo\\s+rm': \"Privileged destructive command\",\n    r'--no-verify': \"Verification bypass detected\",\n    r'test-block': \"Test command for dry run validation\",\n}\n```\n\nExample LLM validation rule:\n```python\nLLM_VALIDATION_RULES = {\n    \"rm\": {\n        # Regex to match commands that trigger LLM validation\n        \"pattern\": r'rm\\s+',\n        \n        # Instructions given to LLM\n        \"instructions\": \"Validate rm commands for path safety\",\n        \n        # What LLM should consider safe\n        \"safe_criteria\": \"Single files or safe local directories\",\n        \n        # What to block\n        \"unsafe_criteria\": \"System paths, parent directory traversal, root paths\",\n        \n        # Examples of safe commands\n        \"safe_examples\": [\"rm file.txt\", \"rm -rf build/\", \"rm -rf ./temp\"],\n        \n        # Examples of unsafe commands\n        \"unsafe_examples\": [\"rm -rf ../../../\", \"rm -rf /usr\", \"rm -rf /\"]\n    }\n}\n```\n\n### Testing\n\nAsk Claude to run these built-in dry-run commands:\n- `test-block` → Hard block validation\n- `test-llm` → LLM validation\n\nExample: \"Run the bash command `test-block`\" - should be blocked immediately.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoop%2Fclaude-command-guard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwoop%2Fclaude-command-guard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoop%2Fclaude-command-guard/lists"}