feat: add worktree isolation utilities for parallel sessions#96
Open
reshashi wants to merge 1 commit intogarrytan:mainfrom
Open
feat: add worktree isolation utilities for parallel sessions#96reshashi wants to merge 1 commit intogarrytan:mainfrom
reshashi wants to merge 1 commit intogarrytan:mainfrom
Conversation
Adds two utility scripts for managing isolated git worktrees, enabling multiple Claude Code sessions to work on different tasks without file conflicts. - worktree.sh: create/list/remove/clean worktrees with .claude-worktree marker files for branch tracking - branch-guard.sh: prevents accidental commits to wrong branch by validating .claude-worktree marker against current git branch These complement conductor.json for multi-session orchestration by providing the underlying worktree isolation layer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two utility scripts for managing isolated git worktrees, enabling multiple Claude Code sessions to work on different tasks without file conflicts:
scripts/worktree.sh— create/list/remove/clean worktrees with.claude-worktreemarker files for branch trackingscripts/branch-guard.sh— prevents accidental commits to the wrong branch by validating the.claude-worktreemarker against the current git branchThese complement
conductor.jsonfor multi-session orchestration by providing the underlying worktree isolation layer. Conductor is the conductor; these are the tracks.Usage
Branch guard (for git hooks)
The
.claude-worktreemarker file (JSON) tracks expected branch, worktree path, session name, and creation timestamp. It is auto-added to.gitignoreon creation.Environment
GSTACK_WORKTREE_BASEoverrides the default worktree root (~/.worktrees).Test plan
worktree.sh createcreates worktree + branch +.claude-worktreemarkerworktree.sh listshows branch and creation time from markerworktree.sh removecleans up worktree, branch, and directorybranch-guard.shreturns 0 when on correct branchbranch-guard.shreturns 1 when on wrong branch or main/masterbranch-guard.shreturns 0 when no marker found (not in a worktree)🤖 Generated with Claude Code