Skip to content
youdede

Worktree Removal Evidence Guard

OperationsHookv1.0.0

A deterministic fail-open WorktreeRemove observer that runs a bounded read-only Git status and reports only the number of changed entries, never paths or content.

Runs on

Scope
$npx @youdede/toolkit add worktree-removal-evidence-guard --target claude-code

What it does

Observe dirty Git state immediately before Claude Code removes an isolated worktree.

When it fires

  • handoff
  • maintenance

How it behaves

Count dirty worktree entries before removal without exposing file paths or changing repository state.

It does not create, retain, delete, clean, commit, stash, or modify a worktree.

It does not claim to prevent removal because WorktreeRemove has no decision control.

It does not print changed paths, diff content, branch names, or repository remotes.

It does not follow a symbolic-link worktree path or run project-provided commands.

Configuration

targets/claude-code/worktree-removal-evidence-guard.mjsnode · read-only

Version
1.0.0
Requires
node
Licence
RiskThis observer observes dirty Git state immediately before Claude Code removes an isolated worktree; it cannot block the event or mutate the inspected state.
Low
ModeHow it works: fixed rules, model instructions, or both.
Deterministic only
Behaviour
Observes, does not intervene
On failure
Allows and continues
LatencyTo observe dirty Git state immediately before Claude Code removes an isolated worktree, the entrypoint may run a bounded local subprocess before returning.
Bounded
Data retentionWhether data remains after use and who manages its storage.
Not retained

Often used with

All in Operations