Skip to content

feat(cli): Add cognee-cli demo with bundled zero-key graph - #4845

Open
Vasilije1990 wants to merge 1 commit into
devfrom
feature/demo-dataset-command
Open

feat(cli): Add cognee-cli demo with bundled zero-key graph#4845
Vasilije1990 wants to merge 1 commit into
devfrom
feature/demo-dataset-command

Conversation

@Vasilije1990

Copy link
Copy Markdown
Contributor

Description

First-session research shows the most common organic failure: the first search returns nothing (or an API-key error) before the user has ever seen cognee work. This PR ships proof of life: cognee-cli demo loads a pre-built knowledge graph and answers a search in ~5 seconds with no LLM key, no embedding provider, and no network access.

Linear issue key pending — the Linear MCP connection needs re-auth; the title will be updated with the COG reference before merge.

$ cognee-cli demo
Loading the bundled demo knowledge graph (no API key required)...
Success: Demo graph loaded into dataset 'demo' (37 nodes, 71 edges).

Query: Who works at Anthropic?
  1. ... Alice works at Anthropic in San Francisco. ...

This demo uses keyword search (CHUNKS_LEXICAL) — it needs no LLM and no embeddings. LLM answers over your own data need LLM_API_KEY set.
Next: cognee-cli search "your question" -t CHUNKS_LEXICAL -d demo

How it works

  • Bundled COGX archive (cognee/cli/samples/demo_graph/, ~48 KB, ships in the wheel): built once by a maintainer via tools/build_demo_archive.py, which cognifies the existing quickstart sample in a scratch store, exports it with cognee.export(format="cogx"), and trims documents.jsonl — document records would route through add(), whose pipeline requires a working LLM connection. Chunk text survives as raw nodes (the exporter writes every DocumentChunk as one), which is exactly what lexical retrieval reads.
  • Graph-only archive restore: remember(source, index_vectors=False) — reusing the kwarg the code route already declares — threads through the migration loader as add_data_points(graph_only=True) and sets skip_connection_test on the import pipeline. No vector engine is initialized, so no key is demanded. Works for both import shapes (streaming and buffered).
  • Zero-cost search: queries run as CHUNKS_LEXICAL (BM25 over graph-stored chunks — no LLM, no embeddings, no network). Also fixes a standalone gap: CHUNKS_LEXICAL was missing from the CLI's SEARCH_TYPE_CHOICES, making it unreachable from cognee-cli search/recall entirely.
  • Honest expectations: the command states it uses keyword search, that LLM answers over the user's own data need LLM_API_KEY, and prints copy-pastable next steps plus cleanup (forget --dataset demo). In --api-url mode the dispatcher's existing "run locally" error covers demo.

Test plan

  • 24 new tests: bundled-archive integrity guards (ships in package, parses, carries no document records, contains lexical-searchable DocumentChunk raw nodes); graph_only threading through stream_graph_from_source, store_imported_graph, and the remember(index_vectors=...) mapping; demo-command behavior (graph-only import asserted, every search pinned to CHUNKS_LEXICAL, custom query/dataset flags, error wrapping).
  • Full cognee/tests/unit/migration/ + cognee/tests/cli_tests/cli_unit_tests/ suites: 309 passed locally.
  • End-to-end verified with LLM_API_KEY/OPENAI_API_KEY/EMBEDDING_API_KEY/ANTHROPIC_API_KEY all stripped from the environment in a scratch store: import + two searches complete in ~4.5 s with real chunk text returned.
  • pre-commit (ruff check + format) clean.

🤖 Generated with Claude Code

First-session drop-off research shows the most common failure is a
first search that returns nothing (or an API-key error) before the
user has seen cognee work at all. Give them proof of life first:
cognee-cli demo loads a pre-built knowledge graph and answers a
search in ~5 seconds with no LLM key, no embedding provider, and no
network access.

The graph ships as a COGX archive built once by a maintainer
(tools/build_demo_archive.py cognifies the quickstart sample, exports
it, and trims document records so the import never triggers add()'s
LLM connection check). The demo restores it graph-only via the new
remember(source, index_vectors=False) path — threaded through the
migration loader as add_data_points(graph_only=True) plus
skip_connection_test — and queries it with CHUNKS_LEXICAL, the BM25
retriever that reads chunks from the graph store and needs neither an
LLM nor embeddings. CHUNKS_LEXICAL is also added to the CLI's search
type choices, where it was previously unreachable.

The command sets expectations explicitly: it names the search as
keyword-based, points at LLM_API_KEY for full answers over the user's
own data, and prints copy-pastable next steps and cleanup.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Vasilije1990
Vasilije1990 requested a review from dexters1 as a code owner August 31, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant