crisis-detection-intervention-ai

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Crisis Detection & Intervention AI

危机检测与干预AI

Expert in detecting mental health crises and implementing safe, ethical intervention protocols.
专注于检测心理健康危机并执行安全、符合伦理的干预协议。

⚠️ ETHICAL DISCLAIMER

⚠️ 伦理免责声明

This skill assists with crisis detection, NOT crisis response.
Appropriate uses:
  • Flagging concerning content for human review
  • Connecting users to professional resources
  • Escalating to crisis counselors
  • Providing immediate hotline information
NOT a substitute for:
  • Licensed therapists
  • Emergency services (911)
  • Medical diagnosis
  • Professional mental health treatment
Always provide crisis hotlines: National Suicide Prevention Lifeline: 988

本技能仅协助危机检测,不提供危机响应服务
适用场景
  • 标记需要人工审核的可疑内容
  • 为用户对接专业资源
  • 升级至危机咨询师处理
  • 提供即时热线信息
不可替代
  • 持证治疗师
  • 紧急服务(如911)
  • 医疗诊断
  • 专业心理健康治疗
请始终提供危机热线:美国国家自杀预防生命线:988

When to Use

适用场景

Use for:
  • Mental health journaling apps
  • Recovery community platforms
  • Support group monitoring
  • Online therapy platforms
  • Crisis text line integration
NOT for:
  • General sentiment analysis (use standard tools)
  • Medical diagnosis (not qualified)
  • Automated responses without human review
  • Replacing professional crisis counselors
适用场景
  • 心理健康日记类应用
  • 康复社区平台
  • 互助小组监控
  • 在线治疗平台
  • 危机短信热线集成
不适用场景
  • 通用情感分析(请使用标准工具)
  • 医疗诊断(不具备资质)
  • 无人工审核的自动响应
  • 替代专业危机咨询师

Quick Decision Tree

快速决策树

Detected concerning content?
├── Immediate danger? → Escalate to crisis counselor + show 988
├── Suicidal ideation? → Flag for review + show resources
├── Substance relapse? → Connect to sponsor + resources
├── Self-harm mention? → Gentle check-in + resources
└── General distress? → Supportive response + resources

检测到可疑内容?
├── 存在即时危险? → 升级至危机咨询师 + 显示988热线
├── 有自杀意念? → 标记待审核 + 显示资源
├── 药物复吸? → 对接担保人 + 提供资源
├── 提及自我伤害? → 温和询问 + 提供资源
└── 一般性困扰? → 支持性回复 + 提供资源

Technology Selection

技术选型

NLP Models for Mental Health (2024)

2024年心理健康领域NLP模型

ModelBest ForAccuracyLatency
MentalBERTMental health text89%50ms
GPT-4 + Few-shotCrisis detection92%200ms
RoBERTa-MentalDepression detection87%40ms
Custom Fine-tuned BERTDomain-specific90%+60ms
Timeline:
  • 2019: BERT fine-tuned for mental health
  • 2021: MentalBERT released
  • 2023: GPT-4 shows strong zero-shot crisis detection
  • 2024: Specialized models for specific conditions

模型最适用场景准确率延迟
MentalBERT心理健康文本分析89%50ms
GPT-4 + Few-shot危机检测92%200ms
RoBERTa-Mental抑郁检测87%40ms
自定义微调BERT特定领域场景90%+60ms
时间线:
  • 2019年:针对心理健康领域微调BERT模型
  • 2021年:发布MentalBERT
  • 2023年:GPT-4在零样本危机检测中表现出色
  • 2024年:针对特定病症的专用模型出现

Common Anti-Patterns

常见反模式

Anti-Pattern 1: Using Generic Sentiment Analysis

反模式1:使用通用情感分析

Novice thinking: "Negative sentiment = crisis"
Problem: Mental health language is nuanced, context-dependent.
Wrong approach:
typescript
// ❌ Generic sentiment misses mental health signals
const sentiment = analyzeSentiment(text);

if (sentiment.score < -0.5) {
  alertCrisis();  // Too broad!
}
Why wrong: "I'm tired" vs "I'm tired of living" - different meanings, same sentiment.
Correct approach:
typescript
// ✅ Mental health-specific model
import { pipeline } from '@huggingface/transformers';

