Conversation
) The write-safety kit README described only the three write footguns; the guard now also enforces **Rule 4** (deny a git operation that would only land by bypassing an active branch rule). Updates: - **What It Installs** describes Rule 4 (direct push to a PR-gated branch, force where history is protected, delete where deletion is blocked, and `--admin`/`--no-verify`; judged against live branch rules, fail-closed on the protected defaults). - **Scope and Limits** adds a note that the branch-bypass rule fails closed (unlike the precision-over-recall write rules). - A **Refreshing After an Upstream Change** section makes the re-run-the-installer update path explicit - the mechanism #365 tracks. Docs only - no release. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Promotes the agent write-safety kit README update to main, documenting the expanded guard behavior (Rule 4 branch-rule bypass + unconditionally denied verification-skipping flags), the fail-closed behavior on protected-by-default branches, and the refresh procedure for updating deployed copies across machines.
Changes:
- Document the hook’s additional protection surface: branch-rule bypass detection plus explicit-bypass flags (
--admin,--no-verify). - Add a “Refreshing After an Upstream Change” section clarifying that re-running the installer is the update mechanism (tracked in #365).
- Clarify scope notes around precision/recall for different rule classes and the fail-closed behavior.
Comments suppressed due to low confidence (1)
host-setup/agent-safety/README.md:72
- This fail-closed description mentions only unreadable branch rules, but the guard also fails closed for protected-by-default branches when it cannot determine the checkout's origin repo (so it cannot query rules at all). Including that case makes the documentation match the actual deny conditions.
- **The branch-bypass rule fails closed.** Unlike the write-footgun rules, a push to `main`/`master`/`develop` is denied even when the branch rules cannot be read, because the harm there is a silent success under the maintainer's admin bypass. The rule reads each branch's live rules, so it adapts to every repo (a code-style `develop` denies, a config-style `develop` allows) with no per-repo configuration, and hands the exact command to the maintainer to run when a bypass is genuinely intended.
Two accuracy fixes Copilot raised on the #452 promotion (#453): - Intro: name both categories (bypasses a **branch rule** or **skips local verification**) instead of the umbrella "repository protection", so the two are distinguished. - Fail-closed: the guard fails closed on a protected-default branch not only when the rules cannot be read but also when the checkout's **origin cannot be resolved** to query them. Broaden both the What It Installs bullet and the Scope bullet to "when its rules cannot be determined". Docs only - no release. --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
host-setup/agent-safety/README.md:3
- This sentence calls out a "git operation" and an "override a required check", but the examples include
gh pr merge --admin, which is a GitHub operation (not a git operation) and bypasses the server-side merge gate. Rewording avoids conflating git, GitHub, and the specific enforcement points.
Per-machine, user-account-scoped guards against an agent making a mis-targeted GitHub **write** under the maintainer's identity, or a **git operation that bypasses a branch rule or overrides a required check** - a push, force-push, or delete that an active branch rule forbids, or an override flag (`--admin` past the server-side merge gate, `--no-verify` past the local git hooks). Deploy it as the **first thing on any new system** where Claude Code runs with the `gh` credentials logged in (WSL, Linux, macOS, Proxmox, Windows).
host-setup/agent-safety/README.md:9
- This bullet describes the second class as a "git operation", but it later includes
gh pr merge --adminas an explicit bypass flag. Changing this to "an operation (git or gh)" keeps the classification technically accurate.
- **`hooks/gh-write-guard.py`** - a PreToolUse hook that denies two classes of dangerous action. First, the GitHub **write** footguns behind the cross-repo comment incident: a state-changing `gh` call whose output is discarded, a GraphQL mutation passing a **literal** node id instead of a `$variable`, and a `gh` write whose explicit target is outside the checkout's `origin`. Second, a **git operation that bypasses a repository protection**. The branch-rule cases - a direct push to a branch that requires a pull request, a force-push where history is protected, a branch delete where deletion is blocked - are judged against the branch's **live** rules, so a code-style `develop` is denied while a config-style `develop` is allowed with no per-repo configuration. A push to a protected-default branch fails closed when its rules cannot be determined - the API is unreachable, or the checkout's origin cannot be resolved to query them. The explicit-bypass flags are denied **unconditionally**, since the flag is itself the bypass and needs no branch query: `gh pr merge --admin` overrides the server-side merge gate, and `git commit`/`git push --no-verify` skips the local git hooks. Reads and everything else pass through. It fires even in autonomous / bypass-permissions sessions, which is how the incident happened.
This was referenced Aug 23, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Promotes #452 - the agent write-safety kit README updated to document Rule 4 (branch-rule bypass + the unconditionally-denied verification-skipping flags), the fail-closed behavior on the protected-default branches, and an explicit Refreshing After an Upstream Change section (re-run the installer = the refresh mechanism #365 tracks).
Docs only - no release. Restores develop==main after the guard/runbook promotion (#451).
🤖 Generated with Claude Code