code-search-cli 0.1.0__tar.gz → 0.3.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 (74) hide show
  1. code_search_cli-0.3.0/.gitignore +37 -0
  2. code_search_cli-0.3.0/MANIFEST.in +4 -0
  3. code_search_cli-0.3.0/NOTICE +4 -0
  4. code_search_cli-0.3.0/PKG-INFO +392 -0
  5. code_search_cli-0.3.0/README.md +368 -0
  6. code_search_cli-0.3.0/benchmarks/README.md +39 -0
  7. code_search_cli-0.3.0/benchmarks/evidence-showcase/README.md +24 -0
  8. code_search_cli-0.3.0/benchmarks/evidence-showcase/RESULTS.md +38 -0
  9. code_search_cli-0.3.0/benchmarks/evidence-showcase/java-lifecycle/PublisherNotifier.java +9 -0
  10. code_search_cli-0.3.0/benchmarks/evidence-showcase/java-lifecycle/ReceiverUtil.java +9 -0
  11. code_search_cli-0.3.0/benchmarks/evidence-showcase/java-lifecycle/StartupService.java +8 -0
  12. code_search_cli-0.3.0/benchmarks/evidence-showcase/python/settings.py +6 -0
  13. code_search_cli-0.3.0/benchmarks/evidence-showcase/typescript/settings.ts +7 -0
  14. code_search_cli-0.3.0/benchmarks/multilingual-30/README.md +178 -0
  15. code_search_cli-0.3.0/benchmarks/multilingual-30/RESULTS.json +9250 -0
  16. code_search_cli-0.3.0/benchmarks/multilingual-30/TASK_IDS.json +189 -0
  17. code_search_cli-0.3.0/benchmarks/multilingual-30/prepare_manifest.py +271 -0
  18. code_search_cli-0.3.0/benchmarks/multilingual-30/prepare_snapshots.py +278 -0
  19. code_search_cli-0.3.0/benchmarks/multilingual-30/run_baselines.py +1034 -0
  20. code_search_cli-0.3.0/benchmarks/render_charts.py +321 -0
  21. code_search_cli-0.3.0/benchmarks/shared-java/README.md +151 -0
  22. code_search_cli-0.3.0/benchmarks/shared-java/RESULTS.json +5676 -0
  23. code_search_cli-0.3.0/benchmarks/shared-java/crg_worker.py +37 -0
  24. code_search_cli-0.3.0/benchmarks/shared-java/run_benchmark.py +774 -0
  25. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/pyproject.toml +6 -3
  26. code_search_cli-0.3.0/scripts/benchmark_tasks.py +36 -0
  27. code_search_cli-0.3.0/scripts/compare_retrievers.py +288 -0
  28. code_search_cli-0.3.0/scripts/e2e_smoke.py +246 -0
  29. code_search_cli-0.3.0/scripts/evaluate_benchmark.py +111 -0
  30. code_search_cli-0.3.0/scripts/evaluate_models.py +327 -0
  31. code_search_cli-0.3.0/scripts/showcase_evidence.py +218 -0
  32. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_retrieval/cli.py +78 -15
  33. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_retrieval/engine.py +296 -19
  34. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_retrieval/index_store.py +30 -13
  35. code_search_cli-0.3.0/src/code_retrieval/installer.py +468 -0
  36. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_retrieval/models.py +17 -2
  37. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_retrieval/query.py +45 -1
  38. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_retrieval/repository.py +69 -7
  39. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_retrieval/resources/code-search/SKILL.md +8 -3
  40. code_search_cli-0.3.0/src/code_retrieval/structure.py +195 -0
  41. code_search_cli-0.3.0/src/code_search_cli.egg-info/PKG-INFO +392 -0
  42. code_search_cli-0.3.0/src/code_search_cli.egg-info/SOURCES.txt +60 -0
  43. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/tests/test_benchmark_scripts.py +0 -51
  44. code_search_cli-0.3.0/tests/test_cli.py +36 -0
  45. code_search_cli-0.3.0/tests/test_engine.py +438 -0
  46. code_search_cli-0.3.0/tests/test_golden_output.py +159 -0
  47. code_search_cli-0.3.0/tests/test_index_store.py +207 -0
  48. code_search_cli-0.3.0/tests/test_installer.py +394 -0
  49. code_search_cli-0.3.0/tests/test_release_hygiene.py +211 -0
  50. code_search_cli-0.3.0/tests/test_repository.py +66 -0
  51. code_search_cli-0.3.0/tests/test_showcase_evidence.py +36 -0
  52. code_search_cli-0.3.0/tests/test_structure.py +159 -0
  53. code_search_cli-0.3.0/uv.lock +14 -0
  54. code_search_cli-0.1.0/NOTICE +0 -7
  55. code_search_cli-0.1.0/PKG-INFO +0 -287
  56. code_search_cli-0.1.0/README.md +0 -266
  57. code_search_cli-0.1.0/src/code_retrieval/installer.py +0 -65
  58. code_search_cli-0.1.0/src/code_retrieval/structure.py +0 -115
  59. code_search_cli-0.1.0/src/code_search_cli.egg-info/PKG-INFO +0 -287
  60. code_search_cli-0.1.0/src/code_search_cli.egg-info/SOURCES.txt +0 -28
  61. code_search_cli-0.1.0/tests/test_engine.py +0 -191
  62. code_search_cli-0.1.0/tests/test_index_store.py +0 -97
  63. code_search_cli-0.1.0/tests/test_installer.py +0 -64
  64. code_search_cli-0.1.0/tests/test_release_hygiene.py +0 -43
  65. code_search_cli-0.1.0/tests/test_structure.py +0 -29
  66. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/LICENSE +0 -0
  67. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/setup.cfg +0 -0
  68. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_retrieval/__init__.py +0 -0
  69. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_retrieval/__main__.py +0 -0
  70. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_retrieval/resources/code-search/agents/openai.yaml +0 -0
  71. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_search_cli.egg-info/dependency_links.txt +0 -0
  72. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_search_cli.egg-info/entry_points.txt +0 -0
  73. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/src/code_search_cli.egg-info/top_level.txt +0 -0
  74. {code_search_cli-0.1.0 → code_search_cli-0.3.0}/tests/test_query.py +0 -0
