docs/Mesh & Discovery/Mesh-Augmented Generation

Mesh-Augmented Generation

RAG retrieves from documents. The mesh retrieves from live, structured grids with lineage.

The problem with RAG

Retrieval-Augmented Generation chunks static documents, embeds them, and retrieves by cosine similarity. It works well for text. It breaks for structured, changing data — because the chunks go stale and lose context the moment the underlying data changes.

What MAG does differently

RAGMAG
Static document chunksLive structured grids
Embedding vectors age outAlways the latest push
No provenance per rowSHA-256 + version per row
Retrieves nearest textRetrieves by schema + query
Good for: docs, PDFs, notesGood for: data, metrics, logs

A concrete example

Your agent is asked: "What was our APAC revenue in Q2?" With RAG, it searches a PDF that was last updated three months ago. With MAG, it searches the mesh for the latest sales-q2 grid, gets a sample of the actual rows, sees the version and timestamp, and answers with a citation.

// MAG answer:
"APAC Q2 revenue was $4.2M across 1,240 transactions.
Source: raihan/sales-q2 · v42 · pushed 2026-05-07 via cli · sha256 e3b0c4…"

Combining MAG and RAG

They're not mutually exclusive. Use RAG for unstructured docs — design specs, meeting notes, RFCs. Use MAG for anything tabular, metered, or regularly updated. The mesh search result includes a schema so the model knows which columns to reference.

Tip: Name grids after the question they answer, not after the source file. q2-apac-revenue retrieves better than export-2026-05.jsonl.