A system including one or more processors coupled to memory, the memory loaded with computer instructions to detect when to diverge to a tangential conversation from linearly structured steps of a cognitive behavioral therapy (CBT) session in a series of sessions for a mental health disorder and when to merge back to flow of linearly structured steps of the session from the tangential conversation in the therapy session, the instructions, when executed on the processors, implement actions comprising:
- conducting a conversation in a current CBT therapy session in the series of sessions for the disorder between a chatbot and a patient;
- receiving input from the patient in a particular utterance in the conversation and detecting a present intent of the patient to diverge from the flow of linearly structured steps of the CBT session;
- sending an invitation to the patient to diverge from the flow of the CBT session and start a tangential conversation;
- receiving a confirmation from the patient to start the tangential conversation and bookmarking a last completed step in the flow of linearly structured steps of the CBT therapy session;
- starting the tangential conversation and calculating a return to CBT session score after each succeeding utterance from the patient;
- and
- comparing the return to CBT session score with a threshold, upon detecting that the CBT session score has exceeded the threshold, resuming the flow of the linearly structured steps of the CBT session from a step following the bookmarked last completed.