Skip to main content

Hybrid search memory for AI agents — SQLite FTS5 + Ollama vector embeddings

Project description

Hybrid Search Memory

Keyword (BM25) + vector (cosine similarity) search over memory files and workspace documents.

Usage

# Search (hybrid mode by default — falls back to keyword-only if Ollama is down)
uv run python skills/hybrid-memory/scripts/hybrid_cli.py search "query text"
uv run python skills/hybrid-memory/scripts/hybrid_cli.py search "query" --mode keyword
uv run python skills/hybrid-memory/scripts/hybrid_cli.py search "query" --mode vector

# Ingest all memory files + TOOLS.md/MEMORY.md/AGENTS.md
uv run python skills/hybrid-memory/scripts/hybrid_cli.py ingest-memory

# Ingest a directory
uv run python skills/hybrid-memory/scripts/hybrid_cli.py ingest --path memory/ --pattern "*.md"
uv run python skills/hybrid-memory/scripts/hybrid_cli.py ingest --path memory/ --incremental

# Store a single document
uv run python skills/hybrid-memory/scripts/hybrid_cli.py store --doc-id ID --text "content"
uv run python skills/hybrid-memory/scripts/hybrid_cli.py store --doc-id ID --file path/to/file.md

# Other
uv run python skills/hybrid-memory/scripts/hybrid_cli.py delete --doc-id ID
uv run python skills/hybrid-memory/scripts/hybrid_cli.py reindex
uv run python skills/hybrid-memory/scripts/hybrid_cli.py stats

When to Use

  • Hybrid search: exact keyword matches + semantic similarity. Best for credential lookups, config values, specific terms.
  • Tiered memory: LLM-powered tree navigation. Best for broad semantic questions, "what happened last week".

Use hybrid search first (fast, precise), fall back to tiered memory if results are insufficient.

Architecture

  • Chunker: Markdown-aware splitting with heading context, configurable size/overlap
  • FTS5: SQLite full-text search with BM25 ranking
  • Vector: Ollama nomic-embed-text embeddings + cosine similarity
  • Merger: Weighted combination (keyword=0.3, vector=0.7), normalization, deduplication

Gracefully degrades to keyword-only when Ollama is unavailable.

Config

Edit config.json or pass CLI flags. DB stored in data/hybrid_search.db.

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

hybrid_memory-0.1.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hybrid_memory-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file hybrid_memory-0.1.0.tar.gz.

File metadata

  • Download URL: hybrid_memory-0.1.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for hybrid_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 051922a749f0702a3e567217fb1a462a768fa0d16b60215300f16a413177a882
MD5 25200508f3050ac1596cdcc30a25f70f
BLAKE2b-256 6f1f635efebb046b09048821db60796339035f22a65eaf33948111740d00479a

See more details on using hashes here.

File details

Details for the file hybrid_memory-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hybrid_memory-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for hybrid_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b06b9ee8027afbce839f07bec1cc66e1b0893be804d2f70db71d46b14318a8f
MD5 94b961dbe1456e1779444a305f5a7904
BLAKE2b-256 96ce3b63a0c34d2dc844ac9f8d70ab2f73b6a85e21f903f03b4dc472a927837f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page