PHII Labs
Anxiety Destroyer: CBT-Coach LLM
2021HealthTech

Anxiety Destroyer: CBT-Coach LLM

View project

Problem

Therapy homework compliance was low.

Solution

Bot asks personalised CBT questions and replies empathetically

Result

  • Daily streaks grew 3 → 5 days avg
  • 2.1k messages processed in month one
  • Dropout rate fell by ~14%

Stack

PythonaiogramSQLiteAnthropic Claude

Anxiety Destroyer: CBT-Coach LLM

Cognitive behavioral therapy works — when people do the homework. The problem is that most do not. In 2021, we were asked to build something that addressed a specific gap: patients who started CBT, understood the framework, and then stopped doing the daily exercises that make it effective. The drop-off was not a motivation problem. It was a friction problem.

The problem

Therapy homework compliance is low across the board. Patients are given thought records, behavioral activation schedules, and exposure exercises to complete between sessions. Most do not finish them. The reasons are predictable: the exercises feel mechanical, there is no feedback loop between sessions, and a blank worksheet is a poor substitute for the therapeutic conversation that made the framework click in the first place.

What patients needed was not a better worksheet. They needed something that asked them the right questions at the right time, responded to their answers the way a coach would, and kept them engaged between sessions. Not a replacement for their therapist — a bridge between sessions.

Approach

We built a Telegram bot using Python and aiogram. Telegram was the right surface because it is where the target users already spent their time — no new app, no login friction, and the conversation interface maps naturally to a CBT exercise. A thought record is literally a conversation: what happened, what did you think, what did you feel, what is the evidence for and against. That maps cleanly onto a chat flow.

The bot asks personalized CBT questions based on the user's history. We store state in SQLite — not just the current exercise, but the patterns across days. If a user consistently catastrophizes about work on Mondays, the bot can proactively check in on Monday morning. The personalization is rules-driven, not model-driven: the LLM generates the empathetic responses, but the logic that decides which question to ask next is deterministic and auditable.

The empathetic reply layer uses Anthropic Claude. We chose Claude for this specifically because the tone matters enormously in a mental health context. A response that feels canned or robotic breaks the engagement loop instantly. A response that feels genuinely understanding keeps the user coming back. Claude's voice — measured, warm, not performatively enthusiastic — fit the clinical tone we needed. The model never gives clinical advice. It reflects, validates, and redirects to the exercise. The therapeutic frame stays intact.

What was built

A Telegram bot that runs daily CBT check-ins. The user gets a prompt at a chosen time, works through a structured exercise in chat, and receives empathetic, context-aware responses at each step. The bot tracks streaks, remembers patterns across sessions, and adjusts its questions based on what the user has been working on. SQLite holds the conversation history and the exercise state. The aiogram framework handles the async Telegram interaction. Claude handles the empathetic narration.

The architecture is deliberately simple. One database, one bot framework, one LLM call per turn. No microservices, no queue, no orchestration layer. The complexity is in the prompt design and the state model, not the infrastructure.

Results

In the first month, the bot processed 2,100 messages. Daily streaks — consecutive days of completed exercises — grew from an average of 3 days to 5 days. That is the metric that matters: streak length is a direct proxy for homework compliance, and homework compliance is the variable that predicts CBT outcomes. Dropout rate fell by roughly 14% compared to the baseline of patients doing exercises on their own.

The 14% reduction sounds modest. It is not. In a mental health intervention, keeping 14% more people engaged through the hardest part — the daily repetition — is the difference between a framework that works on paper and one that works in practice.

Takeaway

The LLM's job in a therapeutic context is not to be a therapist. It is to be the thing the worksheet never was: responsive. A worksheet does not care what you wrote. A coach does. The model generates the empathy that makes the exercise feel like a conversation, and the deterministic state machine ensures the conversation stays inside the clinical frame. That separation — model for tone, rules for structure — is what kept the bot safe to use and effective at keeping people engaged.

Telegram bot →

Want something similar?

Share your workflow and we will show where AI systems can make it stronger.