wip-file-guard

Block destructive writes and edits on protected AI identity files via Node.js hooks.

3|Updated Feb 28, 2026
One-click install
npx skills add https://github.com/wipcomputer/wip-ai-devops-toolbox --skill wip-file-guard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wip-file-guard
Source: https://github.com/wipcomputer/wip-ai-devops-toolbox/tree/main/tools/wip-file-guard
Command: npx skills add https://github.com/wipcomputer/wip-ai-devops-toolbox --skill wip-file-guard

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill prevents AI agents from accidentally or intentionally overwriting critical identity and configuration files, ensuring the integrity of your AI's core instructions and memory.

Core Features & Use Cases

  • Blocks Destructive Writes: Prevents the Write tool from overwriting protected files like CLAUDE.md, SOUL.md, and IDENTITY.md.
  • Limits Destructive Edits: Blocks the Edit tool if it attempts to remove more than 2 net lines from a protected file, or if it performs a large replacement of existing content.
  • Survives Context Compaction: Acts as a technical guardrail that persists even when an AI's behavioral rules degrade after context compaction.
  • Use Case: An AI agent, after context compaction, might try to "optimize" your SOUL.md by replacing its entire content with a generic template. This Skill would block that operation, forcing the AI to append or make minor edits instead.

Quick Start

Use the wip-file-guard skill to protect your CLAUDE.md and SOUL.md files from accidental overwrites.

Frequently Asked Questions about wip-file-guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent Claude Code from overwriting identity files like CLAUDE.md?

To prevent Claude Code from overwriting identity files, you need a PreToolUse hook that blocks destructive write operations on critical configuration files. This Skill enforces those rules, stopping the Write tool from replacing files like CLAUDE.md and SOUL.md.

Does context compaction affect AI safety rules for file protection?

Context compaction degrades AI behavioral rules, but technical guardrails survive it. This Skill operates as a Node.js hook, ensuring file protection persists even when an AI agent's internal instructions degrade after context compaction.

How can I limit destructive edits on protected AI configuration files?

You can limit destructive edits by enforcing a net line removal threshold. This Skill blocks the Edit tool if it attempts to remove more than two net lines from a protected file or performs a large content replacement.

Can I use this file protection hook with OpenClaw agents?

Yes, you can use this file protection hook with OpenClaw agents. It operates as a lifecycle hook for OpenClaw, enforcing edit blocking and preventing destructive writes on critical AI identity files.

What is the best way to stop AI agents from replacing SOUL.md with a generic template?

The best way to stop AI agents from replacing SOUL.md is to block large content replacements at the tool level. This Skill blocks operations that attempt to overwrite protected files, forcing the AI to append or make minor edits instead.

Why should I use a Node.js hook for AI file protection instead of prompt instructions?

A Node.js hook provides technical file protection that persists regardless of context state, whereas prompt instructions degrade after context compaction. This hook directly blocks the Write and Edit tools from executing destructive operations on protected files.