Skip to content

About

Small Obsidian-to-Memvid importer plus local search and Q&A helpers for local-first knowledge retrieval

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Obsidian To Memvid With Local Ollama

Small Obsidian-to-Memvid importer plus local search and Q&A helpers for local-first knowledge retrieval.

This repo is built on Memvid:

What This Repo Does

  • import.py: ingest an Obsidian vault into knowledge.mv2
  • find.py: search that memory with the same Ollama embedding model used during ingestion
  • ask.py: retrieve relevant chunks, then answer with a local Ollama LLM

Everything here uses the Python SDK plus local Ollama. No memvid CLI is required.

This makes the repo portable and avoids the current CLI limitation around querying memories built with mxbai-embed-large.

Requirements

  • Python 3.8+
  • Ollama installed and running
  • mxbai-embed-large pulled locally for embeddings
  • qwen3.5:4b pulled locally for answer synthesis
  • dependencies from requirements.txt

Setup

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
ollama pull mxbai-embed-large
ollama pull qwen3.5:4b
ollama serve

1. Build The Memory File

python3 import.py --vault-path /absolute/path/to/your/obsidian-vault --memory-path knowledge.mv2

What the importer does:

  • scans .md and .txt files
  • skips .obsidian
  • parses YAML frontmatter
  • preserves common frontmatter date fields as created_at and updated_at
  • splits large notes into smaller chunks before embedding
  • embeds chunks with local Ollama using mxbai-embed-large
  • logs failed chunks and continues

Rebuild from scratch:

rm -f knowledge.mv2
python3 import.py --vault-path /absolute/path/to/your/obsidian-vault --memory-path knowledge.mv2

If some chunks are too large for the embedder, the importer logs the failures and keeps going.

2. Search It

Basic search:

python3 find.py --memory-path knowledge.mv2 --query "config"

Search and show the aggregated retrieval context:

python3 find.py --memory-path knowledge.mv2 --query "config" --show-context

Force lexical-only search if you want a pure text lookup without embeddings:

python3 find.py --memory-path knowledge.mv2 --query "config" --mode lex

3. Ask Questions

Basic local Q&A:

python3 ask.py --memory-path knowledge.mv2 --question "Why is determinism important?"

Show the retrieved evidence too:

python3 ask.py --memory-path knowledge.mv2 --question "What themes show up across my notes?" --show-sources

Retrieval-only mode:

python3 ask.py --memory-path knowledge.mv2 --question "What is PersonaSphere?" --context-only --show-sources

Time Travel

Both query helpers expose Memvid replay filters.

Results as they were at frame 100:

python3 find.py --memory-path knowledge.mv2 --query "config" --as-of-frame 100
python3 ask.py --memory-path knowledge.mv2 --question "What changed?" --as-of-frame 100

Results as of a Unix timestamp:

python3 find.py --memory-path knowledge.mv2 --query "config" --as-of-ts 1704067200
python3 ask.py --memory-path knowledge.mv2 --question "What changed?" --as-of-ts 1704067200

Note: --as-of-ts uses Memvid frame timestamps, not your note frontmatter dates.

Common Options

Import:

  • --memory-path: output .mv2 path. Default: knowledge.mv2
  • --ollama-model: embedding model. Default: mxbai-embed-large
  • --ollama-url: Ollama base URL. Default: OLLAMA_HOST or http://localhost:11434
  • --batch-size: notes per batch. Default: 25
  • --chunk-size: max chars per chunk. Default: 800
  • --chunk-overlap: overlap between chunks. Default: 80
  • --failure-log: skipped-chunk log path. Default: import_failures.log
  • --no-embeddings: import text and metadata only

Search and Q&A:

  • --mode: auto, lex, sem, or hybrid. Default: hybrid
  • --top-k: retrieved chunk count. Default: 8
  • --snippet-chars: snippet size per hit. Default: 480
  • --ollama-embed-model: retrieval embedder. Default: mxbai-embed-large
  • --ollama-url: Ollama base URL
  • --as-of-frame: replay at or before a frame id
  • --as-of-ts: replay at or before a Unix timestamp

Q&A only:

  • --ollama-llm: answer model. Default: qwen3.5:4b
  • --ollama-timeout: generation timeout in seconds. Default: 300
  • --context-only: retrieval only, no answer synthesis
  • --show-sources: print retrieved hits after the answer

Notes

  • generated .mv2 files are gitignored
  • log files are gitignored
  • entries are labeled as obsidian
  • top-level vault folders are also stored as labels
  • frontmatter tags are preserved as both tags and frontmatter_tags metadata
  • chunk metadata is stored as chunk_index and chunk_total when a note is split
  • --as-of-ts replays by Memvid frame timestamp, not note frontmatter date metadata

Troubleshooting

Check installed local models:

ollama list

If some notes are too large for the embedding model, the importer logs the skipped chunks and continues:

cat import_failures.log

If Ollama is running somewhere else:

python3 import.py --vault-path /absolute/path/to/your/obsidian-vault --ollama-url http://localhost:11434
python3 find.py --memory-path knowledge.mv2 --query "config" --ollama-url http://localhost:11434
python3 ask.py --memory-path knowledge.mv2 --question "Why is determinism important?" --ollama-url http://localhost:11434

License

MIT

About

Small Obsidian-to-Memvid importer plus local search and Q&A helpers for local-first knowledge retrieval

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages