insight

OKF and RAG in the same system

Jens Østergaard9 min read

Software architect and consultant. Works with business-led product development, distributed systems, operational AI, and production software delivery.

Answer first

The Open Knowledge Format describes a corpus. Retrieval finds things in one. What each contributes when they run together, what the pair does that neither does alone, and how to tell which of the three shapes your problem needs.

The Open Knowledge Format was read in a lot of places as a challenger to retrieval-augmented generation. It answers a different question. OKF specifies what a corpus looks like on disk. Retrieval decides what to pull out of one at query time. A team can adopt either without the other, and the interesting configuration is the one where both are present, because each supplies something the other has no way to produce.

What follows assumes the format itself is familiar. If it is not, what the Open Knowledge Format does covers the specification and its trust fields.

What each one owns

QuestionOKF answersRetrieval answers
What is a unit of knowledge?One markdown file, one concept, identified by its path in the bundle.One chunk, sized by whatever the ingest pipeline decided.
What is this document about?A required type field, plus tags, description, and a link to the underlying asset.Whatever the embedding places near the query vector.
How current is it?status and stale_after, written by the producer as an absolute date.Index freshness, which is a property of the last ingest run.
Who vouches for it?generated and verified, resolving to a trust tier.Nothing. Rank is a similarity score.
Which of ten thousand documents matters here?Nothing. A bundle has no ranking.The entire job.
Who may see it?Nothing. A bundle is a directory of files.Nothing, unless you built it.
The two bottom rows are the ones to keep in view. Ranking is absent from the format by design, and access control is absent from both.

The overlap is smaller than the announcement coverage suggested. The specification's non-goals rule out storage, serving and query infrastructure outright, which is the whole of what a retrieval stack is.

What the pair does that neither does alone

Six things, in rough order of how much they are worth in a system that already works.

  • A filter vocabulary that is declared rather than inferred. Most hybrid stacks have a structured leg alongside the dense and lexical ones, filled with metadata each team invented locally. type, tags and status arrive already agreed, and type is the highest-precision filter in the set because the format requires it.
  • Trust as a retrieval signal. The tier derived from verified becomes either a hard gate, where a regulated answer draws only from human-reviewed concepts, or a term in the fusion score alongside dense and lexical rank. Nothing in a similarity score carries this.
  • Freshness evaluated at query time. stale_after is an absolute date, so a concept can be demoted or excluded on the day it goes stale without waiting for a reindex.
  • Citations that survive an ingest. A concept ID is its path in the bundle, so an answer can cite something stable, and a rewritten paragraph does not orphan the reference the way a content hash does.
  • Cheap incremental reindexing. Bundles ship in git and carry a log.md of changes newest first, so the set of concepts to re-embed is a diff rather than a full rebuild.
  • Numbers that are computed rather than paraphrased. An Attested Computation carries the sanctioned way to produce a value, so a system answering with a figure can run it and return a receipt instead of reading the number out of a passage.
Retrieval decides what is relevant. The format is where an answer to "and should we be relying on it" can come from.
Step 1 of 6: What retrieval returns on its own

The question is about a definition. Similarity finds three passages that mention one, ranks them correctly, and stops there.

One query, two tiersDemo
Retrieval alone, ranked by similarity
  • 0.83...net revenue for the quarter was restated after the Q2 adjustment, see appendix B...
  • 0.79...we take net revenue net of returns and discounts for internal reporting...
  • 0.74...the net revenue in the board pack differs from the dashboard because...

Three passages, correctly ranked. Which definition is the sanctioned one, who owns it, and whether it still holds are not questions a score can answer.

The same six contributions on one question, from what similarity returns alone to a cited, scoped answer. Scroll to move through the steps.

The shape that works

In practice the pair settles into two tiers rather than one merged corpus.

The upper tier is the bundle: a few hundred concepts describing systems, tables, metrics, processes and policies. Small enough to review, owned by someone, generated from the systems of record and regenerated on a schedule. This is where curation effort concentrates, and it is the layer that carries type, trust and lifecycle.

The lower tier is everything else: contracts, case files, tickets, minutes, specifications, the long tail nobody will ever curate. Chunked and embedded as usual, with no promises attached.

A query enters at the top. Concepts are retrieved first, filtered by type and status, gated or ranked by trust tier. Each concept's resource field and its cross-links then point at the documents worth pulling from the lower tier, which turns an open-ended search over the whole corpus into a scoped one. The link graph between concepts gives neighbour expansion without a graph database, since the parent-child hierarchy and the markdown links are already there.

The upper tier also degrades usefully. When no concept matches, the system falls through to plain retrieval over the documents and answers with whatever confidence that warrants, which is the honest outcome for a question the curated layer was never built to cover.

The curated layer takes the query first and filters it on fields the format requires. The document tail is searched where a concept points, and directly when none does.

When one of them is enough

A bundle on its own

Works when the corpus is bounded and the questions are about structure. A few hundred concepts, an agent that walks index.md down the tree, questions of the form what is this table, how does it join, which metric is the sanctioned one. No ranking is needed because the hierarchy does the narrowing, and no embedding budget is spent.

It is also the right answer when portability is the actual requirement. A handover, an exit clause, a knowledge base that has to outlive the platform holding it. A directory of markdown in git satisfies that on its own, and building retrieval over it is a separate decision you can defer.

Retrieval on its own

Works when the corpus is large, heterogeneous and unowned. Nobody is going to write frontmatter for two hundred thousand case documents, and no producer exists to generate it. The questions are about content buried in prose rather than about the shape of a system, and the material changes faster than any curation process could track.

