<!-- source: https://deepwiki.com/openclaw/openclaw/5-extensions -->

# Extensions

- docs/plugins/manifest.md
- extensions/feishu/openclaw.plugin.json
- src/gateway/server-startup-log.test.ts
- src/gateway/server-startup-log.ts
- src/gateway/server.lazy.test.ts
- src/infra/git-commit.test.ts
- src/infra/npm-managed-root.test.ts
- src/infra/npm-managed-root.ts
- src/plugins/config-contract-matches.ts
- src/plugins/config-contracts.test.ts
- src/plugins/config-contracts.ts
- src/plugins/discovery-threading.test.ts
- src/plugins/discovery.test.ts
- src/plugins/discovery.ts
- src/plugins/install.npm-spec.e2e.test.ts
- src/plugins/install.npm-spec.test.ts
- src/plugins/install.test.ts
- src/plugins/install.ts
- src/plugins/installed-plugin-index-registry.ts
- src/plugins/installed-plugin-index-types.ts
- src/plugins/loader.native-module-loader.test.ts
- src/plugins/loader.runtime-registry.test.ts
- src/plugins/loader.test-fixtures.ts
- src/plugins/loader.test.ts
- src/plugins/loader.ts
- src/plugins/manifest-registry.test.ts
- src/plugins/manifest-registry.ts
- src/plugins/manifest-tool-availability.ts
- src/plugins/manifest.ts
- src/plugins/package-entry-resolution.ts
- src/plugins/plugin-graceful-init-failure.test.ts
- src/plugins/plugin-sdk-dist-alias.ts
- src/plugins/registry.ts
- src/plugins/runtime/standalone-runtime-registry-loader.test.ts
- src/plugins/tools.optional.test.ts
- src/plugins/tools.ts
- src/security/dangerous-config-flags-current-snapshot.test.ts
- src/security/dangerous-config-flags-current.ts
- src/security/dangerous-config-flags.ts
- test/helpers/gateway-e2e-harness.test.ts
- test/helpers/gateway-e2e-harness.ts

Extensions provide OpenClaw's primary mechanism for adding new capabilities without modifying core source code. There are two main extension types supported by OpenClaw:

- Plugins - Modular TypeScript/JavaScript packages that register runtime capabilities such as model providers, tools, hooks, and channels.
- Skills - Markdown-based agent capability definitions that provide instructions, examples, and guiding context for agent behavior.

This page gives a high-level overview of these extension types, their architecture, and integration into the system. For deep technical detail and usage, see the respective child pages:

- Plugin Architecture - Full SDK reference, plugin registration API, exports, and discovery mechanisms.
- Skills System - SKILL.md format, requirements, installation, and execution model.
- Plugin Examples - Walkthroughs of OAuth plugins like Google Gemini CLI and Qwen Portal, including provider registration and authentication flows.

## Extension Types

Plugins are code-driven extensions that integrate deeply with OpenClaw's runtime system via the `OpenClawPluginApi` [src/plugins/loader.ts169-174](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L169-L174) while skills augment agent behavior through natural language instructions and examples.

