Structuring Context for AI Agents: Inside Google's Open Knowledge Format
Most of us build RAG pipelines the same way: chunk the data, generate embeddings, and dump everything into a vector database. It works, but I've always felt it's a bit blunt. Once text gets chunked, a lot of structural context disappears, and that's exactly the information an AI agent often needs to reason effectively.
Recently, I came across Google's Open Knowledge Format (OKF). Instead of treating your knowledge base as a collection of unrelated chunks, OKF defines a standardized directory structure of Markdown files specifically designed for AI agents. Think of it as giving your knowledge base a proper schema.
The interesting part is that instead of forcing an agent to infer context after retrieval, every piece of knowledge already tells the agent what it represents before the model even starts reading the actual content.
How an OKF Bundle Is Structured
An OKF bundle is simply a directory of Markdown files.
Instead of dumping an entire webpage into one document, each file represents a single concept, entity, or procedure. One article could easily become several smaller concept files, each focused on one idea.
Every file has two parts i) YAML frontmatter ii) Markdown body
The Metadata Layer (YAML Frontmatter)
The YAML frontmatter acts like a schema. Before an agent reads the content itself, it already knows what kind of document it's dealing with.
type: concept
title: AI Overviews
tags: [search, google, ai, ranking]
related: [search-console, core-web-vitals]
status: active
Rather than having to parse the entire document just to understand its purpose, the agent gets that information immediately.
Typically, you'll define different document types such as:
Concepts — definitions and core ideas.
Entities — people, companies, products, or services.
Playbooks — step-by-step procedures.
References — documentation, raw data, or external resources.
The Payload (Markdown Body)
Everything below the frontmatter is just normal Markdown.
There isn't a strict format here. You can use headings, lists, tables, diagrams, code blocks—whatever makes sense.
The important part is that because every file follows the same metadata schema, the agent already knows where this document fits before reading the actual content.
The Routing Table (index.md)
An OKF bundle usually includes an index.md.
I like thinking of this as the routing table for the knowledge base.
Instead of blindly searching thousands of files, the agent first reads the index to understand which concepts are relevant for the current task. That makes retrieval much more intentional instead of purely semantic.
Knowledge Graphs and the LLM Wiki
One part that immediately reminded me of Andrej Karpathy's LLM Wiki idea is how OKF naturally becomes a knowledge graph.
The goal isn't just retrieving documents anymore.
The agent continuously builds and maintains a structured understanding of your knowledge.
Whenever new information is added, the agent extracts important concepts, creates new Markdown files if needed, and links them to existing concepts using the related field.
In practice, every Markdown file becomes a node, while the related entries become the edges connecting everything together.
That allows an agent to traverse relationships instead of simply retrieving isolated chunks.
Playbooks as Executable Logic
One feature I find especially useful is documenting operational playbooks.
Instead of writing procedures purely for humans, you're writing them in a way AI agents can actually execute.
I think of a playbook almost like a state machine written in Markdown.
Instead of documenting isolated steps, you define the entire workflow:
Initial State — Where the process begins.
Sequence of Actions — The steps performed to reach the goal.
Transition Conditions — The rules that determine what happens next.
Expected Output — The desired end state or artifact.
This approach works well for workflows such as:
Generating a client proposal
Investigating a traffic drop after a migration
Debugging production incidents
Onboarding a new customer
Rather than manually following dozens of notes every time, the agent can synthesize your documentation, execute the playbook step by step, and produce a report that follows your existing workflow.
CI/CD for Knowledge (The Lint Function)
Another idea I really liked comes from Karpathy's concept of a Lint function.
Just like we use ESLint or Prettier to keep codebases consistent, an LLM can periodically review the knowledge graph itself.
The lint process checks for things like:
contradictory information,
outdated documentation,
broken references,
duplicate concepts,
inconsistent playbooks.
Whenever new knowledge gets added, the system compares it against the existing graph and flags anything that doesn't line up.
Instead of manually auditing documentation, the knowledge base continuously validates itself.
Bootstrapping Your Own OKF System
The nice part is that you don't need to build custom parsers to start experimenting.
I'd begin by collecting the foundational resources:
Google's official Open Knowledge Format documentation.
The
SPEC.mdfrom the Google Cloud Platform knowledge catalog.Andrej Karpathy's notes on the LLM Wiki concept.
Then I'd feed those into an AI coding agent with a prompt like:
"I want to build an OKF system. Read the provided documentation and specifications. Give me ideas on how to structure this for my specific domain. Then ask me questions one at a time so we can decide exactly what concepts and playbooks to build first."
From there, I'd start small.
Take your existing documentation, extract individual concepts into separate Markdown files, define a consistent YAML schema, and gradually build the relationships between them.
As AI agents continue getting better, I think having a structured, graph-aware knowledge base like this will matter much more than simply storing embeddings in a vector database.
The difference is subtle but important: instead of building an agent that only searches your data, you're building one that can actually understand how everything connects together.
Comments
Join the discussionNo comments yet. Be the first to comment.