Give agent sessions a branch, and take work by task, pull or branch
Push rights now come from the session's branch, not its task. A session holds one branch: tasks/<n> with a task, a pull request's head branch, or any branch it names. A session without a branch claims a new one by pushing it first. Agents see pull requests linked to their task or opened from their branch.
3 decisions
A decision record here could not be read. Line 8: expected "name: value" under rejected.
Branch names are free, except the default branch, tasks/ names, HEAD and names git rejects; a session without a branch claims a new one on its first push.
Why
- Aman chose free branch names over an agent/<session>/<slug> prefix.
- tasks/<n> stays bound to its task, so no session pushes a task branch without the task.
Assumes
- The claim is safe because it is written only after the atomic create landed, which fails for an existing branch.
Touches
wire.tsindex.ts
refs_take takes exactly one of task, pull or branch; a pull request brings its task only when its head is that task's branch.
Why
- Agents must be able to work on a pull request or branch that has no task.
Touches
sessions.tsmcp.ts
An agent may see and open pull requests linked to its task or whose head is its branch.
Why
- An agent on a branch without a task must reach the pull request it works on.
Touches
policy.ts