Files
yulunz c54a49383a feat(telemetry): persist date of the last tool call. (#2705)
The state file is now loaded into memory and stored within
ClearcutLogger. At each tool call it checks whether it's been more than
one day since the recorded value in the state file, and if so, log the
last tool active, and update the state file.

Regarding the state file's format, lastToolCall is not exactly the very
last one, but rather the last one that was **logged**. This is the same
with the existing lastActive timestamp (i.e. it's not the last timestamp
when the server is active, but rather the last timestamp when the active
status is logged). So here we keep the definitions consistent.

A caveat for future improvement: arguably the loadState() and
writeState() and everything in between should be a atomic unit (there
might be multiple mcp servers running), but I think it's probably good
enough for now. If we see weirdness we can make that happen.

I also added format guards to loadState() so we don't have to try and
catch everywhere else when de-serializing the string. We should actually
just deserialize in loadState() but let me do this in a follow-up CL.
2026-09-09 14:54:26 +00:00
..