agentleFS
JaimeParkerJaimeParker/stable-jarvis/skills/obsidian-semantic-search/SKILL.md

obsidian-semantic-search

Skill19 starsChanged 5 months agoMITView on GitHub

Search Obsidian vault notes by conceptual meaning, not just keywords. Builds a local embedding index over all vault notes (per-section chunking), then performs cosine similarity search at query time. Before any search, the agent MUST check the index state: Decision logic: The scripts locate the vault automatically via OBSIDIAN_VAULT env var or common paths (~/Documents/Obsidian, ~/Obsidian, ~/vault). If the vault is at a non-standard location, set it first: Returns JSON array of results, each with: - title — Note title…

  • Reads credentials

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Search Obsidian vault notes by conceptual meaning, not just keywords.

    line 3
  2. Distinctive:

    Before any search, the agent MUST check the index state:

    line 28
  3. Very specific:

    After getting results, use mcp__obsidian__read_note with the path field to read full content:

    line 73
  4. Very specific:

    All settings via environment variables (loaded from .env):

    line 101
  5. Very specific:

    Rebuild frequency: Run --force after major vault reorganization or when search quality degrades.

    line 116

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Obsidian Semantic Search

Search Obsidian vault notes by conceptual meaning, not just keywords. Builds a local embedding index over all vault notes (per-section chunking), then performs cosine similarity search at query time.

When to Use

  • User asks a fuzzy/conceptual question about their own notes ("What papers discuss exploration in RL?")
  • Keyword search (mcp__obsidian__search_notes) returns too many or too few results
  • User wants to find notes related to a concept without knowing exact terminology
  • As a pre-retrieval step before deep-reading or analyzing vault content

Architecture

Vault (.md files)  ──build_index.py──>  temp/obsidian/embeddings.json  <──search.py──  User Query
                                                │
                                                └── Shared with paper-deep-reader
  • Index: Flat JSON, one embedding per .md note (full body text, frontmatter excluded), mtime-tracked incremental rebuild
  • Embeddings: Reuses stable_jarvis.llm.embed() — same provider stack as paper-deep-reader (local / qwen / openai)
  • Search: Brute-force cosine similarity, O(n) over all notes

Workflow

Phase 0: Check Index Freshness (Always First)

Before any search, the agent MUST check the index state:

python skills/obsidian-semantic-search/scripts/build_index.py --stats

Decision logic:

StateAction
Index exists AND built todaySkip build, proceed to Phase 2 directly
Index exists AND built in last 3 daysRun build_index.py (incremental — only changed files)
Index exists AND older than 3 daysRun build_index.py --force (full rebuild)
Index does NOT existRun build_index.py --force (first build)

Phase 1: Build/Update Index (If Needed)

# Incremental update (recommended when index exists but stale)
python skills/obsidian-semantic-search/scripts/build_index.py

# Full rebuild (first time, or after major vault changes)
python skills/obsidian-semantic-search/scripts/build_index.py --force

The scripts locate the vault automatically via OBSIDIAN_VAULT env var or common paths (~/Documents/Obsidian, ~/Obsidian, ~/vault). If the vault is at a non-standard location, set it first:

export OBSIDIAN_VAULT="/path/to/vault"

Phase 2: Semantic Search

python skills/obsidian-semantic-search/scripts/search.py "query text" --top-k 5

Returns JSON array of results, each with:

  • title — Note title (from H1 or filename)
  • path — Relative path in vault (use directly with mcp__obsidian__read_note)
  • score — Cosine similarity (0–1, higher = more relevant)
  • text_snippet — First 200 chars of the note body
  • arxiv_id — From frontmatter, if present

Phase 3: Read Full Notes (via Obsidian MCP)

After getting results, use mcp__obsidian__read_note with the path field to read full content:

mcp__obsidian__read_note(path="30 Zettelkasten/RL/MAC.md")

Phase 4: Present Results

Format search results for the user with:

  • Note title as [[wikilink]]
  • Relevance score
  • Brief excerpt from text_snippet

Commands

CommandPurpose
build_index.pyIncremental index rebuild (default)
build_index.py --forceFull rebuild from scratch
build_index.py --statsShow index statistics
build_index.py --clearRemove index file
search.py "query"Semantic search (top 5)
search.py "query" --top-k 10More results
search.py "query" --min-score 0.4Filter low-relevance results
search.py "query" --provider qwenUse specific embedding provider

Configuration

All settings via environment variables (loaded from .env):

VariableDefaultDescription
OBSIDIAN_VAULTAuto-detectPath to Obsidian vault
EMBEDDING_PROVIDERlocallocal / qwen / openai
EMBEDDING_MODELProvider-dependentModel override
EMBEDDING_API_KEYFrom {PROVIDER}_API_KEYAPI key for cloud embeddings

The local provider uses sentence-transformers (paraphrase-multilingual-MiniLM-L12-v2) and requires no API key.

Index Management

  • Incremental updates: Running build_index.py without --force compares file mtimes and only re-embeds changed notes. Deleted notes are automatically removed from the index.
  • Shared index: The index at temp/obsidian/embeddings.json is shared with paper-deep-reader. Both skills read and benefit from the same index.
  • Rebuild frequency: Run --force after major vault reorganization or when search quality degrades.

Integration Notes

  • Results from search.py include the vault-relative path — this is the exact argument to pass to mcp__obsidian__read_note
  • Combine with mcp__obsidian__search_notes for hybrid retrieval: semantic for recall, keyword for precision
  • Index is stored at temp/obsidian/embeddings.json — shared with paper-deep-reader skill

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.