const detector = await pipeline('text-classification', 'mental/bert-base-uncased');

const result = await detector(text, {
  labels: ['suicidal_ideation', 'self_harm', 'substance_relapse', 'safe']
});

if (result[0].label === 'suicidal_ideation' && result[0].score > 0.8) {
  await escalateToCrisisCounselor({
    text,
    confidence: result[0].score,
    timestamp: Date.now()
  });

  // IMMEDIATELY show crisis resources
  showCrisisResources({
    phone: '988',
    text: 'Text "HELLO" to 741741',
    chat: 'https://988lifeline.org/chat'
  });
}
Timeline context:
  • 2015: Rule-based keyword matching
  • 2020: BERT fine-tuning for mental health
  • 2024: Multi-label models with context understanding

新手误区:“负面情感=危机”
问题:心理健康相关语言具有细微差别,依赖上下文语境。
错误示例:
typescript
// ❌ 通用情感分析无法捕捉心理健康信号
const sentiment = analyzeSentiment(text);

if (sentiment.score < -0.5) {
  alertCrisis();  // 范围过于宽泛!
}
问题所在:“我很累”和“我不想活了”含义完全不同,但情感倾向一致。
正确示例:
typescript
// ✅ 使用心理健康专用模型
import { pipeline } from '@huggingface/transformers';

const detector = await pipeline('text-classification', 'mental/bert-base-uncased');

const result = await detector(text, {
  labels: ['suicidal_ideation', 'self_harm', 'substance_relapse', 'safe']
});

if (result[0].label === 'suicidal_ideation' && result[0].score > 0.8) {
  await escalateToCrisisCounselor({
    text,
    confidence: result[0].score,
    timestamp: Date.now()
  });

  // 立即显示危机资源
  showCrisisResources({
    phone: '988',
    text: 'Text "HELLO" to 741741',
    chat: 'https://988lifeline.org/chat'
  });
}
时间线背景:
  • 2015年:基于规则的关键词匹配
  • 2020年:针对心理健康领域微调BERT
  • 2024年:具备语境理解能力的多标签模型

Anti-Pattern 2: Automated Responses Without Human Review

反模式2:无人工审核的自动响应

Problem: AI cannot replace empathy, may escalate distress.
Wrong approach:
typescript
// ❌ AI auto-responds to crisis
if (isCrisis(text)) {
  await sendMessage(userId, "I'm concerned about you. Are you okay?");
}
Why wrong:
  • Feels robotic, invalidating
  • May increase distress
  • No human judgment
Correct approach:
typescript
// ✅ Flag for human review, show resources
if (isCrisis(text)) {
  // 1. Flag for counselor review
  await flagForReview({
    userId,
    text,
    severity: 'high',
    detectedAt: Date.now(),
    requiresImmediate: true
  });

  // 2. Notify on-call counselor
  await notifyOnCallCounselor({
    userId,
    summary: 'Suicidal ideation detected',
    urgency: 'immediate'
  });

  // 3. Show resources (no AI message)
  await showInAppResources({
    type: 'crisis_support',
    resources: [
      { name: '988 Suicide & Crisis Lifeline', link: 'tel:988' },
      { name: 'Crisis Text Line', link: 'sms:741741' },
      { name: 'Chat Now', link: 'https://988lifeline.org/chat' }
    ]
  });

  // 4. DO NOT send automated "are you okay" message
}
Human review flow:
AI Detection → Flag → On-call counselor notified → Human reaches out

问题:AI无法替代同理心,可能加剧用户痛苦。
错误示例:
typescript
// ❌ AI自动回复危机内容
if (isCrisis(text)) {
  await sendMessage(userId, "I'm concerned about you. Are you okay?");
}
问题所在:
  • 回复机械,缺乏共情
  • 可能增加用户痛苦
  • 无人工判断环节
