File Safety Guard

Protects files from accidental deletion and overwrites in Claude Code and Cowork sessions.

File Safety Guard

Your Cowork needs this

Prevents accidental file deletion, overwrites, and destructive operations in Claude Code and Cowork sessions. Adds automatic backups, dry-run planning, activity logging, and bulk operation approval.

Why

Claude Code and Cowork can read and write files directly. There are no built-in guardrails preventing accidental deletion, overwriting, or bulk changes to your files. This plugin adds a safety layer that asks before destructive operations, backs up files before modifications, and plans before complex tasks.

Installation

Claude Code

claude plugin marketplace add jitangupta/file-safety-guard
claude plugin install file-safety-guard@file-safety-guard

Cowork

  1. Download the latest release zip file
  2. Open Cowork → PluginsUpload Plugin
  3. Select the zip file

The plugin is installed globally — one-time setup, works across all folders and sessions.

Usage

Claude Code

Skills auto-activate based on task context. No extra steps needed — just work normally and the guardrails apply automatically.

Cowork

Activating File Safety Guard in Cowork

Cowork does not auto-activate skills based on task context. At the start of each session, run the enable command to activate all safety skills:

file-safety-guard:enable

Once activated, the skills remain active for the entire session. You do not need to repeat this for follow-up tasks within the same session.

Why manual? Cowork does not yet support automatic skill activation based on task context. This is a platform limitation, not a plugin issue. Once activated, skills remain active for the entire session.

Fallback: If the /enable command is unavailable, you can activate skills manually:

Use file-safety-guard:file-safety, file-safety-guard:backup-first, and file-safety-guard:dry-run skills for all file operations in this session.

What It Does

Skills

file-safety — Core protection rules that apply to every file operation:

  • No file deletion without explicit approval (shows file name, path, and reason)
  • No direct overwrites — backup created first with timestamp
  • Operations restricted to granted working directory
  • Bulk operations (3+ files) require a numbered list approval
  • Defaults to read-only when intent is uncertain
  • Hidden and system files are never touched
  • Every operation logged to _cowork_activity_log.md

backup-first — Automatic backup before any file modification:

  • Creates timestamped backups in _backups/ folder
  • Format: originalname_backup_YYYYMMDD_HHMM.ext
  • Each modification creates a new backup with a unique timestamp — previous backups are preserved
  • Keeps maximum 3 backups per file, rotates oldest
  • Post-task summary showing files modified and backups created

dry-run — Plan-first approach for complex operations:

  • Creates plan.md listing all planned changes before execution
  • Waits for explicit user approval
  • Updates plan with actual results after completion
  • Deletion section defaults to NONE unless explicitly requested

Commands

/enable — Activate all safety skills for the current session in one command. No need to remember skill names or copy activation text.

Note: In Cowork, use the full command name: file-safety-guard:enable

/safety-check — Quick health report on your working folder:

  • Total file and folder count
  • Last 10 activity log entries
  • Backup folder status and backup count
  • Files modified in current session

Note: In Cowork, use the full command name: file-safety-guard:safety-check

Files Created During Use

File/FolderPurpose
_cowork_activity_log.mdLog of all file operations with timestamps
_backups/Timestamped backup copies of modified files
plan.mdOperation plan for complex tasks (temporary)

All generated files use an underscore prefix so they sort to the top and are easy to identify.

Configuration

The plugin works with sensible defaults. To customize:

SettingFileDefaultWhat to Change
Max backups per fileskills/backup-first/SKILL.md3Change "maximum of 3 backups"
Bulk approval thresholdskills/file-safety/SKILL.md3 filesChange "more than 3 files"
Dry run thresholdskills/dry-run/SKILL.md2 operationsChange "more than 2 file operations"
Protected file patternsskills/file-safety/SKILL.mdHidden files (.)Add patterns to "Hands Off" section

Plugin Structure

file-safety-guard/
├── .claude-plugin/
│   ├── marketplace.json
│   └── plugin.json
├── skills/
│   ├── file-safety/
│   │   └── SKILL.md
│   ├── backup-first/
│   │   └── SKILL.md
│   └── dry-run/
│       └── SKILL.md
├── commands/
│   ├── enable.md
│   └── safety-check.md
├── LICENSE
└── README.md

License

MIT