Fractal memory system for Claude Code
Project description
Oubli
Oubli: French for "forgetting." (Also a West African fruit so sweet it makes babies forget their mother's milk.)
A memory system that never forgets. Persistent fractal memory for Claude Code.
Features
- Fractal in Both Directions - Synthesize raw memories into insights, drill down from insights to source details
- Hybrid Search - Combines BM25 keyword search + semantic embeddings for intelligent retrieval
- Core Memory - Essential facts about you (~2K tokens), loaded in every conversation
- Proactive Memory - Claude searches and saves automatically, no prompting needed
- Immediate Updates - Family, work, and identity changes update Core Memory instantly
- Quiet Operation - Memory operations happen silently in the background
- Local-First - All data stays on your machine, no external services
Installation
pip install oubli
oubli setup
Then restart Claude Code. The embedding model (~80MB) downloads on first use.
Requirements
- Python 3.10+
- Claude Code CLI installed
Uninstall
oubli uninstall
pip uninstall oubli
How It Works
Fractal Memory Hierarchy
The memory system is fractal in both directions:
┌─────────────────────────────────────────┐
│ CORE MEMORY │
│ (~2K tokens, always in context) │
│ │
│ Identity, family, work, preferences │
└─────────────────────┬───────────────────┘
│
▲ synthesis │ drill-down ▼
│
Level 2 ○ "Deeply technical, values efficiency"
╲
Level 1 ○ ○ "Loves jazz fusion" "Python expert"
╲│
Level 0 ○○○○ Raw memories with full conversation text
- Upward (Synthesis): Raw memories consolidate into higher-level insights
- Downward (Drill-down): From any insight, retrieve its source memories for full detail
| Level | Contains | Use Case |
|---|---|---|
| Core Memory | Essential identity (~2K tokens) | Always loaded, answers most questions |
| Level 1+ | Synthesized insights | Quick context without full details |
| Level 0 | Raw memories + full conversation | When you need exact quotes or specifics |
Hybrid Search
Oubli uses LanceDB's hybrid search combining:
- BM25 Full-Text Search - Finds keyword matches
- Semantic Embeddings - Finds conceptually related content (via sentence-transformers)
- RRF Reranking - Merges both result sets intelligently
Example: Searching "jazz music" finds memories about "Pat Metheny" and "fusion harmonies" even without exact keyword matches.
Synthesis (Bottom-Up)
Run /synthesize to consolidate raw memories into insights:
- Merge duplicates - Similar memories at each level are combined
- Group by topic - Related memories clustered together
- Create insights - Level 1+ memories synthesize the patterns
- Update Core Memory - Regenerated from highest-level insights
Drill-Down Retrieval (Top-Down)
When you need more detail than a high-level insight provides:
- Search returns synthesized insights first (compact, high-signal)
- Get parents retrieves the source memories that formed an insight
- Get full text retrieves the complete conversation from a Level 0 memory
Nothing is ever lost - every insight links back to its source memories.
Usage
Natural Interaction
Just talk naturally. Claude handles memory operations silently:
- "I prefer TypeScript over JavaScript" → Saved automatically
- "What do you know about my work?" → Searches memory
- "I no longer work at Spotify" → Deletes old, saves new, updates Core Memory
Import Existing Memories
Paste your Claude.ai memory export and ask:
"Import this into my memory"
Claude parses it into structured memories and optionally creates your Core Memory.
Slash Commands
/synthesize- Run full synthesis: merge duplicates, create insights, update Core Memory/clear-memories- Clear all memories (requires confirmation)
Data Storage
All data stored locally in ~/.oubli/:
| File | Description |
|---|---|
memories.lance/ |
LanceDB database with vector embeddings |
core_memory.md |
Your Core Memory (human-readable, editable) |
What Gets Installed
| Component | Location | Description |
|---|---|---|
| MCP Server | claude mcp |
15 memory tools |
| Hooks | ~/.claude/settings.json |
UserPromptSubmit, PreCompact, Stop |
| Commands | ~/.claude/commands/ |
/clear-memories, /synthesize |
| Instructions | ~/.claude/CLAUDE.md |
How Claude uses the memory system |
MCP Tools
Retrieval
| Tool | Description |
|---|---|
memory_search |
Hybrid search (BM25 + semantic) |
memory_get |
Get full details including conversation text |
memory_get_parents |
Drill down from synthesis to source memories |
memory_list |
List memories by level |
memory_stats |
Get memory statistics |
Storage
| Tool | Description |
|---|---|
memory_save |
Save a new memory (auto-embeds) |
memory_import |
Bulk import memories |
memory_update |
Update an existing memory |
memory_delete |
Delete a memory |
Synthesis
| Tool | Description |
|---|---|
memory_synthesis_needed |
Check if synthesis should run (threshold: 5) |
memory_prepare_synthesis |
Merge duplicates, return groups for synthesis |
memory_synthesize |
Create Level 1+ insight from parent memories |
memory_dedupe |
Manual duplicate cleanup |
Core Memory
| Tool | Description |
|---|---|
core_memory_get |
Get Core Memory content |
core_memory_save |
Save Core Memory content |
Development
git clone https://github.com/dremok/oubli.git
cd oubli
pip install -e .
oubli setup
# Test storage
python -c "
from oubli.storage import MemoryStore
store = MemoryStore()
print('Embeddings:', store.embeddings_enabled())
store.add(summary='Test memory', topics=['test'])
print(store.search('test'))
"
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oubli-0.2.5.tar.gz.
File metadata
- Download URL: oubli-0.2.5.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c07725edc77716c232500df307de5f2557bba5dfe2bf17bff2b31db95067a34
|
|
| MD5 |
39857a4ed5544a2594cf65eae2d920da
|
|
| BLAKE2b-256 |
74f1429cbffbaeed0bde889ae4c75696143a989d5c8e5b886099ef30fb54f1f6
|
File details
Details for the file oubli-0.2.5-py3-none-any.whl.
File metadata
- Download URL: oubli-0.2.5-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b264e13fc1f3272e85e94555032a114e224d36a53bedf6baacb1fe62b51117da
|
|
| MD5 |
6a196cdf054f111e0659befa79738aa0
|
|
| BLAKE2b-256 |
8d9ddd59e2042b7a807852abd5a63d608aa741a910e52116c62bd6c4048c0aab
|