We should keep the state files in $XDG_STATE_HOME location, default $HOME/.local/state, not in the $XDG_STATE_HOME dir.
The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain:
-
actions history (logs, history, recently used files, …)
-
current state of the application that can be reused on a restart (view, layout, open files, undo history, …)
https://specifications.freedesktop.org/basedir-spec/latest/#variables