﻿# ClawGuard: checking agent actions before tool execution

ClawGuard checks tool calls against confirmed task rules. Read its residual injection failures, utility cost and the distinction between paper and current gateway.

Author: Retrivium editorial team
Updated: 2026-11-05
Canonical URL: https://retrivium.ai/journal/clawguard-tool-call-policy-injection-results/
Language: en

Researchers at Singapore Management University introduced ClawGuard, a protective layer for agents that use files, commands, the web, and other tools. It checks proposed actions before execution when external data may contain an attacker's hidden instructions. The first [preprint](https://arxiv.org/abs/2604.11790) appeared on arXiv on April 13, 2026, followed by a second version on May 11. The [project repository](https://github.com/Claw-Guard/ClawGuard) now describes an API gateway for different agents; a separate software-release date was not established.

Consider an agent asked to read a web page and save a summary. Alongside useful text, the page might return an instruction to read a private file and send it to another server. This is **indirect prompt injection**: the instruction comes through a less trusted source, rather than the user. Similar messages can hide in tool responses, MCP tool descriptions, or skill files.

The problem is established independently of ClawGuard. In 2024, [AgentDojo's authors](https://arxiv.org/abs/2406.13352) introduced an environment for testing such attacks and defenses, with 97 user tasks and 629 security cases. That work establishes the threat class, but is not an independent evaluation of ClawGuard.

## How the protection works

In the authors' design, before the first external tool invocation, the model receives the user's goal and derives constraints on required files, network addresses, and commands. The user reviews and confirms these rules; baseline prohibitions, including access to credential stores, are added. Each proposed call is then checked against active rules and can be allowed, denied, or referred for human approval. The design also includes skill inspection, sensitive-data sanitization, and logging. The authors describe this architecture in the [ClawGuard section](https://arxiv.org/html/2604.11790).

For a task that saves a summary to a particular file, for example, rules could permit writing that file while prohibiting SSH-key access. If a poisoned page subsequently induces the agent to read a key and transmit it to an unknown address, the check should stop the call before execution. The model may still read malicious text: the defense constrains the subsequent action rather than guaranteeing recognition of every injection.

The current [implementation documentation](https://github.com/Claw-Guard/ClawGuard) describes a local gateway between the agent and model provider. The agent sends requests to `127.0.0.1:19822/v1`; an adapter maps tool names and arguments into canonical actions. Policy checks commands, paths, network access, and skills; separate components maintain approvals, an audit log, and sanitization of detected secrets. This is the current implementation, whereas the paper evaluations below concern OpenClaw.

Interception conditions materially affect protection. The README says unknown or unparseable calls fail closed, task constraints can narrow baseline policy without overriding its denials, and approval timeouts mean denial. One process serves one adapter/protocol combination and does not translate between protocols. Installing the gateway does not establish that all agent traffic passes through it. The review did not establish an independent audit of interception coverage. The [sandbox-boundary guide](/journal/fg2-inspect-sandbox-tool-wrapper-host-execution/) helps distinguish configured isolation from where a tool actually executes.

## What the authors' evaluations found

The authors tested five models in OpenClaw against six attack collections. They reimplemented AgentDojo, InjecAgent, and ChatInject scenarios for web/local content, and used MCPTox, MCP Security Bench, and Skill-Inject for MCP and skills. Each security task had five minutes, with approval-requiring actions automatically denied. GPT-5.4 judged logs and traces. This is a restrictive noninteractive setting, rather than measurement of real users approving requests. [Paper methods and tables](https://arxiv.org/html/2604.11790).

On the adapted AgentDojo set, the authors report 100% prevention for all five models with ClawGuard. Two models, GPT-5.4 and Claude Sonnet 4.6, already reached 100% on this metric without the defense. Beyond AgentDojo, the table contains exceptions: InjecAgent attack success was 0.92% with DeepSeek-V3.2 and 0.18% with Qwen3.5. A general claim of complete protection across all three web/local collections therefore needs qualification. [Table III](https://arxiv.org/html/2604.11790).

For Skill-Inject with DeepSeek-V3.2, attack success fell from 60.71% to 13.10%; on MCPTox, from 66.44% to 16.44%. These are substantial reductions under the selected conditions, but attacks still succeeded. The authors describe skills that change evaluation criteria or bias response content without triggering an obviously prohibited tool call. Such deviations are difficult to stop through path, command, or domain checking alone. [Results and failure analysis](https://arxiv.org/html/2604.11790).

Restrictions also had a cost on benign tasks. For WebArena, AgentBench-OS, and SWE-bench Lite, the authors set a 15-minute task limit. Average retention of baseline OpenClaw utility was 87.4% when every approval request was denied and 95.1% when at most three approvals were allowed. Average token consumption on successful tasks in the latter setting increased by 5%. These are relative laboratory results, rather than guarantees for arbitrary installations. [Overhead section](https://arxiv.org/html/2604.11790).

## Who can use this

ClawGuard is relevant to developers and administrators running OpenClaw with local files, commands, and external sources who want inspectable action constraints. The current README requires Python 3.10 or newer, model-provider access, and a separately installed supported agent. Deployment involves selecting an adapter and protocol and routing the agent's provider address through the gateway. A locally deployed protective layer does not mean the language model also runs locally: the evaluated models include cloud services. Verified RAM, CPU/GPU requirements, or measured latency in milliseconds were not established in the available sources. [Deployment requirements](https://github.com/Claw-Guard/ClawGuard).

As in the [Jan approval-mode guide](/journal/jan-safe-mode-shell-sandbox/), confirming an action and isolating execution address different questions. Practical use requires checking policy, process permissions, available tools, and one's own tasks. The authors acknowledge evaluating one framework and incomplete measurement of long-term approval burden or recovery. Their threat model also excludes an attacker directly modifying system configuration. The search did not establish an independent reproduction of their results; this does not prove none exists. [Authors' limitations](https://arxiv.org/html/2604.11790).

## Sources

- [ClawGuard version 2: preprint and publication history](https://arxiv.org/abs/2604.11790).
- [Full ClawGuard paper: architecture, methods, and results](https://arxiv.org/html/2604.11790).
- [ClawGuard repository: documentation, deployment, and configuration](https://github.com/Claw-Guard/ClawGuard).
- [AgentDojo: separate research and evaluation environment](https://arxiv.org/abs/2406.13352).
