[Feature]: Support Git Worktree
Pre-submission Checklist
- [x] I have searched existing issues and discussions
- [x] I have read the documentation
- [x] This is a feature request, not a bug report
Problem Statement
As a terminal user, I want a simple way to branch out and develop new features using worktrees. Currently I use a few skills to manage these worktrees, and adding a native feature would make creating them much easier.
Proposed Solution
CLIO should support creating a worktree at any stage of the feature development process. This includes creating the worktree at the very beginning of a feature or after the planning documents are completed. The system should then branch off into the new worktree, copy the necessary files, and prepare the environment so implementation can begin immediately.
Which area would this affect?
Developer Experience
Alternatives Considered
I use 3 skills to use worktree-start, worktree-merge and worktree-cleanup to help with worktree management.
Examples / References
No response
Would you be willing to contribute?
Maybe, with guidance
Additional Context
No response
Automated Triage Summary
| Field | Value |
|---|---|
| Classification | enhancement |
| Priority | medium |
| Completeness | 90% |
Analysis: Feature request: native Git worktree support. The VersionControl tool (lib/CLIO/Tools/VersionControl.pm) implements a fixed set of git operations and does not implement git worktree commands. Implementing this feature requires adding a 'worktree' operation (or discrete worktree_* operations) to supported_operations and route_operation, implementing the git worktree shell calls (add/list/remove/prune) with the same sandbox/path resolution and cwd handling used elsewhere, and ensuring worktree ops integrate with existing git-lock coordination to avoid races. Tests and documentation should be added. Confidence is high because I inspected VersionControl.pm and confirmed no worktree handling exists.
Root Cause Analysis
Confidence: high
Relevant files:
lib/CLIO/Tools/VersionControl.pm
Relevant functions:
route_operationbranch_is_git_repoget_additional_parameters
This repository's git-related functionality is implemented in lib/CLIO/Tools/VersionControl.pm. The VersionControl tool exposes a fixed set of supported_operations (status, log, diff, branch, commit, push, pull, blame, stash, tag). There is no 'worktree' operation or code paths that call git worktree (add/list/remove/prune). To support native worktree workflows the VersionControl tool should be extended: add a new 'worktree' operation (or separate operations like worktree_add/worktree_list/worktree_remove), update supported_operations and route_operation to handle it, implement the necessary git commands (git worktree add/list/remove/prune) with the same sandbox checks and cwd handling already used by other methods, and extend get_additional_parameters to accept worktree-specific params (path, branch/ref, create-branch flag, prune flag). Additionally, the tool coordinates git access via the broker (git lock) in commit(); worktree creation/removal may need to participate in that coordination to avoid races. Finally, tests and documentation must be added for the new operation. Confidence: high (I read VersionControl.pm and confirmed the supported_operations list and absence of worktree handling).
Affected Areas
- lib/CLIO/Tools/VersionControl.pm
- lib/CLIO/Coordination/Broker.pm (git lock coordination)
- tests/ (need new unit tests for worktree ops)
- docs/ (usage docs for version_control tool)
- tool registry/Tool.pm (if any operation metadata needs updating)
This is an automated analysis. A maintainer will review shortly.
Were you wanting to implement this feature? Let me know, and I can help you get started. CLIO is very self sufficient, you may be able to just point Opus at this issue and ask the agent to help you develop the plan.
Edit: If not, no worries I can look into it. Just wanted to see if you were interested first. :)
Yes, I am interested. Let me attempt it and fork it to follow your guidance.
Sounds good, happy to answer any questions that you have as you work.
@devdnn I'm going to use your PR to improve my review agent, you'll see reviews come and go, you can ignore that. After I finish that up I'll review your PR myself. :)
Commenting here, because once I comment there the agent will ignore the PR.
@devdnn I'm going to use your PR to improve my review agent, you'll see reviews come and go, you can ignore that. After I finish that up I'll review your PR myself. :)
Commenting here, because once I comment there the agent will ignore the PR.
Please let me know with the final feedback and I can work on it and will fix those.
No problem, almost there - the agent is providing useful responses now if you want to start using them. I may have a few more changes to make later today, and I'll have time to review your PR later today.