Plugin startup: full git clone on every launch causes contention with multiple instances

Resolved 💬 3 comments Opened Feb 9, 2026 by benpchandler Closed Feb 13, 2026

Problem

Every time Claude Code starts, it does a full git clone of every GitHub-sourced plugin into a temp_git_TIMESTAMP directory, reads the manifest version, compares against the cached version, and discards the clone. There's no lightweight version check.

With multiple concurrent Claude Code sessions (common for developers using terminal multiplexers like zellij/tmux), this causes:

  1. Startup failures — concurrent clones to the same repos create network contention and filesystem race conditions. Sessions hang during git clone and never complete initialization.
  2. Orphaned temp directories — failed/interrupted clones leave temp_git_* dirs in the plugin cache. I found 574 orphaned directories consuming 1.2 GB of disk.
  3. Stale lock contention — version lock files held by dead PIDs block new sessions from starting (Cannot acquire lock for 2.1.37 - held by PID 50077 where PID 50077 no longer exists).

Reproduction

  1. Configure 5+ GitHub-sourced plugins in settings.json
  2. Open 3+ concurrent Claude Code sessions (e.g., in separate terminal tabs)
  3. Observe startup hangs and accumulating temp_git_* directories in ~/.claude/plugins/cache/

Environment

  • macOS (Darwin 25.2.0)
  • Claude Code 2.1.37
  • ~40 plugins across ~9 GitHub repos
  • 5-7 concurrent Claude Code sessions typical

Suggested improvements

Short term:

  • Use git ls-remote to check the latest commit hash before cloning — skip clone if cached version matches
  • Add a file-based mutex so only one instance clones a given repo at a time (others wait or use cache)
  • Clean up temp_git_* directories on startup (or use atomic rename instead of copy)
  • Stale lock detection — if the PID holding a lock is dead, break the lock automatically

Longer term:

  • Cache plugin manifests with a TTL (e.g., check for updates at most once per hour, not every launch)
  • Use GitHub API (GET /repos/:owner/:repo/commits/HEAD) for version checks instead of full clones
  • Support --no-plugins or --offline-plugins flag for quick sessions that don't need fresh plugins

Workaround

Periodic manual cleanup:

find ~/.claude/plugins/cache -maxdepth 1 -name 'temp_git_*' -type d -exec rm -rf {} +

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