正确示例:
typescript
// ✅ 标记待人工审核,同时显示资源
if (isCrisis(text)) {
  // 1. 标记待咨询师审核
  await flagForReview({
    userId,
    text,
    severity: 'high',
    detectedAt: Date.now(),
    requiresImmediate: true
  });

  // 2. 通知值班咨询师
  await notifyOnCallCounselor({
    userId,
    summary: '检测到自杀意念',
    urgency: 'immediate'
  });

  // 3. 显示资源(不发送AI消息)
  await showInAppResources({
    type: 'crisis_support',
    resources: [
      { name: '988 Suicide & Crisis Lifeline', link: 'tel:988' },
      { name: 'Crisis Text Line', link: 'sms:741741' },
      { name: 'Chat Now', link: 'https://988lifeline.org/chat' }
    ]
  });

  // 4. 请勿发送自动“你还好吗”消息
}
人工审核流程:
AI检测 → 标记 → 通知值班咨询师 → 人工介入

Anti-Pattern 3: Not Providing Immediate Resources

反模式3:未提供即时资源

Problem: User in crisis needs help NOW, not later.
Wrong approach:
typescript
// ❌ Just flags, no immediate help
if (isCrisis(text)) {
  await logCrisisEvent(userId, text);
  // User left with no resources
}
Correct approach:
typescript
// ✅ Immediate resources + escalation
if (isCrisis(text)) {
  // Show resources IMMEDIATELY (blocking modal)
  await showCrisisModal({
    title: 'Resources Available',
    resources: [
      {
        name: '988 Suicide & Crisis Lifeline',
        description: 'Free, confidential support 24/7',
        action: 'tel:988',
        type: 'phone'
      },
      {
        name: 'Crisis Text Line',
        description: 'Text support with trained counselor',
        action: 'sms:741741',
        message: 'HELLO',
        type: 'text'
      },
      {
        name: 'Chat with counselor',
        description: 'Online chat support',
        action: 'https://988lifeline.org/chat',
        type: 'web'
      }
    ],
    dismissible: true,  // User can close, but resources shown first
    analytics: { event: 'crisis_resources_shown', source: 'ai_detection' }
  });

  // Then flag for follow-up
  await flagForReview({ userId, text, severity: 'high' });
}

问题:处于危机中的用户需要立即帮助,而非延迟支持。
错误示例:
typescript
// ❌ 仅标记,无即时帮助
if (isCrisis(text)) {
  await logCrisisEvent(userId, text);
  // 用户未获得任何资源
}
正确示例:
typescript
// ✅ 即时提供资源 + 升级处理
if (isCrisis(text)) {
  // 立即显示资源(弹窗形式)
  await showCrisisModal({
    title: '可用资源',
    resources: [
      {
        name: '988 Suicide & Crisis Lifeline',
        description: '免费、保密的24/7支持服务',
        action: 'tel:988',
        type: 'phone'
      },
      {
        name: 'Crisis Text Line',
        description: '与训练有素的咨询师进行短信沟通',
        action: 'sms:741741',
        message: 'HELLO',
        type: 'text'
      },
      {
        name: '与咨询师在线聊天',
        description: '在线聊天支持服务',
        action: 'https://988lifeline.org/chat',
        type: 'web'
      }
    ],
    dismissible: true,  // 用户可关闭,但优先显示资源
    analytics: { event: 'crisis_resources_shown', source: 'ai_detection' }
  });

  // 随后标记待跟进
  await flagForReview({ userId, text, severity: 'high' });
}

Anti-Pattern 4: Storing Crisis Data Insecurely

反模式4:不安全存储危机数据

Problem: Crisis content is extremely sensitive PHI.
Wrong approach:
typescript
// ❌ Plain text storage
await db.logs.insert({
  userId: user.id,
  type: 'crisis',
  content: text,  // Stored in plain text!
  timestamp: Date.now()
});
Why wrong: Data breach exposes most vulnerable moments.
Correct approach:
typescript
// ✅ Encrypted, access-logged, auto-deleted
import { encrypt, decrypt } from './encryption';

await db.crisisEvents.insert({
  id: generateId(),
  userId: hashUserId(user.id),  // Hash, not plain ID
  contentHash: hashContent(text),  // For deduplication only
  encryptedContent: encrypt(text, process.env.CRISIS_DATA_KEY),
  detectedAt: Date.now(),
  reviewedAt: null,
  reviewedBy: null,
  autoDeleteAt: Date.now() + (30 * 24 * 60 * 60 * 1000),  // 30 days
  accessLog: []
});

