Skip to content

fix(using-git-worktrees): auto-create .worktrees/ instead of global fallback - #1092

Closed
RaviTharuma wants to merge 1 commit into
obra:mainfrom
RaviTharuma:fix/worktree-auto-create-local
Closed

RaviTharuma wants to merge 1 commit into
obra:mainfrom
RaviTharuma:fix/worktree-auto-create-local

Conversation

@RaviTharuma

Copy link
Copy Markdown

Summary

  • Remove ~/.config/superpowers/worktrees/ as global fallback directory
  • When no .worktrees/ or worktrees/ exists, auto-create .worktrees/ in the project root
  • Ensure the directory is gitignored before proceeding
  • Update Quick Reference, Common Mistakes, and Red Flags sections accordingly

Problem

In autonomous modes (autopilot, subagent-driven-development, ralph), agents don't ask the user where to create worktrees — they silently pick the global fallback ~/.config/superpowers/worktrees/<project>/. This causes:

  1. 1GB+ of worktrees accumulating in a config directory
  2. Code changes, tests, and builds running inside ~/.config/
  3. Confusing file layout — code modifications buried in a config folder

Solution

Always keep worktrees local to the project. If .worktrees/ doesn't exist, create it automatically instead of falling back to a global directory. This is safe because:

  • .worktrees/ is a common convention (hidden directory, like .git)
  • The skill already verifies gitignore status and adds the entry if missing
  • Project-local worktrees are easier to discover, manage, and clean up

Fixes #1091

…allback

Remove ~/.config/superpowers/worktrees/ as fallback directory.
When no .worktrees/ or worktrees/ exists, auto-create .worktrees/
in the project root and ensure it's gitignored.

In autonomous modes (autopilot, subagent-driven-development),
agents don't ask the user — they silently pick the global fallback,
causing worktrees to accumulate in ~/.config/ (1GB+ for a few branches)
with code changes happening in unexpected locations.

Fixes #1091
@obra obra added worktrees Retired: use skill:using-git-worktrees pr-template-rules-ignored PR filed after template was added but didn't use it labels Apr 27, 2026
@arittr arittr mentioned this pull request May 5, 2026
5 tasks done
@obra

obra commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Thanks @RaviTharuma — avoiding the global fallback in favor of a project-local .worktrees/ is the right model.

After the 6.0 release: 6.0.0 removed the global fallback and defaults to .worktrees/. Verified against v6.0.2 in skills/using-git-worktrees/SKILL.md — the directory priority is now: explicit user instruction → an existing .worktrees//worktrees/ → otherwise a fresh .worktrees/ at the project root. The global ~/.config/superpowers/worktrees/ path is gone.

One nuance worth naming: the rewrite asks the user for consent before creating the worktree, rather than silently auto-creating it. If your real goal was a never-ask, autonomous-mode default (just use .worktrees/ without prompting), that's a slightly different behavior than what shipped — worth a fresh issue if you want it. But the global-fallback problem this PR targets is resolved, so I'm closing it.


Triaged by Claude Opus 4.8 (claude-opus-4-8, 1M context) running in Claude Code 2.1.181, with the superpowers and github-triage plugins. Post-6.0 obsolescence pass — verified against the released v6.0.2 source tree, not from memory. (No session ID available to cite in this environment.)

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

Labels

pr-template-rules-ignored PR filed after template was added but didn't use it worktrees Retired: use skill:using-git-worktrees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

using-git-worktrees: global fallback creates worktrees in ~/.config/superpowers/ — should auto-create .worktrees/ instead

2 participants