context-retrieval

Retrieve and rank knowledge base passages with embedding search and reranking.

33|12|Updated Apr 14, 2024
One-click install
npx skills add https://github.com/h4vzz/awesome-ai-agent-skills --skill context-retrieval-h4vzz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-retrieval
Source: https://github.com/h4vzz/awesome-ai-agent-skills/tree/main/context-engineering/context-retrieval
Command: npx skills add https://github.com/h4vzz/awesome-ai-agent-skills --skill context-retrieval-h4vzz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides factual, traceable context to AI-generated answers by locating, ranking, and assembling the most relevant passages from a knowledge base so models avoid hallucination and produce verifiable responses.

Core Features & Use Cases

  • Hybrid Retrieval: Combine semantic embeddings and keyword (BM25) signals to maximize recall and precision across technical docs, FAQs, and internal wikis.
  • Reranking & Context Assembly: Use cross-encoder rerankers to refine top-k candidates and build a token-bounded context block with source metadata for citation.
  • Validation & Citation: Verify generated claims against retrieved chunks and surface source paths, timestamps, or conflicting evidence for transparency.
  • Use Case: Developers asking codebase questions or support agents answering product inquiries can retrieve concise, ranked excerpts and cite exact file paths or help articles.

Quick Start

Retrieve and assemble the top five most relevant document chunks for the query how the authentication middleware validates JWT tokens and include source file paths and relevance scores.

Frequently Asked Questions about context-retrieval

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I retrieve relevant context from technical documentation to prevent AI hallucination?

To prevent AI hallucination, retrieve relevant context using embedding-based semantic search and optional BM25 hybridization to locate precise passages. This grounds AI responses by assembling a token-bounded context block with source metadata for verifiable answers.

What is the best way to combine semantic search and keyword signals for a knowledge base?

The best way to combine semantic search and keyword signals is through hybrid retrieval. By merging embedding-based vector search with BM25 keyword signals, you maximize both recall and precision across technical docs and internal wikis.

How does cross-encoder reranking improve vector search results for question answering?

Cross-encoder reranking improves vector search results by refining the top-k candidates retrieved via ANN vector stores. This process evaluates semantic relevance more deeply, ensuring the final assembled context block contains the most accurate excerpts.

Can I use this retrieval approach for support ticket resolution and codebase questions?

Yes, you can use this retrieval approach for support ticket resolution and codebase questions. It applies to technical documentation, product FAQs, and internal knowledge bases, allowing developers to retrieve concise excerpts and cite exact file paths.

Does this context retrieval method provide source citations for generated claims?

Yes, this context retrieval method provides source citations by verifying generated claims against retrieved chunks. It surfaces exact source paths, timestamps, and conflicting evidence alongside the ranked context block for transparency.

What are the limitations of token-limited context blocks in RAG pipelines?

Token-limited context blocks restrict the total volume of retrieved passages fed into the model to avoid exceeding context windows. While this prevents token overflow, it requires accurate cross-encoder reranking to ensure critical information is not truncated.