Start here

Concepts

bay gives each name one meaning, and these pages use each name only in that meaning.

bay uses one name for each idea. A change is one intended outcome, and its draft lives in a view. bay builds a candidate from the draft and main, and a runner merges it when its checks pass. Evidence records what each check saw.

Main

Main is the one branch bay merges into: the remote's default branch, such as main or dev. It is one linear branch that only grows, and each merge adds one child of the checked base. bay never forces a push to main. Agents create no branches: each change is bay's own record, edited in a view bay makes. Branches after main, such as staging and production, are promotion targets. Work that must never reach main goes in a lane.

Change

A change is a stable id for one intended outcome. A new implementation keeps the same id. A change id is eight lower-case base32 characters that bay generates. An intent says what the work is, in a few words, or gives a card id. One intent claims one change, even when several starts race for it. Only the same words, in the same case and spacing, name the same intent.

View

A view is the sparse checkout of the declared paths for one change. It also holds the agent product's hook settings, such as .claude/settings.json, when main holds that file. An absent file in a view is not a deletion. Each view is a Git worktree of your clone, so views on one clone share its objects. After bay start, the view works offline. A machine's core.autocrlf setting never changes the line endings of a view's files.

A view is its actor's

A view belongs to the actor that made it: BAY_ACTOR, else your user name. In another actor's view, bay merge and bay save refuse with VIEW_NOT_YOURS, which names that actor. bay start <change> refuses another actor's change the same way, with or without a view here. With agent hooks on, the hook refuses an edit or a git commit there too. Work in a view of your own, or take the change over with bay start <change> --adopt. Then you become its actor: detail.adopted is true, and detail.adopted_from names the actor before.

sh
bay start c7k2m4qa --adopt   # take the change and its view over

When a view goes

  • Each bay start releases this machine's views of changes that merged, were abandoned, or ended as no_effect.
  • It releases such a view at once: its work is on main, on the change, or under refs/bay/view-kept/<change>.
  • It keeps a view with edits, untracked files, a lock, or an unmerged commit that bay did not place.
  • When bay start must make a view again, files no draft holds, ignored ones too, are moved aside, never deleted.
  • It also keeps the view you run bay start in, and the view of a live session on this machine.
  • It keeps a folder that is no valid worktree of this clone, and a view that git worktree remove refuses.
sh
# A retention window after its change ended, a view kept for its unsaved work is saved, then freed.
git checkout refs/bay/view-kept/<change> -- <path>   # bring one file of a freed view back
ls .git/bay/view-kept/<change>/                       # its loose ignored files, such as .env, never committed

Views in a blob-less clone

A clone from git clone --filter=blob:none --no-checkout holds commits and trees, but no file contents. Views on it share one store, and each view fetches only the files it needs, after every bay start. With Git 2.45 or newer, Git never fetches a missing object on its own inside bay's reads. bay fetches what its own reads need, such as .bay/config.toml, by name from the clone's promisor remote. When it cannot fetch .bay/config.toml, the command fails and names that file. Use Git 2.48 or newer for such a clone.

Warm a view's history

Set [view] warm_history = true in .bay/config.toml to fetch the history of a view's declared paths. Then bay start fetches every past version of those paths with git backfill, also when it picks up a change. So git log -p and git blame on those paths need no fetch, also offline. detail.history says how much: its state, the objects missing before and after, and the bytes fetched. Below Git 2.54, bay skips the warm-up, and detail.history names that floor. A warm-up that fails says failed there, and the start still succeeds.

Candidate

The draft is the work in the view. bay builds the candidate from the draft and the current main. The candidate is one exact result: a Git tree and the commit that carries it. bay checks the candidate and merges that same commit.

Check

A check is a command that tests a candidate and returns JSON. Each check reports pass, product_failure, infra_failure or unknown. Unknown is never a pass. With retry_on_failure, a failure followed by a pass is flaky, never a plain pass. A runner asks an unknown check again once main moves, on up to three candidates. .bay/policy.toml on main lists the required checks.

Evidence

Evidence is one record of what one check, review or runtime observation saw on one exact result. With a registry that signs everything, a producer key signs each check record, and a reviewer key each review. bay keeps evidence in Git notes under refs/notes/bay/evidence/<producer>. Evidence counts only for the exact tree it names, and some checks also name the exact commit or base tree. Results say trust: signed with a key registry, trust: approvals when it signs only approvals, and trust: unsigned without one. A producer outside bay, such as a reviewer, writes its records with bay evidence record.

Runner

A runner is the process that finishes a merge after the agent leaves. It claims the operation, runs the checks, and merges the candidate.

On a main branch from bay host with a registry, only a runner's runner key can move main. This holds in the default signing mode. Under signing = "approvals", the host keeps main append-only, as with no registry. On other hosts, use the host's branch protection. bay runner run is one runner, and a CI system can be another.

Merge

To merge is to put one checked candidate on main. bay merge freezes the draft, builds the candidate, submits it, and returns at once. A runner then checks the candidate and merges it. The push to main is the only commit point. A change has merged only when its commit is on main. When the work is already on main, bay merges nothing, and the result's state is no_effect.

Lists every change adds to

Some files are lists that every change adds a line to, such as cards or a registry. Two open changes that each add a line would conflict. Mark such a file merge=union in main's .gitattributes, and bay keeps both sides' lines. bay reads the attributes from main, never from the change, so a change cannot mark its own files.

sh
# .gitattributes on main
cards.md merge=union

What main's commit says

When the agent commits in its view before bay merge, main's commit keeps that message. The agent's first line titles main's commit, followed by : change <id>. With no message, the intent titles it. The agent's other words come next, then bay's trailers, then the agent's own trailers. An Open: trailer names something left undone, or a step that needs a person. bay never judges the words, and an agent's message never sets one of bay's own trailers.

Main's commit keeps the draft's author, unless bay wrote the draft. Then [runner] author sets it, else bay's own.

sh
$ git log -1 --format=%B main
Fix the login page: keep the email after a failed sign-in: change lruimn6q

The form now refills the email field and shows the error under it.

Change-Id: lruimn6q
Revision-Id: 35ea68ce96d5045cfeb221b86331785d4917d0e4
Request-Id: fcd0a42056007b9b00717178bf13ca6efaa70a21
Candidate-Id: lruimn6q.1.1
Registry-Id: none
Bay-Epoch: 1
Intent: fix the login page@1
Actor: ada
Bay-Session: s-afiebih5
Open: ask design whether the error text should be red

Refusal

Most refusals are results with decision set to blocked. UPDATE_UNVERIFIED is failed. It carries one fixed reason code, such as CHECK_FAILED. allowed lists what you can still do. retry_when says what must happen before a retry can succeed, such as after_fix or after_wait. A retry with no change in the cause gets the same refusal and does no work.

Keys

Keys are optional. With a registry, six classes of key sign in bay: agent, runner, producer, reviewer, approver and registry. An agent key signs a request to merge, and a runner's runner key signs the commit that merges into main. A producer key signs check evidence, a reviewer key a review, and an approver key an approval or waiver. A registry key adds and removes keys. One key belongs to exactly one class.

The program, the skill and hook entries

bay puts three things in place, and each has its own home. The program is bay itself, at ~/.local/bin/bay on each machine. The skill is bay's guide for an agent: one copy in each Claude config folder, under skills/bay/. Hook entries are lines in a project's settings file, such as .claude/settings.json, that run bay hook. That file is on main, so every clone gets the entries once their change merges. Roll bay out to many machines puts all three in place, in order.