Agent Wranglers

ENG-15Required

Protect the main branch

Nobody pushes straight to the main branch. Every change arrives through a pull request with passing checks and a recorded review. A team approves with a second person, and a team of one with an AI or bot review.

How to do it

Turn on branch protection or rulesets in the code host, such as GitHub, GitLab or Bitbucket. Require the full check to pass on the latest commit, and at least one approval. Dismiss approvals when new commits arrive. A team of one cannot approve its own pull request, so it takes a solo path. Run an AI or bot review as a required check, which posts its findings on the pull request and fails on any blocking finding. The pull request then keeps the checks, the review and the merge as the audit trail. Add a second person as soon as there is one. Block force pushes and branch deletion. Combine changes as Test each change on top of the latest main before merging says. Review with the code review chapter of the architecture playbook. Changes made by an agent also follow Have someone other than the requester approve agent changes.

How to check

A direct push to the main branch is refused. A pull request with a failing check cannot be merged. In a team, one without an approval cannot be merged. In a team of one, one without a passing review check cannot be merged, and every merged pull request shows that review.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/engineering/version-control-and-review/protect-the-main-branch">Agent Wranglers engineering playbook</a>. In code you write, add a comment next to it with the same link.