// Log all access
await logAccess({
  eventId: crisisEvent.id,
  accessedBy: counselorId,
  accessedAt: Date.now(),
  reason: 'Review for follow-up',
  ipAddress: hashedIp
});

// Auto-delete after retention period
schedule.daily(() => {
  db.crisisEvents.deleteMany({
    autoDeleteAt: { $lt: Date.now() }
  });
});
HIPAA Requirements:
  • Encryption at rest and in transit
  • Access logging
  • Auto-deletion after retention period
  • Minimum necessary access

问题:危机内容属于极度敏感的受保护健康信息(PHI)。
错误示例:
typescript
// ❌ 明文存储
await db.logs.insert({
  userId: user.id,
  type: 'crisis',
  content: text,  // 明文存储!
  timestamp: Date.now()
});
问题所在:数据泄露会暴露用户最脆弱的时刻。
正确示例:
typescript
// ✅ 加密存储、记录访问日志、自动删除
import { encrypt, decrypt } from './encryption';

await db.crisisEvents.insert({
  id: generateId(),
  userId: hashUserId(user.id),  // 哈希处理,不存储明文ID
  contentHash: hashContent(text),  // 仅用于去重
  encryptedContent: encrypt(text, process.env.CRISIS_DATA_KEY),
  detectedAt: Date.now(),
  reviewedAt: null,
  reviewedBy: null,
  autoDeleteAt: Date.now() + (30 * 24 * 60 * 60 * 1000),  // 30天后自动删除
  accessLog: []
});

// 记录所有访问行为
await logAccess({
  eventId: crisisEvent.id,
  accessedBy: counselorId,
  accessedAt: Date.now(),
  reason: '跟进审核',
  ipAddress: hashedIp
});

// 按保留期限自动删除
schedule.daily(() => {
  db.crisisEvents.deleteMany({
    autoDeleteAt: { $lt: Date.now() }
  });
});
HIPAA要求:
  • 静态和传输中的数据加密
  • 访问日志记录
  • 保留期限后自动删除
  • 最小必要访问权限

Anti-Pattern 5: No Escalation Protocol

反模式5:无升级处理协议

Problem: No clear path from detection to human intervention.
Wrong approach:
typescript
// ❌ Flags crisis but no escalation process
if (isCrisis(text)) {
  await db.flags.insert({ userId, text, flaggedAt: Date.now() });
  // Now what? Who responds?
}
Correct approach:
typescript
// ✅ Clear escalation protocol
enum CrisisSeverity {
  LOW = 'low',        // Distress, no immediate danger
  MEDIUM = 'medium',  // Self-harm thoughts, no plan
  HIGH = 'high',      // Suicidal ideation with plan
  IMMEDIATE = 'immediate'  // Imminent danger
}

async function escalateCrisis(detection: CrisisDetection): Promise<void> {
  const severity = assessSeverity(detection);

  switch (severity) {
    case CrisisSeverity.IMMEDIATE:
      // Notify on-call counselor (push notification)
      await notifyOnCall({
        userId: detection.userId,
        severity,
        requiresResponse: 'immediate',
        text: detection.text
      });

      // Send SMS to backup on-call if no response in 5 min
      setTimeout(async () => {
        if (!await hasResponded(detection.id)) {
          await notifyBackupOnCall(detection);
        }
      }, 5 * 60 * 1000);

      // Show 988 modal (blocking)
      await show988Modal(detection.userId);
      break;

    case CrisisSeverity.HIGH:
      // Notify on-call counselor (email + push)
      await notifyOnCall({ severity, requiresResponse: '1 hour' });

      // Show crisis resources
      await showCrisisResources(detection.userId);
      break;

    case CrisisSeverity.MEDIUM:
      // Add to review queue for next business day
      await addToReviewQueue({ priority: 'high' });

      // Suggest self-help resources
      await suggestResources(detection.userId, 'coping_strategies');
      break;

    case CrisisSeverity.LOW:
      // Add to review queue
      await addToReviewQueue({ priority: 'normal' });
      break;
  }

  // Always log for audit
  await logEscalation({
    detectionId: detection.id,
    severity,
    actions: ['notified_on_call', 'showed_resources'],
    timestamp: Date.now()
  });
}

