cd /news/artificial-intelligence/khms-a-file-based-long-term-memory-a… · home topics artificial-intelligence article
[ARTICLE · art-114231] src=github.com ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

KHMS – a file-based long-term memory an LLM agent installs into itself

KHMS, a file-based long-term memory system for LLM agents, stores knowledge as immutable markdown cards in a git repository, with hook-driven recall and a propose-review-approve pipeline, and has been running daily in a single-operator deployment since mid-2026. The system, which aligns with Google Cloud's Open Knowledge Format (OKF) v0.1 June 2026 and v0.2 July 2026, adds epistemic levels, provenance, and refutation handling that OKF does not define.

read3 min views1 publishedAug 28, 2026
KHMS – a file-based long-term memory an LLM agent installs into itself
Image: Michielbdejong (auto-discovered)

KHMS ("know-how management system") is a long-term memory for LLM agents made of plain markdown files in a git repository. Every piece of knowledge is one immutable card with YAML frontmatter — what kind of knowledge it is, how strongly it is evidenced, where it came from, and which other cards it is derived from, supports or contradicts. Cards are never edited and never deleted: a correction is a new card that supersedes the old one, and a refuted card stays visible as a signposted dead end. Around that storage layer sits the part that makes it work in practice — hook-driven recall that pushes relevant cards into the session before the agent asks for them, and a propose → review → approve pipeline in which background jobs may only propose and nothing enters the knowledge directory unreviewed.

Status: extracted and generalized from a working single-operator deployment that has been running daily since mid-2026. The scripts here are the deployment's scripts with the paths parameterized and the domain specifics removed. Numbers marked "calibrate" are that deployment's values, not laws.

**Setting up memory for yourself?**→— the one-pass bootstrap.AGENTS.md- Want the whole model first? →

[spec/khms-spec.md](/kostey/khms-memory/blob/master/spec/khms-spec.md). - Wiring it into Claude Code (hooks, cron, dependencies)? →
[claude-code/](/kostey/khms-memory/blob/master/claude-code/README.md). - Want to see cards before writing any? →
[examples/](/kostey/khms-memory/blob/master/examples)(fictional weather-station domain).

An agent that works with someone for months keeps re-deriving the same conclusions, repeating documented dead ends, and stating yesterday's fact as today's. Context windows do not fix this — they are per-session and they are lossy. Vector-store "memory" mostly fixes recall of text, not the harder parts: whether a remembered claim was measured or merely reported, what refuted it, and who approved it into the record.

KHMS's answers, in one line each:

Cards, not chat logs. One claim per file, typed (fact

,problem→solution

,decision→rationale

,principle

,policy

, …), so knowledge can be linked and counted.Epistemic levels. Observations carryevidence: measured | observed | reported

and a source; rules arederived

and must name what they were derived from. Confidence iscomputedfrom that graph, never hand-asserted.Immutability. No edits, no deletions. Corrections supersede; refutations stay readable, because "we already tried that and it failed" is among the most valuable things memory holds.Retrieval as a floor plus a ceiling. Hooks inject candidate cards automatically on a budget (the floor, which runs whether or not the agent remembers to look); explicit recall before hypotheses and proposals is the agent's own duty (the ceiling).Graduated review. Cheap models propose into an inbox, a stronger stage consolidates, and only an approving stage assigns IDs and writes into the knowledge directory.

Google Cloud's Open Knowledge Format (OKF)— the closest thing to a standard for this storage layer: a directory of markdown files with YAML frontmatter, one required field (type

), no runtime. KHMS's card storage converged on nearly the same shape independently; what OKF (v0.1 June 2026, v0.2 July 2026) does not define is the epistemic and process layer above it — evidence levels, mandatory provenance, refuted-not-deleted, computed belief, the propose→review cycle. If you want KHMS cards to interoperate, map the frontmatter. Spec:https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md· announcement:https://cloud.google.com/blog/products/data-analytics/how-the-open-knowledge-format-can-improve-data-sharingLLM Wiki(Andrej Karpathy) — a pattern for LLM-built and LLM-maintained personal knowledge bases: a persistent, compounding, interlinked wiki instead of per-query RAG. The closest articulation of the idea this system grew from:https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f- Papers this design was built against (each is one card's worth of the argument):

  • Generative Agents (reflection: periodically distilling observations into higher-level conclusions) — https://arxiv.org/abs/2304.03442 - Mem0 (memory operations for LLM agents, incl. deletion of contradicted memories — KHMS deliberately does the opposite) —
[https://arxiv.org/html/2504.19413](https://arxiv.org/html/2504.19413) - Sleep-time compute (doing the distillation work between sessions, not during them) —
[https://arxiv.org/abs/2504.13171](https://arxiv.org/abs/2504.13171) - Graphiti (temporal knowledge graph for agents; invalidation rather than deletion, at the

cost of requiring a graph database) —

https://github.com/getzep/graphiti

  • Generative Agents (reflection: periodically distilling observations into higher-level conclusions) —

MIT — see LICENSE.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @khms 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/khms-a-file-based-lo…] indexed:0 read:3min 2026-08-28 ·