Skip to content

dictation_history

diapason.desktop.dictation_history

A local, bounded history of dictations.

Two things make this worth having: you can recover a sentence the paste lost (wrong window focused, app ate it), and you can see what the recogniser actually heard — which is how you find out that "small" fixes the proper nouns "base" was mangling.

Design constraints that follow from the privacy contract:

  • Local only. A JSONL file under the Diapason config dir. Nothing here is ever sent anywhere; the outbound ratchet has no reason to see this module.
  • Opt-out and bounded. Off by default is wrong (an invisible history is the point of a history), but unbounded growth is a liability: a dictation tool used all day would accumulate every sentence you ever spoke. It keeps the last N entries, N being small enough to stay a convenience rather than an archive.
  • Content lives here, so nowhere else. Entries hold the transcript in clear — that IS the feature — which is precisely why the log must not. redact stays the rule for logging; this file is the one sanctioned place the text is written down.

DictationEntry dataclass

One completed dictation.

append_entry(entry, *, path=None, max_entries=DEFAULT_MAX_ENTRIES)

Append one entry, trimming the file to max_entries.

Never raises: losing a history line must not break a dictation that otherwise succeeded.

clear_history(path=None)

Delete the history file. Returns True if one existed.

load_history(path=None, *, limit=None)

Return entries, newest first. A corrupt line is skipped, not fatal.

stats(entries)

Aggregate a few honest numbers for a dashboard.

Words-per-minute is deliberately absent: it would need a speaking-time denominator this data cannot support, and a made-up productivity figure is worse than none.