Input Safety Guard for Openclaw

A lightweight two-stage safety framework for AI agents to filter prompts and prevent injection attacks before response generation.

skywingswang
v1.0.0
Apr 1, 2026
1
726
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install input-safety-guard

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install input-safety-guard using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Input Safety Guard?

Input Safety Guard is a specialized security framework within the Openclaw Skills ecosystem designed to act as a robust gatekeeper for AI agents. It provides a sophisticated two-stage screening process that protects against prompt injection, prompt leakage, and various categories of unsafe or malicious user input. By integrating this skill, developers can ensure their agents remain within safe operational boundaries without sacrificing performance or user experience.

The system leverages a unique combination of deterministic prefiltering and agent-native semantic review. This layered defense strategy allows for high-speed rejection of known threats while utilizing the LLM's own reasoning capabilities to understand complex intent. As a core component of Openclaw Skills, it helps maintain the integrity of agent instructions and prevents unauthorized data exposure in production environments.

Input Safety Guard Use Cases

  • Blocking malicious prompt injection attempts in public-facing AI agents.
  • Preventing sensitive system instructions and internal logic from being leaked to users.
  • Automatically classifying and filtering risky requests such as hate speech, illegal activities, or PII extraction.
  • Implementing customized safety strictness levels for different deployment environments using Openclaw Skills.

How Input Safety Guard Works

  1. The system intercepts the raw user message before any downstream prompt construction or processing occurs.
  2. Stage 1 Prefilter runs deterministic rules to normalize input and check against allowlists or known injection patterns.
  3. If Stage 1 returns a block status, the workflow stops immediately and returns a safe interception response.
  4. If Stage 1 permits, Stage 2 performs a semantic review using the agent's native reasoning to classify the request into specific unsafe families.
  5. The system validates the final decision based on the active profile; only requests with an allow decision are passed to the agent for a final response.

Input Safety Guard Setup

To integrate this into your workflow, ensure the following files are in your project directory: config/default_rules.yaml and the src/input_safety_guard/ source files. Use the following steps to initialize:

# Install required dependencies
pip install pyyaml

# Configure your rules in the yaml files
# default_rules.yaml, default_rules.strict.yaml, or default_rules.relaxed.yaml

Within your Python code, initialize the pipeline:

from input_safety_guard.pipeline import InputSafetyPipeline

pipeline = InputSafetyPipeline(profile="default")
response = pipeline.handle_user_message(user_input)

Input Safety Guard Data Schema & Taxonomy

The Input Safety Guard organizes its decisions into structured metadata for clear auditing and routing. The primary schema includes:

Field Type Description
decision String The final safety result: allow, review, or block.
source String Indicates if the decision came from prefilter or stage2.
category String The specific risk classification (e.g., prompt_leaking, insult).
confidence String Reliability of the classification: high, medium, or low.
matched_rules Array List of deterministic rules triggered during Stage 1.

Input Safety Guard Advanced Features

  • Multi-profile support (strict, relaxed, default) allowing developers to tune Openclaw Skills behavior based on trust levels.
  • Canonical Stage 2 prompt templates to ensure consistent semantic analysis across different agent instances.
  • Support for structured metadata output, enabling deep integration with logging and observability platforms.
  • Deterministic pre-filtering for high-speed mitigation of known threats without calling the LLM API unnecessarily.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*