# Pre-Action Gate & Spend Guard

> Implement a fail-closed safety gate to prevent unauthorized spending, media generation, and data leaks.

Pre-Action Gate & Spend Guard is a paid AI agent skill on Agensi by Enoch Gardiner, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $2 (one-time purchase)
- Creator: [Enoch Gardiner](https://www.agensi.io/creators/enoch-gardiner)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-22
- Security: scan passed (2026-11-20); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/pre-action-gate-spend-guard
- Tags: llm-ops, python, security, automation, safety-gate

## About this skill

A pre-action gate for agents: no irreversible action — media generation, money spend, sign-in, external send — happens until a structured pass entry is written to an append-only ledger, checking standing rules, the exact named source, and the approval it rides on. Includes the gate workflow, a standing-rules template, the best-file-first and honest-state doctrines, and a stdlib ledger tool that validates entries and refuses incomplete ones. From THE PASSWORD.

## Requires

- Python

## Known limitations

Requires Python 3. Cannot block actions if the agent bypasses the gate via custom tools. Does not monitor routine read-only operations.

## 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 Pre-Action Gate & Spend Guard 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

### How does this gate differ from just telling my agent not to spend money in the system prompt?

This skill acts as a hard stop between your agent's decision and the actual API call. Unlike prompts that agents can ignore, this requires a successful Python-validated ledger write before any high-stakes action can trigger, effectively preventing accidental overspending or data leaks.

### Which AI agent frameworks are compatible with this spend guard?

The gate is framework-agnostic and works with any agent capable of executing local Python scripts or CLI commands. As long as your agent can trigger a script before performing an action, you can integrate this safety layer into your workflow.

### What exactly is included in the download?

The package includes the core validation logic in `gate_ledger.py`, a template for your `standing-rules.json`, documentation for the six-field ledger schema, and implementation guides for common agentic workflows.

### Can I customize the safety rules for different types of actions?

Yes, the `standing-rules.json` allows you to define specific criteria for different action classes. You can set unique safety checks for financial transactions that differ from the rules applied to media generation or data transfers.

### What happens if the validation script encounters an error or the ledger file is missing?

No, the gate is 'fail-closed,' meaning if the script cannot run, the ledger is inaccessible, or the validation fails, the action is automatically blocked. This ensures safety even in the event of a system error or agent confusion.

---

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.
