Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lore

Persistent, queryable memory for AI coding assistants. Lore runs entirely on your machine and stores design decisions, rejected approaches, and coding patterns in a local Qdrant vector database, then surfaces them to Claude Code (or any MCP-compatible AI) before it proposes changes so it never re-suggests what you've already ruled out.

How it works

Lore exposes five MCP tools over stdio:

Tool What it does
memory_search Retrieve relevant memories before proposing a design
memory_record Store a new decision, rejection, pattern, or note
memory_list_recent Browse recently stored memories
memory_forget Delete a memory by ID
memory_supersede Replace an outdated memory with a new one

Memories use a local embedding server—Ollama, LM Studio, oMLX, llama.cpp, or another OpenAI-compatible endpoint—for dense vectors and BM25 with native IDF for sparse vectors. Queries use hybrid retrieval with DBSF fusion over 50 candidates.

Embedding backends

Ollama remains the fallback. LM Studio, oMLX, and llama.cpp share Lore's OpenAI-compatible embedding path; only the provider and model ID change:

# LM Studio (default base URL: http://localhost:1234/v1)
embedding:
  provider: lmstudio
  model: your-loaded-embedding-model

# oMLX (default base URL: http://localhost:8000/v1)
# embedding:
#   provider: omlx
#   model: your-embedding-model-alias

# llama.cpp (default base URL: http://localhost:8080/v1)
# Start llama-server with --embedding and a dedicated embedding model.
# embedding:
#   provider: llamacpp
#   model: your-model-alias

Set base_url to override the provider default and api_key_env when the server requires authentication. Keep model-specific query_prefix and document_prefix values under embedding. Existing ollama.embed_model configurations continue to work. When changing models, migrate safely with lore reindex --target-collection <new-name>.

On a fresh lore setup, Lore checks LM Studio, oMLX, llama.cpp, then Ollama for an available embedding model. It starts Ollama and pulls nomic-embed-text only when no compatible running server is found.

System prompt

Add prompts/system-addition.md to your editor's instructions/rules file. This tells the AI to call memory_search before designing and memory_record when decisions are made.

Session auto-capture (optional)

Automatically extract memories from completed Claude Code sessions. Requires ANTHROPIC_API_KEY.

Add to ~/.claude/settings.json:

{
  "hooks": {
    "Stop": [{
      "matcher": "",
      "hooks": [{ "type": "command", "command": "/abs/path/to/hooks/session-end.sh" }]
    }]
  }
}

Architecture

lore add / memory_record
  └─ scrub secrets
  └─ dense embed (configured provider) + sparse embed (BM25)
  └─ Qdrant UpsertWithSparse

lore search / memory_search
  └─ embed query
  └─ Qdrant hybrid search (DBSF fusion, 50 candidates)
  └─ return top-k

lore ingest-session <transcript>
  └─ parse JSONL → scrub → chunk
  └─ Anthropic extracts memories as JSON
  └─ cosine dedup gate → upsert

Qdrant stores named vectors: dense (model dimension, cosine) + sparse (BM25). Repo identity is stable across renames: git.RepoID uses SHA256 of the remote origin URL when available.

About

Persistent, queryable memory for Claude Code, Codex, Cursor and so on

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages