cortex-local 2.1.14__tar.gz → 2.1.16__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cortex-local
3
- Version: 2.1.14
3
+ Version: 2.1.16
4
4
  Summary: Local semantic search MCP server — notes + code, embedded Qdrant, fastembed
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: click>=8.0.0
@@ -21,6 +21,16 @@ from .indexer import index_path
21
21
 
22
22
  mcp = FastMCP("cortex")
23
23
 
24
+
25
+ def _log_search(tool: str, query: str, top: list) -> None:
26
+ try:
27
+ entry = {"ts": time.time(), "tool": tool, "query": query, "top": top}
28
+ with open(data_dir() / "search_log.jsonl", "a") as f:
29
+ f.write(json.dumps(entry) + "\n")
30
+ except Exception:
31
+ pass
32
+
33
+
24
34
  _reindex_state: dict = {
25
35
  "running": False, "started_at": None, "output": [], "error": None, "done": False,
26
36
  }
@@ -119,6 +129,9 @@ def search_notes(query: str, limit: int = 5) -> str:
119
129
  parts.append(f"**{p['file']} > {p['heading']}** (score: {round(r.score, 3)}){tag_str}\n\n{p['text']}")
120
130
  matched_files.append(p.get("file", ""))
121
131
  matched_scores.append(r.score)
132
+ _log_search("search_notes", query, [
133
+ {"file": f, "score": round(s, 3)} for f, s in zip(matched_files, matched_scores)
134
+ ])
122
135
  ppr = _ppr_block(matched_files, matched_scores)
123
136
  if ppr:
124
137
  parts.append(ppr)
@@ -175,6 +188,10 @@ def search_code(query: str, limit: int = 5) -> str:
175
188
  if len(deduped) >= limit:
176
189
  break
177
190
  _stats["total_results_code"] += len(deduped)
191
+ _log_search("search_code", query, [
192
+ {"repo": r.payload.get("repo", ""), "file": r.payload.get("file", ""), "score": round(bs, 3)}
193
+ for bs, r, _ in deduped
194
+ ])
178
195
  parts = []
179
196
  for boosted_score, r, file_meta in deduped:
180
197
  p = r.payload
File without changes