code-search-cli 0.1.0__tar.gz → 0.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 (72) hide show
  1. code_search_cli-0.2.0/.gitignore +37 -0
  2. code_search_cli-0.2.0/MANIFEST.in +4 -0
  3. code_search_cli-0.2.0/NOTICE +4 -0
  4. code_search_cli-0.2.0/PKG-INFO +345 -0
  5. code_search_cli-0.2.0/README.md +321 -0
  6. code_search_cli-0.2.0/benchmarks/README.md +39 -0
  7. code_search_cli-0.2.0/benchmarks/evidence-showcase/README.md +24 -0
  8. code_search_cli-0.2.0/benchmarks/evidence-showcase/RESULTS.md +38 -0
  9. code_search_cli-0.2.0/benchmarks/evidence-showcase/java-lifecycle/PublisherNotifier.java +9 -0
  10. code_search_cli-0.2.0/benchmarks/evidence-showcase/java-lifecycle/ReceiverUtil.java +9 -0
  11. code_search_cli-0.2.0/benchmarks/evidence-showcase/java-lifecycle/StartupService.java +8 -0
  12. code_search_cli-0.2.0/benchmarks/evidence-showcase/python/settings.py +6 -0
  13. code_search_cli-0.2.0/benchmarks/evidence-showcase/typescript/settings.ts +7 -0
  14. code_search_cli-0.2.0/benchmarks/multilingual-30/README.md +178 -0
  15. code_search_cli-0.2.0/benchmarks/multilingual-30/RESULTS.json +9250 -0
  16. code_search_cli-0.2.0/benchmarks/multilingual-30/TASK_IDS.json +189 -0
  17. code_search_cli-0.2.0/benchmarks/multilingual-30/prepare_manifest.py +271 -0
  18. code_search_cli-0.2.0/benchmarks/multilingual-30/prepare_snapshots.py +278 -0
  19. code_search_cli-0.2.0/benchmarks/multilingual-30/run_baselines.py +1034 -0
  20. code_search_cli-0.2.0/benchmarks/render_charts.py +321 -0
  21. code_search_cli-0.2.0/benchmarks/shared-java/README.md +151 -0
  22. code_search_cli-0.2.0/benchmarks/shared-java/RESULTS.json +5676 -0
  23. code_search_cli-0.2.0/benchmarks/shared-java/crg_worker.py +37 -0
  24. code_search_cli-0.2.0/benchmarks/shared-java/run_benchmark.py +774 -0
  25. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/pyproject.toml +6 -3
  26. code_search_cli-0.2.0/scripts/benchmark_tasks.py +36 -0
  27. code_search_cli-0.2.0/scripts/compare_retrievers.py +288 -0
  28. code_search_cli-0.2.0/scripts/e2e_smoke.py +199 -0
  29. code_search_cli-0.2.0/scripts/evaluate_benchmark.py +111 -0
  30. code_search_cli-0.2.0/scripts/evaluate_models.py +327 -0
  31. code_search_cli-0.2.0/scripts/showcase_evidence.py +218 -0
  32. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/cli.py +36 -6
  33. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/engine.py +296 -19
  34. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/index_store.py +30 -13
  35. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/models.py +17 -2
  36. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/query.py +45 -1
  37. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/repository.py +69 -7
  38. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/resources/code-search/SKILL.md +8 -3
  39. code_search_cli-0.2.0/src/code_retrieval/structure.py +195 -0
  40. code_search_cli-0.2.0/src/code_search_cli.egg-info/PKG-INFO +345 -0
  41. code_search_cli-0.2.0/src/code_search_cli.egg-info/SOURCES.txt +60 -0
  42. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/tests/test_benchmark_scripts.py +0 -51
  43. code_search_cli-0.2.0/tests/test_cli.py +36 -0
  44. code_search_cli-0.2.0/tests/test_engine.py +438 -0
  45. code_search_cli-0.2.0/tests/test_golden_output.py +159 -0
  46. code_search_cli-0.2.0/tests/test_index_store.py +207 -0
  47. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/tests/test_installer.py +4 -0
  48. code_search_cli-0.2.0/tests/test_release_hygiene.py +211 -0
  49. code_search_cli-0.2.0/tests/test_repository.py +66 -0
  50. code_search_cli-0.2.0/tests/test_showcase_evidence.py +36 -0
  51. code_search_cli-0.2.0/tests/test_structure.py +159 -0
  52. code_search_cli-0.2.0/uv.lock +14 -0
  53. code_search_cli-0.1.0/NOTICE +0 -7
  54. code_search_cli-0.1.0/PKG-INFO +0 -287
  55. code_search_cli-0.1.0/README.md +0 -266
  56. code_search_cli-0.1.0/src/code_retrieval/structure.py +0 -115
  57. code_search_cli-0.1.0/src/code_search_cli.egg-info/PKG-INFO +0 -287
  58. code_search_cli-0.1.0/src/code_search_cli.egg-info/SOURCES.txt +0 -28
  59. code_search_cli-0.1.0/tests/test_engine.py +0 -191
  60. code_search_cli-0.1.0/tests/test_index_store.py +0 -97
  61. code_search_cli-0.1.0/tests/test_release_hygiene.py +0 -43
  62. code_search_cli-0.1.0/tests/test_structure.py +0 -29
  63. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/LICENSE +0 -0
  64. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/setup.cfg +0 -0
  65. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/__init__.py +0 -0
  66. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/__main__.py +0 -0
  67. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/installer.py +0 -0
  68. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_retrieval/resources/code-search/agents/openai.yaml +0 -0
  69. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_search_cli.egg-info/dependency_links.txt +0 -0
  70. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_search_cli.egg-info/entry_points.txt +0 -0
  71. {code_search_cli-0.1.0 → code_search_cli-0.2.0}/src/code_search_cli.egg-info/top_level.txt +0 -0
  72. {code_search_cli-0.1.0 → code_search_cli-0.2.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,345 @@
1
+ Metadata-Version: 2.4
2
+ Name: code-search-cli
3
+ Version: 0.2.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,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="Codex skill included" src="https://img.shields.io/badge/Codex-skill_included-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 Codex integration
95
+
96
+ ```bash
97
+ code-search install
98
+ ```
99
+
100
+ This installs the bundled `code-search` skill into Codex. Restart Codex so it can discover the
101
+ skill. The installer is idempotent and refuses to overwrite a locally modified skill unless
102
+ `--force` is supplied.
103
+
104
+ ### Why there is no model underneath
105
+
106
+ Retrieval is deterministic, auditable, and runs entirely on lexical and structural signals: stemmed
107
+ term matching, file-name coverage, structural expansion, and task-role inference. The same query on
108
+ the same tree returns the same evidence, every result explains why it was included, and nothing is
109
+ downloaded at runtime. Model-backed products appear in the public benchmark only as separately
110
+ versioned comparison methods; they are not Code Search runtime dependencies.
111
+
112
+ ## What you get
113
+
114
+ - A concise, de-duplicated evidence set instead of an unbounded list of matches.
115
+ - Source locations, scores, inclusion reasons, evidence roles, provenance, categorical confidence,
116
+ and estimated token cost for every result.
117
+ - Lightweight structural obligations for lifecycle, event, dependency-ordering, and test evidence.
118
+ - Direct reads from a working tree or historical Git revision without changing the checkout.
119
+ - A persistent incremental index that verifies content hashes and reuses unchanged source terms and
120
+ structural boundaries.
121
+ - Optional `code`, `tests`, or `config` scope filters when a task does not need the whole repository.
122
+ - Source indexing across C/C++, C#, Elixir, Go, Haskell, Java, JavaScript/TypeScript, Kotlin, Lua,
123
+ PHP, Python, Ruby, Rust, Scala, shell/Bats, Swift, Zig, and common configuration formats.
124
+ - Model-free structural extraction for Java/Kotlin/Scala, Python, and JavaScript/TypeScript on the
125
+ default path.
126
+ - Compact exact-symbol windows across all indexed source formats when the whole task is an
127
+ identifier or qualified name.
128
+ - A bundled Codex skill that teaches the agent when to retrieve, expand, or fall back to exact `rg`.
129
+
130
+ ## Task evidence beyond ranked matches
131
+
132
+ A flat result list may return both a target function and a similar working function. For the
133
+ callback patterns it currently supports, Code Search compares them and can label the behavior that
134
+ is present in one path but absent from the other. For supported lifecycle patterns, it can also keep
135
+ separate repair responsibilities in one evidence bundle.
136
+
137
+ | Synthetic case | Code Search task-evidence schema | Neutral flat-result schema |
138
+ |---|---|---|
139
+ | Python callback using `emit` | `missing-behavior` + `comparison` with reasons, provenance, and confidence | source spans + score |
140
+ | TypeScript callback using `dispatchEvent` | `missing-behavior` + `comparison` with reasons, provenance, and confidence | source spans + score |
141
+ | Java/Spring-style startup lifecycle | two explicit `required repair site` responsibilities + subscriber `registration` | source spans + score |
142
+
143
+ From a source checkout, run the synthetic fixtures:
144
+
145
+ ```bash
146
+ uv run python scripts/showcase_evidence.py
147
+ ```
148
+
149
+ The [task-evidence contract](https://github.com/quguai/code-search/blob/main/benchmarks/evidence-showcase/README.md)
150
+ documents the fixture and its
151
+ [generated output](https://github.com/quguai/code-search/blob/main/benchmarks/evidence-showcase/RESULTS.md).
152
+ This is a regression check, not a held-out quality benchmark or a patch-success claim.
153
+
154
+ ## CLI
155
+
156
+ Read a historical revision:
157
+
158
+ ```bash
159
+ code-search retrieve \
160
+ --repo /path/to/repository \
161
+ --ref HEAD~1 \
162
+ --task "Resolve NullPointerException in scheduled dump" \
163
+ --format json
164
+ ```
165
+
166
+ Limit a focused query to conventional test paths and filenames:
167
+
168
+ ```bash
169
+ code-search retrieve \
170
+ --repo /path/to/repository \
171
+ --task "Find regression tests for field naming" \
172
+ --scope tests
173
+ ```
174
+
175
+ `--scope` accepts `all` (the default), `code`, `tests`, or `config`. It filters files before ranking;
176
+ leave it at `all` when a task crosses production code, configuration, and tests.
177
+
178
+ Expand a known anchor to its enclosing unit, siblings, or references:
179
+
180
+ ```bash
181
+ code-search expand \
182
+ --repo /path/to/repository \
183
+ --path src/main/java/example/Service.java \
184
+ --line 120 \
185
+ --relation enclosing
186
+ ```
187
+
188
+ Manage the Codex skill:
189
+
190
+ ```bash
191
+ code-search install
192
+ code-search uninstall
193
+ ```
194
+
195
+ Prewarm, inspect, or remove the per-repository index:
196
+
197
+ ```bash
198
+ code-search index --repo /path/to/repository
199
+ code-search status --repo /path/to/repository
200
+ code-search clean --repo /path/to/repository
201
+ ```
202
+
203
+ ## Benchmark
204
+
205
+ The repository publishes two recorded development comparisons. Both measure
206
+ [Code Search](https://github.com/quguai/code-search),
207
+ [Semble](https://github.com/MinishLab/semble),
208
+ [code-review-graph](https://github.com/tirth8205/code-review-graph), BM25,
209
+ [Probe](https://github.com/probelabs/probe), and
210
+ [ripgrep](https://github.com/BurntSushi/ripgrep). They use different datasets and adapters, so their
211
+ scores must not be merged into one leaderboard. The shared Java runner reproduces all six methods;
212
+ the multilingual public runner currently reproduces BM25, Probe, and ripgrep, while the other three
213
+ rows retain their recorded implementation identities and per-task output. The Code Search rows
214
+ describe the source revisions recorded by each benchmark, not a new measurement of version 0.2.0.
215
+
216
+ ### Shared Java comparison
217
+
218
+ The primary comparison uses the same 61 public queries and relevance annotations over pinned Gson,
219
+ Apache Commons Lang, and Jackson Databind revisions.
220
+
221
+ ![Six retrieval methods compared across quality, coverage, latency, and payload](https://raw.githubusercontent.com/quguai/code-search/main/assets/benchmark-quality-speed.png)
222
+
223
+ | Method | NDCG@10 | Recall@10 | MRR@10 | Setup | Query p50 / p95 | Top-10 payload |
224
+ |---|---:|---:|---:|---:|---:|---:|
225
+ | Code Search | **0.8638** | 0.9672 | **0.8463** | 1.809 s | 15.69 / 50.11 ms | 3,058 tok |
226
+ | Semble | 0.8250 | **0.9754** | 0.7852 | 1.550 s | 5.83 / 22.41 ms | 1,803 tok |
227
+ | code-review-graph | 0.7634 | 0.8607 | 0.7670 | 23.744 s | 103.55 / 230.24 ms | 16,161 tok |
228
+ | BM25 | 0.5686 | 0.7623 | 0.5398 | 1.449 s | **1.47 / 3.16 ms** | **1,752 tok** |
229
+ | Probe | 0.2271 | 0.4754 | 0.1649 | — | 586.82 / 952.48 ms | 4,295 tok |
230
+ | ripgrep | 0.1977 | 0.2377 | 0.1904 | — | 32.52 / 61.40 ms | 28,605 tok |
231
+
232
+ No row wins every dimension. On these 61 queries, Code Search has the highest NDCG and MRR; Semble
233
+ has slightly higher Recall, lower query latency, and a smaller payload; BM25 has the lowest query
234
+ latency and payload.
235
+
236
+ NDCG@10 also changes by query type:
237
+
238
+ | Query type | Tasks | Code Search | Semble | code-review-graph | BM25 | Probe | ripgrep |
239
+ |---|---:|---:|---:|---:|---:|---:|---:|
240
+ | Conceptual | 33 | **0.8550** | 0.7869 | 0.7607 | 0.4855 | 0.1794 | 0.0000 |
241
+ | Architecture | 12 | **0.7204** | 0.7068 | 0.4877 | 0.5819 | 0.3044 | 0.0000 |
242
+ | Symbol | 16 | 0.9895 | **0.9923** | 0.9758 | 0.7301 | 0.2678 | 0.7539 |
243
+
244
+ The [shared Java methodology and machine-readable results](https://github.com/quguai/code-search/tree/main/benchmarks/shared-java)
245
+ record exact tool commits, model revisions, repository revisions, adapter definitions, p95 values,
246
+ per-query rows, and reproduction commands.
247
+
248
+ ### Multilingual diagnostic
249
+
250
+ The second comparison uses 30 fixed pre-fix tasks from eight public repositories and eight
251
+ languages. Each language has only three or four tasks, so the heatmap locates weaknesses in this
252
+ sample; it does not establish broad language support.
253
+
254
+ ![NDCG, Recall, and MRR by language for six retrieval methods](https://raw.githubusercontent.com/quguai/code-search/main/assets/benchmark-multilingual.png)
255
+
256
+ | Method | NDCG@10 | Recall@10 | MRR@10 | Warm p50 | Payload p50 |
257
+ |---|---:|---:|---:|---:|---:|
258
+ | Code Search | 0.5026 | 0.7311 | 0.4520 | 18.5 ms | 4,816 tok |
259
+ | Semble | **0.5620** | 0.6700 | **0.5609** | 13.5 ms | 1,750 tok |
260
+ | code-review-graph | 0.3603 | 0.3800 | 0.3944 | 69.7 ms | **734 tok** |
261
+ | BM25 | 0.4973 | **0.7644** | 0.4663 | **0.9 ms** | 70,558 tok |
262
+ | Probe | 0.3084 | 0.6133 | 0.2380 | 1,262.0 ms | 6,982 tok |
263
+ | ripgrep | 0.3954 | 0.7200 | 0.3009 | 473.0 ms | 100,974 tok |
264
+
265
+ BM25 and ripgrep return whole files in this diagnostic, which explains their large payloads. Probe
266
+ returns AST blocks; its file order was identical across five repeated queries on 25 of 30 tasks.
267
+ See the [multilingual methodology and per-language results](https://github.com/quguai/code-search/tree/main/benchmarks/multilingual-30)
268
+ for the adapter definitions and complete records.
269
+
270
+ Both datasets are retrieval-only **development data** that have already been inspected. They do not
271
+ generate patches, run project tests, or run agents. Native result units also differ—evidence spans,
272
+ chunks, graph nodes, AST blocks, and whole files—so setup and payload describe the recorded
273
+ adapters, not every capability of each product. Held-out product claims still require untouched
274
+ tasks, executable patch tests, and repeated agent runs.
275
+
276
+ ## How Code Search fits
277
+
278
+ No retrieval approach is best for every query. The first four rows below generate candidates or
279
+ index source relationships. Code Search builds on lexical candidates, applies lightweight structural
280
+ inference, and organizes selected source as task evidence. It is an evidence layer, not a same-level
281
+ replacement for every retrieval method.
282
+
283
+ | Approach | Typical question | Typical output | Main trade-off |
284
+ |---|---|---|---|
285
+ | 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 |
286
+ | 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 |
287
+ | 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 |
288
+ | 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 |
289
+ | 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 |
290
+
291
+ These approaches complement each other. Exact search remains the right first tool for a known
292
+ literal. Semantic retrieval helps with conceptual discovery, while a structural index is better for
293
+ deep relation queries. Code Search focuses on deciding which implementation, test, configuration,
294
+ registration, comparison, or repair site belongs in the evidence set for the task.
295
+
296
+ ## How it works
297
+
298
+ The engine incrementally caches source terms and structural boundaries, splits identifiers, expands
299
+ engineering aliases, scores paths and content, identifies task-specific structural obligations,
300
+ contrasts related sibling methods when a callback path is missing expected behavior, detects missing
301
+ subscriber-initialization and dependency edges, focuses long methods into query-aware windows, expands
302
+ selected anchors, and packs non-duplicate evidence into a ranked result set. The differentiating thesis is:
303
+
304
+ > Return not only similar code, but the evidence subgraph required to answer the engineering task.
305
+
306
+ The retrieval path is a transparent lexical/structural engine. For an exact symbol-only query, a
307
+ compact window is promoted only when the literal symbol appears directly after a common declaration
308
+ keyword. The result remains a medium-confidence exact-text anchor, not a parser-verified definition.
309
+ Task roles and structural conclusions are rule-based. Stronger parsers and independent held-out
310
+ validation remain future work.
311
+
312
+ ## Documentation
313
+
314
+ - [Retrieval approaches](https://github.com/quguai/code-search/blob/main/docs/retrieval-approaches.md)
315
+ - [Product thesis and proposed architecture](https://github.com/quguai/code-search/blob/main/docs/product-thesis.md)
316
+ - [MVP implementation](https://github.com/quguai/code-search/blob/main/docs/implementation.md)
317
+ - [Evaluation plan](https://github.com/quguai/code-search/blob/main/docs/evaluation-plan.md)
318
+ - [Evaluation harness](https://github.com/quguai/code-search/blob/main/docs/benchmarking.md)
319
+ - [Reproducible benchmark entry points](https://github.com/quguai/code-search/tree/main/benchmarks)
320
+ - [Public release E2E smoke test](https://github.com/quguai/code-search/blob/main/scripts/e2e_smoke.py)
321
+ - [Shared Java retrieval comparison](https://github.com/quguai/code-search/tree/main/benchmarks/shared-java)
322
+ - [Multilingual development benchmark](https://github.com/quguai/code-search/tree/main/benchmarks/multilingual-30)
323
+ - [Task-evidence fixture](https://github.com/quguai/code-search/blob/main/benchmarks/evidence-showcase/README.md)
324
+ - [PyPI release process](https://github.com/quguai/code-search/blob/main/docs/releasing.md)
325
+
326
+ ## Current gaps
327
+
328
+ - **P0, public held-out validation:** publish at least 30 untouched, license-compatible tasks with
329
+ executable patch tests and repeated model runs.
330
+ - **P1, retrieval quality:** close the long-query ranking gaps surfaced by the multilingual
331
+ diagnostic, and add stronger AST/symbol parsers.
332
+ - **P1, onboarding breadth:** add safe CLI/skill installers for more coding agents. Consider MCP only
333
+ if a resident index or structured tool discovery provides a measured benefit over CLI invocation.
334
+ - **P2, distribution:** ship signed standalone binaries.
335
+
336
+ ## Status and independent implementation
337
+
338
+ This is a testable experimental MVP, not a production release. The public development benchmark
339
+ measures retrieval, while the deterministic fixtures and tests cover output behavior and package
340
+ quality. None of them proves held-out retrieval superiority or executable patch success. The
341
+ implementation and bundled Codex skill are independently designed around the task-evidence workflow.
342
+
343
+ ## License
344
+
345
+ Licensed under the [Apache License 2.0](https://github.com/quguai/code-search/blob/main/LICENSE).