Kaimon cache path w/ XDG_CACHE_HOME handling inconsistent #42

Closed
opened 2026-05-10 06:40:35 -07:00 by csvance · 3 comments
csvance commented 2026-05-10 06:40:35 -07:00 (Migrated from github.com)

If XDG_CACHE_HOME is set, Kaimon uses it as the cache path as is rather than appending "kaimon" to it:

function kaimon_cache_dir()
    dir = get(ENV, "XDG_CACHE_HOME") do
        if Sys.iswindows()
            joinpath(
                get(ENV, "LOCALAPPDATA", joinpath(homedir(), "AppData", "Local")),
                "Kaimon",
            )
        else
            joinpath(homedir(), ".cache", "kaimon")
        end
    end
    mkpath(dir)
    return dir
end

should be something like this:

function kaimon_cache_dir()
    dir = if haskey(ENV, "XDG_CACHE_HOME")
        joinpath(ENV["XDG_CACHE_HOME"], "kaimon")
    elseif Sys.iswindows()
        joinpath(
            get(ENV, "LOCALAPPDATA", joinpath(homedir(), "AppData", "Local")),
            "Kaimon",
        )
    else
        joinpath(homedir(), ".cache", "kaimon")
    end
    mkpath(dir)
    return dir
end

You can see that Kaimon was just putting things in the base cache dir previously instead of in its own folder:

cvance@medicalmetrics.local@kvmai01 ~
 % ls $XDG_CACHE_HOME
claude		   google-chrome  kaimon.db		server.log     uv
claude-cli-nodejs  gstreamer-1.0  matplotlib		sessions       xfce4
containers	   huggingface	  mesa_shader_cache	sessions.json
dconf		   JetBrains	  mesa_shader_cache_db	sock
fontconfig	   JNA		  remmina		thumbnails
If `XDG_CACHE_HOME` is set, Kaimon uses it as the cache path as is rather than appending "kaimon" to it: ```julia function kaimon_cache_dir() dir = get(ENV, "XDG_CACHE_HOME") do if Sys.iswindows() joinpath( get(ENV, "LOCALAPPDATA", joinpath(homedir(), "AppData", "Local")), "Kaimon", ) else joinpath(homedir(), ".cache", "kaimon") end end mkpath(dir) return dir end ``` should be something like this: ```julia function kaimon_cache_dir() dir = if haskey(ENV, "XDG_CACHE_HOME") joinpath(ENV["XDG_CACHE_HOME"], "kaimon") elseif Sys.iswindows() joinpath( get(ENV, "LOCALAPPDATA", joinpath(homedir(), "AppData", "Local")), "Kaimon", ) else joinpath(homedir(), ".cache", "kaimon") end mkpath(dir) return dir end ``` You can see that Kaimon was just putting things in the base cache dir previously instead of in its own folder: ``` cvance@medicalmetrics.local@kvmai01 ~ % ls $XDG_CACHE_HOME claude google-chrome kaimon.db server.log uv claude-cli-nodejs gstreamer-1.0 matplotlib sessions xfce4 containers huggingface mesa_shader_cache sessions.json dconf JetBrains mesa_shader_cache_db sock fontconfig JNA remmina thumbnails ```
csvance commented 2026-05-10 14:10:48 -07:00 (Migrated from github.com)

There is also a second location used by the Gate which I addressed in the pull request.

There is also a second location used by the Gate which I addressed in the pull request.
kahliburke commented 2026-06-08 23:08:12 -07:00 (Migrated from github.com)

I'll look into this, thank you.

I'll look into this, thank you.
kahliburke commented 2026-06-16 01:00:02 -07:00 (Migrated from github.com)

Fixed for the 2.0.0 release on the 2.0-integration branch (commit 1cf20a5).

kaimon_cache_dir() now appends a kaimon/ subdirectory under XDG_CACHE_HOME instead of using it verbatim, matching kaimon_config_dir()'s handling — so kaimon.db, sock/, sessions.json etc. no longer scatter into the shared cache root. Thanks @csvance for the clear report and proposed fix.

Note: no automatic data migration — existing XDG users will get a fresh $XDG_CACHE_HOME/kaimon/ dir; prior files in the cache root can be moved in or left to regenerate.

Fixed for the **2.0.0** release on the `2.0-integration` branch (commit `1cf20a5`). `kaimon_cache_dir()` now appends a `kaimon/` subdirectory under `XDG_CACHE_HOME` instead of using it verbatim, matching `kaimon_config_dir()`'s handling — so `kaimon.db`, `sock/`, `sessions.json` etc. no longer scatter into the shared cache root. Thanks @csvance for the clear report and proposed fix. Note: no automatic data migration — existing XDG users will get a fresh `$XDG_CACHE_HOME/kaimon/` dir; prior files in the cache root can be moved in or left to regenerate.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kahliburke/Kaimon.jl#42
No description provided.