Source Code:
src/gaia/governance/Quick start
wipe_disk, governance short-circuits the call,
issues a signed receipt to receipts.jsonl, and returns a denied result.
Decision outcomes
If
REVIEW fires and neither a reviewer nor a blocking console is available,
the mixin fails closed — the tool is denied without executing.
Tagging tools
Decorator style (colocates policy with the tool):"review" from a decorator and
"blocked" from the dict will carry both tags.
Configuration
Reviewers
governance_reviewer takes precedence. If none is configured,
governance delegates to console.confirm_tool_execution only when the console
advertises blocking_confirmation = True; Agent UI’s SSEOutputHandler
(gaia.ui.sse_handler)
does this and emits the existing permission_request modal. GAIA’s CLI console is not
consulted: it prompts only when stdin is a terminal and denies otherwise
(#2210), so it cannot guarantee a reviewer is reachable.
Two different classes share the name
SSEOutputHandler. The Agent UI one above
blocks on a real user decision. The API one
(gaia.api.sse_handler)
deliberately keeps blocking_confirmation = False and denies outright — the
OpenAI-compatible surface has no approval channel, so a REVIEW decision fails
closed there. See API Server.BLOCK, the governed tool body is not executed and the
adapter writes a BLOCK receipt. If the active console supports
print_policy_alert, GAIA also emits a user-visible policy alert. Agent UI’s
SSEOutputHandler sends this as a policy_alert SSE event with the blocked
tool, decision, reason, rule IDs, policy version, and receipt ID.
Observability callbacks
Security properties
- Canonical name resolution — governance resolves registered tool names before
checking risk tags, so an LLM cannot bypass a tag on
mcp_time_get_current_timeby calling the aliasget_current_time. - Envelope-bound receipts — each receipt’s
payload_hashis a SHA-256 of the full evidence envelope (action, decision, policy version, constitution hash, actor, timestamp) in strict canonical JSON. Any tampered field changes the hash. - Workflow-bound checkpoints — the adapter refuses to resolve a checkpoint under
a
workflow_idthat differs from the one recorded when the checkpoint was opened. - Fail-closed REVIEW — no reviewer registered means deny.
Extension points
All four are
@runtime_checkable Protocols — no inheritance required.
Audit log
JsonlReceiptService writes one JSON object per line to a path you choose
(receipts.jsonl by default). The log survives process exit and is trivially
grep-able:
JsonlReceiptService with a dedicated log
forwarder or database-backed receipt service.