Add the morning routine engine — a daily checklist, not four timers
Backlog item #3 (20-07-2026-BACKLOG.md). A morning routine is a checklist for a daily window: several items, each evidenced by a fact key, completed in any order, checked once near the end of the window. Modelling it as four independent reminder timers would stack into exactly the kind of noise Maven is supposed not to produce, so the engine nags at most once per day per routine and only for what is actually still missing. internal/morning follows the established pure-engine pattern (loop, routine, pattern): no store, no clock of its own. Evaluate answers "what's still missing" at any point; Due decides whether to nag. The impurity — reading facts under the store lock, holding the last-nudge map across ticks — stays in the tick driver, which calls Due each tick exactly as it does for loop.Rule and routine.Routine. Completion evidence is a fact key's latest non-voided value timestamped inside today's window, so manual ("выпил воды", voice-tapped) and inferred (another daemon writing the same key) are indistinguishable and both count. Weekdays scopes which days a routine applies to, so weekday/weekend variants are two routine rows rather than a special case in the engine. Exposed read-only: a MorningStatus RPC over ipc, and a /morning page in mavweb built on the same server-rendered shape as /trace — no live-update loop, since checklist state moves on the scale of minutes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X5JApcrCRVGmqrxnhynSik
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
{{template "shellTop" "morning"}}
|
||||
<h1>Morning Routines</h1>
|
||||
{{if not .}}
|
||||
<div class=hint>no morning routines configured</div>
|
||||
{{else}}
|
||||
{{range .}}
|
||||
<div class="mb-4">
|
||||
<div><strong>{{.Name}}</strong>
|
||||
<span class={{if .Active}}green{{else}}gray{{end}}>{{if .Active}}active now{{else}}outside window{{end}}</span>
|
||||
<span class=hint>{{.WindowStart}}–{{.WindowEnd}}</span>
|
||||
</div>
|
||||
<div class=scroll><table class=mono>
|
||||
<tr><th>item<th>status</tr>
|
||||
{{range .Items}}<tr>
|
||||
<td>{{.Label}}</td>
|
||||
<td class={{if .Done}}green{{else}}red{{end}}>{{if .Done}}done{{else}}missing{{end}}</td>
|
||||
</tr>{{end}}
|
||||
</table></div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{template "shellBottom"}}
|
||||
</html>
|
||||
Reference in New Issue
Block a user