Agent Gate

io.github.Jott2121由 GitHub 账号 Jott2121 发布v0.1.1更新于 Oct 27, 2026

Fail-closed quality gate and hash-chained receipt ledger for AI agent workflows.

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

一个本地 MCP 服务器,为 AI 智能体提供“失败即拦截”的完工检查清单,以及防篡改、哈希链式的回执账本。

可以做什么
  • 获取智能体在宣称完成前必须满足的检查清单
  • 对提交的证据按失败即拦截原则评估,返回是否通过及阻塞项
  • 把决策、指标、取值与结论作为回执追加到哈希链账本
  • 读取全部回执并查看哈希链是否完整
适用场景
适合希望智能体在宣布完成前先证明工作、并留下可审计决策记录的场景。适用于担心静默失败、未经验证的结论或日志被篡改的智能体工作流。
运行要求
以 Python 包(mcp-agent-gate)形式通过 stdio 在本地运行,用 pip 安装并以 Python 模块启动。未声明需要账号、API 密钥或请求头。回执写入用户主目录下的账本文件,可用环境变量 AGENT_GATE_LEDGER 覆盖路径。
安装前请注意
该门禁只校验智能体自行提供的证据,通过结果反映的是所报内容而非独立核实。回执会追加写入本地账本文件,该文件应视为需要保护的记录,因为编辑或删除条目会使哈希链失效。默认清单包含对不可逆操作的人工审批检查,但服务器本身并不执行审批。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Agent Gate,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[agent-gate: gate an AI agent's work before it ships with deterministic checks, refute-first review, tamper-evident receipts]

agent-gate

[ci] [CodeQL] [Coverage] [License: MIT] [Python] [MCP]

An MCP server that lets an AI agent gate its own work before it claims "done": deterministic checks, then an independent refute-first review, then a tamper-evident honest receipt.

Agents that grade their own homework ship low-quality output. agent-gate turns that discipline into tools an agent must actually pass: a fail-closed checklist and an append-only, hash-chained receipts ledger. It is Fleet Mode, an agent-orchestration doctrine, made into a runnable tool. Receipts over hype, enforced by the data structures.

🧩 One layer of a five-repo cost-governance stack for operating AI agents cost-efficiently; bow is the flagship that runs every layer in production.

text
agent: "done!"  ->  verify_gate(evidence)  ->  { passed: false, blocking: ["independent_refute_review", "no_secrets"] }

[agent-gate demo]

Why

The expensive failures in agent systems are the silent ones: a model update degrades output, a change quietly breaks a workflow, an agent declares success while the work is wrong. The fix is not a smarter model. It is a gate the agent cannot talk its way past:

  • Fail-closed. A check counts as satisfied only if it is explicitly true. Missing proof is not proof. (Mirrors a promotion gate, not an informal check.)
  • Tamper-evident receipts. Every decision is recorded as (decision, metric, value, verdict) linked into a sha256 chain. Edit or delete any past receipt and verify_chain() returns false. The honest log is enforced by the structure, not by good intentions.
  • Human-gated by default. "Any irreversible/outward act got human approval" is a required check. Agents draft, humans approve.

Tools (over MCP)

ToolWhat it does
gate_checklist(name="ship")Returns the checklist the agent must satisfy before claiming done.
verify_gate(evidence, name="ship")Evaluates evidence fail-closed and returns {passed, blocking}.
record_receipt(decision, metric, value, verdict)Appends an honest, hash-chained receipt; returns it.
read_receipts()Returns every receipt plus whether the chain is intact.

The default ship gate encodes Fleet Mode: deterministic_checks_pass, independent_refute_review, no_secrets, human_gated_if_irreversible, honest_receipt_logged.

Install & wire into an MCP client

bash
pip install mcp-agent-gate   # or: pip install -e . (from source)

Add it to your MCP client (Claude Desktop / Claude Code) config:

json
{  "mcpServers": {    "agent-gate": { "command": "python", "args": ["-m", "agent_gate.server"] }  }}

Now your agent can call verify_gate(...) before it tells you it is finished, and you get a tamper-evident trail of what it decided. Receipts persist to ~/.agent-gate/receipts.jsonl (override with AGENT_GATE_LEDGER).

Use it directly (no MCP client needed)

python
from agent_gate.gate import DEFAULT_SHIP_GATEfrom agent_gate.ledger import Ledger
res = DEFAULT_SHIP_GATE.evaluate({    "deterministic_checks_pass": True,    "independent_refute_review": True,    "no_secrets": True,    "human_gated_if_irreversible": True,    # honest_receipt_logged missing  ->  fail-closed})print(res.passed, res.blocking)   # False ['honest_receipt_logged']
led = Ledger("receipts.jsonl")led.append(decision="ship v0.1", metric="tests", value="pass", verdict="shipped")print(led.verify_chain())         # True  (until someone edits the log)

Design

  • Tested, stdlib-only core. agent_gate/gate.py (fail-closed checklist) and agent_gate/ledger.py (hash-chained receipts) are pure stdlib: fast to read, fast to trust. agent_gate/server.py is a thin MCP adapter over them (the one runtime dependency: mcp).
  • Tests pass on Python 3.11-3.13 (see CI). The MCP tools are tested by calling them, not just importing.

Tests

bash
pip install -e ".[dev]" && python -m pytest -q

Demo

Run it yourself: PYTHONPATH=. python3 examples/demo.py

------------------------------------------------------------1. Agent claims done — but two checks are missing------------------------------------------------------------{  "passed": false,  "blocking": [    "human_gated_if_irreversible",    "honest_receipt_logged"  ]}
------------------------------------------------------------2. Agent satisfies all five checks------------------------------------------------------------{  "passed": true,  "blocking": []}
------------------------------------------------------------3. Record a hash-chained receipt------------------------------------------------------------{  "seq": 1,  "decision": "ship v0.1",  "verdict": "shipped",  "hash": "015202a168512f15..."}{  "seq": 2,  "decision": "deploy",  "verdict": "approved",  "hash": "9533d304d4dd07e5..."}
------------------------------------------------------------4. Verify the chain — edit receipts.jsonl to see this flip to False------------------------------------------------------------chain_intact: True

This repo gates itself

agent-gate is about not shipping unverified work, so the repository holds itself to the same bar:

  • Coverage-gated test matrix — ci.yml runs pytest on Python 3.11–3.13 and fails the build if line coverage drops below the threshold (currently 97% covered).
  • CodeQL — static analysis (security-extended) runs on every push, PR, and weekly; findings surface in the Security tab.
  • Pinned supply chain — every GitHub Action is pinned to a full commit SHA; Dependabot keeps those pins and the Python deps current.
  • Branch protection — main requires the CI and CodeQL checks to pass before a merge.
  • Disclosure policy — see SECURITY.md.

Contributing

See CONTRIBUTING.md.

About

Built by Jeff Otterson (Jott2121). agent-gate operationalizes the gating discipline from bow (an autonomous all-Claude chief-of-staff agent) and the Fleet Mode doctrine. Siblings in the same line: rag-guard and agent-cost-attribution. MIT licensed.

Companion instrument

sabot is the measurement side of this idea. agent-gate adds a fail-closed gate to an agent workflow; sabot plants controlled faults inside running LangGraph, CrewAI and AutoGen pipelines and measures whether gates and reviewer stages like these actually fire. Median own-check detection across three production frameworks: 16.7%, with a pre-registered spec, an Apache-2.0 harness, and every raw trace published.

来源:README.md,提交 ef91c37

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

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

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分