cognee-cli command lets you run Cognee from the terminal so you can remember data, enrich memory, and ask questions without opening a Python file. The commands are designed to be short, use friendly defaults, and are safe for people who are just starting out.
Install the CLI
Thecognee-cli command ships with the cognee package — installing cognee makes it available. To use it inside a project, install Cognee the usual way (see the Installation Guide):
cognee-cli command works from anywhere, use a tool that installs Python applications into isolated environments and puts their commands on your PATH:
cognee-cli system-wide without polluting your project’s virtual environment. To add an extra (for example Postgres support) to the global install, include it in the package spec, e.g. pipx install "cognee[postgres]" or uv tool install "cognee[postgres]".
Setup
Before using the CLI, you need to configure your API key. The recommended approach is to store it in a.env file:
Use the
cognee-cli config set command only for temporary tweaks during a long-running session. For persistent configuration, use .env files or environment variables.Quick Tour of Commands
cognee-cli remember <data>ingests data and builds retrieval-ready memory in one stepcognee-cli recall "question"retrieves answers from the graph or session memorycognee-cli improveenriches an existing datasetcognee-cli forgetremoves stored data when you no longer need itcognee-cli configreads and updates saved settingscognee-cli -uilaunches the local web app
--help after any command (for example, cognee-cli recall --help) to see every option.
The CLI still includes lower-level legacy commands such as
add, cognify, search, and delete, but for new workflows the v1.0 remember / recall / improve / forget commands are the preferred interface.Remember Data
Start by loading something the graph can learn from. You can remember files, folders, URLs, S3 paths, or even plain text.Remember Command Options
Remember Command Options
data: One or more file paths, directory paths, URLs, S3 paths, or text strings. Mix and match as needed--dataset-name(-d): Defaults tomain_dataset. Use clear names so the team remembers what each dataset holds--chunk-size: Token limit for each chunk. Leave blank to let Cognee choose--chunker:TextChunker(default),CsvChunker, orLangchainChunker--background(-b): Ingests data, then keeps graph-building running in the background--chunks-per-batch: Number of chunks to process per task batch
Ingesting a Folder
Ingesting a Folder
Pass a directory path directly to To restrict ingestion to specific files, list them explicitly instead of pointing at the parent folder.
remember (or add) and Cognee walks it recursively, picking up every file in the folder and all of its subdirectories. There is no --recursive flag and no need to shell-expand with globs or find; the ingestion pipeline handles the traversal for you.Improve Memory
Useimprove when you want to enrich an existing dataset after ingestion. This is especially useful for session-bridging or an explicit post-processing pass over memory you already stored.
Improve Command Options
Improve Command Options
--dataset-name(-d): Dataset to improve. Defaults tomain_dataset--dataset-id: Dataset UUID (alternative to--dataset-name)--node-name: Narrow the improvement pass to specific named entities--session-ids(-s): Session IDs whose Q&A and feedback should be bridged into the permanent graph--feedback-alpha: Learning rate for feedback-based weighting updates--background(-b): Handy for large datasets; the CLI exits while the job keeps running
Recall Memory
Onceremember finishes, you can question the graph. Start with a simple natural-language question, then experiment with search types. The CLI exposes a subset of the available retrieval types; see Recall for the memory-oriented workflow and Search for the lower-level search type reference.
Recall Types
Recall Types
Try these quick examples to feel the differences:
The CLI supports a subset of search types:
GRAPH_COMPLETION, RAG_COMPLETION, CHUNKS, SUMMARIES, and CYPHER. Other search types (like GRAPH_SUMMARY_COMPLETION, CODING_RULES, and TEMPORAL) are available in the Python API.Recall Command Options
Recall Command Options
--query-type: Subset of search types (e.g. GRAPH_COMPLETION, RAG_COMPLETION, CHUNKS, SUMMARIES, CYPHER). See Search for the full list.--datasets: Limit search to specific datasets--top-k: Maximum number of results to return--system-prompt: Point to a custom prompt file for LLM-backed modes--session-id(-s): Search session memory directly when used by itself, or add session history to graph-backed recall--output-format(-f):pretty(friendly layout),simple(minimal text), orjson(structured output for scripts)
Forget Data
Clean up when a dataset is outdated or when you reset the environment.Forget Command Options
Forget Command Options
--dataset: Dataset name or UUID to remove--data-id: Remove a single item from the specified dataset--everything(alias--all): Remove all datasets and data for the current user
forget is the v1.0 deletion interface. If you still need the older delete flow, it remains available as a lower-level legacy command.Manage Configuration
The CLI stores its settings so you do not have to repeat them. Configuration updates line up with the Python API.Config Command Options
Config Command Options
list: Print the common keysget [key]: Show the saved value; omit the key to list everythingset <key> <value>: Save a new value. JSON strings such as{}ortrueare parsed automaticallyunset <key>: Reset to the default. Add--forceto skip confirmationreset: Placeholder for a future “reset everything” command
Useful Configuration Keys
Useful Configuration Keys
- Language model:
llm_provider,llm_model,llm_api_key,llm_endpoint - Storage:
graph_database_provider,vector_db_provider,vector_db_url,vector_db_key - Chunking:
chunk_size,chunk_overlap
Launch the UI
Prefer a browser view? Launch the UI with one flag.http://localhost:8000 and the React app on http://localhost:3000. Leave the window open and press Ctrl+C to stop everything.
cognee-cli -ui also launches the Cognee MCP server inside a Docker container, so a running Docker-compatible daemon is required. Docker Desktop, Colima, or any OCI-compatible runtime with a working docker CLI is supported. Before pulling the MCP image the CLI runs a docker info preflight check; if the Docker daemon is not reachable it logs actionable guidance and skips MCP startup, leaving the UI and backend running. See Docker & Colima Setup for setup and troubleshooting.Talk to a Running Cognee API
Add--api-url to delegate any supported command to a running Cognee API server instead of executing it in-process. This is the recommended mode for multi-agent or concurrent usage with file-based databases (SQLite, Ladybug, LanceDB), because it lets a single server own all database connections.
--api-url mode: add, cognify, search, memify, datasets, delete, remember, recall, improve, and forget. Any other command runs locally; pass --api-url only with commands from this list.
Authenticate Against the API
If the target API requires authentication, supply credentials with one of the flags below (or their environment-variable fallbacks). The CLI sends the credentials only when--api-url is set.
API Mode Options
API Mode Options
--api-url: URL of the Cognee API server (for examplehttp://localhost:8000). When set, supported commands are forwarded over HTTP--api-key: API key sent as theX-Api-Keyheader. Falls back to theCOGNEE_API_KEYenvironment variable--api-token: Bearer token sent asAuthorization: Bearer <token>. Falls back to theCOGNEE_API_TOKENenvironment variable. Ignored when--api-keyis also provided--user-id: Optional UUID forwarded as theX-User-Idheader for multi-agent isolation. The server must be configured to honour this header
In
--api-url mode the server controls chunking and feedback weighting, so --chunker on remember and --feedback-alpha on improve are ignored.Next Steps
Installation Guide
Set up your environmentInstall Cognee and configure your environment to start using the CLI.
Quickstart Tutorial
Run your first exampleGet started with Cognee by running your first knowledge graph example.