Skip to main content

cc-guard

Security gateway for Claude Code traffic.

Not to be confused with agent-guard — that's a runtime security engine for AI agents. This is a config installer.

What it does

Point Claude Code at any local anthropic-compatible proxy (flowlens sidecar, litellm, mitmproxy, anthropic-proxy, …) by modifying ~/.claude/settings.json, and back it out cleanly when you're done. Optionally, spawn and supervise the proxy subprocess for you.

# A. Bring your own proxy — cc-guard just patches settings.json
flow run -c ~/.flowlens/sidecar.yaml &
cc-guard install http://127.0.0.1:9999
# ...
cc-guard uninstall

# B. Let cc-guard generate the sidecar config AND spawn the process
cc-guard install http://127.0.0.1:9999 --sidecar
# or against a remote flowlens hub for centralized audit:
cc-guard install http://127.0.0.1:9999 \
  --hub https://hub.example.com --hub-token $TOKEN

Your ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN are passed through untouched in both modes — cc-guard never reads, stores, or rewrites credentials.

Why not just edit ~/.claude/settings.json by hand

Several things need to happen together for the redirect to actually stick:

  • Back up the original ANTHROPIC_BASE_URL so uninstall can restore it (otherwise you lose whatever was there before).
  • Clean conflicting export ANTHROPIC_BASE_URL=... lines in your shell rc file, since shell env vars override settings.json.
  • Atomic writes so a Ctrl-C mid-edit doesn't corrupt your settings.
  • Idempotent install/uninstall so running it twice doesn't double-backup or crash.

cc-guard does all of this, and provides doctor and status commands for checking things after the fact.

Design principles

  1. Proxy-agnostic — any anthropic-compatible local proxy works; nothing is hard-coded to one implementation.
  2. Never touches credentials — ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY pass through unchanged. The proxy forwards them to the real upstream.
  3. Clean uninstall — every change is backed up before it's made, and the optional managed sidecar is SIGTERM'd cleanly on uninstall.
  4. Idempotent — repeat install/uninstall safely.
  5. Plain installer by default — sidecar spawning is strictly opt-in via --sidecar / --hub / --sidecar-config. No background processes unless you asked.

Install

The PyPI package is cc-guardian (the short cc-guard name was too close to an unrelated ccguard project, so PyPI forced a rename). The CLI command is still cc-guard.

uv tool install cc-guardian
# or
pipx install cc-guardian
# or
pip install --user cc-guardian

Two commands are installed: cc-guard (full name) and ccg (short alias).

Platforms: Linux, macOS, Windows. The plain installer is fully cross-platform; the managed sidecar uses start_new_session on POSIX and DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP on Windows. Shell rc cleanup is POSIX-only (no equivalent concept in cmd.exe / PowerShell).

Commands

Command Purpose
cc-guard install URL Point Claude Code at URL (plain mode)
cc-guard install URL --sidecar + spawn a local flowlens sidecar
cc-guard install URL --hub HUB --hub-token TOK + attach to a remote hub
cc-guard uninstall Restore previous settings, stop managed sidecar
cc-guard status Show current install state + sidecar liveness
cc-guard doctor Run diagnostic checks
cc-guard (no args) Interactive wizard

See cc-guard <command> --help for all options, or read docs/execution-logic.md for the wire flow.

License

MIT

Metadata

Release files for cc-guardian 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cc-guardian 0.0.9
File Size Uploaded Provenance Actions
cc_guardian-0.0.9.tar.gz 242.8 kB Without provenance Details for cc_guardian-0.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cc-guardian 0.0.9
File Interpreter ABI Platform Actions
cc_guardian-0.0.9-py3-none-any.whl Python 3 none any Details for cc_guardian-0.0.9-py3-none-any.whl

Total release size: 300.4 kB

Release files / cc_guardian-0.0.9.tar.gz

Download URL cc_guardian-0.0.9.tar.gz
Size 242.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bd5cd4a9551de27cae860de24baaaab8cbd904d5fd0529c2c6827037ab539163
BLAKE2b-256 checksum
How to use checksums
81223831f47c0b6b743879013448ff871db4502fc4f04c2e6701d2be029070f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.2

Release files / cc_guardian-0.0.9-py3-none-any.whl

Download URL cc_guardian-0.0.9-py3-none-any.whl
Size 57.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4546a89684bee1e98355f90fc7e977b0be41975ce39c47e38ca973180744ca3b
BLAKE2b-256 checksum
How to use checksums
331ccfa081a03aaa698486a88a7c98943252f8fd7e0487f2f4f3f8ccdacf8a7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.2

Security for cc-guardian 0.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page