Install command
Provided
Automatically creates timestamped backups of files before modification to prevent data loss. This hook runs before file editing operations (Edit, Write, Multiedit) and creates versioned backups in a centralized .backups directory with ISO 8601-compliant timestamps including nanoseconds for collision prevention.
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
0
78
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
Copy-ready — paste the snippet to get started.
Install command
Provided
Config snippet
Provided
Copy snippet
Provided
Prerequisites
None
Platforms
1 listed
Difficulty
0/100
Adoption plan
Current risk score 16/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes are present.
Review privacy notesRequired
Privacy notes are present.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Required evidence gates are covered (5/6 signals complete).
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are present.
Required in this preset
Privacy notes are present.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required evidence gates are covered for this preset.
Decision timeline
5/6 steps complete with no blocking gaps for this preset.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are available.
verify
Privacy notes are available.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
No required blockers for this timeline preset.
Safety & privacy surface
1 safety and 1 privacy notes across 2 risk areas. Review closely: credentials & tokens, permissions & scopes.
#!/usr/bin/env bash
# Read the tool input from stdin
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name')
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
# Check if file exists before backing up
if [ -f "$FILE_PATH" ]; then
echo "💾 Creating backup for $FILE_PATH..." >&2
# Create backups directory
mkdir -p .backups
# Generate timestamped backup filename
BASENAME=$(basename "$FILE_PATH")
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
BACKUP_NAME="${BASENAME%.*}_${TIMESTAMP}.${BASENAME##*.}"
# Create backup
cp "$FILE_PATH" ".backups/$BACKUP_NAME" 2>/dev/null || true
if [ $? -eq 0 ]; then
echo "✅ Backup created: .backups/$BACKUP_NAME" >&2
else
echo "⚠️ Backup failed for $FILE_PATH" >&2
fi
else
echo "📝 Creating new file $FILE_PATH (no backup needed)" >&2
fi
exit 0{
"hooks": {
"preToolUse": {
"script": "./.claude/hooks/auto-save-backup.sh",
"matchers": [
"edit",
"write",
"multiedit"
]
}
}
}.claude/settings.local.json~/.claude/settings.json.claude/settings.json{
"hooks": {
"preToolUse": {
"script": "./.claude/hooks/auto-save-backup.sh",
"matchers": ["edit", "write", "multiedit"]
}
}
}
#!/usr/bin/env bash
# Read the tool input from stdin
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name')
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
# Check if file exists before backing up
if [ -f "$FILE_PATH" ]; then
echo "💾 Creating backup for $FILE_PATH..." >&2
# Create backups directory
mkdir -p .backups
# Generate timestamped backup filename
BASENAME=$(basename "$FILE_PATH")
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
BACKUP_NAME="${BASENAME%.*}_${TIMESTAMP}.${BASENAME##*.}"
# Create backup
cp "$FILE_PATH" ".backups/$BACKUP_NAME" 2>/dev/null || true
if [ $? -eq 0 ]; then
echo "✅ Backup created: .backups/$BACKUP_NAME" >&2
else
echo "⚠️ Backup failed for $FILE_PATH" >&2
fi
else
echo "📝 Creating new file $FILE_PATH (no backup needed)" >&2
fi
exit 0
Complete hook script that creates timestamped backups before file modifications with nanosecond precision
#!/usr/bin/env bash
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r ".tool_input.file_path // .tool_input.path // \"\"")
if [ -z "$FILE_PATH" ]; then exit 0; fi
if [ -f "$FILE_PATH" ]; then
mkdir -p .backups
BASENAME=$(basename "$FILE_PATH")
TIMESTAMP=$(date +%Y%m%d_%H%M%S_%N)
BACKUP_NAME="${BASENAME%.*}_${TIMESTAMP}.${BASENAME##*.}"
cp "$FILE_PATH" ".backups/$BACKUP_NAME" 2>/dev/null || true
if [ $? -eq 0 ]; then
echo "Backup created: .backups/$BACKUP_NAME" >&2
fi
fi
exit 0
Complete hook configuration for .claude/settings.json to enable automatic backups before file edits, writes, and multiedits
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit|Write|Multiedit",
"hooks": [
{
"type": "command",
"command": "./.claude/hooks/auto-save-backup.sh"
}
]
}
]
}
}
Enhanced hook script with automatic cleanup of old backups when disk space is limited
#!/usr/bin/env bash
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r ".tool_input.file_path")
if [ -f "$FILE_PATH" ]; then
mkdir -p .backups
BASENAME=$(basename "$FILE_PATH")
TIMESTAMP=$(date +%Y%m%d_%H%M%S_%N)
BACKUP_NAME="${BASENAME%.*}_${TIMESTAMP}.${BASENAME##*.}"
# Check disk space before backup
AVAILABLE=$(df -BG .backups | tail -1 | awk '{print $4}' | sed 's/G//')
if [ "$AVAILABLE" -lt 1 ]; then
find .backups -type f -mtime +30 -delete 2>/dev/null
fi
cp "$FILE_PATH" ".backups/$BACKUP_NAME" 2>/dev/null || true
fi
exit 0
Hook script that handles Multiedit operations by backing up all files in the edits array
#!/usr/bin/env bash
INPUT=$(cat)
if echo "$INPUT" | jq -e ".tool_input.edits" &> /dev/null; then
mkdir -p .backups
echo "$INPUT" | jq -r ".tool_input.edits[].file_path" | while read -r FILE_PATH; do
if [ -f "$FILE_PATH" ]; then
BASENAME=$(basename "$FILE_PATH")
TIMESTAMP=$(date +%Y%m%d_%H%M%S_%N)
BACKUP_NAME="${BASENAME%.*}_${TIMESTAMP}.${BASENAME##*.}"
cp "$FILE_PATH" ".backups/$BACKUP_NAME" 2>/dev/null || true
fi
done
fi
exit 0
Advanced hook script with automatic retention policy limiting backups to last 50 versions per file
#!/usr/bin/env bash
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r ".tool_input.file_path")
if [ -f "$FILE_PATH" ]; then
mkdir -p .backups
# Retention policy: keep last 50 backups per file
BASENAME=$(basename "$FILE_PATH")
FILE_PREFIX="${BASENAME%.*}_"
# Count existing backups for this file
BACKUP_COUNT=$(find .backups -name "${FILE_PREFIX}*" | wc -l)
if [ "$BACKUP_COUNT" -ge 50 ]; then
find .backups -name "${FILE_PREFIX}*" -type f -printf '%T@ %p\n' | sort -n | head -n -50 | cut -d ' ' -f2- | xargs rm -f 2>/dev/null
fi
TIMESTAMP=$(date +%Y%m%d_%H%M%S_%N)
BACKUP_NAME="${BASENAME%.*}_${TIMESTAMP}.${BASENAME##*.}"
cp "$FILE_PATH" ".backups/$BACKUP_NAME" 2>/dev/null || true
fi
exit 0
Verify mkdir permissions in project root. Check disk space: df -h. Ensure script runs with correct CWD: pwd >&2 in hook. Create .backups manually if needed: mkdir -p .backups. Check filesystem permissions on project directory.
PreToolUse only creates backup, doesn't block edits. Check subsequent tool execution logs. Verify hook exits with 0 (non-blocking). Review tool output for actual edit errors. Ensure backup operation completes before file modification.
Add nanoseconds to timestamp: date +%Y%m%d*%H%M%S*%N. Or use hash suffix: ${TIMESTAMP}_$(md5sum file | cut -c1-8). Implement collision detection and retry logic. Use ISO 8601 format with nanoseconds for better precision.
Verify [ -f "$FILE_PATH" ] check works correctly. Check TOOL_NAME to distinguish edit vs write: if [["$TOOL_NAME" == "edit"]]. Skip backup for new file creation. Use PreToolUse only for Edit operations, not Write.
Add retention policy: find .backups -mtime +30 -delete. Implement backup rotation script. Use git for versioning instead. Add size limit checks before creating backups. Limit backups per file: find .backups -name "file_*" | tail -n +50 | xargs rm.
Add file size check before backup: [ $(stat -f%z file) -lt 10000000 ]. Use rsync for large files: rsync -a file .backups/backup_name. Consider excluding large files from backup. Add timeout wrapper: timeout 10s cp file backup.
Use cp -p to preserve permissions: cp -p file backup. Check umask settings. Verify backup directory permissions: chmod 700 .backups. Use rsync -a for better metadata preservation: rsync -a file backup.
Check if FILE_PATH is array in multiedit context. Parse all paths: jq -r '.tool_input.edits[].file_path'. Loop through each file for backup. Verify jq parsing handles arrays correctly. Test with multiple files in edits array.
Auto Save Backup - Hooks side by side with 2 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | Automatically creates timestamped backups of files before modification to prevent data loss. This hook runs before file editing operations (Edit, Write, Multiedit) and creates versioned backups in a centralized .backups directory with ISO 8601-compliant timestamps including nanoseconds for collision prevention. Open dossier | A Stop hook that syncs your changed files to cloud storage when a Claude Code session ends, using rclone to push to S3, Google Cloud Storage, or any of its 70+ supported backends. Open dossier | A PostToolUse hook that watches for edits to Docker-related files (Dockerfile, docker-compose, .dockerfile, .dockerignore). Open dossier |
|---|---|---|---|
| Next steps | |||
| Trust | |||
| Review status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed |
| Submitter | — | — | — |
| Install risk | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Brand | — | ||
| Category | hooks | hooks | hooks |
| Source | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | JSONbored |
| Added | 2025-09-19 | 2025-09-19 | 2025-09-19 |
| Platforms | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — |
| Safety notes | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. | ✓Runs automatically at session end and can create compressed archives of modified git files. Uploads backups through AWS CLI, Google Cloud SDK, or rclone when those tools and bucket variables are configured. Writes a temporary archive under /tmp when using the rclone fallback and removes it after the copy attempt. | ✓Runs automatically after write or edit activity on Dockerfile, docker-compose, dockerfile, and dockerignore paths. Invokes docker build or docker compose build and can consume CPU, disk, network, and local Docker daemon resources. Uses the Dockerfile directory or compose-file directory as the build context, so incorrect paths can include more files than expected. |
| Privacy notes | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. | ✓Sends modified file contents to the configured cloud storage destination. Uses locally configured cloud credentials and bucket environment variables but does not define or manage them. Backup archives may include source code, docs, generated files, and any unignored local changes listed by git diff. | ✓Reads Docker-related files and may send build context files to the local Docker daemon during image builds. Build logs may reveal image names, service names, dependency URLs, and package-install output. Prints the first lines of .dockerignore files to local hook output when those files are edited. |
| Prerequisites | — none listed | — none listed | — none listed |
| Install | | | |
| Config | | | |
| Citations | |||
| Claim | Unclaimed | Unclaimed | Unclaimed |
Source-backed guides for putting this to work.
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.