Sources: [src/plugins/loader.ts169-174](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L169-L174) [src/plugins/registry.ts168-175](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/registry.ts#L168-L175)

## Plugin System Architecture

OpenClaw's plugin system organizes plugin discovery, registration, and runtime integration into well-defined components. The system is "manifest-first," meaning it reads `openclaw.plugin.json` to validate configuration and determine capabilities before executing any plugin code [src/plugins/loader.ts101-104](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L101-L104)

Title: Plugin Architecture and Code Entity Mapping

```

```

**Discovery and Installation:**

OpenClaw discovers plugins by searching paths in priority order:

1. Explicit paths configured in plugins.load.paths .
2. Workspace extensions folder .openclaw/extensions/ src/plugins/loader.test.ts 208-212
3. Bundled plugins directory defined by OPENCLAW_BUNDLED_PLUGINS_DIR src/plugins/loader.test.ts 203-204

For external extensions, OpenClaw manages a specialized installation process in `src/plugins/install.ts` that ensures isolation using a managed npm root [src/infra/npm-managed-root.ts15-20](https://github.com/openclaw/openclaw/blob/fbdf5937/src/infra/npm-managed-root.ts#L15-L20) This system handles integrity checks and peer dependency linking [src/plugins/install.ts68-70](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/install.ts#L68-L70)

Sources: [src/plugins/loader.ts57-60](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L57-L60) [src/plugins/loader.test.ts203-204](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.test.ts#L203-L204) [src/plugins/loader.test.ts208-212](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.test.ts#L208-L212) [src/plugins/loader.ts101-104](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L101-L104) [src/infra/npm-managed-root.ts15-20](https://github.com/openclaw/openclaw/blob/fbdf5937/src/infra/npm-managed-root.ts#L15-L20) [src/plugins/install.ts68-70](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/install.ts#L68-L70)

## Plugin SDK and Runtime Integration

OpenClaw provides a typed Plugin SDK that defines the interface between plugins and the Gateway core. The system uses a `PluginModuleLoaderCache` to handle module isolation and reloading [src/plugins/loader.ts125-128](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L125-L128)

Plugins operate in runtimes where they can access core services. Modern plugins use `register(api)` to declare capabilities such as text inference, speech, and image generation [src/plugins/loader.ts169-174](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L169-L174)

Sources: [src/plugins/registry.ts140](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/registry.ts#L140-L140) [src/plugins/loader.ts149](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L149-L149) [src/plugins/loader.ts169-174](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L169-L174) [src/plugins/loader.ts58](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L58-L58)

## Plugin Registration Flow

Title: Plugin Lifecycle and Registration API

```

```

Plugins implement a `register(api: OpenClawPluginApi)` method [src/plugins/loader.test.ts155](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.test.ts#L155-L155) The `OpenClawPluginApi` (built via `buildPluginApi` in `src/plugins/api-builder.ts`) provides methods to register:

- Providers: LLM text inference, speech (TTS/STT), image generation, and media understanding src/plugins/registry.ts 124-125
- Tools: Agent tools via factories that create tool instances src/plugins/registry.ts 151-155
- Hooks: Lifecycle hooks that allow plugins to intercept core events src/plugins/registry.ts 32-33
- Channels: Messaging platform integrations (Telegram, Discord, etc.) src/plugins/loader-channel-setup.ts 79-81

Sources: [src/plugins/loader.test.ts155](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.test.ts#L155-L155) [src/plugins/registry.ts124-125](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/registry.ts#L124-L125) [src/plugins/registry.ts151-155](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/registry.ts#L151-L155) [src/plugins/loader-channel-setup.ts79-81](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader-channel-setup.ts#L79-L81)

## Plugin Slots (Exclusive Categories)

OpenClaw manages some critical roles as exclusive "slots." Only one plugin can be active in a slot at a time, preventing conflicting behaviors in core subsystems.

Slot decisions are resolved during the plugin activation phase [src/plugins/loader.ts50-53](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L50-L53) via `resolveMemorySlotDecision` [src/plugins/loader.ts50](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L50-L50)

Sources: [src/plugins/loader.ts50-53](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.ts#L50-L53) [src/plugins/loader.test.ts11](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.test.ts#L11-L11)

## Skills System Overview

Skills are natural language powered agent capabilities expressed in markdown-formatted `SKILL.md` files. They allow users to extend agent behavior without writing TypeScript code.

Title: Skill Discovery and Loading

```

```

**Key Features:**

- ClawHub Integration: Skills can be discovered and installed from community collections via ClawHub.
- Managed Skills: Skills bundled within the repository (e.g., ./skills ) or installed into the workspace.
- Natural Language Definitions: Uses instructions and examples to guide the LLM's reasoning, with frontmatter for metadata and requirements.

The skills system interacts with the runtime through a status report which tracks eligibility, missing requirements, and installation options.

## Extension Examples

OpenClaw includes several reference implementations demonstrating the extension model:

- Memory Core: The default memory implementation utilizing registerMemoryCapability src/plugins/loader.test.ts 88
- Channel Plugins: Bundled integrations for platforms like Telegram, utilizing api.registerChannel src/plugins/loader.test.ts 153-175
- OAuth Providers: Complex provider plugins that implement OAuth handlers for interactive flows, such as Google Gemini or Qwen src/plugins/registry.ts 275-276
- Tool Factories: Implementation of optional and multi-tool registries src/plugins/tools.optional.test.ts 91-102

For details, see [Plugin Examples](/openclaw/openclaw/5.3-plugin-examples).

Sources: [src/plugins/loader.test.ts88](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.test.ts#L88-L88) [src/plugins/loader.test.ts153-175](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/loader.test.ts#L153-L175) [src/plugins/registry.ts275-276](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/registry.ts#L275-L276) [src/plugins/tools.optional.test.ts91-102](https://github.com/openclaw/openclaw/blob/fbdf5937/src/plugins/tools.optional.test.ts#L91-L102)
