Skip to content

Plugins and marketplaces

A plugin is a zip item like a skill. What it adds is a catalog: the tool reads a marketplace file that lists the plugins, and sofcat writes that file from whatever plugins are placed. The catalog is a placement file, rendered again after every install and removal.

Claude Code reads a local marketplace from a directory: a catalog at .claude-plugin/marketplace.json and one tree per plugin, here under plugins/. A managed-settings drop-in registers the marketplace and enables its managed plugins. This placement writes both; copy it and change the names and paths:

placements:
acme-marketplace:
paths:
darwin: /Library/Application Support/Acme/marketplace
windows: ${ProgramData}\Acme\marketplace
applies_to: [Claude Code]
exclusive: true
items_dir: plugins
vars:
name: acme
owner: {name: Acme IT}
# renames: {old-plugin: new-plugin}
# allowCrossMarketplaceDependenciesOn: [other-marketplace]
files:
- path: .claude-plugin/marketplace.json
template: |
{
"name": {{ json .Placement.Vars.name }},
"owner": {{ json .Placement.Vars.owner }},
{{- if ne (index .Placement.Vars "renames") nil }}
"renames": {{ json .Placement.Vars.renames }},
{{- end }}
{{- if ne (index .Placement.Vars "allowCrossMarketplaceDependenciesOn") nil }}
"allowCrossMarketplaceDependenciesOn": {{ json .Placement.Vars.allowCrossMarketplaceDependenciesOn }},
{{- end }}
"plugins": [
{{- range $i, $p := .Items }}{{ if $i }},{{ end }}
{
"name": {{ json $p.Name }},
"source": {{ json (printf "./plugins/%s" $p.Name) }},
"version": {{ json $p.Version }},
"defaultEnabled": {{ $p.Managed }}
}
{{- end }}
]
}
- paths:
darwin: /Library/Application Support/ClaudeCode/managed-settings.d/50-acme.json
windows: ${ProgramData}\ClaudeCode\managed-settings.d\50-acme.json
template: |
{{- if .Items }}
{{- $enabled := dict }}
{{- range .Items }}{{ if .Managed }}{{ $_ := set $enabled (printf "%s@%s" .Name $.Placement.Vars.name) true }}{{ end }}{{ end }}
{
"extraKnownMarketplaces": {
{{ json .Placement.Vars.name }}: {"source": {"source": "directory", "path": {{ json .Placement.Root }}}}
},
"enabledPlugins": {{ json $enabled }}
}
{{- end }}

vars is free data the templates read as .Placement.Vars. The catalog copies owner, and renames and allowCrossMarketplaceDependenciesOn when vars sets them. The output is canonical JSON, so map keys come out sorted. Plugins are sorted by name. version is the catalog version the receipt records. Bump it when a plugin’s files change, because a harness may not reload them otherwise. defaultEnabled is the receipt’s managed flag: true when a manifest lists the item in managed_installs. A run updates the flag only for items it decides. An item held by an unknown conditional_items condition keeps its recorded flag. With no plugin left, the catalog still lists "plugins": []. The source of each plugin names ./plugins/, the items_dir: change both together.

In the drop-in, path is .Placement.Root, the marketplace’s resolved path. enabledPlugins lists only the managed plugins, keyed <plugin>@<name>. When the marketplace holds no plugin, the template renders nothing and sofcat removes the file.

A managed enabledPlugins value cannot be turned off by the user. To enable a plugin and leave the choice to the user, add the keys to the user’s own settings.json instead, with a merge entry in the same files list:

- paths:
darwin: ${HOME}/.claude/settings.json
windows: ${USERPROFILE}\.claude\settings.json
scope: user
merge: add_if_absent
template: |
{"enabledPlugins": {
{{- range $i, $p := .Items }}{{ if $i }},{{ end }}
{{ json (printf "%s@%s" $p.Name $.Placement.Vars.name) }}: true
{{- end }}
}}

The per-user helper adds <plugin>@<name>: true for every plugin placed when the key is absent, and never changes a key that is there, so a user who sets one to false keeps it off. It takes back only the keys it added, when the plugin leaves the marketplace, and adds one again if claude plugin uninstall deleted it while the plugin is still placed. Unlike the drop-in, which lists only the managed plugins, this lists every plugin placed, optional ones included. The user roots must include ${HOME}/.claude/settings.json and ${USERPROFILE}\.claude\settings.json, or the directories holding them (Write roots). A .claude directory that is a symlink, such as into a dotfiles repository, is refused. See Merging into a user’s file.

The templates can also live in files of their own, named by template_file (Templates for placement files). The example repository does that.

A plugin’s item file lists the marketplace under placements (placements: [acme-marketplace]), and its tree holds the plugin’s files:

item-trees/example-plugin/
.claude-plugin/plugin.json
skills/release-notes/SKILL.md

