Skip to content

feat: intelligent review & scan — wire symbol index, code graph, brain search + nomic embed (#455, #456, #457, #458) - #461

Merged
ajianaz merged 5 commits into
developfrom
feature/intelligent-review-scan
Aug 3, 2026
Merged

feat: intelligent review & scan — wire symbol index, code graph, brain search + nomic embed (#455, #456, #457, #458)#461
ajianaz merged 5 commits into
developfrom
feature/intelligent-review-scan

Conversation

@ajianaz

@ajianaz ajianaz commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Wires cora intelligent features (symbol index, code graph, brain search) into cora review and cora scan pipelines, plus replaces hashing-trick embedding with vendored nomic-embed-code.

Changes

Wire vendored nomic-embed-code to brain search (#455)

  • 4 files, +196 linessrc/embed/mod.rs, src/embed/token_vocab.rs, src/index/brain.rs, src/index/vector.rs
  • Adds PretrainedEmbedder that loads vendored nomic-embed-code model (768-dim, 31MB)
  • Brain search now uses real code embeddings instead of deterministic hashing-trick (256-dim)
  • Graceful degradation: falls back to hashing-trick when pretrained model unavailable

Phase 1: Symbol Index → Context Chain (#456)

  • 3 files, +261 linessrc/engine/index_bridge.rs (new), src/engine/context/resolver.rs, src/engine/context/types.rs
  • IndexBridge: lightweight bridge connecting engine to symbol index (SQLite)
  • Context resolution tries index first (fast, accurate), then per-symbol regex fallback
  • New prefer_index config field (default: true)

Phase 2: Code Graph → Blast Radius (#457)

  • Integrated in src/engine/context/resolver.rs
  • resolve_callers_with_bridge(): queries code graph for inbound callers
  • Replaces regex-based caller scan with graph traversal
  • Also collects test file mappings via graph edges

Phase 3: Brain Search → Review & Scan enrichment (#458)

  • 4 files, +129 linessrc/engine/review.rs, src/engine/llm.rs, src/commands/scan.rs
  • Review already had brain enrichment (impact analysis, affected tests, semantic search)
  • Added brain enrichment to scan pipeline: high-impact symbols + affected tests
  • Single-pass symbol collection with dedup (optimized from N+1 query pattern)

Bug fixes

  • Per-symbol regex fallback for unindexed symbols (fixes silent drop on partial/stale index)
  • Fixed missing prefer_index field in test fixtures

Stats

  • 11 files changed, +742 -76 lines
  • 787 tests passing, 0 failures
  • Cora review: 0 issues
  • Graceful degradation: all features degrade to existing behavior when index unavailable

Closes #455, Closes #456, Closes #457, Closes #458

ajianaz added 5 commits August 3, 2026 08:15
- Feature-gate DEFAULT_DIMS in vector.rs: 768d with pretrained-embed, 256d fallback
- Add embed_code_dispatch() in embed/mod.rs for unified backend selection
- Update brain.rs to use embed_code_dispatch instead of direct embed_code()
- Add check_dimension_compat() to detect stale index from different backend
- Auto-remove stale index on dimension mismatch with re-index warning
- Add embed_code_pretrained() convenience function in token_vocab.rs
- Remove #[allow(dead_code)] from token_vocab.rs (now actively used)

Compiles cleanly with both --features pretrained-embed and default features.
…457)

- Add IndexBridge: lightweight bridge between engine and symbol index
  - Opens cora.db if available, graceful degradation if not
  - Exposes search_symbols(), find_callers(), brain_search(), impact_analysis()
- Wire symbol index to context chain (Phase 1):
  - resolve_via_index() queries SQLite symbols table instead of regex+fs scan
  - Falls back to regex-based resolution when index unavailable
  - prefer_index config flag (default: true)
- Wire code graph to blast radius (Phase 2):
  - resolve_callers_with_bridge() uses graph find_callers() instead of regex
  - Falls back to regex scan if graph unavailable
- Extract build_context_chain_with_bridge() for testability
- Add prefer_index: bool to ContextConfig

Compiles cleanly (cargo check + pretrained-embed feature).
- Add brain_context parameter to scan_files() in LLM layer
- Build brain context once per scan (impact analysis + affected tests)
- Inject Code Intelligence section into scan LLM prompt
- Make build_brain_context() pub(crate) for reuse
- Add build_scan_brain_context() for file-list-based brain queries
- Fix missing prefer_index field in ContextConfig test fixtures

All 787 tests passing.
- resolve_via_index now returns unresolved symbols for per-symbol
  regex fallback (fixes silent drop of unindexed symbols)
- Optimize build_scan_brain_context: single-pass symbol collection
  with dedup, eliminating N+1 query pattern
- Fix missing prefer_index field in ContextConfig test fixtures

All 787 tests passing. Cora review: 0 issues.
- Fix brain.rs:266 field access formatting (b.1 .0 → b.1.0)
- Add #[expect(dead_code)] to has_pretrained() in embed/mod.rs
  (function will be used by Phase 3+ features)
- Apply cargo fmt to resolver.rs, index_bridge.rs, review.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment