DEV Community

CBT Tools
CBT Tools

Posted on

The Case Against AI in Mental Health Apps (And What I Built Instead)

Every few weeks, a new "AI therapist" app launches on Product Hunt. The pitch is always the same: "AI-powered mental health support, available 24/7, powered by GPT-4." They raise millions. They get press. They trend on Twitter.

I think they're building the wrong thing.

Not because AI can't help with mental health — it can. But because most of these apps use LLMs for a job that rule-based systems do better: structured cognitive assessment.

I've spent the last 30 days building 36 free mental health tools using zero AI, zero ML, and zero API calls. Here's why I chose rule-based detection over LLMs, and what I learned.

The Problem with LLMs in Mental Health Apps

1. Hallucination is Dangerous in Therapy

When ChatGPT makes up a fact about history, it's embarrassing. When a mental health app hallucinates a symptom assessment, it's dangerous. LLMs are probabilistic text generators — they predict the next token. They don't know anything about cognitive distortions, core beliefs, or safety behaviors.

I've seen LLM-based apps:

  • Misidentify normal sadness as "clinical depression requiring immediate intervention"
  • Suggest exposure therapy for someone with PTSD without screening
  • Generate plausible-sounding but fabricated CBT techniques

A rule-based system that pattern-matches against Beck's defined cognitive distortions cannot hallucinate. It either matches "catastrophizing" or it doesn't. The output space is bounded by the rules you write.

2. Privacy: Your Thoughts Should Not Leave Your Browser

Most AI therapy apps send your thoughts to OpenAI's servers. Read their privacy policy. Your deepest anxieties, your intrusive thoughts, your relationship conflicts — all processed by a third-party API.

My tools run entirely in the browser. No backend. No API. No signup. Your thought record stays in your localStorage. Your mental health data never leaves your device.

This isn't just a privacy feature — it's a clinical requirement. People are more honest in therapy when they know their thoughts are confidential. An app that sends your thoughts to a server undermines the therapeutic alliance.

3. Non-Determinism is a Bug, Not a Feature

LLMs are non-deterministic. Same input → different output. This is fine for creative writing. It's a bug in therapy.

If I run the thought "I'm going to fail this presentation" through a cognitive distortion detector, I should get the same result every time: catastrophizing + fortune telling. A therapist needs consistency to track progress. If the app says "catastrophizing" today and "overgeneralization" tomorrow, you can't measure improvement.

My rule-based detector returns the same result every time because the rules don't change. Determinism is a feature in mental health assessment.

4. Cost: Free vs. $0.01 per Token

AI therapy apps cost money to run. Each API call costs tokens. They pass that cost to users — $10/month, $20/month, "premium plans."

My tools are free. Not freemium. Not "free with ads." Free. Because pattern matching against a dictionary of 13 cognitive distortions costs nothing. No GPU. No API. No server.

5. Explainability: The Rules ARE the Intervention

When an LLM says "you seem to be catastrophizing," it's a black box. Why did it say that? What pattern did it match? You can't know.

When my detector says "catastrophizing," you can see the exact rule that matched. The rule IS the intervention. The user can see the logic, challenge the rule, and understand why the tool flagged their thought. This transparency is therapeutic — it teaches the user to recognize the pattern themselves.

What I Built Instead

36 tools, all vanilla JavaScript, all running in the browser:

  1. Cognitive Distortion Detector — pattern-matches against Beck's 13 distortions (200 lines of JS)
  2. Core Belief Detector — uses the downward arrow technique to drill from surface thought to terminal core belief (120 lines)
  3. Safety Behavior Detector — classifies actions into 9 CBT-defined categories (90 lines)
  4. Catastrophe Prediction Calibration Detector — tracks how often predicted catastrophes actually happen (90 lines)
  5. Habituation Pattern Detector — tracks anxiety reduction across exposures (90 lines)
  6. CBT Thought Record — structured 7-column thought record with automatic distortion detection
  7. Panic Diary — tracks panic attack triggers, symptoms, and interventions with analytics
  8. Procrastination Pattern Detector — identifies 8 procrastination patterns with CBT interventions

...and 28 more. All free. All open-source. All privacy-first.

When AI IS the Right Tool

I'm not anti-AI. I use ChatGPT daily. The point is using the right tool for the job:

  • Rule-based: Structured assessment, pattern detection, psychoeducation, progress tracking
  • LLM: Open-ended conversation, empathic response, creative reframing, therapeutic dialogue

The best mental health apps will use both: a rule-based system for assessment and tracking, an LLM for conversation and support. But most apps today use an LLM for everything — including the parts it's worst at.

The Results

I'm not going to pretend these tools are clinically validated. They're not. They're educational tools based on well-established CBT frameworks.

But in 30 days:

  • 157 people cloned the GitHub repo
  • 2 people starred it (hey, it's a start)
  • 0 people paid for anything (because everything is free)
  • 0 hallucinations (because there's no LLM)
  • 0 privacy breaches (because there's no server)
  • 0 API costs (because there's no API)

The last three zeros are features, not bugs.

The Takeaway

If you're building a mental health app, ask yourself: does this feature need an LLM, or would a rule-based system work better?

  • Does it need creativity? Use an LLM
  • Does it need consistency? Use rules
  • Does it need privacy? Use rules (client-side)
  • Does it need explainability? Use rules
  • Does it need zero cost? Use rules

Most structured assessment in CBT doesn't need creativity. It needs consistency, privacy, and precision. That's what rule-based systems give you.

The repo is here: github.com/alexcoledev/cbt-toolkit

All 36 tools are live, free, and run in your browser. No signup. No backend. No AI.


I'm building free mental health tools based on CBT. Follow along or contribute on GitHub.

Top comments (0)