Gate your AI agent's destructive actions behind human approval, with a tamper-evident local audit log.
Project description
infraveil-guard
A seatbelt for your AI agent. Put a governed, tamper-evident gate in front of
the destructive things an agent can do — rm -rf, DROP TABLE, terraform destroy, git push --force, kubectl delete namespace, DELETE FROM … with no
WHERE. The agent proposes; the dangerous ones are blocked until a human
approves them out of band; every decision is written to a local hash-chained
ledger you can verify.
Offline by design: no account, no network, no telemetry. It runs entirely on your machine. Open your network tab — it talks to nobody.
pip install infraveil-guard
Why
Coding agents (Claude Code, Cursor, and friends) are great until the one time
they run rm -rf in the wrong directory, or drop the production database to "fix
a migration." You don't want to read every command — you want the catastrophic
ones to stop and wait for you. That's all this does, and it does it well.
Wire it into your agent
Add it as an MCP server. For Claude Code / Cursor / any MCP client:
{
"mcpServers": {
"infraveil-guard": {
"command": "infraveil-guard"
}
}
}
Then add one rule to your agent's instructions (CLAUDE.md, system prompt, etc.):
Before running any shell command, SQL statement, or infrastructure/cloud operation, first call
guard_actionwith the exact command. Only proceed if it returnsproceed: true. If it returnsdecision: "blocked", stop and ask me to approve it — I'll give you a one-time code to pass back asapproval_code.
That's it. Safe commands sail through (and are logged). Dangerous ones stop.
How approval works (the part that matters)
When the agent hits something dangerous, guard_action returns blocked and an
action_id. The agent cannot approve itself — by construction, not by good
behavior. You approve in your own terminal:
$ infraveil-guard approvals
1 action(s) blocked, waiting for approval:
[9b58e9c499b3] CRITICAL CRITICAL risk: drop table (+0 more). Irreversible.
DROP TABLE users;
approve with: infraveil-guard approve 9b58e9c499b3
$ infraveil-guard approve 9b58e9c499b3
Action requesting approval
id: 9b58e9c499b3
risk: CRITICAL (IRREVERSIBLE)
why: CRITICAL risk: drop table. Irreversible.
command:
DROP TABLE users;
Approve this action? [y/N] y
APPROVED. Give the agent this one-time code:
8f2510
It is valid for 15 minutes and works exactly once.
You hand the agent 8f2510; it calls guard_action("DROP TABLE users;", approval_code="8f2510"); the guard checks it, lets it through once, and records
the approval. The code is minted only by the human CLI, is single-use, and
expires — so an agent can't forge or replay it.
Inspect everything — trust nothing
Every decision (allowed, blocked, approved, denied) is appended to a hash-chained
ledger at ~/.infraveil-guard/ledger.jsonl. Editing, deleting, reordering, or
inserting any line breaks the chain:
$ infraveil-guard verify
{ "ok": true, "count": 42, "message": "Hash chain verified across 42 entries - no tampering." }
$ infraveil-guard log 10 # the last 10 decisions, raw
It's ~400 lines of plain stdlib Python. Read it. That's the point.
Tools (MCP)
| Tool | What it does |
|---|---|
guard_action(action, approval_code="") |
Gate an action before running it. Returns proceed true/false. |
assess_action(action) |
Classify blast radius without recording or gating. |
verify_ledger() |
Verify the tamper-evident ledger's hash chain. |
recent_decisions(limit=20) |
The most recent decisions, newest first. |
Configuration
| Env var | Default | Meaning |
|---|---|---|
INFRAVEIL_GUARD_THRESHOLD |
high |
Gate actions at/above this severity: none|low|medium|high|critical. |
INFRAVEIL_GUARD_MODE |
enforce |
enforce blocks dangerous actions; audit logs everything but never blocks (use it to watch your agent before you trust the gate). |
INFRAVEIL_GUARD_HOME |
~/.infraveil-guard |
Where the ledger and approval queue live. |
What this is — and isn't
It is a high-signal classifier + an out-of-band human-approval gate + a tamper-evident local log. It's the smallest honest version of "a human approves before anything irreversible happens."
It is not a sandbox. It works because your agent is told to route actions
through guard_action — a cooperative guardrail, not an unbypassable jail. If you
need a gate the agent cannot skip — because the agent runs inside the governed
runtime, with central audit, least-privilege scoping, and one-click rollback
across a whole fleet — that's the full Infraveil
control plane. This is the doorway; that's the house.
License
AGPL-3.0-or-later. Use it, fork it, read every line. If you run a modified version as a network service, share your changes. © Infraveil Corporation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file infraveil_guard-0.1.0.tar.gz.
File metadata
- Download URL: infraveil_guard-0.1.0.tar.gz
- Upload date:
- Size: 28.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
813d9cac45a3b8e018bdfa030a847bff0d5cb81cd3af99a23f133e21085495a5
|
|
| MD5 |
643f0399be0996552e9c4ef0462a3ee7
|
|
| BLAKE2b-256 |
3e1506e6c631f8876eacf4fabdbfb2312fb9f70ed33ba98e1851a8b4c42c0fa7
|
Provenance
The following attestation bundles were made for infraveil_guard-0.1.0.tar.gz:
Publisher:
publish.yml on infraveilhq/infraveil-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
infraveil_guard-0.1.0.tar.gz -
Subject digest:
813d9cac45a3b8e018bdfa030a847bff0d5cb81cd3af99a23f133e21085495a5 - Sigstore transparency entry: 1886458431
- Sigstore integration time:
-
Permalink:
infraveilhq/infraveil-guard@583526103822ce7a2f361006e0829ead8c3d4a6e -
Branch / Tag:
- Owner: https://github.com/infraveilhq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@583526103822ce7a2f361006e0829ead8c3d4a6e -
Trigger Event:
release
-
Statement type:
File details
Details for the file infraveil_guard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: infraveil_guard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef44aaf04e15b30fdd521f88ccb2e0c681e35639cf937f3d7b63be3885e0f445
|
|
| MD5 |
3f8c81f090985b6b9b481653ec3eba3a
|
|
| BLAKE2b-256 |
c967433cd6a564506e53f24efbb2f2023e000306616129cf58c2af5cb6a3b7c4
|
Provenance
The following attestation bundles were made for infraveil_guard-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on infraveilhq/infraveil-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
infraveil_guard-0.1.0-py3-none-any.whl -
Subject digest:
ef44aaf04e15b30fdd521f88ccb2e0c681e35639cf937f3d7b63be3885e0f445 - Sigstore transparency entry: 1886458475
- Sigstore integration time:
-
Permalink:
infraveilhq/infraveil-guard@583526103822ce7a2f361006e0829ead8c3d4a6e -
Branch / Tag:
- Owner: https://github.com/infraveilhq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@583526103822ce7a2f361006e0829ead8c3d4a6e -
Trigger Event:
release
-
Statement type: