Open source · RepoGuards
Guards for an agent that works across repos
A session sees one git status. The moment the agent reaches into another repo, it is working blind. RepoGuards runs inside the session, at the moment of the tool call: it refuses the two actions that cannot be undone, and hands the agent back the picture it was missing so it can correct itself.
- MIT licence
- Claude Code hooks
- Python 3.9+ · standard library
- Fails open
Demo
What it does
Refuse what can't be undone. Show what the agent can't see.
No push through the wall
git -C ../other-repo push is refused. A push publishes a whole branch, including commits the session never made, and nothing about it can be taken back.
No sweeping commits
add . or commit -a in another repo is refused, and the agent gets that repo's branch and open files instead. An add with exact paths goes through, with the same picture attached.
Ownership is honoured
A file another project claims in its .claude/owns.json is not edited from here. The agent is pointed at the place the file belongs.
A report at the end of the turn
When the session leaves work uncommitted outside its own git status, the end-of-turn guard lists each place and what this session changed there. It speaks only when something changed since it last spoke.
Commit only what this session wrote
close.py --commit stages, in every repo, the files this session wrote and nothing else, so a parallel session's work is never swept into your commit.
One registry for the machine
Which projects exist, and which skill tracks each one loads, so an iOS app never carries Android deploy commands. It works with App Factory's tracks.
Install
Clone it beside your other repos
You need git, Python 3.9 or later, and Claude Code. Nothing else is installed: the tools use only Python's standard library.
# wherever your repos live
BASE=~/Developer
cd "$BASE"
git clone https://github.com/yybd/repo-guards.git
claude plugin marketplace add "$BASE/repo-guards"
python3 "$BASE/repo-guards/tools/deploy.py"
Give marketplace add an absolute path; a bare name is read as a GitHub owner/repo and fails. deploy.py is the whole installation: it creates the registry, installs the plugin and verifies. Then open a new session, because hooks are read when a session starts. To connect a project, run /repo-guards:register-project inside it.
mkdir -p /tmp/rg-demo && cd /tmp/rg-demo && git init -q mine && git init -q theirs
echo '{"tool_name":"Bash","tool_input":{"command":"git -C ../theirs push"},"cwd":"/tmp/rg-demo/mine"}' \
| python3 "$BASE/repo-guards/plugins/repo-guards/hooks/scripts/scope_foreign_commits.py"
Run it in the same shell, with $BASE still set. No session needed: this hands the guard the exact payload Claude Code would send. It answers "permissionDecision": "deny" with the reason the agent would read.
Known limits
Where the guard stops, stated
- What a script writes from the inside is out of reach. The guards read tool calls and shell lines; they are not a file-system watcher.
- A computed target cannot be judged.
git -C $DIR pushresolves inside the shell, so the guard sees a variable and allows it. - It fails open, always. A malformed payload or an unreadable registry allows the operation. A guard that blocks by mistake stops work; one that crashes stops everything.
- Built for Claude Code, and tested only there. The idea carries to any agent with a pre-tool hook; the code does not, yet.
Writing
The article about RepoGuards
-
My agent stood in one repo and pushed another: hooks that stop blind commits across reposhe
Why one instruction file can't keep a coding agent out of the wrong repo, what I tried first, and the hooks that do. October 2026.
More open source
From the same desk
-
App Factory
Claude Code skills42 skills that build, describe, ship and announce apps, in tracks that load only in the repos that need them.
Project page -
App Store Reviews to Telegram
Self-hosted · Node.jsA dashboard and Telegram bot that tells you the moment a new review of your Mac or iOS app is posted.
Project page
Contact
Questions, bugs, or a case the guard missed
Issues and pull requests are welcome on GitHub. Email reaches the developer directly.
support@bdtech.app