# Safe AI Agent Guardrails Pack

Green / Amber / Red authority policies for the four things an agent can break fastest: **Stripe, GitHub, email and your database**.

This is the model Founder2 runs in production (it lives in our `@founderos/policy` package), rewritten as
plain JSON plus a ~150-line TypeScript evaluator with zero dependencies, so you can use it in your own broker.

## The three tiers

| Tier | Examples | Who approves | Extra friction |
| --- | --- | --- | --- |
| **Green** | Read a subscription, SELECT with a row limit, read a PR | Nobody | Allowlisted paths only, logged |
| **Amber** | Open a PR, pause a subscription, reply 1:1 to a customer | Owner or approver | Approval bound to the payload hash |
| **Red** | Merge to main, refund, bulk email, DELETE, migrations | Owner only | Re-auth within 10 min + typed confirmation |

Anything not listed in a policy file is **denied**. Default deny is the whole point.

## Files

- `policies/stripe.json`, `policies/github.json`, `policies/email.json`, `policies/postgres.json` — the rules.
- `AUTHORITY_MATRIX.md` — every rule on one page.
- `BROKER_CHECKLIST.md` — how to stop handing raw API keys to a VM or a coding agent.
- `src/evaluate.ts` — reference evaluator: `evaluate(action, policy, approval?)` → allow / require_approval / deny.
- `src/evaluate.test.ts` — the cases that matter, runnable with vitest or `node --test` after transpiling.
- `AGENTS.snippet.md` — paste into your repo's AGENTS.md / CLAUDE.md so coding agents know the rules too.
- `skills/agent-guardrails/SKILL.md` — a skill that makes an agent classify every side effect before it acts.

## The one rule that matters

**The agent never holds the credential.** It asks a broker; the broker holds the key, checks the policy, waits for
approval and executes. Everything else in this pack is detail. Start with `BROKER_CHECKLIST.md`.
