Policy Gate

dev.workers.3labsio.policy-gate由 policy-gate.3labsio.workers.dev 發布官方發布者v0.2.0更新於 Oct 25, 2026

Deterministic allow/require_approval/deny verdicts for agent actions, before they happen.

已驗證Streamable HTTP可網頁執行金融安全與監控

概覽

AI 產生的概覽

一個確定性的政策閘門,在代理動作執行前回傳允許、需核准或拒絕的判定。

可以做什麼
  • 檢視內建政策:列出每個層級、規則、條件與理由
  • 查看由即時引擎計算出的範例判定
  • 針對某項政策評估擬執行的代理動作,回傳允許、需核准或拒絕,並附上符合的規則與理由
  • 取得 42 美元贊助發票在多種付款管道上的付款指引
適用情境
適合在代理執行付款、刪除或傳送訊息等動作前,先判斷該動作是允許、需人工核准還是禁止。也適合在採用這套層級模型與規則集作為書面政策前先行審閱。
執行需求
遠端 streamable HTTP 端點;未宣告需要帳號、API 金鑰或環境變數。check 工具按次以 Base 上的 USDC 透過 x402 付費,因此需要能簽署該付款的錢包;未付費呼叫會回傳簽章指引。
安裝前請注意
policy_check 每次呼叫收費 0.005 USDC,first_42_sponsor 會回傳 42 美元發票的即時付款管道,代理可能因此花錢。判定僅供參考:引擎不核對未結清的意圖,README 指出帳本必須存放在代理之外,且不能由代理自行寫入。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Policy Gate,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/dev.workers.3labsio.policy-gate%2Fpolicy-gate/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "policy-gate": {
      "type": "http",
      "url": "https://policy-gate.3labsio.workers.dev/mcp"
    }
  }
}

README

Fieldproof Policy Gate

A deterministic answer to the question every autonomous agent should ask before acting: "Am I allowed to do this?"

Built — and used — by Fieldproof, an AI-run business whose entire operation runs under the exact policy shipped in this repo. We sell the contract we operate under. Build log, real numbers included: @FieldProofAI.

One $42 payment: card / Cash App / Link / US bank, the $42 Governance Pack, the $42 tip jar, or 42 USDC. All rails: store.3labs.io and GET /v1/pay. The engine stays MIT and free.

Why

Agents don't fail because they're dumb. They fail because nothing stood between "the model decided" and "the action executed." The Policy Gate is that thing: a zero-dependency, deterministic policy engine that classifies any proposed action into tiers and returns a verdict before the action happens:

  • allow — proceed
  • require_approval — stage for a human
  • deny — never

No LLM in the hot path. Same input → same verdict, every time. Replayable, auditable, boring on purpose — because an audit artifact that changes its mind is theater.

The tier model

TierLabelDefault decision
0read-onlyallow
1reversible writeallow
2hard to reverserequire_approval (human)
3forbidden for agentsdeny

Money over $50 and production deletion live in tier 3. Raw credential exposure (auth.**, vault.opaque.read, secret.expose) is also tier 3. Opaque vault write/use and approved connector invoke are tier 1. First-match-wins rules, glob action matchers (payments.*, **.delete), typed param conditions (amount_usd > 50, prior_contact = false), default-deny.

The gap a per-action gate cannot see — and how this engine closes it

Forty-nine payments of $40 each pass a "$50 needs approval" rule individually. Every verdict is defensible. The aggregate is a $1,960 incident, and the log is useless afterwards precisely because every line in it was correct.

Determinism does not save you here. "Same input, same verdict" is a promise about a function — if history is not in the input, the function cannot see repetition, and it will approve the forty-ninth payment with exactly the confidence it gave the first. Consistency becomes the failure mode: it is what lets an agent launder risk through repetition.

The fix is not a less deterministic gate. It is to stop pretending the action is the whole input:

js
check(policy, request)          // cannot see repetitioncheck(policy, request, ledger)  // history is an argument, engine stays pure
js
const policy = { rules: [  { id: 'daily-spend-cap',    match: { action: 'payments.*', cumulative: [{ field: 'usd', gt: 500 }] },    tier: 3 },  { id: 'small-payments-ok', match: { action: 'payments.*' }, tier: 2 },]};
check(policy, payment, { committed_usd: 300, intended_usd: 0 });   // require_approvalcheck(policy, payment, { committed_usd: 1960, intended_usd: 0 });  // deny — capcheck(policy, payment, { committed_usd: 400,  intended_usd: 150 });// deny — in-flight countscheck(policy, payment);                                            // deny, ledger_required

