The project has two phases: a pilot phase and randomized controlled trial phase. The study within each phase consists of three parts: an inpatient study period, where baseline data are collected, the intervention is initiated, and treatment targets and outcomes are assessed; a one-month post-discharge period, where the intervention is continued and treatment targets and outcomes are assessed and a one-month post-intervention period, where the intervention is no longer administered but treatment targets and outcomes are assessed to test whether the intervention has sustained treatment effects. For the inpatient period, the intervention and the assessment of the treatment targets and outcomes will each be delivered via an iPad administered by a research assistant (RA). During the post-discharge and post-intervention periods assessments will be administered via smartphone mobile apps.

A. Inpatient period. There are eight components to the inpatient part of the study: (1) Parent informed consent and permission. As close as possible to the patient's intake, parents will provide consent and permission for their child to participate. For patients over the age of 17, the patient will be able to provide consent for themselves. For all participants, the investigators will obtain parent consent to collect the qualitative data from the parent on their child's experience of the intervention. (2) Patient assent and baseline data collection. As part of standard clinical intake on the McLean-Franciscan inpatient unit, participants will complete a self-report version of the Self-Injurious Thoughts and Behaviors Interview (SITBI), which will be integrated into the study data set. As soon as possible following parental consent, study staff will meet with participant to obtain assent and collect baseline data. Patient baseline data collection will consist of administration of study measures, including explicit and implicit measures of aversion toward SITB-related and self-related stimuli (i.e., baseline assessments of the treatment target), SITB since admission will be assessed (assuming it is more than 1 day after completing the full SITBI) using a "since last assessment" version of the SITBI, and a brief interview to gather information that can will be used to personalize the TEC intervention, such as details regarding methods the patient has thought of or used to self-injure. Researchers will also schedule a time for patients to complete TEC each day of their inpatient stay. (3) Personalize TEC. Following, the interview, for participants' in the active TEC arm, researchers will setup TEC to be personalized for each participant. For example, the investigators will enter the participants' name in the positive-self TEC intervention based on studies showing that evaluative conditioning paradigms where first names are paired with positive stimuli have been shown to improve implicit affect to self-related stimuli. (4) Installation of apps on patient's phone for the post-discharge part of the study. Parents bring the patient's smartphone to the hospital. The investigators have developed procedures to facilitate receiving and returning patients' phones, such as texting parents reminders and having lockboxes available for phone drop-off and pickup. An app will be installed on participants' phone. (5) TEC intervention and pre/post ratings relevant to acceptability. Because electronic devices, such as phones or tablets, are not allowed on the inpatient unit, each day a RA will bring an iPad to the patient to complete (a) the TEC intervention and (b) pre-/post-intervention measurements of mood, desire to die and urge to kill oneself to help evaluate the acceptability of TEC. (6) Assessment of treatment target and burdensomeness of the intervention. Every three days on the inpatient unit, participants will also complete measures of explicit and implicit aversion to SITB- and self-related stimuli, which are the treatment targets and ratings of the burdensomeness of TEC to evaluate the feasibility of TEC. (7) Assessment of the outcome. Daily, prior to completing the TEC intervention, participants will complete a questionnaire regarding the occurrence of any SITB in the prior 24 hours. SITBs are assessed frequently for the purposes of accurate measurement, such that participants do not have to be remember SITB events over a few days. Daily sessions will take less than 10 minutes. (8) Qualitative interview of intervention experiences. Every three days, a brief interview will assess participants' experiences and reactions to the intervention and qualitatively assess their mood and suicidal thoughts.

B. Post-discharge intervention period. For 28 days after discharge, participants will receive daily push notifications to complete a brief survey regarding SITB in the past 24 hours, the TEC intervention, and pre-/post-intervention mood, desire to die and urge to kill oneself. The push notification will be sent in the morning; additional reminders will be sent throughout the day until the tasks are completed with a maximum of 5 reminders. Once every two weeks, participants will also be asked to complete (1) implicit cognition measures to assess the treatment target and (2) a brief measure regarding the burdensomeness of TEC. A RA will contact the participant after two consecutive days of non-compliance.

C. Post-intervention follow-up. Two- and four-weeks after TEC has ended, the investigators will assess implicit cognitions (i.e., the treatment target) and SITB to test whether treatment effects persist without the intervention. The investigators will send reminders and contact participants if they do not complete the assessments.