|
| 1 | +--- |
| 2 | +globs: "**/.claude-plugin/**,**/plugin.json,**/install.sh,**/.mcp.json" |
| 3 | +description: "Plugin distribution: persistent state, seed dirs, marketplace policy, reserved names" |
| 4 | +domain: claude-code-engineering |
| 5 | +last_verified: 2026-05-05 |
| 6 | +--- |
| 7 | + |
| 8 | +# Plugin Distribution |
| 9 | + |
| 10 | +## Persistent state — `${CLAUDE_PLUGIN_DATA}` (v2.1.126+) |
| 11 | + |
| 12 | +- Plugin-scoped directory for state that must survive plugin updates/reinstalls |
| 13 | +- Available in hooks, skills, commands as the env var `${CLAUDE_PLUGIN_DATA}` |
| 14 | +- Use for: accumulated metrics, last-processed IDs, capture inboxes, manifests of managed projects |
| 15 | +- NEVER store secrets here — sandbox env-scrub does NOT cover plugin data dirs |
| 16 | +- Distinct from `${CLAUDE_PLUGIN_ROOT}` (read-only plugin install dir) |
| 17 | + |
| 18 | +For dotforge specifically: candidates to migrate are `practices/metrics.yml` (counters), `.forge/manifest.json` (registry), and post-session captures that currently land in `practices/inbox/` (which dirties git status). Migration is a multi-commit project — pilot one (e.g. `inbox/`) before others. |
| 19 | + |
| 20 | +## Multi-seed distribution — `CLAUDE_CODE_PLUGIN_SEED_DIR` |
| 21 | + |
| 22 | +- Accepts multiple directories separated by platform delimiter (`:` Unix, `;` Windows) |
| 23 | +- Layered overlay pattern: `seed1` (base) `:` `seed2` (corporate) `:` `seed3` (personal) |
| 24 | +- Use for: enterprise overlays on top of public template, personal preferences on top of team config |
| 25 | +- Later seeds override earlier ones for files with the same path |
| 26 | + |
| 27 | +## Marketplace governance (managed settings) |
| 28 | + |
| 29 | +- `strictKnownMarketplaces` — allowlist of marketplace sources (exact match, supports github/git/url/npm/file/directory/hostPattern) |
| 30 | +- `blockedMarketplaces` — denylist |
| 31 | +- `allowedChannelPlugins` — restricts which plugins can listen on `--channels` |
| 32 | +- `allowManagedPermissionRulesOnly` — locks projects to managed-only permission rules |
| 33 | +- `pluginTrustMessage` — custom warning shown on plugin trust prompts |
| 34 | + |
| 35 | +## Reserved names |
| 36 | + |
| 37 | +- `workspace` — reserved as MCP server name since v2.1.128. Plugins/projects using this name skipped with warning at startup. Audit `.mcp.json` and `mcp/` configs in dotforge stacks before declaring server names. |
| 38 | + |
| 39 | +## Lifecycle hygiene |
| 40 | + |
| 41 | +- `claude plugin prune` (v2.1.121+) — removes orphaned auto-installed dependencies |
| 42 | +- `plugin uninstall --prune` — cascades dependency cleanup |
| 43 | +- `--plugin-dir` accepts `.zip` archives (v2.1.128+) — alternative distribution path |
| 44 | + |
| 45 | +## When to plugin vs `.claude/` |
| 46 | + |
| 47 | +| Need | Use | |
| 48 | +|------|-----| |
| 49 | +| One-project customization, quick experiment | `.claude/` standalone | |
| 50 | +| Shared with team, versioned, namespaced skills | Plugin | |
| 51 | +| Enterprise governance (marketplace allowlist) | Plugin via managed settings | |
| 52 | +| State that must survive updates | Plugin + `${CLAUDE_PLUGIN_DATA}` | |
0 commit comments