mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
docs(plugins): document context engine slots and registration
This commit is contained in:
@@ -393,13 +393,29 @@ Some plugin categories are **exclusive** (only one active at a time). Use
|
||||
plugins: {
|
||||
slots: {
|
||||
memory: "memory-core", // or "none" to disable memory plugins
|
||||
contextEngine: "legacy", // or a plugin id such as "lossless-claw"
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
If multiple plugins declare `kind: "memory"`, only the selected one loads. Others
|
||||
are disabled with diagnostics.
|
||||
Supported exclusive slots:
|
||||
|
||||
- `memory`: active memory plugin (`"none"` disables memory plugins)
|
||||
- `contextEngine`: active context engine plugin (`"legacy"` is the built-in default)
|
||||
|
||||
If multiple plugins declare `kind: "memory"` or `kind: "context-engine"`, only
|
||||
the selected plugin loads for that slot. Others are disabled with diagnostics.
|
||||
|
||||
### Context engine plugins
|
||||
|
||||
Context engine plugins own session context orchestration for ingest, assembly,
|
||||
and compaction. Register them from your plugin with
|
||||
`api.registerContextEngine(id, factory)`, then select the active engine with
|
||||
`plugins.slots.contextEngine`.
|
||||
|
||||
Use this when your plugin needs to replace or extend the default context
|
||||
pipeline rather than just add memory search or hooks.
|
||||
|
||||
## Control UI (schema + labels)
|
||||
|
||||
@@ -465,6 +481,37 @@ Plugins export either:
|
||||
- A function: `(api) => { ... }`
|
||||
- An object: `{ id, name, configSchema, register(api) { ... } }`
|
||||
|
||||
Context engine plugins can also register a runtime-owned context manager:
|
||||
|
||||
```ts
|
||||
export default function (api) {
|
||||
api.registerContextEngine("lossless-claw", () => ({
|
||||
info: { id: "lossless-claw", name: "Lossless Claw", ownsCompaction: true },
|
||||
async ingest() {
|
||||
return { ingested: true };
|
||||
},
|
||||
async assemble({ messages }) {
|
||||
return { messages, estimatedTokens: 0 };
|
||||
},
|
||||
async compact() {
|
||||
return { ok: true, compacted: false };
|
||||
},
|
||||
}));
|
||||
}
|
||||
```
|
||||
|
||||
Then enable it in config:
|
||||
|
||||
```json5
|
||||
{
|
||||
plugins: {
|
||||
slots: {
|
||||
contextEngine: "lossless-claw",
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## Plugin hooks
|
||||
|
||||
Plugins can register hooks at runtime. This lets a plugin bundle event-driven
|
||||
|
||||
Reference in New Issue
Block a user