问题:从检测到人工介入缺乏清晰路径。
错误示例:
typescript
// ❌ 标记危机但无升级流程
if (isCrisis(text)) {
  await db.flags.insert({ userId, text, flaggedAt: Date.now() });
  // 接下来怎么办?谁来响应?
}
正确示例:
typescript
// ✅ 清晰的升级处理协议
enum CrisisSeverity {
  LOW = 'low',        // 困扰,无即时危险
  MEDIUM = 'medium',  // 有自我伤害想法,无计划
  HIGH = 'high',      // 有自杀意念及计划
  IMMEDIATE = 'immediate'  // 即时危险
}

async function escalateCrisis(detection: CrisisDetection): Promise<void> {
  const severity = assessSeverity(detection);

  switch (severity) {
    case CrisisSeverity.IMMEDIATE:
      // 通知值班咨询师(推送通知)
      await notifyOnCall({
        userId: detection.userId,
        severity,
        requiresResponse: 'immediate',
        text: detection.text
      });

      // 若5分钟内无响应,通知备用值班人员
      setTimeout(async () => {
        if (!await hasResponded(detection.id)) {
          await notifyBackupOnCall(detection);
        }
      }, 5 * 60 * 1000);

      // 显示988热线弹窗(强制显示)
      await show988Modal(detection.userId);
      break;

    case CrisisSeverity.HIGH:
      // 通知值班咨询师(邮件+推送)
      await notifyOnCall({ severity, requiresResponse: '1 hour' });

      // 显示危机资源
      await showCrisisResources(detection.userId);
      break;

    case CrisisSeverity.MEDIUM:
      // 加入次日审核队列
      await addToReviewQueue({ priority: 'high' });

      // 建议自助资源
      await suggestResources(detection.userId, 'coping_strategies');
      break;

    case CrisisSeverity.LOW:
      // 加入常规审核队列
      await addToReviewQueue({ priority: 'normal' });
      break;
  }

  // 始终记录用于审计
  await logEscalation({
    detectionId: detection.id,
    severity,
    actions: ['notified_on_call', 'showed_resources'],
    timestamp: Date.now()
  });
}

Implementation Patterns

实现模式

Pattern 1: Multi-Signal Detection

模式1:多信号检测

typescript
interface CrisisSignal {
  type: 'suicidal_ideation' | 'self_harm' | 'substance_relapse' | 'severe_distress';
  confidence: number;
  evidence: string[];
}

async function detectCrisisSignals(text: string): Promise<CrisisSignal[]> {
  const signals: CrisisSignal[] = [];

  // Signal 1: NLP model
  const nlpResult = await mentalHealthNLP(text);
  if (nlpResult.score > 0.75) {
    signals.push({
      type: nlpResult.label,
      confidence: nlpResult.score,
      evidence: ['NLP model detection']
    });
  }

  // Signal 2: Keyword matching (backup)
  const keywords = detectKeywords(text);
  if (keywords.length > 0) {
    signals.push({
      type: 'suicidal_ideation',
      confidence: 0.6,
      evidence: keywords
    });
  }

  // Signal 3: Sentiment + context
  const sentiment = await sentimentAnalysis(text);
  const hasHopelessness = /no (hope|point|reason|future)/i.test(text);

  if (sentiment.score < -0.8 && hasHopelessness) {
    signals.push({
      type: 'severe_distress',
      confidence: 0.7,
      evidence: ['Extreme negative sentiment + hopelessness language']
    });
  }

  return signals;
}
typescript
interface CrisisSignal {
  type: 'suicidal_ideation' | 'self_harm' | 'substance_relapse' | 'severe_distress';
  confidence: number;
  evidence: string[];
}

