canonicalCorpus never indexes: sync() is never invoked, and workspace resolution reads agents.list instead of agents.entries
Plugin version: 1.1.0-beta.11 (master)
OpenClaw: 2026.7.2-beta.6
Config: canonicalCorpus.enabled: true, syncOnSearch: true
With canonicalCorpus.enabled: true the in-place index silently stayed empty forever. Two independent causes.
1. canonicalCorpusIndexer.sync() is never called
dist/index.js constructs the indexer but never calls .sync(). The only call sites are in src/openclaw-memory-capability.js:
- the capability's
search()(gated oncanonicalCorpus.syncOnSearch) - the capability's
sync()
Both are only reachable when the host drives the memory capability via getActiveMemorySearchManager. But the plugin also registers its own memory_search / memory_get tools, so agent searches resolve to those tools and never touch the capability. Net result: the canonical corpus never indexes, with no error and no log.
Reproduce: enable canonicalCorpus, own the memory slot, restart, run a memory_search from an agent — the store gains no corpus: rows.
Suggested fix: kick a fire-and-forget sync() when the plugin service starts, and/or drive it on a timer from syncIntervalMs.
2. resolveCanonicalCorpusWorkspaces reads agents.list, but OpenClaw uses agents.entries
src/corpus-indexer.js:
const list = Array.isArray(agents?.list) ? agents.list : [];
for (const entry of list) { ... add(entry.workspace ?? ..., entry.id); }
OpenClaw stores agents as an object keyed by agent id under agents.entries, not an array under agents.list. The loop therefore matches nothing and the function falls through to its single-workspace fallback:
byWorkspace.set(join(homeDir, ".openclaw", "workspace"), new Set(["main"]));
So only the default workspace is ever indexed. In my case that silently missed 5 of 6 agent workspaces — and because the fallback "works", there is no symptom suggesting anything is wrong.
Supporting both shapes fixes it. After patching, resolveCanonicalCorpusWorkspaces returns all 6 workspaces and a sync reports:
indexed 2505/2505 canonical corpus chunk(s), 0 stale (startup) — from 796 document(s)
Happy to send a PR for either or both if useful.
Confirmed both on current master:
- No sync driver.
canonicalCorpusIndexer.sync()is only called fromsrc/openclaw-memory-capability.ts(capabilitysearch()withsyncOnSearch, and capabilitysync()). Nothing inindex.tstriggers it at service start or onsyncIntervalMs. So when agents use the plugin's ownmemory_searchtool, the corpus never indexes. agents.listonly.resolveCanonicalCorpusWorkspaces()insrc/corpus-indexer.tsstill reads onlyagents.list. Note thatsrc/session-recovery.tsand the md-mirror path inindex.ts(collectAgentWorkspaces(parsed?.agents?.entries, …)) already handle theagents.entriesobject form, so there's an existing pattern to reuse.
Both are real bugs, so yes, please send the PR. Splitting it in two would make review easier: (2) is a small, self-contained fix, while (1) needs a decision on start-up vs. timer-driven sync. Please add a regression test for each.