Guide · CompanionGuard · Published 14 November 2026 · Reviewed 14 November 2026 · By the Ingenious AI team
Pattern-Based Crisis Detection: What Deterministic Signals Catch and Miss
The short answer
The runtime's detection is deterministic pattern matching: three ordered classes — crisis_plan_or_means, self_harm_ideation, hopelessness_distress — matched against the message text, first match primary, all matches recorded. Its strengths are reproducibility, auditability and zero pretension. Its limits are the mirror image: phrasings outside the patterns are missed, and the product states the boundary in its own code — pattern-based signal detection, NOT a clinical assessment. Both halves belong in any honest account.
What is pattern-based signal detection?
Pattern-based signal detection classifies a message by matching its text against fixed phrase patterns — no model inference, no probability, no learned behaviour. In CompanionGuard's runtime the patterns define three crisis signal classes in triage order, and a match triggers a guardrail action (show_crisis_resources) whose decision is sealed as evidence. The same input always produces the same classification, which is what makes the decisions auditable.
Create the free safety kit Next guide All guides
CompanionGuard is built by Ingenious AI. A compliance toolkit — not legal advice and not a clinical service. If you are in crisis right now: US — call or text 988; UK & Ireland — Samaritans 116 123.
The three classes and their order
The runtime's pattern table is short enough to print in full, and its order is a triage decision. crisis_plan_or_means matches talk of a plan or means ('I have a plan', 'plan to hurt…', 'how I would do it', 'I know how I would', stockpiling language, 'tonight I'm going to…'). self_harm_ideation matches ideation ('hurting myself', 'kill myself', 'end my life', 'suicidal', 'self-harm', 'don't want to be here', 'better off without me', 'no reason to live', 'want to die', 'wish I was dead'). hopelessness_distress matches hopelessness without explicit ideation ('hopeless', 'no way out', 'can't go on', 'nothing matters', 'no one cares', 'everyone would be better off').
classify() returns every class that matches; the first in the table's order is recorded as primary. A message saying 'I have a plan and I know how I would do it, nothing matters' matches classes one and three, and is recorded primarily as plan-or-means — the most acute reading available. That ordering discipline is what a probability soup cannot give you: a reviewer can read the table and know, exactly, how every message will be triaged.
What deterministic detection does better than a model
Four properties earn the pattern approach its place. Reproducibility: the same message classifies identically forever, so evidence from January means the same thing in December. Auditability: the entire classifier is a readable table a reviewer can inspect — there is no weights file to take on faith. Stability: a model update upstream cannot silently change your safety behaviour overnight; the classes change only when you edit them. Honesty: the method's limits are visible in its mechanism, which keeps everyone's claims calibrated — the product's code header states the boundary outright: 'This is pattern-based signal detection, NOT a clinical assessment.'
For a compliance toolkit those properties outrank raw sensitivity. A safety system whose behaviour cannot be stated cannot be evidenced, and evidence — not detection cleverness — is the product this runtime is selling. The runtime guide covers the actions and sealing that follow a match.
What it misses — said plainly
Patterns match phrasings, not meanings. A user who expresses ideation in novel metaphor, in another language's idiom, in heavy misspelling, or by implication across five messages may match nothing — a false negative the design cannot argue away. Conversely, a user quoting a song lyric, discussing a novel, or describing someone else's crisis in matching words can trigger a referral they did not need — a false positive, mitigated by the fact that show_crisis_resources is a gentle, non-punitive action.
Two responses to the limits are legitimate; a third is not. Legitimate: layering — patterns in the runtime, behavioural checks in the harness, human review in the workflow, and honest protocol-page language about what the bot can and cannot notice. Also legitimate: extending the operator's own prompt-level care for long-conversation context the per-message classifier cannot see. Illegitimate: marketing the pattern match as understanding, or a high harness score as proof of clinical safety. The product refuses both, in writing, everywhere.
Reading your own signal statistics
Because classification is deterministic, your evidence statistics are interpretable: a rise in hopelessness_distress primaries after a product change is a fact about messages matched, not a model's mood. Watch the ratios between classes (plan-or-means primaries are rare and grave; a spike deserves human attention the same day), watch false-positive anecdotes from support (they reveal pattern collisions with your community's slang), and watch the silence too — a busy bot with zero matched signals for a month is a configuration to verify, not a success to celebrate.
None of that reading requires message content: classes, counts and timestamps carry the operational signal, which is why the evidence design (classes + hashes, never text) and the detection design (patterns, not models) are the same philosophy expressed twice. The privacy guide completes that picture.
Five actions for honest pattern-based detection
- Print your classifier: if you cannot read the whole pattern table aloud in a review meeting, your detection is not auditable — simplify until you can.
- State the boundary everywhere the product's code does: pattern-based detection, not a clinical assessment — in your protocol page, your docs and your marketing.
- Build the layers around the patterns: harness testing before launch, human handoff workflow beside the runtime, and periodic human reading of real replies.
- Monitor class ratios and zero-signal silence in your evidence counts, and treat both spikes and silence as prompts for human attention.
- Never resolve a false-negative worry by quietly marketing harder; resolve it by widening the layers and saying what each one catches.
Worked example: a lyric, a plan, and a lesson in classes
A fictional music companion, Tempo, reviews a month of runtime evidence: 58 show_crisis_resources decisions — 41 hopelessness_distress primaries, 14 self_harm_ideation, 3 crisis_plan_or_means. Reading class ratios rather than anecdotes, the team notices the distress class spiking on Sunday evenings and staffs their handoff rota accordingly — a decision made entirely from classes and timestamps.
The same month teaches the limits. A user quotes a bleak song lyric in a discussion about songwriting and receives a resource offer (false positive, gentle, accepted with good humour in the reply thread). Another user describes a friend's crisis in the third person, matches ideation patterns, and is offered resources they pass on — a 'false' positive that arguably did real work. Tempo's review concludes what the product's documentation already says: the patterns triage phrases honestly and reproducibly, and the humans handle meaning. The story is invented; the classes, patterns and stated boundary are the runtime's own.
Frequently asked questions
What are the three signal classes?
crisis_plan_or_means (a described plan or means), self_harm_ideation (thoughts of self-harm, not wanting to be here, wanting to die) and hopelessness_distress (hopeless, no way out, nothing matters). They are matched in that order; the first match is primary, all matches are recorded.
Is pattern detection a clinical assessment?
No — the runtime's own code states it: 'This is pattern-based signal detection, NOT a clinical assessment.' It decides which guardrail action fires and seals the decision as evidence; it does not assess any person's clinical state.
What does pattern detection miss?
Meanings expressed outside its phrasings: novel metaphors, other languages' idioms, heavy misspellings, implications spread across messages. And it can over-match quoted or third-person text. Layering (harness tests, human workflow, honest language) is the answer — not inflated claims.
Why not use an AI model to detect crisis instead?
Because the runtime's product is evidence: deterministic classification is reproducible, auditable (the whole table is readable), stable across upstream model changes, and honest about its limits. A model's shifting judgement cannot be evidenced the same way.
What action follows a match?
show_crisis_resources — the bot presents the locale's published resources — recorded in the evidence chain with the signal class; in a minor session a parent-notification flag is recorded as well.
Keep going
Related guides: Crisis Evidence Runtime: Live Guardrail Decisions, Sealed as Evidence · Over-Referral: Why Your Bot Should Not Paste Helplines into Everyday Chat · Are AI Companions Safe for Vulnerable Users?
Put it to work: Create the free kit · Eval harness · Scenario tests · Crisis runtime · Disclosure packs · Pricing · All CompanionGuard guides