An extension is a directory installed under ~/.m31a/extensions/<name>/ with a manifest named m31a-extension.json. The loader is packages/cli/src/config/extension.ts and extension-manager.ts.
Minimal manifest
{
"name": "my-extension",
"version": "1.0.0"
}Both name and version are required.
Manifest fields
| Field | Type | Purpose |
|---|---|---|
name | string | Required; validated on load. |
version | string | Required. |
mcpServers | object | Named MCP server definitions contributed by the extension. |
contextFileName | string or array | Additional context files. |
excludeTools | array | Tools hidden while the extension is active. |
settings | array | User-configurable settings with ${...} variables. |
themes | array | Custom theme definitions. |
plan.directory | string | Plan artifact directory; must be relative and cannot contain ... |
migratedTo | string | Migration marker. |
A setting entry has name, description, envVar, and optional sensitive. Sensitive values go to the OS keychain; other values go to the extension's .env file. Workspace values take precedence over user values.
${...} variables in the manifest are hydrated from extensionPath, workspacePath, the path separator, and /.
Contribution directories
These are discovered from the extension folder rather than declared in the manifest:
| Path | Contribution |
|---|---|
skills/ | Agent skills with SKILL.md. |
agents/ | Agent definitions. |
hooks/hooks.json | Hook definitions shaped as { "hooks": { "<Event>": [...] } }, loaded only when hooksConfig.enabled is true. |
commands/*.toml | Custom slash commands. |
policies/*.toml | Policy rules. Extension rules cannot grant allow or YOLO. |
Themes are declared in the manifest's themes array.
Install metadata
Installed extensions contain .m31a-extension-install.json:
{
"source": "https://github.com/owner/repo.git",
"type": "git",
"ref": "main",
"autoUpdate": true
}type is git, local, link, or github-release; GitHub release installs also store releaseTag. Source options include allowPreRelease. A lock file is created as <extensionsDir>/<name>.lock via proper-lockfile.
Managing extensions
m31a extensions install <source>
m31a extensions list
m31a extensions link <path>
m31a extensions validate <path>
m31a extensions update [name]
m31a extensions disable <name>
m31a extensions enable <name>Use m31a -e <list> to limit which extensions load for one invocation and -l to list them. In the TUI, /extensions provides explore, reload, and config in addition to the CLI operations.
Security
- Review hook and MCP definitions as executable code.
security.blockGitExtensionsblocks Git-based installs;security.allowedExtensionsrestricts sources by regular expression.- Admin settings under
admin.extensionscan enforce organization policy.
Next steps
See Extensions and the bundled examples under packages/cli/src/commands/extensions/examples/.