knowledge-rag 4.3.0 → 4.3.1

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.
Files changed (2) hide show
  1. package/README.md +59 -52
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1399,6 +1399,64 @@ Common issues:
1399
1399
 
1400
1400
  ## Changelog
1401
1401
 
1402
+ ### Unreleased
1403
+
1404
+ ### v4.3.1 (2026-06-22) — Hybrid Search Fixes
1405
+
1406
+ - **FIX**: Accept `"general"` as a valid category in `search_knowledge`. The parser hardcodes `"general"` as the fallback in `_detect_category` (`ingestion.py`), but the validator only built `valid_categories` from `config.keyword_routes` + `config.category_mappings.values()` — so users who customized `config.yaml` and dropped the default `"general": "general"` mapping hit `Invalid category` even though the index contained `general` documents. Validator now always tolerates `"general"`. (#98, thanks @Hohlas)
1407
+ - **FIX**: Skip BM25-only search results when Chroma can no longer resolve the chunk ID. Stale BM25 indices (typically right after `remove_document` or in the window between async reindex and BM25 rebuild) returned hits whose `collection.get()` came back empty; the previous fallback inserted entries with `document=""` / `metadata={}` into the reranker, polluting results with empty matches. The pipeline now `continue`s past those, dropping the stale hit cleanly. (#98, thanks @Hohlas)
1408
+ - **TEST**: Added `tests/test_pr98_regression.py` (4 tests) pinning both contracts so future refactors cannot silently revert either fix. Test count baseline: 227 → 231. (#99)
1409
+ - **CI**: Bumped `[tool.mypy] python_version` from 3.11 to 3.12 to accept PEP 695 `type` statements in the numpy stub (`numpy/__init__.pyi`) which were breaking the Pillar 7 strict gate. Only affects static analysis; `requires-python = ">=3.11"` unchanged. (#100)
1410
+
1411
+ ### v4.3.0 (2026-06-17) — Async Reindex, GPU CUDA 12, 13th MCP Tool
1412
+
1413
+ - **NEW**: `get_reindex_status` MCP tool — lightweight reindex progress polling without computing full index stats. Returns active/idle status, percent, processed/total, errors, and last result.
1414
+ - **NEW**: `reindex_documents` now runs in background via daemon thread — returns immediately with `{"status": "started"}`. Eliminates MCP timeout on large document sets (5K+ files). Concurrent calls return `already_running` with current progress.
1415
+ - **NEW**: GPU acceleration with full CUDA 12 support — `onnxruntime-gpu` + 7 NVIDIA pip packages (`cublas`, `cudnn`, `cuda-runtime`, `cufft`, `cusparse`, `cusolver`, `curand`, `nvjitlink`). Server auto-detects GPU on startup with 4-step verification (providers, DLLs, nvidia-smi, session creation). Falls back to CPU gracefully.
1416
+ - **NEW**: `_setup_cuda_dll_paths()` adds NVIDIA pip package DLL directories to `PATH` automatically on Windows — onnxruntime finds CUDA 12 DLLs without a full CUDA Toolkit install.
1417
+ - **DEPS**: `[gpu]` extra expanded from 3 to 8 packages (added `cufft`, `cusparse`, `cusolver`, `curand`, `nvjitlink`).
1418
+ - **FIX**: GPU status reporting now uses actual ONNX session creation test instead of just checking `get_available_providers()` — prevents false "GPU ACTIVE" when CUDA DLLs are missing.
1419
+ - **DOCS**: GPU Acceleration section rewritten with complete requirements table, setup steps, verification instructions, and fallback behavior.
1420
+ - **DOCS**: Tool reference updated — `reindex_documents` async behavior documented, `get_reindex_status` reference added.
1421
+ - **TEST**: Backwards-compat baseline updated for 13 MCP tools.
1422
+
1423
+ ### v4.2.0 (2026-06-17) — Search Performance & Output Quality
1424
+
1425
+ - **PERF**: Custom inverted-index BM25 replaces `rank-bm25` full-corpus scan — 128× faster keyword search on 50K+ chunk corpora. Only documents containing query terms are scored via posting lists.
1426
+ - **PERF**: `numpy.argpartition` for O(n) top-k selection instead of O(n log n) sort.
1427
+ - **PERF**: Batched adjacent chunk fetch — single ChromaDB `collection.get()` call replaces N round-trips per result.
1428
+ - **PERF**: O(1) reverse lookup via `_source_to_docid` dict eliminates linear scans of `_indexed_docs` in `search_similar`, `update_document`, `remove_document`, and `_expand_with_adjacent_chunks`.
1429
+ - **NEW**: `snippet_mode` parameter on `search_knowledge` (default: `true`) — truncates content to ~500 chars at natural break points with `content_length` field. Reduces token consumption by ~72%.
1430
+ - **NEW**: `min_score` parameter on `search_knowledge` (default: `0.0`) — filters results below a normalized relevance threshold. Response includes `filtered_by_score` count.
1431
+ - **NEW**: `filtered_by_score` field in search response JSON for transparency.
1432
+ - **DEPS**: `numpy` added as direct dependency (was transitive via fastembed); `rank-bm25` import removed from server.py.
1433
+ - **TEST**: 6 new tests for `min_score` filtering and `snippet_mode` truncation.
1434
+ - **TEST**: Updated backwards-compat baseline to include new `search_knowledge` parameters.
1435
+
1436
+ ### v4.1.2 (2026-06-17)
1437
+
1438
+ - **FIX**: `_save_metadata` dict snapshot prevents concurrent modification crash during file watcher events.
1439
+ - **STYLE**: ruff format applied to server.py.
1440
+
1441
+ ### v4.1.1 (2026-06-17)
1442
+
1443
+ - **FIX**: All `_indexed_docs` iterations now use `list()` snapshot, preventing `dictionary changed size during iteration` crash when FileWatcher modifies the index concurrently with MCP tool calls (affects `search_knowledge`, `search_similar`, `update_document`, `remove_document`, `evaluate_retrieval`, `list_categories`, `list_documents`)
1444
+
1445
+ ### v4.1.0 (2026-06-17)
1446
+
1447
+ - **Added:** `query_expansion_groups` config for symmetric synonym expansion (#92)
1448
+ - **Improved:** `expand_query()` now returns deterministic expansion order (set → ordered list with dedup)
1449
+
1450
+ ### v4.0.1 (2026-06-16)
1451
+
1452
+ - **FIX**: Orphan cleanup now runs before indexing loop, preventing chunk loss when files are moved (#90).
1453
+ - **FIX**: Chunk deduplication is now per-document instead of global, preventing cross-document chunk deletion (#91).
1454
+ - **FIX**: Added `on_moved` handler to `DocumentWatcher` for proper file move detection.
1455
+ - **FIX**: Startup preflight probes ChromaDB in a child process and moves crashing persistent indexes to `data/backups/auto-repair-*` before MCP initialization.
1456
+ - **FIX**: Reranker load failures now fall back to RRF ordering instead of failing `search_knowledge` on offline machines.
1457
+ - **FIX**: Virtualenv project-root detection now handles Python symlinks that resolve to the system interpreter.
1458
+ - **NEW**: `knowledge-rag-guarded` console script kept as an explicit guarded startup alias.
1459
+
1402
1460
  ### v4.0.0 (2026-06-09) — Enterprise Concurrent Access
1403
1461
 
1404
1462
  - **NEW**: SSE and streamable-http transport modes — 1 server serves N clients (`server.transport: "sse"` in config.yaml or `--transport sse` CLI).
@@ -1434,7 +1492,7 @@ Common issues:
1434
1492
  - **NEW** Property-based fuzzing of all parsers via Hypothesis (`tests/test_ingestion_property.py`) — 200 random examples per CI run.
1435
1493
  - **NEW** Memory baseline regression tests (`tests/test_memory_baseline.py`, cross-platform via psutil) — RSS bounded under 1000 queries; nightly soak amplifies to 50K iterations.
1436
1494
  - **NEW** Property/locale/format/preset matrices (`tests/test_presets.py`, `tests/test_locale.py`, `tests/test_format_smoke.py`).
1437
- - **NEW** Backwards-compatibility regression tests (`tests/test_backwards_compat.py`) — legacy YAML configs from v3.6.0 / v3.7.0 still parse; all 12 MCP tool parameter names frozen.
1495
+ - **NEW** Backwards-compatibility regression tests (`tests/test_backwards_compat.py`) — legacy YAML configs from v3.6.0 / v3.7.0 still parse; all 13 MCP tool parameter names frozen.
1438
1496
  - **NEW** AST-based public API surface diff (`scripts/check_api_surface.py`) — any breaking change blocks merge, baseline at `.github/api-surface-baseline.json`.
1439
1497
  - **NEW** CHANGELOG enforcement (`scripts/check_changelog.py`) — user-facing PRs must add a bullet under `## Unreleased`; bypass via `skip-changelog` label.
1440
1498
  - **NEW** Test count anti-regression (`scripts/check_test_count.py`) — guards against silent test deletion.
@@ -1464,57 +1522,6 @@ Common issues:
1464
1522
  - **CHORE**: pytest `tmp_path_retention_count=1` to avoid Windows atexit cleanup race in CI.
1465
1523
  - **ROADMAP**: Tracked v4.0 shared-service architecture (one daemon, many thin MCP clients) as the long-term fix for multi-process resource duplication. (#34)
1466
1524
 
1467
- ### Unreleased
1468
-
1469
- ### v4.3.0 (2026-06-17) — Async Reindex, GPU CUDA 12, 13th MCP Tool
1470
-
1471
- - **NEW**: `get_reindex_status` MCP tool — lightweight reindex progress polling without computing full index stats. Returns active/idle status, percent, processed/total, errors, and last result.
1472
- - **NEW**: `reindex_documents` now runs in background via daemon thread — returns immediately with `{"status": "started"}`. Eliminates MCP timeout on large document sets (5K+ files). Concurrent calls return `already_running` with current progress.
1473
- - **NEW**: GPU acceleration with full CUDA 12 support — `onnxruntime-gpu` + 7 NVIDIA pip packages (`cublas`, `cudnn`, `cuda-runtime`, `cufft`, `cusparse`, `cusolver`, `curand`, `nvjitlink`). Server auto-detects GPU on startup with 4-step verification (providers, DLLs, nvidia-smi, session creation). Falls back to CPU gracefully.
1474
- - **NEW**: `_setup_cuda_dll_paths()` adds NVIDIA pip package DLL directories to `PATH` automatically on Windows — onnxruntime finds CUDA 12 DLLs without a full CUDA Toolkit install.
1475
- - **DEPS**: `[gpu]` extra expanded from 3 to 8 packages (added `cufft`, `cusparse`, `cusolver`, `curand`, `nvjitlink`).
1476
- - **FIX**: GPU status reporting now uses actual ONNX session creation test instead of just checking `get_available_providers()` — prevents false "GPU ACTIVE" when CUDA DLLs are missing.
1477
- - **DOCS**: GPU Acceleration section rewritten with complete requirements table, setup steps, verification instructions, and fallback behavior.
1478
- - **DOCS**: Tool reference updated — `reindex_documents` async behavior documented, `get_reindex_status` reference added.
1479
- - **TEST**: Backwards-compat baseline updated for 13 MCP tools.
1480
-
1481
- ### v4.2.0 (2026-06-17) — Search Performance & Output Quality
1482
-
1483
- - **PERF**: Custom inverted-index BM25 replaces `rank-bm25` full-corpus scan — 128× faster keyword search on 50K+ chunk corpora. Only documents containing query terms are scored via posting lists.
1484
- - **PERF**: `numpy.argpartition` for O(n) top-k selection instead of O(n log n) sort.
1485
- - **PERF**: Batched adjacent chunk fetch — single ChromaDB `collection.get()` call replaces N round-trips per result.
1486
- - **PERF**: O(1) reverse lookup via `_source_to_docid` dict eliminates linear scans of `_indexed_docs` in `search_similar`, `update_document`, `remove_document`, and `_expand_with_adjacent_chunks`.
1487
- - **NEW**: `snippet_mode` parameter on `search_knowledge` (default: `true`) — truncates content to ~500 chars at natural break points with `content_length` field. Reduces token consumption by ~72%.
1488
- - **NEW**: `min_score` parameter on `search_knowledge` (default: `0.0`) — filters results below a normalized relevance threshold. Response includes `filtered_by_score` count.
1489
- - **NEW**: `filtered_by_score` field in search response JSON for transparency.
1490
- - **DEPS**: `numpy` added as direct dependency (was transitive via fastembed); `rank-bm25` import removed from server.py.
1491
- - **TEST**: 6 new tests for `min_score` filtering and `snippet_mode` truncation.
1492
- - **TEST**: Updated backwards-compat baseline to include new `search_knowledge` parameters.
1493
-
1494
- ### v4.1.2 (2026-06-17)
1495
-
1496
- - **FIX**: `_save_metadata` dict snapshot prevents concurrent modification crash during file watcher events.
1497
- - **STYLE**: ruff format applied to server.py.
1498
-
1499
- ### v4.1.1 (2026-06-17)
1500
-
1501
- - **FIX**: All `_indexed_docs` iterations now use `list()` snapshot, preventing `dictionary changed size during iteration` crash when FileWatcher modifies the index concurrently with MCP tool calls (affects `search_knowledge`, `search_similar`, `update_document`, `remove_document`, `evaluate_retrieval`, `list_categories`, `list_documents`)
1502
-
1503
- ### v4.1.0 (2026-06-17)
1504
-
1505
- - **Added:** `query_expansion_groups` config for symmetric synonym expansion (#92)
1506
- - **Improved:** `expand_query()` now returns deterministic expansion order (set → ordered list with dedup)
1507
-
1508
- ### v4.0.1 (2026-06-16)
1509
-
1510
- - **FIX**: Orphan cleanup now runs before indexing loop, preventing chunk loss when files are moved (#90).
1511
- - **FIX**: Chunk deduplication is now per-document instead of global, preventing cross-document chunk deletion (#91).
1512
- - **FIX**: Added `on_moved` handler to `DocumentWatcher` for proper file move detection.
1513
- - **FIX**: Startup preflight probes ChromaDB in a child process and moves crashing persistent indexes to `data/backups/auto-repair-*` before MCP initialization.
1514
- - **FIX**: Reranker load failures now fall back to RRF ordering instead of failing `search_knowledge` on offline machines.
1515
- - **FIX**: Virtualenv project-root detection now handles Python symlinks that resolve to the system interpreter.
1516
- - **NEW**: `knowledge-rag-guarded` console script kept as an explicit guarded startup alias.
1517
-
1518
1525
  ### v3.6.2 (2026-04-23)
1519
1526
 
1520
1527
  - **INFRA**: NPM provenance attestation (SLSA supply chain security), full README on npm page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knowledge-rag",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "Local RAG System for Claude Code — Hybrid search + Cross-encoder Reranking + 13 MCP Tools + 20 Format Parsers. Zero external servers.",
5
5
  "bin": {
6
6
  "knowledge-rag": "./bin/cli.js"