ultimate-rag

Deliver Lyapunov-convergent RAG answers with self-critique and convergence tracking.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/lofibrainwav/AFO_Kingdom --skill ultimate-rag
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ultimate-rag
Source: https://github.com/lofibrainwav/AFO_Kingdom/tree/main/skills/ultimate-rag
Command: npx skills add https://github.com/lofibrainwav/AFO_Kingdom --skill ultimate-rag

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill delivers a hybrid Corrective RAG and Self-RAG system with mathematical convergence guarantees, reducing hallucinations and improving retrieval reliability.

Core Features & Use Cases

  • Corrective RAG (CRAG): threshold-based corrections, automatic web search fallback, and knowledge graph augmentation for entity relationships.
  • Self-RAG: self-critique and iterative refinement with convergence tracking to improve answer quality over iterations.
  • Lyapunov Convergence: formal guarantees of stability and convergence within a bounded number of iterations.

Quick Start

rag = UltimateRAG(top_k=5, max_iterations=10) result = rag.query("What is Trinity Score philosophy?") print(result.answer)

Frequently Asked Questions about ultimate-rag

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

FAQPage Schema
How does RAG reduce hallucinations in retrieval-based answers?

RAG mitigates hallucination by retrieving factual context from knowledge sources before generation, then applying self-critique loops and relevance thresholds to filter unreliable outputs. Lyapunov convergence guarantees iterative refinement stabilizes toward factually grounded answers within a bounded number of iterations.

What is self-RAG and how does it improve answer quality?

Self-RAG applies iterative self-critique to refine retrieved answers by evaluating their own quality and relevance at each step. Convergence tracking ensures the process stabilizes, progressively eliminating weak retrievals and improving factual accuracy through structured feedback loops.

Can I use automatic web search as a fallback when retrieval confidence is low?

Yes. This Skill includes threshold-based correction that automatically triggers web search fallback when relevance scores fall below confidence limits, and augments results with knowledge graph data to strengthen entity relationships and factual grounding.

How many iterations does it take for RAG answers to converge?

Convergence is mathematically bounded by Lyapunov stability guarantees, which limit iterations to a preset maximum—configurable via max_iterations—ensuring predictable completion time while maintaining answer quality improvement across refinement cycles.

What output metrics does this Skill provide to track answer reliability?

The Skill explicitly outputs confidence scores and iteration metrics, exposing convergence progress and answer stability. These metrics let you audit factual reliability and verify that answers have reached a stable, high-confidence state before use.

Do I need a vector database to use this RAG system?

Vector search is a core functional requirement for relevance scoring. You need access to vector embeddings and similarity search—either via an integrated vector database or external retrieval service—to execute the full retrieval and ranking pipeline.