cognee-cli crate.
It drives the full pipeline and is also the on-device (Android) runner. Run
cognee-cli <command> --help for the authoritative flag list; the clap
definitions are in crates/cli/src/cli.rs.
Subcommands
The memory API verbs (remember / recall / improve / forget) are the
primary surface; the add / cognify / search commands below them
are the lower-level pipeline they compose. All of these are always built (not
feature-gated).
The feature-gated commands are enabled in the default build of
cognee-cli
(except platform-specific ones). See Architecture: feature strategy.
Cloud serve / disconnect are not part of OSS.
Memory API
The four primary verbs cover the common workflow end-to-end:remember with a --session-id records session memory; without one it persists
permanent, graph-backed memory. recall is session-aware and graph-backed; with
no -t/--query-type it auto-routes to a suitable retrieval strategy.
Lower-level pipeline
The memory verbs composeadd → cognify → search, which you can also drive
directly for fine-grained control (remember ≈ add + cognify + improve;
recall ≈ auto-routed search):
cognify run that completes with failures recorded (tolerated summarization
failures, or items no document type matched) prints one extra WARN line per dataset
(cognify completed with failures — …), naming the counts and the first ten
failed data ids (… (first 10 of N) beyond that), and saying whether a re-run
would pick the outstanding documents up. A clean run prints nothing extra. The
run’s COMPLETED row stays {}; the failure report is the returned
result, not a run_info key. Which failures are tolerated at all
is the failure policy in
Configuration: cognify failure handling; the default
errors the run instead.
-t/--query-type on search / recall accepts GRAPH_COMPLETION,
HYBRID_COMPLETION, RAG_COMPLETION, CHUNKS, SUMMARIES, CODE, CYPHER
and TEMPORAL (the QueryTypeArg enum in
crates/cli/src/cli.rs;
see also cognee-cli search --help). search defaults to HYBRID_COMPLETION.
The library’s SearchType enum is larger (18 types — see
Operations: search), but the other types are not
exposed as CLI values yet. The hybrid retriever’s tuning knobs are not exposed as
CLI flags either — see
Configuration: hybrid retriever knobs.
CODE search
-t CODE runs the deterministic code-graph search
(SearchType::Code)
over a dataset’s code graph (written by remember --content-type code or cognify’s code routes), with no LLM.
This is a breaking change: -t CODE on search and recall used to run
CODING_RULES, which the CLI no longer exposes.
The three CODE options:
--code-query JSONnames the operation and its arguments; without it the search runsexplorewith the query text as seed.--helplists the fifteen operations.--diagram {mermaid,dot}adds the result drawn as Mermaid or Graphviz DOT.--diagram-out PATHwrites the diagram after the results are printed: a.html/.htmpage that renders Mermaid in a browser (Mermaid loaded from a CDN), an.svg/.png/.pdfrendered by Graphviz’sdot(found onPATH; a missingdotis an error naming it), or the raw source for any other extension. Alone it implies--diagram: DOT for.dot/.gvand the Graphviz renderings, Mermaid otherwise.
-t CODE (a validation error otherwise). The pretty output
prints each operation result as indented JSON under a one-line summary, and its
diagram in a mermaid / dot code fence; -f json keeps the diagram inside
the payload. search runs the CODE type itself. recall -t CODE with any of
the three options runs the query in recall’s opt-in code source (--scope code, replacing any --scope), whose facts print the same way; without them
it pins the graph source to CODE. recall --scope code alone runs explore
on the query text. A seed the code graph cannot resolve is no result in
recall, and an error in search over one dataset. A refused CODE operation
is reported as a validation error naming its error_code.
config subcommand
Reads/writes ~/.config/cognee-rust/config.json. Keys are the snake_case
Settings field names plus the keys of the component config sections compiled
into this build. set and get take the canonical key (such as llm.model) or
its flat alias (such as llm_model); cognee-cli config list prints the
canonical keys only. See
Configuration: CLI config.
LLM retries
--llm-max-retries N (accepted by cognify, add-and-cognify, search)
overrides the retry count for that run; the persistent default is the
llm_max_retries config key (default 3). The CLI flag wins over the config
value, which in turn is set by LLM_MAX_RETRIES.
It governs the structured-output retry loop only — the strict-schema,
function-call and JSON-fallback parsing paths — and counts attempts, not
re-asks: 3 is three attempts, so at most two corrective re-asks. The transport
retry loop underneath it is a separate knob, LLM_NETWORK_RETRIES (config key
llm_network_retries, default 2), which has no CLI flag. They used to share
one value, which multiplied the two ladders into each other.
0 is accepted for consistency with the env var; every adapter floors the
structured count at 1, so it means “one attempt, no re-ask”. To shorten a
transport ladder that would otherwise keep waiting out its time floor, set
LLM_MIN_RETRY_SECONDS=0.
A run-sequence step may carry the flag; it applies to that step, and steps
without it fall back to the configured value.
Logging
The CLI callscognee_logging::init_logging at startup. Console logs go to
stderr instead of stdout whenever stdout is machine-readable — -f json /
-f simple on search / recall, and always for export, visualize and
bench — so that output stays parseable (a -f json step inside run-sequence
is not detected and keeps stdout). The env-var surface
(COGNEE_LOG_*, RUST_LOG/LOG_LEVEL, LOG_FILE_NAME) is shared with the HTTP
server and bindings and documented canonically in
Configuration: logging. Example — JSON logs to
a custom directory: