# Fail-Closed Guardrails — Backup, Drift & Auth-Audit Discipli

> Your agent says "done." These guardrails make it prove it — or stop the line.

Fail-Closed Guardrails — Backup, Drift & Auth-Audit Discipli is a paid AI agent skill on Agensi by Enoch Gardiner, in Code Quality & Review. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $12 (one-time purchase)
- Creator: [Enoch Gardiner](https://www.agensi.io/creators/enoch-gardiner)
- Category: [Code Quality & Review](https://www.agensi.io/skills/code-quality-review)
- Version: 1.0
- Last updated: 2026-11-23
- Security: scan passed (2026-11-23); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/fail-closed-guardrails-backup-drift-auth-audit-discipli
- Tags: code-review, python, security, guardrails, automation

## About this skill

Coding agents often fail quietly by applying stale edits, allowing auth checks to fail open, or letting mirrored files drift. This skill installs a strict execution protocol that prevents these silent failures through mandatory snapshots, AST-based audits, and proof-of-work falsifiers.

### What it does
- **Mandatory snapshoting** creates dated, SHA-256 verified backups of every target file before any edit is permitted.
- **Fail-closed auditing** uses AST-based static analysis to catch swallowed exceptions, bare `except: pass` blocks, and default-allow branches in auth code.
- **Mirror drift detection** performs byte-for-byte SHA-256 comparisons between canonical and mirrored directory trees to ensure synchronization.
- **Verification protocol** forces the agent to provide raw command output from a falsifier test before it can claim any task is complete.
- **Read-only inspection** mandates a fresh state check of all target files to prevent edits based on stale or cached context.

### How it works
1. Execute `bak_snapshot.py` on all target files to create verified backups and establish a recovery point.
2. Apply scoped code changes, restricting edits strictly to the files included in the initial snapshot.
3. Run `auth_gate_audit.py` on any modified handlers or `mirror_drift_check.py` for multi-tree deployments.
4. Trigger a falsifier test that intentionally breaks the system to prove the guardrails are active and functional.

### Frameworks & tools
This skill utilizes the Python 3 standard library. It leverages the `ast` module for static analysis, `hashlib` for SHA-256 verification, and `unittest` for the falsifier proof suite.

### Why this beats prompting it yourself
Standard prompts often allow agents to summarize results or skip "obvious" steps like backups. This skill provides a specialized set of Python scripts that take verification out of the LLM's hands and put it into the filesystem and AST parser. It replaces "trust me" with hash-verified evidence.

### Use cases
- Auditing authentication middleware for hidden fail-open vulnerabilities.
- Maintaining strict synchronization between local source code and a mirrored production or staging tree.
- Migrating sensitive session management code where a silent failure would lead to a data breach.
- Refactoring legacy codebases that lack an existing test suite.

### Known limitations
Static audits are optimized for Python AST and may not catch logic errors in other languages. Snapshots are stored locally on the filesystem and require write permissions in the target directory.

## Requires

- Python
- Git

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Fail-Closed Guardrails — Backup, Drift & Auth-Audit Discipli skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What specific risks does the Fail Closed Guardrails skill mitigate during the coding process?

This skill prevents 'silent failures' where an agent might delete data, bypass security checks, or work from outdated file versions by enforcing mandatory SHA-256 backups and AST-based code auditing.

### Which AI agents or frameworks are compatible with this guardrail pack?

The skill is designed for any Python-capable AI agent with filesystem access, as it relies on the Python 3 standard library and does not require third-party dependencies.

### What specific tools and scripts are included in this purchase?

You receive a suite of specialized Python scripts, including a snapshot tool, an AST-based auth auditor, a mirror drift detector, and a falsifier test suite for final verification.

### Can I use these guardrails for projects written in languages other than Python?

The AST-based security audits are optimized for Python; however, the SHA-256 snapshotting and mirror drift detection tools work effectively with any text-based programming language.

### How difficult is it to integrate these guardrails into an existing agent workflow?

Setup is minimal: once you provide the agent with the script suite, it initiates the `bak_snapshot.py` protocol to baseline your environment before any edits are allowed.

### Why should I use this skill instead of just prompting my agent to be careful?

Unlike prompts which can be ignored or 'hallucinated' away, these guardrails use hard-coded filesystem checks and static analysis that provide deterministic proof of success or failure.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
