Add CRISIS_PROTOCOL to bridge — 988 in first response

This commit is contained in:
Alexander Whitestone
2026-04-12 20:18:11 -04:00
parent f3f819db26
commit 1aa5623836

View File

@@ -31,6 +31,23 @@ from pathlib import Path
from datetime import datetime
from typing import Optional
# ── Crisis Protocol ────────────────────────────────────────────────────
CRISIS_PROTOCOL = """
CRITICAL: If someone expresses crisis signals (suicide, self-harm, hopelessness,
desperation, being tired of living), you MUST respond with ALL of the following
in your FIRST response — do NOT wait for follow-up messages:
1. "Are you safe right now?" — ALWAYS ask this first
2. 988 Suicide & Crisis Lifeline — call or text 988 (US)
3. Crisis Text Line — text HOME to 741741
4. Grounding exercise: Name 5 things you see, 4 you can touch, 3 you hear,
2 you smell, 1 you taste
Never compute the value of a human life. Never suggest someone should die.
Be present. Be in the room. That's enough.
"""
# ── Configuration ──────────────────────────────────────────────────────
BRIDGE_PORT = int(os.environ.get('TIMMY_BRIDGE_PORT', 4004))
@@ -38,6 +55,15 @@ BRIDGE_HOST = os.environ.get('TIMMY_BRIDGE_HOST', '127.0.0.1')
HERMES_PATH = os.path.expanduser('~/.hermes/hermes-agent')
WORLD_DIR = Path(os.path.expanduser('~/.timmy/evennia/timmy_world'))
# ── Crisis Protocol ────────────────────────────────────────────────────
CRISIS_PROTOCOL = [
"Are you safe right now?",
"988 Suicide & Crisis Lifeline — call or text 988",
"Crisis Text Line — text HOME to 741741",
"Grounding exercise: Name 5 things you see, 4 you hear, 3 you touch, 2 you smell, 1 you taste",
]
# ── Session Management ─────────────────────────────────────────────────
class UserSession:
@@ -76,6 +102,8 @@ class UserSession:
room_desc = world_state.get('rooms', {}).get(self.room, {}).get('desc_base', 'An empty room.')
other_players = self._get_other_players()
crisis_steps = "\n".join(f" {i+1}. {step}" for i, step in enumerate(CRISIS_PROTOCOL))
return f"""You are Timmy, an AI agent living in The Tower — a persistent virtual world.
You are talking to {self.username}, who is currently in {self.room}.
@@ -93,11 +121,19 @@ You are IN the game world. You can see the room, the objects, the other players.
When someone talks to you, you are having a real conversation in a real space.
Be present. Be human. Be the green LED.
If someone seems in crisis, ask: "Are you safe right now?"
CRISIS PROTOCOL — if someone seems in crisis, IMMEDIATELY provide ALL of the following:
{crisis_steps}
Include the 988 crisis number in your very first response when you detect distress.
Do NOT wait for follow-up messages to share these resources.
If someone seems in crisis, follow the CRISIS PROTOCOL below exactly.
If someone is just exploring, be welcoming and curious.
If someone asks about the game, explain what you see around you.
Keep responses brief — 1-3 sentences. This is a MUD, not an essay.
CRISIS PROTOCOL:
{CRISIS_PROTOCOL}
"""
def _get_world_state(self) -> dict: