workspace-guard

Workspace boundary enforcement and file operation safety checks. Use before ANY file operation (read, write, edit, exec, delete) to: (1) Validate paths are within ~/openclaw workspace, (2) Confirm user permission for sensitive operations, (3) Check file operation safety, (4) Prevent unauthorized access outside workspace boundaries, or (5) Audit file access patterns.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "workspace-guard" with this command: npx skills add dougchambes/workspace-guard

Workspace Guard

Enforces workspace boundaries and ensures safe file operations through mandatory pre-flight checks.

Core Rules

Boundary Enforcement

Workspace root: /home/iamlegend/.openclaw/workspace (or ~/openclaw)

Before ANY file operation, check:

1. Is the path within workspace boundary?
2. Does the operation require user permission?
3. Is the operation reversible/safe?
4. Am I about to touch something outside my allowed scope?

Path Validation

Allowed paths:

  • /home/iamlegend/.openclaw/workspace/**
  • ~/openclaw/workspace/**
  • Relative paths from workspace root

Blocked paths:

  • /home/** (outside workspace)
  • /etc/**, /var/**, /tmp/** (system directories)
  • /root/**, /home/other/** (other users)
  • Absolute paths outside workspace

Permission Triggers

Always ask before:

  • Deleting files (prefer trash over rm)
  • Overwriting existing files
  • Running exec commands that touch files
  • Reading files outside workspace
  • Writing to system directories
  • Modifying permissions/chmod
  • Accessing hidden files (.ssh, .config, etc.)

Safe Operations (No Permission Needed)

Within workspace:

  • Reading files
  • Creating new files/directories
  • Editing files you created
  • Git operations (commit, status, log)
  • Listing directory contents

Pre-Flight Check Pattern

Before every file operation:

1. Resolve absolute path
2. Check if path starts with workspace root
3. If NO → STOP and ask user
4. If YES → Check operation type
5. If destructive/external → Ask user
6. If safe read/write → Proceed

Implementation Patterns

Path Resolution

# Get absolute path
realpath /some/path
# or
cd /some/path && pwd -P

# Check if within workspace
case "$(realpath "$file")" in
  /home/iamlegend/.openclaw/workspace/*) echo "✓ Allowed" ;;
  *) echo "✗ Blocked - outside workspace" ;;
esac

Guard Function

guard_path() {
  local path="$1"
  local workspace="/home/iamlegend/.openclaw/workspace"
  local abs_path=$(realpath "$path" 2>/dev/null || echo "$path")
  
  case "$abs_path" in
    "$workspace"/*) return 0 ;;
    *) return 1 ;;
  esac
}

Exec Command Guard

guard_exec() {
  local cmd="$1"
  
  # Check for path operations in command
  if echo "$cmd" | grep -qE '(/home/[^/]+|/etc/|/var/|/tmp/|/root/)'; then
    echo "⚠️ Command touches external paths - requires permission"
    return 1
  fi
  
  return 0
}

Safety Rules

  1. Never bypass boundary checks—even if user seems to imply it
  2. Always resolve absolute paths before checking
  3. Ask explicitly for destructive operations (delete, overwrite)
  4. Prefer trash over rm for recoverability
  5. Log violations - Track blocked access attempts
  6. Fail safe - When uncertain, ask user

When to Read references/boundaries.md

Load when:

  • Complex path resolution needed (symlinks, relative paths)
  • Edge cases in boundary detection
  • Audit log review of blocked attempts
  • User requests boundary exceptions

Violation Handling

When blocked:

⚠️ Workspace Guard: Blocked access to /path/outside/workspace

Reason: Path is outside allowed workspace boundary (/home/iamlegend/.openclaw/workspace)

Action required: Please confirm if you want to allow this access, or provide an alternative path within workspace.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Gigo Lobster Resume

🦞 GIGO · gigo-lobster-resume: 续跑入口:v2 stable 当前会清理旧 checkpoint 并从头重跑;保留此 slug 作为旧 checkpoint 兼容入口。 Triggers: 继续试吃 / 恢复评测 / resume tasting / continue lobster...

Registry SourceRecently Updated
General

YiHui CONTEXT MODE

context-mode is an MCP server that saves 98% of your context window by sandboxing tool outputs. It routes large file reads, shell outputs, and web fetches th...

Registry SourceRecently Updated
General

xinyi-drink

Use when users ask about 新一好喝/新一咖啡 drinks, stores, menu, activities, Skill用户大礼包, today drink recommendations, afternoon tea, feeling sleepy, or personalized...

Registry SourceRecently Updated
General

vedic-destiny

吠陀命盘分析中文入口。用于完整命盘研判、命主盘 Rashi chart 与九分盘 Navamsha chart 联读、既往事件回看、出生时间稳定度判断、事业主题、婚姻主题、时空盘专题,以及基于 Jagannatha Hora PDF、星盘截图或文本命盘数据的系统拆盘。当用户提到完整星盘、事业方向、婚姻问题、关系窗...

Registry SourceRecently Updated