Scope
refactron/rag/indexer.py (RAGIndexer) and refactron/rag/retriever.py (ContextRetriever)
Problem
Both classes construct SentenceTransformer(embedding_model) in __init__. Loading the model twice in one process duplicates memory and startup latency (common in workflows: index then query, or repeated CLI invocations if embedder is ever kept warm).
Suggested direction
- Introduce a small factory or module-level LRU keyed by
(model_name, device), or allow injecting a shared SentenceTransformer instance into both classes.
- Keep backward-compatible defaults.
Acceptance
- Single-model workflows only load weights once; public API still works without callers passing a custom instance.
Scope
refactron/rag/indexer.py(RAGIndexer) andrefactron/rag/retriever.py(ContextRetriever)Problem
Both classes construct
SentenceTransformer(embedding_model)in__init__. Loading the model twice in one process duplicates memory and startup latency (common in workflows: index then query, or repeated CLI invocations if embedder is ever kept warm).Suggested direction
(model_name, device), or allow injecting a sharedSentenceTransformerinstance into both classes.Acceptance