A local context layer for AI tools: mirror your repositories, index them into a knowledge graph, and serve it over MCP so agents answer from real source instead of guessing.
Project description
contextlake
All your real context, in one local lake.
A local context layer for your AI tools: mirror your repositories, index them
into a knowledge graph, and serve it over MCP, so agents answer from real source instead of guessing.
Why contextlake
Your AI assistant is only as good as what it can actually see. Point it at one file and it's sharp; ask it about the system, which service calls this API, who depends on that package, where a symbol is really defined across dozens of repos, and it starts guessing.
contextlake gives your tools the real source to read. It mirrors your repositories to your machine, indexes them into a queryable knowledge graph, and serves that graph to your editor over MCP. Everything runs locally and offline, no code leaves your machine, and it carries no credentials of its own.
How it works
contextlake is three layers you adopt one at a time. The mirror is useful on its own, and each layer above it is optional.
- Mirror: clone every repo you can reach in a GitLab group into a faithful copy of its namespace tree, each on its most active branch, kept fresh with one command. (The source is GitLab today; the design is source-agnostic.)
- Knowledge layer (optional): parse the mirror into a code + dependency graph, add semantic search, a council-verified wiki (each page reviewed and scored before publishing, low-confidence pages dropped), and connectors to Atlassian / Figma / GitLab.
- Serve: expose it all over MCP and an offline interactive graph visualizer, so
agents can answer "where is
Xdefined?" or "who callsY?" instead of grepping.
Each layer has its own guide: the mirror in Usage & config, the knowledge layer and serving in Knowledge layer, and the whole flow start to finish in QUICKSTART.
Install
pip install "contextlake[kb]" # the full tool: mirror + graph, search, wiki, MCP server
pip install contextlake # mirror-only core (no pip dependencies at all)
Everything in the quickstart below needs the [kb] extra (Python 3.10+); the plain
install is just the mirroring CLI and runs on Python 3.9+.
Prefer an isolated, zero-setup install? uv fetches the right
Python and an isolated environment for you:
uv tool install "contextlake[kb]" # install the CLI on your PATH
uvx --from "contextlake[kb]" contextlake --help # …or run it once, without installing
# pipx install "contextlake[kb]" # pipx works too
Install extras (the mirror needs none — add these for the knowledge layer)
| Extra | Adds | When you need it |
|---|---|---|
[kb] |
The knowledge layer: parse → graph → wiki → MCP server | Anything beyond mirroring |
[kb-full] |
[kb] + the built-in CPU embedder + sqlite-vec ANN |
One-step local semantic search, no Ollama or API key |
[kb-vec] |
The sqlite-vec ANN backend | Faster vector search than the pure-Python fallback |
[kb-local] |
The built-in CPU embedder (model2vec, ~30 MB) | Semantic search with no Ollama or API key |
[kb-fastembed] |
A higher-quality ONNX embedder (~90 MB) | Better semantic ranking |
[llm-local] |
A built-in CPU model for the wiki (llama-cpp) | wiki --llm builtin with no Ollama or API key |
Docker (turnkey / air-gapped: models baked in)
The published image bundles the knowledge layer plus the built-in CPU models (embedder + a small wiki LLM), so it runs with no Ollama, no API key, and no model download at runtime. The PyPI wheel stays the primary install; reach for the image on locked-down or offline machines.
docker run -v "$PWD:/work" ghcr.io/sayak-sarkar/contextlake doctor
docker run -v "$PWD:/work" ghcr.io/sayak-sarkar/contextlake index
From source (for contributors)
git clone https://github.com/sayak-sarkar/contextlake && cd contextlake
pip install -e ".[kb]"
Prerequisites: git, and, only for GitLab mirroring, either a GITLAB_TOKEN
env var (a PAT with read_api + read_repository — no other tool needed) or an
authenticated glab (glab auth login). The
knowledge layer needs neither. Once installed, contextlake, python -m contextlake,
and python3 contextlake.py are equivalent.
Quickstart: one repo, no setup
You don't need GitLab or any config to try contextlake on a repo you already have.
No install? Run it once with uvx: prefix any command
below with uvx --from "contextlake[kb]" (e.g. uvx --from "contextlake[kb]" contextlake index --source .).
contextlake index # parse the current repo into a local knowledge graph
contextlake graph --overview --open # open the interactive graph in your browser
contextlake serve # …or serve it to your AI IDE over MCP
Wire it into your editor in one line, no config file needed (it uses the local
~/.contextlake/kb store you just built):
claude mcp add contextlake-kb -- contextlake serve # Claude Code
# zero-install variant: claude mcp add contextlake-kb -- uvx --from "contextlake[kb]" contextlake serve
contextlake graph, a whole codebase as one offline, navigable graph.
Everything lands in a local store (~/.contextlake/kb), nothing leaves your machine. Index
any path with --source PATH, or every git repo under a directory with --workspace DIR.
Want the full path, mirror a GitLab fleet → graph → wired editor in a few minutes? QUICKSTART.md walks the whole flow.
Fleet mode: mirror a GitLab group
Where contextlake goes beyond single-repo tools is mirroring and cross-referencing a whole GitLab fleet. Copy the example config and set your group + workspace:
cp .contextlake.ini.example ~/.contextlake.ini
[contextlake]
work_dir = ~/work
gitlab_group = your-gitlab-group
contextlake status # see where you stand (read-only)
contextlake sync # fetch → clone → update → branches → verify → audit
It carries no credentials of its own (auth rides on your existing glab login), so
.contextlake.ini holds only non-secret settings and is gitignored by default. It runs
across hundreds of repos concurrently, with an adaptive worker pool, retries with
backoff, and never stomps on the feature branch you're in the middle of.
Behind a slow / TLS-inspecting corporate proxy (e.g. Zscaler) where
glab's API calls time out? SetGITLAB_TOKEN(aread_apitoken) and contextlake enumerates projects via its own HTTP client, which tolerates the slow DNS whereglab's short dial timeout fails.
Commands at a glance
Run any command as contextlake <command>; each has scoped help via
contextlake <command> --help. Per-command docs live with their layer: the
mirror commands in usage.md;
the knowledge-layer commands (index, embed, connect, wiki, query, owners,
impact, graph, …) in knowledge-layer.md,
and serve/steer in serve.md.
| Command | What it does |
|---|---|
status |
Show the workspace sync state vs GitLab (read-only) |
sync |
The full pipeline: fetch → clone → update → branches → verify → audit |
fetch · clone · update |
The sync steps, individually |
branches |
Switch each repo to its most active branch |
verify · audit |
Check the mirror vs GitLab; report repo health, age & drift (JSON + CSV) |
bootstrap |
Turnkey: sync + index + connect + embed + wiki + steer |
index |
Build the code/dependency graph (--workspace, incremental, --watch) |
connect |
Link repos to Atlassian / Figma / GitLab items (--watch to keep refreshing) |
embed |
Build semantic-search vectors (zero-config built-in CPU model, Ollama, or an API; incremental, --watch) |
ingest |
Aggregate external docs into the graph + semantic store (built-in files/web/api/mcp sources, or plugins) |
wiki [<repo>…] |
LLM-synthesized, council-verified wiki pages (all repos, or just the named ones); --llm builtin|ollama|openai enables the LLM tier inline |
query |
Search the index (--kind, --repo, --as-of <commit>) |
owners (alias who-knows) |
Likely owners / SMEs for a repo (or --path), ranked from git history |
impact (alias blast-radius) |
Change-impact / blast radius: what depends on a symbol (--hops, --repo to disambiguate) |
graph |
Visualize the graph, offline interactive HTML / DOT / Mermaid / JSON |
dashboard |
Local knowledge-system dashboard UI (--serve; --sample for the bundled demo fleet; --site DIR for a static offline export) |
serve |
Expose the graph over MCP (--transport stdio/http) |
steer |
Write editor steering, AGENTS.md, .mcp.json, .windsurfrules, skills |
lint · doctor · eval |
Graph health · environment check · retrieval-quality scoring |
Global options apply to any command: --dry-run (preview without changing anything),
-v/-q (verbosity), --log-file PATH, --config PATH, --version. Output is colorized on
a TTY and plain when piped; set NO_COLOR to force-disable.
Knowledge layer
Beyond mirroring, the optional contextlake.kb layer turns your repos into a knowledge
graph and serves it to AI tools over MCP. It can link repos to their Atlassian / Figma /
GitLab items, add semantic search, write a curated wiki, visualize the graph
(offline interactive HTML, fleet overview, a symbol's neighbourhood, or a single repo), and
generate per-tool steering files + a skills library. Most of it needs no model; the rest
works with a local Ollama or any OpenAI-compatible endpoint.
One command sets it all up (configs are read from their default locations):
contextlake bootstrap
Full guide: docs/knowledge-layer.md.
The dashboard
contextlake dashboard --serve opens a local, offline-first window into everything the
knowledge layer builds — a fleet overview, per-repo anatomy, the cross-repo architecture
graph, change-impact (blast radius), health, and search. Try it with zero setup via
contextlake dashboard --serve --sample.
The dashboard — a guided tour — step by step, with screenshots.
Documentation
- QUICKSTART.md, install → bootstrap → wire your editor, in minutes
- docs/dashboard.md, the dashboard, a guided tour with screenshots
- docs/usage.md, every command, configuration, branch safety, scheduling
- docs/knowledge-layer.md, the graph, connectors, search, wiki
- docs/serve.md, serve the graph over MCP + wire your editor
- docs/internals.md, architecture & internals
- docs/releasing.md, maintainer runbook: versioning, tagging, publishing
- CHANGELOG.md · ROADMAP.md · CONTRIBUTING.md · BRANDING.md
License
MIT, see LICENSE. Pebble the otter is the project mascot; deep context, clear answers.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file contextlake-2.22.0.tar.gz.
File metadata
- Download URL: contextlake-2.22.0.tar.gz
- Upload date:
- Size: 424.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f01bc7828d9af77e8a0ed64bac1a301af46dad637f15850071bbe5157f5e4a5
|
|
| MD5 |
d4ecd050861fbddb2b21c2aa7f07eee5
|
|
| BLAKE2b-256 |
74f5958887719f78ecd2d32b983333127b7068cb11bb9004a23d55514f454c90
|
Provenance
The following attestation bundles were made for contextlake-2.22.0.tar.gz:
Publisher:
release.yml on sayak-sarkar/contextlake
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextlake-2.22.0.tar.gz -
Subject digest:
0f01bc7828d9af77e8a0ed64bac1a301af46dad637f15850071bbe5157f5e4a5 - Sigstore transparency entry: 2044369461
- Sigstore integration time:
-
Permalink:
sayak-sarkar/contextlake@a9c96d5a2795a304dfa8cd1169a67e76d6b65416 -
Branch / Tag:
refs/tags/v2.22.0 - Owner: https://github.com/sayak-sarkar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a9c96d5a2795a304dfa8cd1169a67e76d6b65416 -
Trigger Event:
push
-
Statement type:
File details
Details for the file contextlake-2.22.0-py3-none-any.whl.
File metadata
- Download URL: contextlake-2.22.0-py3-none-any.whl
- Upload date:
- Size: 429.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49c17fade5767f77af471bc3b4d2aee7a4d529c4dfacd69a9209651a5f0897f8
|
|
| MD5 |
31e7df94f12c568a8bb7d0b31a8d1847
|
|
| BLAKE2b-256 |
15084b51680caabb15a1649a62400a364f78a9eefde8e8b0d3916ee0f77f2353
|
Provenance
The following attestation bundles were made for contextlake-2.22.0-py3-none-any.whl:
Publisher:
release.yml on sayak-sarkar/contextlake
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextlake-2.22.0-py3-none-any.whl -
Subject digest:
49c17fade5767f77af471bc3b4d2aee7a4d529c4dfacd69a9209651a5f0897f8 - Sigstore transparency entry: 2044369472
- Sigstore integration time:
-
Permalink:
sayak-sarkar/contextlake@a9c96d5a2795a304dfa8cd1169a67e76d6b65416 -
Branch / Tag:
refs/tags/v2.22.0 - Owner: https://github.com/sayak-sarkar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a9c96d5a2795a304dfa8cd1169a67e76d6b65416 -
Trigger Event:
push
-
Statement type: