The team behind the Ya Zdorov health assistant app has redesigned its long-term memory (LTM) architecture to improve data management. Initially, the system stored all user-reported health facts in a single JSON object, which was passed entirely to the LLM. This approach caused context bloat, prevented tracking of data changes, and failed to distinguish between missing information and confirmed negative statuses.
The updated architecture divides LTM into 11 distinct categories, including medications, symptoms, allergies, and medical history. The system now separates read and write operations. The read-path retrieves only relevant data for specific queries, while the write-path processes new information asynchronously to avoid increasing response latency.
The new design separates current state tracking from historical event logs. When a user reports a change, such as a dosage adjustment, the system updates the current state while preserving the history of previous events. This allows the assistant to distinguish between active and inactive treatments without deleting historical data.
The team implemented a hybrid approach to data processing. LLMs handle semantic tasks like classification and extraction, but critical state transitions and data validation are performed by deterministic code. This ensures that the system does not rely solely on the model to decide how to update the memory.
The system also handles provenance by keeping self-reported data separate from uploaded medical documents. When discrepancies arise between these sources, the model receives both facts with their origin labels. This allows the assistant to address uncertainty in its responses rather than automatically prioritizing one source over the other.





