diff --git a/docs/decisions.md b/docs/decisions.md index 7de98fa..f0d98a1 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -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.