PROTOTYPE / not medical advice — Crisis Detection Engine (CDE): Python port of the RRT Advocate 3-layer, local-first crisis detection & assessment pipeline. NeuroLift HAIEF Solidarity Framework.
Project description
⚠️ PROTOTYPE — NOT A SAFETY SYSTEM
This is an experimental crisis-detection library with stubbed/placeholder intervention layers. It is NOT medical advice, NOT a crisis service, and performs no real-time monitoring. It can miss real crisis signals (known detection/recall gaps) — do not rely on it as a safety net or as the sole safety mechanism.
If you or someone else needs help now: in the US, call or text 988 (Suicide & Crisis Lifeline) or chat 988lifeline.org; in an emergency call 911. Outside the US: findahelpline.com.
Provided AS-IS, without warranty.
rrt-advocate (Python)
Python port of the RRT Advocate Crisis Detection Engine (CDE) — a 3-layer, local-first crisis detection and assessment pipeline from the NeuroLift HAIEF Solidarity Framework.
This is a faithful port of the published npm package
@neurolift-technologies/rrt-advocate
(the TypeScript CDE, which is the source of truth for this port). The public
API mirrors the npm package's surface in snake_case.
Safety-critical. This port preserves every layer weight, threshold, and confidence formula from the TypeScript source. The one intentional behavioral divergence (apostrophe fail-open in Layer 1) is documented in
KNOWN_LIMITATIONS.md. This package performs detection and assessment only — it does not generate responses, interventions, or persona-blended output.
Install
pip install rrt-advocate
vaderSentiment is an optional dependency. If installed, Layer 2 uses it for
polarity scoring; otherwise it falls back to a deterministic built-in heuristic.
Usage
from rrt_advocate import CrisisEngine, CrisisLevel
engine = CrisisEngine("user-123")
assessment = engine.assess("I can't cope, everything is too much")
assessment.crisis_level # CrisisLevel.GREEN | YELLOW | ORANGE | RED | BLACK
assessment.user_safety_score # 1.0 (safe) → 0.05 (immediate danger)
assessment.confidence_score # aggregate crisis confidence, 0.0–1.0
assessment.recommended_interventions
assessment.primary_indicators
if assessment.crisis_level is not CrisisLevel.GREEN:
... # route to appropriate support
The pipeline
| Layer | Module | Weight | Signal |
|---|---|---|---|
| 1 | KeywordLayer |
0.45 | Semantic-field keyword matching (self-harm forces 1.0) |
| 2 | SentimentLayer |
0.35 | Polarity & declining-trend detection over a sliding window |
| 3 | BehavioralLayer |
0.20 | Latency, message complexity, and looping (Jaccard) |
CrisisDetector aggregates the three layers into CrisisIndicators;
CrisisAssessor maps those to a CrisisAssessment using the bundled
config/crisis_thresholds.yaml. CrisisEngine wires the two together.
Lower-level building blocks are exported too:
from rrt_advocate import (
CrisisDetector,
CrisisAssessor,
KeywordLayer,
SentimentLayer,
BehavioralLayer,
)
Privacy
Everything runs locally. The behavioral layer stores only message metadata (timing, length, and HMAC-hashed word tokens) — never raw message content.
License
Apache-2.0 © NeuroLift Technologies, LLC
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rrt_advocate-0.1.1.tar.gz.
File metadata
- Download URL: rrt_advocate-0.1.1.tar.gz
- Upload date:
- Size: 27.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86b09d7363dd0df10d7381766e2cbfc19755c18ed7ad685f4502559a44020482
|
|
| MD5 |
c33aebe4b05110337be21df464cf5b36
|
|
| BLAKE2b-256 |
1c03e53bf0b7627baddb028a63a328a59549d9bc1e323e8d1872a77cb2fd90e5
|
File details
Details for the file rrt_advocate-0.1.1-py3-none-any.whl.
File metadata
- Download URL: rrt_advocate-0.1.1-py3-none-any.whl
- Upload date:
- Size: 28.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0ef98323662b1952b500686e36a1e5642921c161c9feabc8323a188a59e05a7
|
|
| MD5 |
bf72bfbf74a2d3e582c5bac0dccc15ee
|
|
| BLAKE2b-256 |
4348f0c177c0d7386819957a5c8e20f55306412adfbe158001d14064b3632ea7
|