defaults < config.json < .env < env < code
(precedence), and can be set from code with
the config API or
cognee-cli config.
Search
Thesearch and search.hybrid engine sections tune the standard retrievers;
cognee hands them to SearchBuilder::with_tuning (Settings::search_tuning).
Four
Settings fields tune the search orchestrator itself, lowered by the same
Settings::search_tuning:
Triplet retriever hub cap
This caps the triplet search behind the graph completion types (brute_force_triplet_search). It is unrelated to the TRIPLET_COMPLETION
search type, which has been removed.
Measured on a synthetic 100k corpus, a cap of 100 keeps a Jaccard similarity of
0.93–0.96 against the uncapped result set, with a worst query at 0.67; a cap of
200 keeps 0.92–0.93 but has a worst query at 0.18. The latency it buys is small
on a uniform corpus and large on real hub-heavy text (one
graph_completion
search went from 332 ms to 76 ms). Treat it as a knob for a corpus with known
hubs, measured on that corpus, not as a default.
The cap bounds single-query graph search at depth 1 only: it has no effect with
a neighborhood_depth above 1. Batch graph search
(brute_force_triplet_search_batch, several queries at once) loads the whole
graph, as Python’s batch mode does, and the cap does not apply to it — see
Operations: search.
PgGraphAdapter applies the cap in SQL; every other backend gets the same
semantics from GraphDBTrait::get_neighborhood_scoped’s client-side default.
Hybrid retriever knobs
TheHYBRID_COMPLETION search type (SearchType::HybridCompletion) accepts a
set of per-request tuning knobs. These are library / orchestrator-only —
typed Option<...> fields on
SearchParams,
populated from the snake_case JSON keys inside
SearchRequest.retriever_specific_config. They have no env binding.
When a knob is unset the retriever falls back through
retriever_specific_config.<knob> → SearchRequest.top_k capped at 10 → the
HybridRetriever::new constructor default (an explicit per-lane knob is never
capped):
TEMPORAL.
TEMPORAL search (SearchType::Temporal) runs the same hybrid
fetch, so it reads the same keys, with two differences. The fallback above
applies to the HYBRID_COMPLETION lanes only: TEMPORAL’s top_k is
SearchRequest.top_k (5 when unset) and is not capped at 10. And its chunk
and entity lanes are sized by candidate_top_k and its fact lane by top_k,
overriding chunks_top_k / entities_top_k / facts_top_k (text_summaries_top_k
is ignored too: the summary lane follows the chunk lane); the time-window
rerank then cuts the candidates back to top_k. A top_k of 0 or a
candidate_top_k below top_k is rejected with InvalidInput, as in Python.
Chunk-lane fusion. chunk_lane_fusion chooses how the DocumentChunk_text
lane and the TextSummary_text lane are combined:
"relative_score"(default) normalises each lane’s similarities to[0, 1]against that lane’s own candidates and adds them, the summary lane weighted bysummary_lane_weight(the chunk lane always weighs1.0)."reciprocal_rank"is Python’srank_chunk_summary_pairsverbatim — RRF over ranks only.
chunk_lane_fusion = "reciprocal_rank" to get the
Python ranking back.
Truth weighting. use_truth_weight (default false) re-ranks the chunk
lane by truth-subspace alignment with the query. It needs exactly one dataset in
scope and chunk coordinates at the live centroid epoch, which
improve(build_truth_subspace=true) builds from the session’s distilled
learnings; without both, ranking stays at baseline. A failed build keeps the
previous epoch live and reports the build_truth_subspace stage as errored; a
graph backend without truth-state support (GraphDBTrait::supports_truth_state)
reports it as skipped / backend_unsupported. The stage’s record is in
ImproveResult.stages (stages in the bindings’ improve result).
External metadata. Metadata is opt-in and allowlist-only. With
include_external_metadata off (the default), the raw stored value is removed
from returned passage objects and from the completion context. With it on, only
the non-null keys named in external_metadata_keys are returned, and rendered
as key: value lines above the passage. A missing, malformed, or non-object
value yields external_metadata: null and does not fail the search. This is the
query-time side only: cognify does not yet copy document metadata into the
vector payloads, and existing datasets will need re-cognifying once it does
(there is no backfill).
DLT rows. Cognify indexes a DLT row (a document whose external_metadata
has source: "dlt") into DltRow_text, never DocumentChunk_text, as Python
does. This fills the hybrid lanes that were already in place: when
DltRow_text exists, the chunk lane searches it next to DocumentChunk_text
and ranks both as one list, and the entity lane adds DltColumn_properties,
SchemaTable_name and SchemaRelationship_name. A store without DLT data
behaves as before. Graph completion now also searches DltRow_text. Datasets
cognified before this layout need re-cognifying after deleting their old graph
and vector rows; there is no migration.
Global context index. include_global_context_index (default false)
makes HYBRID_COMPLETION prepend the same dataset-scoped root and nearest
bucket summaries as GRAPH_COMPLETION; global_context_index_top_k (default
3) limits the bucket summaries, and a value above 10000 fails the search
with InvalidInput. The index must first be built by improve(), which runs
the global_context_index stage by default (IMPROVE_GLOBAL_CONTEXT_INDEX; see
Operations: improve). Missing or legacy index data
degrades to the ordinary hybrid context instead of failing the search. The
HTTP-facing degradation notes live with the server’s search-router docs, which
are not part of the cognee-rs repository.
Search history
When on, each search (CLI
search / recall, bindings) records one query row
and one result row after retrieval. They carry the searched dataset’s
dataset_id when exactly one dataset was searched. Turn it off with
cognee-cli config set log_search_history false or
COGNEE_LOG_SEARCH_HISTORY=false. This setting is the only switch: the
per-request SearchRequest::save_interaction (saveInteraction /
save_interaction in the bindings) is removed, and CLI search, which used
to skip history, now records it too.
Recall warm-up short-circuit
Before searching the graph, recall checkspipeline_runs for the datasets the
caller can read. When no pipeline has run on them, a graph-only recall
returns one system item with status: "memory_warming_up" instead of
searching; when no build there ever completed and the latest one failed, it
returns status: "build_failed" with the error. Data that was added but not
yet cognified is searched as usual. The check reads no graph or vector store, and treats the graph as
built when it cannot tell. Next to other sources a cold graph contributes
nothing, and an only_context recall always searches.
The CLI recall and the bindings enable the check. A hand-built orchestrator
probes only when given a GraphWarmup (SearchBuilder::with_graph_warmup);
without one, recall searches as before. This is a breaking change for Rust
callers: RecallSource gained a System variant, so an exhaustive match on
it needs a new arm.
Improve (self-improvement loop)
Theimprove engine section is Python’s ImproveConfig (IMPROVE_*).
Settings::improve_config resolves and checks it: a negative count, a negative or
NaN debounce_seconds, a feedback_alpha outside (0, 1], an unknown stage name or the fatal
persist_session_qa in stages_disabled is an error. An explicit improve()
(the CLI verb, the bindings) fails on it; the automatic
improve after a session remember() is skipped with a warning instead, so the
entry is still stored. A removed stage name (triplet_enrichment) is ignored
with a warning. The stages themselves are described in
Operations: improve.
IMPROVE_AUTO_ENABLED, IMPROVE_REVIEW_CONFLICTS and
IMPROVE_GLOBAL_CONTEXT_INDEX accept true|1|yes|on
and false|0|no|off; any other value is ignored with a warning. A numeric
IMPROVE_* env value that does not parse is dropped silently; one that parses
but is out of range is kept and makes the configuration invalid.
Feedback & personalization
Python’sBaseConfig knobs, cognee-wide Settings fields. Each number is
range-checked: out of range is an error from ConfigManager::set (and every
binding / cognee-cli config set), and is ignored with a warning from env.