Files
the-door/SAFETY_IMPROVEMENTS_SUMMARY.md
Hermes Crisis Safety Review 80578ddcb3 fix: Crisis safety improvements based on audit
- Fix manifest.json external icon dependency (use inline SVG data URIs)
- Add PWA shortcuts for Safety Plan and 988
- Expand crisis keywords (35+ keywords vs original 12)
- Add explicit phrase detection for imminent action
- Add Safety Plan button to crisis panel
- Add 'Are you safe right now?' to crisis panel text
- Support URL param (?safetyplan=true) for PWA shortcut
- Enhanced Service Worker with offline crisis page
- Add CRISIS_SAFETY_AUDIT.md comprehensive report

Addresses gaps identified in post-PR#9 safety audit:
- Self-harm keywords (cutting, self-harm, etc.)
- Passive suicidal ideation detection
- Offline crisis resource page
- Crisis panel quick-access improvements
2026-04-01 06:28:22 +00:00

5.0 KiB

Crisis Safety Improvements Summary

Date: April 1, 2026
Commit: df821df
Status: Committed locally (push requires authentication)


Changes Made

1. manifest.json — Fixed External Dependencies

Problem: Icons loaded from external picsum.photos service
Fix: Inline SVG data URIs + PWA shortcuts

Before:

"icons": [
  { "src": "https://picsum.photos/seed/door/192/192", ... }
]

After:

"icons": [
  { "src": "data:image/svg+xml,...", "type": "image/svg+xml" }
],
"shortcuts": [
  { "name": "My Safety Plan", "url": "?safetyplan=true" },
  { "name": "Call 988 Now", "url": "tel:988" }
]

2. index.html — Enhanced Crisis Detection

Expanded Keywords (12 → 35+)

Added categories:

  • Self-harm: hurt myself, self harm, cutting myself, burn myself
  • Passive suicidal ideation: don't want to exist, never wake up, sleep forever
  • Hopelessness: no point, nothing matters, giving up, worthless, burden

Expanded Explicit Phrases (13 → 27)

Added categories:

  • Imminent action: going to do it now, doing it tonight, ready to end it
  • Specific plans: bought a gun, rope ready, wrote a note
  • Active self-harm: bleeding out, cut too deep, took too many

Crisis Panel Improvements

  • New text: "Are you safe right now?" — aligns with protocol
  • New button: "My Safety Plan" — quick access during crisis
  • Better messaging: Emphasizes confidentiality

PWA Shortcut Support

  • URL param ?safetyplan=true opens safety plan directly
  • Cleans up URL after opening

3. sw.js — Enhanced Offline Crisis Support

Cache Updates

  • Bumped to CACHE_NAME = 'the-door-v2'
  • Added /manifest.json to cached assets

Offline Crisis Page

When user is offline and navigates, they now see:

  • "You are not alone" header
  • 988 call button
  • Crisis Text Line info
  • Grounding techniques (breathing, water, etc.)
  • Psalm 34:18 scripture
  • Automatic reconnection message

Better Error Handling

  • Non-GET requests properly skipped
  • Clearer offline messaging

4. CRISIS_SAFETY_AUDIT.md — Comprehensive Documentation

Created 378-line audit report covering:

  • Full PR#9 review
  • Crisis detection accuracy analysis
  • Safety plan accessibility
  • Offline functionality
  • 988 integration compliance
  • "When a Man Is Dying" protocol compliance
  • Security & privacy review
  • 11 specific recommendations (3 critical, 4 high, 4 medium)

Safety Impact

Crisis Detection Coverage

Category Before After
Keywords 12 35+
Explicit phrases 13 27
Self-harm detection None Full coverage
Passive ideation Minimal Comprehensive

User Experience Improvements

  1. Faster help access: Safety plan directly from crisis panel
  2. Offline resilience: Crisis resources always available
  3. PWA integration: Homescreen shortcuts to safety plan and 988
  4. Protocol alignment: "Are you safe right now?" now asked in UI

Testing Recommendations

Before deploying, test:

  1. Crisis keyword detection:

    // Open console and test:
    checkCrisis("i want to hurt myself");  // Should show panel
    checkCrisis("i'm about to do it now"); // Should show overlay
    
  2. Offline functionality:

    • Enable airplane mode
    • Refresh page → Should show offline crisis page
  3. Safety plan shortcut:

    • Visit /?safetyplan=true
    • Should open directly to safety plan modal
  4. PWA installation:

    • Chrome DevTools → Application → Install PWA
    • Verify shortcuts appear

Remaining Recommendations

From the audit, these items remain for future work:

🔴 Critical (for next release)

  1. Fix manifest.json external icons DONE
  2. Add self-harm keywords DONE
  3. Add Safety Plan button to Crisis Panel DONE

🟡 High Priority

  1. Create /crisis-resources static page
  2. Add input validation/sanitization
  3. Add crisis testing documentation
  4. Consider false-positive context detection

🟢 Medium Priority

  1. Pattern detection for escalation (multi-message)
  2. International crisis line support
  3. Export/print safety plan
  4. Rate limiting UI feedback

Files Modified

CRISIS_SAFETY_AUDIT.md  | 378 ++++++++++++++++++++++++++++++++
index.html             |  55 +++++-
manifest.json          |  26 +++-
sw.js                  |  66 +++++--
4 files changed, 508 insertions(+), 17 deletions(-)

Compliance Summary

Protocol Requirement Status
Ask "Are you safe right now?" UI text + system prompt
Stay present System prompt
Do not suggest death System prompt
Point to 988 Multiple locations
Tell truth plainly (Gospel) System prompt + offline page
Alexander's story System prompt
Crisis Text Line (741741) SMS links
Offline crisis resources Service Worker

Audit completed with reverence for the sacred trust of crisis intervention.
Sovereignty and service always.