Xpersona
W

Wip File Guard

CLAWHUB · Unverified

Hook that blocks destructive edits to protected identity files. For Claude Code CLI and OpenClaw. Skill: Wip File Guard Owner: parkertoddbrooks Summary: Hook that blocks destructive edits to protected identity files. For Claude Code CLI and OpenClaw. Tags: latest:1.9.72 Version history: v1.9.72 | 2026-04-21T21:24:57.219Z | user AI DevOps Toolbox v1.9.72 Promote v1.9.71-alpha series to stable Closes #256. Consolidates 21 alpha prereleases (v1.9.71-alpha.1 through v1.9.71-alpha.21) into a stable v1.9.72 release. No

62
Rank
84
Safety
2.3k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 2.3K downloads reported by the source. Last updated 10/9/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17620xzyc7kfan8m36at57m6n83h8he:wip-file-guard
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-parkertoddbrooks-wip-file-guard/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

160,000 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: wip-file-guard
description: Hook that blocks destructive edits to protected identity files. For Claude Code CLI and OpenClaw.
license: MIT
interface: [cli, module, hook, plugin, skill]
metadata:
  display-name: "Identity File Protection"
  version: "1.0.1"
  homepage: "https://github.com/wipcomputer/wip-file-guard"
  author: "Parker Todd Brooks"
  category: dev-tools
  capabilities:
    - file-protection
    - edit-blocking
    - identity-guard
  requires:
    bins: [node]
  openclaw:
    requires:
      bins: [node]
    install:
      - id: node
        kind: node
        package: "@wipcomputer/wip-file-guard"
        bins: [wip-file-guard]
        label: "Install via npm"
    emoji: "🛡️"
compatibility: Requires node. Node.js 18+.
---

# wip-file-guard

Hook that blocks destructive edits to protected identity files. For Claude Code CLI and OpenClaw.

## When to Use This Skill

