Skip to content

Send a change through the loop

A change reaches main only through a pull request on GitHub. agents-git finish pushes your branch and opens no pull request. agents-git finish --ready opens it ready once the change is whole, and GitHub runs the rest. This page covers the part you do. What every pull request passes covers what GitHub does.

Commit on your branch. Git refuses a commit on main, any move of main except following origin/main, and git stash.

  • Write each commit subject and the pull request title as type(scope): subject, such as fix(gates): refuse a bare title, as the playbook plugin’s opening-a-pr playbook says. Do not end with a period.
  • Keep one concern in a branch. The size gate counts changed lines outside lockfiles and plans, and the limit is 400.
  • If a branch must go over, add a Size-Exception: <reason> trailer to a commit. git commit --amend --no-edit --trailer "Size-Exception: <why>" adds it to the last one. finish copies the reason into the pull request text.

agents-git size shows where the branch stands. The post-commit hook that guard install writes warns when a commit leaves it over the cap with no exception.

From the copy, with every file committed:

Terminal window
node daemon/agents-git/main.ts finish

finish refuses, and pushes nothing, when the copy has uncommitted files, is on main, or has no commit ahead of origin/main. Otherwise it does these things in order.

  1. It runs the size gate, unless a commit carries a Size-Exception trailer.
  2. It scans the commits it would publish for secrets, personal details and banned names.
  3. It pushes the branch to GitHub, never forced.
  4. It keeps the branch’s open pull request, if any, and moves its base to main. It opens none.

Before the size gate, finish takes a merge of main that land pushed to the branch, by a fast-forward or a merge of its own, and refuses any other commit someone else pushed there.

The Stop hook runs finish as each turn ends, when the copy is clean and ahead. agents-git sweep runs it for a copy that has sat idle for 15 minutes. You can run it yourself at any time, and a new commit goes up the same way.

The title is the first line of the branch’s description, set with git config branch.<name>.description, and its ## sections are the whole body. finish --ready checks them before pushing, and refuses a description with no sections. That text goes into the pull request finish --ready opens. Once it is open, write its text with gh pr edit <number> --body-file <file>, and finish keeps it.

The rules are these.

  • The title is type(scope): subject, at most 120 characters, with no trailing period.
  • The body holds only these sections, in this order. ## Why, ## What changed, ## Scope, ## Tradeoffs, ## Blast Radius and ## Verification.
  • ## Why, ## Scope, ## Blast Radius and ## Verification are required.
  • ## Blast Radius is one or two sentences. Its heading keeps the capital R.
  • No text sits before the first section, and no 40-character commit SHA appears.
  • The title and body together run at most 40 lines.

When the change is whole, run agents-git finish --ready from the copy. It opens the pull request ready in one call. Don’t open a draft, and don’t mark one ready on GitHub. A draft runs no stage, and a push made while the pull request is a draft leaves a skipped ship run on that head, and GitHub files the later checks under that run. GitHub then refuses the merge though every check passed. So on a draft someone opened by hand, finish --ready pushes, marks it ready, then pushes a merge of main on top when it pushed to a draft or GitHub lists a skipped ship run on the head. When that fails on a pull request it marked ready, it marks it a draft again and says so.

finish --ready runs every gate the loop’s first job runs before it pushes, and a pull request opened or marked ready starts the loop. A push to a ready pull request runs the loop again.

agents-git status shows the pull request, its checks, and what to run next. A branch with no pull request, pushed by plain finish or another tool, waits on GitHub until someone opens its pull request ready, as finish --ready does.

Each stage sets a check run on the head commit, named agents/gates, agents/review and agents/verdict. A failure names its findings. Fix them in your copy, commit, and run finish again. The new head runs the stages again. A reviewer’s blocking finding is a line comment on the pull request. A change to a protected path, such as the rules files, the checks that guard them or the schema, is named for the reviewer to read in full.

GitHub squash-merges the pull request, and the follow workflow pulls main into the main checkout with git pull --ff-only. It then removes the copy of each pull request that landed, when the copy is clean. A dirty copy stays, and the pull request says so. To remove a copy yourself, run agents-git done <name> --yes.