Hello Amos and thank you for your answer.
The ~/.config/itch/downloads was not inside the default install location, which is ~/.config/itch/apps and it was not just json files, but several gigabytes of zip files containing complete games and it did not clear when I cleared my downloads list.
You are correct, that /tmp might be on a small partition, but so might the home directory. In my case, system and home is on a small-ish SSD, while data and games go to a large HDD, and my SSD ran out of space, which was why I started investigating this.
The problem becomes particularly bad because itch is installing games to ~/.config by default, which, as the name suggests, is intended for small configuration files and on many systems is being kept in a version control system for safe storage and the ability to roll back to a previous state. I now have many gigabytes of download cache inside my version control system :(
A more suitable location for per-user data files is ~/.local/share/<appname>. To quote the specs:
$XDG_DATA_HOME
defines the base directory relative to which user specific data files should be stored. If$XDG_DATA_HOME
is either not set or empty, a default equal to$HOME
/.local/share should be used.
$XDG_CONFIG_HOME
defines the base directory relative to which user specific configuration files should be stored. If$XDG_CONFIG_HOME
is either not set or empty, a default equal to$HOME
/.config should be used.
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
I just did a wipe of the itch config folder and let itch recreate it, then added another install dir and installed a new game and everything worked as it should.
The downloads dir gets created inside the install location and the dir is automatically emptied after installation.
So in conclusion, the ~/.config/itch/downloads seems to be a remnant of a previous version of itch, that just never got cleaned up. Users should not have this issue on fresh installs.
My only remaining issue is the choice of default install location. I can work around that with adding another install location or, as I had already done, by symlinking to my usual games install location, but for new users, this could easily become a cause of confusion or frustration, when an application is installing large binaries to a configuration dir.