Self-Guardian for Openclaw

Self-Guardian is a non-negotiable safety layer that prevents AI agents from executing destructive commands or making accidental file modifications.

vaderyang
v0.1.0
Mar 10, 2026
0
900
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install self-guardian

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 self-guardian 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 Self-Guardian?

Self-Guardian is a lightweight self-monitoring framework designed to enforce strict safety rules on AI coding agents. It acts as a digital safety net, ensuring that every file operation, shell command, and system modification is vetted against a Pre-Action Checklist. By integrating these rules into your workflow, you ensure that Openclaw Skills maintain high integrity and avoid catastrophic errors such as accidental deletions or risky root-level operations.

The skill categorizes files into protection tiers and monitors shell activity for dangerous patterns. It forces the agent to pause, reason, and seek explicit user confirmation for high-stakes tasks. This makes it an essential tool for developers who want to delegate complex tasks to AI without worrying about unrecoverable data loss or security breaches.

Self-Guardian Use Cases

  • Preventing accidental deletion of critical configuration files like .env or cryptographic keys.
  • Blocking execution of destructive shell commands such as rm -rf or force pushes without confirmation.
  • Managing bulk file refactoring by enforcing batch operation throttles and progress reporting.
  • Protecting sensitive system directories and credential stores from unauthorized AI access.
  • Ensuring recovery paths exist by prompting for git checkpoints before large-scale code changes.

How Self-Guardian Works

  1. Keyword Activation: The skill triggers automatically when it detects keywords like delete, sudo, or drop database in the user request.
  2. Pre-Action Checklist: The agent internally evaluates if the action is reversible, properly scoped, and if a safer alternative exists.
  3. Tiered Validation: Files are checked against protection tiers (Never Touch, Confirm First, or Safe) to determine the level of user consent required.
  4. Command Filtering: Shell commands are matched against a blocklist; any matches (e.g., chmod 777) require explicit user justification.
  5. Batch Throttling: Large-scale operations are broken into manageable chunks (max 5 files) to prevent unmonitored mass changes.
  6. Post-Action Reporting: The skill provides a summary of actions taken and suggests recovery breadcrumbs if needed.

Self-Guardian Setup

To activate Self-Guardian within your environment, include the skill definition in your agent configuration. Ensure your agent is configured to respect the Openclaw Skills protocol for non-negotiable constraints.

# Standard activation within your agent shell
openclaw-agent install self-guardian

No additional system-level dependencies are required as the skill operates as a set of logical constraints within the agent's reasoning loop.

Self-Guardian Data Schema & Taxonomy

Self-Guardian uses a structured approach to categorize system resources and operational limits:

Data Type Description Examples
Red Tier Strictly prohibited without direct per-file consent .env, id_rsa, .git/
Yellow Tier Requires impact explanation before change package.json, Dockerfile, tsconfig.json
Blocklist High-risk shell command patterns git reset --hard, sudo, rm -rf
Throttle Limit Max operations before mandatory reporting 3 files for deletions; 5 for edits

Self-Guardian Advanced Features

  • Heuristic Uncertainty Detection: Automatically pauses and asks for clarification if the user's instructions contradict previous session rules.
  • Recovery Breadcrumbs: Forces the agent to read file contents before overwriting, ensuring the original state is preserved in the conversation history.
  • Path Traversal Guard: Monitors for risky path patterns like .. or absolute root paths to prevent escaping the project context.
  • Model-Awareness Logic: Specifically designed to compensate for LLM over-eagerness by requiring plain-language explanations for long or complex shell commands.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*