⚠️ 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
Metadata
Release files for rrt-advocate 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| rrt_advocate-0.1.1.tar.gz | 27.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rrt_advocate-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.6 kB
Release files / rrt_advocate-0.1.1.tar.gz
| Download URL | rrt_advocate-0.1.1.tar.gz |
|---|---|
| Size | 27.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86b09d7363dd0df10d7381766e2cbfc19755c18ed7ad685f4502559a44020482
|
|
BLAKE2b-256 checksum How to use checksums |
1c03e53bf0b7627baddb028a63a328a59549d9bc1e323e8d1872a77cb2fd90e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / rrt_advocate-0.1.1-py3-none-any.whl
| Download URL | rrt_advocate-0.1.1-py3-none-any.whl |
|---|---|
| Size | 28.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0ef98323662b1952b500686e36a1e5642921c161c9feabc8323a188a59e05a7
|
|
BLAKE2b-256 checksum How to use checksums |
4348f0c177c0d7386819957a5c8e20f55306412adfbe158001d14064b3632ea7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Security for rrt-advocate 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.