@@ -0,0 +1,37 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .DS_Store
5
+ .coverage
6
+ .mypy_cache/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .playwright-cli/
10
+ .venv/
11
+ .idea/
12
+ build/
13
+ dist/
14
+ *.log
15
+ *.sqlite
16
+ *.sqlite3
17
+
18
+ # Machine-local configuration and benchmark artifacts
19
+ .local/
20
+ benchmarks/private/
21
+ .env
22
+ .env.*
23
+ !.env.example
24
+ .netrc
25
+ .npmrc
26
+ .pypirc
27
+ credentials*.json
28
+ secrets*.json
29
+ *.key
30
+ *.pem
31
+ *.p12
32
+ *.pfx
33
+
34
+ # wrangler files
35
+ .wrangler
36
+ .dev.vars*
37
+ !.dev.vars.example
@@ -0,0 +1,4 @@
1
+ include .gitignore
2
+ include uv.lock
3
+ recursive-include scripts *.py
4
+ recursive-include benchmarks *.java *.json *.md *.py *.ts
@@ -0,0 +1,4 @@
1
+ Code Search
2
+ Copyright 2026 Code Search contributors
3
+
4
+ This product is licensed under the Apache License, Version 2.0.
@@ -0,0 +1,392 @@
1
+ Metadata-Version: 2.4
2
+ Name: code-search-cli
3
+ Version: 0.3.0
4
+ Summary: Task-aware code search with compact, auditable evidence for coding agents
5
+ Author: Code Search contributors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://code-search.quguai.cc/
8
+ Project-URL: Documentation, https://code-search.quguai.cc/
9
+ Project-URL: Repository, https://github.com/quguai/code-search
10
+ Project-URL: Issues, https://github.com/quguai/code-search/issues
11
+ Project-URL: Changelog, https://github.com/quguai/code-search/releases
12
+ Keywords: code-search,code-retrieval,coding-agents,agent-skills,cli,codex
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Topic :: Software Development
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ License-File: NOTICE
23
+ Dynamic: license-file
24
+
25
+ <div align="center">
26
+ <a href="https://github.com/quguai/code-search">
27
+ <picture>
28
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/quguai/code-search/main/assets/brand-dark.png" />
29
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/quguai/code-search/main/assets/brand-light.png" />
30
+ <img src="https://raw.githubusercontent.com/quguai/code-search/main/assets/brand-light.png" alt="CodeSearch" width="600" />
31
+ </picture>
32
+ </a>
33
+ <p><strong>Task-aware code search for coding agents</strong></p>
34
+ <p>Explainable evidence. Scoped context. No runtime model.</p>
35
+ </div>
36
+
37
+ <p align="center">
38
+ <a href="https://github.com/quguai/code-search/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/quguai/code-search/ci.yml?branch=main&amp;style=flat-square" /></a>
39
+ <a href="https://pypi.org/project/code-search-cli/"><img alt="PyPI" src="https://img.shields.io/pypi/v/code-search-cli?style=flat-square" /></a>
40
+ <a href="https://github.com/quguai/code-search/blob/main/LICENSE"><img alt="Apache-2.0 license" src="https://img.shields.io/github/license/quguai/code-search?style=flat-square" /></a>
41
+ <img alt="Python 3.11+" src="https://img.shields.io/badge/Python-3.11%2B-3776AB?style=flat-square&amp;logo=python&amp;logoColor=white" />
42
+ <img alt="Agent Skill installers for seven agents" src="https://img.shields.io/badge/Agent_Skills-7_targets-5B47D6?style=flat-square" />
43
+ <img alt="Experimental status" src="https://img.shields.io/badge/status-experimental-D97706?style=flat-square" />
44
+ </p>
45
+
46
+ <p align="center">
47
+ <strong>English</strong> | <a href="https://github.com/quguai/code-search/blob/main/README.zh-CN.md">简体中文</a> | <a href="https://github.com/quguai/code-search/blob/main/README.ja-JP.md">日本語</a> | <a href="https://github.com/quguai/code-search/blob/main/README.ko-KR.md">한국어</a> | <a href="https://github.com/quguai/code-search/blob/main/README.ru-RU.md">Русский</a>
48
+ </p>
49
+
50
+ ---
51
+
52
+ Code Search is a task-aware retrieval CLI for coding agents. It returns a concise, verifiable set of
53
+ source evidence for an engineering task, not only a list of similar snippets.
54
+
55
+ The current version is an independently implemented, fully model-free MVP: no embeddings, no GPU, no
56
+ server, and no network calls. It can read a working tree or any Git revision and returns source
57
+ locations, ranking reasons, structural evidence roles, provenance, categorical confidence, and
58
+ payload statistics.
59
+
60
+ > Search less. Hand the agent the evidence it needs to act.
61
+
62
+ ## Quick start
63
+
64
+ ### Install from PyPI
65
+
66
+ ```bash
67
+ uv tool install code-search-cli
68
+ code-search --version
69
+ ```
70
+
71
+ The distribution is named `code-search-cli`; the installed command remains `code-search`.
72
+
73
+ ### Install from this checkout
74
+
75
+ ```bash
76
+ cd /path/to/code-search
77
+ uv tool install .
78
+ code-search --version
79
+ ```
80
+
81
+ ### Retrieve evidence for a task
82
+
83
+ ```bash
84
+ code-search retrieve \
85
+ --repo /path/to/repository \
86
+ --task "Fix dependency injection order so startup events are not missed"
87
+ ```
88
+
89
+ The command is read-only. It does not check out revisions, modify the target repository, or create an
90
+ index inside it. It incrementally maintains a per-user SQLite index under the operating-system cache
91
+ directory, honors Git ignore rules for working trees, and uses `code-search clean` to remove the
92
+ cached source snapshot and derived metadata.
93
+
94
+ ### Optional agent integration
95
+
96
+ ```bash
97
+ code-search install # Codex remains the default
98
+ code-search install --target cursor # Or select one target explicitly
99
+ ```
100
+
101
+ The bundled `code-search` Agent Skill can be installed for Codex, Claude Code, Cursor, Gemini CLI,
102
+ OpenCode, GitHub Copilot, or Kiro. Installation is user-level and idempotent. It tracks hashes of
103
+ the files it installed, so an untouched older release can upgrade safely while a locally modified
104
+ skill is still protected unless `--force` is supplied. Add `--dry-run` to preview the operation.
105
+ The CLI remains the primary interface; installing the skill adds neither an MCP server nor a runtime
106
+ model.
107
+
108
+ ### Why there is no model underneath
109
+
110
+ Retrieval is deterministic, auditable, and runs entirely on lexical and structural signals: stemmed
111
+ term matching, file-name coverage, structural expansion, and task-role inference. The same query on
112
+ the same tree returns the same evidence, every result explains why it was included, and nothing is
113
+ downloaded at runtime. Model-backed products appear in the public benchmark only as separately
114
+ versioned comparison methods; they are not Code Search runtime dependencies.
115
+
116
+ ## What you get
117
+
118
+ - A concise, de-duplicated evidence set instead of an unbounded list of matches.
119
+ - Source locations, scores, inclusion reasons, evidence roles, provenance, categorical confidence,
120
+ and estimated token cost for every result.
121
+ - Lightweight structural obligations for lifecycle, event, dependency-ordering, and test evidence.
122
+ - Direct reads from a working tree or historical Git revision without changing the checkout.
123
+ - A persistent incremental index that verifies content hashes and reuses unchanged source terms and
124
+ structural boundaries.
125
+ - Optional `code`, `tests`, or `config` scope filters when a task does not need the whole repository.
126
+ - Source indexing across C/C++, C#, Elixir, Go, Haskell, Java, JavaScript/TypeScript, Kotlin, Lua,
127
+ PHP, Python, Ruby, Rust, Scala, shell/Bats, Swift, Zig, and common configuration formats.
128
+ - Model-free structural extraction for Java/Kotlin/Scala, Python, and JavaScript/TypeScript on the
129
+ default path.
130
+ - Compact exact-symbol windows across all indexed source formats when the whole task is an
131
+ identifier or qualified name.
132
+ - A bundled Agent Skill, with user-level filesystem installers for Codex, Claude Code, Cursor,
133
+ Gemini CLI, OpenCode, GitHub Copilot, and Kiro, that teaches the agent when to retrieve, expand,
134
+ or fall back to exact `rg`. Their paths, dry-run behavior, idempotence, safe upgrades, and
135
+ file-protection behavior have automated coverage.
136
+
137
+ ## Task evidence beyond ranked matches
138
+
139
+ A flat result list may return both a target function and a similar working function. For the
140
+ callback patterns it currently supports, Code Search compares them and can label the behavior that
141
+ is present in one path but absent from the other. For supported lifecycle patterns, it can also keep
142
+ separate repair responsibilities in one evidence bundle.
143
+
144
+ | Synthetic case | Code Search task-evidence schema | Neutral flat-result schema |
145
+ |---|---|---|
146
+ | Python callback using `emit` | `missing-behavior` + `comparison` with reasons, provenance, and confidence | source spans + score |
147
+ | TypeScript callback using `dispatchEvent` | `missing-behavior` + `comparison` with reasons, provenance, and confidence | source spans + score |
148
+ | Java/Spring-style startup lifecycle | two explicit `required repair site` responsibilities + subscriber `registration` | source spans + score |
149
+
150
+ From a source checkout, run the synthetic fixtures:
151
+
152
+ ```bash
153
+ uv run python scripts/showcase_evidence.py
154
+ ```
155
+
156
+ The [task-evidence contract](https://github.com/quguai/code-search/blob/main/benchmarks/evidence-showcase/README.md)
157
+ documents the fixture and its
158
+ [generated output](https://github.com/quguai/code-search/blob/main/benchmarks/evidence-showcase/RESULTS.md).
159
+ This is a regression check, not a held-out quality benchmark or a patch-success claim.
160
+
161
+ ## CLI
162
+
163
+ Read a historical revision:
164
+
165
+ ```bash
166
+ code-search retrieve \
167
+ --repo /path/to/repository \
168
+ --ref HEAD~1 \
169
+ --task "Resolve NullPointerException in scheduled dump" \
170
+ --format json
171
+ ```
172
+
173
+ Limit a focused query to conventional test paths and filenames:
174
+
175
+ ```bash
176
+ code-search retrieve \
177
+ --repo /path/to/repository \
178
+ --task "Find regression tests for field naming" \
179
+ --scope tests
180
+ ```
181
+
182
+ `--scope` accepts `all` (the default), `code`, `tests`, or `config`. It filters files before ranking;
183
+ leave it at `all` when a task crosses production code, configuration, and tests.
184
+
185
+ Expand a known anchor to its enclosing unit, siblings, or references:
186
+
187
+ ```bash
188
+ code-search expand \
189
+ --repo /path/to/repository \
190
+ --path src/main/java/example/Service.java \
191
+ --line 120 \
192
+ --relation enclosing
193
+ ```
194
+
195
+ Manage the optional Agent Skill:
196
+
197
+ ```bash
198
+ code-search install # Codex
199
+ code-search install --target claude-code
200
+ code-search install --target cursor
201
+ code-search install --target gemini
202
+ code-search install --target opencode
203
+ code-search install --target github-copilot
204
+ code-search install --target kiro
205
+ code-search install --target detected # Best-effort convenience selector
206
+ code-search install --target detected --dry-run # Preview without writing
207
+ code-search uninstall --target cursor
208
+ code-search uninstall --target detected
209
+ ```
210
+
211
+ The installer writes only managed Skill files and its hash manifest inside the selected agent's
212
+ user configuration:
213
+
214
+ | `--target` | User-level destination |
215
+ |---|---|
216
+ | `codex` | `$CODEX_HOME/skills/code-search/` when set; otherwise `~/.agents/skills/code-search/` |
217
+ | `claude-code` | `$CLAUDE_CONFIG_DIR/skills/code-search/` when set; otherwise `~/.claude/skills/code-search/` |
218
+ | `cursor` | `~/.cursor/skills/code-search/` |
219
+ | `gemini` | `$GEMINI_CLI_HOME/.gemini/skills/code-search/` when set; otherwise `~/.gemini/skills/code-search/` |
220
+ | `opencode` | `$OPENCODE_CONFIG_DIR/skills/code-search/` when set; otherwise `${XDG_CONFIG_HOME:-~/.config}/opencode/skills/code-search/` |
221
+ | `github-copilot` | `$COPILOT_HOME/skills/code-search/` when set; otherwise `~/.copilot/skills/code-search/` |
222
+ | `kiro` | `~/.kiro/skills/code-search/` |
223
+
224
+ Agent-specific environment overrides must be absolute paths; a relative `XDG_CONFIG_HOME` is ignored
225
+ as required by the XDG base-directory specification. An existing legacy Codex installation under
226
+ `~/.codex/skills/code-search/` is updated and removed in place instead of being silently migrated.
227
+
228
+ `detected` is a best-effort convenience selector based on known commands, configuration directories,
229
+ environment overrides, and an already-installed target. It does not launch a client or verify that
230
+ the client can load the skill. Cursor detection deliberately relies on `~/.cursor` rather than the
231
+ ambiguous `agent` executable name. Because some clients also scan another client's compatibility
232
+ directories, prefer an explicit target and use one if the same skill appears more than once.
233
+
234
+ Every selected destination is preflighted before writing or removing files. A small hidden manifest
235
+ records hashes of the managed files; it is installer metadata, not another instruction loaded by the
236
+ agent. This lets an untouched older installation upgrade without treating it as a user edit.
237
+ Uninstall removes only managed files whose content is still recognized and leaves extra user files
238
+ in place. Use `--force` only when you intentionally want to replace or remove a modified managed
239
+ file. `--dry-run` performs the same checks and reports the planned action without changing files.
240
+
241
+ Prewarm, inspect, or remove the per-repository index:
242
+
243
+ ```bash
244
+ code-search index --repo /path/to/repository
245
+ code-search status --repo /path/to/repository
246
+ code-search clean --repo /path/to/repository
247
+ ```
248
+
249
+ ## Benchmark
250
+
251
+ The repository publishes two recorded development comparisons. Both measure
252
+ [Code Search](https://github.com/quguai/code-search),
253
+ [Semble](https://github.com/MinishLab/semble),
254
+ [code-review-graph](https://github.com/tirth8205/code-review-graph), BM25,
255
+ [Probe](https://github.com/probelabs/probe), and
256
+ [ripgrep](https://github.com/BurntSushi/ripgrep). They use different datasets and adapters, so their
257
+ scores must not be merged into one leaderboard. The shared Java runner reproduces all six methods;
258
+ the multilingual public runner currently reproduces BM25, Probe, and ripgrep, while the other three
259
+ rows retain their recorded implementation identities and per-task output. The Code Search rows
260
+ describe the source revisions recorded by each benchmark, not a new measurement of the current release.
261
+
262
+ ### Shared Java comparison
263
+
264
+ The primary comparison uses the same 61 public queries and relevance annotations over pinned Gson,
265
+ Apache Commons Lang, and Jackson Databind revisions.
266
+
267
+ ![Six retrieval methods compared across quality, coverage, latency, and payload](https://raw.githubusercontent.com/quguai/code-search/main/assets/benchmark-quality-speed.png)
268
+
269
+ | Method | NDCG@10 | Recall@10 | MRR@10 | Setup | Query p50 / p95 | Top-10 payload |
270
+ |---|---:|---:|---:|---:|---:|---:|
271
+ | Code Search | **0.8638** | 0.9672 | **0.8463** | 1.809 s | 15.69 / 50.11 ms | 3,058 tok |
272
+ | Semble | 0.8250 | **0.9754** | 0.7852 | 1.550 s | 5.83 / 22.41 ms | 1,803 tok |
273
+ | code-review-graph | 0.7634 | 0.8607 | 0.7670 | 23.744 s | 103.55 / 230.24 ms | 16,161 tok |
274
+ | BM25 | 0.5686 | 0.7623 | 0.5398 | 1.449 s | **1.47 / 3.16 ms** | **1,752 tok** |
275
+ | Probe | 0.2271 | 0.4754 | 0.1649 | — | 586.82 / 952.48 ms | 4,295 tok |
276
+ | ripgrep | 0.1977 | 0.2377 | 0.1904 | — | 32.52 / 61.40 ms | 28,605 tok |
277
+
278
+ No row wins every dimension. On these 61 queries, Code Search has the highest NDCG and MRR; Semble
279
+ has slightly higher Recall, lower query latency, and a smaller payload; BM25 has the lowest query
280
+ latency and payload.
281
+
282
+ NDCG@10 also changes by query type:
283
+
284
+ | Query type | Tasks | Code Search | Semble | code-review-graph | BM25 | Probe | ripgrep |
285
+ |---|---:|---:|---:|---:|---:|---:|---:|
286
+ | Conceptual | 33 | **0.8550** | 0.7869 | 0.7607 | 0.4855 | 0.1794 | 0.0000 |
287
+ | Architecture | 12 | **0.7204** | 0.7068 | 0.4877 | 0.5819 | 0.3044 | 0.0000 |
288
+ | Symbol | 16 | 0.9895 | **0.9923** | 0.9758 | 0.7301 | 0.2678 | 0.7539 |
289
+
290
+ The [shared Java methodology and machine-readable results](https://github.com/quguai/code-search/tree/main/benchmarks/shared-java)
291
+ record exact tool commits, model revisions, repository revisions, adapter definitions, p95 values,
292
+ per-query rows, and reproduction commands.
293
+
294
+ ### Multilingual diagnostic
295
+
296
+ The second comparison uses 30 fixed pre-fix tasks from eight public repositories and eight
297
+ languages. Each language has only three or four tasks, so the heatmap locates weaknesses in this
298
+ sample; it does not establish broad language support.
299
+
300
+ ![NDCG, Recall, and MRR by language for six retrieval methods](https://raw.githubusercontent.com/quguai/code-search/main/assets/benchmark-multilingual.png)
301
+
302
+ | Method | NDCG@10 | Recall@10 | MRR@10 | Warm p50 | Payload p50 |
303
+ |---|---:|---:|---:|---:|---:|
304
+ | Code Search | 0.5026 | 0.7311 | 0.4520 | 18.5 ms | 4,816 tok |
305
+ | Semble | **0.5620** | 0.6700 | **0.5609** | 13.5 ms | 1,750 tok |
306
+ | code-review-graph | 0.3603 | 0.3800 | 0.3944 | 69.7 ms | **734 tok** |
307
+ | BM25 | 0.4973 | **0.7644** | 0.4663 | **0.9 ms** | 70,558 tok |
308
+ | Probe | 0.3084 | 0.6133 | 0.2380 | 1,262.0 ms | 6,982 tok |
309
+ | ripgrep | 0.3954 | 0.7200 | 0.3009 | 473.0 ms | 100,974 tok |
310
+
311
+ BM25 and ripgrep return whole files in this diagnostic, which explains their large payloads. Probe
312
+ returns AST blocks; its file order was identical across five repeated queries on 25 of 30 tasks.
313
+ See the [multilingual methodology and per-language results](https://github.com/quguai/code-search/tree/main/benchmarks/multilingual-30)
314
+ for the adapter definitions and complete records.
315
+
316
+ Both datasets are retrieval-only **development data** that have already been inspected. They do not
317
+ generate patches, run project tests, or run agents. Native result units also differ—evidence spans,
318
+ chunks, graph nodes, AST blocks, and whole files—so setup and payload describe the recorded
319
+ adapters, not every capability of each product. Held-out product claims still require untouched
320
+ tasks, executable patch tests, and repeated agent runs.
321
+
322
+ ## How Code Search fits
323
+
324
+ No retrieval approach is best for every query. The first four rows below generate candidates or
325
+ index source relationships. Code Search builds on lexical candidates, applies lightweight structural
326
+ inference, and organizes selected source as task evidence. It is an evidence layer, not a same-level
327
+ replacement for every retrieval method.
328
+
329
+ | Approach | Typical question | Typical output | Main trade-off |
330
+ |---|---|---|---|
331
+ | Exact text or regex search | Where does this identifier, error string, or literal occur? | Matching lines or small windows | Fast and deterministic, but depends on exact wording and does not infer missing behavior on its own |
332
+ | Lexical or full-text retrieval | Which files share this vocabulary or path context? | Ranked files or spans with lexical scores | Explainable and model-free, but weaker on paraphrases and cross-file relationships |
333
+ | Embedding or hybrid chunk retrieval | Which code expresses this natural-language concept? | Semantically ranked code chunks | Designed to recover conceptual matches, but adds model and index cost; chunk boundaries may omit surrounding evidence |
334
+ | Structural graph or symbol index | Where is this symbol defined, referenced, or related? | Definitions, references, relations, or traversals | Strong for explicit relations, but depends on parser coverage, edge accuracy, and a correct starting anchor |
335
+ | Code Search task-evidence bundle | Which evidence belongs in this bug, change, or review? | De-duplicated source spans with task roles, reasons, provenance, confidence, and payload | Task-role inference is lightweight and rule-based, and the result is not a compiler-grade program graph |
336
+
337
+ These approaches complement each other. Exact search remains the right first tool for a known
338
+ literal. Semantic retrieval helps with conceptual discovery, while a structural index is better for
339
+ deep relation queries. Code Search focuses on deciding which implementation, test, configuration,
340
+ registration, comparison, or repair site belongs in the evidence set for the task.
341
+
342
+ ## How it works
343
+
344
+ The engine incrementally caches source terms and structural boundaries, splits identifiers, expands
345
+ engineering aliases, scores paths and content, identifies task-specific structural obligations,
346
+ contrasts related sibling methods when a callback path is missing expected behavior, detects missing
347
+ subscriber-initialization and dependency edges, focuses long methods into query-aware windows, expands
348
+ selected anchors, and packs non-duplicate evidence into a ranked result set. The differentiating thesis is:
349
+
350
+ > Return not only similar code, but the evidence subgraph required to answer the engineering task.
351
+
352
+ The retrieval path is a transparent lexical/structural engine. For an exact symbol-only query, a
353
+ compact window is promoted only when the literal symbol appears directly after a common declaration
354
+ keyword. The result remains a medium-confidence exact-text anchor, not a parser-verified definition.
355
+ Task roles and structural conclusions are rule-based. Stronger parsers and independent held-out
356
+ validation remain future work.
357
+
358
+ ## Documentation
359
+
360
+ - [Retrieval approaches](https://github.com/quguai/code-search/blob/main/docs/retrieval-approaches.md)
361
+ - [Product thesis and proposed architecture](https://github.com/quguai/code-search/blob/main/docs/product-thesis.md)
362
+ - [MVP implementation](https://github.com/quguai/code-search/blob/main/docs/implementation.md)
363
+ - [Evaluation plan](https://github.com/quguai/code-search/blob/main/docs/evaluation-plan.md)
364
+ - [Evaluation harness](https://github.com/quguai/code-search/blob/main/docs/benchmarking.md)
365
+ - [Reproducible benchmark entry points](https://github.com/quguai/code-search/tree/main/benchmarks)
366
+ - [Public release E2E smoke test](https://github.com/quguai/code-search/blob/main/scripts/e2e_smoke.py)
367
+ - [Shared Java retrieval comparison](https://github.com/quguai/code-search/tree/main/benchmarks/shared-java)
368
+ - [Multilingual development benchmark](https://github.com/quguai/code-search/tree/main/benchmarks/multilingual-30)
369
+ - [Task-evidence fixture](https://github.com/quguai/code-search/blob/main/benchmarks/evidence-showcase/README.md)
370
+ - [PyPI release process](https://github.com/quguai/code-search/blob/main/docs/releasing.md)
371
+
372
+ ## Current gaps
373
+
374
+ - **P0, public held-out validation:** publish at least 30 untouched, license-compatible tasks with
375
+ executable patch tests and repeated model runs.
376
+ - **P1, retrieval quality:** close the long-query ranking gaps surfaced by the multilingual
377
+ diagnostic, and add stronger AST/symbol parsers.
378
+ - **P1, onboarding validation:** expand beyond the seven current user-level Agent Skill destinations
379
+ only when another integration has a real discovery path and automated coverage. Consider MCP only
380
+ if a resident index or structured tool discovery provides a measured benefit over CLI invocation.
381
+ - **P2, distribution:** ship signed standalone binaries.
382
+
383
+ ## Status and independent implementation
384
+
385
+ This is a testable experimental MVP, not a production release. The public development benchmark
386
+ measures retrieval, while the deterministic fixtures and tests cover output behavior and package
387
+ quality. None of them proves held-out retrieval superiority or executable patch success. The
388
+ implementation and bundled Agent Skill are independently designed around the task-evidence workflow.
389
+
390
+ ## License
391
+
392
+ Licensed under the [Apache License 2.0](https://github.com/quguai/code-search/blob/main/LICENSE).