---
title: "GRAIN | The RAG Engineer"
description: "GRAIN is a retrieval loop: Gather, Rank, Assemble, Inspect, Navigate. Gather governs the corpus: sources, permissions, and versioning. Rank retrieves…"
image: "https://lenvanderhof.com/photos/len-portrait-1.jpg"
---

Framework

# GRAIN The RAG Engineer

GRAIN is a retrieval loop: Gather, Rank, Assemble, Inspect, Navigate. Gather governs the corpus: sources, permissions, and versioning. Rank retrieves candidate passages and reranks them for the question actually asked. Assemble builds the context the model may see. Inspect traces a wrong answer back to the chunk and retrieval decision behind it. Navigate keeps the index fresh: TTL policy, re-ingest, and change detection. If you cannot point at the passage, you do not have retrieval. You have a fluent guess.

The moves

5

## When to use it

Use it when a RAG demo cites the wrong paragraph with a straight face. If the team cannot open the chunk the model used, the loop is broken at Inspect.

## The moves

1. 01

### Gather

Source selection, permissions, versioning, and the corpus contract that decides what belongs in the index.
2. 02

### Rank

First-stage retrieval (dense, sparse, or hybrid), then a reranker that orders candidates before assembly.
3. 03

### Assemble

Token budget, chunk order, deduplication, instruction layout, and citations that keep evidence usable.
4. 04

### Inspect

Failure traces, bad-chunk workflows, and eval suites that connect a wrong answer to a retrieval decision.
5. 05

### Navigate

TTL policy, re-ingest jobs, change detection, and signals that show operators how old an answer could be.

Failure modes

## Why the demo fails in production

If you cannot open the source behind the sentence, you do not have RAG. You have a chat window with extra text pasted in. GRAIN is the inspectable loop. Failure is almost always a named letter, not a weaker model.

1. 01

### Gather



No corpus contract: permissions, versioning, and what belongs in the index were never written down. Stale files stay retrievable.
2. 02

### Rank



Candidates are ordered for a different question, or never reranked. The first-stage hit is treated as the answer.
3. 03

### Assemble



The cited chunk is not in the window the model actually saw. Context is stuffed; evidence is not usable.
4. 04

### Inspect



Nobody can open the passage used. There is no eval that ties a wrong answer to a retrieval decision.
5. 05

### Navigate



No TTL, no re-ingest, no signal of how old the answer could be. The demo was fresh. Production is not.

What is RAG?

## The book

Available now

### The RAG Engineer

Retrieval Systems That Agents Can Actually Trust in Production

Open the bookThe articleThe series

## Related frameworks

STACK

### The Agentic Codebase

STACK is a five-layer architecture for repositories where humans and agents share work: Structure, Toolchain, Agent configuration, Connection, Knowledge and quality. The agent OS is versioned like the app.

SENSE

### AI Agents for Startup Strategy

SENSE is a five-move strategic intelligence layer: Scan, Evaluate, Navigate, Simulate, Execute. It turns agent work from a productivity shortcut into a sourced claim that changes a watchlist, an assumption register, or a Monday decision.

CHORUS

### The Multi-Agent Organization

CHORUS is a six-skill coordination protocol for teams of 2 to 15 people who share work with specialised AI workers: Charter, Handoff, Orchestrate, Review, Update, Sync. Org charts name reporting lines. CHORUS names coordination lines.

ROUTE

### The Model Portfolio

ROUTE is a five-skill discipline for governing a mix of language models: Register, Objective typing, Utilize policy, Track, Evolve. Register catalogs every model with mandate, cost class, privacy class, and retirement status. Objective typing names what a task actually requires before a model is chosen. Utilize policy writes the routing rules, cascades, and fallbacks. Track measures cost, latency, and quality per route. Evolve promotes, demotes, and retires on a cadence. A leaderboard pick is a collection. ROUTE is a portfolio.

## Essays on this site

- [What is RAG? Retrieval, then generation](https://lenvanderhof.com/en/blog/what-is-rag/)

## Terminology

- [GRAIN](https://lenvanderhof.com/glossary/grain/)
- [STACK](https://lenvanderhof.com/glossary/stack/)
- [SENSE](https://lenvanderhof.com/glossary/sense/)
- [CHORUS](https://lenvanderhof.com/glossary/chorus/)
- [ROUTE](https://lenvanderhof.com/glossary/route/)
- [AI agent](https://lenvanderhof.com/glossary/ai-agent/)
- [Human in the loop](https://lenvanderhof.com/glossary/human-in-the-loop/)
- [Override doctrine](https://lenvanderhof.com/glossary/override-doctrine/)

Not a grain-size metaphor and not “we added a vector store.” GRAIN is the inspectable loop. RAG names the architecture. The RAG Engineer is available now in English and Dutch paperback, hardcover, and Kindle.

## Citation

GRAIN (The RAG Engineer). Len P. van der Hof, Systems for the Strategic Self. https://lenvanderhof.com/frameworks/grain/

```json
{
	"@context": "https://schema.org",
	"@graph": [
		{
			"@type": "DefinedTerm",
			"@id": "https://lenvanderhof.com/frameworks/grain/#term",
			"name": "GRAIN",
			"description": "GRAIN is a retrieval loop: Gather, Rank, Assemble, Inspect, Navigate. Gather governs the corpus: sources, permissions, and versioning. Rank retrieves candidate passages and reranks them for the question actually asked. Assemble builds the context the model may see. Inspect traces a wrong answer back to the chunk and retrieval decision behind it. Navigate keeps the index fresh: TTL policy, re-ingest, and change detection. If you cannot point at the passage, you do not have retrieval. You have a fluent guess.",
			"url": "https://lenvanderhof.com/frameworks/grain/",
			"inDefinedTermSet": "https://lenvanderhof.com/frameworks/"
		},
		{
			"@type": "WebPage",
			"@id": "https://lenvanderhof.com/frameworks/grain/#webpage",
			"url": "https://lenvanderhof.com/frameworks/grain/",
			"name": "GRAIN",
			"description": "GRAIN is a retrieval loop: Gather, Rank, Assemble, Inspect, Navigate. Gather governs the corpus: sources, permissions, and versioning. Rank retrieves candidate passages and reranks them for the question actually asked. Assemble builds the context the model may see. Inspect traces a wrong answer back to the chunk and retrieval decision behind it. Navigate keeps the index fresh: TTL policy, re-ingest, and change detection. If you cannot point at the passage, you do not have retrieval. You have a fluent guess.",
			"inLanguage": "en",
			"isPartOf": {
				"@id": "https://lenvanderhof.com/#website"
			},
			"about": {
				"@id": "https://lenvanderhof.com/frameworks/grain/#term"
			},
			"mainEntity": {
				"@id": "https://lenvanderhof.com/frameworks/grain/#term"
			},
			"breadcrumb": {
				"@id": "https://lenvanderhof.com/frameworks/grain/#breadcrumb"
			}
		},
		{
			"@type": "BreadcrumbList",
			"@id": "https://lenvanderhof.com/frameworks/grain/#breadcrumb",
			"itemListElement": [
				{
					"@type": "ListItem",
					"position": 1,
					"name": "Home",
					"item": "https://lenvanderhof.com/"
				},
				{
					"@type": "ListItem",
					"position": 2,
					"name": "Frameworks",
					"item": "https://lenvanderhof.com/frameworks/"
				},
				{
					"@type": "ListItem",
					"position": 3,
					"name": "GRAIN",
					"item": "https://lenvanderhof.com/frameworks/grain/"
				}
			]
		}
	]
}
```
