home / skills / openclaw / skills / anshumanbh-qmd

anshumanbh-qmd skill

/skills/anshumanbh/anshumanbh-qmd

This skill helps you search markdown knowledge bases efficiently using qmd to return relevant snippets and reduce token usage.

npx playbooks add skill openclaw/skills --skill anshumanbh-qmd

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.2 KB
---
name: qmd
description: Search markdown knowledge bases efficiently using qmd. Use this when searching Obsidian vaults or markdown collections to find relevant content with minimal token usage.
argument-hint: "<search query> [--collection <name>] [--semantic]"
---

# QMD Search Skill

Search markdown knowledge bases efficiently using qmd, a local indexing tool that uses BM25 + vector embeddings to return only relevant snippets instead of full files.

## Why Use This

- **96% token reduction** - Returns relevant snippets instead of reading entire files
- **Instant results** - Pre-indexed content means fast searches
- **Local & private** - All indexing and search happens locally
- **Hybrid search** - BM25 for keyword matching, vector search for semantic similarity

## Commands

### Search (BM25 keyword matching)
```bash
qmd search "your query" --collection <name>
```
Fast, accurate keyword-based search. Best for specific terms or phrases.

### Vector Search (semantic)
```bash
qmd vsearch "your query" --collection <name>
```
Semantic similarity search. Best for conceptual queries where exact words may vary.

### Hybrid Search (both + reranking)
```bash
qmd hybrid "your query" --collection <name>
```
Combines both approaches with LLM reranking. Most thorough but often overkill.

## How to Use

1. **Check if collection exists**:
   ```bash
   qmd collection list
   ```

2. **Search the collection**:
   ```bash
   # For specific terms
   qmd search "api authentication" --collection notes

   # For conceptual queries
   qmd vsearch "how to handle errors gracefully" --collection notes
   ```

3. **Read results**: qmd returns relevant snippets with file paths and context

## Setup (if qmd not installed)

```bash
# Install qmd
bun install -g https://github.com/tobi/qmd

# Add a collection (e.g., Obsidian vault)
qmd collection add ~/path/to/vault --name notes

# Generate embeddings for vector search
qmd embed --collection notes
```

## Invocation Examples

```
/qmd api authentication          # BM25 search for "api authentication"
/qmd how to handle errors --semantic   # Vector search for conceptual query
/qmd --setup                     # Guide through initial setup
```

## Best Practices

- Use **BM25 search** (`qmd search`) for specific terms, names, or technical keywords
- Use **vector search** (`qmd vsearch`) when looking for concepts where wording may vary
- Avoid hybrid search unless you need maximum recall - it's slower
- Re-run `qmd embed` after adding significant new content to keep vectors current

## Handling Arguments

- `$ARGUMENTS` contains the full search query
- If `--semantic` flag is present, use `qmd vsearch` instead of `qmd search`
- If `--setup` flag is present, guide user through installation and collection setup
- If `--collection <name>` is specified, use that collection; otherwise default to checking available collections

## Workflow

1. Parse arguments from `$ARGUMENTS`
2. Check if qmd is installed (`which qmd`)
3. If not installed, offer to guide setup
4. If searching:
   - List collections if none specified
   - Run appropriate search command
   - Present results to user with file paths
5. If user wants to read a specific result, use the Read tool on the file path

Overview

This skill lets you search markdown knowledge bases efficiently using qmd. It focuses on returning relevant snippets rather than entire files to minimize token usage and speed up retrieval. Use it for local Obsidian vaults or any markdown collection where privacy and fast, precise search matter. The tool supports keyword, semantic, and hybrid search modes for flexible results.

How this skill works

The skill invokes qmd commands to query pre-indexed collections. BM25 keyword searches (qmd search) return exact-term matches quickly, vector searches (qmd vsearch) retrieve semantically similar snippets, and hybrid search combines both with reranking for thoroughness. Results include file paths and short context snippets so you read only the most relevant passages.

When to use it

  • Searching an Obsidian vault or local markdown directory for targeted info
  • Reducing token usage when feeding search results to an LLM or automation
  • Looking for conceptual answers where wording may vary (use semantic)
  • Doing fast lookups of technical terms, names, or exact phrases (use BM25)
  • Maintaining private, local search workflows without cloud indexing

Best practices

  • Use qmd search for precise keywords and qmd vsearch for conceptual queries
  • Avoid hybrid search unless you need maximum recall; it is slower and more costly
  • Re-run qmd embed after adding many new files so vector indexes stay current
  • Specify --collection to target the right dataset; list collections if unsure
  • Present only returned snippets and file paths to downstream processes to save tokens

Example use cases

  • Find exact API configuration notes across a large Obsidian vault using BM25
  • Locate conceptual guidance like 'error handling patterns' with vector search
  • Feed concise snippets to an LLM for summarization or code generation
  • Quickly confirm where a topic is documented by returning file paths and contexts
  • Onboard a local knowledge base into workflows while keeping data private

FAQ

Do I need to index my collection before semantic search?

Yes. Run qmd embed for the collection to generate vectors before using qmd vsearch.

When should I use hybrid search?

Use hybrid when you need the most thorough results and can accept slower, higher-cost queries; otherwise prefer BM25 or vector search based on your query type.