OpenLabor fork of OpenClaw's memory-wiki plugin with ctx-aware vault.path templating for multi-workspace deployments.
OpenClaw's bundled memory-wiki resolves vault.path once at register(api) time, so a single OpenClaw instance cannot serve agents across multiple workspaces without all of them writing to the same vault. This fork lets vault.path reference per-invocation context tokens ({workspaceDir}, {agentDir}, {agentId}, {sessionKey}), expanded on each wiki tool call. One plugin instance, per-workspace vaults.
OpenLabor uses this to give each organization its own wiki: agents in workspace {WORKSPACES_PATH}/{orgSlug}/{templateId} share a vault at {WORKSPACES_PATH}/{orgSlug}/wiki via the config vault.path: "{workspaceDir}/../wiki".
Upstream PRs tracking this work:
- openclaw/openclaw#66134 — factory registration for wiki_apply/status/lint (prerequisite).
- openclaw/openclaw#66149 — ctx-aware vault.path templating.
Once both land upstream, this fork can be retired in favor of the bundled plugin.
- Plugin id changed from
memory-wikitomemory-wiki-plusto coexist with the bundled plugin without collision. resolveMemoryWikiConfigForCtx(base, ctx)helper insrc/config.tsexpands template tokens invault.pathagainst tool invocation context.- All five tool factories (
wiki_status,wiki_lint,wiki_apply,wiki_search,wiki_get) route through the new helper. - Identity fast path — non-templated vault paths skip the expansion entirely; zero allocation overhead for single-workspace deployments.
Everything else — gateway methods, CLI surfaces, structured claims, provenance, dashboards, Obsidian integration — is identical to the bundled plugin.
openclaw plugins install @openlabor/openclaw-memory-wikiOr via git URL / local path if installing from source.
Disable the bundled memory-wiki plugin, then enable this one with a templated vault path:
{
plugins: {
entries: {
"memory-wiki": { enabled: false },
"memory-wiki-plus": {
enabled: true,
config: {
vault: {
path: "{workspaceDir}/../wiki"
}
}
}
}
}
}| Token | Source |
|---|---|
{workspaceDir} |
Active agent's workspace directory |
{agentDir} |
Active agent's private directory |
{agentId} |
Active agent id |
{sessionKey} |
Active session key |
Templates are expanded at tool-invocation time. Path traversal segments (..) normalize after expansion, so {workspaceDir}/../wiki resolves to the parent of workspaceDir plus /wiki.
Template expansion runs only for the five wiki tool surfaces. The openclaw wiki CLI and non-agent gateway methods (wiki.doctor, wiki.init, etc.) have no invocation context and use the literal configured path. If you template vault.path, the CLI will see the raw template string — keep the CLI out of those flows or configure a fallback.
The plugin tracks extensions/memory-wiki/ in openclaw/openclaw. To merge upstream changes:
- Diff upstream's
extensions/memory-wiki/against the vendored tree. - Apply wanted changes to this package.
- Reapply the templating patch if any hunks were rejected.
- Run the smoke test (below).
- Bump the version and publish.
The templating patch lives in two files:
src/config.ts— types and helpers:VaultPathTemplateContext,containsVaultPathTemplate,expandVaultPathTemplate,resolveMemoryWikiConfigForCtx.index.ts— five tool factories route theirconfigargument throughresolveMemoryWikiConfigForCtx(config, ctx).
npm install
npx tsx -e 'import("./index.ts").then(m => console.log(m.default.id))'
# expect: memory-wiki-plusMIT — same as upstream OpenClaw. Copyright notices preserved.