@voidwire/lore 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.ts CHANGED
@@ -185,6 +185,7 @@ async function handleSearch(args: string[]): Promise<void> {
185
185
 
186
186
  const limit = parsed.has("limit") ? parseInt(parsed.get("limit")!, 10) : 20;
187
187
  const since = parsed.get("since");
188
+ const project = parsed.get("project");
188
189
 
189
190
  // Handle prismis passthrough
190
191
  if (source === "prismis") {
@@ -255,7 +256,7 @@ async function handleSearch(args: string[]): Promise<void> {
255
256
  }
256
257
 
257
258
  try {
258
- const results = await semanticSearch(query, { source, limit });
259
+ const results = await semanticSearch(query, { source, limit, project });
259
260
  output({
260
261
  success: true,
261
262
  results,
@@ -581,6 +582,7 @@ Usage:
581
582
  Search Options:
582
583
  --exact Use FTS5 text search (bypasses semantic search)
583
584
  --limit <n> Maximum results (default: 20)
585
+ --project <name> Filter results by project
584
586
  --since <date> Filter by date (today, yesterday, this-week, YYYY-MM-DD)
585
587
  --sources List indexed sources with counts
586
588
 
@@ -638,6 +640,7 @@ Usage:
638
640
  Options:
639
641
  --exact Use FTS5 text search (bypasses semantic search)
640
642
  --limit <n> Maximum results (default: 20)
643
+ --project <name> Filter results by project (post-filters KNN results)
641
644
  --since <date> Filter by date (today, yesterday, this-week, YYYY-MM-DD)
642
645
  --sources List indexed sources with counts
643
646
  --help Show this help
@@ -665,6 +668,7 @@ Examples:
665
668
  lore search "authentication"
666
669
  lore search blogs "typescript patterns"
667
670
  lore search commits --since this-week "refactor"
671
+ lore search "authentication" --project=momentum --limit 5
668
672
  lore search --exact "def process_data"
669
673
  lore search prismis "kubernetes security"
670
674
  lore search atuin "docker build"
package/lib/semantic.ts CHANGED
@@ -32,8 +32,21 @@ export interface SemanticResult {
32
32
  export interface SemanticSearchOptions {
33
33
  source?: string;
34
34
  limit?: number;
35
+ project?: string;
35
36
  }
36
37
 
38
+ /**
39
+ * Maps source types to their project field name in metadata JSON.
40
+ * Different sources store project names in different fields.
41
+ */
42
+ const PROJECT_FIELD: Record<string, string> = {
43
+ commits: "project",
44
+ sessions: "project",
45
+ tasks: "project",
46
+ captures: "context",
47
+ teachings: "source",
48
+ };
49
+
37
50
  const MODEL_NAME = "nomic-ai/nomic-embed-text-v1.5";
38
51
 
39
52
  interface EmbeddingPipeline {
@@ -223,6 +236,24 @@ export async function semanticSearch(
223
236
  const stmt = db.prepare(sql);
224
237
  const results = stmt.all(...params) as SemanticResult[];
225
238
 
239
+ // Post-filter by project if specified
240
+ // KNN WHERE clause doesn't support json_extract on joined metadata,
241
+ // so we filter after the query returns
242
+ if (options.project) {
243
+ return results.filter((result) => {
244
+ const field = PROJECT_FIELD[result.source];
245
+ if (!field) return false;
246
+
247
+ try {
248
+ const metadata = JSON.parse(result.metadata);
249
+ return metadata[field] === options.project;
250
+ } catch {
251
+ // Skip results with malformed metadata
252
+ return false;
253
+ }
254
+ });
255
+ }
256
+
226
257
  return results;
227
258
  } finally {
228
259
  db.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidwire/lore",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Unified knowledge CLI - Search, list, and capture your indexed knowledge",
5
5
  "type": "module",
6
6
  "main": "./index.ts",