[FEATURE] Use sparse checkout for plugin installs — only fetch shipping assets, not entire repo
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When Claude Code installs a plugin (via marketplace or direct install), it performs a full git clone of the source repository. This means every file in the repo — tests, CI configs, development tooling, documentation source, images, etc. — is downloaded to the user's machine, even though only the plugin directory is a shipping asset.
This has two problems:
- Performance: Full clones are unnecessarily slow and disk-heavy, especially for monorepos or repos with large non-plugin content (media, test fixtures, etc.).
- Shipping asset boundary (more important): Files outside the plugin directory are development artifacts — tests,
.github/workflows,.config/, contributor docs, build scripts, etc. These are not intended to be distributed to end users. Fetching them conflates "installing a plugin" with "cloning a development environment." Plugin consumers should only receive what plugin authors intend to ship.
Proposed Solution
Use Git's partial clone + sparse checkout to fetch only the plugin subdirectory:
# 1. Partial clone — no blobs downloaded yet
git clone --filter=blob:none --sparse --depth=1 <repo-url>
cd <repo>
# 2. Sparse checkout — only materialize the plugin path
git sparse-checkout set <plugin-path>
| Flag | Effect |
|---|---|
| --filter=blob:none | Partial clone — skips downloading file content until needed |
| --sparse | Enables sparse checkout (only root files initially) |
| --depth=1 | Shallow — only the latest commit, no history |
For marketplace installs, the flow becomes:
- Sparse-clone with only
.claude-plugin/to readmarketplace.json - Parse
pluginRootand plugin source paths git sparse-checkout add <plugin-dirs>to fetch only declared plugins
This is well-supported by GitHub's servers and requires Git 2.25+.
Alternative Solutions
| Approach | Downside |
|---|---|
| Full clone (status quo) | Downloads non-shipping content; slower |
| --depth=1 only (shallow clone) | Still downloads all files across the tree |
| Download tarball of subdirectory via GitHub API | Loses git-based update/ref mechanism |
Priority
Medium
Feature Category
Plugin management
Additional Context
- Git partial clone + sparse checkout is production-ready and used at scale (e.g., by large monorepos at Microsoft, Google).
- GitHub's servers fully support
--filter=blob:noneand--filter=tree:0. - Prior issue #28426 requested this from a performance angle but was auto-closed as stale. This issue reframes around the shipping asset boundary: plugin consumers should only receive files that plugin authors intend to distribute.
- See also #15439 and #30593 for related subdirectory/path support discussions.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