From eb2eebae22bb2eba9d0ddbd77a1da4d0b5ab218d Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 6 Mar 2026 08:52:56 -0500 Subject: [PATCH] docs(plugins): document context engine slots and registration --- docs/tools/plugin.md | 51 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/docs/tools/plugin.md b/docs/tools/plugin.md index 4a20ec0c37c..087c89d38dc 100644 --- a/docs/tools/plugin.md +++ b/docs/tools/plugin.md @@ -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