{"slug": "khms-a-file-based-long-term-memory-an-llm-agent-installs-into-itself", "title": "KHMS – a file-based long-term memory an LLM agent installs into itself", "summary": "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.", "body_md": "KHMS (\"know-how management system\") is a long-term memory for LLM agents made of plain\nmarkdown files in a git repository. Every piece of knowledge is one immutable **card** with\nYAML frontmatter — what kind of knowledge it is, how strongly it is evidenced, where it came\nfrom, and which other cards it is derived from, supports or contradicts. Cards are never\nedited and never deleted: a correction is a new card that *supersedes* the old one, and a\nrefuted card stays visible as a signposted dead end. Around that storage layer sits the part\nthat makes it work in practice — **hook-driven recall** that pushes relevant cards into the\nsession before the agent asks for them, and a **propose → review → approve** pipeline in\nwhich background jobs may only propose and nothing enters the knowledge directory unreviewed.\n\nStatus: 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.\n\n**Setting up memory for yourself?**→— the one-pass bootstrap.[AGENTS.md](/kostey/khms-memory/blob/master/AGENTS.md)- Want the whole model first? →\n[spec/khms-spec.md](/kostey/khms-memory/blob/master/spec/khms-spec.md). - Wiring it into Claude Code (hooks, cron, dependencies)? →\n[claude-code/](/kostey/khms-memory/blob/master/claude-code/README.md). - Want to see cards before writing any? →\n[examples/](/kostey/khms-memory/blob/master/examples)(fictional weather-station domain).\n\nAn agent that works with someone for months keeps re-deriving the same conclusions, repeating\ndocumented dead ends, and stating yesterday's fact as today's. Context windows do not fix this\n— they are per-session and they are lossy. Vector-store \"memory\" mostly fixes recall of *text*,\nnot the harder parts: whether a remembered claim was measured or merely reported, what refuted\nit, and who approved it into the record.\n\nKHMS's answers, in one line each:\n\n**Cards, not chat logs.** One claim per file, typed (`fact`\n\n,`problem→solution`\n\n,`decision→rationale`\n\n,`principle`\n\n,`policy`\n\n, …), so knowledge can be linked and counted.**Epistemic levels.** Observations carry`evidence: measured | observed | reported`\n\nand a source; rules are`derived`\n\nand must name what they were derived from. Confidence is*computed*from 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.\n\n**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`\n\n), 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](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-sharing](https://cloud.google.com/blog/products/data-analytics/how-the-open-knowledge-format-can-improve-data-sharing)**LLM 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](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)- Papers this design was built against (each is one card's worth of the argument):\n- Generative Agents (reflection: periodically distilling observations into higher-level\nconclusions) —\n[https://arxiv.org/abs/2304.03442](https://arxiv.org/abs/2304.03442) - Mem0 (memory operations for LLM agents, incl. deletion of contradicted memories — KHMS\ndeliberately does the opposite) —\n[https://arxiv.org/html/2504.19413](https://arxiv.org/html/2504.19413) - Sleep-time compute (doing the distillation work between sessions, not during them) —\n[https://arxiv.org/abs/2504.13171](https://arxiv.org/abs/2504.13171) - Graphiti (temporal knowledge graph for agents; invalidation rather than deletion, at the\ncost of requiring a graph database) —\n[https://github.com/getzep/graphiti](https://github.com/getzep/graphiti)\n\n- Generative Agents (reflection: periodically distilling observations into higher-level\nconclusions) —\n\nMIT — see [LICENSE](/kostey/khms-memory/blob/master/LICENSE).", "url": "https://wpnews.pro/news/khms-a-file-based-long-term-memory-an-llm-agent-installs-into-itself", "canonical_source": "https://github.com/kostey/khms-memory", "published_at": "2026-08-28 13:28:24+00:00", "updated_at": "2026-08-28 13:48:39.693462+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-agents", "ai-tools"], "entities": ["KHMS", "Google Cloud", "Open Knowledge Format (OKF)", "Claude Code"], "alternates": {"html": "https://wpnews.pro/news/khms-a-file-based-long-term-memory-an-llm-agent-installs-into-itself", "markdown": "https://wpnews.pro/news/khms-a-file-based-long-term-memory-an-llm-agent-installs-into-itself.md", "text": "https://wpnews.pro/news/khms-a-file-based-long-term-memory-an-llm-agent-installs-into-itself.txt", "jsonld": "https://wpnews.pro/news/khms-a-file-based-long-term-memory-an-llm-agent-installs-into-itself.jsonld"}}