Adding a bundle here produces a thin layer of generated descriptions that nobody reviews, which is worse than nothing, because a stale concept carries the same declared trust as a maintained one.

Both

The case is strongest where a small curated core sits under a large uncurated tail, and where an answer has to be defensible. Regulated decisions, anything where provenance is asked for after the fact, anything producing figures. Multiple consumers is the other trigger: once two or more systems read the same knowledge, the format stops being overhead and becomes the contract between them.

SignalBundle onlyRetrieval onlyBoth
Corpus sizeTens to a few hundred conceptsThousands upwardSmall curated core, large tail
Who maintains itA named owner, or a generatorNobodyOwner for the core, nobody for the tail
Question shapeWhat is this, how does it fitWhere is it saidBoth, routed by the top tier
Provenance requiredUsefulUnavailableThe reason to do it
Answers include figuresAttested computationParaphrase, with the risk that carriesCompute from the concept, cite the document
Main costCuration disciplineRanking quality and evaluationBoth, plus keeping the tiers in step

What it costs to run both

A bundle is a second artifact that has to stay synchronised with the systems it describes. Generate it, never hand-author it, and regenerate on a schedule; a hand-written bundle becomes a competing system of record within a quarter.

The trust fields are worth exactly as much as the pipeline that writes them. Gating retrieval on human-reviewed is meaningful when only the process that performed the review may write a human: actor. Ingesting someone else's bundle and honouring its verified field is trusting the producer, and no amount of parsing changes that.

Filters have to degrade. Conformance requires only parseable frontmatter with a non-empty type, and consumers are forbidden from rejecting a bundle over anything else, so absent stale_after means unknown rather than fresh, and absent verified means unverified rather than failed.

Frontmatter does not belong in the embedding. Embed the body with the title and description; index the rest as filters and lexical terms. Concatenating YAML into the embedded text degrades the dense leg for no gain.

And permissions remain yours. A bundle carries no access control, an index built over one inherits none, and the enforcement work is the same as it was before either technology arrived. Retrieval that respects access control is the piece on what that actually takes.

What we recommend

  • If you already run retrieval and it works, add a bundle over the twenty concepts that answer most questions, and use it as a filter and trust layer above the existing index. Nothing about the pipeline has to change to try it.
  • If you are starting, build the concept layer first. It is smaller, cheaper to evaluate, and it tells you whether the questions people actually ask need the document tail at all.
  • Route by question type rather than blending everything into one index. Structure questions to the concept layer, content questions to the documents, figures to the computation.
  • Own the type vocabulary. It is the only required field, the format prescribes no taxonomy, and it is the decision that is expensive to reverse once two consumers depend on it.
  • Keep the evaluation on the retrieval side. The format contributes filters and signals; whether the answers got better is still measured the way it always was.

The pairing is worth the effort for one reason. Retrieval systems have always been able to say what is relevant and have never been able to say whether it should be relied on. That second question is now expressible in the corpus itself, which is a better place for it than a convention in one team's ingest script.

Does OKF replace RAG?
No. OKF specifies how a corpus is laid out on disk. Retrieval decides what to pull from a corpus at query time. The specification lists storage, serving and query infrastructure as non-goals, so it defines no index, no ranking, and no query layer.
What does a bundle add to an existing retrieval pipeline?
A declared filter vocabulary in type, tags and status; a trust tier derived from the verified field that can gate or rank results; query-time staleness from stale_after; stable concept IDs for citation; a change log that makes reindexing incremental; and attested computations for answers containing figures.
How should the two be arranged?
As two tiers. A small curated bundle of concepts describing systems, metrics and processes, sitting above a large uncurated document corpus. Queries enter at the concept layer, which filters and scopes, then follow resource fields and cross-links into the documents. When no concept matches, the system falls through to plain retrieval.
When is retrieval alone the right answer?
When the corpus is large, heterogeneous and unowned, the questions are about content buried in prose, and no producer exists to generate frontmatter. A bundle of machine-written descriptions that nobody reviews is worse than none, because a stale concept declares the same trust as a maintained one.
Does a bundle solve permissions in a RAG system?
No. A bundle is a directory of files with no access control, and an index built over it inherits nothing. Enforcement stays with the store serving the bundle, the ingest partitioning, and the retrieval layer.
  1. How the Open Knowledge Format can improve data sharingGoogle Cloud Blog
  2. Open Knowledge Format v0.2 core specificationGoogleCloudPlatform/knowledge-catalog

Newsletter

Occasional notes on building systems that hold up

A short email when we publish something worth your time. Architecture, integration, and operational AI in regulated organizations. No cadence promises, no forwarding your address.

explore further

Related insights

  • What the Open Knowledge Format does

    A directory of markdown files with YAML frontmatter, published by Google Cloud as an open specification. What OKF requires, what its trust fields record, and which of your problems it leaves untouched.

  • What an AI gateway does, and when you need one

    One internal interface between your applications and whichever model serves them. What belongs in that layer, and the point at which not having one starts to cost you.

  • Your AI needs playback—not a blockchain

    A trustworthy AI system should not merely retain an answer. It should let you return to that interaction and inspect the evidence, decisions, configuration, and controls behind it.

Capabilities

  • Data Platforms

    Platforms that make data useful and trustworthy inside operational systems.

  • Operational AI

    AI systems that integrate with existing platforms and workflows, with control, traceability, and operational reliability.

  • Systems Architecture

    Designing architectural foundations that allow complex organizations to operate reliably and evolve safely.