Home / Claude Code mods / Security / branch-guard

branch-guard

branch-guard is a Claude Code mod by Justmalhar that stops Claude from editing files or running mutating git commands on main or master, and points it at a worktree instead.

Updated 2026-10-04

What is branch-guard?

branch-guard is a Claude Code mod by Justmalhar that stops Claude from editing files or running mutating git commands on main or master, and points it at a worktree instead. It is listed under Security and has 1 GitHub stars.

TypeClaude code mod
AuthorJustmalhar
RepositoryJustmalhar/awesome-claude-mods
Popularity1 GitHub stars
CategorySecurity
SecurityLow risk (88/100)
Rank#1,886 of 5,272 Claude Code mods; #222 in Security
LicenseMIT
Last commit2026-10-04
Hooks1 events
SeesWrite|Edit|MultiEdit|Bash calls
Draws onnothing

Is branch-guard safe to install?

branch-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
$.process.runruns processes
$.session.cwd
$.ui.askdraws interface

How do I install branch-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/Justmalhar/awesome-claude-mods
    claude plugin validate ./awesome-claude-mods/mods/branch-guard
  3. Install it. Run this in your terminal, then /reload-plugins in an open session.
    claude plugin marketplace add Justmalhar/awesome-claude-mods && claude plugin install branch-guard@awesome-claude-mods

Or ask Claude to set it up

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

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

More from Justmalhar/awesome-claude-mods

This repository has at least 9 Claude Code mods on MCPMods.

  • auto-checkpoint: Snapshots the working tree into hidden git refs at the start of every turn, with /checkpoints to list them and /undo-tur (Low risk)
  • cost-bar: A one-row band above the prompt with session cost, 5h/7d plan limits and an optional budget bar. (Low risk)
  • file-tree-pane: Adds /tree: a side pane with a lazy file tree coloured by git status. Press a file to put @path in the prompt. (Low risk)
  • notify-on-finish: Sends a desktop notification when a long turn finishes, so you can look away while Claude works. (Low risk)
  • path-guard: Blocks Write, Edit and MultiEdit calls that target a path outside the project root or inside .git, plus optional deny gl (Low risk)
  • powerline-bar: A one-row powerline-style band above the prompt: directory, git branch and state, model, context fill. (Review before installing)
  • secret-guard: Blocks Write, Edit and Bash calls that would put an API key, token or private key into a file or command. (Low risk)
  • sensitive-file-guard: Blocks Read, Write, Edit, Grep, Glob and Bash calls that touch .env files, private keys and credential stores. (Low risk)