Back to skills
SkillHub ClubAnalyze Data & AIFull StackData / AI

ultimate-rag

Hybrid Corrective RAG + Self-RAG implementation with Lyapunov-proven convergence for hallucination-free retrieval.

Packaged view

This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.

Stars
1
Hot score
77
Updated
March 20, 2026
Overall rating
C2.8
Composite score
2.8
Best-practice grade
A85.2

Install command

npx @skill-hub/cli install lofibrainwav-afo-kingdom-ultimate-rag

Repository

lofibrainwav/AFO_Kingdom

Skill path: skills/ultimate-rag

Hybrid Corrective RAG + Self-RAG implementation with Lyapunov-proven convergence for hallucination-free retrieval.

Open repository

Best for

Primary workflow: Analyze Data & AI.

Technical facets: Full Stack, Data / AI.

Target audience: everyone.

License: MIT.

Original source

Catalog source: SkillHub Club.

Repository owner: lofibrainwav.

This is still a mirrored public skill entry. Review the repository before installing into production workflows.

What it helps with

  • Install ultimate-rag into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
  • Review https://github.com/lofibrainwav/AFO_Kingdom before adding ultimate-rag to shared team environments
  • Use ultimate-rag for development workflows

Works across

Claude CodeCodex CLIGemini CLIOpenCode

Favorites: 0.

Sub-skills: 0.

Aggregator: No.

Original source / Raw SKILL.md

---
name: ultimate-rag
description: Hybrid Corrective RAG + Self-RAG implementation with Lyapunov-proven convergence for hallucination-free retrieval.
license: MIT
compatibility:
  - claude-code
  - codex
  - cursor
metadata:
  version: "2.0.0"
  category: rag-systems
  author: AFO Kingdom
  philosophy_scores:
    truth: 98
    goodness: 95
    beauty: 90
    serenity: 92
---

# Ultimate RAG (Hybrid CRAG + Self-RAG)

Advanced retrieval-augmented generation combining Corrective RAG and Self-RAG techniques with mathematical convergence guarantees.

## Architecture

```
Query → [Vector Search] → [Relevance Check] → [Self-Critique] → [Corrective Loop] → Answer
                              ↓                    ↓
                         [Web Search]        [Regenerate]
                              ↓                    ↓
                         [Knowledge Graph] ← [Lyapunov Check]
```

## Features

### Corrective RAG (CRAG)
- Relevance scoring with threshold-based correction
- Automatic web search fallback for low-confidence retrievals
- Knowledge graph augmentation for entity relationships

### Self-RAG
- Self-critique mechanism for answer validation
- Iterative refinement with convergence tracking
- Hallucination detection and prevention

### Lyapunov Convergence
- Mathematical proof of answer stability
- Guaranteed convergence within N iterations
- Quantifiable improvement metrics

## Usage

```python
from AFO.rag import UltimateRAG

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

# Result includes confidence and convergence metrics
print(f"Answer: {result.answer}")
print(f"Confidence: {result.confidence}")
print(f"Iterations: {result.iterations}")
print(f"Lyapunov Delta: {result.lyapunov_delta}")
```

## Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| query | string | required | User question |
| top_k | int | 5 | Number of documents to retrieve |
| max_iterations | int | 10 | Maximum self-correction iterations |
| relevance_threshold | float | 0.7 | Minimum relevance score |

## Philosophy Alignment

- **眞 (Truth)**: Lyapunov-proven retrieval accuracy
- **善 (Goodness)**: No hallucinations, stable answers
- **美 (Beauty)**: Clean retrieval pipeline
- **孝 (Serenity)**: Auto-converges without user intervention
ultimate-rag | SkillHub