mirror of
https://github.com/clawdbot/clawdbot.git
synced 2026-01-31 19:37:45 +01:00
fix(qmd): use XDG dirs for qmd home; drop ollama docs
This commit is contained in:
committed by
vignesh07
parent
5679b4a8a8
commit
bdf692ae54
@@ -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
|
- 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 gateway’s `PATH`.
|
a release) and make sure the `qmd` binary is on the gateway’s `PATH`.
|
||||||
- QMD needs an SQLite build that allows extensions (`brew install sqlite` on
|
- QMD needs an SQLite build that allows extensions (`brew install sqlite` on
|
||||||
macOS). The gateway sets `INDEX_PATH`/`QMD_CONFIG_DIR` automatically.
|
macOS).
|
||||||
- QMD shells out to its CLI, which depends on an Ollama daemon listening on
|
- QMD runs fully locally via Bun + `node-llama-cpp` and auto-downloads GGUF
|
||||||
`http://localhost:11434` to load the bundled models (`embeddinggemma`,
|
models from HuggingFace on first use (no separate Ollama daemon required).
|
||||||
`ExpedientFalcon/qwen3-reranker:0.6b-q8_0`, `qwen3:0.6b`). Install/run Ollama
|
- The gateway runs QMD in a self-contained XDG home under
|
||||||
separately before enabling the backend.
|
`~/.clawdbot/agents/<agentId>/qmd/` by setting `XDG_CONFIG_HOME` and
|
||||||
- OS support: macOS and Linux work out of the box once Bun + SQLite + Ollama are
|
`XDG_CACHE_HOME`.
|
||||||
installed. Windows requires WSL2 (or building the experimental Ollama port)
|
- OS support: macOS and Linux work out of the box once Bun + SQLite are
|
||||||
until Ollama ships native binaries.
|
installed. Windows is best supported via WSL2.
|
||||||
|
|
||||||
**How the sidecar runs**
|
**How the sidecar runs**
|
||||||
- The gateway writes a self-contained QMD home under
|
- The gateway writes a self-contained QMD home under
|
||||||
|
|||||||
@@ -70,8 +70,6 @@ export class QmdMemoryManager implements MemorySearchManager {
|
|||||||
private readonly stateDir: string;
|
private readonly stateDir: string;
|
||||||
private readonly agentStateDir: string;
|
private readonly agentStateDir: string;
|
||||||
private readonly qmdDir: string;
|
private readonly qmdDir: string;
|
||||||
private readonly cacheDir: string;
|
|
||||||
private readonly configDir: string;
|
|
||||||
private readonly xdgConfigHome: string;
|
private readonly xdgConfigHome: string;
|
||||||
private readonly xdgCacheHome: string;
|
private readonly xdgCacheHome: string;
|
||||||
private readonly collectionsFile: string;
|
private readonly collectionsFile: string;
|
||||||
@@ -102,18 +100,17 @@ export class QmdMemoryManager implements MemorySearchManager {
|
|||||||
this.stateDir = resolveStateDir(process.env, os.homedir);
|
this.stateDir = resolveStateDir(process.env, os.homedir);
|
||||||
this.agentStateDir = path.join(this.stateDir, "agents", this.agentId);
|
this.agentStateDir = path.join(this.stateDir, "agents", this.agentId);
|
||||||
this.qmdDir = path.join(this.agentStateDir, "qmd");
|
this.qmdDir = path.join(this.agentStateDir, "qmd");
|
||||||
this.cacheDir = path.join(this.qmdDir, "cache");
|
// QMD respects XDG base dirs:
|
||||||
this.configDir = path.join(this.qmdDir, "config");
|
// - config: $XDG_CONFIG_HOME/qmd/index.yml
|
||||||
|
// - cache: $XDG_CACHE_HOME/qmd/index.sqlite
|
||||||
this.xdgConfigHome = path.join(this.qmdDir, "xdg-config");
|
this.xdgConfigHome = path.join(this.qmdDir, "xdg-config");
|
||||||
this.xdgCacheHome = path.join(this.qmdDir, "xdg-cache");
|
this.xdgCacheHome = path.join(this.qmdDir, "xdg-cache");
|
||||||
this.collectionsFile = path.join(this.configDir, "index.yml");
|
this.collectionsFile = path.join(this.xdgConfigHome, "qmd", "index.yml");
|
||||||
this.indexPath = path.join(this.cacheDir, "index.sqlite");
|
this.indexPath = path.join(this.xdgCacheHome, "qmd", "index.sqlite");
|
||||||
this.env = {
|
this.env = {
|
||||||
...process.env,
|
...process.env,
|
||||||
QMD_CONFIG_DIR: this.configDir,
|
|
||||||
XDG_CONFIG_HOME: this.xdgConfigHome,
|
XDG_CONFIG_HOME: this.xdgConfigHome,
|
||||||
XDG_CACHE_HOME: this.xdgCacheHome,
|
XDG_CACHE_HOME: this.xdgCacheHome,
|
||||||
INDEX_PATH: this.indexPath,
|
|
||||||
NO_COLOR: "1",
|
NO_COLOR: "1",
|
||||||
};
|
};
|
||||||
this.sessionExporter = this.qmd.sessions.enabled
|
this.sessionExporter = this.qmd.sessions.enabled
|
||||||
@@ -139,10 +136,10 @@ export class QmdMemoryManager implements MemorySearchManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async initialize(): Promise<void> {
|
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.xdgConfigHome, { recursive: true });
|
||||||
await fs.mkdir(this.xdgCacheHome, { 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();
|
this.bootstrapCollections();
|
||||||
await this.writeCollectionsConfig();
|
await this.writeCollectionsConfig();
|
||||||
|
|||||||
Reference in New Issue
Block a user