retrieval-search-orchestration
$
npx mdskill add lyndonkl/claude/retrieval-search-orchestrationEngineers optimal retrieval strategies for complex GraphRAG queries.
- Handles multi-hop reasoning and citation tracking for knowledge graphs.
- Integrates with RAG pipelines and knowledge graph query services.
- Decides execution by selecting global-first or hybrid search patterns.
- Delivers structured retrieval specifications with provenance citations.
SKILL.md
.github/skills/retrieval-search-orchestrationView on GitHub ↗
---
name: retrieval-search-orchestration
description: Designs retrieval strategies for querying knowledge graphs in RAG systems, covering pattern selection (global-first, local-first, U-shaped hybrid), query decomposition for multi-hop reasoning, ranking and constraint configuration, and provenance tracking for citation. Use when designing retrieval pipelines, orchestrating search over knowledge graphs, or when user mentions retrieval strategy, search orchestration, query decomposition, multi-hop reasoning, provenance tracking, or citation in GraphRAG.
---
## Table of Contents
- [Workflow](#workflow)
- [Step Descriptions](#step-descriptions)
- [Retrieval Pattern Selection Guide](#retrieval-pattern-selection-guide)
- [Query Decomposition Patterns](#query-decomposition-patterns)
- [Output Template](#output-template)
# Retrieval & Search Orchestration
## Workflow
Copy this checklist and work through each step:
- [ ] 1. Analyze query types and requirements
- [ ] 2. Select retrieval pattern
- [ ] 3. Design query decomposition strategy
- [ ] 4. Configure ranking and constraints
- [ ] 5. Design provenance tracking
- [ ] 6. Define fallback strategies
- [ ] 7. Produce retrieval strategy specification
## Step Descriptions
### Step 1: Analyze Query Types and Requirements
Classify the queries your system must handle. Common categories include:
- **Factoid lookups**: single-entity, single-hop (e.g., "What is the capital of France?")
- **Exploratory/thematic**: broad questions requiring aggregation across many entities (e.g., "What are the main themes in this corpus?")
- **Multi-hop reasoning**: questions requiring traversal of multiple relationships (e.g., "Which drugs treat diseases caused by gene X?")
- **Temporal queries**: questions bounded by time ranges or requiring sequence understanding
- **Constrained queries**: questions with type or attribute filters (e.g., "List all clinical trials after 2020 for drug Y")
Identify the distribution of these query types in your use case to guide pattern selection.
### Step 2: Select Retrieval Pattern
Use the Retrieval Pattern Selection Guide below to choose the right approach for your query distribution. See `resources/methodology.md` for detailed implementation guidance on each pattern.
### Step 3: Design Query Decomposition Strategy
For complex queries, break them into sub-queries that can be independently resolved and then aggregated. Approaches include LLM-as-controller decomposition, self-ask chains, and ReAct-style interleaved reasoning and retrieval. See the Query Decomposition Patterns section below and `resources/methodology.md` for details.
### Step 4: Configure Ranking and Constraints
Define how retrieved results are scored, ranked, and filtered:
- Embedding similarity thresholds
- Graph distance penalties
- Type-based pre-filters or post-filters
- Confidence score minimums
- Temporal decay functions for time-sensitive data
### Step 5: Design Provenance Tracking
Ensure every piece of retrieved information carries metadata about its origin. This includes source document IDs, extraction timestamps, confidence scores, and evidence chain construction. See `resources/provenance-patterns.md` for annotation approaches, confidence scoring, and LLM integration patterns.
### Step 6: Define Fallback Strategies
Design what happens when primary retrieval fails or returns insufficient results:
- Iterative deepening (expand hop count)
- Query relaxation (remove constraints progressively)
- Parallel exploration (try multiple patterns simultaneously)
- Graceful degradation (return partial results with confidence indicators)
### Step 7: Produce Retrieval Strategy Specification
Compile the full specification using the Output Template below.
---
## Retrieval Pattern Selection Guide
| Pattern | Best For | Mechanism | Trade-offs | Section Ref |
|---|---|---|---|---|
| **Global-First** | Broad thematic queries, corpus-level summaries | Community detection, top-down traversal of summarized indexes | High-level coverage; may miss specific details | 3.1 |
| **Local-First** | Entity-centric lookups, neighborhood exploration | Seed entity linking, 1-2 hop neighborhood expansion with embedding gates | High precision for known entities; limited scope | 3.2 |
| **U-Shaped Hybrid** | Complex queries needing both breadth and depth | Coarse-to-fine bidirectional search, top-down then bottom-up refinement | Best coverage; higher latency and complexity | 3.3 |
| **Query Decomposition** | Multi-hop reasoning, composite questions | LLM breaks query into sub-queries, sequential retrieval, aggregation | Handles complex questions; depends on decomposition quality | 3.4 |
| **Temporal** | Time-bounded or sequence-dependent queries | Time-slice filtering, episodic windowing, time-decay ranking | Captures temporal dynamics; needs temporal metadata | 3.5 |
| **Constraint-Guided** | Type-filtered or rule-bounded queries | Pre-filter + vector search, symbolic query then neural re-rank | Reduces search space; requires well-typed schema | 3.6 |
**Selection heuristic**: Start with the dominant query type in your system. If queries are mixed, consider U-Shaped Hybrid as a default with fallback to specialized patterns.
---
## Query Decomposition Patterns
### LLM-as-Controller
The LLM receives the original query and generates a plan of sub-queries:
```
Original: "Which drugs treat diseases linked to mutations in BRCA1?"
Sub-query 1: "What diseases are linked to mutations in BRCA1?"
Sub-query 2: "What drugs treat [diseases from sub-query 1]?"
Aggregation: Combine results, deduplicate, rank by evidence strength
```
### Self-Ask Chain
The model iteratively asks itself follow-up questions, retrieving after each:
```
Q: "What is the relationship between company X and technology Y?"
Follow-up 1: "What products does company X produce?" -> retrieve
Follow-up 2: "Which of those products use technology Y?" -> retrieve
Follow-up 3: "What partnerships exist between X and Y providers?" -> retrieve
Synthesize: Combine all retrieved evidence into final answer
```
### ReAct Pattern
Interleave reasoning and retrieval actions:
```
Thought: I need to find the connection between entity A and entity C
Action: Search KG for paths between A and C (max 3 hops)
Observation: Found path A -> B -> C via relationship R1 and R2
Thought: I should verify this path with supporting evidence
Action: Retrieve source documents for edges A-B and B-C
Observation: Edge A-B supported by [doc1, doc2], edge B-C supported by [doc3]
Answer: A connects to C through B, supported by 3 source documents
```
### Tool-Augmented Retrieval
Generate formal queries (Cypher, SPARQL) for structured graph traversal:
```
LLM generates: MATCH (d:Drug)-[:TREATS]->(dis:Disease)<-[:CAUSES]-(g:Gene {name: 'BRCA1'})
RETURN d.name, dis.name, g.name
Execute against graph database
Post-process results with LLM for natural language answer
```
---
## Output Template
```markdown
# Retrieval Strategy Specification
## System Context
- **Domain**: [e.g., biomedical, legal, financial]
- **Knowledge Graph Type**: [e.g., property graph, RDF, hybrid]
- **Primary Query Types**: [list dominant query categories]
- **Scale**: [approximate node/edge counts, query volume]
## Retrieval Pattern
- **Primary Pattern**: [selected pattern from guide]
- **Rationale**: [why this pattern fits the query distribution]
- **Secondary/Fallback Pattern**: [if applicable]
## Query Decomposition
- **Strategy**: [LLM-as-controller / self-ask / ReAct / tool-augmented / none]
- **Max Sub-queries**: [limit per original query]
- **Aggregation Method**: [union / intersection / ranked merge / LLM synthesis]
## Ranking & Constraints
- **Similarity Threshold**: [minimum embedding similarity score]
- **Max Hop Distance**: [maximum graph traversal depth]
- **Type Filters**: [entity/relationship type constraints]
- **Temporal Constraints**: [time windows, decay functions]
- **Confidence Minimum**: [minimum source confidence for inclusion]
## Provenance Design
- **Annotation Method**: [metadata fields / evidence nodes / named graphs / reification]
- **Confidence Scoring**: [source reliability tiers, aggregation rules]
- **Citation Format**: [inline / post-hoc / both]
- **Conflict Resolution**: [timestamp priority / source authority / LLM adjudication]
## Fallback Strategy
- **Primary Fallback**: [iterative deepening / query relaxation / parallel exploration]
- **Max Retry Depth**: [number of fallback attempts]
- **Degradation Policy**: [partial results with confidence / explicit uncertainty / escalation]
## Evaluation Criteria
- Reference: `resources/evaluators/rubric_retrieval.json`
- **Target Score**: [minimum acceptable weighted score]
```
More from lyndonkl/claude
- abstraction-concrete-examplesBuilds structured abstraction ladders that translate high-level principles into concrete, actionable examples across 3-5 levels. Bridges communication gaps, reveals hidden assumptions, and tests whether abstract ideas work in practice. Use when explaining concepts at different expertise levels, moving between abstract principles and concrete implementation, identifying edge cases by testing ideas against scenarios, designing layered documentation, decomposing complex problems into actionable steps, or bridging strategy-execution gaps.
- academic-letter-architectGuides the creation of evidence-based academic recommendation letters, reference letters, and award nominations that combine concrete examples, meaningful comparisons, and genuine enthusiasm. Use when writing recommendation letters for students, postdocs, or colleagues, or when user mentions recommendation letter, reference, nomination, letter of support, endorsement, or needs help with strong advocacy and comparative statements.
- adr-architectureDocuments significant architectural and technical decisions with full context, alternatives considered, trade-offs analyzed, and consequences understood. Creates a decision trail that helps teams understand why decisions were made. Use when choosing between technology options, making infrastructure decisions, establishing standards, migrating systems, or when user mentions ADR, architecture decision, technical decision record, or decision documentation.
- adverse-selection-priorProduces a Bayesian prior probability that an offered transaction is +EV for the recipient, given that the counterparty chose to propose it. Applies Akerlof market-for-lemons logic -- if they offered it, they believe it is +EV for them, so the prior that it is +EV for us is materially below 50%. Reusable across trade evaluation, waiver drops (another team dropping a player is also adverse selection), job-offer analysis, M&A, and any "someone offered me this" situation. Use when you receive an unsolicited trade/offer/proposal, analyzing incoming trade prior, evaluating why a counterparty proposed a deal, or when user mentions adverse selection, market for lemons, why did they offer this, incoming trade prior, they proposed it, Bayesian adjustment on received offer.
- alignment-values-north-starCreates actionable alignment frameworks that give teams a shared North Star (direction), values (guardrails), and decision tenets (behavioral standards). Enables autonomous decision-making while maintaining organizational coherence. Use when starting new teams, scaling organizations, defining culture, establishing product vision, resolving misalignment, creating strategic clarity, or when user mentions North Star, team values, mission, principles, guardrails, decision framework, or cultural alignment.
- analogy-weight-checkFor every analogy in a substacker draft, verifies it carries mechanical weight — the analogy does real work explaining the mechanism, not merely decorates it. Cross-references analogy-catalog.md for novelty (is this analogy reused from a prior post?) and domain fit (biology > organizational > sports preferred; physics/military disfavored). Use whenever an analogy appears in the draft. Trigger keywords: analogy weight, decorative, mechanical weight, reused analogy, catalog check, metaphor check.
- answer-uncomfortable-questionTakes one strategic question about substacker ("should we launch paid?", "is this section dead?", "are we writing for the wrong audience?") and produces the mandatory evidence + reasoning + downside triad plus a recommendation. Used 3 times per Growth Strategist review. Trigger keywords: uncomfortable question, strategic question, evidence reasoning downside, triad.
- attribute-performanceFor each substacker post that materially over- or under-performs the rolling baseline (|z| ≥ 1.0), produces a plain-English attribution paragraph with calibrated confidence (high / medium / low / unexplained). Considers subject-line effect, topic zeitgeist, external share, day-of-week, length effect, and audience-notes signals. Labels unexplained outliers explicitly rather than fabricating a story. Use after compute-baseline when outlier posts exist. Trigger keywords: attribution, why did this post work, outlier explanation, performance analysis.
- auction-first-price-shadingComputes the optimal shaded bid for a first-price sealed-bid auction given a true private value, an estimate of the number of competing bidders N, and a value-distribution assumption. Implements the `(N-1)/N` equilibrium shading rule for uniform private values, adjusts for log-normal or empirical value distributions, layers a risk-aversion adjustment, and caps output against the bidder's remaining budget. Domain-neutral auction theory reusable across fantasy sports (baseball FAAB, NBA/NHL waiver auctions), prediction-market limit sizing, sealed procurement bids, and any blind-bid context. Use when user mentions "first-price auction bid", "sealed bid shading", "(N-1)/N", "FAAB bid amount", "auction shading", "optimal bid first-price", "bid for sealed-bid", "blind bid sizing", or when downstream logic needs a principled shade factor rather than an ad-hoc heuristic.
- auction-winners-curse-haircutApplies a Bayesian haircut to a bid valuation for common-value auctions where winning is itself evidence the bidder over-estimated. Takes a raw valuation, a value-type classification (common_value / private_value / mixed), the number of informed bidders N, and a signal-dispersion estimate, and returns an adjusted valuation. Domain-neutral and reusable across fantasy FAAB, prediction markets, M&A bids, ad-auction budgets, and any generic bidding context. Use when user mentions "winner's curse", "common value auction", "valuation haircut", "adverse valuation", "Bayesian bid adjustment", or "over-paying in auction".