fix: gists show the conversation's real date, not the summarize-run date

Summaries displayed s.created_at (set to now() at summarize time), so every
imported gist read 2026-06-16. Derive the actual session date from the earliest
exchange timestamp (MIN(created_at) per session — the preserved original date,
same source the era rollups use) via a correlated subquery in the summary
readers. New Summary.session_started_at field; chat shows it (falling back to
created_at). No schema change / backfill needed — always correct from source.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 04:23:14 +00:00
parent 3b0b808986
commit 2d44457b96
2 changed files with 17 additions and 7 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ SUMMARY_K = 3 # other-session gists
def _summary_note(summaries: list[memory.Summary]) -> Message:
lines = [f"- ({s.created_at[:10]}) {s.content}" for s in summaries]
lines = [f"- ({(s.session_started_at or s.created_at)[:10]}) {s.content}" for s in summaries]
body = "Gist of earlier sessions (compacted — ask if you need specifics):\n" + "\n".join(lines)
return {"role": "system", "content": body}