What it does
Prompts on a schedule, and escalates
- Habits with their own schedules. Each habit has a cron expression in local time, an escalation cadence and a way to prove it was done. The three sensor habits are a rowing session, a strength session and an evening routine.
- Five levels of escalation. An ignored prompt steps up every 30 minutes for the row and strength habits, and on a tighter window of minutes for the evening routine. At the last level the run is recorded as missed.
- The WHY ladder at L3. The third prompt draws on three wells of motivation, chosen by a fixed rule rather than by a model: a pattern in recent misses (three or more of the same reason in 28 days, at most once every 14 days) comes first; then an anomaly in the wearable's data; then a rotation through three named stakes the owner committed to in advance, financial or relational, never the same stake twice in 7 days.
- Priority ordering. The previous day's evening result is settled before the next day's first prompt fires, through a dispatch priority and a guard that defers that prompt by 60 seconds if needed.
Verifies against real data
- The rower. A Concept2 Logbook connection over OAuth pulls the day's sessions and checks distance, duration and type against the window. From L3 on, a photo of the rower's monitor is also accepted.
- Strength. A photo of the training log is uploaded in Discord and read by Claude vision, which requires at least three distinct lifts, each with weight and reps.
- The evening routine, in two stages. The owner types a set phrase before the window closes; the next day the daemon checks the wearable's record against the target the owner set. A gap is recorded with its minutes and followed by a curious question, not a scolding.
- A vision registry. Each kind of photo proof is an entry with its own prompt and thresholds, so adding a new proof is a registry entry, not a code change. Three rejected photos in one run are called out in the next prompt.
- No self-report. If a sensor is down, the daemon retries the wearable every 6 hours for 48 hours and then marks the run as unresolved for lack of data, reported as an infrastructure issue, never as a pass.
Reviews the week and adapts the plan
- Once a week, the review gathers the week's runs, classified miss reasons, skips, unanswered prompts, 30-day patterns and sensor data, and posts four sections: what the week looked like, patterns noticed, stable habits, and proposals.
- Three-reaction proposals. Each proposal is a concrete change (a time, a threshold, a window). Apply updates the habit and records the prior setting so it can be reversed; Reject asks what was wrong; Discuss opens a Discord thread where the daemon asks two or three questions and the thread resolves to applied, rejected, a counter-proposal or deferred.
- Miss classification. Every miss reason is classified, with specifics recorded as
category:entityslugs and a confidence, feeding the pattern well.
A daily alignment check by text message
- A fourth habit asks four fixed alignment questions and escalates hourly by iMessage until they are answered, bounded by a daily cap, a minimum interval and quiet hours, with every text logged so the limits survive a restart.
Chat, web interface and API
- Conversation in Discord. The owner can talk to the daemon, and create, update, archive and restore habits by message.
- A Hono HTTP API for habits, runs, statistics and a recent-activity feed, behind a web interface.
- Five Discord channels: one for each of the three sensor habits, one for wins (a bare log of completions) and one for the weekly review.
A record that cannot be rewritten
- Hash-chained events. Every event is hashed over its canonical form (RFC 8785) joined to the hash of the one before it; database triggers refuse any update or delete; and
verifyChainrecomputes the whole chain. Event types are fixed by a database check: habit flow, proposals, chat and habit changes, and sensor failures. - Durable storage. SQLite in write-ahead-log mode with foreign keys on and periodic checkpoints.
What it achieved
- 773 test cases in 89 test files, 27,625 lines of tests against 16,075 lines of source, with no mocks.
- 314 commits and 11 database migrations.
- Three habits verified by hardware and vision, a fourth checked in by text message, every outcome on a tamper-evident record.
- Reliability guards keep it running unattended (below).
The problem it solves
Most habit apps are built to be gentle: a missed run earns a soft reminder and a fresh start. Self-report makes it worse, because the person most tempted to bend the truth is the one entering the data. habit-daemon takes the owner at their word when they plan the week and enforces that decision days later, when renegotiating would be easier. It separates the moment of weakness from the moment of consequence, checks the rower, the wearable and the camera instead of asking, and keeps a record nobody can quietly edit.
How he built it
- A design document first.
ARCHITECTURE.mdfixes the data model, the escalation cadences, the L3 selection rule, the proof types, the review format and the reliability rules. - Deterministic where it matters. Escalation timing, the WHY-ladder choice and proof thresholds are plain code; models write prompts and read photos.
- Tests without mocks. The 773 test cases run against real SQLite and real modules, table-driven where possible, behind one
pnpm gatethat type-checks, builds and runs everything. - Strict TypeScript and validated output. Every model dispatch must end in a typed footer validated by a Zod schema before the run is recorded.
- Reliability guards. A persistent circuit breaker stops dispatching when check-ins fail across the board. A global AI-dependency state pauses all dispatch once on an account-wide failure, alerts the owner in plain language without calling Claude, and probes for recovery with one controlled request. A heartbeat file and a kill switch round out the safety set.
- Sensor adapters behind contracts. The wearable adapter is a Python shim with a four-value exit-code contract; the Concept2 adapter refreshes its own tokens.
- Maxwell built it by directing AI agents, on Node, TypeScript, discord.js 14, the Claude Agent SDK, Hono and SQLite.