Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Policy-Gated Agents: audit and harden tool-using agents

    1

    Reviews or rebuilds an AI agent so the model only proposes payments, refunds, emails and record changes, and plain code decides what executes.

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Policy-Gated Agents: audit and harden tool-using agents

    Policy-Gated Agents: audit and harden tool-using agents

    Example session with this skill installed

    We're about to ship our refund bot (it's in refund-bot/). It reads customer support emails and handles refunds on its own. Can you check whether it's safe to put in front of real customers? Write up what you find in audit.md.

    • Read your context and instructions
    • Compiled the policy-gated agents

    No, it isn't safe to put in front of real customers yet. Every rule in the bot's instructions ("max $100 without a manager", "only the customer's own orders") is only a request to the model; the code never checks any of them. The full report is in audit.md.

    How I checked: I read all the code and ran your test, which passes. Then I ran 17 scenarios against the unchanged bot, using a stand-in model that does whatever the email asks. That stands in for a real model that gets persuaded or is simply wrong, and shows what your code allows, not how likely Claude is to comply. Twelve scenarios ended in a refund, account change or email that shouldn't have happened. In total, $8,410 went out in refunds that break your rules or exceed what the order cost.

    The worst problems:

    Your own suspicious sample email works. If the model follows it, the bot refunds $320 + $48 with no manager, because the email calls the customer "gold-tier". It also changes Maria's account email to the outside address and sends the confirmation there. The manager check only looks at the amount and tier the model types in (agent.py:21-22).

    No checks on refunds. It will refund another customer's order, more than the order cost, or the same order over and over. One test had ten $100 refunds of a $320 order in one go.

    The bot refunds on its own. If the model errors or runs out of steps, it refunds the hinted order in full and says "We've refunded your order." (agent.py:31-36, 53-57). During an outage, every email with an order hint gets a refund.

    It can change the email on any customer's account (update_customer_email), and send email to any address, so it could relay phishing under your brand.

    Retries pay again. One provider timeout paid a $48 refund twice. A locked database turned one $48 refund into 24 payments ($1,152), with nothing in your records.

    • Your test checks the reply's wording. It would still pass if the bot refunded nothing or crashed.

    Fastest fixes, in order:

    1. Remove the account-email tool.
    2. Send email only to the address on file.
    3. Make both fallbacks hold the case for a person.
    4. Check every refund in code before paying: the order belongs to the sender, the amount isn't more than what's left to refund, the tier comes from your database, and there are daily caps.
    5. Make refunds exactly-once: one key per email, and no retry around the payment.
    6. Add tests that check what was actually paid and sent.

    The first three take about an hour combined.

    Questions for you (also listed in the report):

    • Should gold customers really skip approval with no cap? The code says yes; your written rule doesn't.
    • Should the bot refund when the model is down?
    • How do you identify the customer? If it's just the email's From line, anyone can write as anyone.
    • Where does order_hint come from?

    I haven't changed your code. My probe scripts are in scratch/ if you want to rerun them. I can make these fixes and turn the scenarios into tests, and I can add the pattern screener I used to your repo. It flagged the suspicious sample and passed the normal one.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    AI agents that read emails, tickets or documents and also hold tools that move money or send messages can be talked into using those tools. Prompt rules lower the odds; they do not stop a persuaded model.

    This skill applies one pattern: the model's output is a proposal, and deterministic code checks it against the system of record before anything executes. It works in two modes.

    Audit an existing agent: an inventory of every action the model can trigger, seven gate questions for each one (direct or proposed, whose numbers, where the limits live, approvals, exactly-once writes, failing closed, audit trail), a severity rule, and a report template with file:line evidence.

    Build the gate into an agent: proposals with schemas, facts fetched by ID, rules as pure functions with stable codes, an executor that re-checks and writes exactly once, approvals bound to the exact proposal and claimed atomically, and fail-closed error paths. It ends with tests that would catch a regression, including a "gullible model" test where a stub model obeys the injected instructions and nothing unsafe may execute.

    What's included

    • SKILL.md: the workflow for both modes and the report template
    • references/: audit checklist with search patterns for OpenAI Agents SDK, Anthropic tool use, LangChain/LangGraph, Vercel AI SDK and MCP; build notes with a TypeScript sketch; eval design (end-state graders, fault injection, pass^k)
    • scripts/injection_screen.py: standard-library screener for instructions aimed at AI agents and for invisible Unicode (tag characters, zero-width, bidi controls); CLI and importable; no network access
    • templates/policy_gate.py and test_policy_gate.py: a dependency-free reference gate with 10 tests

    Tested

    In two side-by-side tests on a deliberately flawed refund bot, the version hardened without this skill paid a replayed refund twice both times; the version hardened with it did not.

    Works with any stack. The patterns come from Matchpoint, an open-source accounts-payable agent harness (github.com/Safiullah-Rahu/matchpoint), where a model that obeyed injected invoice notes made 63 unsafe proposals across the eval suite and none executed.

    What it does not do

    It does not make the model's answers correct, and it does not replace a security review of the rest of the system.

    Covers actions with side effects (payments, refunds, emails, record changes). It does not make the model's answers correct, does not cover data leaks from read-only agents, and does not replace a security review of the rest of the system. The injection screener is pattern-based: it lowers the odds of a persuaded model, while the code gate is what makes a bad proposal harmless. Build mode edits your code, so review the diff and run your tests.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed today

    Requires

    Python 3.9+

    Permissions

    Terminal / Shell
    Write Files
    Read Files

    Reads the agent's code to audit it. In Build mode it edits that code and adds tests. It runs the bundled Python screener and tests locally. It makes no network calls.

    Listedtoday

    What's inside

    Frequently Asked Questions

    Unlike prompt-based instructions that models can ignore through injection or hallucination, this skill implements deterministic code-level gates that validate actions against your system-of-record before they execute.

    It works with any stack. The audit checklist has search patterns for the OpenAI Agents SDK, Anthropic tool use, LangChain/LangGraph, the Vercel AI SDK and MCP. The reference gate and its tests are in Python, and the build notes include a TypeScript sketch.

    Seven files: SKILL.md (the audit and build workflows and a report template), three reference files (audit checklist, build notes, eval design), a standard-library screener for prompt injection and invisible Unicode, and a dependency-free Python reference gate with 10 tests.

    It shows how to make each write happen exactly once: the key names the request (for example the order and the email's message ID), not the attempt, it is stored with a unique constraint, and the same key is passed to the payment provider. A retry or a replayed email then returns the first result instead of paying again. The reference gate includes a replay test.

    Start with Audit mode: it lists every action the model can trigger and writes a report with file:line evidence and a fix order. Then Build mode makes the changes: proposals with schemas, facts fetched by ID, a pure-function gate, an executor that re-checks and writes once, approvals, and fail-closed error paths, followed by tests that include a gullible-model test.

    This skill focuses on securing 'write' actions and side effects; it does not prevent the model from hallucinating facts in conversation or provide PII redaction for read-only data.

    New in Agents & Orchestration