[FEATURE] Honor the repository's documented branch-naming convention (CLAUDE.md) for auto-created session branches
Environment
- Claude Code 2.1.222, desktop app, macOS
- Background / worktree sessions against a repository that documents a branch-naming convention in
CLAUDE.md
Summary
Auto-created session branches use a random claude/<adjective>-<surname>-<hash> name (claude/distracted-tharp-9849c2, claude/quizzical-yalow-4ab734) and ignore a branch-naming convention documented in the repository's own CLAUDE.md.
The specific inconsistency: CLAUDE.md already takes precedence over harness git behavior in one place but not the other.
Per agent-view.md and the v2.1.221 release notes, background sessions auto-commit and push unless CLAUDE.md says the user handles git — the harness reads and defers to CLAUDE.md for commit/push. But a branch-naming convention stated in that same file has no effect. Two git behaviors, one config file, opposite treatment.
Example
The repository's CLAUDE.md states that work should use claude/<type>/<slug> branches. Human-initiated and plan-driven work in the repo follows it:
claude/feat/ap3-production-deploy
claude/docs/lp-content-playbook
claude/fix/lp-only-interior-chrome
claude/chore/open-issue-sweep-2
Auto-created session branches in the same repository do not:
claude/distracted-tharp-9849c2
claude/quizzical-yalow-4ab734
Impact
A random name says nothing about the work. In a branch list, a PR queue, or a worktree directory listing, these are unidentifiable without checking out or reading the diff — the same complaint as #18686.
It compounds with worktree naming: worktree directories keep the name of the first branch they ever held, so neither the directory name nor the branch name describes what is in it. See #85997 and #79366.
Request
Any one of these would resolve it, in rough order of preference:
- Honor a branch-naming convention documented in
CLAUDE.md, consistent with howCLAUDE.mdgit instructions are already honored for commit/push. - A configurable naming template in
settings.json(e.g.branchNameTemplate). - Task-derived slugs instead of random names. #62166 indicates task-derived branch naming previously existed on the web client and regressed to this same
<adjective>-<surname>-<hash>pattern, so the capability appears to have existed.
A WorktreeCreate hook can rename after the fact, but that is a post-hoc workaround for a name the harness has already chosen and used.
Related
- #31969 — open: "Enter/resume existing worktrees, configurable branch naming, hook removal control." This overlaps directly; happy for this to be folded into that issue if maintainers prefer. Filing separately because the
CLAUDE.md-precedence angle is not raised there. - #62166 — task-derived branch names regressing to
<adjective>-<surname>-<hash>(web) - #42365, #63458 — configurable worktree branch prefix / desktop parity (both closed as stale)
- #18686 — generated branch names unidentifiable in the session dropdown
- #85997 — no visible indication of current branch/worktree in the desktop UI