OKF Agent Memory – Git-native persistent memory for AI coding agents
TL;DR Highlight
Git-markdown memory with in-memory BM25 search claims 80% fewer tokens and sub-300µs lookups
Who Should Read
A developer using coding agents whose CLAUDE.md/AGENTS.md keeps ballooning until the agent ignores instructions
Core Mechanics
- Memory is split into two layers
- The always-loaded Push layer keeps only rules in AGENTS.md, capped at 400 tokens.
- The on-demand Pull layer lives in knowledge/ and costs 0 tokens in the base system prompt.
- Two failure modes of current setups
- Stuffing everything into AGENTS.md/CLAUDE.md bloats context and the agent ignores key instructions, per the README.
- Putting rules in a vector DB fails because agents never semantically search for constraints like formatting or security.
- In-memory BM25 instead of vectors
- BM25 is keyword-based ranking, so no embedding API or external DB is needed.
- The README table lists search under 300µs versus 150–800ms for Mem0/Letta-style runtimes.
- Go single binary with built-in MCP server
- `okf mcp knowledge` starts a stdio MCP server for Claude Code, Cursor and others.
- Tools are okf_search, okf_show, okf_create and okf_validate.
- All memory is Git-tracked markdown
- Notes are OKF v0.2 documents in knowledge/, reviewable with git diff, git blame and code review.
- It supports provenance, trust tiers (verified/generated) and lifecycle metadata like stale_after.
- Search before write, bind knowledge to code
- Search-Before-Write prevents duplicate concepts.
- code_refs tie decisions to source files, and --for-path lists constraints before you edit a file.
Community Reactions
- Critique: only latency is benchmarked
- One commenter said measuring latency without recall/precision is meaningless next to LLM call times.
- Another asked whether any capture/retrieval quality benchmarks exist.
- Doubts about needing an MCP server
- A commenter asked why an MCP server is needed when the spec is so simple.
- Another wondered how well the model follows OKF in harnesses like Codex that have built-in memory tools.
- Memory itself may be a burden
- One commenter argued memory wastes context like skills and a few hand-written md files suffice.
- Enterprise use needs separate testing
- One commenter separates planning and implementation sessions and hoped domain memory would keep unit-level work smooth.
- They said practical risk remains and they would test it on a personal project first.
How to Apply
- Measure your current AGENTS.md size
- Count tokens in your CLAUDE.md/AGENTS.md today and mark anything past 400 tokens.
- Split it into must-always-follow rules and look-up knowledge.
- Bootstrap OKF in a scratch project
- Run brew install okf-memory/tap/okf, then okf bootstrap . in the project.
- Inspect the generated knowledge/ and AGENTS.md with git diff.
- Connect the MCP server to your agent
- Register command okf with args ["mcp", "path/to/knowledge"] in Claude Code or Cursor config.
- Check logs to see whether the agent calls okf_search before working.
- Add path-based constraint lookup to your workflow
- Add code_refs to your key decision documents.
- Have the agent run okf search --for-path <file> knowledge before editing.
Try It
# Paste into Claude Code or ChatGPT (simplified version of the OKF Agent Memory approach)
You are a coding agent. Split the AGENTS.md below into two layers.
1) Push layer: compress only always-on invariant rules into 400 tokens or fewer.
2) Pull layer: split the rest into topic-based markdown concept docs. Each has a title, one-line description, tags and a body under 300 tokens. Also create index.md listing every doc with a one-line description.
[AGENTS.md]
{{AGENTS.md content}}
Next step: when I give a new task {{task description}}, make the agent read only index.md first and then open just the concept docs it needs.Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques