Skip to content

emawritz/sesion

Repository files navigation

Sesión

CI License: MIT Node TypeScript NestJS SvelteKit Claude Conventional Commits

The software Argentine psychologists use so their practice runs itself, while they do the only thing that matters: listen.

Sesión (domain: app.sesion.com.ar) is a vertical SaaS for psychology practices in Argentina. It replaces five tools that today elbow each other for space — Excel, Google Calendar, WhatsApp, a paper notebook, and a folder full of receipt photos — with a single platform that actually understands the craft.


What it does

  • Recurring agenda with day/week/month views, drag & drop, and cascading cancellations when the therapist takes leave or a holiday hits.
  • WhatsApp automation — confirmations, reminders, incoming receipts, payment collection, debt reminders. Everything flows through a queue with retries and exponential backoff.
  • Conversational check-ins where the patient replies on WhatsApp and a Claude-powered orchestrator classifies and records the response.
  • Billing and payments — monthly breakdowns per patient, with Mercado Pago and Stripe.
  • Video calls via self-hosted LiveKit — one unique link per session, no Zoom in the loop.
  • Reports and finances — income, expenses, goals, attendance, all exportable to PDF / Excel / iCal.

🧠 Claude Sonnet 4.6 + Opus 4.6 orchestration

"Pay for frontier intelligence — but only where it moves the clinical needle."

Sesión is a concrete instance of the pattern Anthropic presents as Claude Managed Agents, applied to a clinical vertical:

                   ┌──────────────────────────────────────┐
                   │              Router                  │
                   │   (task · risk signal · confidence)  │
                   └────────────────┬─────────────────────┘
                                    │
               ┌────────────────────┴────────────────────┐
               ▼                                         ▼
  ┌────────────────────────┐              ┌────────────────────────┐
  │   EXECUTOR  (92 %)     │              │   FRONTIER  (8 %)      │
  │                        │              │                        │
  │   Claude Sonnet 4.6    │  ── escalates ▶   Claude Opus 4.6     │
  │   Claude Haiku 4.5     │   when        │   (1M context)        │
  │                        │   confidence  │                        │
  │ · session notes        │   is too low  │ · risk classification  │
  │ · WhatsApp check-ins   │               │ · co-supervisor        │
  │ · summaries · aura     │               │ · pre-session brief    │
  │ · copilot chat         │               │ · therapeutic alliance │
  │ · resource recommend.  │               │ · multi-session synth. │
  └────────────────────────┘               └────────────────────────┘

Why it matters: an average practice fires ~200k Claude calls per month. Blindly routing all of them to Opus breaks unit economics (~USD 85/psychologist/month on AI alone, negative margins). Routing everything to a small model loses the first patient the day a real clinical case falls through the cracks. Sesión's router has a third option:

  • 92% of traffic resolves on Sonnet 4.6 / Haiku 4.5 for pennies.
  • The 8% where the executor hesitates auto-escalates to Opus 4.6 — and that 8% is exactly where the patient's life lives (suicidal ideation detection, therapeutic alliance ruptures, drug interactions).
  • Unit economics: ~USD 23/psychologist/month (vs. USD 85 without the router). The delta — from 142% to 38% COGS over revenue — is what makes Sesión viable as a business.

Production-ready, not hello-world

Every model call sits on top of a layer that solves what the Anthropic keynote describes as "ship production-ready agents faster":

Keynote requirement How Sesión implements it
Sandboxing DTOs with class-validator, prompt-injection sanitization, schema-bounded tool use
Long-running agents Persistent queue with retries and exponential backoff (MessageQueueService) — an agent that starts survives a reboot
Multi-agent coordination Router + executor → frontier escalation, auditing in AIUsage, global monthly USD cap
Budget + observability AI_MONTHLY_CAP_USD, per-user rate limit, prompt caching on heavy system prompts, cache_read_input_tokens recorded per call
Graceful degradation Fallback chain is 100% Anthropic: Sonnet → Haiku → static template. Zero third-party data egress

Read AI-ARCHITECTURE.md for the full map of all 17 Claude calls, the TypeScript router contract, the prompt caching plan, and the complete unit-economics model.


Stack

NestJS 10 · Prisma 5 · PostgreSQL 16 · SvelteKit + Svelte 5 runes · TailwindCSS v4 · Baileys (WhatsApp) · LiveKit (video) · Claude Opus 4.6 + Sonnet 4.6 + Haiku 4.5 · Redis · Docker Compose · Coolify.


Getting started

The full setup guide — Docker quick start, local development, environment variables, conventions, deploy — lives in SETUP.md.

30-second TL;DR:

git clone <repo-url> sesion && cd sesion
cp .env.example .env                    # fill in the secrets
docker compose up -d --build
docker compose exec backend npx prisma db seed
open http://localhost:5173

Documentation

  • SETUP.md — complete technical setup, architecture, conventions.
  • AI-ARCHITECTURE.md — Claude Sonnet 4.6 + Opus 4.6 orchestration, router, prompt caching, unit economics.
  • PRESS-KIT.md — brand identity, palette, voice, tone.
  • deploy/DEPLOY.md — production deployment guide (Coolify).
  • SECURITY.md — vulnerability disclosure policy.
  • docs/ — historical implementation and design plans.

Contributing

This is a small project with opinionated design decisions. Before opening a large PR, please open an issue first describing the problem — it's easier to align upfront than to reject code after the fact.

The non-obvious conventions are documented in §7 of SETUP.md: time handling, Svelte 5 runes, and the message-queue discipline. Read them before touching code. See CONTRIBUTING.md for the full PR checklist.


License

MIT © 2026 Emanuel Cejas.

About

Sesión — SaaS para consultorios de psicología en Argentina. Agenda, WhatsApp automático, facturación, videollamadas y orquestación Claude Opus 4.6 + Sonnet 4.6.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors