fix(qmd): use XDG dirs for qmd home; drop ollama docs

This commit is contained in:
Vignesh Natarajan
2026-01-27 23:42:52 -08:00
committed by vignesh07
parent 5679b4a8a8
commit bdf692ae54
2 changed files with 15 additions and 18 deletions

View File

@@ -130,14 +130,14 @@ out to QMD for retrieval. Key points:
- Install the QMD CLI separately (`bun install -g github.com/tobi/qmd` or grab
a release) and make sure the `qmd` binary is on the gateways `PATH`.
- QMD needs an SQLite build that allows extensions (`brew install sqlite` on
macOS). The gateway sets `INDEX_PATH`/`QMD_CONFIG_DIR` automatically.
- QMD shells out to its CLI, which depends on an Ollama daemon listening on
`http://localhost:11434` to load the bundled models (`embeddinggemma`,
`ExpedientFalcon/qwen3-reranker:0.6b-q8_0`, `qwen3:0.6b`). Install/run Ollama
separately before enabling the backend.
- OS support: macOS and Linux work out of the box once Bun + SQLite + Ollama are
installed. Windows requires WSL2 (or building the experimental Ollama port)
until Ollama ships native binaries.
macOS).
- QMD runs fully locally via Bun + `node-llama-cpp` and auto-downloads GGUF
models from HuggingFace on first use (no separate Ollama daemon required).
- The gateway runs QMD in a self-contained XDG home under
`~/.clawdbot/agents/<agentId>/qmd/` by setting `XDG_CONFIG_HOME` and
`XDG_CACHE_HOME`.
- OS support: macOS and Linux work out of the box once Bun + SQLite are
installed. Windows is best supported via WSL2.
**How the sidecar runs**
- The gateway writes a self-contained QMD home under

View File

@@ -70,8 +70,6 @@ export class QmdMemoryManager implements MemorySearchManager {
private readonly stateDir: string;
private readonly agentStateDir: string;
private readonly qmdDir: string;
private readonly cacheDir: string;
private readonly configDir: string;
private readonly xdgConfigHome: string;
private readonly xdgCacheHome: string;
private readonly collectionsFile: string;
@@ -102,18 +100,17 @@ export class QmdMemoryManager implements MemorySearchManager {
this.stateDir = resolveStateDir(process.env, os.homedir);
this.agentStateDir = path.join(this.stateDir, "agents", this.agentId);
this.qmdDir = path.join(this.agentStateDir, "qmd");
this.cacheDir = path.join(this.qmdDir, "cache");
this.configDir = path.join(this.qmdDir, "config");
// QMD respects XDG base dirs:
// - config: $XDG_CONFIG_HOME/qmd/index.yml
// - cache: $XDG_CACHE_HOME/qmd/index.sqlite
this.xdgConfigHome = path.join(this.qmdDir, "xdg-config");
this.xdgCacheHome = path.join(this.qmdDir, "xdg-cache");
this.collectionsFile = path.join(this.configDir, "index.yml");
this.indexPath = path.join(this.cacheDir, "index.sqlite");
this.collectionsFile = path.join(this.xdgConfigHome, "qmd", "index.yml");
this.indexPath = path.join(this.xdgCacheHome, "qmd", "index.sqlite");
this.env = {
...process.env,
QMD_CONFIG_DIR: this.configDir,
XDG_CONFIG_HOME: this.xdgConfigHome,
XDG_CACHE_HOME: this.xdgCacheHome,
INDEX_PATH: this.indexPath,
NO_COLOR: "1",
};
this.sessionExporter = this.qmd.sessions.enabled
@@ -139,10 +136,10 @@ export class QmdMemoryManager implements MemorySearchManager {
}
private async initialize(): Promise<void> {
await fs.mkdir(this.cacheDir, { recursive: true });
await fs.mkdir(this.configDir, { recursive: true });
await fs.mkdir(this.xdgConfigHome, { recursive: true });
await fs.mkdir(this.xdgCacheHome, { recursive: true });
await fs.mkdir(path.dirname(this.collectionsFile), { recursive: true });
await fs.mkdir(path.dirname(this.indexPath), { recursive: true });
this.bootstrapCollections();
await this.writeCollectionsConfig();