obsidian-retrieval-eval

obsidian-retrieval-eval is a command for Claude Code from eugeniughelbur/obsidian-second-brain. It costs 26 tokens per session (1,190 once invoked), scanned A, original, MIT.

A command for measuring how effectively an Obsidian vault's search finds the correct note for natural-language questions.

In plain words
What is it for?
Use it to create or run retrieval test cases, inspect search failures, and optionally save the evaluation report in the vault.
Why use it?
It turns vague concerns about search quality into measurements such as recall and ranking position, along with a list of missed notes.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is uv run --directory "SKILL_ROOT" python scripts/eval/retrieval_eval.py --generate 30.

Part of the obsidian-second-brain plugin — 1 skill, 47 commands, 3 hooks shipped together

Good fit Use it to create or run retrieval test cases, inspect search failures, and optionally save the evaluation report in the vault.

Compare 6 commands from other repositories ↓
About the project

obsidian-second-brain turns an Obsidian vault into persistent, searchable memory for Claude Code and other command-line coding agents, storing knowledge as linked Markdown notes. It is for developers, founders, writers, and researchers who want agents to retain project context across sessions. Its catalogue entries provide commands, hooks, a plugin, a skill, and instructions for capturing, finding, and maintaining that memory.

eugeniughelbur/obsidian-second-brain · 4,376 stars · on GitHub · eugeniughelbur.github.io

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/eugeniughelbur/obsidian-second-brain
agentmods
npx agentmods add commands/eugeniughelbur/obsidian-second-brain/obsidian-retrieval-eval

Made for: Claude Code.

Or install obsidian-second-brain, the plugin that ships this one along with the rest of its 1 skill, 47 commands, 3 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for obsidian-retrieval-eval

README.md
[![agentmods](https://agentmods.dev/badge/commands/eugeniughelbur/obsidian-second-brain/obsidian-retrieval-eval/github.svg)](https://agentmods.dev/commands/eugeniughelbur/obsidian-second-brain/obsidian-retrieval-eval)
Your own site
<a href="https://agentmods.dev/commands/eugeniughelbur/obsidian-second-brain/obsidian-retrieval-eval"><img src="https://agentmods.dev/badge/commands/eugeniughelbur/obsidian-second-brain/obsidian-retrieval-eval/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for obsidian-retrieval-eval

Your own site · 80×15
<a href="https://agentmods.dev/commands/eugeniughelbur/obsidian-second-brain/obsidian-retrieval-eval"><img src="https://agentmods.dev/badge/commands/eugeniughelbur/obsidian-second-brain/obsidian-retrieval-eval.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,190 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00026 $0.01190
Opus 5 $0.00013 $0.00595
Sonnet 5 $0.00005 $0.00238
Haiku 4.5 $0.00003 $0.00119

Measured 10d ago against content hash eb3d5bdff90d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

obsidian-retrieval-eval scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/obsidian-retrieval-eval.md · 43 lines

How it starts

The opening of the file, as written. The whole thing — 43 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Use the obsidian-second-brain skill. Execute /obsidian-retrieval-eval $ARGUMENTS:

You cannot improve retrieval you have not measured. This scores the vault's REAL search (the term-frequency, title-weighted ranking in integrations/obsidian-mcp-server/vault_ops.py, the same engine behind /obsidian-find and the MCP connector) against natural-language questions whose correct answer note is known - so "should I add a vector index / better ranking?" becomes a number and a list of failures, not a hunch.

The optional argument is a number of cases to (re)generate first (without XAI_API_KEY the generator silently falls back to verbatim-sentence heuristics - fine for keyword-style cases, weak for paraphrase-style) (e.g. 30), or report to also write the result to the vault. No argument: evaluate the existing cases.

  1. Read _CLAUDE.md first if it exists in the vault root.

  2. If the user asked to generate (or no cases file exists yet at scripts/eval/retrieval_cases.jsonl), bootstrap the eval set from the vault. Run from the skill root (its absolute path was given at session start as Skill root; substitute it for SKILL_ROOT):

    uv run --directory "SKILL_ROOT" python scripts/eval/retrieval_eval.py --generate 30
    

    This samples real notes and, for each, has an LLM write a question whose answer is in that note while AVOIDING the note's title words (so it tests retrieval, not string match). The note's path is the gold answer. Cases are gitignored - they contain private note paths.

  3. Run the evaluation (from the same skill root):

    uv run --directory "SKILL_ROOT" python scripts/eval/retrieval_eval.py --json
    

    It prints recall@1/3/5/10, MRR, and per-case results: misses (gold note never in the top 10) and buried cases (gold ranked below #3, usually because a noisy high-mention note or a raw/ transcript outscored the canonical note).

  4. Interpret the numbers for the user in plain language: what fraction of natural-language questions surface the right note, and the dominant failure pattern (e.g. long raw/ sources and log.md outranking short canonical notes; title-weighting helping only when the query reuses title words). Name the specific notes that wrongly ranked #1 from the JSON.

  5. Turn failures into concrete, testable retrieval fixes ranked by leverage - e.g. exclude raw/ and log.md from search, boost notes by type: (canonical concept/entity/project over transcripts), add alias/heading indexing, or add semantic matching. Each fix is a hypothesis: re-run this eval on the SAME cases after the change to confirm it actually raised recall, never assume.

  6. If the user passed report (or asks to save), write an AI-first baseline note to wiki/concepts/ (resolve per references/folder-map.md), type: synthesis, tagged [retrieval, eval], linked from a retrieval-quality project note if one exists: record the engine, the case count, the recall@k / MRR numbers with the date as a recency marker, the top failure patterns with example notes, and the ranked fix hypotheses. This is the before-number every future retrieval change is measured against.

Measure, change one thing, measure again. That loop - not a guess about vector databases - is how retrieval actually improves.


AI-first rule: Every note created or updated by this command MUST follow references/ai-first-rules.md - ## For future agent preamble, rich frontmatter (type, date, tags, ai-first: true, plus type-specific fields), recency markers per external claim, mandatory [[wikilinks]] for every person/project/concept referenced, sources preserved verbatim with URLs inline, and confidence levels where applicable. If that path does not resolve from your working directory, search upward for it; if you still cannot read it, say so before writing rather than producing a note that silently skips the rule. The vault is for future agent retrieval - not human reading.

Anti-fabrication: Report the eval numbers exactly as the harness emits them - never round a miss into a hit or invent a recall figure. If the cases are few or the gold labels look weak, say so rather than overclaiming. See the anti-fabrication and search-completeness hard rules in references/ai-first-rules.md.

Read the full file on GitHub · 43 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 43 lines · 26 tokens per session scan A eb3d5bdff90d

Subscribe to this mod's changes

obsidian-retrieval-eval is a command published in the GitHub repository eugeniughelbur/obsidian-second-brain (4,376 stars, last pushed 3d ago), licensed MIT. It adds 26 tokens to every session and 1,190 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.