{"slug": "stanch-dead-man-s-switch-that-stops-the-bleeding-when-no-one-answers", "title": "Stanch – Dead man's switch that stops the bleeding when no one answers", "summary": "Stanch, a dead-man's switch for automated services, launches v0.2 with autonomous stop-playbook execution when alerts go unacknowledged. The tool enforces fail-stop semantics by running pre-approved containment actions like disabling feature flags or pausing lanes, designed to prevent further damage without human intervention. Stanch targets AI-operated workflows and agent-based systems where monitoring alone cannot guarantee a response.", "body_md": "The dead-man's switch that acts.Stanch stops the bleeding when no one answers.\n\n*v0.1 shipped detection, invariants and alerting; v0.2 adds the \"acts\": first-class acknowledgment and autonomous stop-playbook execution on missed ACK. See Status.*\n\nServices increasingly run themselves — agents, automations, pipelines, AI-operated workflows. When one of them goes wrong at 3 a.m., your monitoring stack *tells* you. Nothing *guarantees* the bleeding stops if you don't answer.\n\n*To stanch* is to stop a flow — of blood, of loss. That is the entire product. Alerting assumes a human wakes up; **Stanch assumes the human might not** — and holds a small set of pre-approved emergency actions that can only ever make the system *safer*: turn a flag off, pause a lane, go read-only, quarantine, restart once. If a critical alert is not acknowledged in time, Stanch executes the most conservative pre-approved action. That's it. It cannot \"fix\" anything — by design.\n\nThe model comes from **fail-stop semantics** in distributed systems: on failure, stop rather than act incorrectly.\n\nEverything below is exercised by the test suite (226 tests) and the demo compose.\n\n**External dead-man heartbeat.** Your services check in (`POST /api/v1/heartbeat`\n\n, scoped tokens, fail-closed); Stanch runs*outside*them, so it notices when they can't speak for themselves.**Business-invariant watchers.** Not just \"is the process up\" — versioned YAML rules over heartbeat metadata (`staleness`\n\n,`meta_threshold`\n\n), shadow-capable, for invariants like*payouts per hour must not exceed X*or*no completed orders for N minutes during business hours*.**Pluggable alert channels.** Telegram and WhatsApp (direct Meta Graph API, template mode for business-initiated alerts outside the 24h window) behind a single channel interface.**Anti-fatigue pipeline.** Dedupe by fingerprint, per-rule cooldowns, auto-resolve on recovery, optional per-severity re-notification of open alerts.**Stop-only playbooks, declared as code.** Containment actions are a closed set, pre-approved in code, reviewed via git, and restricted to STOP semantics by construction: disable a feature flag, pause a lane, switch read-only, quarantine an entity, one restart. Stanch can never start, transfer, delete, or touch DNS — enforced by type and by negative test.**Playbook execution engine.** A shadow-first runtime for the stop set: pluggable executors (webhook family included — one operator-controlled URL per action kind),`action_log`\n\nwritten*before*and*after*every real execution, and shadow mode that logs what*would*have run without touching anything.**Missed-ACK autonomy.** A P0 with no human acknowledgment within the configured window ⇒ the most conservative pre-approved action of its rule runs, automatically. One autonomy decision per alert (re-armed only after resolve), enforcement opt-in*per rule*— everything else stays shadow.**Acknowledgment tracking.** First-class ACK on alerts — an authenticated endpoint (idempotent, coherent 404/409) plus`/ack`\n\ncommands and replies straight from the Telegram ops chat; WhatsApp acks via the endpoint (its template contract has no buttons — documented).**Append-only audit trail.** Every observation, alert, and recorded action is appended to`action_log`\n\n; nothing is rewritten.**Self-monitoring.** Watch-the-watcher pings to a healthchecks.io-compatible URL, plus a daily health summary.\n\n**The hand only knows how to stop.** Every automated action reduces exposure; none can create new risk.**Deterministic action path.** No model, no heuristic, no \"probably\" between detection and containment.**Human primacy.** Playbooks are approved by humans in advance, as code, via git. The dashboard can acknowledge and silence — it can never edit rules.**Shadow-first adoption.** Run observe-only until you trust it; enforcement is opt-in per rule.**Fail-stop over fail-operational.** When in doubt, stop the smallest thing that stanches the loss.\n\nPrerequisites: Docker with the Compose v2 plugin (`docker compose`\n\n, not `docker-compose`\n\n), `make`\n\n, and `curl`\n\n. No `.env`\n\nneeded — the demo ships with safe defaults.\n\n```\ngit clone https://github.com/getstanch/stanch\ncd stanch\ndocker compose up --build\n```\n\nThis boots Stanch plus a small demo service that heartbeats every 10 s and exposes its own control endpoint. It runs in the foreground — open a second terminal for the next commands (or add `-d`\n\n). **Wait until the demo service has checked in once** (~15 s after boot; `make demo-status`\n\nshows `heartbeats_delivered`\n\n≥ 1). Don't worry about racing it: `make demo-incident`\n\nrefuses to run before that first check-in, so you can't silently break the demo. Then trigger the whole loop:\n\n```\nmake demo-incident   # stops the demo service's heartbeat — nothing else\nmake demo-status     # watch: P0 alert (~30 s) → no ACK (60 s) → lane paused → audit trail\n```\n\nMissed heartbeat → P0 alert → no acknowledgment within the window → Stanch POSTs the pre-approved `pause`\n\naction to the demo service's control endpoint → the lane shows `paused`\n\nand the dossier carries the full `action_started`\n\n/`action_finished`\n\ntrail. To watch a human win the race instead, run `make demo-ack`\n\nbefore the window closes — it grabs the open alert's id, acks it, and the hand stands down. Example configuration lives in `examples/`\n\n, fully commented.\n\nEarly — `v0.1.0`\n\n, APIs unstable. Stanch was designed by a founder-engineer to guard a real five-city transportation platform (~400,000 rides/month); the staged, shadow-first rollout on that operation is in progress, and this README will state plainly what has and hasn't run in production as that progresses. No inflated claims: what you read here is what is true today. v0.1 shipped detection, invariants, alerting and the audit trail; v0.2 (unreleased, on `main`\n\n) adds the acknowledgment flow, the playbook execution engine and missed-ACK autonomy — every capability listed above is proven by the test suite before it is listed.\n\nStanch is **not** a metrics platform (bring Prometheus/Grafana), **not** an incident manager (bring PagerDuty/Opsgenie if you like — Stanch coexists), and **not** an auto-healer. It deliberately cannot repair, scale, roll back, or \"try something.\" It stops things. That constraint is the product.\n\n- Hardened playbook executors for common stacks (feature-flag providers, queue pauses, DB read-only)\n- More alert channels; acknowledgment via inline replies\n- Invariant-rule library with real-world examples\n- Post-incident report generation (read-only analyst)\n\nIssues and PRs welcome — especially real-world invariant rules and containment executors. See `CONTRIBUTING.md`\n\n. Security reports: see `SECURITY.md`\n\n(please do not open public issues for vulnerabilities).\n\nApache-2.0. © Marcos Rodrigues Gomes Junior.", "url": "https://wpnews.pro/news/stanch-dead-man-s-switch-that-stops-the-bleeding-when-no-one-answers", "canonical_source": "https://github.com/getstanch/stanch", "published_at": "2026-07-15 15:11:19+00:00", "updated_at": "2026-07-15 15:28:16.544943+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "ai-infrastructure", "developer-tools"], "entities": ["Stanch", "Telegram", "WhatsApp", "Meta"], "alternates": {"html": "https://wpnews.pro/news/stanch-dead-man-s-switch-that-stops-the-bleeding-when-no-one-answers", "markdown": "https://wpnews.pro/news/stanch-dead-man-s-switch-that-stops-the-bleeding-when-no-one-answers.md", "text": "https://wpnews.pro/news/stanch-dead-man-s-switch-that-stops-the-bleeding-when-no-one-answers.txt", "jsonld": "https://wpnews.pro/news/stanch-dead-man-s-switch-that-stops-the-bleeding-when-no-one-answers.jsonld"}}