Skip to content

Docs: require agent worktrees to be rooted on main#446

Merged
brickbots merged 1 commit into
mainfrom
docs/agent-worktree-base
May 29, 2026
Merged

Docs: require agent worktrees to be rooted on main#446
brickbots merged 1 commit into
mainfrom
docs/agent-worktree-base

Conversation

@brickbots
Copy link
Copy Markdown
Owner

Why

Agent worktrees created via EnterWorktree use a fresh base that resolves to this clone's origin/HEAD. In this repo that pointer is origin/release (the GitHub default branch), so worktrees can land on release rather than main — contrary to the Branch Model rule that all work branches off main.

CLAUDE.md cannot change the base (it's decided by the harness before any instruction is read), so this documents the recovery step and the per-clone fix.

Changes

Adds an Agent worktrees subsection to the Branch Model in CLAUDE.md:

  • Agents must verify the base after EnterWorktree and git reset --hard origin/main if it landed on release.
  • Maintainers can make fresh root on main per clone (without changing GitHub's default) via git remote set-head origin main.

🤖 Generated with Claude Code

The harness's `fresh` worktree base resolves to the clone's origin/HEAD,
which points at `release` (the GitHub default) — so EnterWorktree can land
on release rather than main. Document the verify-and-reset recovery step
and the `git remote set-head origin main` fix that makes `fresh` root on
main per clone.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@brickbots brickbots merged commit ed2641e into main May 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant