Repository navigation
Description
Description
MemoryTopicRecord.from_markdown() interprets Updated: and Sessions: at the beginning of any line as record metadata, including lines inside ## Summary. A valid summary beginning with either label loses its text when a topic is reloaded, and replaces the actual update timestamp or originating session IDs. This also affects MemoryFileStore.get_topic(), list_topics(), and the summary written when rebuilding the memory index.
Reproduced on the current main commit b9d24c8fb484c8330abe8bb9e7500ca3c3bbf46c with Python 3.14.3 on Windows. The reproduction uses the public file store and real temporary files; no model or external service is needed.
Reproduction
from tempfile import TemporaryDirectory
from agent_framework import AgentSession, MemoryFileStore, MemoryTopicRecord
with TemporaryDirectory() as directory:
store = MemoryFileStore(directory, owner_state_key="owner_id")
session = AgentSession(session_id="session-1")
session.state["owner_id"] = "alice"
record = MemoryTopicRecord(
topic="planning",
summary="Sessions: keep the troubleshooting context.",
memories=["Keep the verified release date."],
updated_at="2026-04-21T10:05:00+00:00",
session_ids=["session-1", "session-2"],
)
store.write_topic(session, record, source_id="memory")
loaded = store.get_topic(session, source_id="memory", topic=record.slug)
assert loaded is not None
print(loaded.summary)
print(loaded.session_ids)
assert loaded == recordExpected: the summary and session_ids=["session-1", "session-2"] are preserved.
Actual: the summary becomes Keep the verified release date. and the session IDs become ["keep the troubleshooting context."]; the equality assertion fails. Using summary="Updated: the release date changed." instead changes updated_at to the release date changed. and loses the summary in the same way. Ordinary summaries and labels appearing later within a summary round-trip normally.
Suggested correction
Recognize these metadata labels only before entering a content section. This preserves the existing preamble format, summary normalization, memory bullets, and heading escaping without changing the public API.
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity