Skip to content

Commit 423d4bd

Browse files
authored
Update docs: fix outdated info, add missing modules and benchmark details (#51)
1 parent b48f0a0 commit 423d4bd

3 files changed

Lines changed: 64 additions & 4 deletions

File tree

‎BENCHMARKS.md‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Measured on Apple M3 Max, 36GB RAM.
1313
| Recall@5 | 77.5% | 78.5% | 78.5% |
1414
| Recall@10 | 89.5% | 90.0% | 90.0% |
1515
| MRR | **61.9%** | 60.8% | 60.8% |
16+
| nDCG@5 | 58.7% | 59.9% | 59.9% |
1617
| Recency@1 | **100%** | 14% | 14% |
1718
| Consolidation | **99%** | 0% | 0% |
1819
| Store p50 | 49ms | 696ms | 16ms |
@@ -25,6 +26,57 @@ Measured on Apple M3 Max, 36GB RAM.
2526
- **Deduplication**: 99% consolidation rate — near-duplicates auto-merged. Others: 0%
2627
- **Latency**: 14x faster store than ChromaDB (49ms vs 696ms). All operations local, no network
2728

29+
## Category breakdown
30+
31+
### Recall@5 by category
32+
33+
| Category | Sediment | ChromaDB | Mem0 |
34+
|----------|----------|----------|------|
35+
| `architecture` | **82.9%** | 71.4% | 71.4% |
36+
| `code_patterns` | **88.6%** | **88.6%** | **88.6%** |
37+
| `cross_project` | 65.6% | **68.8%** | **68.8%** |
38+
| `project_facts` | 60.6% | **75.8%** | **75.8%** |
39+
| `troubleshooting` | 78.1% | **81.2%** | **81.2%** |
40+
| `user_preferences` | **87.9%** | 84.9% | 84.9% |
41+
42+
### MRR by category
43+
44+
| Category | Sediment | ChromaDB | Mem0 |
45+
|----------|----------|----------|------|
46+
| `architecture` | **66.8%** | 55.8% | 55.8% |
47+
| `code_patterns` | 70.4% | **71.1%** | **71.1%** |
48+
| `cross_project` | **50.7%** | 47.1% | 47.1% |
49+
| `project_facts` | 51.6% | **59.2%** | **59.2%** |
50+
| `troubleshooting` | **63.2%** | 62.8% | 62.8% |
51+
| `user_preferences` | 67.6% | **67.9%** | **67.9%** |
52+
53+
## Temporal correctness
54+
55+
| Metric | Sediment | ChromaDB | Mem0 |
56+
|--------|----------|----------|------|
57+
| Recency@1 | **100%** | 14% | 14% |
58+
| Recency@3 | **100%** | 94% | 94% |
59+
| MRR | **100%** | 48.8% | 48.8% |
60+
| Mean Rank | **1.00** | 2.38 | 2.38 |
61+
62+
## Latency
63+
64+
### Store latency
65+
66+
| Metric | Sediment | ChromaDB | Mem0 |
67+
|--------|----------|----------|------|
68+
| p50 | 49ms | 696ms | **16ms** |
69+
| p95 | 62ms | 726ms | **19ms** |
70+
| p99 | 88ms | 729ms | **20ms** |
71+
72+
### Recall latency
73+
74+
| Metric | Sediment | ChromaDB | Mem0 |
75+
|--------|----------|----------|------|
76+
| p50 | 103ms | 694ms | **8ms** |
77+
| p95 | 109ms | 728ms | **12ms** |
78+
| p99 | 132ms | 746ms | **12ms** |
79+
2880
## Methodology
2981

3082
- **Dataset**: 1,000 memories across 6 categories (architecture, code patterns, project facts, troubleshooting, user preferences, cross-project)

‎CLAUDE.md‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,17 @@ Sediment is a semantic memory system for AI agents, running as an MCP (Model Con
3939
### Core Components
4040

4141
- **`src/main.rs`** - CLI entry point with subcommands (init, stats, list) and MCP server startup
42-
- **`src/lib.rs`** - Library root exposing public API, project detection, and scope types
43-
- **`src/db.rs`** - LanceDB wrapper handling vector storage, search, and CRUD operations
42+
- **`src/lib.rs`** - Library root exposing public API, project detection, scope types, and project ID migration
43+
- **`src/db.rs`** - LanceDB wrapper handling vector storage, hybrid search (vector + FTS/BM25), and CRUD operations
4444
- **`src/embedder.rs`** - Local embeddings using `all-MiniLM-L6-v2` via Candle (384-dim vectors)
4545
- **`src/chunker.rs`** - Smart content chunking by type (markdown, code, JSON, YAML, text)
46+
- **`src/document.rs`** - ContentType enum for routing content to the appropriate chunker
47+
- **`src/item.rs`** - Unified Item, Chunk, SearchResult, StoreResult, and ConflictInfo types
4648
- **`src/access.rs`** - SQLite-based access tracking, validation counting, and memory decay scoring
4749
- **`src/graph.rs`** - SQLite graph store: relationship tracking (RELATED, SUPERSEDES, CO_ACCESSED, CLUSTER_SIBLING edges)
4850
- **`src/consolidation.rs`** - Background consolidation: auto-merging near-duplicates, linking similar items
51+
- **`src/error.rs`** - SedimentError enum with typed error variants (Database, Embedding, Arrow, etc.)
52+
- **`src/retry.rs`** - Retry utilities with exponential backoff (3 attempts, 100ms–2s)
4953

5054
### MCP Server (`src/mcp/`)
5155

@@ -67,7 +71,8 @@ Sediment is a semantic memory system for AI agents, running as an MCP (Model Con
6771
- **Two-database hybrid**: LanceDB for vectors, SQLite for graph relationships + mutable counters
6872
- **Single central database** at `~/.sediment/data/` stores all projects; graph + access at `~/.sediment/access.db`
6973
- **Project scoping** via UUID stored in `.sediment/config` per project
70-
- **Similarity boosting**: Same-project items get 1.15x boost, different projects 0.95x penalty
74+
- **Similarity boosting**: Same-project items unchanged, different projects get 0.875x penalty (12.5% spread)
75+
- **Hybrid search**: Vector similarity combined with FTS/BM25 scoring. BM25 boost is additive (max 0.12, power-law gamma 2.0). FTS index rebuilt on each store
7176
- **Conflict detection**: Items with >=0.85 similarity flagged on store and enqueued for consolidation
7277
- **Fresh DB connection per tool call** with shared embedder for efficiency
7378
- **Memory decay scoring**: Recall results re-ranked using freshness (hyperbolic decay, 0.5 at 30 days) and access frequency (log-scaled). Tracked in SQLite sidecar since LanceDB is append-oriented.
@@ -126,6 +131,8 @@ CREATE TABLE graph_edges (
126131
created_at INTEGER NOT NULL,
127132
UNIQUE(from_id, to_id, edge_type)
128133
);
134+
CREATE INDEX idx_edges_from ON graph_edges(from_id, edge_type);
135+
CREATE INDEX idx_edges_to ON graph_edges(to_id, edge_type);
129136

130137
-- Access tracking and decay scoring
131138
CREATE TABLE access_log (

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ All local, embedded, zero config:
160160

161161
- **Memory decay**: Results re-ranked by freshness (30-day half-life) and access frequency. Old memories rank lower but are never auto-deleted.
162162
- **Trust-weighted scoring**: Validated and well-connected memories score higher.
163-
- **Project scoping**: Automatic context isolation between projects. Same-project items get a similarity boost.
163+
- **Hybrid search**: Vector similarity combined with FTS/BM25 scoring for better retrieval quality.
164+
- **Project scoping**: Automatic context isolation between projects. Different-project items receive a similarity penalty.
164165
- **Relationship graph**: Items linked via RELATED, SUPERSEDES, and CO_ACCESSED edges. Recall expands results with 1-hop graph neighbors and co-access suggestions.
165166
- **Background consolidation**: Near-duplicates (≥0.95 similarity) auto-merged; similar items (0.85–0.95) linked.
166167
- **Type-aware chunking**: Intelligent splitting for markdown, code, JSON, YAML, and plain text.

0 commit comments

Comments
 (0)