Guardian
Guardian is an open-source middleware and SDK for AI coding assistants. It acts as a developer-controlled approval layer that intercepts operations proposed by AI agents on your machine, evaluates them against local rules, groups repetitive operations, and remembers approved patterns to eliminate approval fatigue without sacrificing control.
Why Guardian Exists
AI coding assistants are highly capable but require access to execute shell commands, install dependencies, read sensitive files, and modify repositories. Managing these permissions manually is a trade-off:
- Unrestricted execution presents high risk to repository integrity and secret leakage.
- Manual approval for every action causes severe cognitive overload and prompt fatigue.
Guardian solves this by acting as a lightweight, deterministic approval engine between your machine and the assistant.
Key Features
- Deterministic Rule Pack: Out-of-the-box rules evaluating actions into Auto Allow, Ask, or Block.
- Action Grouping: Intelligently groups repetitive actions (such as multiple file reads/writes, formatter runs, or test execution loops) into a single approval prompt.
- Approval Memory: Automatically remembers safe interaction patterns and trust configurations to prevent repeated prompting.
- Session Auditing: Logs all evaluated actions and decisions to a local SQLite timeline database.
- Extensible Integration: Supports major command-line and editor-based AI coding assistants through native adapters.
Supported AI Coding Assistants
Guardian is designed to work with a variety of tools. Built-in translation adapters support:
Installation
Guardian requires Python 3.11 or higher.
Install Guardian using pip:
pip install guardian-ai-monitor
For more details on requirements and platform support, see the Installation Guide.
Quick Start
Get started with Guardian in under two minutes:
-
Initialize configuration in your project root:
guardian initThis creates a default
guardian.tomlfile. -
Verify your environment:
guardian doctorThis checks for configuration file validity, SQLite database connectivity, and environment variables.
For a full walkthrough, refer to the Quickstart Guide.
Core Concepts
Understanding how Guardian models action lifecycles:
graph TD
A[AI Assistant Request] --> B[Action Intercepted]
B --> C[Preview Generated]
C --> D[Risk Assessment / Review]
D --> E{Rule & Memory Evaluation}
E -->|Safe / Trusted| F[Auto Allow]
E -->|Moderate Risk| G[Ask Developer]
E -->|High Risk / Blocked| H[Block/Deny]
F --> I[Final Outcome Recorded]
G -->|Approved| I
G -->|Rejected| H
- Action: The raw command, file read/write, or network call proposed by the assistant.
- Preview: A structured preview showing the files, directories, or execution scopes affected.
- Review: An evaluation report containing risk scores, reasons, and classification categories.
- Decision: The final policy outcome (
allow,ask, ordeny) generated by the engine. - Outcome: The recorded lifecycle status tracking whether the operation succeeded or was rejected.
Documentation Links
- Installation Guide - System requirements, installation methods, and troubleshooting.
- Quickstart Guide - Five-minute walk-through of core commands.
- Configuration Reference - Details on custom
guardian.tomloptions and defaults. - CLI Reference - Syntax, arguments, and examples for all CLI commands.
- Rule Pack Guide - In-depth look at Auto Allow, Ask, Block, Grouping, and Approval Memory rules.
Contributing
We welcome contributions! Please see our Contributing Guidelines for local setup, testing instructions, and style guidelines.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 guardian_ai_monitor-0.1.0.tar.gz.
File metadata
- Download URL: guardian_ai_monitor-0.1.0.tar.gz
- Upload date:
- Size: 87.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e26e41828442b8e64efaaca8dec4c6c617191f76b5538a01c0f059510fe989f
|
|
| MD5 |
ba8491854a2d5bdaf6cdca876249eab4
|
|
| BLAKE2b-256 |
1b9dc44c4105601a6335385c67c0f4789da0ab3733b7ceca06735bf236af1062
|
File details
Details for the file guardian_ai_monitor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: guardian_ai_monitor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 172.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00ccce28f7308a4c7783b1eaefd854aaf4c6be81694312a71f42e802f5a75e12
|
|
| MD5 |
2438ba5562bb4148b958f9163665c3a2
|
|
| BLAKE2b-256 |
bf9acf6b951d4221eb9b1e061445d6218d0095a176db0f0dbe67b91665a24e81
|