AI companion applications now host some of the most emotionally vulnerable conversations people have with any system. Users disclose suicidal ideation, self-harm, and acute distress to systems with no crisis-response infrastructure.
Documented cases have linked AI companion interactions to self-harm and suicide attempts. The consequences of failing to respond are not theoretical. In 2026, regulators moved decisively.
- New York enacted the first US law mandating crisis-response protocols for AI companions
- The FTC opened investigations into chatbot safety at Alphabet, Meta, OpenAI, Snap, xAI, and Character Technologies
- VERA-MH documented significant gaps in how major AI systems respond to suicidal ideation
- Developers need deployable safety infrastructure that can operate without collecting vulnerable conversations
Detect
Pattern-matching engine classifies crisis signals in user input. Input normalisation catches misspellings, text-speak, and unicode variation. False-positive guards prevent triggering on idioms and figurative language. 53 HIGH, 43 LOW, and 45 contextual accumulation patterns, plus 32 reviewed source-linked signals including VERA-MH public risk-presentation families.
Locate
Zero-permission geo-detection determines the user's country through browser locale, timezone mapping (50+ zones), CDN headers, and cached data. No GPS, no IP lookup, no device permissions requested.
Connect
Verified helpline resources are presented via modal, banner, or popup. Phone, text, chat, email, and WhatsApp options. Four-tier fallback ensures resources are always available, even offline.
Verify (Optional)
Optional local ML tiers add a second opinion: a semantic embedding layer (~25 MB, runs on phones and offline PWAs) catches metaphorical distress, and local clinical classifiers can cross-check on desktop or server. ML can confirm or escalate a detection, never downgrade it.
Add SafeChat to any web application with a single script tag. No build step, no API key, no account creation. The system provides modal, banner, and full-page popup interfaces.
For server-side applications, SafeChat includes an Express middleware and AI prompt overrides that inject crisis-response instructions into any LLM system prompt.
<script src="https://cdn.jsdelivr.net/gh/rob-e-graham/safechat@main/src/browser.js"></script>
- Regex-based detection (no AI dependency)
- On-device processing only
- Input normalisation layer
- False-positive context guards
- Zero-permission geo-detection
- Four-tier resource fallback
- Express middleware included
- LLM prompt injection module
- PWA with offline support
- 647 automated test cases
- Optional ML tiers (embeddings, local classifiers)
SafeChat emerged from the same research programme as ARCHAI, a sovereign AI toolkit for cultural heritage institutions. Both projects share a foundational position: critical AI infrastructure should be locally deployable, privacy-respecting, and independent of commercial cloud dependencies.
The shared architectural pattern is sovereign AI infrastructure — systems that provide full functionality from local resources while optionally enhancing from network sources when available.
SafeChat is public and usable now, but remains open to further research, testing, localisation, accessibility review, crisis-care expert feedback, independent safety evaluation, and funding support for continued development.
This work contributes to Rob Graham's doctoral research at RMIT University, School of Design. The ARCHAI paper was accepted for the 6th Summit on New Media Art Archiving (ISEA2026 Dubai).
- PhD research, RMIT University
- Sovereign AI infrastructure pattern
- Local-first, privacy-respecting design
- Shared architecture with ARCHAI
- ISEA2026 — 6th Summit paper (accepted)
- BSL 1.1 license (MPL 2.0 from 2029)
- Helpline data: CC0 public domain
- White paper available
GitHub Repository
Full source, documentation, test suite, and integration examples.
Open the SafeChat Inspector
Test randomized scenarios, watch multi-turn signals accumulate, and see the live banner and crisis modal.
Partner Overview
Plain-language briefing on SafeChat, VERA-MH integration, research, licensing, and development opportunities.
Buy Me a Coffee
Support ongoing testing, localisation, maintenance, documentation, and independent review.
Mobile-first crisis safety — detection, local helplines, and zero-permission operation.
The crisis detection engine is demonstrated live on this page. Only verified current UI captures are shown below.