#22518: feat(extensions): add chromadb-memory plugin with multi-agent collection routing
size: L
## Summary
Adds a new `chromadb-memory` extension — a fully self-hosted long-term memory plugin backed by ChromaDB and local Ollama embeddings. No cloud APIs required.
## Features
- **Auto-recall**: Before every agent turn, the user's message is embedded via Ollama and queried against ChromaDB. Relevant results (above `minScore`) are injected into context automatically.
- **`chromadb_search` tool**: Manual semantic search over ChromaDB for when the agent needs to dig deeper.
- **Hybrid search**: Combines vector similarity with keyword boosting (capitalized proper nouns, quoted phrases) for better recall on named entities.
- **Multi-agent collection routing** (new): Set `collectionMap` to route different agents to different ChromaDB collections — keeps agent memories isolated without running separate plugin instances.
- **Backward compatible**: `collectionMap` is optional. If omitted, all agents use `collectionName` as before.
- **Per-collection ID cache**: Fixes a cross-agent cache collision bug where multiple agents sharing one plugin instance would incorrectly reuse each other's resolved collection IDs.
## Multi-agent config example
```json
{
"plugins": {
"entries": {
"chromadb-memory": {
"enabled": true,
"config": {
"chromaUrl": "http://localhost:8000",
"collectionName": "longterm_memory",
"collectionMap": {
"main": "longterm_memory",
"regina": "regina_memory"
},
"ollamaUrl": "http://localhost:11434",
"embeddingModel": "nomic-embed-text",
"autoRecall": true
}
}
}
}
}
```
## Schema change
- Added `collectionMap` property to `openclaw.plugin.json` config schema
- Changed `additionalProperties: false` → `true` to prevent validation failures as the plugin evolves
## Prerequisites
- ChromaDB running locally (Docker or native)
- Ollama with `nomic-embed-text` pulled
## Testing
Tested on a live OpenClaw setup with two agents (`main` + `regina`) sharing one gateway, each with their own ChromaDB collection. Hot-reload confirmed working — no gateway restart required when adding `collectionMap` to an existing config.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added a new `chromadb-memory` extension that provides self-hosted long-term memory backed by ChromaDB with local Ollama embeddings. The plugin features auto-recall (automatic context injection before agent turns), a manual `chromadb_search` tool, and hybrid search combining vector similarity with keyword boosting. The key enhancement is multi-agent collection routing via `collectionMap`, which allows different agents to use separate ChromaDB collections without running multiple plugin instances. This fixes a cross-agent cache collision bug where agents would incorrectly share resolved collection IDs.
**Key changes:**
- Per-collection ID cache to prevent cross-agent cache collisions
- Backward-compatible `collectionMap` configuration (optional, falls back to `collectionName`)
- Hybrid search with keyword extraction for proper nouns and quoted phrases
- Error handling with cache invalidation and retry logic
- Schema change: `additionalProperties: false` → `true` in config schema for forward compatibility
**Issues found:**
- The `before_agent_start` hook signature is incorrect - it should receive `(event, ctx)` with `agentId` in the second parameter `ctx`, not in `event`
<h3>Confidence Score: 3/5</h3>
- This PR contains a critical syntax error in the event handler that will cause the multi-agent routing feature to malfunction
- The implementation is well-structured and solves a real cross-agent cache collision bug, but has a critical bug in the `before_agent_start` hook signature that will prevent the multi-agent collection routing from working correctly. The `agentId` is being read from the wrong parameter (`event.agentId` instead of `ctx.agentId`), which means all agents will likely fall back to the default collection.
- Pay close attention to `extensions/chromadb-memory/index.ts` - the event handler signature needs correction before merging
<sub>Last reviewed commit: 2fefca8</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#8795: feat(memory): add Redis-backed long-term memory plugin
by tf-gmail · 2026-02-04
77.7%
#20338: feat: add daedalus-memory plugin — trust-gradient memory with tri-c...
by CmdrFALCO · 2026-02-18
73.5%
#14073: [wip]support OpenViking Memory Plugin
by Mijamind719 · 2026-02-11
72.8%
#19022: memory: support per-agent QMD collection paths
by Whoaa512 · 2026-02-17
72.5%
#19967: feat(memory): add semantic clustering and enhanced MMR
by alihassan6520 · 2026-02-18
71.9%
#9678: Cross-agent memory read allowlist
by Helmi · 2026-02-05
71.9%
#17030: feat(memory-lancedb): support Ollama and OpenAI-compatible embeddin...
by nightfullstar · 2026-02-15
71.7%
#19787: feat: Antigravity Fork - Token Economy, Mem0, sqlite-vec, Auto-Arch...
by msrovani · 2026-02-18
71.6%
#7088: feat: add Camb AI extension
by neilruaro-camb · 2026-02-02
71.6%
#3401: fix(memory-lancedb): improve autoCapture with turn-by-turn processing
by mike-nott · 2026-01-28
71.5%