Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I built a 4-tier approval gate for my AI companion: a heuristic that can never say no

说明与用途

为 Ankita 桌面助手实现了四层审批门,防止 Gmail 等服务的未授权操作,并为所有决策提供审计跟踪。

问题

The original approval system allowed trusted servers to bypass prompts, letting Gmail send mail without user confirmation.

结果

The new gate prevents silent approvals, ensures every tier downgrade is reviewed, and provides an audit trail for all decisions.

工作流

  • 1. Replace binary rule with mcp‑tiers.mjs defining four tiers.
  • 2. Resolve tier via blocklist → per‑tool rule → per‑app rule → app defaults → heuristic.
  • 3. Implement lowersProtection() to flag tier downgrades as approval‑worthy.
  • 4. Parse meta‑tool arguments in enclosedActions() to determine worst enclosed tier.
  • 5. Record decisions with recordDecision() for audit trail.
  • 6. Store pending approvals in ApprovalRegistry for UI visibility.
  • 7. Run comprehensive tests (14/14) to validate tier resolution logic.

证据

The old rule was binary: a tool marked readOnlyHint: true skipped the gate, everything else asked — and a trusted server skipped the gate entirely.

来源

Tier 0 — auto-allow: read-only tools. Tier 1 — ask once. Tier 2 — always ask for destructive verbs. Tier 3 — deny only via blocklist.

来源

The heuristic can never silently deny. It can escalate a prompt, never issue a refusal.

来源

Every decision goes through recordDecision(), which keeps per-server counters of allowed / asked / denied.

来源

  • 记录日期: 2026-10-11T11:56:04.279Z