csegraph
CseGraph is a context engine for coding agents. Its only job is to hand an agent the accurate, minimal slice of code context needed to make a correct retrieval or edit, so the agent spends fewer tokens and skips tool calls it would otherwise make (broad grep, full-file read, repeated lookups).
It indexes source code into a SQLite-backed dependency graph, then returns compact, task-specific context bundles before an agent edits.
The product loop is:
index -> refresh -> context -> optional inspect/path/analyze
Use csegraph when you want an agent to see the target code, direct dependencies, imports, nearby tests, and a short explanation of why each node was selected without repeatedly scanning the repository.
Install
Current release: 1.8.0.
pip install csegraph
To pin this release exactly:
pip install csegraph==1.8.0
The base package includes Python, JavaScript, and TypeScript grammars. Install extra grammars only when you need them:
pip install "csegraph[go,rust]"
pip install "csegraph[all]"
Then run csegraph --help to confirm the CLI is on your PATH.
Five Minute Quickstart
cd /path/to/your/repo
csegraph index .
csegraph context "explain how authentication refresh works" --detail-level standard --format markdown
The default index lives at .csegraph/index.db. It is local runtime state and
should not be committed.
For VS Code extension install and setup, see csegraph-vscode/README.md.
Benchmarks & Performance
The native MCP cross-repo benchmarking suite (tools/cross_repo_benchmark.py)
evaluates CseGraph against 10 major open-source repositories, generating 100
unique architectural queries per repository through the same stdio JSON-RPC path
used by coding agents. Current auto, small, medium, and large profile
results are recorded in the Agent Context Benchmarks.
Package Layout
| Package | Location | Purpose |
|---|---|---|
csegraph |
repo root | One Python distribution containing the public CLI, MCP server, SDK facade, and private engine internals. |
csegraph-vscode |
csegraph-vscode/ |
VS Code extension source. See extension README. |
Public Python imports use csegraph. Internal implementation modules live under csegraph._core and csegraph._cli; they are not documented as public API.
Install From Source
env/bin/pip install -e .
For local development and test runs, install the test extra:
env/bin/python -m pip install -e ".[test,all]"
For benchmark reports with OpenAI proxy token counts, include the benchmark extra:
env/bin/python -m pip install -e ".[benchmark,test,all]"
requirements.txt contains the product-only editable install.
This repository is source-first. The public project is distributed as one Python package and the VS Code extension source; generated binaries, local graph databases, build outputs, and dashboard artifacts are not committed.
Project Hygiene
- Security policy: SECURITY.md
- Code of conduct: CODE_OF_CONDUCT.md
- Support guide: SUPPORT.md
- Contribution guide: CONTRIBUTING.md
- Release checklist: RELEASE.md
- Changelog: CHANGELOG.md
- CLI, MCP, and SDK reference: docs/csegraph.md
- Architecture reference: docs/architecture.md
Privacy and Local Files
CseGraph is local-first. Indexes are written under the target repository's
.csegraph/ directory, while registry and daemon metadata use ~/.csegraph/
for registered repository paths, database paths, daemon PID files, and logs.
No network request is required for normal indexing, retrieval, or MCP stdio. The
optional embeddings workflow can call an OpenAI-compatible endpoint only when
explicitly configured and allowed with
CSEGRAPH_ALLOW_CLOUD_EMBEDDINGS; that sends symbol text to the configured
endpoint.
Development
pytest # Full test suite
pytest tests/unit/ # Unit tests only
pytest tests/integration/ # Integration tests only
pytest -x -q # Stop on first failure, quiet
python -m compileall -q csegraph tools csegraph-vscode
csegraph --help
License
CseGraph is released under the MIT License. See LICENSE.
Metadata
Release files for csegraph 1.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| csegraph-1.8.0.tar.gz | 181.7 kB | With provenance | Details for csegraph-1.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| csegraph-1.8.0-py3-none-any.whl | Python 3 | none | any | Details for csegraph-1.8.0-py3-none-any.whl |
Total release size: 396.2 kB
Release files / csegraph-1.8.0.tar.gz
| Download URL | csegraph-1.8.0.tar.gz |
|---|---|
| Size | 181.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa51682f5ea37f38592e5db9333e87d1e920194c74ba84ef2206ae05affd2f4f
|
|
BLAKE2b-256 checksum How to use checksums |
dc5b7b8e6aed27d2042214b9390b8df649f7f3be24cee03270fb5055632f3a3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.
Transparency logRelease files / csegraph-1.8.0-py3-none-any.whl
| Download URL | csegraph-1.8.0-py3-none-any.whl |
|---|---|
| Size | 214.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a7a86f20d373208cec99b4435fbcbb55d810de5f8275b9ab54e8aa3a9ec3b3a
|
|
BLAKE2b-256 checksum How to use checksums |
b535e396eab83e74a0a32d5b3c554121309a0f78ac2cfc1173243e16cff4e636
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.
Transparency logSecurity for csegraph 1.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for csegraph-1.8.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.