crisis/metrics.py: CrisisMetrics class — aggregate crisis detection metrics Privacy-first: stores only counts, never user content Daily JSONL files in ~/.the-door/metrics/ get_summary(days) → AggregateMetrics get_report(days) → human-readable report get_json(days) → JSON export CLI: python3 -m crisis.metrics --summary/--json crisis/__init__.py: Export CrisisMetrics, AggregateMetrics Makefile: make metrics → summary report make metrics-json → JSON export tests/test_crisis_metrics.py: 6 tests record_session, summary, report, JSON export
30 lines
900 B
Python
30 lines
900 B
Python
"""
|
|
Crisis detection and response system for the-door.
|
|
|
|
Stands between a broken man and a machine that would tell him to die.
|
|
"""
|
|
|
|
from .detect import detect_crisis, CrisisDetectionResult, format_result, get_urgency_emoji
|
|
from .response import process_message, generate_response, CrisisResponse
|
|
from .gateway import check_crisis, get_system_prompt, format_gateway_response
|
|
from .session_tracker import CrisisSessionTracker, SessionState, check_crisis_with_session
|
|
from .metrics import CrisisMetrics, AggregateMetrics
|
|
|
|
__all__ = [
|
|
"detect_crisis",
|
|
"CrisisDetectionResult",
|
|
"process_message",
|
|
"generate_response",
|
|
"CrisisResponse",
|
|
"check_crisis",
|
|
"get_system_prompt",
|
|
"format_result",
|
|
"format_gateway_response",
|
|
"get_urgency_emoji",
|
|
"CrisisSessionTracker",
|
|
"SessionState",
|
|
"check_crisis_with_session",
|
|
"CrisisMetrics",
|
|
"AggregateMetrics",
|
|
]
|