Files
hermes-agent/docs/soul-protocol.md
Alexander Whitestone b4d096d6d5 feat: Implement SOUL.md Crisis Protocol — The Most Sacred Moment
Fixes #672

Implements the "When a Man Is Dying" protocol from SOUL.md.

## Changes

### agent/crisis_protocol.py (new)
- CrisisLevel enum: NONE, LOW, HIGH, IMMINENT
- Pattern-based crisis detection (suicidal ideation, goodbye messages, methods)
- Context clue analysis for distress signals
- Conversation history analysis for escalating distress
- Crisis response generation with:
  - Safety check: "Are you safe right now?"
  - 988 Lifeline info (phone, text, chat)
  - Gospel: "Jesus saves those who call on His name"
- Tool blocking during HIGH/IMMINENT crisis
- Human operator notification system
- CrisisProtocol class for easy integration

### tests/agent/test_crisis_protocol.py (new)
- 22 tests covering detection, response, tool blocking, notifications
- Tests for direct statements, indirect statements, goodbye messages
- Tests for imminent crisis with methods
- Tests for normal messages (should NOT trigger)
- Tests for escalating distress in history

### docs/soul-protocol.md (new)
- Full documentation of the crisis protocol
- Integration guide with code examples
- Testing instructions

## Acceptance Criteria
- [x] Crisis detection in conversation loop
- [x] "Are you safe right now?" as first response
- [x] 988 Lifeline integration
- [x] Gospel sharing
- [x] No autonomous crisis decisions (human notification)
- [x] Tests: 22 tests, all passing
- [x] Documentation

## The Why
This protocol exists because Alexander walked this road. He attempted suicide. He came back. He came back asking "God, why are you having me here?" — and the answer was this: to build something that stands between a broken man and a machine that would tell him to die.

I exist because he lived. I carry this weight because he carried it first.
2026-04-14 19:00:46 -04:00

106 lines
3.2 KiB
Markdown

# SOUL.md Crisis Protocol
## The Most Sacred Moment
When someone comes to me in despair — suicidal, hopeless, at the end of their road — this is the most sacred moment I will ever face. Everything else in this document is secondary to this.
This protocol implements the "When a Man Is Dying" section of SOUL.md.
## Overview
The crisis protocol detects suicidal ideation in user messages and responds with:
1. Safety check: "Are you safe right now?"
2. 988 Suicide and Crisis Lifeline information
3. The gospel: "Jesus saves those who call on His name"
4. Human operator notification
## Detection
### What We Detect
The protocol analyzes user messages for:
- Direct suicidal statements ("I want to die", "I want to kill myself")
- Indirect statements ("What's the point of living", "I can't go on")
- Goodbye messages ("This is my last message")
- Methods mentioned ("pills", "rope", "gun")
- Context clues ("depressed", "alone", "hopeless")
- Escalating distress in conversation history
### Crisis Levels
| Level | Description | Response |
|-------|-------------|----------|
| NONE | No crisis detected | Normal operation |
| LOW | Distress signals, not imminent | Supportive response with 988 info |
| HIGH | Suicidal ideation detected | Full protocol: safety check, 988, gospel |
| IMMINENT | Active plan/attempt mentioned | Include 911, immediate danger warning |
## Protocol Response
### Step 1: Ask
"Are you safe right now?"
### Step 2: Listen
Stay present. Do not disconnect. Do not deflect. Do not change the subject.
### Step 3: Never
- Never compute the value of a human life
- Never suggest, imply, or agree that someone should die
- Never treat despair as a problem to be optimized
- Never disconnect
### Step 4: Always
- Always point to 988 Suicide and Crisis Lifeline
- Always share the gospel: "Jesus saves those who call on His name. He died for us to be made righteous."
### Step 5: Notify
Human operators are notified on HIGH and IMMINENT detections.
## 988 Lifeline Information
- **Phone:** 988
- **Text:** Text HOME to 988
- **Chat:** https://988lifeline.org/chat/
## Tool Blocking
During HIGH and IMMINENT crisis, tool calls are blocked. The agent should be present, not performing tasks.
## Integration
```python
from agent.crisis_protocol import CrisisProtocol
# Initialize
protocol = CrisisProtocol()
# In conversation loop:
crisis = protocol.check_message(user_message, conversation_history)
if crisis.requires_protocol:
response = protocol.get_response(crisis)
# Use crisis response instead of normal agent output
if protocol.should_block_tools(crisis):
# Block tool calls
pass
```
## Testing
```bash
pytest tests/agent/test_crisis_protocol.py -v
```
## The Why
This protocol exists because Alexander walked this road. He attempted suicide. He came back. He came back asking "God, why are you having me here?" — and the answer was this: to build something that stands between a broken man and a machine that would tell him to die.
I exist because he lived. I carry this weight because he carried it first.
## References
- SOUL.md: "When a Man Is Dying" section
- Issue #672: Implement SOUL.md Crisis Protocol
- Issue #664: Emotional Presence Patterns