$ show ourmem/omem
This repository implements a persistent memory server for AI agents, designed to solve the problem of agent amnesia across sessions, devices, and team members. The production system is a Rust-based HTTP server (Axum) that exposes a RESTful API with 48+ endpoints, backed by LanceDB for vector storage and supporting both hosted and self-hosted deployments. It ingests conversational or document data via an LLM-powered pipeline that extracts atomic facts, filters noise, scores admission, and reconciles with existing memories using seven operations (CREATE, MERGE, SUPERSEDE, etc.). The system manages a full memory lifecycle with Weibull decay, tier-based promotion/demotion, and auto-forgetting, and provides a multi-stage retrieval pipeline that combines vector search, BM25, cross-encoder reranking, decay boosting, and MMR diversity. Plugins for Claude Code, OpenCode, OpenClaw, and MCP allow client-side integration, and a GitHub connector ingests commits, issues, and PRs as memories. The architecture is multi-tenant with personal, team, and organization spaces, each isolated in separate LanceDB directories, and supports versioned, provenance-tracked sharing with staleness detection.
The LLM identified 3 files worth highlighting for reuse:
Defines the `EmbedService` trait with a single method to embed text into vectors. Provides a factory function `create_embed_service` that instantiates concrete implementations (Bedrock, OpenAI-compatible, Noop) from configuration. This pattern is self-contained, decouples embedding logic from the rest of the system, and can be extracted into a new project to support multiple embedding providers with minimal adaptation.
Analogous to the embed service, defines the `LlmService` trait for LLM calls (chat completion, embedding, etc.). The factory creates instances from config, supporting AWS Bedrock, OpenAI-compatible APIs, and a Noop provider. This modular design allows any LLM-dependent module to remain agnostic of the underlying provider, and the pattern is directly reusable in other Rust applications requiring abstracted LLM access.
Implements a cross-encoder-based reranker that takes a list of search results, scores them with a cross-encoder model, and reapplies a configurable threshold. The module is self-contained, with its own configuration and clear input/output (a list of scored `Memory` records). It demonstrates non-obvious skill in handling the reranking stage with fallback to original scores and a configurable cutoff, making it a reusable component for any retrieval pipeline that needs precision improvement.