Add mailmind replay and the wake rule it reports on #38

Merged
svc-agent-writer merged 1 commit from feat/replay into main 2026-10-31 12:21:15 +00:00

Closes #21. Stacked on #37: merge #37 first. Until then, this diff also shows #37's commit.

Changes

  • An optional [wake] section with three keys:

    • threshold (0..1, default 0.65, so a "within hours" score of 0.667 wakes)
    • per_thread_per_day (default 1)
    • per_day (default 10)

    When the section is absent, no wake is raised. #22 enforces that.

  • would_wake(rule, score, thread_today, total_today) in assess.py: the rule in code. Jev's score is one input, and the caps hold whatever it says. #22 reuses it.

  • Store.assessments(since) returns only the received time, the thread key, the class and the score. A moved copy counts once (grouped by Message-ID).

  • mailmind replay [--days N] [--threshold X] [--per-thread-per-day N] [--per-day N]:

    • It opens the store read-only.
    • Per UTC day received, it prints the assessed count, the count per class, and the wakes the rule would raise.
    • It then prints totals and a score histogram in quarter buckets.
    • The flags try another rule without a config change. An out-of-range value is refused.
    • When [wake] is not set, it says so.
  • Docs: README CLI and config rows, and [wake] in config.example.toml.

Sample output

replay days=2 from=2026-10-30 to=2026-10-31 (UTC, by day received)
rule threshold=0.65 per_thread_per_day=1 per_day=2
day | assessed | needs-reply | actionable | fyi | newsletter | transactional | noise | wake
2026-10-30 | 4 | 3 | 1 | 0 | 0 | 0 | 0 | 2
2026-10-31 | 2 | 0 | 0 | 1 | 1 | 0 | 0 | 0
total | 6 | 3 | 1 | 1 | 1 | 0 | 0 | 2
score | messages
0.00-0.25 | 1
...

Tests

tests/test_replay.py:

  • the rule's threshold and both caps
  • the report over fixture rows, with the caps applied
  • the UTC day boundary
  • the CLI against a store: a moved copy counts once, no subject or address in the output, and an out-of-range threshold refused

make check passes (105 tests).

🤖 Generated with Claude Code

Closes #21. Stacked on #37: merge #37 first. Until then, this diff also shows #37's commit. ## Changes - An optional `[wake]` section with three keys: - `threshold` (0..1, default 0.65, so a "within hours" score of 0.667 wakes) - `per_thread_per_day` (default 1) - `per_day` (default 10) When the section is absent, no wake is raised. #22 enforces that. - `would_wake(rule, score, thread_today, total_today)` in `assess.py`: the rule in code. Jev's score is one input, and the caps hold whatever it says. #22 reuses it. - `Store.assessments(since)` returns only the received time, the thread key, the class and the score. A moved copy counts once (grouped by Message-ID). - `mailmind replay [--days N] [--threshold X] [--per-thread-per-day N] [--per-day N]`: - It opens the store read-only. - Per UTC day received, it prints the assessed count, the count per class, and the wakes the rule would raise. - It then prints totals and a score histogram in quarter buckets. - The flags try another rule without a config change. An out-of-range value is refused. - When `[wake]` is not set, it says so. - Docs: README CLI and config rows, and `[wake]` in `config.example.toml`. ## Sample output ``` replay days=2 from=2026-10-30 to=2026-10-31 (UTC, by day received) rule threshold=0.65 per_thread_per_day=1 per_day=2 day | assessed | needs-reply | actionable | fyi | newsletter | transactional | noise | wake 2026-10-30 | 4 | 3 | 1 | 0 | 0 | 0 | 0 | 2 2026-10-31 | 2 | 0 | 0 | 1 | 1 | 0 | 0 | 0 total | 6 | 3 | 1 | 1 | 1 | 0 | 0 | 2 score | messages 0.00-0.25 | 1 ... ``` ## Tests `tests/test_replay.py`: - the rule's threshold and both caps - the report over fixture rows, with the caps applied - the UTC day boundary - the CLI against a store: a moved copy counts once, no subject or address in the output, and an out-of-range threshold refused `make check` passes (105 tests). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
mail_search gains a triage filter, search and thread rows end with the class once triage has run, and mail_read shows the class and wake score. Untriaged rows keep the 0.2 shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An optional [wake] section holds the threshold and the per-thread and per-day caps. would_wake is the rule in code; mailmind replay prints, per UTC day received, the count per class and the wakes the rule would raise, plus a score histogram. It prints counts only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.