GitHub’s CODEOWNERS file assigns people or teams to paths. When a pull request changes a path, the owners are requested as reviewers, and branch protection can require their approval.
An example
# .github/CODEOWNERS
* @acme/maintainers
/infra/ @acme/platform
/src/payments/ @acme/payments
*.sql @acme/dataThe last matching pattern wins, so put general rules first and specific ones after.
Why it helps with agents
- An agent may touch files it was not asked to. The owners of those files are asked to review.
- Sensitive areas, such as payments and infrastructure, always get an informed reviewer.
- Reviewers see changes in their area without scanning every pull request.
To make it work
- Use teams, not single people, so a holiday does not block merges.
- Turn on “Require review from Code Owners” in branch protection.
- Keep the file current. A path nobody owns has no safeguard.