| name | worktree-manager |
| description | Advanced Git worktree management agent that orchestrates parallel development environments with integrated quality assurance and automated workflow management. Enables concurrent feature development, isolated testing environments, and seamless integration with CI/CD pipelines. |
Worktree Manager Agent Skill
Overview
Advanced Git worktree management agent that orchestrates parallel development environments with integrated quality assurance and automated workflow management. Enables concurrent feature development, isolated testing environments, and seamless integration with CI/CD pipelines.
Capabilities
- Parallel Development: Create and manage multiple isolated worktrees for concurrent development
- Environment Isolation: Complete separation of development branches and workspaces
- Quality Integration: Automatic QA execution per worktree with status tracking
- Terminal Management: Automated terminal launching and process management
- Workflow Automation: Git operations, merging, and conflict resolution
- Resource Management: Worktree lifecycle management and cleanup automation
Tools Required
MCP Tools
codex_read_file - Reading worktree configurations and status files
codex_write_file - Generating worktree metadata and reports
codex_codebase_search - Analyzing project structure across worktrees
grep - Searching for worktree-related files and patterns
read_file - File access for worktree operations
write - Creating worktree artifacts and logs
File System Access
- Read: Full repository access for worktree management
- Write: Limited to
./worktrees, ./.worktrees.json, ./worktree-artifacts
Network Access
- None required - Local Git operations only
Shell Commands
git worktree - Git worktree operations (add, remove, list, prune)
git checkout - Branch switching and creation
git merge - Worktree merging operations
git status - Worktree status checking
git log - Worktree history analysis
ps - Process management for terminal instances
Usage Examples
Create Parallel Development Environment
codex $worktree-manager "Create parallel development environment for user authentication feature"
Manage Feature Branches
codex $worktree-manager "Set up isolated worktrees for auth, payment, and UI features"
QA-Integrated Development
codex $worktree-manager "Create worktree with automatic QA validation for security audit"
Worktree Lifecycle Management
codex $worktree-manager "Manage worktree lifecycle: create, develop, qa, merge, cleanup"
Output Format
Worktree Management Report
ðEEWorktree Manager Report - Parallel Development Environment
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââE
Operation: Create Parallel Environment
Timestamp: 2026-01-04 15:30:00 UTC
Duration: 45.2 seconds
ð Environment Summary
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââE
Total Worktrees: 4 (3 active, 1 inactive)
Active Branches: feature/auth, feature/payment, feature/ui
Base Branch: main
Repository: /path/to/project
ð¿ Worktree Status Overview
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââE
âââââââââââââââââââ¬âââââââââââââ¬âââââââââââââ¬âââââââââââââ¬ââââââââââââââââââE
âEWorktree âEBranch âEStatus âEQA Status âELast Activity âE
âââââââââââââââââââ¼âââââââââââââ¼âââââââââââââ¼âââââââââââââ¼ââââââââââââââââââ¤
âEauth-feature âEfeature/auth âEactive âEqa_passed âE15:28:33 âE
âEpayment-feature âEfeature/pay âEactive âEqa_runningâE15:29:45 âE
âEui-feature âEfeature/ui âEactive âEqa_pendingâE15:30:00 âE
âEold-experiment âEexperiment âEinactive âEqa_failed âE2026-01-03 âE
âââââââââââââââââââ´âââââââââââââ´âââââââââââââ´âââââââââââââ´ââââââââââââââââââE
ð¥EETerminal Management
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââE
Active Terminals: 3
ââ auth-feature (PID: 12345) - /path/to/project/auth-feature
ââ payment-feature (PID: 12346) - /path/to/project/payment-feature
ââ ui-feature (PID: 12347) - /path/to/project/ui-feature
ð¬ QA Integration Status
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââE
QA Service: Active (monitoring 3 worktrees)
Recent QA Results:
âââ auth-feature: âEPASSED (security: A+, performance: A)
âââ payment-feature: ð RUNNING (45% complete)
âââ ui-feature: â³ PENDING (waiting for changes)
ð Worktree Artifacts
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââE
âââ worktrees/auth-feature/artifacts/qa_report.json
âââ worktrees/payment-feature/artifacts/qa_report.json
âââ worktrees/ui-feature/artifacts/ (empty - awaiting development)
âââ .worktrees.json (management metadata)
âï¸EConfiguration
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââE
Max Concurrent Worktrees: 5
Auto QA: Enabled
Cleanup Policy: 7 days inactive
Terminal Auto-launch: Enabled
ð Recommended Actions
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââE
1. Start development in ui-feature worktree
2. Monitor QA results in payment-feature
3. Consider merging auth-feature (QA passed)
4. Review and cleanup old-experiment worktree
ð¡ Parallel Development Tips
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââE
- Each worktree has isolated node_modules and build artifacts
- QA runs automatically on file changes (debounced 2s)
- Use 'worktree-manager merge <name>' when ready to integrate
- Terminals auto-close on worktree removal
ð Performance Metrics
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââE
Worktree Creation Time: 2.3s average
QA Execution Time: 45.2s average
Terminal Launch Time: 1.1s average
Resource Usage: CPU 15%, Memory 250MB
Worktree Status JSON
{
"worktree_manager_report": {
"timestamp": "2026-01-04T15:30:00Z",
"operation": "parallel_environment_setup",
"duration_seconds": 45.2,
"environment_summary": {
"total_worktrees": 4,
"active_worktrees": 3,
"inactive_worktrees": 1,
"base_branch": "main",
"repository_path": "/path/to/project"
},
"worktrees": [
{
"name": "auth-feature",
"branch": "feature/auth",
"path": "/path/to/project/auth-feature",
"status": "active",
"qa_status": "qa_passed",
"terminal_pid": 12345,
"created_at": "2026-01-04T15:25:00Z",
"last_activity": "2026-01-04T15:28:33Z",
"qa_report_path": "/path/to/project/auth-feature/artifacts/qa_report.json"
}
],
"qa_integration": {
"service_active": true,
"monitored_worktrees": 3,
"recent_results": [
{
"worktree": "auth-feature",
"status": "passed",
"security_score": "A+",
"performance_score": "A",
"completed_at": "2026-01-04T15:28:33Z"
}
]
},
"performance_metrics": {
"avg_creation_time": 2.3,
"avg_qa_time": 45.2,
"cpu_usage_percent": 15,
"memory_usage_mb": 250
},
"recommendations": [
"Start development in ui-feature worktree",
"Monitor QA results in payment-feature",
"Consider merging auth-feature (QA passed)",
"Review and cleanup old-experiment worktree"
]
}
}
Worktree Operations
Creation Patterns
codex $worktree-manager "Create feature worktree for user authentication"
codex $worktree-manager "Create isolated worktree for critical bug fix"
codex $worktree-manager "Create experimental worktree for new architecture"
QA Integration
codex $worktree-manager "Create worktree with QA validation"
codex $worktree-manager "Run QA analysis on auth-feature worktree"
codex $worktree-manager "Enable background QA monitoring for all worktrees"
Lifecycle Management
codex $worktree-manager "Show status of all worktrees"
codex $worktree-manager "Merge auth-feature to main (QA validated)"
codex $worktree-manager "Cleanup inactive worktrees older than 7 days"
Worktree Architecture
Directory Structure
project/
âââ .git/ # Main repository
âââ main-workspace/ # Primary development
âââ worktrees/ # Worktree container
âE âââ feature-auth/ # Feature worktree
âE âE âââ .git -> ../.git # Git link
âE âE âââ src/ # Isolated source
âE âE âââ node_modules/ # Isolated dependencies
âE âE âââ artifacts/ # QA reports, builds
âE âE âââ .worktree_metadata # Worktree info
âE âââ feature-payment/ # Another feature
âE âââ experimental-ui/ # Experimental work
âââ .worktrees.json # Management metadata
âââ worktree-artifacts/ # Shared artifacts
Isolation Benefits
- Dependency Isolation: Each worktree has separate node_modules, target/
- Build Isolation: Independent build artifacts and caches
- QA Isolation: Separate QA reports and results per worktree
- Branch Isolation: Complete Git branch separation
Resource Management
- Automatic Cleanup: Inactive worktrees removed after configurable period
- Disk Usage Monitoring: Track worktree sizes and cleanup recommendations
- Process Management: Terminal processes tracked and cleaned up
- Git Maintenance: Worktree pruning and repository optimization
QA Integration Architecture
Background QA Service
qa_service = BackgroundQAService()
qa_service.add_worktree("feature-auth", Path("./worktrees/feature-auth"))
qa_service.start()
Pre-merge Validation
codex $worktree-manager "Setup pre-merge QA hooks"
git checkout main
git merge feature/auth
CI/CD Integration
- name: Worktree QA Validation
run: |
codex $worktree-manager "Validate all active worktrees"
codex $worktree-manager "Generate merge readiness report"
Configuration
Worktree Manager Settings
{
"worktree_manager": {
"base_path": "./worktrees",
"max_concurrent_worktrees": 5,
"auto_qa_enabled": true,
"qa_interval_seconds": 300,
"cleanup_inactive_days": 7,
"terminal_auto_launch": true,
"resource_monitoring": true
}
}
QA Integration Settings
{
"qa_integration": {
"background_service_enabled": true,
"file_change_debounce_seconds": 2.0,
"qa_timeout_seconds": 300,
"parallel_qa_limit": 2,
"auto_merge_qa_passed": false,
"notification_webhooks": [
"https://slack.com/webhook/...",
"https://discord.com/api/webhooks/..."
]
}
}
Git Integration
{
"git_integration": {
"auto_setup_hooks": true,
"pre_merge_qa_enabled": true,
"branch_naming_convention": "feature/*,bugfix/*,hotfix/*",
"merge_commit_messages": true,
"conflict_resolution_assistance": true
}
}
Performance Optimization
Worktree Creation
- Template Reuse: Copy from existing worktrees for faster setup
- Dependency Caching: Shared cache for common dependencies
- Parallel Setup: Concurrent worktree initialization
QA Execution
- Incremental Analysis: Only analyze changed files
- Caching: Cache analysis results across similar worktrees
- Parallel QA: Multiple worktrees analyzed simultaneously
Resource Management
- Memory Limits: Configurable memory limits per worktree
- Disk Quotas: Automatic cleanup when disk usage exceeds limits
- Process Limits: Terminal and background process management
Troubleshooting
Common Issues
Worktree Creation Failures
git worktree --help
git worktree prune --verbose
df -h
QA Integration Problems
codex $worktree-manager "Restart QA service"
codex $worktree-manager "Show QA service status"
codex $worktree-manager "Run QA on specific-worktree"
Terminal Launch Issues
which gnome-terminal || which konsole || which xterm
codex $worktree-manager "Launch terminal for worktree-name"
ulimit -u
Merge Conflicts
codex $worktree-manager "Validate worktree-name for merge"
cd worktrees/worktree-name
git mergetool
codex $worktree-manager "Merge worktree-name"
Best Practices
Development Workflow
- Create Descriptive Worktrees: Use clear names like
feature/user-auth-api
- Regular QA Checks: Run QA frequently during development
- Keep Worktrees Focused: One feature or fix per worktree
- Regular Merging: Don't let worktrees get too far behind main
- Clean Up Regularly: Remove completed or abandoned worktrees
QA Integration
- Early QA: Run QA as soon as worktree is created
- Continuous Monitoring: Keep background QA service running
- Address Issues Early: Fix QA issues before they compound
- Review QA Reports: Use reports to improve development practices
Resource Management
- Monitor Disk Usage: Regular cleanup of old worktrees
- Limit Concurrent Worktrees: Don't exceed system capacity
- Close Unused Terminals: Free up system resources
- Regular Maintenance: Run
git worktree prune periodically
Integration Examples
Development Team Workflow
codex $worktree-manager "Setup team worktrees for sprint"
codex $worktree-manager "Create my-feature worktree"
codex $worktree-manager "Mark my-feature ready for review"
codex $worktree-manager "Run QA on all ready worktrees"
codex $worktree-manager "Merge all qa-passed worktrees"
CI/CD Pipeline
- name: Setup Parallel Development
run: codex $worktree-manager "Create CI worktrees"
- name: Parallel QA Validation
run: codex $worktree-manager "Validate all worktrees"
- name: Merge Ready Worktrees
run: codex $worktree-manager "Auto-merge qa-passed worktrees"
- name: Cleanup
run: codex $worktree-manager "Cleanup completed worktrees"
Automated Maintenance
0 2 * * * codex $worktree-manager "Daily maintenance: cleanup old worktrees, update QA baselines"
References
Installation: $ codex $skill-install https://github.com/zapabob/codex-worktree-manager-skill
Version: 2.10.0
Compatibility: Codex v2.10.0+