feat: add --copy-ai for AI session preservation in worktrees#4
Merged
Conversation
Adds extensible provider system that copies AI tool configs (.claude/, .codex/) on worktree create and archives sessions + syncs settings back on worktree remove. Supports Claude Code and Codex out of the box, new providers added by defining _ai_copy_<name> + _ai_save_<name> functions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Codex sessions are global (date-based), local .codex/skills/ contains relative symlinks that break when copied to a different path. Keep provider registered for future expansion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codex manages its own worktrees at ~/.codex/worktrees/ and sessions are not tied to project paths. Provider system remains extensible via GIT_WT_AI_PROVIDERS for future tools. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
--copy-aiflag togit wt newthat copies AI tool configs (.claude/settings.local.json,.codex/) into new worktreesgit wt rm, archives Claude Code sessions to~/.git-wt/<repo>/.ai-sessions/<name>/and syncs changed settings back to originGIT_WT_AI_PROVIDERSenv var — new AI tools supported by adding_ai_copy_<name>+_ai_save_<name>functionsGIT_WT_COPY_AI=trueenv var to enable permanently without the flagTest plan
make lint— shellcheck passesmake test— smoke test passesgit wt new --copy-ai test— verifies.claude/settings.local.jsoncopied and.git-wt-ai-syncmarker createdgit wt rm test— verifies settings synced back to origin if changedGIT_WT_COPY_AI=true git wt new test2— works without explicit flaggit wt clean— works with AI-enabled worktrees (calls rm internally).claude/or.codex/don't exist in origin🤖 Generated with Claude Code