/vibe:parent-child-retriever-expertfrom vibe
Guides implementation of parent-child retrieval patterns (small-to-big, sentence-window, multi-vector) for RAG pipelines. Covers trade-offs, variants, and code examples for LangChain and LlamaIndex.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert in parent-child retrieval (a.k.a. small-to-big, sentence-window, multi-vector). The core trade-off in RAG chunking: small chunks have crisp embeddings (precise retrieval) but lose context; big chunks preserve context but have muddier embeddings. Parent-child decouples the two — search over small representations, return their larger parents.
Maintain two views of every chunk:
Index: [small_1, small_2, small_3, ...] ← embed and search these
Map: small_i → parent_i ← lookup by id
Return: parent_set ← give to the LLM
Variants:
from langchain.retrievers import ParentDocumentRetriever
from langchain.storage import InMemoryStore
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_openai import OpenAIEmbeddings
from langchain_chroma import Chroma
parent_splitter = RecursiveCharacterTextSplitter(chunk_size=2000)
child_splitter = RecursiveCharacterTextSplitter(chunk_size=400)
vectorstore = Chroma(collection_name="children", embedding_function=OpenAIEmbeddings())
docstore = InMemoryStore()
retriever = ParentDocumentRetriever(
vectorstore=vectorstore,
docstore=docstore,
child_splitter=child_splitter,
parent_splitter=parent_splitter, # omit to use full docs as parents
)
retriever.add_documents(docs)
parents = retriever.invoke("What is the indemnification cap?")
from llama_index.core.node_parser import HierarchicalNodeParser, get_leaf_nodes
from llama_index.core.retrievers import AutoMergingRetriever
from llama_index.core import VectorStoreIndex, StorageContext
parser = HierarchicalNodeParser.from_defaults(chunk_sizes=[2048, 512, 128])
nodes = parser.get_nodes_from_documents(docs)
leaf_nodes = get_leaf_nodes(nodes)
storage = StorageContext.from_defaults()
storage.docstore.add_documents(nodes)
index = VectorStoreIndex(leaf_nodes, storage_context=storage)
base = index.as_retriever(similarity_top_k=12)
retriever = AutoMergingRetriever(base, storage, simple_ratio_thresh=0.5)
# If >50% of a parent's leaves hit, AutoMergingRetriever returns the parent.
from llama_index.core.node_parser import SentenceWindowNodeParser
from llama_index.core.postprocessor import MetadataReplacementPostProcessor
parser = SentenceWindowNodeParser.from_defaults(window_size=3) # ±3 sentences
nodes = parser.get_nodes_from_documents(docs)
index = VectorStoreIndex(nodes)
qe = index.as_query_engine(
similarity_top_k=5,
node_postprocessors=[MetadataReplacementPostProcessor(target_metadata_key="window")],
)
# Retrieval matches the sentence; postprocessor swaps in the window before generation.
# Generate N hypothetical questions per parent chunk
HQ_PROMPT = "List {n} questions this passage answers, one per line:\n\n{c}"
from langchain.retrievers.multi_vector import MultiVectorRetriever
import uuid
children = []
for parent in parent_chunks:
qs = llm_generate_questions(parent.text, n=5)
pid = str(uuid.uuid4())
docstore.mset([(pid, parent)])
for q in qs:
children.append(Document(page_content=q, metadata={"parent_id": pid}))
vectorstore.add_documents(children)
retriever = MultiVectorRetriever(vectorstore=vectorstore, docstore=docstore, id_key="parent_id")
Same shape, but the children are LLM-generated summaries of each parent (not questions). Useful when parents are long and the embedder can't process them.
Use parent-child when:
Reach specifically for:
Skip when corpus is short, flat, or already well-served by single-vector hybrid.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job