feat: sqlite persistence with goose migrations, flashcard schema, zap logger

- Add SQLite as authoritative store alongside Qdrant (best-effort indexing)
- Use goose for embedded SQL migrations
- Schema matches flashcard format: id(INTEGER PK), note, repos, host, tags, user, context, created
- Replace std log with zap structured logger
- Split registerTools into registerStoreKnowledge + registerSearchKnowledge
- Qdrant index uses SQLite rowid directly as point ID (no SHA256 hash)
- Search enriches Qdrant results from SQLite by ID
- Lowercase auth header before prefix check
- Always handle json.MarshalIndent errors
- NixOS: StateDirectory, sqlitePath to /var/lib/st-pierre/st-pierre.sqlite
This commit is contained in:
didier committed 2026-06-02 10:01:28 -04:00
1 parent 5ac11631d4
commit 39c6185b70
8 files changed
+366 -94

No files matched your search

+8
View File
@@ -98,6 +98,12 @@
default = null;
description = "MCP Bearer token directly. Prefer tokenFile for secrets.";
};
sqlitePath = lib.mkOption {
type = lib.types.path;
default = "/var/lib/st-pierre/st-pierre.sqlite";
description = "Path to the SQLite database file.";
};
};
config = lib.mkIf cfg.enable {
@@ -119,6 +125,7 @@
Group = "st-pierre";
Restart = "always";
WorkingDirectory = "/var/lib/st-pierre";
StateDirectory = "st-pierre";
ExecStart = "${st-pierre-pkg}/bin/st-pierre";
EnvironmentFile = lib.optional (cfg.openaiApiKeyFile != null) cfg.openaiApiKeyFile
++ lib.optional (cfg.tokenFile != null) cfg.tokenFile
@@ -133,6 +140,7 @@
QDRANT_TLS = if cfg.qdrantTls then "true" else "false";
EMBEDDING_BASE_URL = cfg.embeddingBaseUrl;
EMBEDDING_MODEL = cfg.embeddingModel;
SQLITE_PATH = builtins.toString cfg.sqlitePath;
}
// lib.optionalAttrs (cfg.openaiApiKey != null) {
OPENAI_API_KEY = cfg.openaiApiKey;