Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.simplefunctions.dev/llms.txt

Use this file to discover all available pages before exploring further.

The heartbeat is SF’s self-monitoring loop. It runs as a separate Cloudflare Worker (sf-heartbeat) every 4h and emits a digest covering:
  • Cron health (which scheduled jobs ran, which missed, which failed).
  • Portfolio state per user (balance, exposure, drawdown, last reconcile).
  • Mirror health (congress + fred sync staleness).
  • Active trade ideas count and freshness.
  • Vault backup recency.

Channels

The digest can route to:
  • Email via Resend (heartbeat sends from ops@simplefunctions.dev).
  • AgentMail loop for AI replies — the digest is sent as a thread the user can reply to, and replies go to an LLM that has read access to SF state.
  • CLI via sf heartbeat <id>.
  • Per-thesis heartbeat — every thesis has its own heartbeat config that triggers monitor cycles.

Configuration

sf heartbeat <thesis-id>                  # show current config for one thesis
configure_heartbeat(...)                   # MCP tool, mutates config
Per-thesis settings:
  • cadence_hours — base monitor cadence
  • dormant_cadence_hours — fallback cadence when no signals
  • low_confidence_since_at — sustained-low-confidence detection
  • kill_conditions — structured triggers that pause the thesis

Source

  • sf-heartbeat (sibling Cloudflare Worker repo).
  • src/app/api/cron/health-digest/route.ts — reads from the same data source.
  • src/lib/thesis/agents/monitor.ts — per-thesis heartbeat loop.

Operator surface

The PatClaw heartbeat is delivered via email twice daily and exposes:
  • ⚠ count of items needing attention.
  • Subject line summary.
  • Reply-to AgentMail inbox for AI back-and-forth.

Next steps

Provenance

How heartbeat reads cron_run_log.

Portfolio autopilot

Drawdown halts emit health alerts.