Bio-inspired persistent memory for AI agents. 5-layer architecture with FTS5, vector search, knowledge graph, and HybridRAG fusion.
Project description
๐ง Rewind Memory
Bio-inspired persistent memory for AI agents.
Rewind gives AI agents structured, persistent memory that works like biological memory โ keyword search, knowledge graphs, semantic vectors, score fusion, and intelligent retrieval. Every memory is classified by type (user, feedback, project, reference), weighted by recency, and checked for drift. Runs fully local on SQLite with zero external dependencies.
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ L2 Orchestrator โ
โ (fusion ยท ranking ยท deduplication) โ
โโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโโค
โ L0 โ L1 โ L3 โ L4 โ
โSensory โ System โ Graph โ Vector โ
โ Buffer โ Files โ โ Search โ
โ โ โ โ โ
โ SQLite โ File โ SQLite โsqlite-vecโ
โ FTS5 โ system โ Graph โ (vec0) โ
โโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโโ
Layers
| Layer | Name | Bio Analogy | Backend | Purpose |
|---|---|---|---|---|
| L0 | Sensory Buffer | Sensory cortex | SQLite FTS5 | Fast keyword search, BM25 ranking |
| L1 | System Memory | Working memory | File system | Identity, preferences, context โ loaded every session |
| L2 | Orchestrator | Prefrontal cortex | In-process | Fuses keyword + graph + vector results |
| L3 | Knowledge Graph | Association cortex | SQLite | Entity relationships, spreading activation, Hebbian learning |
| L4 | Vector Search | Episodic memory | sqlite-vec | Semantic similarity via local embeddings (Ollama) |
Quick Start
pip install rewind-memory
rewind doctor # Auto-diagnose and fix memory stack
rewind ingest-chats # Backfill historical OpenClaw conversations
rewind watch # Real-time conversation indexing (L0 keyword search)
rewind search "what did we discuss about X"
Full walkthrough: docs/QUICKSTART.md โ 5 minutes to first search.
# 1. Install Ollama for vector search (optional but recommended)
curl -fsSL https://ollama.com/install.sh | sh
ollama pull nomic-embed-text # ~274MB
# 2. Install Rewind
pip install rewind-memory
# 3. Ingest your files
rewind ingest ~/my-project/docs/
# 4. Search
rewind search "what was decided about auth"
Commands
| Command | Description |
|---|---|
rewind ingest <path> |
Ingest files into memory |
rewind search <query> |
Search memory |
rewind health |
Health check |
rewind doctor |
Auto-diagnose and fix issues |
rewind watch |
Real-time session watcher (NEW in 0.4.7) |
rewind ingest-chats |
Historical conversation backfill (NEW in 0.4.7) |
rewind proxy |
Memory-augmented LLM proxy |
rewind migrate |
Migrate backends (Pro) |
Free vs Pro
| Feature | Free | Pro |
|---|---|---|
| L0 Keyword Search (FTS5) | โ | โ |
rewind doctor |
โ | โ |
rewind watch (L0) |
โ | โ |
rewind ingest-chats (L0) |
โ | โ |
| L5 Semantic Search (Qdrant) | โ | โ |
| Multi-channel awareness | โ | โ |
| Session Extractor | โ | โ |
| Session Continuity | โ | โ |
| Neo4j Knowledge Graph | โ | โ |
| Memory Proxy | โ | โ |
Usage
from rewind.client import RewindClient
from rewind.config import default_config
client = RewindClient(default_config("free"))
# Search across all layers
results = client.search("what is Hebbian learning")
for r in results:
print(f"{r.score:.2f} [{r.layer}] {r.text[:80]}")
# Ingest a document
client.ingest("notes/meeting.md")
# Health check
print(client.health())
CLI
# Search
rewind search "memory consolidation" --limit 10
# Ingest files
rewind ingest ./documents/
# Health check
rewind health
Integrations (Claude Code, Cursor, OpenClaw)
Rewind ships with an MCP server that works with any MCP-compatible tool:
Claude Code โ add to ~/.claude/settings.json:
{
"mcpServers": {
"rewind": {
"command": "rewind-mcp"
}
}
}
OpenClaw โ config setup + optional gateway pre-turn hook:
# Route memory_search through Rewind
rewind-openclaw setup --url http://localhost:8031
# Patch the gateway to auto-inject memory into EVERY inbound message
# (the agent gets memory context before it even starts thinking)
rewind-openclaw patch
Cursor / Windsurf / Cline โ add rewind-mcp as an MCP server in settings.
See docs/INTEGRATIONS.md for full setup guides.
Memory Proxy (zero-config, works with any tool)
The proxy auto-injects memory into every LLM call. No MCP needed โ just change your API URL:
pip install rewind-memory[proxy]
# Ingest your project first
rewind ingest ./my-project/
# Start the memory proxy
rewind proxy --port 8080
Then point your tool at it:
# Cursor
OPENAI_BASE_URL=http://localhost:8080/v1 cursor .
# Aider
OPENAI_API_BASE=http://localhost:8080/v1 aider
# Any OpenAI-compatible tool
export OPENAI_BASE_URL=http://localhost:8080/v1
The proxy:
- Searches memory on every prompt (keyword + graph + vector fusion)
- Injects relevant context into the system message
- Auto-budgets injection size based on model context limits
- Passes through your API key to the upstream provider
- Supports streaming responses
- Works with OpenAI, Anthropic, NVIDIA, any OpenAI-compatible API
# Point at Anthropic instead of OpenAI
rewind proxy --port 8080 --upstream https://api.anthropic.com/v1
# Point at a local model
rewind proxy --port 8080 --upstream http://localhost:11434/v1
Configuration
# ~/.rewind/config.yaml
tier: free
workspace_path: ~/my-project
embedding:
provider: ollama
model: nomic-embed-text
url: http://localhost:11434
layers:
l0_sensory: true
l1_stm: true
l3_graph: true
l4_workspace: true
Upgrading
Rewind Core is free and fully functional as a local memory stack. For additional layers (communications, documents, bio lifecycle) and cloud GPU embeddings, see Rewind Pro.
Pro extends the Core package via a plugin โ install both and Pro layers activate automatically:
client = RewindClient(default_config("pro"), api_key="rw_live_...")
| Feature | Core (Free) | Pro ($9/mo) | MOS (Custom) |
|---|---|---|---|
| Keyword search (FTS5) | โ | โ | โ |
| System memory | โ | โ | โ |
| Knowledge graph (SQLite) | โ | โ | โ |
| Semantic vector search | โ local Ollama | โ cloud GPU (A10G) | โ custom GPU |
| HybridRAG fusion | โ 5-layer (L0โL4) | full 7-layer (L0โL6) | full 7-layer |
| Memory type taxonomy | โ (user/feedback/project/reference) | โ | โ |
| Recency weighting | โ (type-aware decay) | โ | โ |
| Query-intent matching | โ (boosts matching types) | โ | โ |
| Memory drift detection | โ (flags stale references) | โ | โ |
| OpenClaw gateway autopatcher | โ (pre-turn memory injection) | โ | โ |
| Communications memory (L5) | โ | โ | โ |
| Document store (L6) | โ | โ | โ |
| LLM relevance selection | โ | โ (cheap model side-query) | โ |
| Cross-encoder reranking | โ | โ (GPU-accelerated) | โ |
| Memory extraction (post-turn) | โ | โ (auto-extracts durable memories) | โ |
| Partial compaction | โ | โ (preserves task intent) | โ |
| Cloud GPU embeddings (NV-Embed-v2) | โ | 25K/mo included | custom volume rates |
| Retrieval feedback learning | โ | โ | โ |
| Migration assist (โ Neo4j/Qdrant) | โ | โ | โ |
| Bio lifecycle (decay, pruning) | โ | โ | โ |
| Air-gapped deployment | โ | โ | โ |
| Dedicated engineer + SLA | โ | โ | โ |
Development
git clone https://github.com/saraidefence/rewind-memory.git
cd rewind-memory
pip install -e ".[dev]"
pytest tests/
Patent
The 7-layer bio-inspired memory architecture is patent pending.
License
Apache License 2.0 โ see LICENSE.
Built by SARAI Defence. Ukrainian-built. Patent pending.
Project details
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 rewind_memory-0.5.1.tar.gz.
File metadata
- Download URL: rewind_memory-0.5.1.tar.gz
- Upload date:
- Size: 53.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2394b3c1fad3f42a1f5823d6829e46e0f5c75f1fa2819b849a3efa80ff048eaf
|
|
| MD5 |
ecd0fea87d1623c20f4626d1b246bace
|
|
| BLAKE2b-256 |
9b00415f9dfff61db689402268376b1b218d8c94149a2c94c969dc2a651ebbcd
|
File details
Details for the file rewind_memory-0.5.1-py3-none-any.whl.
File metadata
- Download URL: rewind_memory-0.5.1-py3-none-any.whl
- Upload date:
- Size: 56.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a64948eef79f548ca180a836a1a6dfd4635605fea38f0ee406598f09bb1e34b0
|
|
| MD5 |
e8eacb4816e6b8d48ae04225e37f4de8
|
|
| BLAKE2b-256 |
7936aafa832d76a0b066af5f1aa145dd62c2e95693792af98a70a2611619e93a
|