From 5467aff5cc34ff8d929a919d1e5f84699f429caf Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Fri, 13 Feb 2026 11:39:51 -0600 Subject: [PATCH] store: Stdlib-only YAML frontmatter parsing for markdown memory files --- ...-parsing-for-markdown-memory-fil-312bc2.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 graph/solutions/stdlib-only-yaml-frontmatter-parsing-for-markdown-memory-fil-312bc2.md diff --git a/graph/solutions/stdlib-only-yaml-frontmatter-parsing-for-markdown-memory-fil-312bc2.md b/graph/solutions/stdlib-only-yaml-frontmatter-parsing-for-markdown-memory-fil-312bc2.md new file mode 100644 index 00000000000..ab78539a5dd --- /dev/null +++ b/graph/solutions/stdlib-only-yaml-frontmatter-parsing-for-markdown-memory-fil-312bc2.md @@ -0,0 +1,24 @@ +--- +id: 312bc25f-1d4c-4a17-8ea6-3516d9e952a2 +type: solution +title: "Stdlib-only YAML frontmatter parsing for markdown memory files" +tags: [cognitive-memory, python, architecture, stdlib] +importance: 0.7 +confidence: 0.8 +created: "2026-02-13T17:39:51.592359+00:00" +updated: "2026-02-13T17:39:51.592359+00:00" +--- + +Built a complete YAML frontmatter parser/serializer using only Python stdlib (re module + manual parsing). Key design decisions: + +- Parse frontmatter between --- markers with regex +- Handle nested lists (relations) and simple key-value pairs +- Slugify titles with 6-char UUID suffix for unique filenames +- Keep _index.json as derived cache (rebuilt from files via reindex) +- Keep _state.json for mutable data (access counts, decay scores) +- Git-track markdown files but gitignore _index.json and _state.json + +The decay model uses: importance × e^(-0.03 × days_since_access) × log2(access_count + 1) × type_weight +Half-life is ~23 days. Type weights range from 0.8 (error/general) to 1.3 (decision). + +Content preview (first 200 chars) stored in _index.json enables zero-file-I/O search for recall and search commands.