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 cognify
turns datasets into a knowledge graphcognee-cli search "question"
asks the graph for answerscognee-cli delete
removes stored data when you no longer need itcognee-cli config
reads and updates saved settingscognee-cli -ui
launches 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) orLangchainChunker
if installed--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.Search Types
Search Types
Try these quick examples to feel the differences:
Search Command Options
Search Command Options
--query-type
: Choose from GRAPH_COMPLETION, RAG_COMPLETION, INSIGHTS, CHUNKS, SUMMARIES, CODE, or CYPHER--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
: Remove all data for a specific user--all
: Remove all data (use with caution)--force
: Skip confirmation prompts
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{}
ortrue
are parsed automaticallyunset <key>
: Reset to the default. Add--force
to 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.