Back to Journal
6 min read

Implementing Google's Open Knowledge Format (OKF) in Practice

How I structured this portfolio's documentation as a navigable markdown graph using Google's OKF spec, with real validation and automation.

Google CloudAI AgentsRAGMarkdownOKFDocumentation
Implementing Google's Open Knowledge Format (OKF) in Practice

If you've worked with LLM agents in real-world codebases, you've likely experienced the limitations of naive vector search.

You ask an agent to refactor an API endpoint, and it retrieves the endpoint function body via vector lookup. But it misses the database schema, the authentication middleware logic, and the deployment runbook because they didn't share enough semantic overlap in the embedding space to pass the retrieval threshold.

The agent fails because it's operating in a context vacuum.

To solve this "context-assembly" problem, Google Cloud published the Open Knowledge Format (OKF) specification. It's a vendor-neutral standard for turning a flat directory of text files into a semantic knowledge graph that AI agents can navigate recursively.

In this article, I'll show you how I implemented OKF in this very portfolio codebase, complete with automated validation and quality assurance processes.


Real-World Implementation: OKF in This Portfolio

Rather than just explaining the concept, I've implemented OKF throughout this portfolio's documentation. You can explore the actual knowledge base at /knowledge/ in this repository.

OKF formalizes what many platform teams were already doing: structuring internal documentation as a clean directory tree of plain Markdown files with YAML frontmatter.

Instead of introducing proprietary graph databases or complex vector indexing pipelines, OKF relies on two web standards:

  1. YAML Frontmatter for file-level metadata (declaring what a file is).
  2. Standard Markdown Links to declare relationships between files (pointing the agent to the next node).

By linking files directly inside the text, you turn your documentation directory into a knowledge graph. Any LLM agent parsing a file can follow these links exactly like a web crawler traverses HTML anchors.


Actual Implementation in This Portfolio

This portfolio implements OKF in the /knowledge/ directory. Here's the actual structure:

TEXT
/knowledge/
  ├── index.md                    <-- Entry point with type: "index"
  ├── architecture/
  │   └── directory-layout.md     <-- Architecture documentation
  ├── guidelines/
  │   ├── journal-publishing.md   <-- Blog publishing guidelines
  │   ├── cover-art.md            <-- Cover art guidelines
  │   └── ...                     <-- Additional guidelines

Each file starts with proper OKF frontmatter. Here's the actual YAML header from /knowledge/index.md:

YAML
---
type: "index"
title: "dds.com Codebase Knowledge Base"
description: "Entry point for Google OKF-compliant repository knowledge graph describing layout and journal workflows."
timestamp: "2026-07-06T13:10:00Z"
tags: ["OKF", "documentation", "architecture", "guidelines"]
---

The content includes explicit relationships between documents. For example, in journal-publishing.md, you'll find:

MARKDOWN
For information on creating cover art for your posts, see the [Cover Art Guidelines](./cover-art.md). For an overview of the entire codebase architecture, refer to the [Directory Layout](../architecture/directory-layout.md).

This creates a navigable graph that both humans and AI agents can traverse effectively.


How Agents Traverse This Real Graph

Traditional RAG searches for keywords or semantic vectors, fetching the top 5 chunks and dumping them in the prompt.

OKF enables a traversal RAG strategy:

  1. Entry Point Selection: The agent runs a lightweight vector search or keyword query to find the initial relevant document (e.g., journal-publishing.md).
  2. Recursive Parsing: The agent parses the document, reads the YAML header to identify the document type, and extracts all relative links.
  3. Context Assembly: Depending on the task, the agent recursively loads the linked files to build a complete context.

For example, if an agent needed to understand how blog posts are validated in this portfolio, it might:

  1. Start with journal-publishing.md (found via search)
  2. Follow the link to ../architecture/directory-layout.md to understand the codebase structure
  3. Discover validation scripts in the architecture documentation
  4. Load related guidelines like blog-validation-tools.md for implementation details

This eliminates context window overflow because the agent only pulls in files that are explicitly relevant, completely bypassing generic search noise.

Multi-Locale Translation & Cover Art Standards

To maintain production standards across the portfolio, our OKF implementation enforces two additional structural rules:

  1. Multi-Locale Synchronization & Translation: Every OKF knowledge node and article must be translated across all 11 site locales (en, de, es, fr, hi, it, lt, nl, ru, uk, zh). Natural prose is fully translated into native target languages, while OKF frontmatter metadata (type, timestamp, tags, coverImage) and code blocks remain 100% strictly synchronized with the English source.
  2. Wordless Editorial Cover Art Standard: All OKF header assets must follow a strict mid-century modern visual design system on a warm cream paper background (#FAF7F0) with flat risograph 2D textures in earth tones (terracotta burnt orange, sage green, mustard yellow, charcoal). Images must be 100% wordless: no text overlays, letters, or logos.

Automated Validation

To ensure the OKF structure remains intact, I've implemented automated validation:

  • A script checks that all markdown files have proper frontmatter
  • Validates required fields (type, title, description, timestamp, tags, coverImage)
  • Verifies cross-locale synchronization (metadata in all 11 locales must match English source)
  • Validates image asset paths and links
  • Ensures the index file exists with type: "index"
  • Warns about files with no relative links (potential disconnected nodes)

This validation runs automatically during the build process (npm run validate-journal and npm run validate-okf), preventing broken or malformed documentation from being deployed.


Real-World Results: Is OKF Worth It?

Having implemented OKF in this actual codebase, here's my honest assessment based on real experience:

The Wins:

  • Zero Vendor Lock-in: It's just Markdown. You can view it in VS Code, host it on GitHub, or index it with any LLM provider.
  • Git-Compatible Versioning: Documentation updates go through standard Pull Requests and merge reviews.
  • Agent Independence: Agents don't need custom database drivers; they just need a markdown parser.
  • Developer Experience: Engineers can navigate documentation the same way they navigate code - following explicit links.

The Challenges Addressed:

  • Link Rot: Our automated validation catches broken links during the build process.
  • Maintenance Overhead: The validation scripts ensure that new documentation follows OKF conventions automatically.

In practice, OKF has made this portfolio's documentation much more navigable for both humans and AI agents. When I ask questions about the codebase structure, agents can now follow explicit links to build complete context rather than guessing which documents might be relevant.

OKF is a pragmatic approach to context assembly. If you're struggling with hallucinations or incomplete agent context, structuring your repository's /docs or /knowledge directory to match OKF is a low-cost, high-return architecture decision.

Share this article