aigate
Secret hygiene for AI-generated code. Catches hardcoded credentials in prompts, tool inputs, generated code, and existing files.
Quick start
pip install aigate && aigate setup-all
That's it. This installs a background proxy (redact mode), a PostToolUse hook for file scanning, and registers the MCP server with Claude Code. Restart your terminal for env vars to take effect.
Requires Python 3.11+ and jq.
What it does
Three layers, one detection engine:
| Layer | Scope | How |
|---|---|---|
| Proxy | Network-level | Intercepts HTTPS requests to AI APIs. Redacts secrets before they leave your machine. |
| Hooks | Claude Code | PostToolUse scans files after Write/Edit. PreToolUse redacts tool inputs. |
| MCP Server | Any agent | Three tools agents call to scan code, store secrets, and audit files. |
setup-all installs all three. Or pick what you need:
aigate install-hook # hooks only (no proxy)
claude mcp add aigate aigate-mcp # MCP server only
aigate setup && aigate start # proxy only
Scan existing code
aigate scan-dir . # find secrets in a directory
aigate scan-dir . --fix --dry-run # preview what would change
aigate scan-dir . --fix # replace with env var refs, save to .env
Detection
AWS keys, API tokens (OpenAI, Anthropic, GitHub, GitLab, Slack, SendGrid, Square), database URLs, private keys, GCP service accounts, Tailscale keys, env file secrets, and high-entropy password/token fields.
Detected secrets are mapped to conventional env var names:
| Token | Env var |
|---|---|
sk-ant-* |
ANTHROPIC_API_KEY |
sk-*, sk-proj-* |
OPENAI_API_KEY |
ghp_*, github_pat_* |
GITHUB_TOKEN |
glpat-* |
GITLAB_TOKEN |
xoxb-* |
SLACK_BOT_TOKEN |
SG.* |
SENDGRID_API_KEY |
AKIA* |
AWS_ACCESS_KEY_ID |
Proxy modes
aigate start -m block # reject requests (default)
aigate start -m redact # replace secrets with env var placeholders
aigate start -m warn # forward + log warning
aigate start -m audit # forward + silent log
Uninstall
aigate stop-proxy && aigate uninstall-hook && claude mcp remove aigate
pip uninstall aigate && rm -rf ~/.aigate ~/.mitmproxy
Remove the lines after # aigate: proxy env vars and # aigate: trust mitmproxy CA from your shell profile.
CA cert removal — macOS: sudo security delete-certificate -c mitmproxy /Library/Keychains/System.keychain | Debian: sudo rm /usr/local/share/ca-certificates/mitmproxy-aigate.crt && sudo update-ca-certificates --fresh | RHEL: sudo rm /etc/pki/ca-trust/source/anchors/mitmproxy-aigate.pem && sudo update-ca-trust
Metadata
Release files for aigate 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aigate-0.3.1.tar.gz | 38.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aigate-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 66.3 kB
Release files / aigate-0.3.1.tar.gz
| Download URL | aigate-0.3.1.tar.gz |
|---|---|
| Size | 38.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a5be5a3c2716132d742078228a3ed9b4fd365790501a55695687d8c51013712
|
|
BLAKE2b-256 checksum How to use checksums |
27da58b35419ba8c8bfae88a3b6322ec3b8d99533783b3ade356671494af1813
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / aigate-0.3.1-py3-none-any.whl
| Download URL | aigate-0.3.1-py3-none-any.whl |
|---|---|
| Size | 27.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07906235478c23ebb52ba297f71dd9f6d3737b383ff98b0f348fc475e0d0919a
|
|
BLAKE2b-256 checksum How to use checksums |
1f649fa037b21f5eefad37ae8691f51cbfae0bea7d57cc66f20f37e65b4bbaf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for aigate 0.3.1
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.