From 77e71d09f22cda56af4785c8c189123e528abe9e Mon Sep 17 00:00:00 2001 From: max0n232 Date: Sat, 11 Apr 2026 00:20:07 +0300 Subject: [PATCH] fix: add USERPROFILE fallback for Windows HOME resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows, `HOME` is not a standard environment variable — the equivalent is `USERPROFILE`. When MCP clients (e.g. Claude Code) spawn the QMD server as a subprocess, they pass `USERPROFILE` but not `HOME`. This causes QMD to fall back to `/tmp`, opening an empty database instead of the user's actual index. Fix: check `USERPROFILE` before falling back to `/tmp`. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/store.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store.ts b/src/store.ts index ab4cbf4..56e02e5 100644 --- a/src/store.ts +++ b/src/store.ts @@ -38,7 +38,7 @@ import type { // Configuration // ============================================================================= -const HOME = process.env.HOME || "/tmp"; +const HOME = process.env.HOME || process.env.USERPROFILE || "/tmp"; export const DEFAULT_EMBED_MODEL = "embeddinggemma"; export const DEFAULT_RERANK_MODEL = "ExpedientFalcon/qwen3-reranker:0.6b-q8_0"; export const DEFAULT_QUERY_MODEL = "Qwen/Qwen3-1.7B";