eight examples · two integrated RAG pipelines

Beyond “just add a vector database.”

A rigorous, executable map of retrieval, reusable context, graphs, tables, memory, and tools—built to show where each mechanism works and where the acronyms stop.

17concepts mapped
8showcase examples
95%+branch coverage gate
0required API keys

Different mechanisms. One inspectable runtime.

Both RAG paths preserve provenance and produce decision traces. The other runnable primitives expose mechanism-specific outputs such as cache metrics, graph facts, recalled memory, row provenance, and tool results.

01

Question

Intent, constraints, scope

02

Select

Explicit RAG strategy or separately constructed primitive

03

Authorize RAG

Trust and ACLs before document indexing

04

Augment

Select or compute evidence

05

Return

Cited RAG answer or inspectable result

06

Evaluate

Versioned lexical regression fixture

Choose the knowledge operation, not the trend.

Filter by family. “Advanced” and “agentic” are umbrellas; Self-RAG, CRAG, CAG, KAG, and database TAG have specific fidelity boundaries.

runnable

Naive RAG

Chunk → retrieve top-k → inject evidence → generate with citations.

Watch: retrieval errors flow directly into generation.

runnable

Advanced RAG

Transform queries, fuse retrievers, rerank, and filter.

Boundary: an umbrella, not one reproducible algorithm.

architecture

Modular RAG

Compose replaceable retrievers, routers, verifiers, memory, and generators.

Requires: typed contracts, traces, and disciplined configuration.

runnable

Hybrid RAG

Combine exact lexical ranking and vector-space ranking with RRF.

Lab: BM25 + transparent TF-IDF baseline.

architecture

Multi-hop RAG

Decompose and alternate retrieval with evidence accumulation.

Watch: error propagation and runaway loops.

paper-specific

Self-RAG

A trained model emits retrieval and reflection tokens.

Not: any generic prompt-based critique loop.

paper-specific

CRAG

Evaluate retrieval, refine knowledge, and use fallback sources.

Generic analogue: call it crag-inspired.

router

Adaptive RAG

Route no-retrieval, single-hop, or iterative retrieval by query complexity.

Watch: routing mistakes become a new failure mode.

umbrella

Agentic RAG

A bounded controller selects sources, observes, replans, and stops.

Requires: budgets, loop detection, and permissions.

teaching-scale

GraphRAG

Local graph evidence plus global community-level reports.

Lab: connected communities, not full Microsoft GraphRAG.

runnable mini-kag

KAG / KG-RAG

Use graphs, ontologies, rules, or schemas for explicit reasoning.

Boundary: OpenSPG KAG is a specific full stack.

runnable primitive

Table augmentation

Validated equality filters and finite calculations with row-index provenance.

Full TAG: combines DB and LM semantic operators.

simulator

CAG

Preload stable knowledge and reuse a model KV/prefix cache.

Lab: context reuse metrics, not fake past_key_values.

baseline

Long context

Place the corpus directly in context, with or without retrieval.

Watch: token cost and lost-in-the-middle effects.

runnable primitive

Memory augmentation

Append and lexically recall process-local scoped strings.

Missing: persistence, provenance, correction, TTL, and deletion.

runnable primitive

Tool augmentation

Call a registered Python function through name and keyword allowlists with finite JSON-compatible immutable records.

Missing: semantic per-tool schemas, authorization, timeout, sandbox, and durable audit logs.

extension

Multimodal RAG

Retrieve across text, images, audio, video, tables, and layout.

Requires: modality-specific provenance and evaluation.

Claims should match the mechanism.

The project deliberately avoids tutorial theater: no API key is needed, TF-IDF is not called a semantic model, and a cached string is not called a model KV cache.

✓Source trust and ACLs run before indexing in the integrated document-RAG path.
✓Both RAG answers retain evidence IDs and immutable structured traces.
✓Teaching simulations are separated from faithful paper reproductions.
✓A three-case lexical regression fixture is executable; broader evaluation is not claimed.
$ python -m pip install --require-hashes -r constraints/build.txt
$ python -m pip install --require-hashes -r constraints/py311.txt
$ python -m pip install --no-build-isolation --no-deps -e .
$ kal showcase
$ kal evaluate --check

{
  "naive-rag": { "citations": [...] },
  "advanced-rag": { "trace": [...] },
  "cag": { "cache_hits": 1 },
  "kag": { "facts": [...] },
  "graph-rag": { "community_reports": [...] },
  "memory-augmented": {...},
  "table-augmented": {...},
  "tool-augmented": {...}
}

Read the trace, not just the answer.

Clone the project, run every path locally, and inspect the RAG decision traces alongside each primitive's mechanism-specific output.

Open on GitHub ↗