**Use wip-file-guard for:**
- Protecting CLAUDE.md, SOUL.md, IDENTITY.md, MEMORY.md, and other identity files from being overwritten
- Blocking AI agents from replacing file content instead of extending it
- Surviving context compaction (behavioral rules get erased, but hooks don't)

**This is a technical guardrail, not a prompt.** It blocks the operation before it happens.

### Do NOT Use For

- Protecting binary files or images
- Blocking all edits (it allows small edits, only blocks destructive ones)
- Repos without identity files

## How It Works

Two rules:

1. **Write is blocked** on protected files. Always. Use Edit instead.
2. **Edit is blocked** when it removes more than 2 net lines from a protected file.

### Protected Files

CLAUDE.md, SHARED-CONTEXT.md, SOUL.md, IDENTITY.md, CONTEXT.md, TOOLS.md, MEMORY.md

### Protected Patterns

Any file matching: memory, memories, journal, diary, daily log

## API Reference

### CLI

```bash
node guard.mjs --list          # list protected files
bash test.sh                   # run test suite
```

### Claude Code Hook

Add to `~/.claude/settings.json`:

```json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "node \"/path/to/wip-file-guard/guard.mjs\"",
            "timeout": 5
          }
        ]
      }
    ]
  }
}
```

## Troubleshooting

### Agent keeps trying to Write

The deny message tells the agent to re-read the file and use Edit instead. If the agent ignores it, it's likely post-compaction and has lost context. The hook will keep blocking.

### Edit blocked unexpectedly

Check the net line removal. Edits that remove more than 2 lines from a protected file are blocked. Small edits (adding or replacing 1-2 lines) are allowed.

README.md

###### WIP Computer

[![npm](https://img.shields.io/npm/v/@wipcomputer/wip-file-guard)](https://www.npmjs.com/package/@wipcomputer/wip-file-guard) [![CLI / TUI](https://img.shields.io/badge/interface-CLI_/_TUI-black)](https://github.com/wipcomputer/wip-ai-devops-toolbox/blob/main/tools/wip-file-guard/guard.mjs) [![OpenClaw Plugin](https://img.shields.io/badge/interface-OpenClaw_Plugin-black)](https://github.com/wipcomputer/wip-ai-devops-toolbox/blob/main/tools/wip-file-guard/openclaw.plugin.json) [![Claude Code Hook](https://img.shields.io/badge/interface-Claude_Code_Hook-black)](https://github.com/wipcomputer/wip-ai-devops-toolbox/blob/main/tools/wip-file-guard/guard.mjs) [![Claude Code Skill](https://img.shields.io/badge/interface-Claude_Code_Skill-black)](https://github.com/wipcomputer/wip-ai-devops-toolbox/blob/main/tools/wip-file-guard/SKILL.md) [![Universal Interface Spec](https://img.shields.io/badge/Universal_Interface_Spec-black?style=flat&color=black)](https://github.com/wipcomputer/wip-ai-devops-toolbox/blob/main/tools/wip-universal-installer/SPEC.md)

# File Guard

PreToolUse hook that blocks destructive edits to protected files. When an AI agent tries to overwrite or strip content from files like CLAUDE.md, SHARED-CONTEXT.md, or SOUL.md... it gets blocked with a clear explanation of what went wrong.

## The Problem

AI agents replace content instead of extending it. After context compaction, behavioral rules like "don't delete things" vanish. The agent rewrites your CLAUDE.md, strips 30 lines from SHARED-CONTEXT.md, or replaces your SOUL.md with a shorter version. Every time.

File Guard is a technical guardrail. It doesn't ask the agent to be careful. It blocks the operation before it happens.

## How It Works

Two rules:

1. **Write is blocked** on protected files outside shared state paths. Use Edit instead.
2. **Edit is blocked** when it removes more than 2 net lines from a protected file (20 for shared state).
3. **Shared state paths** (e.g. `~/.openclaw/workspace/`) are always writable. These are live agent workspace files, not code.

The agent gets a deny message explaining what happened and telling it to re-read the file and add content instead of replacing it.

### Protected Files

| File | What it protects |
|------|-----------------|
| `CLAUDE.md` | Project instructions, boot sequence, system docs |
| `SHARED-CONTEXT.md` | Cross-agent shared state |
| `SOUL.md` | Agent identity |
| `IDENTITY.md` | Agent identity (alternate format) |
| `CONTEXT.md` | Current state snapshot |
| `TOOLS.md` | Tool and workflow rules |
| `MEMORY.md` | Persistent memory and preferences |

## Install

Open your AI coding tool and say:

```
Read the README at github.com/wipcomputer/wip-file-guard.
Then explain to me:
1. What is this tool?
2. What does it do?
3. What would it change or fix in our current system?

Then ask me:
- Do you have more questions?
- Do you want to integrate it into our system?
- Do you want to clone it (use as-is) or fork i

_meta.json

{
  "ownerId": "kn7b4mj57xb02gqhvjzgzkxq557zz95h",
  "slug": "wip-file-guard",
  "version": "1.9.72",
  "publishedAt": 1776806697219
}

CHANGELOG.md

# Changelog

## 1.0.2 (2026-04-08)

Add `~/.openclaw/workspace/` to shared state paths. OpenClaw agent workspace files are live shared state, not code. The guard now checks shared state BEFORE exact-match protection, so workspace TOOLS.md, MEMORY.md, etc. can be written freely by the agent that owns them. Fixes Lēsa being unable to write her own workspace files after the guard was deployed to OpenClaw on Apr 4.

## 1.0.1 (2026-02-21)

Align description, add SKILL.md, add badges, agent-driven install, REFERENCE.md

REFERENCE.md

###### WIP Computer
# wip-file-guard ... Reference

Manual install instructions, CLI usage, and customization.

## Install

Install to your LDM OS home:

```bash
mkdir -p ~/.ldm/extensions/wip-file-guard
cp guard.mjs openclaw.plugin.json package.json ~/.ldm/extensions/wip-file-guard/
```

All config paths should point to the installed location (`~/.ldm/extensions/`), not the source repo.

## Claude Code

Add to `~/.claude/settings.json`:

```json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "node ~/.ldm/extensions/wip-file-guard/guard.mjs",
            "timeout": 5
          }
        ]
      }
    ]
  }
}
```

## OpenClaw

```bash
cp -r ~/.ldm/extensions/wip-file-guard ~/.openclaw/extensions/wip-file-guard
```

The `openclaw.plugin.json` registers a `before_tool_use` lifecycle hook that applies the same rules.

## CLI

```bash
# List protected files
node guard.mjs --list

# Test the guard with a simulated input
echo '{"tool_name":"Write","tool_input":{"file_path":"/foo/CLAUDE.md"}}' | node guard.mjs

# Run the test suite
bash test.sh
```

## Customization

### Adding Protected Files

Edit the `PROTECTED` set in `guard.mjs`:

```javascript
const PROTECTED = new Set([
  'CLAUDE.md',
  'SHARED-CONTEXT.md',
  'SOUL.md',
  'IDENTITY.md',
  'CONTEXT.md',
  'TOOLS.md',
  'MEMORY.md',
  'YOUR-FILE-HERE.md',   // add yours
]);
```

### Changing the Line Threshold

The default blocks edits that remove more than 2 net lines. Change the threshold in the Edit handler:

```javascript
if (removed > 2) {   // change 2 to your threshold
```

Sponsored

Ads related to Wip File Guard and adjacent AI workflows.