Expand description
codemem-engine: Domain logic engine for the Codemem memory system.
This crate contains all business logic, orchestration, and domain operations:
- index — ast-grep based code indexing, symbol extraction, reference resolution
- hooks — Lifecycle hook handlers (PostToolUse, SessionStart, Stop)
- watch — Real-time file watching with debouncing and .gitignore support
- bm25 — Okapi BM25 scoring with code-aware tokenization
- scoring — 9-component hybrid scoring for memory recall
- patterns — Cross-session pattern detection
- compress — Optional LLM-powered observation compression
- metrics — Operational metrics collection
Re-exports§
pub use index::ChunkConfig;pub use index::CodeChunk;pub use index::CodeParser;pub use index::Dependency;pub use index::IndexAndResolveResult;pub use index::IndexProgress;pub use index::IndexResult;pub use index::Indexer;pub use index::ManifestResult;pub use index::ParseResult;pub use index::Reference;pub use index::ReferenceKind;pub use index::ReferenceResolver;pub use index::ResolvedEdge;pub use index::Symbol;pub use index::SymbolKind;pub use index::Visibility;pub use index::Workspace;pub use bm25::Bm25Index;pub use metrics::InMemoryMetrics;pub use enrichment::EnrichResult;pub use enrichment::EnrichmentPipelineResult;pub use persistence::edge_weight_for;pub use persistence::IndexPersistResult;pub use recall::ExpandedResult;pub use recall::NamespaceStats;pub use recall::RecallQuery;pub use search::CodeSearchResult;pub use search::SummaryTreeNode;pub use search::SymbolSearchResult;pub use analysis::DecisionChain;pub use analysis::DecisionConnection;pub use analysis::DecisionEntry;pub use analysis::ImpactResult;pub use analysis::SessionCheckpointReport;
Modules§
- analysis
- Analysis domain logic: impact-aware recall, decision chains, session checkpoints.
- bm25
- BM25 scoring module for code-aware text ranking.
- compress
- LLM-powered observation compression for Codemem.
- consolidation
- Consolidation logic for the Codemem memory engine.
- enrichment
- Enrichment logic: store_insight, git history, security, performance, complexity, architecture, test mapping, API surface, doc coverage, change impact, code smells, hot+complex correlation, blame/ownership, enhanced security scanning, and quality stratification.
- graph_
ops - Engine facade methods for graph algorithms.
- hooks
- Hooks module: PostToolUse hook handler for passive capture from AI coding assistants.
- index
- Code indexing engine: ast-grep based code parsing, symbol extraction, reference resolution, and incremental indexing.
- insights
- Insight aggregation domain logic.
- metrics
- In-memory metrics collector for operational metrics.
- patterns
- Cross-session pattern detection for Codemem.
- pca
- persistence
- Graph persistence: persist indexing results (file/package/symbol/chunk nodes, edges, embeddings, compaction) into the storage and graph backends.
- recall
- Memory recall with hybrid scoring.
- scoring
- Hybrid scoring for memory recall.
- search
- Code search and summary tree domain logic.
- watch
- Watch module: Real-time file watcher for Codemem.
Structs§
- Analyze
Options - Options for the unified
analyze()pipeline. - Analyze
Result - Result of the unified
analyze()pipeline. - Codemem
Engine - Core domain engine holding all backends and domain state.
- Embedding
Service - Embedding service with Candle inference (no internal cache — use
CachedProviderwrapper). - Graph
Engine - In-memory graph engine backed by petgraph, synced to SQLite via codemem-storage.
- Hnsw
Index - HNSW vector index backed by usearch.
- Index
Cache - Cached code-index results for structural queries.
- Session
Context - Session context synthesized at session start.
- Split
Part - A part descriptor for
split_memory(). - Storage
- SQLite-backed storage for Codemem memories, embeddings, and graph data.
Enums§
- Analyze
Progress - Progress events emitted during analysis.
Traits§
- Embedding
Provider - Trait for pluggable embedding providers.
Functions§
- embeddings_
from_ env - Create an embedding provider from environment configuration. Create an embedding provider from environment variables.