-
Notifications
You must be signed in to change notification settings - Fork 5
Extension Development
OpenSoul is built on a plugin-centric architecture. Extensions can add new channels, tools, hooks, and providers.
Extensions live under extensions/<name>/ and are self-contained packages. They use the public Plugin SDK (opensoul/plugin-sdk) and should never import internal src/* modules directly.
A typical extension contains:
extensions/my-channel/
├── package.json
├── opensoul.plugin.json # Plugin manifest
├── index.ts # Entry point
├── src/ # Implementation
└── test/ # Tests
{
"name": "my-channel",
"version": "1.0.0",
"type": "channel",
"description": "My custom channel adapter",
"entry": "index.ts"
}Implement the ChannelPlugin contract to add new messaging platforms:
import type { ChannelPlugin } from "opensoul/plugin-sdk";
export const plugin: ChannelPlugin = {
name: "my-channel",
async onMessage(ctx) {
// Handle incoming messages
},
async send(ctx, message) {
// Send outgoing messages
},
};Add custom tools that agents can invoke:
import type { ToolPlugin } from "opensoul/plugin-sdk";
export const plugin: ToolPlugin = {
name: "my-tool",
description: "A custom tool",
async execute(ctx, params) {
// Tool implementation
return { result: "..." };
},
};Intercept and modify behavior at various lifecycle points:
import type { HookPlugin } from "opensoul/plugin-sdk";
export const plugin: HookPlugin = {
name: "my-hook",
async beforeAgentRun(ctx) {
// Modify context before agent execution
},
async afterAgentRun(ctx, result) {
// Process results after agent execution
},
};Add custom model providers or auth mechanisms.
The public API surface is available at opensoul/plugin-sdk (src/plugin-sdk/index.ts).
Important: External extensions must use this SDK — do not import from internal src/* paths.
-
Discovery — Gateway scans
extensions/for plugin manifests - Loading — Plugins are loaded and validated
- Registration — Plugins register with the plugin registry
- Runtime — Plugins receive events and API calls through the runtime API
Key source modules:
-
src/plugins/loader.ts— Plugin loading and discovery -
src/plugins/registry.ts— Plugin registration -
src/plugins/runtime/— Plugin runtime API
| Extension | Type | Description |
|---|---|---|
discord |
Channel | Discord bot integration |
telegram |
Channel | Telegram bot (grammY) |
slack |
Channel | Slack workspace integration |
whatsapp |
Channel | WhatsApp via Baileys |
signal |
Channel | Signal messenger |
matrix |
Channel | Matrix protocol |
feishu |
Channel | Feishu/Lark |
line |
Channel | LINE messaging |
msteams |
Channel | Microsoft Teams |
voice-call |
Feature | Voice call support |
memory-core |
Feature | Memory system core |
memory-lancedb |
Feature | LanceDB vector memory |
llm-task |
Feature | LLM task execution |
diagnostics-otel |
Feature | OpenTelemetry diagnostics |
copilot-proxy |
Feature | Copilot proxy |
Channel plugins can register config schemas and UI hints:
export const configSchema = {
type: "object",
properties: {
apiToken: {
type: "string",
description: "API token for the channel",
sensitive: true,
},
},
};The Control UI automatically renders forms for plugin config schemas.
Tests are colocated with extensions:
# Run extension tests
pnpm test --config vitest.extensions.config.ts- Architecture — Plugin system architecture
- Skills and Tools — Tool development
- Configuration — Plugin config
OpenSoul — Your AI Soul Companion | MIT License | Documentation
Getting Started
Core Concepts
Usage
Development
Links