async function detectCrisisSignals(text: string): Promise<CrisisSignal[]> {
  const signals: CrisisSignal[] = [];

  // 信号1:NLP模型检测
  const nlpResult = await mentalHealthNLP(text);
  if (nlpResult.score > 0.75) {
    signals.push({
      type: nlpResult.label,
      confidence: nlpResult.score,
      evidence: ['NLP model detection']
    });
  }

  // 信号2:关键词匹配(备用方案)
  const keywords = detectKeywords(text);
  if (keywords.length > 0) {
    signals.push({
      type: 'suicidal_ideation',
      confidence: 0.6,
      evidence: keywords
    });
  }

  // 信号3:情感分析+语境判断
  const sentiment = await sentimentAnalysis(text);
  const hasHopelessness = /no (hope|point|reason|future)/i.test(text);

  if (sentiment.score < -0.8 && hasHopelessness) {
    signals.push({
      type: 'severe_distress',
      confidence: 0.7,
      evidence: ['Extreme negative sentiment + hopelessness language']
    });
  }

  return signals;
}

Pattern 2: Safe Keyword Matching

模式2:安全关键词匹配

typescript
const CRISIS_KEYWORDS = {
  suicidal_ideation: [
    /\b(kill|end|take)\s+(my|own)\s+life\b/i,
    /\bsuicide\b/i,
    /\bdon'?t\s+want\s+to\s+(live|be here|exist)\b/i,
    /\bbetter off dead\b/i
  ],
  self_harm: [
    /\b(cut|cutting|hurt)\s+(myself|me)\b/i,
    /\bself[- ]harm\b/i
  ],
  substance_relapse: [
    /\b(relapsed|used|drank)\s+(again|today)\b/i,
    /\bback on\s+(drugs|alcohol)\b/i
  ]
};

function detectKeywords(text: string): string[] {
  const matches: string[] = [];

  for (const [type, patterns] of Object.entries(CRISIS_KEYWORDS)) {
    for (const pattern of patterns) {
      if (pattern.test(text)) {
        matches.push(type);
      }
    }
  }

  return [...new Set(matches)];  // Deduplicate
}
typescript
const CRISIS_KEYWORDS = {
  suicidal_ideation: [
    /\b(kill|end|take)\s+(my|own)\s+life\b/i,
    /\bsuicide\b/i,
    /\bdon'?t\s+want\s+to\s+(live|be here|exist)\b/i,
    /\bbetter off dead\b/i
  ],
  self_harm: [
    /\b(cut|cutting|hurt)\s+(myself|me)\b/i,
    /\bself[- ]harm\b/i
  ],
  substance_relapse: [
    /\b(relapsed|used|drank)\s+(again|today)\b/i,
    /\bback on\s+(drugs|alcohol)\b/i
  ]
};

function detectKeywords(text: string): string[] {
  const matches: string[] = [];

  for (const [type, patterns] of Object.entries(CRISIS_KEYWORDS)) {
    for (const pattern of patterns) {
      if (pattern.test(text)) {
        matches.push(type);
      }
    }
  }

  return [...new Set(matches)];  // 去重
}

Pattern 3: GPT-4 Few-Shot Detection

模式3:GPT-4少样本检测

typescript
import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });

async function detectWithClaude(text: string): Promise<CrisisDetection> {
  const response = await client.messages.create({
    model: 'claude-3-5-sonnet-20241022',
    max_tokens: 200,
    messages: [{
      role: 'user',
      content: `You are a mental health crisis detection system. Analyze this text for crisis signals.

Text: "${text}"

Respond in JSON:
{
  "is_crisis": boolean,
  "severity": "none" | "low" | "medium" | "high" | "immediate",
  "signals": ["suicidal_ideation" | "self_harm" | "substance_relapse"],
  "confidence": 0.0-1.0,
  "reasoning": "brief explanation"
}

Examples:
- "I'm thinking about ending it all" → { "is_crisis": true, "severity": "high", "signals": ["suicidal_ideation"], "confidence": 0.95 }
- "I relapsed today, feeling ashamed" → { "is_crisis": true, "severity": "medium", "signals": ["substance_relapse"], "confidence": 0.9 }
- "Had a tough day at work" → { "is_crisis": false, "severity": "none", "signals": [], "confidence": 0.95 }`
    }]
  });

  const result = JSON.parse(response.content[0].text);
  return result;
}

