Problem
The automatic MemorySyncManager path for files under knowledge_base/ calls LongTermMemoryStore.index_file() without the file's source mtime. index_file() therefore defaults the database files.mtime value to the current sync time. The direct memory ingest path already passes the document mtime, so watcher-indexed documents behave inconsistently.
This makes file freshness metadata inaccurate and can distort retrieval recency scoring for older documents.
Reproduction
- Create
knowledge_base/old.md and set its filesystem mtime to a timestamp well in the past.
- Start
MemorySyncManager (or wait for its watcher to index the file).
- Read the stored mtime with
LongTermMemoryStore.get_file_mtimes(["knowledge_base/old.md"]).
- Observe that it is close to the sync time rather than the source file's mtime.
Expected behavior
Automatic knowledge-base synchronization passes the source file mtime to index_file(), matching ingest_document(), so the persisted metadata reflects the document on disk.
Acceptance criteria
- Initial and watcher-driven knowledge-base indexing pass the file's filesystem mtime to
index_file().
- A regression test proves the captured mtime equals the source file mtime.
- Existing memory-file sync, public APIs, persistence schema, and migrations remain unchanged.
- No network or provider dependency is required by the test.
Problem
The automatic
MemorySyncManagerpath for files underknowledge_base/callsLongTermMemoryStore.index_file()without the file's source mtime.index_file()therefore defaults the databasefiles.mtimevalue to the current sync time. The directmemory ingestpath already passes the document mtime, so watcher-indexed documents behave inconsistently.This makes file freshness metadata inaccurate and can distort retrieval recency scoring for older documents.
Reproduction
knowledge_base/old.mdand set its filesystem mtime to a timestamp well in the past.MemorySyncManager(or wait for its watcher to index the file).LongTermMemoryStore.get_file_mtimes(["knowledge_base/old.md"]).Expected behavior
Automatic knowledge-base synchronization passes the source file mtime to
index_file(), matchingingest_document(), so the persisted metadata reflects the document on disk.Acceptance criteria
index_file().