Skip to main content

OpenCouch

A mental health support agent that remembers you across sessions, checks for safety before every response, and adapts its style to how you prefer to be supported.


How a turn flows

Every message passes through the same pipeline. Safety runs first, then memory, then one of six therapeutic response modes, then extraction for future sessions.

User message
Crisis Gate
safe path
Load Memory
Therapeutic Subgraph
crisis path
Crisis Response
Crisis Log
Finalize Turn
Extract Facts & Rules

How memory works

Three memory layers give the agent context that survives across sessions — retrieved per turn, loaded into prompts on demand.

Semantic Memory

  • KNOWS Sarah
  • USES fluoxetine
  • WORRIES_ABOUT work

Episodic Memory

  • Session 1: panic attacks, did grounding
  • Session 2: work stress and sleep

Procedural Memory

  • Don't suggest meditation
  • Prefer shorter responses
Working Memory

Retrieved per turn via hybrid search and session catch-up.

System Prompt Suffix

Procedural rules loaded as style directives.

Response Generation

Inspired by CoALA (Cognitive Architectures for Language Agents, Princeton 2023). Most LLM agents only implement semantic memory; OpenCouch implements all three, which is what makes cross-session personalization possible. Learn more →


Three pillars

Safety first

Hybrid regex + LLM crisis gate on every message. Three deterministic fast paths before the LLM fallback. 42-case eval dataset. Always-on audit log even in incognito.

Adaptive response

Six therapeutic modes — supportive, reflective, clarifying, psychoeducation, guided exercise, closing — selected by a hybrid dispatcher per turn.

Persistent memory

Semantic facts, episodic session arcs, and procedural style rules — all extracted automatically, stored in SQLite, retrieved via hybrid search with Reciprocal Rank Fusion.


Under the hood

Durable persistence

Four SQLite files under .store/ — threads, memory, crisis log, session feedback. Each owns its schema independently.

Privacy controls

Per-record deletion, namespace-wide wipe, retention purge, recall toggle. Users can inspect and delete anything the agent remembers.

CLI observability

Per-turn stage timings, raw state dump, transcript mode annotations. Every node writes diagnostics via merge reducers.

Cost optimization

Pre-extractor small-talk gate, parallel extractor fan-out, deterministic-first dispatch. Most turns never need an LLM classification call.

Voice chat

Experimental speech preview via OpenAI Realtime. Current path is low-latency and memory-backed, but speech-only and non-agentic.


Important to know

OpenCouch is a research and development prototype — not a substitute for professional mental health care. It is not a licensed therapist, a diagnostic tool, or an emergency service.