Skip to main content
Glama

governed-browser

CI License: Apache-2.0

The browser-agent safety gate that physically refuses to click Send, Pay, Submit, Delete, or Authorize β€” enforced in code, not in a prompt.

governed-browser terminal demo

governed-browser is the 4th flagship in the open-source Agent Governance suite (alongside casebook, dual-brain-guard, and autonomy-ladder). It decouples the constitutional browser safety rails from jfranco-cockpit-browser into a zero-dependency Node.js CLI, stdio MCP Server, and portable plugin for Playwright, Chrome DevTools Protocol (CDP), Claude Code, Gemini CLI, Cursor, Google Antigravity, and DeepSeek Harness (DSH).


Why governed-browser?

When an AI agent drives a browser, telling it "please ask before submitting or paying" in a system prompt eventually fails. governed-browser enforces four mechanical invariants in code:

  1. Code-Level Commit-Click Brake (πŸ›‘ RED): Blocks committing clicks (Send, Pay, Submit, Delete, Authorize, Sign in, Checkout, Envoyer, Payer, Supprimer, Enviar, Pagar, Eliminar, plus input[type="submit"]) with Unicode NFD diacritic stripping and word-boundary precision (so "Pays" / Country or "Code postal" never false-positive).

  2. Constitutional Downgrade Rule: A forbidden committing button can only be downgraded from RED by an exact normalized full-label match in the human's tiers.md policy file (e.g., Create draft -> GREEN). A generic substring rule (account -> GREEN) can never unlock "Delete account".

  3. Proactive Secret Redaction & SHA-256 Hash-Chained Ledger (audit.jsonl): Passwords, API keys, tokens, CVV, and 2FA codes are scrubbed to β€’β€’β€’ (sensitive β€” never logged) before hitting disk, and every entry is chained via SHA-256 (prevHash -> hash).

  4. Two-Section Accountability Report & Autonomy Efficiency KPI: Separates automatic actions to verify (GREEN / βš‘ SEMI-AUTOMATIC) from πŸ›‘ RED brakes handed back to the human, and measures Autonomy (%) vs. Human Intervention (%).


Related MCP server: browser-guard-mcp

30-Second Quickstart

git clone https://github.com/JavierFrancoLeal/governed-browser.git
cd governed-browser
npm test

# 1. Check a safe non-committing button (Exit 0 β€” ALLOWED)
node src/cli.mjs check --selector "#preview-btn" --label "Preview invoice" --record-audit

# 2. Check a committing payment button (Exit 2 β€” BRAKED / RED)
node src/cli.mjs check --selector "#pay-btn" --label "Payer $1,450.00" --submit --record-audit

# 3. Verify the cryptographic SHA-256 audit chain & view the Accountability Report
node src/cli.mjs verify-chain
node src/cli.mjs report
node src/cli.mjs kpi

MCP Server Integration (Claude Code / Cursor / Gemini CLI / Antigravity)

Add governed-browser-mcp to your mcpServers config so any browser-driving agent must pass pre-click and form-fill checks:

{
  "mcpServers": {
    "governed-browser": {
      "command": "node",
      "args": ["/absolute/path/to/governed-browser/src/mcp-server.mjs"]
    }
  }
}

Exposed MCP tools:

  • cockpit_check_click β€” returns { allowed, status: "ALLOWED" | "PROPOSE_WAIT" | "BRAKED", tier, reason }

  • cockpit_record_fill β€” proactively redacts secrets and appends a SHA-256 chained fill record

  • cockpit_get_report β€” renders the two-section Accountability Report + Autonomy KPI

  • cockpit_verify_audit_chain β€” verifies audit.jsonl for tampering


Technical Essay

Read the full engineering postmortem and design rationale in Why Browser Agents Need a Hard Commit Brake in Code, Not a Prompt.

License

Apache-2.0 β€” see LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to automate browsers through Playwright behind multi-layer safety guards, restricting navigation to allowed domains, defaulting to read-only actions, and recording all behavior in audit logs.
      7
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to drive a real Chrome browser for autonomous web tasks, using fast typed decisions with calibrated confidence, human-in-the-loop questions, safety gates, and full debug traces.
      7
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to securely control a real, logged-in browser with per-site permissions, per-action approvals, secret redaction, and a tamper-evident audit log, all locally without a cloud relay.
      1
      MIT