Skip to content

Commit eb2eeba

Browse files
committed
docs(plugins): document context engine slots and registration
1 parent f788ba1 commit eb2eeba

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

docs/tools/plugin.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,29 @@ Some plugin categories are **exclusive** (only one active at a time). Use
393393
plugins: {
394394
slots: {
395395
memory: "memory-core", // or "none" to disable memory plugins
396+
contextEngine: "legacy", // or a plugin id such as "lossless-claw"
396397
},
397398
},
398399
}
399400
```
400401

401-
If multiple plugins declare `kind: "memory"`, only the selected one loads. Others
402-
are disabled with diagnostics.
402+
Supported exclusive slots:
403+
404+
- `memory`: active memory plugin (`"none"` disables memory plugins)
405+
- `contextEngine`: active context engine plugin (`"legacy"` is the built-in default)
406+
407+
If multiple plugins declare `kind: "memory"` or `kind: "context-engine"`, only
408+
the selected plugin loads for that slot. Others are disabled with diagnostics.
409+
410+
### Context engine plugins
411+
412+
Context engine plugins own session context orchestration for ingest, assembly,
413+
and compaction. Register them from your plugin with
414+
`api.registerContextEngine(id, factory)`, then select the active engine with
415+
`plugins.slots.contextEngine`.
416+
417+
Use this when your plugin needs to replace or extend the default context
418+
pipeline rather than just add memory search or hooks.
403419

404420
## Control UI (schema + labels)
405421

@@ -465,6 +481,37 @@ Plugins export either:
465481
- A function: `(api) => { ... }`
466482
- An object: `{ id, name, configSchema, register(api) { ... } }`
467483

484+
Context engine plugins can also register a runtime-owned context manager:
485+
486+
```ts
487+
export default function (api) {
488+
api.registerContextEngine("lossless-claw", () => ({
489+
info: { id: "lossless-claw", name: "Lossless Claw", ownsCompaction: true },
490+
async ingest() {
491+
return { ingested: true };
492+
},
493+
async assemble({ messages }) {
494+
return { messages, estimatedTokens: 0 };
495+
},
496+
async compact() {
497+
return { ok: true, compacted: false };
498+
},
499+
}));
500+
}
501+
```
502+
503+
Then enable it in config:
504+
505+
```json5
506+
{
507+
plugins: {
508+
slots: {
509+
contextEngine: "lossless-claw",
510+
},
511+
},
512+
}
513+
```
514+
468515
## Plugin hooks
469516

470517
Plugins can register hooks at runtime. This lets a plugin bundle event-driven

0 commit comments

Comments
 (0)