Expand description
Per-project “last session start” watermark.
Stored at ~/.difflore/projects/{hash}/last-session-start.json as a
one-shot JSON blob { "ts_ms": …, "client": "…" }. Owning this file
is a single-purpose responsibility — no other code reads or writes
it — so the format can change freely as long as the read path stays
permissive about missing/malformed input (silent fallback to None,
never panics).
Concurrent SessionStart fires from two agent windows in the same repo
could race the write here. That’s fine: whichever fires last wins,
and the only consequence is one of the two banners may show a
slightly older prev_ts. We deliberately do NOT take a lock — the
whole helper is on the hot path and a contended file lock would
defeat the 50 ms budget.
Structs§
- Watermark
- One row in the watermark file.
clientis purely diagnostic — the banner pipeline doesn’t branch on it today, but storing it lets a future audit answer “which agent last opened this repo?” without crawling the fire log.
Functions§
- read_
watermark - Read the watermark for the given project hash. Returns
Nonewhen: - write_
watermark - Write the watermark for the given project hash. Best-effort:
caller can ignore the
Resultvialet _ = …. Creates the parent dir on demand — first-ever SessionStart in a repo finds~/.difflore/projects/{hash}/missing.