Skip to content
Habits

Pull requests AGENTS.md

An agent that commits to the default branch or force-pushes will wreck a review. This file tells it to work on the current branch, to write a summary a reviewer can check, and to leave push and merge for a person unless the task explicitly asks.

Paste, then edit

Pair it with the test file so the summary includes a command that actually ran.

In this stack

What to tell the agent

Do

  • Name the default branch, so the agent knows what it must not commit to.
  • Say whether this repo uses squash merge, so it does not invent a merge commit.
  • Point at an example commit message if you have a house style.
  • Ask for the test command in the summary every time.

Leave alone

  • git push --force and git reset --hard.
  • A commit message that says update or fix.
  • Opening a pull request that includes unrelated files the agent reformatted.
Starter file

AGENTS.md to copy

Save this as AGENTS.md at the root of the repository, or next to the package it covers. Replace the commands with the ones in this repo. See which agents read the file.

AGENTS.md
# Pull requests

## Branch
- Stay on the branch you were given. Do not commit to the default branch.
- Do not force-push, rebase a shared branch, or delete a remote branch unless the task says so.
- Do not amend a commit you did not create in this task.

## Commits
- One concern per commit when you are asked to commit.
- The message says what changed and why, in the imperative, in one line. The body can name the check you ran.
- Do not commit generated junk, secrets, or a lockfile you did not mean to update.

## Summary
- List the files.
- List the commands you ran and the result line.
- Name the risk: a migration, an auth change, a public API, or none.
- Do not open or merge the pull request unless the task asked you to.

## Leave alone
- Do not rewrite history to "clean up" commits from other people.
- Do not change the Git user name or email.
Commands to confirm

Checks named in the file

Confirm each command exists here before you rely on it. Delete the ones this repository does not use.

  • See the branch and the files. git status --short && git branch --show-current
  • Recent commit style. git log -5 --oneline
FAQ

Questions

What is the Pull requests AGENTS.md for?

It keeps an agent on the current branch and makes the pull request summary list files, checks, and risk.

Should the instruction file let an agent push to the default branch?

Name the default branch and tell the agent to stay on the branch it was given. Pushing and merging stay with a person unless that exact task includes them.

What belongs in the pull request summary an agent writes?

The files, the check command and its result, and whether the change touches a migration, auth, or a public API. A reviewer should be able to repeat the check from that summary.

Keep going

Related on MCPpedia