{"id":50655389,"url":"https://github.com/danielmrdev/vault-memory","last_synced_at":"2026-06-07T23:30:59.636Z","repository":{"id":350337063,"uuid":"1206398971","full_name":"danielmrdev/vault-memory","owner":"danielmrdev","description":"Semantic search over markdown collections — BM25 + vector hybrid, SQLite, Gemini embeddings. Hermes Agent memory plugin.","archived":false,"fork":false,"pushed_at":"2026-04-09T21:57:03.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-09T23:29:20.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielmrdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-09T21:56:20.000Z","updated_at":"2026-04-09T21:57:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/danielmrdev/vault-memory","commit_stats":null,"previous_names":["danielmrdev/vault-memory"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/danielmrdev/vault-memory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmrdev%2Fvault-memory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmrdev%2Fvault-memory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmrdev%2Fvault-memory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmrdev%2Fvault-memory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielmrdev","download_url":"https://codeload.github.com/danielmrdev/vault-memory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmrdev%2Fvault-memory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34042554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-07T23:30:59.030Z","updated_at":"2026-06-07T23:30:59.623Z","avatar_url":"https://github.com/danielmrdev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vault-memory\n\nSemantic search over collections of markdown files.\n\nBM25 (FTS5) + vector cosine similarity, combined via Reciprocal Rank Fusion.\nSQLite-backed, zero external dependencies, free Gemini embeddings (free tier).\n\nPorted and extracted from [Nous](https://github.com/danielmunoz/nous) —\na personal AI assistant. Designed to work standalone or as a\n[Hermes Agent](https://hermes.computer) memory plugin.\n\n---\n\n## Features\n\n- **Hybrid search** — BM25 keyword + cosine vector similarity, fused via RRF\n- **Agnostic collections** — index any directory under any name (`obsidian`, `hermes-memory`, `work-notes`, …)\n- **Incremental indexing** — skips unchanged files (mtime), re-embeds only new/changed chunks\n- **Graceful degradation** — falls back to BM25-only when Gemini is unavailable (rate limit, no key)\n- **Zero dependencies** — Python stdlib only (`sqlite3`, `struct`, `urllib`)\n- **Compatible DB** — same schema as Nous `vectors.db`, can reuse existing data\n\n---\n\n## Installation\n\n### As a standalone CLI\n\n```bash\ngit clone https://github.com/YOUR_USER/vault-memory\ncd vault-memory\npip install -e .          # installs the `vm` command\n\n# or without installing, run directly:\npython -m vault_memory.cli\n```\n\n### As a Hermes Agent memory plugin\n\n```bash\n# 1. Clone into Hermes plugin directory\ngit clone https://github.com/YOUR_USER/vault-memory \\\n    ~/.hermes/hermes-agent/plugins/memory/vault-memory\n\n# 2. Add GEMINI_API_KEY to ~/.hermes/.env\necho \"GEMINI_API_KEY=your_key_here\" \u003e\u003e ~/.hermes/.env\n\n# 3. Set default DB path (optional — default: ~/hache/data/vectors.db)\necho \"VAULT_MEMORY_DB=/path/to/vectors.db\" \u003e\u003e ~/.hermes/.env\n\n# 4. Enable in Hermes\nhermes memory setup\n# → select: vault-memory\n\n# 5. Index your vault\nvm index ~/path/to/obsidian-vault --collection obsidian\nvm index ~/.hermes/memories --collection hermes-memory\n```\n\n### Scheduled reindexing (cron)\n\nA ready-made script for nightly reindexing with weekly rotation to respect\nthe Gemini free tier quota:\n\n```bash\n# Add to crontab — runs at 4am every day\ncrontab -e\n# Add: 0 4 * * * /path/to/hache/scripts/vector-reindex.sh \u003e\u003e ~/hache/logs/vector-reindex.log 2\u003e\u00261\n```\n\n---\n\n## Usage\n\n### CLI (`vm`)\n\n```bash\n# Index a directory (any name for collection)\nvm index ~/obsidian-vault         --collection obsidian\nvm index ~/.hermes/memories       --collection hermes-memory\nvm index ~/notes/work             --collection work\n\n# Index a single file\nvm index ~/obsidian-vault/note.md --collection obsidian\n\n# Search (hybrid by default — BM25+vector if embeddings exist, else BM25-only)\nvm search \"pitchgale marketing strategy\" --collection obsidian\nvm search \"how to configure vllm\"        --limit 10\nvm search \"weekly review\"                --json    # JSON output for scripting\n\n# Stats\nvm stats\n\n# Prune orphaned entries (files that were deleted)\nvm prune ~/obsidian-vault\n```\n\n### Environment variables\n\n| Variable         | Default                       | Description                     |\n|------------------|-------------------------------|---------------------------------|\n| `VAULT_MEMORY_DB`| `~/hache/data/vectors.db`     | Path to SQLite database         |\n| `GEMINI_API_KEY` | _(empty — BM25 only)_         | Gemini API key for embeddings   |\n\n### Python API\n\n```python\nfrom vault_memory import VaultMemory\n\nvm = VaultMemory(\"/path/to/vectors.db\", gemini_api_key=\"...\")\n\n# Index\nvm.index_directory(\"~/obsidian-vault\", collection=\"obsidian\")\nvm.index_file(\"~/notes/project.md\",    collection=\"work\")\n\n# Search\nresults = vm.search(\"my query\", collection=\"obsidian\", limit=5)\n\n# Format for LLM context injection\ncontext = vm.build_context(results)\n# → \"## Relevant Context\\n\\n**heading** (file.md)\\nsnippet...\\n\\n...\"\n\n# Stats\nstats = vm.get_stats()\n\n# Prune deleted files\nvm.prune_orphans(\"~/obsidian-vault\")\n\nvm.close()\n```\n\n---\n\n## Architecture\n\n```\nvault_memory/\n├── chunker.py    — Markdown → overlapping chunks (1500 chars, 200 overlap)\n├── store.py      — SQLite: FTS5 BM25 + BLOB embeddings + RRF combiner\n├── embedder.py   — Gemini API client (batching, retry, rate-limit cooldown)\n├── indexer.py    — High-level facade: index_file, index_directory, search\n└── cli.py        — CLI entry point (vm command)\n```\n\n### DB Schema\n\n```sql\ncollections   -- named collections\nchunks        -- text chunks (content, heading, embedding BLOB, norm)\ningest_log    -- per-file mtime for skip-on-unchanged\nchunks_fts    -- FTS5 virtual table (porter tokenizer) with auto-sync triggers\n```\n\n### Search modes\n\n| Mode     | When                                               |\n|----------|----------------------------------------------------|\n| `hybrid` | Gemini available + collection has embeddings       |\n| `bm25`   | Gemini unavailable / rate limited / no embeddings  |\n\nHybrid uses RRF (k=60) to merge vector and BM25 ranked lists.\n\n---\n\n## Gemini free tier\n\n`gemini-embedding-001` free tier: ~1500 RPD (requests per day), 1500 RPM.\n\nThe nightly reindex script uses weekly rotation to stay within quota:\n- Mon: `00-Inbox`\n- Tue: `01-PROYECTOS`\n- Wed: `02-ÁREAS`\n- Thu: `03-RECURSOS`\n- Fri: `04-Archivo`\n- Sat/Sun: retry unembedded chunks only\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielmrdev%2Fvault-memory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielmrdev%2Fvault-memory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielmrdev%2Fvault-memory/lists"}