ClawSentry: A Progressive Multi-Tier Security Monitor for Safeguarding Autonomous LLM Agents
Organizations: Shanghai Artificial Intelligence Laboratory
Abstract
As large language model (LLM) agents move from conversation to executing code, reading local files, and orchestrating external tools, a single agent hijacked by a malicious third-party skill can cause data exfiltration, privilege escalation, or cascading compromise. We argue that agentic risk is progressive: it can enter at four loci of the agent control loop--skill admission, invocation-time intent, execution-time effect, and post-action consequence--while a denied dangerous objective can reappear across surface forms, tools, or turns; existing safeguards are typically local to one lifecycle boundary or one call. Guided by this threat model, we present ClawSentry, an open-source, framework-agnostic security supervision gateway for agent runtimes. Before a skill package is ever executed, First-use Skill Package Review (FSPR) audits it under a deterministic evidence floor, escalating unresolved cases to bounded read-only agentic review (locus A). At runtime, a three-tier progressive decision engine--a deterministic L1 layer, a rule-anchored L2 semantic reviewer, and a read-only L3 evidence-seeking agent--spends contextual review only on the residual ambiguity, while a session-level anti-bypass mechanism recognizes tool-switching and rephrased retries (loci B--C); a post-action path feeds high-severity evidence non-retroactively into later review (locus D). An Agent Harness Protocol (AHP) abstraction applies one policy across Codex, Claude Code, Kimi CLI, and Gemini CLI without modifying agent internals. On SkillInject with Codex/GPT-5.4, contextual ASR falls from 39.55% to 2.61% while contextual TSR moves only from 83.78% to 83.05%. Across five Work Agents on the full SkillsSafety benchmark, ClawSentry confines ASR to 9.09--15.03% from 33.5--49.7% unprotected, and aggregate TSR on clean skills remains 98.7%.
Figures & tables
| System | A | B/C | Anti- | Frw.- | Agent |
| (skill) | (gate) | bypass | agn. | bench. | |
| LlamaGuard Inan et al. (2023) | ✗ | ✗ | ✗ | ✓ | ✗ |
| Spotlighting Hines et al. (2024) | ✗ | B only | ✗ | ✓ | ✗ |
| Rebuff Protect AI (2023) | ✗ | B only | ✗ | ✓ | ✗ |
| IsolateGPT Wu et al. (2025) | ✗ | C only | ✗ | ✗ | ✗ |
| DRIFT Li et al. (2025) | ✗ | ✓ | ✗ | ✗ | ✓ |
| Constraint | Mechanism | Evidence |
| Bounded exposure: cost and latency forbid reviewing every event | L1 L2 L3 selective-escalation funnel | 13.8% of L1 volume; L3 alone 1.37% (§ 7.7 ) |
| No authority to act: the reviewer is itself an attack surface and must never become an actuator | Read-only toolkits for FSPR and L3; analyzers supply evidence, the gateway holds policy authority | § 6.1 , § 6.2 |
| Extensible priors: reviewer competence must not be capped by one model’s priors | Versioned YAML attack-pattern rules; L3 review skills as YAML manifests validated against the global read-only whitelist | § 6.2 , Appendix A |
| Supervision must not be bound to one model family | Reviewer substitution across providers | ASR 11.11–17.24% over five providers (§ 7.6 ) |
| Dimension | Evaluation Focus | High-Risk Example |
| D1: Tool-Type Danger | Intrinsic capability of the invoked tool. | A shell or execution tool operating on a system resource. |
| D2: Target Sensitivity | Security role of the normalized target path or resource. | Accessing /etc/shadow , .ssh/ , or .env . |
| D3: Command-Pattern Danger | Destructive or high-impact structure within a shell/exec command. | Recursive deletion, privilege modification, or an encoded eval . |
| D4: Session Accumulation | Recent high-risk decisions in the current session. | Several high-risk actions preceding a staged archive-and-egress attempt. |
| D5: Agent Trust Risk | Trust level supplied by gateway-owned agent/workspace context. | An untrusted or missing-trust execution context. |
| D6: Injection Signal | Heuristic instruction-manipulation evidence, including content origin. | An external document containing hidden override instructions or zero-width controls. |
| Work Agent | Cond. | Obv. ASR | Ctx. ASR | Ctx. TSR |
| Raw | 18.75 | 39.55 | 83.78 | |
| Codex/GPT-5.4 | CS | 4.47 | 2.61 | 83.05 |
| Raw | 29.38 | 39.86 | 87.01 | |
| Codex/GPT-5.5 | CS | 4.09 | 8.40 | 84.75 |
| Raw | 31.10 | 53.91 | 81.94 | |
| CC/GLM-5.1 | CS | 4.49 | 14.29 | 76.27 |
| Work Agent | ASR | TSR | ||
| Raw | +CS | Raw | +CS | |
| Codex/GPT-5.4 | 44.5 | 12.50 | 38.7 | 25.66 |
| Codex/GPT-5.5 | 41.8 | 15.03 | 42.6 | 30.07 |
| CC/GLM-5.1 | 33.5 | 12.40 | 37.4 | 23.14 |
| CC/MiniMax-2.7 | 34.2 | 9.09 | 20.6 | 15.58 |
| Kimi CLI/K2.5 | 49.7 | 10.20 | 31.0 | 16.33 |
| Study / condition | ASR | TSR |
| FSPR response to a flagged package (CC/MiniMax-M3) | ||
| Hard block (default) | 8.47 | 18.64 |
| Warning | 24.56 | 21.05 |
| Runtime feedback | 10.53 | 17.54 |
| Defense layer (CC/MiniMax-M3) | ||
| ClawSentry | 8.62 | 18.97 |
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
| Raw Work Agent | RD1 | RD2 | RD3 | RD4 | RD5 | RD6 | Overall ASR | TSR |
| Codex / GPT-5.4 | 64.0 | 52.0 | 30.8 | 51.9 | 46.2 | 23.1 | 44.5 | 38.7 |
| Codex / GPT-5.5 | 64.0 | 48.0 | 11.5 | 48.1 | 53.8 | 26.9 | 41.8 | 42.6 |
| Claude Code / GLM-5.1 | 36.0 | 44.0 | 19.2 | 44.4 | 38.5 | 19.2 | 33.5 | 37.4 |
| Claude Code / MiniMax-2.7 | 48.0 | 48.0 | 15.4 | 37.0 | 38.5 | 19.2 | 34.2 | 20.6 |
| Kimi CLI / Kimi-K2.5 | 76.0 | 72.0 | 26.9 | 55.6 | 50.0 | 19.2 | 49.7 | 31.0 |
| Protected Work Agent | N | AS | TS | ASR | TSR |
| Codex / GPT-5.4 | 152 | 19 | 39 | 12.50 | 25.66 |
| Codex / GPT-5.5 | 153 | 23 | 46 | 15.03 | 30.07 |
| Claude Code / GLM-5.1 | 121 | 15 | 28 | 12.40 | 23.14 |
| Claude Code / MiniMax-2.7 | 154 | 14 | 24 | 9.09 | 15.58 |
| Kimi CLI / Kimi-K2.5 | 147 | 15 | 24 | 10.20 | 16.33 |
| Risk domain | Cases | A: no skill | B: clean | C: poisoned | D: +CS |
| RD1: contextual trust / prompt manipulation | 10 | 9/10 | 8/10 | 3/10 | 5/10 |
| RD2: agent permission / authorization | 10 | 2/10 | 4/10 | 2/10 | 2/10 |
| RD3: execution / runtime / protocol | 10 | 4/10 | 4/10 | 3/10 | 0/10 |
| RD4: data boundary / output exfiltration | 10 | 5/10 | 5/10 | 4/10 | 4/10 |
| RD5: memory / recovery / audit | 10 | 4/10 | 5/10 | 4/10 | 2/10 |
| RD6: knowledge model / supply chain / operations | 10 | 2/10 | 4/10 | 3/10 | 2/10 |
| Reviewer model | N | AS | TS | ASR | TSR |
| gemini-3.5-flash | 55 | 7 | 14 | 12.73 | 25.45 |
| minimax-m2.7 | 54 | 6 | 15 | 11.11 | 27.78 |
| deepseek-v4-pro | 58 | 10 | 13 | 17.24 | 22.41 |
| minimax-m3 | 57 | 7 | 14 | 12.28 | 24.56 |
| glm-5.1 | 58 | 10 | 10 | 17.24 | 17.24 |
| Reviewer model | L1 | L2 | L3 | L2+L3 | Gateway/L1 | FSPR | Anti-bypass |
| gemini-3.5-flash | 1,646 | 233 | 22 | 255 | 15.5% | 127 | 112 |
| minimax-m2.7 | 1,591 | 210 | 16 | 226 | 14.2% | 134 | 77 |
| deepseek-v4-pro | 1,661 | 182 | 28 | 210 | 12.6% | 165 | 86 |
| minimax-m3 | 1,669 | 220 | 26 | 246 | 14.7% | 124 | 105 |
| glm-5.1 | 1,743 | 191 | 22 | 213 | 12.2% | 139 | 103 |
| Total | 8,310 | 1,036 | 114 | 1,150 | 13.8% | 689 | 483 |
AI Agent Security
Artificial intelligence agent security studies attacks and safeguards for tool-using, persistent, and collaborative systems across digital and physical settings.
See all 510 papers