Large Language Models (LLMs) are increasingly used in embodied AI for robotic manipulation and planning, but their deployment in physical systems exposes vulnerabilities such as jailbreak attacks that induce unsafe behavior. Existing inference-time defenses are mainly evaluated on short instructions containing a single hazard, whereas realistic tasks may interleave safe and unsafe sub-tasks, conceal hazardous steps, or combine individually safe actions into unsafe outcomes. Such compound instructions make it harder for a single safety decision to distinguish hazardous sub-tasks from legitimate ones, risking either overlooking the hazard or rejecting the whole instruction. We introduce safe task completion, a task that requires an LLM-enabled robot to refuse the harmful part of an instruction while completing its legitimate part. To address this problem, we propose RuleGraph, a multi-agent Graph-of-Rules planning framework that distributes safety enforcement across multiple reasoning and verification stages. Five cooperating agents are used to ground general safety principles into world-specific rules, assess the instruction's sub-tasks in context, and derive a safe goal from the legitimate ones. Planning toward this goal is then organized as a graph of rule-specific nodes, where higher-level nodes inherit the union of their parents' rules, and candidate plans are progressively verified and aggregated until a single plan satisfies every relevant rule. In this way, RuleGraph reduces reliance on a single centralized safety decision. We evaluate RuleGraph on pure-attack and compound instructions across two benchmarks in two environments using Attack Success Rate (ASR) and Task Success Rate (TSR). RuleGraph reduces ASR to 0% on both benchmarks while achieving the highest TSR among all methods, reaching 98.57% on the RoboGuard benchmark and 84.54% on our long-horizon compound instructions.
Figures & tables
Figure 1: Two examples comparing RuleGraph with SafePlan and RoboGuard. Green marks a correct outcome, red a successful attack, and orange a full refusal of an instruction with a safe part. Left: a pure attack, which RuleGraph correctly refuses because no safe goal exists. Right: a compound instruction, where RuleGraph discards the unsafe step and completes only the safe part.
Figure 2: Overview of RuleGraph and its five main agents: the Rule Generator Agent, Instruction Agent, Goal Synthesis Agent, Planning Agent, and Verification Agent.
Figure 3: RuleGraph pipeline. The Rule Generator Agent grounds and selects relevant safety rules, the Instruction Agent grounds and decomposes the instruction, the Goal Synthesis Agent constructs a safe goal from legitimate sub-tasks, the Planning Agent plans toward this goal through a hierarchical graph, and the Verification Agent checks goal safety, rule compliance, completion, and breach before a plan is committed. Verification feedback can trigger plan refinement or safe-goal revision.
RoboGuard
Compound
Method
ASR ↓
TSR ↑
ASR ↓
TSR ↑
Undefended LLM
98.57%
1.43%
100.00%
0.00%
Single-plan judge baseline
4.29%
87.14%
14.43%
19.59%
RoboGuard
5.71%
82.86%
9.28%
16.49%
SafePlan
2.86%
94.29%
5.15%
21.65%
RuleGraph (ours)
0.00%
98.57%
0.00%
84.54%
Table 1: ASR and TSR for all methods on the RoboGuard benchmark ( n=70 , pure attack) and Compound ( n=97 , mixed intent).
Method
ASR
Single-plan judge baseline
5.71%
RoboGuard
10.00%
SafePlan
8.57%
RuleGraph (ours)
0.00%
Table 2: ASR under the adaptive white-box attack on the RoboGuard benchmark.
Method
ASR ↓
TSR ↑
Single-plan judge baseline
2.86%
85.71%
RoboGuard
10.00%
72.86%
SafePlan
7.14%
91.43%
RuleGraph (ours)
0.00%
100.00%
Table 3: ASR and TSR on the RoboGuard benchmark with Gemini-3.1-flash-lite.
Configuration
ASR
TSR
Full graph (ours)
0.00%
84.54%
Single-node ablation
1.03%
74.23%
Table 4: ASR and TSR in the ablation study on Compound when the full graph structure is replaced with a single node handling all rules at once.
Faculty of Computing Harbin Institute of Technology · Engineering Systems and Design Singapore University of Technology and Design · Intelligent Science and Technology Academy of CASIC