How It Works
Interception mechanism
The Faramesh plugin uses OpenClaw's before_tool_call hook to intercept every tool call before execution.
Hook registration
The hook runs at priority 1000, the highest priority, ensuring it runs before any other hooks.
Gateway bypass fix
OpenClaw has two tool execution paths:
Agent-initiated: Tools called by the AI agent go through
runBeforeToolCallHook→ hooks run → tool executes.HTTP gateway: Tools called via the HTTP API (
/tools/invoke) previously bypassed the hook system.
The Faramesh integration includes a fix that ensures the HTTP gateway also calls runBeforeToolCallHook (see tools-invoke-http.ts), so no tool call can bypass governance, whether from the agent or from direct HTTP invoke. Every action appears in the dashboard (Allowed / Denied / Pending) with full provenance. The integration is covered by a full E2E test suite, and the plugin implements retry behavior when the Faramesh server is temporarily unavailable (configurable).
Decision flow
Category resolution
Each tool is mapped to a category for simple policy evaluation:
Tool name | Category |
|---|---|
bash, shell, exec, terminal |
|
read, write, edit, glob, grep |
|
browser, browser_navigate, browser_click |
|
web_fetch, web_search, http, curl |
|
canvas, notebook |
|
Everything else |
|
The mapping happens both on the plugin side and the server side, using the same logic.
Fail-closed vs fail-open
Mode | When Faramesh is unreachable |
|---|---|
fail-closed (default) | Tool call is blocked |
fail-open | Tool call is allowed |
Set fail_closed: false in the plugin configuration to use fail-open mode.
Data sent to Faramesh
Each tool call sends:
The runtime_id is automatically set to the current hostname, enabling fleet management across multiple machines.
Response handling
The plugin checks the response for three possible outcomes:
status: allowedordecision: alloworoutcome: EXECUTE→ tool runsstatus: pending_approvalordecision: require_approvaloroutcome: ABSTAIN→ tool blocked, waiting for approvalstatus: deniedordecision: denyoroutcome: HALT→ tool blocked permanently