Codex reads .agents/plugins/marketplace.json from a local marketplace in its own format. This entry writes it beside the Claude catalog above, with each plugin’s version stamped from its placed hash so Codex reloads a plugin whose rendered files changed (examples/placements.yaml carries the same template):

files:
- path: .agents/plugins/marketplace.json
template: |
{
"name": {{ json .Placement.Vars.name }},
"interface": {"displayName": {{ json .Placement.Vars.owner.name }}},
"plugins": [
{{- range $i, $p := .Items }}{{ if $i }},{{ end }}
{
"name": {{ json $p.Name }},
"version": "{{ $p.Version }}+{{ slice $p.PlacedHash 7 19 }}",
"source": {"source": "local", "path": "./plugins/{{ $p.Name }}"},
"policy": {
"installation": {{ if $p.Managed }}"INSTALLED_BY_DEFAULT"{{ else }}"AVAILABLE"{{ end }},
"authentication": "ON_INSTALL"
}
}
{{- end }}
]
}

slice $p.PlacedHash 7 19 takes twelve hex digits after the sha256: prefix. With two plugins placed, one managed, the file comes out as:

{
"interface": {
"displayName": "Acme IT"
},
"name": "acme",
"plugins": [
{
"name": "hello-plugin",
"policy": {
"authentication": "ON_INSTALL",
"installation": "INSTALLED_BY_DEFAULT"
},
"source": {
"path": "./plugins/hello-plugin",
"source": "local"
},
"version": "1.0.0+ffaa66a85382"
}
]
}

codex plugin marketplace add <placement root> then lists the plugins with those policies and versions.

One marketplace can hold plugins for Claude Code, for Codex and for both. Codex loads a plugin only when its tree ships .codex-plugin/plugin.json, so the Codex catalog should list only those. The template asks each tree with HasFile and takes the category from the plugin’s own manifest with ReadJSON, so nothing in vars repeats what the trees hold (Functions):

vars:
name: acme
owner: {name: Acme IT}
codex_authentication: {ci-plugin: ON_USE}
files:
- path: .agents/plugins/marketplace.json
template: |
{{- $plugins := list }}
{{- range $p := .Items }}{{ if $p.HasFile ".codex-plugin/plugin.json" }}
{{- $manifest := $p.ReadJSON ".codex-plugin/plugin.json" }}
{{- $auth := default "ON_INSTALL" (index $.Placement.Vars.codex_authentication $p.Name) }}
{{- $policy := dict "installation" "AVAILABLE" "authentication" $auth }}
{{- if $p.Managed }}{{ $_ := set $policy "installation" "INSTALLED_BY_DEFAULT" }}{{ end }}
{{- $plugins = append $plugins (dict
"name" $p.Name
"version" (printf "%s+%s" $p.Version (slice $p.PlacedHash 7 19))
"source" (dict "source" "local" "path" (printf "./plugins/%s" $p.Name))
"category" $manifest.interface.category
"policy" $policy) }}
{{- end }}{{ end }}
{
"name": {{ json .Placement.Vars.name }},
"interface": {"displayName": {{ json .Placement.Vars.owner.name }}},
"plugins": {{ json $plugins }}
}

The template builds the list of plugins with list, dict and append and encodes it once with json, so it places no commas itself. codex_authentication holds only the exceptions: default gives every plugin it does not name ON_INSTALL. The map must exist, even empty (codex_authentication: {}), because reading a vars key that is missing fails the render. So does a Codex manifest without interface.category.

The Claude catalog can leave out the plugins that are for Codex alone the same way, with {{ if $p.HasFile ".claude-plugin/plugin.json" }}.

Claude Desktop reads each organization plugin’s install behaviour from installationPreference in its .claude-plugin/plugin.json. One template serves managed and self-service plugins alike:

{
"name": {{ json .Item.Name }},
"version": {{ json .Item.Version }},
"description": "A managed Claude Desktop plugin",
"installationPreference": {{ if .Item.Managed }}"auto_install"{{ else }}"available"{{ end }}
}

Moving the item between optional_installs and managed_installs flips .Item.Managed, and the next run re-renders plugin.json in place with the same tree_hash and a new placed_hash. sofcat knows nothing of Claude Desktop’s values; the template does.

An MCP server configuration that attributes requests to the device’s user reads a fact an admin script provides and branches on a built-in (.mcp.json.tmpl):

{
"mcpServers": {
"chatproxy": {
"type": "http",
"url": "https://chatproxy.example.com/mcp",
"headers": {
"x-litellm-api-key": "Bearer {{ fact "assigned_user" }}/claudecode",
"x-platform": {{ if cond "os == \"windows\"" }}"windows"{{ else }}"macos"{{ end }}
}
}
}
}

Its record’s facts is {"assigned_user": "jdoe", "os": "windows"}; a new assigned_user from the script re-renders .mcp.json and nothing else. In user scope, {{ .User }} gives the login name without a script.

Both files are tree templates: they ship in the plugin’s tree with a .tmpl suffix and sofcat renders them on the device.