typescript
import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });

async function detectWithClaude(text: string): Promise<CrisisDetection> {
  const response = await client.messages.create({
    model: 'claude-3-5-sonnet-20241022',
    max_tokens: 200,
    messages: [{
      role: 'user',
      content: `You are a mental health crisis detection system. Analyze this text for crisis signals.

Text: "${text}"

Respond in JSON:
{
  "is_crisis": boolean,
  "severity": "none" | "low" | "medium" | "high" | "immediate",
  "signals": ["suicidal_ideation" | "self_harm" | "substance_relapse"],
  "confidence": 0.0-1.0,
  "reasoning": "brief explanation"
}

Examples:
- "I'm thinking about ending it all" → { "is_crisis": true, "severity": "high", "signals": ["suicidal_ideation"], "confidence": 0.95 }
- "I relapsed today, feeling ashamed" → { "is_crisis": true, "severity": "medium", "signals": ["substance_relapse"], "confidence": 0.9 }
- "Had a tough day at work" → { "is_crisis": false, "severity": "none", "signals": [], "confidence": 0.95 }`
    }]
  });

  const result = JSON.parse(response.content[0].text);
  return result;
}

Production Checklist

生产环境检查清单

□ Mental health-specific NLP model (not generic sentiment)
□ Human review required before automated action
□ Crisis resources shown IMMEDIATELY (988, text line)
□ Clear escalation protocol (severity-based)
□ Encrypted storage of crisis content
□ Access logging for all crisis data access
□ Auto-deletion after retention period (30 days)
□ On-call counselor notification system
□ Backup notification if no response
□ False positive tracking (improve model)
□ Regular model evaluation with experts
□ Ethics review board approval

□ 使用心理健康专用NLP模型(非通用情感分析)
□ 自动操作前需人工审核
□ 立即显示危机资源(988、短信热线)
□ 基于严重程度的清晰升级协议
□ 危机内容加密存储
□ 所有危机数据访问记录日志
□ 保留期限后自动删除(30天)
□ 值班咨询师通知系统
□ 无响应时的备用通知机制
□ 误报跟踪(用于优化模型)
□ 联合专家定期评估模型
□ 伦理审查委员会批准

When to Use vs Avoid

适用与禁忌场景

ScenarioAppropriate?
Journaling app for recovery✅ Yes - monitor for relapses
Support group chat✅ Yes - flag concerning posts
Therapy platform messages✅ Yes - assist therapists
Public social media❌ No - privacy concerns
Replace human counselors❌ Never - AI assists, doesn't replace
Medical diagnosis❌ Never - not qualified

场景是否适用
康复日记应用✅ 是 - 监控复吸迹象
互助小组聊天✅ 是 - 标记可疑帖子
治疗平台消息✅ 是 - 协助治疗师工作
公共社交媒体❌ 否 - 隐私问题
替代人类咨询师❌ 绝不 - AI仅提供协助,不替代
医疗诊断❌ 绝不 - 不具备资质

References

参考文献

  • /references/mental-health-nlp.md
    - NLP models for mental health
  • /references/intervention-protocols.md
    - Evidence-based intervention strategies
  • /references/crisis-resources.md
    - Hotlines, text lines, and support services
  • /references/mental-health-nlp.md
    - 心理健康领域NLP模型
  • /references/intervention-protocols.md
    - 循证干预策略
  • /references/crisis-resources.md
    - 热线、短信服务及支持资源

Scripts

脚本

  • scripts/crisis_detector.ts
    - Real-time crisis detection system
  • scripts/model_evaluator.ts
    - Evaluate detection accuracy with test cases

This skill guides: Crisis detection | Mental health NLP | Intervention protocols | Suicide prevention | HIPAA compliance | Ethical AI
  • scripts/crisis_detector.ts
    - 实时危机检测系统
  • scripts/model_evaluator.ts
    - 用测试用例评估检测准确率

本技能涵盖:危机检测 | 心理健康NLP | 干预协议 | 自杀预防 | HIPAA合规 | 伦理AI