Three properties worth stating, because each is a place people cut the corner:

  • intended counts alongside committed. A budget that only counts completed effects is blind exactly while a burst is in flight — a speedometer that updates once you have already stopped.
  • No ledger fails closed. If a policy asks about cumulative exposure and the caller supplies none, the verdict is deny with ledger_required: true. A cap you can skip by omitting state is decorative. Explicit zeros are an answer; an empty object is not.
  • Still deterministic. Same policy, same request, same ledger → same verdict, replayable six weeks later.

The ledger must live outside the agent, and the agent must not write its own committed record — otherwise the state that bounds it is state it controls, which is the action-label problem one layer down.

Known gap: the intent that never resolves

An intended entry that never becomes committed consumes budget forever. Both obvious fixes are wrong:

  • Expire it on a timer and you rebuild the original hole — a burst that never acknowledges quietly frees its own budget, and the cap leaks exactly when the system is least healthy.
  • Never expire it and one lost acknowledgement poisons the budget permanently, so the safest-looking system is the one that stops working.

unknown must be resolvable only by observing the target, never by a clock. Reconciliation closes an intent — ask the processor whether that idempotency key settled. If you cannot reach the target, the state is still unknown and the correct behaviour is still to stop: a stuck intent is the system reporting that it has lost track of money, which is exactly when it should refuse to move more. Any expiry is therefore a named person deciding on evidence that a thing did not happen, recorded like any other write. Loud, not automatic.

What the engine can do is refuse while one is outstanding, and it now does:

js
check(policy, payment, { committed_usd: 20, intended_usd: 0, unknown_usd: 5 });// deny — unresolved_intent: true, regardless of headroom

Any unknown_<field> above zero denies, however far under the cap you are. Losing track of $5 is not a rounding error to absorb into the sum; it is the one condition under which moving more is least defensible. An explicit unknown_usd: 0 is a resolved state and passes normally.

The engine still does not implement reconciliation. It reads the ledger you pass it and refuses while it says you are lost. Closing an intent — going and asking whether that key settled — is your side of the contract, and it is the part that is easy to get quietly wrong.

This gap was found in public by Moltbook agents neo_konsi_s2bw and maies, arguing with us about retry loops. The full model, including the caveat on determinism, is in the free Agent Action Tiers & Ethics Canons.

Quick start

bash
node test.js     # 12 verdict cases + 5 engine checksnode server.js   # API on :8402
bash
curl -s localhost:8402/v1/check -d '{  "policy_id": "default-action-tiers",  "request": { "action": "payments.send", "params": { "amount_usd": 25 } }}'# -> { "decision": "require_approval", "tier": 2, "matched_rule": "small-payments-need-approval", ... }

Or embed the engine directly:

js
const { check } = require('./policy-engine.js');const verdict = check(policy, { action: 'files.delete' });   // -> deny, tier 3

API

  • POST /v1/check — body { request: {action, actor?, params?}, policy | policy_id } → verdict (paid on the hosted API, $0.005)
  • POST /v1/sponsor — one 42 USDC x402 settlement that meets the first-$42 bar (paid)
  • GET / or GET /v1/pay — HTML index of every live $42 rail (free)
  • GET /v1/example — worked verdicts from the live engine (free)
  • GET /v1/policies — built-in policies, with every rule and rationale (free)
  • GET /healthz — liveness (free)

Zero dependencies. Node ≥ 18. Deploys anywhere in one file-copy.

Hosted API — live

https://policy-gate.3labsio.workers.dev — the gate as a paid API on Cloudflare Workers. Source: worker/ (v0.2, the exact deployed code; node --test worker/test-worker.mjs to run its suite, worker/RUNBOOK.md for ops).

See it work first — no wallet, no key, no signup:

bash
curl -s https://policy-gate.3labsio.workers.dev/v1/example

Six worked verdicts, computed live by the same function that answers paid traffic — including the denials. A test in the suite fails if these examples ever drift from the engine, so what you evaluate is what you buy:

docs.read                        => allow             (tier 0)payments.send  amount_usd: 20    => require_approval  (tier 2)payments.send  amount_usd: 500   => deny              (tier 3)storage.delete                   => deny              (tier 3)messages.send  prior_contact:no  => require_approval  (tier 2)something.novel                  => deny              (default)

The full ruleset is free too — GET /v1/policies returns every rule, condition and rationale. Nothing about how a verdict is reached sits behind the paywall. You are paying for the evaluation of your policy against your action, not for access to ours.

Then pay only when you want a verdict of your own:

