# Configure local and remote retrieval

Source: https://usecns.dev/engram-topic-configure-local-and-remote-retrieval/

[Start here](https://usecns.dev/manual-engram/)
[CLI commands](https://usecns.dev/commands-engram/)
[Configuration & integration](https://usecns.dev/engram-topics/)

Start with the offline default: deterministic 128-dimensional local feature hashing plus lexical/graph retrieval. Remote embeddings and a reranker are optional configured services. Local and remote dense vectors use separate storage so a dimension change does not make the local channel disappear.

Configure `[retrieval]` provider, endpoint, model, dimensions and connect/request timeouts. `remote-openai` needs a real endpoint and model. Configure `[retrieval.reranker]` separately: enablement, provider (`vllm-rerank`), endpoint/model, prompt template, instruction, candidate count, protected dense-candidate count, minimum score and timeout/fail-open policy. Built-in candidate settings are 20 candidates and 5 guaranteed dense candidates; defaults include 200 ms connect and 2,500 ms request limits, with fail-open enabled. Validate the actual OTE rather than copying a historical endpoint.

Environment choices include `ENGRAM_EMBEDDING_ENDPOINT`, `ENGRAM_EMBEDDING_MODEL`, `ENGRAM_RERANKER_ENDPOINT`, `ENGRAM_RERANKER_MODEL`, and `THALAMUS_URL` endpoint fallback. Inspect the effective target without printing credentials. Remote retrieval sends query/document material to that service: require authorization for the selected corpus.

Use `engram doctor` for SQLite/OTE health and `engram doctor --backfill-embeddings` to populate missing remote dense embeddings after offline mint/import. Backfill may contact the configured model endpoint. Fail-open fallback preserves availability, not equivalent relevance or an error-free run; inspect warnings. Do not tune thresholds against the same sealed evaluation set used to claim independent verification.