Skip to main content

Module write_budget

Module write_budget 

Source
Expand description

Write-budget telemetry — the system learning its own cost.

The irony tax: WhiteMagic gives agents durable continuity while shortening the life of the SSD that holds the store. This module makes the cost visible: it tracks how many bytes the store grew per day (LMDB high-water mark + Tantivy index size), keeps a 90-day daily ledger at <store-root>/write_budget.json, and answers the operational question “did the store write more than usual today?” — the Harmony Vector’s frugality dimension.

Measurement model (honest approximations, stated plainly):

  • LMDB: data.mdb file size is a high-water mark — it grows in increments and never shrinks without compaction, so deltas measure growth, and free-after-delete space is not credited. This is the right bias for SSD-wear accounting (over-count writes, never under).
  • Tantivy: directory size on disk, walked at most once per 5 minutes and cached between walks (a segment-merging index changes size in steps; per-request walks would cost more I/O than they measure).
  • Backups and dream-cycle compactions are attributed to the day they grew the files, same as any write.

Structs§

DayWrites
Per-day write totals attributed to one UTC date.
WriteBudgetDelta
One observation’s outcome: how many bytes were attributed, and to when.
WriteBudgetLedger
Daily write-budget ledger for one store.
WriteBudgetReport
The operational summary wm doctor and /status render.