# CODEOWNERS and coding agents: who must review which files

Canonical: [CODEOWNERS and coding agents: who must review which files](https://contextingo.com/blog/codeowners-and-coding-agents)

Locale: en

Purpose: A CODEOWNERS file maps paths to reviewers. With agents writing changes, it is the safest way to make sure sensitive files get an owner’s review.

Content updated: 2026-10-06

Source revision: content.ts 2026-10-06

Maintenance owner: the Contextingo site owner

[Topic map](https://contextingo.com/llm/topics/blog.md) · [Complete scoped map](https://contextingo.com/sitemap.md)

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/data
```

The 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

1. Use teams, not single people, so a holiday does not block merges.
2. Turn on “Require review from Code Owners” in branch protection.
3. Keep the file current. A path nobody owns has no safeguard.

See [branch protection for agent pull requests](/blog/branch-protection-for-agent-pull-requests).

## Questions

### Where does the file live?

In the repository root, in `docs/`, or in `.github/`.

### Does it work on other hosts?

GitHub and GitLab both support code owners, with different syntax details.
