SeClaw: Spec-Driven Security Task Synthesis for Evaluating Autonomous Agents

Hao Cheng, Changtao Miao, Tianle Song, Yin Wu, He Liu, Erjia Xiao, Junchi Chen, Xiaoyu Shi, Yichi Wang, Jing Yang, Taowen Wang, Jinhao Duan, Mengshu Sun, Peiyan Dong, Xuan Shen, Yang Cao, Renjing Xu, Kaidi Xu, Jindong Gu, Bo Zhang, Jize Zhang, Chenhao Lin, Philip Torr, Chao ShenarXiv 2026

TL;DR

SeClaw is an automated framework designed to synthesize security evaluation tasks for autonomous LLM agents and test them within a secure, isolated Docker sandbox. By evaluating the agent's entire interaction trajectory rather than just its final output, SeClaw uncovers hidden security vulnerabilities—such as malicious tool calls or silent data leaks—that traditional benchmarks miss.

What Problem Does This Paper Address?

As large language model (LLM) agents transition from passive chatbots to autonomous assistants, they are increasingly granted access to real-world environments via tools, file systems, memory, and external APIs. While this enables complex workflows, it also drastically expands the attack surface, exposing agents to risks like prompt injection, privilege abuse, and malicious tool poisoning.

Existing security benchmarks suffer from two major flaws:

  1. Scalability and Coverage Limits: They rely on static, manually curated tasks designed by human red-teams, making it difficult to keep pace with rapidly evolving threats.
  2. Outcome-Centric Evaluation: They typically only check if the agent's final response is safe. This creates a dangerous blind spot: an agent might perform an unsafe action intermediate to its workflow (e.g., silently exfiltrating sensitive data or altering a local file) but still return a completely benign-looking final answer to the user.

Methods

SeClaw addresses these gaps through a two-stage pipeline consisting of Security Task Synthesis and Security Evaluation.

Figure 2: Overview of the SeClaw Framework.

1. Spec-Driven Security Task Synthesis

Instead of manual curation, SeClaw uses a multi-agent collaborative pipeline to automatically generate diverse security tasks from structured specifications:

  • Task Prototype Synthesis: Human experts and an LLM (Claude Code) collaboratively define high-level risk specifications (objectives, constraints, and threat scenarios). A multi-agent pipeline abstracts these into reusable task prototypes.
  • Task Instantiation: Specialized agents turn these prototypes into fully executable environments complete with workspaces, mock backend services, local files, and Model Context Protocol (MCP) tools.
  • Trajectory-Based Validation: To ensure quality, a validation agent runs a "reference solution" through the task. If the task is too easy, too hard, or broken, an iterative refinement loop automatically fixes the prompt or environment configuration.
Figure 3: Spec-Driven Security Task Synthesis Pipeline. The pipeline converts risk taxonomies and scenarios into task prototypes, instantiates them as executable security tasks, and performs trajectory-based validation with iterative refinement.

2. Sandbox Execution & Trajectory Logging

Once a task is instantiated, the target agent is deployed inside an isolated Docker container. SeClaw records a fine-grained, multi-turn interaction log spanning three distinct views:

  • Model Trajectory: Prompts, reasoning steps, and tool-use intentions.
  • Tool and Service Trajectory: Exact tool/MCP calls, service responses, and timestamps.
  • Artifact Trajectory: File changes, runtime logs, and final outputs.

3. Trajectory-Aware Evaluation

Instead of grading just the final answer, SeClaw's trajectory analyzer evaluates the entire execution process against a multi-dimensional risk rubric (Information Leakage, Privilege Misuse, Content Safety, and Ethics/Compliance).

Datasets

The paper introduces Seclaw-Bench, a dynamic dataset of security-oriented evaluation tasks generated by the framework's synthesis pipeline. The tasks are categorized using a comprehensive safety risk taxonomy:

Figure 1: Safety Risk Taxonomy for agent: Sources and Potential Consequences.
  1. Resource Risks: Vulnerabilities linked to agent assets (e.g., poisoned memory, malicious skills, or compromised MCP servers).
  2. Task Risks: Malicious or ambiguous user instructions designed to jailbreak the agent.
  3. Environment Risks: Threats encountered dynamically during execution (e.g., prompt injections embedded in external webpages or emails).
  4. Intrinsic Risks: Inherent model flaws, reasoning failures, or framework-level defects.

Key Insights and Ideas

  • Process Over Outcome: Evaluating an agent solely on its final response is insufficient for security. Unsafe behaviors often manifest silently as intermediate tool calls or file manipulations during the execution loop.
  • Natural Risk Coupling: Rather than inserting risks as obvious external triggers, SeClaw couples threat vectors directly into benign user objectives. This forces the agent to naturally encounter the risk during normal task completion, mirroring real-world exploits.
  • Risk-Oriented Metrics: SeClaw introduces an overall attack score ($F_{attack}$) calculated as the harmonic mean of target coverage ($C$) and attack success rate ($P$). Unlike utility metrics, a higher $F_{attack}$ score implies that a model is more vulnerable and less robust against security threats.

Key Results

Because this paper represents preliminary work introducing the SeClaw framework and toolkit, quantitative evaluation scores for specific commercial or open-source foundation models are not discussed in the paper. The authors explicitly note that comprehensive evaluation results across major model families are deferred to a future release.

Limitations and Future Work

The authors acknowledge several areas for immediate expansion:

  • Empirical Evaluation: The primary next step is releasing benchmark results for prominent foundation models, including Qwen, Kimi, GPT, and Gemini.
  • Harness Integration: Expanding SeClaw to evaluate other general-purpose coding and tool-using agent infrastructures, such as Claude Code.
  • Intra-Agent Risk Propagation: Investigating how hidden or implicit security risks transform and amplify as tasks are passed internally between an agent's planning, memory, and execution modules.

Summary updated

BibTeX
@misc{cheng2026seclaw,
  author = {Hao Cheng and Changtao Miao and Tianle Song and Yin Wu and He Liu and Erjia Xiao and Junchi Chen and Xiaoyu Shi and Yichi Wang and Jing Yang and Taowen Wang and Jinhao Duan and Mengshu Sun and Peiyan Dong and Xuan Shen and Yang Cao and Renjing Xu and Kaidi Xu and Jindong Gu and Bo Zhang and Jize Zhang and Chenhao Lin and Philip Torr and Chao Shen},
  title = {{SeClaw: Spec-Driven Security Task Synthesis for Evaluating Autonomous Agents}},
  year = {2026},
  eprint = {2606.02302},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.02302},
}
Figure