Context
The current Tier 2 compaction writes a free-text Markdown summary via SessionCompactor. This loses structured information (tickers discussed, intent types, thesis IDs, confidence). PR #156 defined a SessionDigest dataclass but didn't implement persistence.
Goal
Write a SessionDigest record to the fact store alongside the existing Markdown summary on each compaction, preserving structured metadata that the free-text summary discards.
Scope
- Implement
FactStore.save_digest() and FactStore.get_sessions_for_ticker(ticker) CRUD methods
- Create the
session_digests DuckDB table (uses VARCHAR[] arrays for tickers/intents)
- In
ConversationEngine._maybe_compact(), accumulate tickers_discussed and intent_types_used across queries, then write digest on compaction
- Add
get_sessions_for_ticker() to enable "which sessions discussed AAPL?" lookups
- Unit tests
Related
Context
The current Tier 2 compaction writes a free-text Markdown summary via
SessionCompactor. This loses structured information (tickers discussed, intent types, thesis IDs, confidence). PR #156 defined aSessionDigestdataclass but didn't implement persistence.Goal
Write a
SessionDigestrecord to the fact store alongside the existing Markdown summary on each compaction, preserving structured metadata that the free-text summary discards.Scope
FactStore.save_digest()andFactStore.get_sessions_for_ticker(ticker)CRUD methodssession_digestsDuckDB table (usesVARCHAR[]arrays for tickers/intents)ConversationEngine._maybe_compact(), accumulatetickers_discussedandintent_types_usedacross queries, then write digest on compactionget_sessions_for_ticker()to enable "which sessions discussed AAPL?" lookupsRelated