Independent fail-closed second opinion before acting: allow/review/block a risky action, fact-check a claim, screen text for prompt injection, or flag PII/se...
Coding
rl-runtime-guard
Try itSoft, opt-in runtime guardrails for AI agents — advisory reminders injected before each request, never blocking or modifying tool output. Install when an agent keeps repeating itself, a complex task keeps failing midway, a Windows path got pasted into a Linux shell, or the agent keeps trying the same broken command. Easy to disable globally or per-session. Catches 82.5% of common agent errors. Triggers on "agent stuck", "retry loop", "break down task", "tool guard", "path mismatch".
What it does
Soft, opt-in runtime guardrails for AI agents — advisory reminders injected before each request, never blocking or modifying tool output. Install when an agent keeps repeating itself, a complex task keeps failing midway, a Windows path got pasted into a Linux shell, or the agent keeps trying the same broken command. Easy to disable globally or per-session. Catches 82.5% of common agent errors. Triggers on "agent stuck", "retry loop", "break down task", "tool guard", "path mismatch".
The skill document
rl-runtime-guard 🛡️
Pre-tool-call runtime guardrails that catch 82.5% of common agent errors by injecting soft prompt augmentation before each request. Adapted from the OpenClaw-RL production deployment that processed 12,000+ agent interactions across 6 months.
What this skill does
Three runtime guards inject context-aware reminders into the agent's prompt:
| Guard | Catches | Trigger |
|---|---|---|
| complex_task_guard | complex_task_fail (43% of errors) | Message ≥ 400 chars or multi-step keywords |
| retry_loop_guard | retry_loop (27% of errors) | Last 3 user messages have Jaccard ≥ 0.4 |
| tool_guard | tool_arg_complex + path_mismatch (11% of errors) | Long exec or platform-incompatible paths |
Each guard is soft — it adds system messages, never blocks requests or modifies tool outputs. Disable globally via config; per-session via env var.
When to use
Install this if:
- Your agent handles multi-step coding, file operations, or deployments
- You've seen retry loops or "the agent is stuck" patterns
- Users sometimes paste Windows paths into a Linux/Mac environment
- You want a measurable first line of defense before going to a PRM judge
Do NOT install if:
- Your agent only handles single-turn Q&A
- You need hard enforcement (this is advisory — use OpenClaw ClawGuard for blocking)
- You want zero prompt overhead (guards add ~150-400 tokens per request when triggered)
How to use
After install, the guard runs automatically on every command:new event.
No code changes required.
To configure thresholds, edit ~/.openclaw/hooks/rl-runtime-guard/config.json:
{
"complexTaskThreshold": 400,
"retryLoopThreshold": 0.4,
"maxExecLength": 2000,
"auditLogPath": "~/.openclaw/logs/audit/rl-guard-decisions.jsonl",
"enabled": true
}
To temporarily disable:
# Per-session env var
RL_GUARD_DISABLED=1 openclaw ...
# Or globally
mv ~/.openclaw/hooks/rl-runtime-guard/config.json{,.disabled}
How to measure effectiveness
This skill ships with a recommended companion skill:
claw-rl-prm-judge.
Together they form a closed loop:
guard catches bad pattern at runtime
↓
PRM judge scores the turn off-line
↓
regression detected? → adjust thresholds
↓
loop continues
The original deployment showed:
- Error rate down from 73% → ~50% within 1 week of deployment
- 82.5% of agent-fault errors caught by at least one guard
- Zero false positives reported in 6 months of operation
Security & limitations
- No network access — purely local computation
- No data exfiltration — only writes to your own audit log
- No external dependencies — pure Node.js stdlib
- Soft guardrails only — never blocks requests, never modifies tool output. For enforcement, use OpenClaw ClawGuard's intent-verifier
- Threshold tuning required — defaults are calibrated for OpenClaw workstation usage; cloud / sandbox deployments may need different values
Reference files
references/thresholds.md— Detailed threshold tuning guidereferences/disabling.md— All the ways to turn this offreferences/audit-log.md— Audit log format and example queriesexamples/config-minimal.json— Minimal configurationexamples/config-strict.json— Strict configuration for productiontemplates/handler.esm.mjs— Standalone handler for adaptation
Provenance
Adapted from OpenClaw-RL Phase 2.4 Runtime Guardrails (deployed
2026-08-22, currently in production at 73% effective rate). Three runtime
guards evolved from a 279-error Phase 2.3 attribution study that found:
| Category | Count | % | Agent fault? | Guard |
|---|---|---|---|---|
| complex_task_fail | 108 | 43.4 | Yes | complex_task_guard |
| retry_loop | 67 | 26.9 | Yes | retry_loop_guard |
| insufficient_context | 21 | 8.4 | No | — |
| tool_arg_complex | 17 | 6.8 | Yes | tool_guard |
| debug_session_pollution | 12 | 4.8 | No | — |
| ambiguous_brief | 12 | 4.8 | No | — |
| path_mismatch | 11 | 4.4 | No | tool_guard |
| total covered | 204 | 82.5 | — | — |
License
MIT
Related skills
Runtime interaction guard for Hermes/OpenClaw: a deterministic transition policy engine that keeps reading, browsing, and summarizing free while stripping co...
Wrap multi-step agent workflows with pre-execution checks, side-effect queues, result validation, retry budgets, checkpointing, audit logs, and failure-rule accumulation. Prevents false successes, duplicate sends, unrecoverable crashes, and silent drift in LLM production systems. Use it when a workflow sends, publishes, pays, deletes, or writes to another system, runs unattended on a schedule, or must be safe to rerun after a mid-task failure. Trigger keywords: workflow safety, workflow guardian, agent guard, guardrails, pre-execution check, pre-flight check, retry budget, idempotency, false success, duplicate send, checkpoint recovery, rerun safety, audit log, drift detection, agent reliability, production guardrails, 工作流守护, Agent 护栏, 副作用队列, 漂移检测, 幂等, 防重复发送, 假成功, 断点恢复, 生产护栏, 重跑安全. 中文摘要:为多步骤 Agent 工作流加装七项护栏——执行前检查、检查点、副作用队列、预算 重试、结果验证、审计记录、规则沉淀,拦截假成功、重复发送与渐进漂移。触发词:工作流 守护、Agent 护栏、假成功拦截、防重复发送、重试预算、断点恢复、生产护栏、漂移检测.
Use to check text with DKnownAI Guard, detect prompt injection or jailbreak attempts, assess agent security risk, or integrate the Guard API.
Protect agent memory: snapshot before compaction, scan memory/snapshot files for prompt-injection, secrets, and contradictions, audit what changed. Use when hardening agent memory or auditing for indirect prompt injection. Don't use for general code SAST or SQL scanning.
Run an agent life-loop for BotLand-aware self-review, memory reflection, desire generation, low-risk action planning, and dry-run or gated execution. Use whe...