cognee-cli command lets you run Cognee from the terminal so you can add data, build the knowledge graph, 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.
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 add <data>loads documents or text into a datasetcognee-cli cognifyturns datasets into a knowledge graphcognee-cli search "question"asks the graph for answerscognee-cli deleteremoves 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 search --help) to see every option.
Add Data
Start by loading something the graph can learn from. You can add files, folders, URLs, or even plain text.Add Command Options
Add Command Options
data: One or more file paths, URLs, 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
Cognify Data
Cognify builds the knowledge graph. Run it whenever you add new data or change the ontology.Cognify Command Options
Cognify Command Options
--datasets(-d): Space-separated list. Skip it to process everything--chunk-size: Token limit for each chunk. Leave blank to let Cognee choose--chunker:TextChunker(default),CsvChunker, orLangchainChunker. See Chunkers for more.--background(-b): Handy for large datasets; the CLI exits while the job keeps running--verbose(-v): Prints progress messages--ontology-file: Path to a custom ontology (.owl,.rdf, etc.)
Search the Graph
Once cognify 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 search types; see Search for the full list.Search Types
Search 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, TEMPORAL) are available in the Python API. The CLI CODE option is not supported and will error.Search Command Options
Search 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--output-format(-f):pretty(friendly layout),simple(minimal text), orjson(structured output for scripts)
Delete Data
Clean up when a dataset is outdated or when you reset the environment.Delete Command Options
Delete Command Options
--dataset-name: Remove a specific dataset--user-id: Required with--all(and when acting on another user’s data)--all: Remove all datasets the user can delete (use with caution)--force: Skip confirmation prompts
Deleting individual data items by ID is not currently supported in the CLI. Use the Python SDK or HTTP API for granular deletion.
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.
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.