OKF Agent Memory
Keeps what a coding agent learns as plain Markdown inside the repository — an OKF v0.2 knowledge bundle searched in-process by BM25 — so the memory can be diffed and reviewed instead of living in a database.

What it is
A memory layer for AI coding agents that keeps what they learn as plain Markdown in the repository, not in a database. Knowledge lives in an OKF v0.2 bundle — a knowledge/ directory of concept files with YAML frontmatter, index.md files and a log.md — read back by an in-process BM25 search rather than by embeddings. It is for people running coding agents over a repository (the README names Claude Code, Cursor and Codex) and for anyone who wants an agent’s decisions reviewable with git diff. Install by cloning and running make build, which produces the standalone binary at bin/okf; ./bin/okf validate knowledge --strict --drift then checks a bundle, ./bin/okf search "architecture layers" knowledge queries it, and ./bin/okf bootstrap /path/to/my-project --name "My Service" scaffolds the whole stack into another repository. The MCP server runs over stdio as ./bin/okf mcp knowledge (registered in claude_desktop_config.json or Cursor), make check runs the tests, and ./bin/okf hub init-vault, hub push and hub sync handle optional encrypted sync.
Who built itAn organisation account rather than a person: the repository is okf-memory/okf-agent-memory, and the metadata contains no owner profile. The work is one-sided — 144 of the 167 commits carry the sknr account (142 authored as sknr and 2 as Stephan Knauer), 12 come from google-labs-jules[bot], 5 from denis-samatov, 3 from dependabot[bot], 2 from yakimoto and 1 from dajiaohuang, and those accounts are exactly the six names on the contributor list. The sponsorship links point at github.com/sponsors/sknr in the funding file and in the README badge, which is the only maintainer identity the materials show.
How it is put together
The parts · 6A Go library and CLI around a Markdown convention, in five stated layers: the OKF v0.2 format at the bottom of the contract, a project convention on top of it, an agent skill and a micro-syntax for instructions, the tooling itself, and finally the knowledge corpus. The tooling layer is deliberately dependency-free — go.mod is 140 bytes and go.sum 312 bytes — and does everything in process: parse and validate the bundle, build an in-memory BM25 index over the concepts, serve six MCP tools over stdio, and scaffold the same layout into another repository. Two consequences shape the rest of the tree. Because the memory is a plain-text bundle, every write goes through functions that must keep frontmatter, index.md files and log.md consistent, which is why the mutation and validation code is the largest part of the library and why security work in this repository is almost always path containment. And because the bundle is meant to travel between machines without the maintainer seeing it, a second, separate pair of packages implements an encrypted Hub: a key-derivation and envelope format on one side, and a client, engine, reconcile and log-merge on the other.
- pkg/okf/
- The core library: 39 files and 343 KB, led by
mcp.go(21,338 bytes),mutate.go(19,300),parser.go(13,713),search.go(13,037),validator.go(12,616),bundle.go(10,377),filter.go(8,893),bootstrap.go(6,429),domains.go(6,246),symlink.go(5,676),types.go(4,321) and a 586-bytepath.go, withpkg/okf/aag/linter.go(6,231) and a 13,572-bytepkg/okf/schemas/tools.json. The tests are as heavy as the code:mcp_test.go51,526 bytes,okf_test.go37,059 andmutate_security_test.go33,072. - pkg/sync/ and pkg/vault/
- The Hub, and the only part of the project that talks to a network. Twelve files and 82 KB for the engine, client, hub, server, reconcile and log-merge, and nine files and 33 KB for the key derivation, envelope, tree and commit machinery.
knowledge/architecture/zero-knowledge-vault-sync.md(5,188 bytes) documents it, and the command surface ishub init-vault,hub pushandhub sync. - cmd/ and internal/cli/
- Thin entry points over the library:
cmd/okf/main.gois 842 bytes, and the 14 command files underinternal/cli/total 66 KB —agents.go(10,675),mutate.go(10,099),search.go(7,821),validate.go(5,787),hub.go(5,666),scaffold.go(3,967),registry.go(3,698),root.go(2,047), each with a matching test. The benchmark runner is separate and single-file:cmd/okf-benchmark/main.go, 62,626 bytes. - knowledge/
- The project’s own bundle, used as its working memory:
index.md(1,844 bytes) andlog.md(15,964), ten files and 24 KB underarchitecture/includinggovernance-model.md(5,683),security-boundaries.md(3,899),zero-knowledge-vault-sync.md(5,188),layers.md(3,025) andtooling-decision.md(2,816), nine files and 31 KB underconvention/includingcoding-standards.md(6,093),dual-memory-architecture.md(5,224) andrelease-procedure.md(4,108), plusproject/,roadmap/milestones.md(4,616) andrequirements/mutation-metadata.md(923). - docs/
- Four specification files and 46 KB —
CONVENTION.md(17,031),AGENT_ACTION_GRAMMAR_RFC.md(16,980),DUAL_MEMORY_AGENT_ARCHITECTURE_RFC.md(7,362) andOKF-COMPATIBILITY.md(6,241) — five guides and 44 KB led byCLI.md(12,540),AGENT_INSTRUCTION_BEST_PRACTICES.md(11,767) andBENCHMARKING_METHODOLOGY.md(7,133), the project documents including a 14,543-byte roadmap and a release playbook, two security documents, and sixteen release-note files from v0.1.0 to v0.4.4. - Agent material, examples and packaging
AGENTS.md(2,191 bytes) sits besideCLAUDE.md,.cursorrulesand.windsurfrulesat nine bytes each and.github/copilot-instructions.mdat twelve. The agent skill is six files under.agents/skills/okf-memory/, byte-identical in size topkg/okf/assets/skill/and kept in step by amake sync-assetstarget. Three example corpora of thirteen files each show the bundle applied to software, coaching and books;benchmarks/holds a 3,862-byte README, fixtures including an 11,504-byte monolith document, and the seven result files; a 1,895-byte Homebrew formula template and a 7,165-byteMakefilehandle build and distribution.
Choices, and what they beat
Plain Markdown in git rather than a database or a vector store over an embedding index or a hosted memory API
Stated as a property of the design and argued against named alternatives: "100% Git-Native & Zero Vendor Lock-in" with everything version-controlled as plain text and "No external database required", and "Zero API Costs for Memory Retrieval" because a "Local lexical BM25 indexing eliminates recurring vector embedding API costs and network roundtrips". The rejected route is named in the README’s opening, which calls dumping behavioural rules into vector databases "The RAG Blindspot", on the grounds that agents never semantically search for operational constraints during general tasks.
Two memory layers with a token budget rather than one large instruction file over everything in
AGENTS.md, which the README calls "The Prompt Monolith"The budget is written down: the push layer is "Strictly capped at 100–150 tokens" and the pull layer costs "0 tokens in initial system prompt" because it is fetched on demand. The composition rule is given as an equation, "AGENTS.md = Domain Codex + OKF Memory Bridge", with the codex written in a dense micro-syntax the README says saves "~78–85% tokens compared to natural language prompt instructions".
Search before writing, and no raw scanning of the bundle over letting the agent read the knowledge directory however it likes
The README states the principle and its purpose — "Search-Before-Write Principle: Mandates querying existing memory before authoring, preventing concept duplication and hallucinated divergence" — and the project’s own
AGENTS.mdturns it into rules an agent must follow: search withlimit=3before proposing architecture or dependencies, and never readknowledge/throughlist_dir,grep_search,findor a raw reader.Human verification that a tool call cannot claim over letting an agent mark a concept as verified
The rule is written in
AGENTS.md— "NEVER forge human verification (verified:is human-only)" — and the open pull request 43 shows it being enforced in code, after finding "no logic preventing an agent from inserting ahuman:prefix in theVerifiedarray within a tool payload". The same instinct excludes agents from the contributor list: "NEVER credit dedicated agent accounts in CONTRIBUTORS or release notes (human-only)."Bound every input at the boundary over trusting MCP tool arguments and search parameters
Written as explicit limits: a maximum of 100 search results, queries truncated at 1,000 runes and a 50-token cap in
pkg/okf/search.go; 1 KB string constraints and a 1 MB body limit for MCP tool inputs; concept IDs validated insideSaveConcept; and cross-platform absolute-path checking replacingfilepath.IsAbs, because the standard function decides what an absolute path is from the running OS.
Read fromThe three architecture documents the report printed in full — knowledge/project/overview.md (2,485 characters), knowledge/convention/dual-memory-architecture.md (5,218 characters) and AGENTS.md (2,191 bytes), with CLAUDE.md named as the fourth candidate it did not print — plus the README (15,905 characters, fetched from the repository because the report prints only its first 6,000; the tree lists the file at 16,267 bytes), the README’s own repository-structure section, and the complete 229-file tree with sizes.
Build log
6 stages- 01
A memory layer that says it implements Google OKF v0.2
The repository describes itself in its own metadata as "Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure." The README opens on "A Domain-Neutral, Git-Native Persistent Project Memory for AI Agents based on the Open Knowledge Format (OKF) v0.2", and its first badge links those words to
GoogleCloudPlatform/knowledge-catalogatokf/SPEC.md. The project’s own knowledge bundle repeats the same reference:knowledge/project/overview.md(2,485 characters) lists a source titled "Open Knowledge Format (OKF) v0.2 Specification" at that path. All of this is the project describing itself; the materials contain no statement from Google or from anyone else confirming the implementation. The one place the repository treats compliance as something to be argued rather than asserted is its own documentdocs/spec/OKF-COMPATIBILITY.md(6,241 bytes), which the README lists as the "OKF v0.2 Compatibility Matrix — Specification validation analysis". A closed issue shows that document doing real work: a reporter quotes it on a link form the specification allows but the validator rejected, and the maintainer closed the report as fixed in v0.4.4 via commit 9146138. - 02
The performance numbers are the author’s, and one of them is his own doubt
The speed figures here are self-reported. The README’s benchmark table sets "Concept Search Latency ... < 300 µs (Microseconds, In-Memory BM25)" against "150ms – 800ms" for "Python / Vector DB Runtimes (Mem0, Letta)", and gives "~4.0 ms" for a full corpus parse and graph validation, "< 4 ms" for cold start, "$0.00" per 1,000 queries and "< 15 MB" of resident memory. The metadata summary repeats the search number as "sub-300µs in-memory BM25 search" and states token savings as "80%", while the README’s own highlight says Agent Action Grammar saves "~78–85% tokens compared to natural language prompt instructions". No hardware, corpus size or procedure appears in the table; it points at
make benchmarkand a "Progressive Disclosure Benchmark Suite", and the repository does shipdocs/guides/BENCHMARKING_METHODOLOGY.md(7,133 bytes),benchmarks/README.md(3,862 bytes), a 668-bytepkg/okf/search_benchmark_test.goand seven result files naming the models used. None was printed in the materials, so the method behind the sub-300µs figure could not be checked here. The maintainer’s own open issue 42 argues the same BM25 implementation has "three structural weaknesses in document frequency and term frequency calculation" — acronyms matching inside longer words and collapsing IDF, and prefixes matching short stems so thatlogmatchesloginandauthmatchesauthor. - 03
Fifteen releases in the first twenty-three days
The metadata records the repository as created on 2026-09-05, and fifteen releases exist between that day and 2026-09-27: v0.1.0 on 2026-09-05, v0.1.1 on 2026-09-06, v0.1.2 on 2026-09-07, v0.1.3 and v0.1.4 on 2026-09-08, v0.1.5 on 2026-09-09, v0.2.0 on 2026-09-12, v0.3.0 on 2026-09-15, v0.3.1 on 2026-09-16, v0.4.0-rc.1 and v0.4.0 on 2026-09-17, v0.4.1 on 2026-09-18, v0.4.2 on 2026-09-19, v0.4.3 on 2026-09-23 and v0.4.4 on 2026-09-27. Twelve of them landed inside the first fourteen days and the last three spread across the following nine. All fifteen are marked neither prerelease nor draft, the release candidate included, and it was published at 08:26:58Z on 2026-09-17, about five hours before the version it precedes. Fifteen tags match the fifteen releases. The commit history has the same compressed shape: 167 commits, every one of them in 2026-09, from the oldest ("feat: initial commit of OKF Agent Memory v0.1.0", 2026-09-05T21:10:22Z) to the newest ("chore(release): prepare release notes and knowledge for v0.4.4", 2026-09-27T20:20:10Z); twelve of those commits come from
google-labs-jules[bot]and three fromdependabot[bot]. Around the repository sit 740 stars, 57 forks, 4 watchers and 4 open issues, anddocs/releases/keeps sixteen files, one per version plus an index. - 04
Four architecture candidates, three of them printed and quoted
The report found four candidate architecture documents and printed three in full, naming
CLAUDE.mdas the one it did not print. The first isknowledge/project/overview.md(2,485 characters): "The OKF Agent Memory project provides an open, vendor-neutral, and domain-agnostic persistent memory layer for AI agents, built directly on Google’s Open Knowledge Format (OKF) v0.2." and, on where memory should live, "OKF Agent Memory solves this by treating an OKF knowledge bundle inside the repository (knowledge/) as the single source of persistent truth." The second isknowledge/convention/dual-memory-architecture.md(5,218 characters): "The Dual-Memory Agent Architecture (DMAA) v0.1 resolves the context-bloat and attention-drift dilemma across AI agents in all domains through a 2-layer cognitive model.", with the push layer "Strictly capped at 100–150 tokens" and the pull layer at "0 tokens in initial system prompt"; the two compose by an equation written into the document, "AGENTS.md = Domain Codex + OKF Memory Bridge". The third is the repository’s ownAGENTS.md(2,191 bytes), written in the micro-syntax the project calls Agent Action Grammar: "- MUST executeokf_search(query=keywords, limit=3)before proposing architecture, dependencies, or changes." and "- NEVER scanknowledge/vialist_dir,grep_search,find, or raw readers." - 05
A month of path-traversal fixes, and verification an agent cannot forge
Nine of the thirty issues and pull requests are security hardening, and most trace back to one class of mistake. Pull request 26 reports that on POSIX systems
filepath.Cleantreats a backslash as an ordinary filename character, so a payload like....ile.mdcould pass a containment check; 27 states the root cause plainly — "On POSIX platforms (Linux/macOS), Go’sfilepath.ToSlashis a no-op becausefilepath.Separatoris/" — and 32, 33 and 34 continue the work, with 36 adding that "The standardfilepath.IsAbs()function relies on the runtime OS architecture to determine absolute paths", so a Windows absolute path goes unrecognised on POSIX. The same run of pull requests hardened YAML frontmatter: 36 describes "YAML Frontmatter Smuggling", and the still-open 43 explains thatsanitizeConceptMetadatachecked withstrings.HasPrefixand could be bypassed with spaces, quotes or JSON-like syntax. That pull request names a second problem in the same file: "There was no logic preventing an agent from inserting ahuman:prefix in theVerifiedarray within a tool payload, resulting in a false-sense of human provenance." The project had already written the rule into its own instructions:AGENTS.mdsays "NEVER forge human verification (verified:is human-only; declaregenerated: { by: "<actor>", at: "<iso-time>" })". - 06
Beyond the command line: a Hub, a grammar linter and three example corpora
The tree is larger than a parser plus a CLI. Two packages carry an encrypted Hub that the README calls Zero-Knowledge Sync:
pkg/sync/(12 files, 82 KB —engine.go16,002 bytes, withclient.go,hub.go,server.go,reconcile.goandlog_merge.go) andpkg/vault/(9 files, 33 KB —envelope.go,tree.go,kdf.go,commit.go), driven by./bin/okf hub init-vault,hub pushandhub sync, which take a password, a secret key and an optional token.pkg/okf/aag/holds a 6,231-byte linter for the Agent Action Grammar the project invented, specified indocs/spec/AGENT_ACTION_GRAMMAR_RFC.md(16,980 bytes). The benchmark runner is one 62,626-byte file,cmd/okf-benchmark/main.go, andbenchmarks/results/holds seven result files (116 KB) naming models such as claude-opus-5, gpt-5.6-sol and qwen3-coder-30b, while the README describes that directory as logs "across 8+ local & cloud LLMs". Three example corpora —examples/software,examples/coachingandexamples/books, thirteen files each — show the same bundle used for architecture decisions, coaching sessions and book reviews. Distribution is a Homebrew formula template (1,895 bytes) and a 9,113-byte release workflow. The project also keeps its own memory this way:knowledge/log.mdis 15,964 bytes and one of its tests is calleddogfood_test.go(3,304 bytes).
Adjacent records
All records →No. 059
GSD Core
Git. Ship. Done. — a meta-prompting, context-engineering and spec-driven development framework that runs the same five-step loop on every milestone: discuss, plan, execute, verify and ship. The heavy work is pushed into fresh-context subagents so the main session stays lean, and every decision is written into Markdown and JSON under a planning directory instead of living in the conversation.
No. 070
OpenChatCut
A local-first video editor whose editing surface is a conversation: the built-in agent and external Codex or Claude Code sessions call the same editing tools the interface itself uses, so every change lands on a real multi-track timeline as a clip, transition, caption, effect or audio item that can still be dragged, undone and exported. Projects and media stay on the machine, and preview and final render both come out of Remotion.
No. 061
Reticle
An MCP server and a dev-only SDK that let a coding agent read and drive a running web or desktop app from the inside, then answer with a verdict and the file and line to fix instead of a screenshot.