Skip to content

Captain should start on the base branch (main/staging/develop), not whatever branch the tree was left on #683

Description

@tu11aa

Summary

A captain session should start on the project's integration branch (main / staging / develop), not on whatever branch the working tree happened to be left on. Today a captain booted on a stale feature branch and that single fact propagated into every piece of work it did.

Why this matters more than it looks

The captain's current checkout is not just cosmetic — squadrant crew spawn bases each crew worktree on the captain's current branch. So a captain sitting on a feature branch silently hands every crew the wrong base.

In one session (prism-app, 2026-08-18) the captain booted on feat/bug-report, a branch that was 75 commits behind origin/staging and had been untouched for six days. Consequences:

  • Every crew spawn printed base: feat/bug-report. Five crews, five wrong bases.
  • Each brief needed an explicit "your worktree may say base feat/bug-report — IGNORE that and check out X explicitly" line. That is a workaround being copy-pasted into every task, which is the classic sign the default is wrong.
  • Any crew that didn't get that line would have branched from a six-day-old base and produced a diff full of phantom changes — reverting 75 commits of other people's merged work.
  • The captain's own read-only checks (git log, git diff, file reads) silently describe stale code unless it remembers to qualify every path with origin/staging.

The failure mode is quiet. Nothing errors. The work just gets done against the wrong tree.

Proposed behaviour

On captain startup, if the checkout is not on the project's base branch:

  1. Default: check out the base branch (resolved the way handoff facts already resolves baseBranch — it correctly reported main via the GitHub API in this session) and fast-forward it.
  2. Do not do this silently if the tree is dirty — uncommitted work must never be stranded or discarded. Warn and stay put instead.
  3. Respect an explicit user intent — if the operator asked to work on a specific branch, or a config flag pins one, honour that.
  4. Print what happened either way, so the captain can see the base it will hand to crews.

A softer first version: don't switch, but warn loudly at startup when the checkout isn't the base branch, including how far behind it is. That alone would have caught this.

Related

squadrant crew spawn inheriting the captain's checkout is arguably the deeper issue — a crew's base should probably be derived from the task, not from wherever the captain is standing. Worth considering whether spawn should default to the project base branch and take an explicit flag to inherit.

Repro

  1. Leave a project checkout on a stale feature branch.
  2. Start the captain.
  3. squadrant crew spawn <project> "..." — observe base: <stale feature branch>.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions