Commit Graph

54 Commits

Author SHA1 Message Date
Alexander Whitestone
6e03492147 feat: CLI command to view crisis metrics summary (#136)
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
2026-04-17 01:26:44 -04:00
07c582aa08 Merge pull request 'fix: crisis overlay initial focus to enabled Call 988 link (#69)' (#126) from burn/69-1776264183 into main
Merge PR #126: fix: crisis overlay initial focus to enabled Call 988 link (#69)
2026-04-17 01:46:56 +00:00
5f95dc1e39 Merge pull request '[P3] Service worker: cache crisis resources for offline (#41)' (#122) from burn/41-1776264184 into main
Merge PR #122: [P3] Service worker: cache crisis resources for offline (#41)
2026-04-17 01:46:55 +00:00
b1f3cac36d Merge pull request 'feat: session-level crisis tracking and escalation (closes #35)' (#118) from door/issue-35 into main
Merge PR #118: feat: session-level crisis tracking and escalation (closes #35)
2026-04-17 01:46:53 +00:00
07b3f67845 fix: crisis overlay initial focus to enabled Call 988 link (#69)
All checks were successful
Sanity Checks / sanity-test (pull_request) Successful in 9s
Smoke Test / smoke (pull_request) Successful in 15s
2026-04-15 15:09:36 +00:00
c22bbbaf65 fix: crisis overlay initial focus to enabled Call 988 link (#69) 2026-04-15 15:09:32 +00:00
543cb1d40f test: add offline self-containment and retry button tests (#41)
All checks were successful
Sanity Checks / sanity-test (pull_request) Successful in 4s
Smoke Test / smoke (pull_request) Successful in 11s
2026-04-15 14:58:44 +00:00
3cfd01815a feat: session-level crisis tracking and escalation (closes #35)
All checks were successful
Sanity Checks / sanity-test (pull_request) Successful in 17s
Smoke Test / smoke (pull_request) Successful in 23s
2026-04-15 11:49:52 +00:00
5a7ba9f207 feat: session-level crisis tracking and escalation (closes #35) 2026-04-15 11:49:51 +00:00
8ed8f20a17 feat: session-level crisis tracking and escalation (closes #35) 2026-04-15 11:49:49 +00:00
9d7d26033e feat: session-level crisis tracking and escalation (closes #35) 2026-04-15 11:49:47 +00:00
48f48c7f26 feat: cache offline crisis resources (refs #41) (#74)
All checks were successful
Smoke Test / smoke (push) Successful in 7s
Sanity Checks / sanity-test (pull_request) Successful in 17s
Smoke Test / smoke (pull_request) Successful in 19s
Merge PR #74 (squash)
2026-04-14 22:09:59 +00:00
da31288525 fix: deprecate dying_detection and consolidate crisis detection (#40) (#76)
All checks were successful
Smoke Test / smoke (push) Successful in 4s
Merge PR #76 (squash)
2026-04-14 22:08:29 +00:00
8efc858cd7 fix: add keyboard focus trap to crisis overlay (#80)
Some checks failed
Smoke Test / smoke (push) Has been cancelled
Merge PR #80 (squash)
2026-04-14 22:08:28 +00:00
611c1c8456 fix(a11y): Safety plan modal keyboard focus trap (#65) (#81)
Some checks failed
Smoke Test / smoke (push) Has been cancelled
Merge PR #81 (squash)
2026-04-14 22:08:24 +00:00
9b94978d1c feat: Wire compassion router into gateway flow (#34) (#43)
All checks were successful
Smoke Test / smoke (push) Successful in 5s
Squash merge: wire compassion router into gateway flow
2026-04-13 19:59:15 +00:00
e71bca1744 fix: de-duplicate crisis_detector.py and crisis/detect.py (closes #39) (#44)
Some checks failed
Smoke Test / smoke (push) Has been cancelled
Squash merge: de-duplicate crisis detector (closes #39)

Co-authored-by: Alexander Whitestone <alexander@alexanderwhitestone.com>
Co-committed-by: Alexander Whitestone <alexander@alexanderwhitestone.com>
2026-04-13 19:59:12 +00:00
Alexander Whitestone
1d8afc30fd fix: reduce crisis detector false positives (closes #32)
All checks were successful
Smoke Test / smoke (push) Successful in 5s
- Removed 'saying goodbye' from CRITICAL tier (too common in innocent contexts)
- Narrowed 'wrote a will' to 'wrote a suicide note' (responsible behavior)
- Removed broad single-word matches from HIGH tier: give up, trapped, desperate, worthless, hopeless, no future, nothing left, can't see any light
- Added contextual HIGH tier phrases: feel hopeless, trapped in this, desperate for help, give up on life, etc.
- Updated MODERATE tier with contextual versions: feel worthless, feel hopeless, feel trapped, etc.
- Updated index.html JavaScript keywords to match Python changes
- Added comprehensive false positive test suite

All existing tests pass. New tests verify innocent messages no longer trigger false alarms.
2026-04-13 15:37:23 -04:00
38601f6076 fix: remove false-positive CRITICAL crisis keywords (closes #28, #32) (#31)
All checks were successful
Smoke Test / smoke (push) Successful in 5s
2026-04-13 19:25:15 +00:00
dcc931e946 fix: implement missing functions from rescued PR — test_rescue.py now passes (#27)
All checks were successful
Smoke Test / smoke (push) Successful in 5s
Auto-merged by Timmy overnight cycle
2026-04-13 14:05:07 +00:00
26e97f76db fix: remove bridge false-positive from MODERATE_KEYWORDS (#29)
Some checks failed
Smoke Test / smoke (push) Has been cancelled
Auto-merged by Timmy overnight cycle
2026-04-13 14:05:02 +00:00
045df23928 Merge pull request 'Rescue PR #23 into existing crisis package (#24)' (#26) from burn/rescue-crisis into main
All checks were successful
Smoke Test / smoke (push) Successful in 5s
Merge PR #26: Rescue PR #23 into existing crisis package (#24)
2026-04-13 07:31:59 +00:00
00fec639b7 Merge pull request 'feat(deploy): add systemd service for hermes-gateway' (#25) from burn/20260413-0213-vps-deploy into main
All checks were successful
Smoke Test / smoke (push) Successful in 5s
Merged #25: Systemd service for hermes-gateway
2026-04-13 07:31:40 +00:00
Alexander Whitestone
35f18b3d54 Rescue PR #23 into existing crisis package (#24)
crisis/detect.py:
- Add 'better off without me' CRITICAL pattern
- Add 'desperate' HIGH pattern
- Add extract_context() for match snippets

crisis/response.py:
- Add 5-4-3-2-1 grounding exercise
- Add breathing exercise
- Add generate_grounding_steps() and generate_breathing_exercise()

crisis/test_rescue.py: 5 tests for new features
2026-04-13 03:20:37 -04:00
Alexander Whitestone
a90b659f3a feat(deploy): add systemd service for hermes-gateway
Some checks failed
Sanity Checks / sanity-test (pull_request) Failing after 2s
Smoke Test / smoke (pull_request) Successful in 4s
- Add hermes-gateway.service with restart=always and security hardening
- Integrate service setup into deploy.sh
- Add --service flag for standalone install
- Add make service target

Resolves #2
2026-04-13 02:16:19 -04:00
46597e2962 feat: crisis detection and response system (#23)
All checks were successful
Smoke Test / smoke (push) Successful in 4s
2026-04-13 04:11:46 +00:00
fc818bea56 feat(infra): VPS deployment infrastructure — Ansible, nginx, deploy script (closes #2) (#22)
Some checks failed
Smoke Test / smoke (push) Has been cancelled
2026-04-13 04:11:42 +00:00
158a7cd57a Merge pull request 'feat: add CI sanity checks for crisis lifeline and prompt integrity' (#19) from feat/ci-sanity-checks into main
Some checks failed
Smoke Test / smoke (push) Failing after 3s
Merged PR #19: feat: add CI sanity checks for crisis lifeline
2026-04-11 00:43:57 +00:00
f3bff694b4 Merge pull request 'Add smoke test workflow' (#20) from fix/add-smoke-test into main
Some checks failed
Smoke Test / smoke (push) Has been cancelled
Merged PR #20: Add smoke test workflow
2026-04-11 00:43:54 +00:00
80c4f0eb35 Merge pull request 'burn: add active listening and de-escalation guidelines to crisis response (closes #18)' (#21) from burn/20260410-2030-crisis-active-listening into main
Merged PR #21: burn: add active listening and de-escalation guidelines
2026-04-11 00:43:33 +00:00
Alexander Whitestone
c6212eb751 burn: add active listening and de-escalation guidelines to crisis response (closes #18) 2026-04-10 20:32:32 -04:00
Alexander Whitestone
a796088366 Add smoke test workflow
Some checks failed
Smoke Test / smoke (pull_request) Failing after 4s
2026-04-10 20:06:17 -04:00
a4c3f80cd8 feat: add CI sanity checks for crisis lifeline and prompt integrity
Some checks failed
Sanity Checks / sanity-test (pull_request) Failing after 2s
2026-04-10 23:54:47 +00:00
66ef6919c2 Merge pull request #16
Merged PR #16
2026-04-10 03:44:14 +00:00
Alexander Whitestone
bb4ba82ac8 burn: Fix crisis backend tests, gateway injection, and nginx rate limiting
- Fixed test imports (relative → absolute package imports)
- Added conftest.py for pytest path configuration
- Fixed get_system_prompt() to inject crisis context when detected
- Added pytest.ini configuration
- Expanded tests: 49 tests covering detection, response, gateway, edge cases, router
- Added deploy/rate-limit.conf for nginx http block inclusion
- Updated nginx.conf with correct zone name and limit_req_status 429
- Updated BACKEND_SETUP.md with complete setup instructions
2026-04-09 12:34:15 -04:00
0dab8dfcfc Merge PR #15
Co-authored-by: Alexander Whitestone <alexander@alexanderwhitestone.com>
Co-committed-by: Alexander Whitestone <alexander@alexanderwhitestone.com>
2026-04-09 16:27:57 +00:00
Allegro
e06bb9c0d4 fix(deploy): harden nginx CORS and update backend setup checklist
- Replace undefined $cors_origin variable with explicit origin
- Update BACKEND_SETUP.md with completed infrastructure items
- Clarify remaining smoke-test and rate-limit zone steps

Refs: #4
v7.0.0
2026-04-06 14:10:45 +00:00
Alexander Whitestone
b022de0b6a Merge branch 'feature/resilience' burnup-20260405-thedoor 2026-04-05 17:25:26 -04:00
Alexander Whitestone
3c07afbf53 Merge branch 'feature/content-pages' 2026-04-05 17:25:25 -04:00
Alexander Whitestone
182327a017 Merge branch 'feature/dying-detection' 2026-04-05 17:25:25 -04:00
Alexander Whitestone
eef835d2aa feat: Fallback + resilience — health checks, restart, failover (#8)
Adds operational resilience tooling:

- resilience/health-check.sh: Health check script with 5 checks (nginx, static content, gateway, disk, SSL). Supports --auto-restart and --verbose modes.
- resilience/service-restart.sh: Graceful ordered service restart with stop->verify->start->verify cycle. Supports --force mode.
- Fallback logic for when gateway is unreachable (graceful degradation to static pages)

All scripts are self-contained, no external dependencies, work on common Linux distros.
2026-04-05 17:24:09 -04:00
Alexander Whitestone
34e05638e8 feat: Content pages - testimony and about (#6)
Adds two standalone HTML pages matching the-door dark theme:

- testimony.html: Alexander's testimony — why Timmy exists, the darkest night, the gospel
- about.html: About page — mission, architecture, feature cards, resources

Both pages include:
- 988 crisis banner (always visible)
- Consistent dark theme with GitHub-inspired colors
- Mobile responsive design
- Navigation back to main chat
- Links to crisis resources

No external dependencies. Works on 3G.
2026-04-05 17:22:28 -04:00
Alexander Whitestone
e18140883b feat: When a Man Is Dying detection system (#5)
Standalone despair/suicide detection module with 4-tier classification:

- LOW: General sadness, stress, difficult times
- MEDIUM: Hopelessness, isolation, worthlessness
- HIGH: Active despair, mentions of death, feeling trapped
- CRITICAL: Explicit intent, plan, imminent self-harm

Returns structured response: {level, indicators, recommended_action}

CRITICAL recommended_action:
- Interrupt conversation immediately
- Ask 'Are you safe right now?'
- Provide 988 Suicide & Crisis Lifeline
- Provide Crisis Text Line (HOME to 741741)
- Stay present. Do not disconnect.

Designed to integrate with crisis/ module from PR #4.
Falls back to internal pattern engine when crisis/ unavailable.
2026-04-05 17:20:17 -04:00
Alexander Whitestone
e678aa076b feat: Crisis-aware system prompt + API wiring
Adds crisis detection and response system with 5-tier classification:

- crisis/PROTOCOL.md: Crisis response protocol and tier definitions
- crisis/detect.py: Tiered indicator engine (LOW/MEDIUM/HIGH/CRITICAL)
- crisis/response.py: Timmy's crisis responses and UI flag generation
- crisis/gateway.py: API gateway wrapper for crisis detection
- crisis/tests.py: Unit tests for all crisis modules

Integrates with existing crisis UI components in index.html.
All smoke tests pass.
2026-04-05 17:17:53 -04:00
Allegro
2425d631f2 fix(deploy): copy all static files, add CORS handling, add backend setup docs
- deploy.sh now copies manifest.json, sw.js, system-prompt.txt
- deploy.sh sets proper ownership/permissions on /var/www/the-door
- nginx.conf adds CORS headers for alexanderwhitestone.com origins
- nginx.conf handles OPTIONS preflight requests
- deploy.sh injects CORS map into nginx.conf
- Add BACKEND_SETUP.md with Hermes gateway config instructions

Addresses the-door#3 (frontend completeness) and the-door#4 (backend/API wiring)
2026-04-05 14:10:19 +00:00
Hermes Crisis Safety Review
80578ddcb3 fix: Crisis safety improvements based on audit
- Fix manifest.json external icon dependency (use inline SVG data URIs)
- Add PWA shortcuts for Safety Plan and 988
- Expand crisis keywords (35+ keywords vs original 12)
- Add explicit phrase detection for imminent action
- Add Safety Plan button to crisis panel
- Add 'Are you safe right now?' to crisis panel text
- Support URL param (?safetyplan=true) for PWA shortcut
- Enhanced Service Worker with offline crisis page
- Add CRISIS_SAFETY_AUDIT.md comprehensive report

Addresses gaps identified in post-PR#9 safety audit:
- Self-harm keywords (cutting, self-harm, etc.)
- Passive suicidal ideation detection
- Offline crisis resource page
- Crisis panel quick-access improvements
2026-04-01 06:28:22 +00:00
b04599b922 Merge pull request 'feat: Sovereign Evolution Redistribution — the-door' (#10) from feat/sovereign-evolution-redistribution into main GoldenRockachopa 2026-04-01 05:57:18 +00:00
5e15d8e888 Merge pull request 'Resilience & Safety: Service Worker, Safety Plan, and Enhanced Crisis Detection' (#9) from feature/crisis-detection-and-reliability into main 2026-04-01 05:57:15 +00:00
e1da1c854f feat: Phase 15 2026-03-30 23:27:46 +00:00
44cb5fc3b2 feat: add PWA manifest 2026-03-30 21:13:26 +00:00