--- name: km-rag-methodology description: Expertise in implementing Knowledge-Map RAG (KM-RAG), focusing on structured Knowledge Units, Graph relationships, and multi-stage retrieval in .NET. tags: [RAG, KnowledgeMap, GraphRAG, AI, .NET, CleanArchitecture] version: 1.0.0 --- # KM-RAG Methodology This skill provides a comprehensive framework for transitioning from basic chunk-based RAG to a structured **Knowledge-Map RAG (KM-RAG)** approach. ## Core Concepts - **Knowledge Units (KU)**: Granular pieces of information with stable IDs and types (Section, Table, Definition, Rule). - **Knowledge Map (Graph)**: Explicit links between units (`Next`, `Defines`, `Contains`) enabling contextual expansion. - **Multi-Stage Retrieval**: A pipeline starting with semantic candidate generation followed by graph expansion and optional reranking. - **Provenance & Governance**: Full traceability of AI answers back to their source units. ## Key Artifacts - [Core Concepts](artifacts/core_concepts.md): Deep dive into the methodology. - [Implementation Patterns (.NET)](artifacts/implementation_patterns.md): C# code for units, links, and retrieval. - [Quality Checklist](artifacts/evaluation_checklist.md): Metrics and safety procedures. - [Deep Research Report](artifacts/deep-research-report-rag.md): Original research on the KM-RAG approach. ## Usage Use this skill when: - Designing or refactoring RAG systems for high precision. - Implementing multi-tenant knowledge bases. - Enhancing AI answers with structural context from a graph. - Building evaluation pipelines for hallucination detection.