v2.2.0: PreToolUse hooks now protect both archive/ and archived/ directory conventions. Regex anchored on trailing slash to avoid false positives on git archive / tar archive.tar. Toggle protection with archived-lock/archived-unlock.

version
2.2.0

Install

/plugin install archive-first@psychquant-claude-plugins

Run it inside Claude Code after adding the marketplace with /plugin marketplace add PsychQuant/psychquant-claude-plugins.

Contents

Discovered from source

Commands 3

Archive-First: Create Backup

Archive the specified directory (or current project) as a regression baseline before AI-assisted reorganization.

Steps

  1. Determine the target directory:

    • If $ARGUMENTS is provided, use it as the target path
    • If no arguments, use the current working directory
  2. Create the archived copy:

    mkdir -p ./archived
    cp -r <target> ./archived/<dirname>-$(date +%Y%m%d-%H%M%S)
    
  3. Confirm to the user:

    • Show the archived path
    • Show the number of files copied
    • Remind them that PreToolUse hooks will block destructive commands on archived/

Archive-First: Lock

Enable the PreToolUse hooks that block destructive commands on archived/ paths.

Steps

  1. Remove the disabled flag:

    rm -f ~/.cache/archive-first/disabled
    
  2. Confirm to the user that protection is active.

Archive-First: Unlock

Temporarily disable the PreToolUse hooks to allow operations on archived/ paths.

Steps

  1. Create the disabled flag:

    mkdir -p ~/.cache/archive-first && touch ~/.cache/archive-first/disabled
    
  2. Confirm to the user that protection is disabled.

  3. Remind them to re-enable with /archive-first:archived-lock when done.

Hooks 1

Sponsors

Details

Marketplace
PsychQuant/psychquant-claude-plugins
Source
plugins/archive-first
Author
Che Cheng
Category
Productivity

More from PsychQuant/psychquant-claude-plugins

All 42