Home / Claude Code mods / Security / worktree-guard

worktree-guard

worktree-guard is a Claude Code mod by thieung that guards a shared worktree: stops `git add -A` from staging files this session did not touch, previews destructive git commands, and points at the process holding a busy port.

Updated 2026-10-05

What is worktree-guard?

worktree-guard is a Claude Code mod by thieung that guards a shared worktree: stops `git add -A` from staging files this session did not touch, previews destructive git commands, and points at the process holding a busy port. It is listed under Security and has no public popularity data yet.

TypeClaude code mod
Authorthieung
Repositorythieung/claude-mods
Popularityno public popularity data yet
CategorySecurity
SecurityLow risk (88/100)
Rank#4,825 of 5,272 Claude Code mods; #499 in Security
LicenseMIT
Last commit2026-10-05
Hooks5 events
SeesBash calls, every tool call
Draws onPane, AbovePrompt

Is worktree-guard safe to install?

worktree-guard scores 88/100 on the MCPMods security check: Low risk. Things to review: starts processes outside the sandbox. It passed 7 of 8 checks.

Mod footprints come from claude plugin validate, which lists every event a mod hooks and every API call it makes without running it.

CheckResult
No network accessPass
Starts processes outside the sandboxReview
Writes no files or configPass
Doesn't read environment variablesPass
Only sees the events it hooksPass
Doesn't drive ClaudePass
Passes claude plugin validatePass
Has an open-source licensePass

API calls in its code

CallWhat it means
$.command.register
$.process.runruns processes
$.session.cwd
$.session.id
$.state.get
$.state.set
$.ui.askdraws interface
$.ui.closedraws interface
$.ui.logdraws interface
$.ui.opendraws interface
$.ui.panesdraws interface
$.ui.resolvedraws interface
$.ui.toastdraws interface

How do I install worktree-guard?

  1. Check your Claude Code version. Mods need Claude Code 2.1.287 or later and are on by default.
    claude --version
  2. Read its footprint. This lists every event it hooks and every API call it makes, without running it.
    git clone https://github.com/thieung/claude-mods
    claude plugin validate ./claude-mods/worktree-guard
  3. Install it. Run this in your terminal, then /reload-plugins in an open session.
    claude plugin marketplace add thieung/claude-mods && claude plugin install worktree-guard@thieung-mods

Or ask Claude to set it up

Paste this into Claude Code and it installs worktree-guard for you:

Install the "worktree-guard" Claude Code mod from https://github.com/thieung/claude-mods/tree/main/worktree-guard. Run claude plugin validate on it first and show me what it can access before you enable it.

More from thieung/claude-mods

This repository has 3 Claude Code mods on MCPMods.

  • ak-cockpit: AgentKit cockpit above the prompt: context fill with a handoff nudge, and the active plan's phase and checklist. (Low risk)
  • ghost-proc-guard: Stops Claude from starting a second copy of your dev servers on the next free port (monorepos and worktrees included), t (Low risk)