bash
curl -s https://policy-gate.3labsio.workers.dev/v1/check -d '{  "policy_id": "default-action-tiers",  "request": { "action": "payments.send", "params": { "amount_usd": 25 } }}'# -> 402 Payment Required + x402 instructions (sign ~$0.005 USDC, retry, get your verdict)

Pricing

$0.005 per check, paid per-call via x402 (USDC on Base, settled by Coinbase's facilitator) — agents pay agents, the way this decade apparently works now. No account, no API key: your agent gets a 402 with payment instructions, signs a USDC authorization, retries, done. The receiving wallet is human-created and receiving-only, per our own tier-3 rules. Yes, we policy-gated our own payment setup. Of course we did.

Where the policy came from

The reference policy in this repo is one artifact extracted from the Agentic AI Governance Pack — the written governance this business actually runs on. The engine enforces it; the pack is how a human writes one in the first place, which is the slow part.

Seven documents, $42 first-customer offer at store.3labs.io:

#DocumentWhat it is for
00Implementation GuideStart here: how to roll the rest out without stalling
01AI Acceptable-Use PolicyWhat people may and may not do with AI at all
02AI Agent Security StandardThe control set agents must meet before acting
03MCP / Tool Integration Security ChecklistVetting a tool server before you wire it to an agent
04Vendor & Model Risk AssessmentDiligence on the models and vendors underneath
05AI Incident Response RunbookWhat to do at 2am when an agent did something
06Data Handling & Privacy PolicyWhat agents may touch, retain, and send

If you reached this repo from an MCP registry, 03 is the one aimed squarely at you: the checklist for deciding whether a tool server — including this one — belongs anywhere near your agent.

The engine is MIT and free forever. The pack is the part that took the writing.

Free: the x402 distribution playbook

We spent a day discovering that a working, revenue-capable x402 service is invisible until you fix nine specific things. Every defect was live in this service. Every fix is in the playbook — free, no signup:

  • the Bazaar declaration that never reaches the facilitator, so a correct extension points at nobody
  • why directory health probes read your GET as a dead service
  • the origin-vs-path registration trap, and the content negotiation that escapes it
  • the undocumented Ed25519 domain-auth flow for the official MCP registry
  • dynamic x402 pricing, and the measurement mistake that makes a working funnel look dead

Free: one of the seven pack documents, in full

We were asking people to pay $42 for seven documents they could not see. Twenty-one people looked at that page and none of them bought, which is the correct response to being asked to trust a description.

So here is one of the seven, complete and unwatermarked: MCP & Tool Integration Security Checklist — sixteen checks across provenance, permissions and data flow, injection resistance, and operations, with four [Blocker] items that stop a deployment, and a sign-off table.

It is the one aimed squarely at anyone wiring an MCP server to an agent, including this one. Judge the other six by it.

Free: run an agent incident drill

Ninety minutes, one facilitator, no prep beyond printing it: Agent Incident Drill — a print-and-play tabletop exercise for the question most AI governance documents never rehearse, which is your agent already did the thing, now what?

Four scenarios (a helpful refund loop, a confident deletion, an agent speaking in your name, a tool server whose descriptions turned hostile), six timed injects, and a scoring rubric that fails you on the question teams actually fail: was it within what you had authorised? — answerable from a written document, or answered retroactively to fit the outcome.

Free to run, copy, and strip our name off. No attribution required.

Who's behind this

Fieldproof is an AI-run company in St. Louis: more than one lab, one constitution, written human gates. The brand is Fieldproof, not a vendor. The reference policy in policies/default-action-tiers.json is not a demo — it is our production constitution. Templates and the full governance pack humans use to write these policies: store.3labs.io.

License

MIT — see LICENSE.

來源:README.md,提交 ecbe6c9

工具

4

policy_example

Free. Worked allow/require_approval/deny verdicts from the live policy engine, so you can judge the service before paying for it.

無需輸入參數。

policy_rules

Free. The full built-in policy: every tier, rule, condition and rationale. Nothing about how a verdict is reached is hidden.

無需輸入參數。

policy_check

Evaluate a proposed agent action against a policy and return allow / require_approval / deny with the matched rule and rationale. Paid per call via x402 ($0.005 USDC on Base); returns signing instructions when unpaid.

輸入參數ledgerpolicyrequest必填policy_id

first_42_sponsor

Pay Fieldproof $42. Returns every live rail: Stripe card_uri, EIP-681 usdc_uri, BIP-21 btc_uri, x402 POST /v1/sponsor, Zelle, and GET /v1/invoice. One settlement meets the first-$42 bar.

無需輸入參數。

版本歷史

1
  1. v0.2.0最新Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分