Workspace providers: pluggable create/remove commands (rift, CoW clones, Worktrunk), with support for non-git directories and cleanup on settle #11266
evbuildsnet
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
T3 Code has one way to isolate a thread:
git worktree addinto~/.t3/worktrees. That path is hardcoded inGitVcsDriverCore.createWorktree, and everything around it assumes git:local, so every thread on that project shares one directory.node_modules,.env, build caches and generated files are gone, and therunOnWorktreeCreateaction has to rebuild them for every thread.Several discussions already ask for a piece of this: copy-on-write clones instead of worktrees (#10853), driving worktrees through Worktrunk (#8953), and cleaning up when a thread settles (#6856, #6999, #6864). They are all the same missing abstraction.
Proposal: workspace providers
Make the git worktree a provider, and let a project pick a different one. A provider is three things, configured in
t3.jsonor project settings:{ "workspace": { "create": "rift create --copy-all", // runs in the project dir, prints the workspace path "remove": "rift remove --force", // runs inside the workspace "requiresGit": false // default true; false lets plain directories use it } }Lifecycle:
createin the project directory, take the printed path as the thread'sworktreePath, start the session there. ExistingrunOnWorktreeCreateactions keep working since they only need the path.removeinside the workspace. Same guards the team named when closing feat(server): clean worktree build artifacts when threads settle #8771: skip while a session is running, while terminals are open, or while another thread references the path.createagain, exactly like the current "recreate a missing worktree on the next turn" behaviour.The built-in git provider is
git worktree add/git worktree removewithrequiresGit: true, so nothing changes for anyone who does not opt in.Motivating example: rift
rift makes copy-on-write clones of a directory using APFS
clonefile. It does not care whether the directory is a git repo, or whether it holds several repos side by side.rift create --copy-allgives a full clone in well under a second, includingnode_modulesand build output, so the agent starts warm.rift removemoves it to trash and unregisters it. It already has a.rift.tomlpostcreatehook and exposesRIFT_SOURCE/RIFT_DESTINATIONto it.I run this today by hand for every thread. The only thing missing is T3 Code calling it, and pointing the thread at the result.
Worktrunk (#8953) fits the same contract:
wt switch --create --json <branch>prints a path,wt removetears it down. A plaincp -cCoW clone (#10853) fits too.Smallest useful scope
workspace.createandworkspace.removeint3.json,requiresGitflag.createwheregit worktree addruns today and stores the path on the thread.thread.settledthat runsremovewith the guards above.No UI beyond what project settings already have for actions. Happy to contribute the implementation if this shape is welcome, and to fold it into the post-Orchestrator-V2 worktree lifecycle work the team mentioned in #8771.
All reactions