ClaudeCodeMod

All shelves / Mods / Safety

mod-collision-guard

By v-amorim

mod-collision-guard is a Claude Code safety mod by v-amorim.

Pauses a file edit when another open session just edited that file, and asks you to proceed, move to a worktree, cancel, or type an instruction for Claude.

DrawsHolds a command

Install

The marketplace name is claude-mods.

In Claude Code
/plugin marketplace add v-amorim/moonlight-claude-mods
/plugin install mod-collision-guard@claude-mods
Open the repo

It runs inside the Claude Code process. The side panel is only what the author's README names. Read the repo before you install, or run claude plugin validate on the plugin folder.

Version
2.0.0
License
MIT
Repo stars
5
Last change
2026-10-30

What it can reach

  • Draws in the session
  • Holds a command
  • Reads this turn's file edits

Needs Claude Code 2.1.287 or newer; the author tested on Windows Terminal and macOS iTerm2. /plugin install asks where to install the mod: keep Install for you (user scope), press Enter, press Esc to leave the plugin screen, then run /reload-plugins. Auto-update is off for unofficial marketplaces; turn it on under /plugin, Marketplaces, claude-mods. The README warns that mods are not sandboxed and run with your permissions. Each session keeps a small file of the files it edits under ~/.claude/mods-data/mod-collision-guard/sessions. The window defaults to 30 minutes and only other sessions' edits count. With Guard edits off, edits are still recorded for other sessions but never paused.

The marketplace, claude-mods, holds 13 mods in the Moonlight look, and other repositories use that name too, so add v-amorim/moonlight-claude-mods. Stopping two sessions from editing the same file is why this page files it under safety. collision-guard holds an edit to a file another open chat changed in the last 30 minutes, and asks you to proceed, move this chat to a worktree, or cancel. shared-file-guard-mutlumehmet refuses a shell write to a shared file this session never read, or that another session changed, and tells Claude to read it again. This one asks before Edit, Write, MultiEdit or NotebookEdit, with a window you can change, and has four ways out: proceed, move to a worktree (Claude calls EnterWorktree and redoes the edit there), cancel, or type an instruction for Claude.

Demo

The Features section of the author's README: each session records the files it edits in its own small file, a question appears before Edit, Write, MultiEdit or NotebookEdit when another open session edited that file inside the window, and the four ways out: proceed, move to a worktree, cancel, or type an instruction for Claude.
Screenshot of the author's GitHub page.

What it hooks into

  • ui.toastA Claude Code event
  • ui.messageAdds a message to the session
  • session.startWhen a session starts
  • session.endWhen a session ends
  • tool.callAround a tool call, where it can hold one
  • command.runWhen you run its slash command/mod-collision-guard
  • ui.closeWhen its pane closes
  • state.setA Claude Code event
  • ui.renderDraws into the sessionAbovePromptPane

Read from the on() calls in its hook modules. Open its source under Files to check what each one does.

Slash commands 1

  • /mod-collision-guard

Files

The author's README and source, 4 files. They load when you open them.

Facts

Author
v-amorim
Category
Safety
Marketplace
claude-mods
Repo
v-amorim/moonlight-claude-mods
Folder
mod-collision-guard
Version
2.0.0
License
MIT
Repo stars
5
Last change
2026-10-30
Language
TypeScript
Files
23

Other mods in Safety

secret-guardvumichienHolds a commandHides secret values from your env files and secret-shaped text in tool results, tells Claude to use $NAME instead, and refuses commands that print them.blast-radiusAnthropicHolds a commandHolds a shell command such as rm -rf, a force push, a hard reset, or a migration, shows what it would touch, then asks you to proceed or cancel.merge-gatehamzaferHolds a commandHolds gh pr merge until CI is green and a Codex review has run once, and draws that pull request's status above the prompt.rulebook-guardhamzaferHolds a commandAsks before git commit --amend, an unformatted push, or personal details in notes and commits.bash-guardSingh-APHolds a commandHolds every Bash call, even in bypass mode. Blocks rm -rf on a home or system directory, and asks before a force-push, a hard reset, or a pipe into sh.net-guardSingh-APHolds a commandHolds curl, wget, ssh, scp, git push, and WebFetch, even in bypass mode. Blocks paste sites and request catchers, and asks before data goes anywhere new.file-guardSingh-APHolds a commandHolds writes outside the project and writes into .git, and asks before lockfiles and CI files.slopsquat-guardSingh-APHolds a commandHolds a package install and checks the name against its registry, so a hallucinated or typosquatted package does not install.command-explainerSingh-APDraws a plain-English line and a risk level on the permission prompt, so you can see what the command does before you approve it.secret-guardarasovicHolds a commandHides API keys and private keys before the model or the transcript sees them, blocks credential files and commands that print secrets, and shows what it caught.guardrailsarasovicHolds a commandHolds Cloudflare write commands, attribution lines in commits and pull requests, and branch names that start with claude/.guardrails-liteedtrackaiHolds a commandHolds a read of a secret .env file, a git force-push, and a recursive rm on /, ~, or $HOME. .env.example, .env.sample, and .env.template are allowed.
All 73 in Safety