zeroclaw/src/memory
khhjoe 00209dd899
feat(memory): add mem0 (OpenMemory) backend integration (#3965)
* feat(memory): add mem0 (OpenMemory) backend integration

- Implement Mem0Memory struct with full Memory trait
- Add history() audit trail, recall_filtered() with time/metadata filters
- Add store_procedural() for conversation trace extraction
- Add ProceduralMessage type to Memory trait with default no-op
- Feature-gated behind `memory-mem0` flag
- 9 unit tests covering edge cases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* style: apply cargo fmt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(memory): add extraction_prompt config, deploy scripts, and timing instrumentation

- Add `extraction_prompt` field to `Mem0Config` for custom LLM fact
  extraction prompts (e.g. Cantonese/Chinese content), with
  `MEM0_EXTRACTION_PROMPT` env var fallback
- Pass `custom_instructions` in mem0 store requests so the server
  uses the client-supplied prompt over its default
- Add timing instrumentation to channel message pipeline
  (mem_recall_ms, elapsed_before_llm_ms, llm_call_ms, total_ms)
- Add `deploy/mem0/` with self-hosted mem0 + reranker GPU server
  scripts, fully configurable via environment variables
- Update config reference docs (EN, zh-CN, VI) with `[memory.mem0]`
  subsection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

# Conflicts:
#	src/channels/mod.rs

* chore: remove accidentally staged worktree from index

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:22:44 -04:00
..
backend.rs feat(memory): add mem0 (OpenMemory) backend integration (#3965) 2026-03-20 18:22:44 -04:00
chunker.rs perf: eliminate unnecessary heap allocations across agent loop, memory, and channels 2026-02-19 07:06:27 -08:00
cli.rs chore(fmt): apply rustfmt after main rebase 2026-02-21 12:09:06 +08:00
consolidation.rs fix(agent): prevent duplicate tool schema injection in XML dispatcher (#3744) 2026-03-16 18:38:44 -04:00
embeddings.rs fix(memory): add openrouter as recognized embedding provider 2026-02-19 15:10:25 -05:00
hygiene.rs Addressed clippy lint issues 2026-03-10 01:48:19 -04:00
knowledge_graph.rs feat(knowledge): add knowledge graph for expertise capture and reuse (#3596) 2026-03-17 01:11:29 -04:00
lucid.rs fix(tests): increase lucid memory test timeouts to prevent flakiness 2026-02-21 12:01:38 +08:00
markdown.rs chore: Remove blocking read strings 2026-02-19 14:52:29 +08:00
mem0.rs feat(memory): add mem0 (OpenMemory) backend integration (#3965) 2026-03-20 18:22:44 -04:00
mod.rs feat(memory): add mem0 (OpenMemory) backend integration (#3965) 2026-03-20 18:22:44 -04:00
none.rs feat(memory): add session_id isolation to Memory trait (#530) 2026-02-17 07:44:05 -05:00
postgres.rs fix(memory): avoid tokio runtime panic when initializing postgres backend 2026-02-20 16:21:25 +08:00
qdrant.rs fix(channels,memory): Docker workspace path remapping, vision support, and Qdrant backend restore (#1) 2026-02-24 16:03:01 +08:00
response_cache.rs feat(cache): wire two-tier response cache, multi-provider token tracking, and cache analytics 2026-03-16 12:44:48 -04:00
snapshot.rs fix(build): complete strict lint and test cleanup (replacement for #476) 2026-02-18 00:18:54 +08:00
sqlite.rs fix(security): prevent cleartext logging of sensitive data 2026-02-18 20:12:45 -08:00
traits.rs feat(memory): add mem0 (OpenMemory) backend integration (#3965) 2026-03-20 18:22:44 -04:00
vector.rs fix: resolve all clippy --all-targets warnings across 15 files 2026-02-14 03:52:57 -05:00