Semantic Units
Whole functions/classes/methods — not arbitrary text chunks.
A local code-retrieval engine that parses Python and C++ into semantic CodeUnits, combines lexical and dense retrieval with program structure, and compiles explainable results into token-budgeted context.
286 tests · Python + C++ · Local-first · M0–M10 complete
Current implemented architecture — not a roadmap.
Incremental maintenance path
SHA-256 ChangeSet → incremental semantic analysis → relation refresh → transactional persistence → selective vector reuse
Whole functions/classes/methods — not arbitrary text chunks.
Lexical + dense rankings fused with reciprocal rank fusion.
Depth-1 RESOLVED structural neighbors support candidate ranking.
Whole CodeUnits packed under an explicit token budget.
Loading showcase query…
Gold target: store.save_order
Lower rank is better.
The engine does not only return a similarity score. Structured reranking records the prior graph rank, per-relation RRF contributions, directional evidence, and final rank delta.
aicode search --mode reranked --explain
symbol: store.save_order
rerank: #3 → #5 (delta -2)
contributions:
graph_base rank=3 rrf=0.015873
calls rank=5 rrf=0.015385
evidence:
checkout.finalize_checkout [rank 1]
CALLS · seed_to_candidate
Intentionally a negative structural example — graph fusion displaced the gold target.
24 hand-labeled queries · 11 files · 53 CodeUnits · Python
Source: committed canonical evaluation artifacts
Dense retrieval performed best in aggregate on the included benchmark. Graph-neighbor fusion often displaced already-correct text results, and the structured reranker sometimes amplified that reordering.
This is benchmark-specific evidence, not a universal claim.
Avoided semantic-analysis and embedding work — not wall-clock speed claims.
Source: committed canonical evaluation artifacts
Whole CodeUnits · greedy skip-to-fit · overlap suppression · no partial
source truncation · simple-lexical-v1 is an estimator, not a vendor tokenizer.
checkout.finalize_checkout
checkout.compute_order_subtotal
policies.ChargePolicy
store.save_order
notifications.notify_order_confirmed
validation.validate_order_customer
users.normalize_emailcheckout.finalize_checkoutstore.save_orderRelations: CALLS · IMPORTS · INHERITS · CONTAINS
pricing::calculate(int)pricing::calculate(double)ui::Widget::Widget(int)ui::Widget::~Widget()ui::Widget::operator==(const Widget&) const@filelocal:local_a.cpp::<anonymous>::helper()calculate(int) ≠ calculate(double)
Tree-sitter syntax analysis, not compiler-grade C++ semantics. No C++ REFERENCES baseline. Single language per index snapshot.