Skip to main content

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.

PyPI License Python Tests Version

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.json
  • tree.html

contexly index <path> [level]

Print compact index from existing tree or create one if missing.

  • level=0 -> repo map
  • level=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 passed
  • contexly tree . -> PASS
  • contexly index . 0 -> PASS
  • contexly query . "sample query" -> PASS

Documentation Map

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:

![Downloads](https://img.shields.io/pypi/dm/contexly)

Contributing

Please open an issue or pull request with clear reproduction steps and expected behavior.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contexly-0.1.0.tar.gz (73.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contexly-0.1.0-py3-none-any.whl (54.4 kB view details)

Uploaded Python 3

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

Hashes for contexly-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ca99be3cfe035a8c65b2a2f12ae0dcf6fb9737fbd1d42c08fb9ca69b010b4639
MD5 a33d421804b1d94d64774d7d8eb7e097
BLAKE2b-256 febd943330981784e3b95f2f3cf4eebdcf73ea60609d093a43d335d5bf418fd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for contexly-0.1.0.tar.gz:

Publisher: publish.yml on Mynksri/Contexly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for contexly-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07a7c062711b477e67ed7b0f665e010f24371937631b65d8503889271b860aa7
MD5 e172b4105705ce9a26866824fd5b6a59
BLAKE2b-256 c413d6b4d1f44bb5831ea9b9e3c3c84acdebafc5cbafcaf81f0942eaf76549b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for contexly-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Mynksri/Contexly

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page