context-engine: pass runtime context to ContextEngineFactory (#67243)

Merged via squash.

Prepared head SHA: 9aca6a5af1
Co-authored-by: jarimustonen <1272053+jarimustonen@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
This commit is contained in:
Jari Mustonen
2026-04-29 04:21:14 +03:00
committed by GitHub
parent 12c52963ea
commit d8a600f2ad
15 changed files with 298 additions and 25 deletions

View File

@@ -122,7 +122,7 @@ A plugin can register a context engine using the plugin API:
import { buildMemorySystemPromptAddition } from "openclaw/plugin-sdk/core";
export default function register(api) {
api.registerContextEngine("my-engine", () => ({
api.registerContextEngine("my-engine", (ctx) => ({
info: {
id: "my-engine",
name: "My Context Engine",
@@ -154,6 +154,10 @@ export default function register(api) {
}
```
The factory `ctx` includes optional `config`, `agentDir`, and `workspaceDir`
values so plugins can initialize per-agent or per-workspace state before the
first lifecycle hook runs.
Then enable it in config:
```json5