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
- No open-source infrastructure existed for developers to implement these protections
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. 45 HIGH patterns, 22 LOW patterns.
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.
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/dist/safechat.min.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
- 424 automated test cases
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, supervised by Chris Barker. Presented at ISEA2026 Dubai.
- PhD research, RMIT University
- Sovereign AI infrastructure pattern
- Local-first, privacy-respecting design
- Shared architecture with ARCHAI
- ISEA2026 Dubai presentation
- BSL 1.1 license (MPL 2.0 from 2029)
- Helpline data: CC0 public domain
- White paper available
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.