Layer 2 · Knowledge

Knowledge layer

Turn the mirror into a queryable graph with search, a wiki, and connectors.

An optional subsystem (contextlake.kb) turns your mirrored repositories into a queryable knowledge graph and serves it to AI agents over MCP, so an assistant can ask "where is X defined?", "who calls Y?", or "which repos depend on package Z?" instead of grepping hundreds of repos. It's generic: it indexes any repositories and connects to any configured knowledge sources; no organization-specific data lives in the package (your sites, keys, and rules go in a private config file).

This page orients you; each stage below has its own focused page.

Install the extra#

The knowledge layer needs the [kb] extra (Python 3.10 or newer):

pip install "contextlake[kb]"        # knowledge layer (parse + graph + serve)
# ...or everything for local semantic search in one step (no Ollama or API key):
pip install "contextlake[kb-full]"   # = kb + built-in CPU embedder + sqlite-vec ANN
contextlake doctor                   # check the environment

contextlake doctor verifies the whole layer in one pass (FTS5, git / glab on PATH, the store's real counts, the built-in CPU embedder, and the ANN index) and exits non-zero if anything is wrong, so it doubles as a CI health gate:

contextlake doctor output: green ticks for SQLite FTS5, git and glab on PATH, config loads, a reachable store with 4 repos / 29 nodes / 28 edges, the built-in embedder, and the sqlite-vec ANN index, ending in OK.

The fastest way to build all of it is one command, contextlake bootstrap (see Bootstrap and keep fresh). The rest of this section is the map of what that pipeline does, stage by stage.

Building it, stage by stage#

Using what you built#

For the command list see the contextlake command reference; to decode a run see Reading the console output.

Next steps