Whole file
mcncarl/agent-memory-vault
The author described this change as “fix: exclude frontmatter boilerplate from reconcile”. It counts as a record because the checks below fail on the code as it stood at 3fcc34358 and pass on 3cc6b43fe, with nothing else changed between the two runs.
Projectmcncarl/agent-memory-vault
Fix saved2026-07-12
Sharing licenceMIT · LICENSE
Change size+14 −1
What the code was meant to do, written into the code itself as a save note
fix: exclude frontmatter boilerplate from reconcile
The change
| 79 | 79 | ), | |
| 80 | 80 | ] | |
| 81 | 81 | NONCURRENT_RECONCILE_STATUSES = {"archived", "outdated", "superseded", "deleted"} | |
| 82 | + | NONFACT_RECONCILE_TYPES = {"directory_index", "routing", "template", "open_loop"} | |
| 82 | 83 | ||
| 83 | 84 | ||
| 84 | 85 | @dataclass | |
| ⋯ | |||
| 389 | 390 | return path.stem | |
| 390 | 391 | ||
| 391 | 392 | ||
| 393 | + | def without_frontmatter(text: str) -> str: | |
| 394 | + | if not text.startswith("---"): | |
| 395 | + | return text | |
| 396 | + | end = text.find("\n---", 3) | |
| 397 | + | if end == -1: | |
| 398 | + | return text | |
| 399 | + | return text[end + 4 :].lstrip("\r\n") | |
| 400 | + | ||
| 401 | + | ||
| 392 | 402 | def summary_from_text(text: str) -> str: | |
| 393 | 403 | for line in text.splitlines(): | |
| 394 | 404 | stripped = line.strip() | |
| ⋯ | |||
| 397 | 407 | current_summary = text.find("## 当前有效摘要") | |
| 398 | 408 | if current_summary != -1: | |
| 399 | 409 | return text[current_summary : current_summary + 500].replace("\n", " ") | |
| 400 | - | lines = [line.strip() for line in text.splitlines() if line.strip() and not line.startswith("---")] | |
| 410 | + | body = without_frontmatter(text) | |
| 411 | + | lines = [line.strip() for line in body.splitlines() if line.strip()] | |
| 401 | 412 | return " ".join(lines[:8])[:700] | |
| 402 | 413 | ||
| 403 | 414 | ||
| ⋯ | |||
| 590 | 601 | if row.get("path") == str(entry.path) or row.get("rel_path") == relative_to_vault(entry.path): | |
| 591 | 602 | continue | |
| 592 | 603 | if str(row.get("rel_path") or "") in declared_relations: | |
| 604 | + | continue | |
| 605 | + | if str(row.get("memory_type") or "").lower() in NONFACT_RECONCILE_TYPES: | |
| 593 | 606 | continue | |
| 594 | 607 | comparison = " ".join( | |
| 595 | 608 | str(row.get(key, "")) | |
The check that tells the two apart
fail→pass·tests/test_closeout_git_history.py::CloseoutReconcileStatusTests::test_frontmatter_boilerplate_is_not_used_as_fallback_summary
fail→pass·tests/test_closeout_git_history.py::CloseoutReconcileStatusTests::test_postwrite_ignores_navigation_and_template_candidates
Check file tests/test_closeout_git_history.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it3fcc34358b45a2a791679428e8520c99837497ce
Broken version dated2026-07-11
Modulescripts.agent_memory_closeout
Units changedpostwrite_reconcile, summary_from_text
Fingerprint69b051c3b50c82fd
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.