core: write only new history and share files on Windows

The store rewrote all of history.json, 19 MB here, on every 60 s
refresh. It now appends each refresh's changes to a journal and compacts
into monthly files and a state checkpoint at 8 MiB, so an idle refresh
writes only snapshot.json. Bucket updates are keyed, unchanged limit
samples are kept at most hourly, Codex replays are bounded by session
totals, and Claude dedupe keys expire after 60 days.

Readers of atomically replaced files allow delete sharing, and the
replace retries briefly, so the Stream Deck plugin reading snapshot.json
cannot make a refresh fail. Claude's <synthetic> entries are skipped,
and repeated diagnostics fold into one entry with a count.

Refs #1
This commit is contained in:
Florian Schmidt
2026-10-14 19:59:58 +02:00
parent 14223b05df
commit c2f97e9384
15 changed files with 849 additions and 71 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ public sealed class RefreshEngine : IAsyncDisposable
clock = timeProvider ?? TimeProvider.System;
Diagnostics = new(clock);
settings = SettingsFile.Load(directory, Diagnostics);
History = new(directory, Diagnostics);
History = new(directory, Diagnostics, clock);
ClaudeDirectory = claudeDirectory ?? DataPaths.ClaudeDirectory;
CodexDirectory = codexDirectory ?? DataPaths.CodexDirectory;
scanner = new(History, Diagnostics, ClaudeDirectory, CodexDirectory);