Skip to content

feat: add --copy-ai for AI session preservation in worktrees#4

Merged
kuderr merged 5 commits into
mainfrom
feat/copy-ai
Feb 25, 2026
Merged

feat: add --copy-ai for AI session preservation in worktrees#4
kuderr merged 5 commits into
mainfrom
feat/copy-ai

Conversation

@kuderr
Copy link
Copy Markdown
Owner

@kuderr kuderr commented Feb 25, 2026

Summary

  • Adds --copy-ai flag to git wt new that copies AI tool configs (.claude/settings.local.json, .codex/) into new worktrees
  • On git wt rm, archives Claude Code sessions to ~/.git-wt/<repo>/.ai-sessions/<name>/ and syncs changed settings back to origin
  • Extensible provider system via GIT_WT_AI_PROVIDERS env var — new AI tools supported by adding _ai_copy_<name> + _ai_save_<name> functions
  • GIT_WT_COPY_AI=true env var to enable permanently without the flag

Test plan

  • make lint — shellcheck passes
  • make test — smoke test passes
  • git wt new --copy-ai test — verifies .claude/settings.local.json copied and .git-wt-ai-sync marker created
  • git wt rm test — verifies settings synced back to origin if changed
  • GIT_WT_COPY_AI=true git wt new test2 — works without explicit flag
  • git wt clean — works with AI-enabled worktrees (calls rm internally)
  • No errors when .claude/ or .codex/ don't exist in origin

🤖 Generated with Claude Code

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>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

kuderr and others added 4 commits February 25, 2026 13:33
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>
@kuderr kuderr merged commit b4c64c1 into main Feb 25, 2026
2 checks passed
@kuderr kuderr deleted the feat/copy-ai branch February 25, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant