cbox manager default parent-branch policy
Problem
When a cbox manager agent launches a named sandbox (cbox new <name>), the
worktree was historically based on main. When the manager is already on a
feature branch, the sandbox should inherit that branch as its parent so work
stays on the right lineage without requiring an explicit --parent-branch flag
every time.
Context
Possible Solutions
Plan
Implementation Progress
_default_parent_branch()helper returns the caller's current branch.cbox new <name>uses current branch as default parent when--parent-branchis omitted.--parent-branch <branch>still overrides the default.- Console prints
Using current branch as parent: <branch>when defaulting. - Canonical docs updated (
docs/agent/cbox.md,.cursor/rules/cbox.mdc,libs/cbox/CLAUDE.md,.codex/skills/cbox/SKILL.md). - Focused unit tests for
_default_parent_branch()and the defaulting behavior incbox new. -
Manager skill docs updated to reflect that
--parent-branchis optional when already on the target branch. -
Named sandbox worktrees default to the manager's current branch, not
main. - Explicit
--parent-branchflag still overrides the default. _default_parent_branch()returnsNoneon detached HEAD or git failure.- All cbox tests pass (110/110).
Evidence of prior behavior
Before commit 48354c84 ("unify cbox agent guidance and improve sandbox
defaults"), _create_worktree() was called without a parent branch when
--parent-branch was omitted, causing git branch sandbox/<name> to branch
from HEAD of whatever branch the repo happened to be on — but the docs and
skill files all said "parent branch: main", reinforcing a workflow where
managers always passed --parent-branch main explicitly. The new behavior
makes the implicit default match what managers actually want: inherit the
current branch.
- Implementation landed in
48354c84, docs in30310067. - This task adds tests, updates skill/workflow docs, and creates a formal task record.
Review Feedback
- [ ] Review cleared