repopilot — Claude Code hook: stops agents that weaken tests and CI
repopilot takes a repo snapshot at session start and checks it again before the agent stops. If tests, suppressions or CI gates got weaker, the session will not end quietly.
no license ★ 1,596 updated 2026-10-29
.claude/settings.jsonWhat repopilot does
The hook has two jobs. SessionStart runs snapshot.sh to capture how the repository looks before the agent touches anything. Stop runs guard.sh, which compares the current state with that snapshot. If the agent weakened tests, slipped in suppressions or bypassed CI gates, the hook stops it. One signal, one stop. Everything runs locally, so the outcome is deterministic.
Because the snapshot happens at session start, the comparison is not against git history but against the state right before the agent began. This catches edits that have not been committed yet. The timeouts are generous: 60 seconds for the snapshot, 180 for the pre-stop review.
Installation for Claude Code means editing .claude/settings.json. The scripts live in ${CLAUDE_PLUGIN_ROOT}/scripts/. If an agent removes a test to make a build pass, the hook blocks the session from wrapping up cleanly.
What it helps with
- detect when an agent removed or weakened tests
- catch suppressions added to silence errors
- stop CI gate bypasses before they get committed
- capture a repo snapshot before the session starts
- review the agent's output before the session ends
Example prompts for the agent
- Start a session so repopilot takes a repo snapshot
- Stop the agent and check if it weakened any tests
- Review the repository state before finishing the session
How to install repopilot
Manually: put the files in place
.claude/settings.jsonThe hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json
Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command
Questions about repopilot
How do I install repopilot in Claude Code?
Add the hook config to .claude/settings.json: on SessionStart run ${CLAUDE_PLUGIN_ROOT}/scripts/snapshot.sh with a 60-second timeout, on Stop run ${CLAUDE_PLUGIN_ROOT}/scripts/guard.sh with a 180-second timeout.
What does repopilot do?
It snapshots the repo when a session starts and compares the current state with that snapshot before the agent stops. If tests, suppressions or CI gates became weaker, the hook halts the agent.
Does repopilot work with Codex?
The hook ships with the repopilot plugin for Claude Code and triggers on SessionStart and Stop. It runs locally and needs no external services.