Skip to content

OpenLabor/openclaw-memory-wiki

Repository files navigation

@openlabor/openclaw-memory-wiki

OpenLabor fork of OpenClaw's memory-wiki plugin with ctx-aware vault.path templating for multi-workspace deployments.

Why this fork exists

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:

Once both land upstream, this fork can be retired in favor of the bundled plugin.

What's the difference from bundled memory-wiki?

  1. Plugin id changed from memory-wiki to memory-wiki-plus to coexist with the bundled plugin without collision.
  2. resolveMemoryWikiConfigForCtx(base, ctx) helper in src/config.ts expands template tokens in vault.path against tool invocation context.
  3. All five tool factories (wiki_status, wiki_lint, wiki_apply, wiki_search, wiki_get) route through the new helper.
  4. 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.

Install

openclaw plugins install @openlabor/openclaw-memory-wiki

Or via git URL / local path if installing from source.

Configure

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"
          }
        }
      }
    }
  }
}

Supported template tokens

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.

Limitations

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.

Upstream sync workflow

The plugin tracks extensions/memory-wiki/ in openclaw/openclaw. To merge upstream changes:

  1. Diff upstream's extensions/memory-wiki/ against the vendored tree.
  2. Apply wanted changes to this package.
  3. Reapply the templating patch if any hunks were rejected.
  4. Run the smoke test (below).
  5. 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 their config argument through resolveMemoryWikiConfigForCtx(config, ctx).

Smoke test

npm install
npx tsx -e 'import("./index.ts").then(m => console.log(m.default.id))'
# expect: memory-wiki-plus

License

MIT — same as upstream OpenClaw. Copyright notices preserved.

About

OpenClaw memory-wiki fork with ctx-aware vault.path templating for multi-workspace deployments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors