vector-db-lord

vector-db-lord is a skill for Claude Code, Codex from m3taz-ahmed/ai-globals. It costs 41 tokens per session (1,616 once invoked), scanned A, original, MIT.

A guide for designing vector databases and retrieval-augmented generation (RAG) systems. RAG lets an AI answer using documents retrieved from a search store instead of relying only on its trained knowledge.

In plain words
What is it for?
It is for selecting a vector database, combining keyword and meaning-based search, choosing indexes and compression, reordering results, connecting knowledge graphs, and measuring RAG quality.
Why use it?
It helps avoid searches that miss exact keywords, return irrelevant results, become too expensive at large scale, or use outdated embeddings. It supports choosing a database and evaluating retrieval quality.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for selecting a vector database, combining keyword and meaning-based search, choosing indexes and compression, reordering results, connecting knowledge graphs, and measuring RAG quality.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/m3taz-ahmed/ai-globals/vector-db-lord
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add m3taz-ahmed/ai-globals --skill vector-db-lord
Clone the repo
git clone --depth 1 https://github.com/m3taz-ahmed/ai-globals

Made for: Claude Code, Codex.

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 vector-db-lord

README.md
[![agentmods](https://agentmods.dev/badge/skills/m3taz-ahmed/ai-globals/vector-db-lord/github.svg)](https://agentmods.dev/skills/m3taz-ahmed/ai-globals/vector-db-lord)
Your own site
<a href="https://agentmods.dev/skills/m3taz-ahmed/ai-globals/vector-db-lord"><img src="https://agentmods.dev/badge/skills/m3taz-ahmed/ai-globals/vector-db-lord/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 vector-db-lord

Your own site · 80×15
<a href="https://agentmods.dev/skills/m3taz-ahmed/ai-globals/vector-db-lord"><img src="https://agentmods.dev/badge/skills/m3taz-ahmed/ai-globals/vector-db-lord.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,616 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.00041 $0.01616
Opus 5 $0.00020 $0.00808
Sonnet 5 $0.00008 $0.00323
Haiku 4.5 $0.00004 $0.00162

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

Security

Grade A, and why

vector-db-lord 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 4d 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.

skills/vector-db-lord/SKILL.md · 67 lines

How it starts

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

Vector DB Lord

[OBJ] Design and optimize vector search and RAG systems — from DB selection and hybrid search to quantization, reranking, and evaluation — for production-grade retrieval at scale.

Problem

Vector search looks simple in a tutorial: embed, store, query. In production it breaks: pure dense search misses keyword matches, recall drops at scale, costs explode with billions of vectors, and stale embeddings return irrelevant results. RAG without hybrid search, reranking, and evaluation is a demo, not a system.

Rules

  1. [REQ] Vector DB selection. Pinecone serverless (managed, auto-scaling, good for start-ups), Weaviate 1.39 (hybrid built-in, modules for embeddings), Qdrant 1.13+ (Rust, fast filtering, self-hostable), Milvus (scale, billions of vectors, distributed), pgvector 0.8.2 (Postgres extension, good if already on PG), Chroma (embedded, prototyping), turbopuffer (serverless, S3-backed, cheap). Match DB to scale, hosting, and team expertise.
  2. [REQ] Hybrid search. Combine BM25 (keyword/lexical) + dense (semantic) + sparse (learned sparse like SPLADE). Weighted fusion or reciprocal rank fusion (RRF). Pure dense misses exact keyword matches; pure BM25 misses semantic similarity. Hybrid is the default for production RAG.
  3. [REQ] Query-time rescoring. Retrieve top-K (oversample, e.g., K=100) with fast approximate search, then rescore top-N (e.g., N=20) with a cross-encoder or ColBERT-style late interaction. Rescoring improves precision without full reranking cost.
  4. [REQ] MMR for diversity. Use Maximal Marginal Relevance (MMR) when result diversity matters (exploratory search, recommendation). MMR balances relevance and novelty — prevents top-K from being near-duplicates. Tunable λ: 1.0 = pure relevance, 0.0 = pure diversity.
  5. [REQ] Multi-vector / ColBERT late interaction. For high-precision retrieval, use ColBERT or multi-vector representations. Store token-level embeddings; late interaction scoring at query time. Higher storage cost but significantly better recall than single-vector.
  6. [REQ] Quantization. Use quantization to reduce memory and speed up search: 8-bit scalar (simple, 4× memory reduction, minimal recall loss), 4-bit (more aggressive, test recall), product quantization (PQ, good for billions), binary quantization (extreme compression, use for first-stage retrieval + rescore with full vectors).
  7. [REQ] Reranking. Always rerank top candidates with a cross-encoder model (Cohere Rerank, bge-reranker, Jina Reranker). Cross-encoders see query + document jointly, unlike bi-encoders. Reranking is the single highest-ROI step in RAG pipelines.
  8. [REQ] Knowledge graphs for agentic RAG. For agentic RAG, combine vector search with a knowledge graph (entity-relationship). The agent retrieves entities, traverses relationships, and synthesizes. GraphRAG (Microsoft) or Neo4j + vector hybrid. Pure vector RAG misses multi-hop reasoning.
  9. [REQ] Index selection. HNSW (default — fast query, high memory, good recall), IVF (good for billion-scale, lower recall, tunable nprobe), DiskANN (disk-based, good for large datasets that don't fit in RAM). Choose based on dataset size, latency target, and memory budget.
  10. [REQ] Filtering strategies. Pre-filtering (filter before vector search — accurate but slow if filter is selective), post-filtering (filter after — fast but may return too few results), in-filter (filter during search — Qdrant/Weaviate support this). Use in-filtering when available; it balances speed and accuracy.
  11. [REQ] Metadata management. Store metadata alongside vectors (source, date, tags, permissions). Filter on metadata at query time. Keep metadata schema consistent — schema drift breaks filters. Version metadata schema like any other schema.
  12. [REQ] Embedding model selection. Match embedding model to task: general (text-embedding-3-large, bge-m3), multilingual (multilingual-e5), domain-specific (BioBERT for medical, CodeBERT for code). Benchmark on YOUR data — don't trust the model's published benchmarks.
  13. [REQ] Chunking strategies. Chunk by semantic boundaries (paragraphs, sections) not fixed token count. Overlap chunks by 10-20% to preserve context. For code, chunk by function/class. For markdown, chunk by headers. Document the chunking strategy — it affects recall as much as the embedding model.
  14. [REQ] Evaluation metrics. Measure: recall@k (did the relevant doc appear in top-k?), nDCG (graded relevance, position-weighted), MRR (mean reciprocal rank, for single-relevant-answer queries). Evaluate on a held-out test set with human-labeled relevance. No RAG system ships without retrieval evaluation.
  15. [REQ] Cost optimization. Quantize vectors (8-bit or PQ), use serverless where possible (Pinecone serverless, turbopuffer), cache frequent queries, batch embedding API calls, use smaller embedding models for first-stage retrieval + larger for reranking. Monitor cost per 1K queries.
  16. [REQ] Scaling strategies. Vertical (bigger machine — HNSW in RAM) up to ~10M vectors. Horizontal sharding (partition by metadata or hash) for >10M. Disk-based (DiskANN) for datasets >RAM. Hybrid: hot data in RAM (HNSW), cold data on disk (DiskANN). Plan scaling before you need it.
  17. [REQ] Incremental updates. Support incremental insert/update/delete without rebuilding the index. HNSW supports this natively. For IVF, periodic rebuild needed. Document the update strategy — stale vectors return stale results.
  18. [PROHIBIT] Deploying a RAG system without hybrid search, reranking, and a retrieval evaluation test set — pure dense search without evaluation is a prototype, not production.

Read the full file on GitHub · 67 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. 4d ago Changed · +1 lines b71e888ca0c4
  2. 6d ago First seen · 66 lines · 41 tokens per session scan A e2686bb07d16

Subscribe to this mod's changes

vector-db-lord is a skill published in the GitHub repository m3taz-ahmed/ai-globals (5 stars, last pushed yesterday), licensed MIT. It adds 41 tokens to every session and 1,616 once invoked, about $0.0002 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-09-06.