Last year a couple of researchers published a paper on their approach to treat depression in otherwise-untreatable patients.
They implanted a chip in the patient's (yes, n=1) brain, which they trained to detect when the patient is going into depressing thoughts. Using Deep Brain Stimulation they terminate the signal propagation of that neural pathway.
Similar techniques have been used to treat Parkinson's.
https://pubmed.ncbi.nlm.nih.gov/32846987/