docs: record the store's single writer and app activation

Both the app and the CLI can refresh, so D5 now names one writer at a
time behind a lock file and gives the data directory an override for
tests. D8 says how a second start reaches the running instance without
a socket, which D9 rules out.

Refs #1
This commit is contained in:
Florian Schmidt
2026-10-14 18:35:27 +02:00
parent d3091cff16
commit 1bf378e4aa
+7 -2
View File
@@ -90,7 +90,10 @@ JSON or JSON lines through System.Text.Json source generation, written atomicall
file in the same directory, then a replace. There is no database dependency. Scanning is
incremental: for each source file the store remembers how far it read and reads only appended
bytes. A file that shrank or was replaced is read again from the start. A response counts once
across restarts, rescans and resumed sessions.
across restarts, rescans and resumed sessions. One process writes the store at a time, guarded
by an exclusive lock file in the data directory. While another process holds it, the CLI only
reads the current `snapshot.json` and says so. `FINALTOKEN_DATA_DIR` overrides the data
directory, for tests and parallel checks.
**Why.** R4 needs history longer than the CLIs keep theirs ([D3](#d3--claude-data-sources)). A
file store has no native dependency to ship with NativeAOT.
@@ -139,7 +142,9 @@ by hand.
when the app is built), with the Fluent theme, compiled bindings only and CommunityToolkit.Mvvm
source generators. Charts are small custom controls drawn with Avalonia's `DrawingContext`;
there is no chart library.
- **Lifecycle.** One instance per user; starting it again brings the running one to the front.
- **Lifecycle.** One instance per user, guarded by the store's lock file
([D5](#d5--own-history-store)). Starting it again writes an activation request file to the data
directory and exits; the running instance watches for it and brings its window to the front.
The tray icon offers Open, Refresh now, Settings and Quit. Closing the window keeps the app
running in the tray. Starting the app opens the stats panel (R4). Start with the OS is an
opt-in setting.