diff --git a/README.md b/README.md index 4671ef1..811a7ee 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ memoryd --http 8795 # Streamable HTTP, so every host uses the same store ## Storage -One JSON file per memory under `$MEMORYDIR` (default `~/.hermes/memories`): +One JSON file per memory under `$MEMORYDIR` (default `$XDG_DATA_HOME/memoryd`, else `~/.local/share/memoryd`): ```json { diff --git a/memoryd.c b/memoryd.c index f1da9de..ca89ebe 100644 --- a/memoryd.c +++ b/memoryd.c @@ -94,7 +94,14 @@ static char *mem_root(void) home = getenv("HOME"); if (home == NULL) home = "/tmp"; - mcp_buf_printf(&b, "%s/.hermes/memories", home); + { + const char *xdg = getenv("XDG_DATA_HOME"); + + if (xdg != NULL && *xdg != '\0') + mcp_buf_printf(&b, "%s/memoryd", xdg); + else + mcp_buf_printf(&b, "%s/.local/share/memoryd", home); + } return b.p; }