Contexly codebase context engine - 1M lines to 35K tokens for any AI
Project description
Contexly - Codebase Context Engine
AI doesn't need your code. It needs your logic.
Contexly extracts logic skeletons from large codebases so AI agents get the structure they need without paying token costs for full source.
Why Contexly
Large codebases are expensive to feed directly into LLMs. A 1M-line repository can cost $100+ per session and still lose context between chats.
Contexly reduces this by building compact, searchable logic trees:
- 1,000,000 lines -> ~35,000-40,000 tokens (typical)
- Usually 95%+ token reduction
- Searchable context by file, function, and logic intent
- MCP-native workflow for AI agents
Package Name vs Command Name
Contexly uses different names for package install and CLI command:
- PyPI package name:
contexly - CLI command:
contexly - MCP command:
contexly-mcp
Installation
pip install contexly
Dev install (with test tools):
pip install -e ".[dev]"
Quick Start
# 1) Build a logic tree
contexly tree .
# 2) Get high-level repository map
contexly index . 0
# 3) Query relevant context
contexly query . "test query" 2 1
# 4) Open generated HTML tree
contexly view .
CLI Commands
contexly init <path>
Initialize .contexly/ metadata for a project.
contexly tree <path>
Build a logic skeleton tree and save artifacts to central output folder:
~/.vscode/github-repo-context/contexly-outputs/<project-name>/
Outputs:
tree.jsontree.html
contexly index <path> [level]
Print compact index from existing tree or create one if missing.
level=0-> repo maplevel=1-> file index (default)
contexly query <path> "<query>" [depth] [level]
Search context and build targeted result around matched files.
Examples:
contexly query . "rate limiting" 1 2
contexly query . "auth flow" 2 1 --debug
contexly impact <path> <function_name> [file_hint]
Preview downstream impact before editing a function.
contexly status <path>
Show current tree summary and compression info.
contexly view <path or html_file>
Open generated tree HTML in the browser.
contexly session ...
Session commands for optional progress tracking:
session new <path> "Task name"session update <path> <done|in_progress|todo> "text"session step <path> "completed" "next"session status <path>
MCP for Agents
Contexly provides an MCP server for Claude, Copilot, Cursor, Continue, Windsurf, and other MCP-compatible clients.
Start MCP server:
contexly-mcp
or
python contexly_mcp.py
See full setup examples in MCP_SETUP.md and mcp.example.json.
Validation Snapshot
Recent local checks:
pytest tests -q->56 passedcontexly tree .-> PASScontexly index . 0-> PASScontexly query . "sample query"-> PASS
Documentation Map
- AGENT_REFERENCE.md: complete agent workflow guide
- MCP_TOOL_REFERENCE.md: quick MCP signatures and examples
- REPO_STRUCTURE.md: repository and module structure
- DOCUMENTATION_INDEX.md: documentation navigation
- MCP_SETUP.md: client integration setup
Roadmap to Public Launch
- Final end-to-end checks on fresh environment
- Version bump (when needed)
- Git tag and release notes
- PyPI publish for
pip install contexly-engine
After PyPI publish, add downloads badge:

Contributing
Please open an issue or pull request with clear reproduction steps and expected behavior.
License
MIT
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 contexly-0.1.0.tar.gz.
File metadata
- Download URL: contexly-0.1.0.tar.gz
- Upload date:
- Size: 73.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca99be3cfe035a8c65b2a2f12ae0dcf6fb9737fbd1d42c08fb9ca69b010b4639
|
|
| MD5 |
a33d421804b1d94d64774d7d8eb7e097
|
|
| BLAKE2b-256 |
febd943330981784e3b95f2f3cf4eebdcf73ea60609d093a43d335d5bf418fd4
|
Provenance
The following attestation bundles were made for contexly-0.1.0.tar.gz:
Publisher:
publish.yml on Mynksri/Contexly
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contexly-0.1.0.tar.gz -
Subject digest:
ca99be3cfe035a8c65b2a2f12ae0dcf6fb9737fbd1d42c08fb9ca69b010b4639 - Sigstore transparency entry: 1486549929
- Sigstore integration time:
-
Permalink:
Mynksri/Contexly@3d22a19b67e18b2c965b275cd08d24bb0faba7f2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Mynksri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3d22a19b67e18b2c965b275cd08d24bb0faba7f2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file contexly-0.1.0-py3-none-any.whl.
File metadata
- Download URL: contexly-0.1.0-py3-none-any.whl
- Upload date:
- Size: 54.4 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 |
07a7c062711b477e67ed7b0f665e010f24371937631b65d8503889271b860aa7
|
|
| MD5 |
e172b4105705ce9a26866824fd5b6a59
|
|
| BLAKE2b-256 |
c413d6b4d1f44bb5831ea9b9e3c3c84acdebafc5cbafcaf81f0942eaf76549b3
|
Provenance
The following attestation bundles were made for contexly-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Mynksri/Contexly
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contexly-0.1.0-py3-none-any.whl -
Subject digest:
07a7c062711b477e67ed7b0f665e010f24371937631b65d8503889271b860aa7 - Sigstore transparency entry: 1486550019
- Sigstore integration time:
-
Permalink:
Mynksri/Contexly@3d22a19b67e18b2c965b275cd08d24bb0faba7f2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Mynksri
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3d22a19b67e18b2c965b275cd08d24bb0faba7f2 -
Trigger Event:
release
-
Statement type: