openclaw - 💡(How to fix) Fix feat(memory): shared embedding cache across agents indexing same workspace — eliminates duplicate API calls [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#74264Fetched 2026-04-30 06:26:32
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
closed ×1commented ×1cross-referenced ×1

When multiple agents share the same workspace (e.g. sonnet-working and opus-strategic), identical document chunks are independently indexed and embedded in each agent's SQLite database, resulting in duplicate embedding API calls and wasted storage.

Root Cause

The duplication arises because each agent maintains its own chunks + embedding_cache tables and indexes workspace files independently, with no awareness of embeddings already computed by sibling agents.

RAW_BUFFERClick to expand / collapse

Summary

When multiple agents share the same workspace (e.g. sonnet-working and opus-strategic), identical document chunks are independently indexed and embedded in each agent's SQLite database, resulting in duplicate embedding API calls and wasted storage.

Evidence (OpenClaw 2026.4.25, audit 2026-04-28)

From a Pass 4 deep audit of four SQLite memory databases:

  • 3,773 identical chunk IDs found in BOTH sonnet-working.sqlite and opus-strategic.sqlite
  • 3,399 duplicate embedding API calls — the same content embedded twice, once per agent
  • 176 identical file paths indexed in both databases
  • Estimated wasted embedding spend: proportional to 3,399 unnecessary API calls per index cycle

The duplication arises because each agent maintains its own chunks + embedding_cache tables and indexes workspace files independently, with no awareness of embeddings already computed by sibling agents.

Impact

  • Storage bloat: identical vectors stored twice (~66 KB JSON text per embedding at current encoding)
  • Unnecessary API spend: every reindex cycle of the workspace triggers duplicate embedding API calls to the provider
  • Scales linearly with number of active agents sharing the same workspace

Proposed Fix

A shared embedding cache layer accessible to all agents indexing the same workspace root. Options:

  1. Shared embedding_cache table in a common DB path (e.g. ~/.openclaw/memory/shared.sqlite) keyed by content hash
  2. Deduplication at index time: before calling the embedding API, check if a sibling agent's DB already has an embedding for this chunk hash
  3. Memory v2 architecture (#67836) may address this structurally — if so, please link

Environment

  • OpenClaw 2026.4.25 (aa36ee6)
  • 4 agents sharing workspace-nexus: sonnet-working, opus-strategic, haiku-routine, gpt55-execution
  • Workspace: ~/.openclaw/workspace-nexus
  • Memory plugin: memory-core

extent analysis

TL;DR

Implementing a shared embedding cache layer among agents sharing the same workspace can mitigate duplicate embedding API calls and storage waste.

Guidance

  • Investigate using a shared embedding_cache table in a common DB path, such as ~/.openclaw/memory/shared.sqlite, to store embeddings keyed by content hash.
  • Consider deduplication at index time by checking if a sibling agent's DB already has an embedding for a given chunk hash before calling the embedding API.
  • Review the Memory v2 architecture (#67836) to determine if it structurally addresses this issue.
  • Evaluate the feasibility of implementing a shared cache layer given the current environment and agents' configurations.

Example

No code snippet is provided as the issue does not contain specific implementation details.

Notes

The proposed fix assumes that agents can access and share a common database or cache layer. The effectiveness of the solution may depend on the specific implementation and the agents' configurations.

Recommendation

Apply a workaround by implementing a shared embedding cache layer, as it can help reduce duplicate embedding API calls and storage waste, and potentially scale better with the number of active agents.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix feat(memory): shared embedding cache across agents indexing same workspace — eliminates duplicate API calls [1 comments, 2 participants]