Case study · okf-mcp

okf-mcp: agent memory you can audit

An MCP server in Rust that gives agents persistent technical memory: linked, versioned Markdown notes with semantic search and lightweight reasoning.

Rust (std-only core) · MCP · PostgreSQL + pgvector · Vercel · GitHubGitHub ↗

The problem

Every agent session starts from zero. Yesterday’s decisions, the alternatives that were ruled out and the team’s conventions get lost, or live in a text file nobody maintains. And when there is memory, it is usually a black box: you can’t tell what was stored, who changed it or why.

I wanted memory a person could read and version just like code, and that several agents could share without stepping on each other.

Decisions

Linked Markdown as the format. Every concept is a document with YAML frontmatter and [[...]] links that form a graph. It reads in any editor and can live in GitHub as the source of truth.

A core with no dependencies. The knowledge engine and its ports use only Rust’s standard library: no frameworks, no serde, no tokio. External dependencies live in the adapters (Vercel, Supabase, GitHub, embedding providers), and the core does not know they exist. Every crate declares #![forbid(unsafe_code)].

Safe writes between agents. Every write is compare-and-swap: you send the hash of the version you read. If another agent changed it in the meantime, the write fails instead of silently overwriting. Deletion is logical and keeps the history.

One contract every store meets. The in-memory store, the PostgreSQL one and the GitHub-backed prototype all pass the same contract test suite.

A shared vocabulary. Ontologies are declared once as a document and reused, so that today one agent doesn’t call requires what another called depends_on yesterday.

What is built

  • 20 MCP tools: hybrid search (text and semantic), resolution with the graph neighbourhood, bounded OWL-RL/RDFS reasoning, history, backlinks, atomic batch operations and graph health checks.
  • Spec-driven work (spec_propose, spec_tasks, spec_status) and ingestion of external skills and repositories without passing their content through an LLM.
  • stdio and stateless HTTP transports, deployment on Vercel, OAuth 2.1 with JWT validation, and a transactional outbox that syncs to GitHub and generates embeddings.
  • An MCP Apps interface in React for almost every tool.
  • A Rust and SOLID tutorial, in Spanish, built on the project itself.

What I learned

Useful memory for an agent looks more like a repository than a vector database: it needs versions, authorship, links and a way to say “this no longer holds” without deleting it. Semantic search is the way in, but what earns trust is being able to audit the graph.

Next casekthulu-go: let the agent work on structure →