logosdb 1.0.2__tar.gz → 1.2.0__tar.gz

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 (249) hide show
  1. {logosdb-1.0.2 → logosdb-1.2.0}/.github/workflows/publish.yml +4 -3
  2. {logosdb-1.0.2 → logosdb-1.2.0}/CHANGELOG +36 -5
  3. {logosdb-1.0.2 → logosdb-1.2.0}/CMakeLists.txt +1 -1
  4. {logosdb-1.0.2 → logosdb-1.2.0}/PKG-INFO +2 -2
  5. {logosdb-1.0.2 → logosdb-1.2.0}/README.md +1 -1
  6. logosdb-1.2.0/examples/python/hello_annotated.py +63 -0
  7. {logosdb-1.0.2/nodejs/deps/core → logosdb-1.2.0}/include/logosdb/logosdb.h +55 -3
  8. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/README.md +22 -2
  9. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/package.json +10 -10
  10. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/server.json +8 -2
  11. logosdb-1.2.0/mcp/src/chunk-context.test.ts +152 -0
  12. logosdb-1.2.0/mcp/src/chunk-context.ts +80 -0
  13. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/chunker.test.ts +17 -0
  14. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/chunker.ts +95 -12
  15. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/file-index-manifest.test.ts +22 -0
  16. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/file-index-manifest.ts +9 -5
  17. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/index.ts +98 -5
  18. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/store.ts +6 -7
  19. {logosdb-1.0.2 → logosdb-1.2.0}/n8n/package.json +7 -7
  20. {logosdb-1.0.2 → logosdb-1.2.0/nodejs/deps/core}/include/logosdb/logosdb.h +55 -3
  21. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/logosdb.cpp +81 -0
  22. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/lib/index.js +19 -0
  23. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/package.json +1 -1
  24. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/src/node_logosdb.cpp +45 -0
  25. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/test/test.js +34 -0
  26. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/types/index.d.ts +21 -0
  27. {logosdb-1.0.2 → logosdb-1.2.0}/package-lock.json +121 -456
  28. {logosdb-1.0.2 → logosdb-1.2.0}/pyproject.toml +1 -1
  29. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/__init__.py +2 -2
  30. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/_core.pyi +11 -0
  31. {logosdb-1.0.2 → logosdb-1.2.0}/python/src/bindings.cpp +30 -0
  32. {logosdb-1.0.2 → logosdb-1.2.0}/src/logosdb.cpp +81 -0
  33. {logosdb-1.0.2 → logosdb-1.2.0}/tests/python/test_smoke.py +25 -0
  34. {logosdb-1.0.2 → logosdb-1.2.0}/tests/test_doctest.cpp +60 -0
  35. {logosdb-1.0.2 → logosdb-1.2.0}/.clang-format +0 -0
  36. {logosdb-1.0.2 → logosdb-1.2.0}/.clang-format-ignore +0 -0
  37. {logosdb-1.0.2 → logosdb-1.2.0}/.clang-tidy +0 -0
  38. {logosdb-1.0.2 → logosdb-1.2.0}/.claude/commands/forget.md +0 -0
  39. {logosdb-1.0.2 → logosdb-1.2.0}/.claude/commands/index.md +0 -0
  40. {logosdb-1.0.2 → logosdb-1.2.0}/.claude/commands/search.md +0 -0
  41. {logosdb-1.0.2 → logosdb-1.2.0}/.claude/mcp.json +0 -0
  42. {logosdb-1.0.2 → logosdb-1.2.0}/.editorconfig +0 -0
  43. {logosdb-1.0.2 → logosdb-1.2.0}/.githooks/README.md +0 -0
  44. {logosdb-1.0.2 → logosdb-1.2.0}/.githooks/install.sh +0 -0
  45. {logosdb-1.0.2 → logosdb-1.2.0}/.githooks/pre-commit +0 -0
  46. {logosdb-1.0.2 → logosdb-1.2.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  47. {logosdb-1.0.2 → logosdb-1.2.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  48. {logosdb-1.0.2 → logosdb-1.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  49. {logosdb-1.0.2 → logosdb-1.2.0}/.github/workflows/ci.yml +0 -0
  50. {logosdb-1.0.2 → logosdb-1.2.0}/.github/workflows/python.yml +0 -0
  51. {logosdb-1.0.2 → logosdb-1.2.0}/.gitignore +0 -0
  52. {logosdb-1.0.2 → logosdb-1.2.0}/.vibe/config.toml +0 -0
  53. {logosdb-1.0.2 → logosdb-1.2.0}/.vibe/skills/ldb-forget/SKILL.md +0 -0
  54. {logosdb-1.0.2 → logosdb-1.2.0}/.vibe/skills/ldb-index/SKILL.md +0 -0
  55. {logosdb-1.0.2 → logosdb-1.2.0}/.vibe/skills/ldb-search/SKILL.md +0 -0
  56. {logosdb-1.0.2 → logosdb-1.2.0}/.vibe/skills/logosdb-memory/SKILL.md +0 -0
  57. {logosdb-1.0.2 → logosdb-1.2.0}/AGENTS.md +0 -0
  58. {logosdb-1.0.2 → logosdb-1.2.0}/CODE_OF_CONDUCT.md +0 -0
  59. {logosdb-1.0.2 → logosdb-1.2.0}/CONTRIBUTING.md +0 -0
  60. {logosdb-1.0.2 → logosdb-1.2.0}/LICENSE +0 -0
  61. {logosdb-1.0.2 → logosdb-1.2.0}/RELEASING.md +0 -0
  62. {logosdb-1.0.2 → logosdb-1.2.0}/SECURITY.md +0 -0
  63. {logosdb-1.0.2 → logosdb-1.2.0}/docs/adr-002-training-free-quantization.md +0 -0
  64. {logosdb-1.0.2 → logosdb-1.2.0}/docs/rag-on-prem.md +0 -0
  65. {logosdb-1.0.2 → logosdb-1.2.0}/docs/sizing.md +0 -0
  66. {logosdb-1.0.2 → logosdb-1.2.0}/examples/python/basic_usage.py +0 -0
  67. {logosdb-1.0.2 → logosdb-1.2.0}/examples/python/clinical_notes_bilingual.py +0 -0
  68. {logosdb-1.0.2 → logosdb-1.2.0}/examples/python/clinical_notes_minimal.py +0 -0
  69. {logosdb-1.0.2 → logosdb-1.2.0}/examples/python/memory_efficient_rag.py +0 -0
  70. {logosdb-1.0.2 → logosdb-1.2.0}/examples/python/sentence_transformers_demo.py +0 -0
  71. {logosdb-1.0.2 → logosdb-1.2.0}/img/linkedin-banner.png +0 -0
  72. {logosdb-1.0.2 → logosdb-1.2.0}/img/logo-0.10.0.png +0 -0
  73. {logosdb-1.0.2 → logosdb-1.2.0}/img/logo-0.11.0.png +0 -0
  74. {logosdb-1.0.2 → logosdb-1.2.0}/img/logo-0.12.0.png +0 -0
  75. {logosdb-1.0.2 → logosdb-1.2.0}/img/logo-0.13.0.png +0 -0
  76. {logosdb-1.0.2 → logosdb-1.2.0}/img/logo-0.9.0.png +0 -0
  77. {logosdb-1.0.2 → logosdb-1.2.0}/img/logosdb-0.9.0-medical-example.jpg +0 -0
  78. {logosdb-1.0.2 → logosdb-1.2.0}/logo-0.7.0.png +0 -0
  79. {logosdb-1.0.2 → logosdb-1.2.0}/logo.png +0 -0
  80. {logosdb-1.0.2 → logosdb-1.2.0}/logos-motto-0.7.0.png +0 -0
  81. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/.gitignore +0 -0
  82. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/.npmignore +0 -0
  83. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/.prettierrc +0 -0
  84. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/eslint.config.js +0 -0
  85. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/scripts/mcp-stdio-smoke.mjs +0 -0
  86. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/cli.test.ts +0 -0
  87. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/cli.ts +0 -0
  88. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/embeddings.ts +0 -0
  89. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/gitignore-walker.test.ts +0 -0
  90. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/gitignore-walker.ts +0 -0
  91. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/hybrid.test.ts +0 -0
  92. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/hybrid.ts +0 -0
  93. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/metadata-filter.test.ts +0 -0
  94. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/metadata-filter.ts +0 -0
  95. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/quota.test.ts +0 -0
  96. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/quota.ts +0 -0
  97. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/security.test.ts +0 -0
  98. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/security.ts +0 -0
  99. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/src/store.test.ts +0 -0
  100. {logosdb-1.0.2 → logosdb-1.2.0}/mcp/tsconfig.json +0 -0
  101. {logosdb-1.0.2 → logosdb-1.2.0}/n8n/.gitignore +0 -0
  102. {logosdb-1.0.2 → logosdb-1.2.0}/n8n/.prettierrc +0 -0
  103. {logosdb-1.0.2 → logosdb-1.2.0}/n8n/README.md +0 -0
  104. {logosdb-1.0.2 → logosdb-1.2.0}/n8n/eslint.config.js +0 -0
  105. {logosdb-1.0.2 → logosdb-1.2.0}/n8n/src/credentials/LogosDbApi.credentials.ts +0 -0
  106. {logosdb-1.0.2 → logosdb-1.2.0}/n8n/src/index.ts +0 -0
  107. {logosdb-1.0.2 → logosdb-1.2.0}/n8n/src/nodes/LogosDb/LogosDb.node.ts +0 -0
  108. {logosdb-1.0.2 → logosdb-1.2.0}/n8n/tsconfig.json +0 -0
  109. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/README.md +0 -0
  110. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/binding.gyp +0 -0
  111. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/hnsw_index.cpp +0 -0
  112. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/hnsw_index.h +0 -0
  113. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/metadata.cpp +0 -0
  114. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/metadata.h +0 -0
  115. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/platform.cpp +0 -0
  116. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/platform.h +0 -0
  117. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/storage.cpp +0 -0
  118. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/storage.h +0 -0
  119. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/wal.cpp +0 -0
  120. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/src/wal.h +0 -0
  121. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/third_party/hnswlib/hnswlib/bruteforce.h +0 -0
  122. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/third_party/hnswlib/hnswlib/hnswalg.h +0 -0
  123. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/third_party/hnswlib/hnswlib/hnswlib.h +0 -0
  124. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/third_party/hnswlib/hnswlib/space_ip.h +0 -0
  125. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/third_party/hnswlib/hnswlib/space_l2.h +0 -0
  126. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/third_party/hnswlib/hnswlib/stop_condition.h +0 -0
  127. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/third_party/hnswlib/hnswlib/visited_list_pool.h +0 -0
  128. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/deps/core/third_party/nlohmann/json.hpp +0 -0
  129. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/package-lock.json +0 -0
  130. {logosdb-1.0.2 → logosdb-1.2.0}/nodejs/scripts/vendor-core.mjs +0 -0
  131. {logosdb-1.0.2 → logosdb-1.2.0}/package.json +0 -0
  132. {logosdb-1.0.2 → logosdb-1.2.0}/plugins/codex-semantic-memory/.codex-plugin/marketplace.json +0 -0
  133. {logosdb-1.0.2 → logosdb-1.2.0}/plugins/codex-semantic-memory/.codex-plugin/plugin.json +0 -0
  134. {logosdb-1.0.2 → logosdb-1.2.0}/plugins/codex-semantic-memory/.mcp.json +0 -0
  135. {logosdb-1.0.2 → logosdb-1.2.0}/plugins/codex-semantic-memory/AGENTS.md +0 -0
  136. {logosdb-1.0.2 → logosdb-1.2.0}/plugins/codex-semantic-memory/README.md +0 -0
  137. {logosdb-1.0.2 → logosdb-1.2.0}/plugins/codex-semantic-memory/scripts/logosdb-mcp-wrap.sh +0 -0
  138. {logosdb-1.0.2 → logosdb-1.2.0}/plugins/codex-semantic-memory/skills/semantic-memory/SKILL.md +0 -0
  139. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/__main__.py +0 -0
  140. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/_vibe_cli.py +0 -0
  141. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/anthropic.py +0 -0
  142. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/camel.py +0 -0
  143. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/cognee.py +0 -0
  144. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/cohere.py +0 -0
  145. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/crewai.py +0 -0
  146. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/haystack.py +0 -0
  147. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/huggingface.py +0 -0
  148. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/langchain.py +0 -0
  149. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/langchain.pyi +0 -0
  150. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/llamaindex.py +0 -0
  151. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/mem0.py +0 -0
  152. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/mistral.py +0 -0
  153. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/openai.py +0 -0
  154. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/py.typed +0 -0
  155. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/sizing.py +0 -0
  156. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/superlinked.py +0 -0
  157. {logosdb-1.0.2 → logosdb-1.2.0}/python/logosdb/vibe.py +0 -0
  158. {logosdb-1.0.2 → logosdb-1.2.0}/src/hnsw_index.cpp +0 -0
  159. {logosdb-1.0.2 → logosdb-1.2.0}/src/hnsw_index.h +0 -0
  160. {logosdb-1.0.2 → logosdb-1.2.0}/src/metadata.cpp +0 -0
  161. {logosdb-1.0.2 → logosdb-1.2.0}/src/metadata.h +0 -0
  162. {logosdb-1.0.2 → logosdb-1.2.0}/src/platform.cpp +0 -0
  163. {logosdb-1.0.2 → logosdb-1.2.0}/src/platform.h +0 -0
  164. {logosdb-1.0.2 → logosdb-1.2.0}/src/storage.cpp +0 -0
  165. {logosdb-1.0.2 → logosdb-1.2.0}/src/storage.h +0 -0
  166. {logosdb-1.0.2 → logosdb-1.2.0}/src/wal.cpp +0 -0
  167. {logosdb-1.0.2 → logosdb-1.2.0}/src/wal.h +0 -0
  168. {logosdb-1.0.2 → logosdb-1.2.0}/tests/doctest.h +0 -0
  169. {logosdb-1.0.2 → logosdb-1.2.0}/tests/python/test_anthropic.py +0 -0
  170. {logosdb-1.0.2 → logosdb-1.2.0}/tests/python/test_haystack.py +0 -0
  171. {logosdb-1.0.2 → logosdb-1.2.0}/tests/python/test_huggingface.py +0 -0
  172. {logosdb-1.0.2 → logosdb-1.2.0}/tests/python/test_integrations.py +0 -0
  173. {logosdb-1.0.2 → logosdb-1.2.0}/tests/python/test_langchain.py +0 -0
  174. {logosdb-1.0.2 → logosdb-1.2.0}/tests/python/test_llamaindex.py +0 -0
  175. {logosdb-1.0.2 → logosdb-1.2.0}/tests/python/test_mistral.py +0 -0
  176. {logosdb-1.0.2 → logosdb-1.2.0}/tests/python/test_openai.py +0 -0
  177. {logosdb-1.0.2 → logosdb-1.2.0}/tests/python/test_vibe.py +0 -0
  178. {logosdb-1.0.2 → logosdb-1.2.0}/tests/test_stress.cpp +0 -0
  179. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/README.md +0 -0
  180. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/.github/workflows/build.yml +0 -0
  181. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/.gitignore +0 -0
  182. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/ALGO_PARAMS.md +0 -0
  183. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/CMakeLists.txt +0 -0
  184. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/LICENSE +0 -0
  185. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/MANIFEST.in +0 -0
  186. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/Makefile +0 -0
  187. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/README.md +0 -0
  188. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/TESTING_RECALL.md +0 -0
  189. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/cpp/EXAMPLES.md +0 -0
  190. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/cpp/example_epsilon_search.cpp +0 -0
  191. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/cpp/example_filter.cpp +0 -0
  192. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/cpp/example_mt_filter.cpp +0 -0
  193. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/cpp/example_mt_replace_deleted.cpp +0 -0
  194. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/cpp/example_mt_search.cpp +0 -0
  195. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/cpp/example_multivector_search.cpp +0 -0
  196. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/cpp/example_replace_deleted.cpp +0 -0
  197. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/cpp/example_search.cpp +0 -0
  198. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/python/EXAMPLES.md +0 -0
  199. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/python/example.py +0 -0
  200. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/python/example_filter.py +0 -0
  201. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/python/example_replace_deleted.py +0 -0
  202. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/python/example_search.py +0 -0
  203. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/python/example_serialization.py +0 -0
  204. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/examples/python/pyw_hnswlib.py +0 -0
  205. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/hnswlib/bruteforce.h +0 -0
  206. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/hnswlib/hnswalg.h +0 -0
  207. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/hnswlib/hnswlib.h +0 -0
  208. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/hnswlib/space_ip.h +0 -0
  209. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/hnswlib/space_l2.h +0 -0
  210. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/hnswlib/stop_condition.h +0 -0
  211. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/hnswlib/visited_list_pool.h +0 -0
  212. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/pyproject.toml +0 -0
  213. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/python_bindings/LazyIndex.py +0 -0
  214. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/python_bindings/__init__.py +0 -0
  215. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/python_bindings/bindings.cpp +0 -0
  216. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/python_bindings/setup.py +0 -0
  217. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/python_bindings/tests/bindings_test_bf_index.py +0 -0
  218. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/setup.py +0 -0
  219. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/download_bigann.py +0 -0
  220. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/epsilon_search_test.cpp +0 -0
  221. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/main.cpp +0 -0
  222. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/multiThreadLoad_test.cpp +0 -0
  223. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/multiThread_replace_test.cpp +0 -0
  224. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/multivector_search_test.cpp +0 -0
  225. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/searchKnnCloserFirst_test.cpp +0 -0
  226. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/searchKnnWithFilter_test.cpp +0 -0
  227. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/sift_1b.cpp +0 -0
  228. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/sift_test.cpp +0 -0
  229. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/update_gen_data.py +0 -0
  230. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/cpp/updates_test.cpp +0 -0
  231. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test.py +0 -0
  232. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test_filter.py +0 -0
  233. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test_getdata.py +0 -0
  234. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test_labels.py +0 -0
  235. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test_metadata.py +0 -0
  236. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test_pickle.py +0 -0
  237. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test_recall.py +0 -0
  238. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test_replace.py +0 -0
  239. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test_resize.py +0 -0
  240. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test_spaces.py +0 -0
  241. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/bindings_test_stress_mt_replace.py +0 -0
  242. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/draw_git_test_plots.py +0 -0
  243. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/git_tester.py +0 -0
  244. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/hnswlib/tests/python/speedtest.py +0 -0
  245. {logosdb-1.0.2 → logosdb-1.2.0}/third_party/nlohmann/json.hpp +0 -0
  246. {logosdb-1.0.2 → logosdb-1.2.0}/tools/fuzz_jsonl_metadata.cpp +0 -0
  247. {logosdb-1.0.2 → logosdb-1.2.0}/tools/logosdb-bench.cpp +0 -0
  248. {logosdb-1.0.2 → logosdb-1.2.0}/tools/logosdb-cli.cpp +0 -0
  249. {logosdb-1.0.2 → logosdb-1.2.0}/website/bla.txt +0 -0
@@ -31,9 +31,10 @@ jobs:
31
31
  # pyproject — that runs x86_64 Docker on ARM and
32
32
  # fails with "exec format error")
33
33
  # ubuntu-24.04-arm → manylinux aarch64 (native)
34
- # macos-13 → macOS x86_64 (Intel runner)
35
- # macos-14 → macOS arm64 (Apple Silicon runner)
36
- os: [ubuntu-latest, ubuntu-24.04-arm, macos-14]
34
+ # macos-latest → macOS arm64 (Apple Silicon; macos-14 label is
35
+ # currently rejected on this org as
36
+ # macos-14-arm64-us-default)
37
+ os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
37
38
  steps:
38
39
  - name: Checkout
39
40
  uses: actions/checkout@v4
@@ -1,12 +1,43 @@
1
1
  logosdb change log
2
2
  ==================
3
3
 
4
- 1.0.2 (2026-10-19) — Python / C++ / PyPI
5
- -----------------------------------------
4
+ 1.2.0 (2026-11-09) — core / PyPI / npm `logosdb`
5
+ -------------------------------------------------
6
+
7
+ * **#122 — fetch-by-id (`logosdb_get`).** Load a live row’s embedding,
8
+ text, and timestamp by integer id. Tombstoned / out-of-range ids fail
9
+ cleanly. Exposed as C API + C++ `DB::get`, Python `DB.get` / `Row`, and
10
+ Node `db.get(id)`.
11
+ * Ships with `logosdb-mcp-server` **1.4.0** (depends on `logosdb` ^1.2.0).
12
+
13
+ 1.4.1 (2026-11-09) — `logosdb-mcp-server` only
14
+ -----------------------------------------------
15
+
16
+ * Align local `LogosDB` TypeScript surface with `logosdb` ≥ 1.2.0: `get(id)` /
17
+ `Row` (and `update`). Re-export `Row` / `SearchHit` from `store`.
18
+ * New tool **`logosdb_get`**: fetch live row embedding + metadata by id.
19
+
20
+ 1.4.0 (2026-11-09) — `logosdb-mcp-server` only
21
+ -----------------------------------------------
22
+
23
+ * Depend on `logosdb` **^1.2.0** (fetch-by-id on the native binding).
24
+ * Package / MCP registry metadata → **1.4.0**.
25
+
26
+ 1.1.0 (2026-10-28) — core / PyPI / npm `logosdb`
27
+ -------------------------------------------------
28
+
29
+ * Coordinated minor: Python, C++, and npm `logosdb` → **1.1.0**.
30
+ * Ships with `logosdb-mcp-server` **1.3.0** (Contextual Retrieval, #128).
31
+
32
+ 1.3.0 (2026-10-28) — `logosdb-mcp-server` only
33
+ -----------------------------------------------
6
34
 
7
- * Align `pyproject.toml`, CMake `project(VERSION ...)`, and
8
- `LOGOSDB_VERSION_*` with npm `logosdb` 1.0.2 so PyPI can publish the
9
- same train. The 1.0.1 wheel was the last Python release.
35
+ * **#128 — Contextual Retrieval (`header` mode).** `logosdb_index_file`
36
+ prepends a situating prefix (file, chunk i/n, line range, heading/symbol)
37
+ to the *embedded* string. Stored row text stays the raw chunk.
38
+ `LOGOSDB_CHUNK_CONTEXT=off|header|llm` (default `header`; `llm` falls
39
+ back to header). Incremental fingerprint includes `chunkContext`; old
40
+ manifests without the field compare as `off`.
10
41
 
11
42
  1.2.0 (2026-10-10) — npm packages
12
43
  ---------------------------------
@@ -1,5 +1,5 @@
1
1
  cmake_minimum_required(VERSION 3.15)
2
- project(logosdb VERSION 1.0.2 LANGUAGES CXX)
2
+ project(logosdb VERSION 1.2.0 LANGUAGES CXX)
3
3
 
4
4
  set(CMAKE_CXX_STANDARD 17)
5
5
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: logosdb
3
- Version: 1.0.2
3
+ Version: 1.2.0
4
4
  Summary: Fast semantic vector database (HNSW + mmap) with Python bindings
5
5
  Keywords: vector-database,hnsw,embeddings,semantic-search,nearest-neighbor
6
6
  Author-Email: Jose <jose-compu@users.noreply.github.com>
@@ -104,7 +104,7 @@ Authors: Jose ([@jose-compu](https://github.com/jose-compu))
104
104
  * Vectors and metadata are stored as flat binary files, memory-mapped for zero-copy reads.
105
105
  * Approximate nearest-neighbor search via [HNSW](https://arxiv.org/abs/1603.09320) (hnswlib), O(log n) query time.
106
106
  * Each vector row carries optional text and ISO 8601 timestamp metadata (JSONL sidecar).
107
- * The basic operations are `Put(embedding, text, timestamp)` and `Search(query, top_k)`.
107
+ * The basic operations are `Put(embedding, text, timestamp)`, `Get(id)`, and `Search(query, top_k)`.
108
108
  * **Timestamp range filtering**: search within a time window (e.g., "last 24 hours").
109
109
  * **Multiple distance metrics**: inner product, cosine similarity (auto-normalized), or L2 Euclidean.
110
110
  * Bulk vector access for direct tensor construction (e.g. loading into GPU memory).
@@ -18,7 +18,7 @@ Authors: Jose ([@jose-compu](https://github.com/jose-compu))
18
18
  * Vectors and metadata are stored as flat binary files, memory-mapped for zero-copy reads.
19
19
  * Approximate nearest-neighbor search via [HNSW](https://arxiv.org/abs/1603.09320) (hnswlib), O(log n) query time.
20
20
  * Each vector row carries optional text and ISO 8601 timestamp metadata (JSONL sidecar).
21
- * The basic operations are `Put(embedding, text, timestamp)` and `Search(query, top_k)`.
21
+ * The basic operations are `Put(embedding, text, timestamp)`, `Get(id)`, and `Search(query, top_k)`.
22
22
  * **Timestamp range filtering**: search within a time window (e.g., "last 24 hours").
23
23
  * **Multiple distance metrics**: inner product, cosine similarity (auto-normalized), or L2 Euclidean.
24
24
  * Bulk vector access for direct tensor construction (e.g. loading into GPU memory).
@@ -0,0 +1,63 @@
1
+ """Smallest LogosDB Python path with teaching comments (open / put / search / close).
2
+
3
+ Run:
4
+ pip install .
5
+ python examples/python/hello_annotated.py
6
+
7
+ Comments explain public API usage only. Behavior is a minimal put+search demo.
8
+ """
9
+ from __future__ import annotations
10
+
11
+ import shutil
12
+ import tempfile
13
+ from pathlib import Path
14
+
15
+ import numpy as np
16
+
17
+ import logosdb
18
+
19
+
20
+ def unit_vector(dim: int, seed: int) -> np.ndarray:
21
+ """Deterministic L2-normalized vector (demo stand-in for a real embedding)."""
22
+ rng = np.random.default_rng(seed)
23
+ v = rng.standard_normal(dim).astype(np.float32)
24
+ v /= np.linalg.norm(v)
25
+ return v
26
+
27
+
28
+ def main() -> None:
29
+ dim = 64
30
+ path = Path(tempfile.mkdtemp(prefix="logosdb-hello-"))
31
+ try:
32
+ # --- open DB ---
33
+ # logosdb.DB(path, dim=...) creates or opens an on-disk index at `path`.
34
+ # `dim` is the embedding width and must match every put/search vector.
35
+ db = logosdb.DB(str(path), dim=dim)
36
+ print(f"opened {db}")
37
+
38
+ # --- put vector + text ---
39
+ # put(embedding, text=...) appends one live row and returns its row id.
40
+ # Text is optional metadata returned on search hits when present.
41
+ emb = unit_vector(dim, seed=1)
42
+ row_id = db.put(emb, text="hello from logosdb")
43
+ print(f"put id={row_id} count_live={db.count_live()}")
44
+
45
+ # --- search top_k ---
46
+ # search(query, top_k=N) returns the N nearest *live* rows under the DB
47
+ # distance metric. Each hit exposes id, score, and optional text.
48
+ query = unit_vector(dim, seed=1) # same vector => the row we just wrote ranks first
49
+ hits = db.search(query, top_k=3)
50
+ print("top_k hits:")
51
+ for h in hits:
52
+ print(f" id={h.id} score={h.score:.4f} text={h.text!r}")
53
+
54
+ # --- close / cleanup ---
55
+ # Python releases the handle when `db` goes out of scope. Remove the temp
56
+ # directory so repeated runs start from an empty database.
57
+ del db
58
+ finally:
59
+ shutil.rmtree(path, ignore_errors=True)
60
+
61
+
62
+ if __name__ == "__main__":
63
+ main()
@@ -5,9 +5,9 @@
5
5
  #include <stdint.h>
6
6
 
7
7
  #define LOGOSDB_VERSION_MAJOR 1
8
- #define LOGOSDB_VERSION_MINOR 0
9
- #define LOGOSDB_VERSION_PATCH 2
10
- #define LOGOSDB_VERSION_STRING "1.0.2"
8
+ #define LOGOSDB_VERSION_MINOR 2
9
+ #define LOGOSDB_VERSION_PATCH 0
10
+ #define LOGOSDB_VERSION_STRING "1.2.0"
11
11
 
12
12
  /* Distance metrics for vector similarity search */
13
13
  #define LOGOSDB_DIST_IP 0 /* Inner product (default, requires L2-normalized vectors) */
@@ -29,6 +29,7 @@ extern "C"
29
29
  typedef struct logosdb_t logosdb_t;
30
30
  typedef struct logosdb_options_t logosdb_options_t;
31
31
  typedef struct logosdb_search_result_t logosdb_search_result_t;
32
+ typedef struct logosdb_row_t logosdb_row_t;
32
33
 
33
34
  /* ── Options ───────────────────────────────────────────────────────── */
34
35
 
@@ -161,6 +162,22 @@ extern "C"
161
162
  const char* timestamp,
162
163
  char** errptr);
163
164
 
165
+ /* Fetch a live row by id (#122). Returns an owned result that the caller
166
+ * must free with logosdb_row_free(). On error returns NULL and sets
167
+ * *errptr (null db, id out of range, or tombstoned).
168
+ *
169
+ * The embedding pointer from logosdb_row_embedding() is dim float32 values
170
+ * owned by the result (dequantized if storage dtype is float16/int8).
171
+ * Text and timestamp pointers are NULL when the stored field is empty. */
172
+ logosdb_row_t* logosdb_get(logosdb_t* db, uint64_t id, char** errptr);
173
+
174
+ uint64_t logosdb_row_id(const logosdb_row_t* r);
175
+ int logosdb_row_dim(const logosdb_row_t* r);
176
+ const float* logosdb_row_embedding(const logosdb_row_t* r);
177
+ const char* logosdb_row_text(const logosdb_row_t* r);
178
+ const char* logosdb_row_timestamp(const logosdb_row_t* r);
179
+ void logosdb_row_free(logosdb_row_t* r);
180
+
164
181
  /* ── Search ────────────────────────────────────────────────────────── */
165
182
 
166
183
  logosdb_search_result_t*
@@ -291,6 +308,14 @@ struct SearchHit
291
308
  std::string timestamp;
292
309
  };
293
310
 
311
+ struct Row
312
+ {
313
+ uint64_t id = 0;
314
+ std::vector<float> embedding;
315
+ std::string text;
316
+ std::string timestamp;
317
+ };
318
+
294
319
  class DB
295
320
  {
296
321
  public:
@@ -471,6 +496,33 @@ class DB
471
496
  return new_id;
472
497
  }
473
498
 
499
+ /* Fetch a live row by id. Throws if the id is out of range or tombstoned. */
500
+ Row get(uint64_t id)
501
+ {
502
+ char* err = nullptr;
503
+ logosdb_row_t* r = logosdb_get(db_, id, &err);
504
+ if (!r)
505
+ {
506
+ std::string msg = err ? err : "unknown";
507
+ free(err);
508
+ throw std::runtime_error("logosdb_get: " + msg);
509
+ }
510
+ Row out;
511
+ out.id = logosdb_row_id(r);
512
+ int d = logosdb_row_dim(r);
513
+ const float* emb = logosdb_row_embedding(r);
514
+ if (emb && d > 0)
515
+ out.embedding.assign(emb, emb + d);
516
+ const char* t = logosdb_row_text(r);
517
+ if (t)
518
+ out.text = t;
519
+ const char* ts = logosdb_row_timestamp(r);
520
+ if (ts)
521
+ out.timestamp = ts;
522
+ logosdb_row_free(r);
523
+ return out;
524
+ }
525
+
474
526
  std::vector<SearchHit> search(const std::vector<float>& query, int top_k)
475
527
  {
476
528
  char* err = nullptr;
@@ -206,7 +206,7 @@ Run [Ollama](https://ollama.com) with an embedding model (e.g. `nomic-embed-text
206
206
 
207
207
  ## Google Antigravity
208
208
 
209
- [Google Antigravity](https://codelabs.developers.google.com/google-workspace-mcp-antigravity) is an agentic IDE stack that can load **MCP servers** over **stdio** — the same pattern as Claude Code. **`logosdb-mcp-server`** is published as [`logosdb-mcp-server`](https://www.npmjs.com/package/logosdb-mcp-server) on npm and speaks standard MCP tools (`logosdb_index`, `logosdb_index_file`, `logosdb_search`, `logosdb_list`, `logosdb_info`, `logosdb_delete`). See the [MCP specification](https://modelcontextprotocol.io).
209
+ [Google Antigravity](https://codelabs.developers.google.com/google-workspace-mcp-antigravity) is an agentic IDE stack that can load **MCP servers** over **stdio** — the same pattern as Claude Code. **`logosdb-mcp-server`** is published as [`logosdb-mcp-server`](https://www.npmjs.com/package/logosdb-mcp-server) on npm and speaks standard MCP tools (`logosdb_index`, `logosdb_index_file`, `logosdb_search`, `logosdb_list`, `logosdb_info`, `logosdb_get`, `logosdb_delete`). See the [MCP specification](https://modelcontextprotocol.io).
210
210
 
211
211
  ### Where to configure
212
212
 
@@ -348,6 +348,7 @@ Noted. I'll keep that in the "decisions" namespace for future sessions.
348
348
  | `VOYAGE_API_KEY` | — | Required when `EMBEDDING_PROVIDER=voyage` |
349
349
  | `LOGOSDB_CHUNK_SIZE` | `800` | Target characters per chunk for `"legacy"` and `"section"` modes (ignored in `"line"` mode) |
350
350
  | `LOGOSDB_CHUNK_MODE` | `auto` | Default chunking strategy: `auto` \| `line` \| `section` \| `legacy`. See [Chunking strategies](#chunking-strategies). |
351
+ | `LOGOSDB_CHUNK_CONTEXT` | `header` | Situating prefix on the *embedded* string: `off` \| `header` \| `llm`. Stored row text stays the raw chunk. See [Contextual Retrieval](#contextual-retrieval). |
351
352
  | `LOGOSDB_RESPECT_GITIGNORE` | `1` (auto-on inside a Git working tree) | `0` / `false` / `no` / `off` disables `.gitignore`-aware filtering globally (0.9.1+) |
352
353
 
353
354
  **Important:** Use one embedding backend consistently for a given namespace on disk. Mixing dimensions or models on the same `LOGOSDB_PATH` namespace will produce invalid search results.
@@ -357,10 +358,11 @@ Noted. I'll keep that in the "decisions" namespace for future sessions.
357
358
  | Tool | Inputs | Description |
358
359
  |---|---|---|
359
360
  | `logosdb_index` | `text`, `namespace`, `metadata?`, `tags?` | Embed and store a text snippet; optional structured `tags` for later `filter` |
360
- | `logosdb_index_file` | `path`, `namespace`, `chunk_size?`, `chunking?`, `incremental?`, `respect_gitignore?`, `tags?` | Chunk, embed, and store a file or tree; **`incremental: true`** skips unchanged files, replaces chunks for changed files, and prunes removed files under a directory (state in `LOGOSDB_PATH/_logosdb_mcp_manifests/`). When the path lives inside a Git working tree, `.gitignore` rules are applied by default (override per call with `respect_gitignore: false` or globally with `LOGOSDB_RESPECT_GITIGNORE=0`; see [`.gitignore`-aware walking](#gitignore-aware-walking-091)). `chunking` selects the splitting strategy — see [Chunking strategies](#chunking-strategies). |
361
+ | `logosdb_index_file` | `path`, `namespace`, `chunk_size?`, `chunking?`, `chunk_context?`, `incremental?`, `respect_gitignore?`, `tags?` | Chunk, embed, and store a file or tree; **`incremental: true`** skips unchanged files, replaces chunks for changed files, and prunes removed files under a directory (state in `LOGOSDB_PATH/_logosdb_mcp_manifests/`). When the path lives inside a Git working tree, `.gitignore` rules are applied by default (override per call with `respect_gitignore: false` or globally with `LOGOSDB_RESPECT_GITIGNORE=0`; see [`.gitignore`-aware walking](#gitignore-aware-walking-091)). `chunking` selects the splitting strategy — see [Chunking strategies](#chunking-strategies). `chunk_context` selects the situating prefix on embeddings — see [Contextual Retrieval](#contextual-retrieval). |
361
362
  | `logosdb_search` | `query`, `namespace`, `top_k?`, `ts_from?`, `ts_to?`, `candidate_k?`, `hybrid?`, `fusion?`, `lexical_weight?`, `filter?` | Semantic search; optional ISO 8601 window; optional hybrid ANN+lexical fusion; optional metadata `filter` |
362
363
  | `logosdb_list` | — | List namespaces (includes live counts / quota summary when configured) |
363
364
  | `logosdb_info` | `namespace` | Stats: count, live count, dimension |
365
+ | `logosdb_get` | `namespace`, `id` | Fetch a live row by id (embedding, text, timestamp); fails if OOB or tombstoned (`logosdb` ≥ 1.2.0) |
364
366
  | `logosdb_delete` | `namespace`, `id?` **or** `query?`, `search_top_k?`, `match_rank?` | Delete by row id, or embed `query` and delete the `match_rank` hit (default 0) among `search_top_k` neighbors |
365
367
 
366
368
  Timestamp-filtered search matches the core library: when `ts_from` and/or `ts_to` are set, results are drawn from that window; `candidate_k` defaults to `10 × top_k` if omitted.
@@ -407,6 +409,24 @@ The `chunking` setting is part of the **incremental cache fingerprint**: changin
407
409
 
408
410
  `chunk_size` controls the target character count for the `"legacy"` and `"section"` modes (default `800`; env `LOGOSDB_CHUNK_SIZE`). It is ignored in `"line"` mode (which uses `linesPerChunk` / `lineOverlap`, not exposed as tool parameters but configurable programmatically via the `ChunkOptions` API).
409
411
 
412
+ ## Contextual Retrieval
413
+
414
+ Plain windows lose identity. `logosdb_index_file` can prepend a short **situating header** to the string that is **embedded**, while the stored row text stays the raw chunk (plus the existing `[file:…][chunk:…]` display label).
415
+
416
+ This is [Anthropic Contextual Retrieval](https://www.anthropic.com/news/contextual-retrieval) v1 (`header` only; no LLM).
417
+
418
+ | Mode | Embedded string | Stored text |
419
+ |------|-----------------|-------------|
420
+ | `header` (default for new indexes) | file, chunk i/n, lines, optional heading/symbol, then the raw chunk | raw chunk (display label unchanged) |
421
+ | `off` | raw chunk only — same embed input as pre-1.3.0 | unchanged |
422
+ | `llm` | reserved; falls back to `header` until a generator is configured | unchanged |
423
+
424
+ **Per call:** `logosdb_index_file({ …, chunk_context: "off" })`.
425
+
426
+ **Globally:** `LOGOSDB_CHUNK_CONTEXT=off` (also `0` / `false` / `raw`).
427
+
428
+ The incremental fingerprint includes `chunkContext`. Missing field on old manifests compares as `off` (no mass re-index). Switching `off` ↔ `header` forces a re-chunk.
429
+
410
430
  ## Development
411
431
 
412
432
  ```bash
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logosdb-mcp-server",
3
- "version": "1.2.0",
3
+ "version": "1.4.1",
4
4
  "mcpName": "io.github.jose-compu/logosdb-mcp-server",
5
5
  "description": "MCP server for LogosDB: local semantic memory, file indexing, and hybrid search for Claude Code, Cursor, and other MCP clients",
6
6
  "main": "dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "format:check": "prettier --check src/",
30
30
  "prepublishOnly": "npm run build",
31
31
  "smoke": "node scripts/mcp-stdio-smoke.mjs",
32
- "test": "npm run build && node --test dist/chunker.test.js dist/security.test.js dist/file-index-manifest.test.js dist/gitignore-walker.test.js dist/hybrid.test.js dist/metadata-filter.test.js dist/quota.test.js dist/store.test.js dist/cli.test.js && npm run smoke"
32
+ "test": "npm run build && node --test dist/chunker.test.js dist/chunk-context.test.js dist/security.test.js dist/file-index-manifest.test.js dist/gitignore-walker.test.js dist/hybrid.test.js dist/metadata-filter.test.js dist/quota.test.js dist/store.test.js dist/cli.test.js && npm run smoke"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
@@ -56,18 +56,18 @@
56
56
  },
57
57
  "homepage": "https://github.com/jose-compu/logosdb/tree/main/mcp#readme",
58
58
  "dependencies": {
59
- "@modelcontextprotocol/sdk": "^1.32.1",
59
+ "@modelcontextprotocol/sdk": "^1.29.0",
60
60
  "@xenova/transformers": "^2.17.2",
61
- "ignore": "^7.0.12",
62
- "logosdb": "^1.0.2"
61
+ "ignore": "^7.0.5",
62
+ "logosdb": "^1.2.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@types/node": "^20.19.43",
66
- "@typescript-eslint/eslint-plugin": "^8.71.1",
67
- "@typescript-eslint/parser": "^8.71.1",
68
- "eslint": "^10.12.0",
65
+ "@types/node": "^20.0.0",
66
+ "@typescript-eslint/eslint-plugin": "^8.59.1",
67
+ "@typescript-eslint/parser": "^8.59.1",
68
+ "eslint": "^10.3.0",
69
69
  "eslint-config-prettier": "^10.1.8",
70
- "prettier": "^3.9.10",
70
+ "prettier": "^3.8.3",
71
71
  "typescript": "^5.4.0"
72
72
  },
73
73
  "engines": {
@@ -8,13 +8,13 @@
8
8
  "url": "https://github.com/jose-compu/logosdb",
9
9
  "source": "github"
10
10
  },
11
- "version": "1.2.0",
11
+ "version": "1.4.1",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "registryBaseUrl": "https://registry.npmjs.org",
16
16
  "identifier": "logosdb-mcp-server",
17
- "version": "1.2.0",
17
+ "version": "1.4.1",
18
18
  "transport": {
19
19
  "type": "stdio"
20
20
  },
@@ -31,6 +31,12 @@
31
31
  "isRequired": false,
32
32
  "isSecret": false
33
33
  },
34
+ {
35
+ "name": "LOGOSDB_CHUNK_CONTEXT",
36
+ "description": "Situating prefix on embeds: off, header (default), or llm",
37
+ "isRequired": false,
38
+ "isSecret": false
39
+ },
34
40
  {
35
41
  "name": "OPENAI_API_KEY",
36
42
  "description": "Required when EMBEDDING_PROVIDER=openai",
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Contextual Retrieval headers (#128): off vs header embed strings;
3
+ * stored raw text is never rewritten here.
4
+ */
5
+
6
+ import assert from 'node:assert/strict';
7
+ import { describe, it } from 'node:test';
8
+
9
+ import { chunk } from './chunker.js';
10
+ import {
11
+ buildSituatingHeader,
12
+ embedTextForChunk,
13
+ resolveChunkContextMode,
14
+ type SituatingHeaderInput,
15
+ } from './chunk-context.js';
16
+
17
+ function headerInput(
18
+ overrides: Partial<SituatingHeaderInput> & { raw?: string } = {},
19
+ ): SituatingHeaderInput {
20
+ const raw =
21
+ overrides.raw ??
22
+ 'function greet() {\n return "hi";\n}\n';
23
+ const chunks = chunk(raw, { mode: overrides.resolvedMode ?? 'line', filePath: 'src/app.ts' });
24
+ const c = chunks[0]!;
25
+ return {
26
+ filePath: 'src/app.ts',
27
+ chunkIndex: 0,
28
+ chunkCount: chunks.length,
29
+ chunk: c,
30
+ resolvedMode: 'line',
31
+ ...overrides,
32
+ };
33
+ }
34
+
35
+ describe('resolveChunkContextMode', () => {
36
+ it('defaults to header', () => {
37
+ assert.equal(resolveChunkContextMode(undefined, {}), 'header');
38
+ });
39
+
40
+ it('accepts off aliases', () => {
41
+ assert.equal(resolveChunkContextMode('off'), 'off');
42
+ assert.equal(resolveChunkContextMode('0', {}), 'off');
43
+ assert.equal(resolveChunkContextMode('false', {}), 'off');
44
+ assert.equal(resolveChunkContextMode('raw', {}), 'off');
45
+ });
46
+
47
+ it('reads LOGOSDB_CHUNK_CONTEXT when no explicit value', () => {
48
+ assert.equal(resolveChunkContextMode(undefined, { LOGOSDB_CHUNK_CONTEXT: 'off' }), 'off');
49
+ assert.equal(resolveChunkContextMode(undefined, { LOGOSDB_CHUNK_CONTEXT: 'llm' }), 'llm');
50
+ });
51
+ });
52
+
53
+ describe('buildSituatingHeader', () => {
54
+ it('includes file, chunk i/n, and line range for line mode', () => {
55
+ const src = Array.from({ length: 60 }, (_, i) => `line ${i + 1}`).join('\n');
56
+ const chunks = chunk(src, { mode: 'line', linesPerChunk: 20, lineOverlap: 0, filePath: 'a.ts' });
57
+ assert.ok(chunks.length >= 2);
58
+ const h = buildSituatingHeader({
59
+ filePath: 'src/a.ts',
60
+ chunkIndex: 0,
61
+ chunkCount: chunks.length,
62
+ chunk: chunks[0]!,
63
+ resolvedMode: 'line',
64
+ });
65
+ assert.match(h, /File: src\/a\.ts/);
66
+ assert.match(h, /chunk 1\/\d+/);
67
+ assert.match(h, /lines 1-/);
68
+ assert.ok(h.split('\n').length <= 3);
69
+ });
70
+
71
+ it('includes Section heading for markdown section mode', () => {
72
+ const md = '# Revenue\n\nACME grew 3%.\n\n## Details\n\nMore text here.\n';
73
+ const chunks = chunk(md, { mode: 'section', filePath: 'notes.md' });
74
+ const first = chunks[0]!;
75
+ assert.ok(first.heading);
76
+ const h = buildSituatingHeader({
77
+ filePath: 'notes.md',
78
+ chunkIndex: 0,
79
+ chunkCount: chunks.length,
80
+ chunk: first,
81
+ resolvedMode: 'section',
82
+ });
83
+ assert.match(h, /Section: Revenue/);
84
+ });
85
+
86
+ it('includes Symbol from last-seen function for line mode', () => {
87
+ const src = 'export function verifyToken(t: string) {\n return true;\n}\n\nconst x = 1;\n';
88
+ const chunks = chunk(src, { mode: 'line', linesPerChunk: 2, lineOverlap: 0, filePath: 'jwt.ts' });
89
+ const later = chunks.find((c) => c.heading);
90
+ // first chunk starts at the function — heading is on later windows
91
+ const target = later ?? chunks[chunks.length - 1]!;
92
+ const h = buildSituatingHeader({
93
+ filePath: 'jwt.ts',
94
+ chunkIndex: 1,
95
+ chunkCount: chunks.length,
96
+ chunk: target,
97
+ resolvedMode: 'line',
98
+ });
99
+ if (target.heading) assert.match(h, /Symbol:/);
100
+ });
101
+
102
+ it('includes namespace and tags on a third line', () => {
103
+ const h = buildSituatingHeader({
104
+ ...headerInput(),
105
+ namespace: 'code',
106
+ tags: { lang: 'typescript', reviewed: true },
107
+ });
108
+ assert.match(h, /namespace=code/);
109
+ assert.match(h, /lang=typescript/);
110
+ assert.ok(h.split('\n').length <= 3);
111
+ });
112
+
113
+ it('legacy mode uses char offset when lines are present still shows File', () => {
114
+ const raw = 'plain paragraph without headings.\n';
115
+ const chunks = chunk(raw, { mode: 'legacy', filePath: 'note.txt' });
116
+ const h = buildSituatingHeader({
117
+ filePath: 'note.txt',
118
+ chunkIndex: 0,
119
+ chunkCount: 1,
120
+ chunk: chunks[0]!,
121
+ resolvedMode: 'legacy',
122
+ });
123
+ assert.match(h, /File: note\.txt/);
124
+ assert.match(h, /chunk 1\/1/);
125
+ });
126
+ });
127
+
128
+ describe('embedTextForChunk', () => {
129
+ it('off is bit-compatible with the raw chunk', () => {
130
+ const input = headerInput();
131
+ const raw = input.chunk.text;
132
+ assert.equal(embedTextForChunk('off', input, raw), raw);
133
+ });
134
+
135
+ it('header prefixes situating context and keeps raw body intact', () => {
136
+ const input = headerInput();
137
+ const raw = input.chunk.text;
138
+ const embedded = embedTextForChunk('header', input, raw);
139
+ assert.ok(embedded.startsWith('File:'));
140
+ assert.ok(embedded.endsWith(raw));
141
+ assert.notEqual(embedded, raw);
142
+ assert.equal(raw.includes('File:'), false);
143
+ });
144
+
145
+ it('llm without a generator falls back to header', () => {
146
+ const input = headerInput();
147
+ const raw = input.chunk.text;
148
+ const embedded = embedTextForChunk('llm', input, raw);
149
+ assert.ok(embedded.startsWith('File:'));
150
+ assert.ok(embedded.endsWith(raw));
151
+ });
152
+ });
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Situating-context annotations for Contextual Retrieval (#128).
3
+ *
4
+ * `header` prepends a short deterministic prefix to the string that is
5
+ * embedded. The stored row text stays the raw chunk (plus the existing
6
+ * `[file:][chunk:]` display label in the index handler).
7
+ *
8
+ * `off` embeds the raw chunk only (bit-compatible with pre-1.3.0).
9
+ * `llm` is reserved; without a generator it falls back to `header`.
10
+ */
11
+
12
+ import type { Chunk, ChunkMode } from './chunker.js';
13
+
14
+ export type ChunkContextMode = 'off' | 'header' | 'llm';
15
+
16
+ export function resolveChunkContextMode(
17
+ raw?: string | null,
18
+ env: NodeJS.ProcessEnv = process.env,
19
+ ): ChunkContextMode {
20
+ const v = (raw ?? env.LOGOSDB_CHUNK_CONTEXT ?? 'header').trim().toLowerCase();
21
+ if (v === 'off' || v === '0' || v === 'false' || v === 'no' || v === 'raw') return 'off';
22
+ if (v === 'llm') return 'llm';
23
+ return 'header';
24
+ }
25
+
26
+ /** Effective embed mode: `llm` without a generator is `header`. */
27
+ export function effectiveEmbedMode(mode: ChunkContextMode, hasLlm = false): 'off' | 'header' {
28
+ if (mode === 'off') return 'off';
29
+ if (mode === 'llm' && hasLlm) return 'header'; // v2 generator not wired yet
30
+ return 'header';
31
+ }
32
+
33
+ export interface SituatingHeaderInput {
34
+ filePath: string;
35
+ chunkIndex: number;
36
+ chunkCount: number;
37
+ chunk: Chunk;
38
+ resolvedMode: Exclude<ChunkMode, 'auto'>;
39
+ namespace?: string;
40
+ tags?: Record<string, string | number | boolean | null>;
41
+ }
42
+
43
+ /**
44
+ * Deterministic 1–3 line situating header. Never includes the raw chunk body.
45
+ */
46
+ export function buildSituatingHeader(input: SituatingHeaderInput): string {
47
+ const { filePath, chunkIndex, chunkCount, chunk, resolvedMode, namespace, tags } = input;
48
+ const loc =
49
+ chunk.lineStart != null && chunk.lineEnd != null
50
+ ? `lines ${chunk.lineStart}-${chunk.lineEnd}`
51
+ : `offset ${chunk.offset}`;
52
+ const lines: string[] = [
53
+ `File: ${filePath} chunk ${chunkIndex + 1}/${chunkCount} ${loc}`,
54
+ ];
55
+ if (chunk.heading) {
56
+ const kind = resolvedMode === 'line' ? 'Symbol' : 'Section';
57
+ lines.push(`${kind}: ${chunk.heading}`);
58
+ }
59
+ const extras: string[] = [];
60
+ if (namespace) extras.push(`namespace=${namespace}`);
61
+ if (tags) {
62
+ for (const [k, v] of Object.entries(tags)) {
63
+ if (v === null) continue;
64
+ extras.push(`${k}=${String(v)}`);
65
+ }
66
+ }
67
+ if (extras.length) lines.push(extras.join(' '));
68
+ return lines.join('\n');
69
+ }
70
+
71
+ /** String passed to the embedder. Stored row text must stay `chunk.text`. */
72
+ export function embedTextForChunk(
73
+ mode: ChunkContextMode,
74
+ headerInput: SituatingHeaderInput,
75
+ rawText: string,
76
+ ): string {
77
+ if (effectiveEmbedMode(mode) === 'off') return rawText;
78
+ const header = buildSituatingHeader(headerInput);
79
+ return `${header}\n\n${rawText}`;
80
+ }
@@ -575,3 +575,20 @@ test('backward-compat: chunk(text) — no opts, defaults to legacy', () => {
575
575
  const chunks = chunk('Para one.\n\nPara two.');
576
576
  assert.ok(chunks[0].text.includes('Para one'));
577
577
  });
578
+
579
+ test('line ranges are 1-based and cover the chunk', () => {
580
+ const src = makeLines(80);
581
+ const chunks = chunk(src, { mode: 'line', linesPerChunk: 20, lineOverlap: 0 });
582
+ for (const c of chunks) {
583
+ assert.ok(c.lineStart != null && c.lineEnd != null);
584
+ assert.ok(c.lineStart >= 1);
585
+ assert.ok(c.lineEnd >= c.lineStart);
586
+ }
587
+ assert.equal(chunks[0].lineStart, 1);
588
+ });
589
+
590
+ test('section mode attaches ATX heading', () => {
591
+ const md = '# Intro\n\nHello world.\n\n## API\n\nDocs here.\n';
592
+ const chunks = chunk(md, { mode: 'section', filePath: 'README.md' });
593
+ assert.ok(chunks.some((c) => c.heading === 'Intro' || c.heading === 'API'));
594
+ });