feat: Git Worktree Isolation for Agent Tasks (Issue #8)#14
Merged
MikeeBuilds merged 1 commit intomainfrom Dec 22, 2025
Merged
Conversation
- Add squadron/services/worktree.py with core functions:
- create_worktree() - Create isolated worktree + branch
- cleanup_worktree() - Remove worktree, optionally merge to main
- get_worktree_path() - Check if worktree exists
- list_worktrees() - List all active worktrees
- Integrate into agent.py:
- Creates worktree at task start when task_id provided
- Executes in isolated directory
- Returns to original directory on completion
- Add overseer.py methods:
- finalize_task() - Merge or discard task worktree
- list_worktrees() - Get active worktrees for dashboard
- Add API endpoints:
- POST /tasks/{task_id}/finalize - Merge or discard worktree
- GET /worktrees - List all active worktrees
Enables safe parallel agent execution without conflicts.
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
Implements isolated Git worktrees for each agent task, enabling safe parallel execution without conflicts.
Features
Files Changed
[NEW] \squadron/services/worktree.py\
Core worktree management module with:
[MODIFY] \squadron/swarm/agent.py\
[MODIFY] \squadron/swarm/overseer.py\
[MODIFY] \squadron/server.py\
Testing
✅ Tested create/cleanup cycle successfully:
\
Created: .worktrees/task-test-123
Worktrees: [{'path': '...', 'task_id': 'test-123'}]
Cleaned up, worktrees: []
\\
Closes #8