CodeTrellis - Project Self-Awareness System - AI context injection tool
Project description
CodeTrellis — Give AI Full Project Awareness
Scan your codebase, compress to ~1K tokens, inject into every AI prompt.
Works with: GitHub Copilot | Claude | Cursor | Windsurf | any MCP-compatible AI
The Problem
- AI assistants read files one at a time — they never see your full project
- They don't know about existing components, schemas, or patterns
- You explain your project structure repeatedly in every conversation
- AI lacks business domain understanding — doesn't know why code exists
Quick Start
pip install codetrellis
codetrellis scan /path/to/project --optimal
codetrellis init . --ai # sets up Copilot/Claude/Cursor integration
How It Works
┌─────────────────────────────────────────────────────────────────┐
│ CodeTrellis WORKFLOW │
├─────────────────────────────────────────────────────────────────┤
│ │
│ 1. SCAN 2. COMPRESS 3. INJECT │
│ ───────── ─────────── ──────── │
│ │
│ Read every → Convert to → Add to every │
│ file in minimal AI prompt │
│ project tokens │
│ │
│ 187 lines → 30 tokens → Full awareness │
│ │
└─────────────────────────────────────────────────────────────────┘
Top Features
- 120+ language/framework parsers — Python, TypeScript, Go, Rust, Java, C#, and more
- MCP server for real-time AI context injection (JSON-RPC 2.0)
- JIT context engine — delivers only relevant sections for the file you're editing
- Incremental builds — only re-extract changed files
- Best Practices Library — 4,500+ practices auto-selected for your stack
- Output tiers — from ~800 tokens (compact) to full code context (logic)
- CI/CD mode — deterministic, parallel builds for pipelines
- AI integration — auto-generates Copilot, Claude, Cursor, Windsurf configs
Installation
pip install codetrellis
# Optional extras
pip install codetrellis[all] # AST parsing, YAML, color, token counting
pip install codetrellis[ast] # Tree-sitter AST parsing only
Output Tiers
| Tier | Truncation | Tokens | Use Case |
|---|---|---|---|
compact |
Yes | ~800-2000 | Quick overview |
prompt |
NO | ~8000-15000 | Default AI injection (includes code logic!) |
full |
NO | ~15000+ | Detailed analysis |
logic |
NO | ~30000+ | Full code context |
json |
NO | Variable | Machine processing |
# Use tiers
codetrellis scan ./project --tier compact # Minimal
codetrellis scan ./project --tier prompt # Default (recommended)
codetrellis scan ./project --tier full # Everything
codetrellis scan ./project --tier logic # With function bodies
CLI Commands
# Scanning
codetrellis scan [path] # Scan project
codetrellis scan [path] --optimal # Maximum quality (recommended)
codetrellis scan [path] --incremental # Only changed files
codetrellis scan [path] --ci # CI/CD mode (deterministic + parallel)
codetrellis scan --remote <url> # Scan a remote git repo
# AI Integration
codetrellis init . --ai # Generate Copilot/Claude/Cursor configs
codetrellis init . --update-ai # Regenerate AI files (no re-scan)
codetrellis mcp --stdio # Start MCP server
codetrellis context path/to/file.py # JIT context for a file
codetrellis skills # Generate AI-executable skills
# View & Export
codetrellis show # Show full matrix
codetrellis prompt # Print prompt-ready matrix
codetrellis export --json # Export as JSON
# Quality & Maintenance
codetrellis verify [path] # Build quality gate
codetrellis validate [path] # Validate extraction completeness
codetrellis coverage [path] # Show extraction coverage
codetrellis watch # Auto-sync on file changes
codetrellis clean [path] # Clean caches
Contributing
See CONTRIBUTING.md for development setup and guidelines.
License
MIT License — Keshav Chaudhary 2026
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
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 codetrellis-1.2.0.tar.gz.
File metadata
- Download URL: codetrellis-1.2.0.tar.gz
- Upload date:
- Size: 3.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b9f6a3debbbf6a5611eef8fdc41a434a895cc761e6b7dfbb23535907fe3ea8f
|
|
| MD5 |
2e76399ee77994ff7d584714cddaba7e
|
|
| BLAKE2b-256 |
399582cfecf620dc85560a00cedc8c931bb910d2122c9b8a32d502215e3fe5da
|
Provenance
The following attestation bundles were made for codetrellis-1.2.0.tar.gz:
Publisher:
release.yml on chaudhary-keshav/codetrellis-matrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codetrellis-1.2.0.tar.gz -
Subject digest:
9b9f6a3debbbf6a5611eef8fdc41a434a895cc761e6b7dfbb23535907fe3ea8f - Sigstore transparency entry: 1212497639
- Sigstore integration time:
-
Permalink:
chaudhary-keshav/codetrellis-matrix@fe8f2635649d55e3b69719ca731f3e52618b9d77 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/chaudhary-keshav
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fe8f2635649d55e3b69719ca731f3e52618b9d77 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codetrellis-1.2.0-py3-none-any.whl.
File metadata
- Download URL: codetrellis-1.2.0-py3-none-any.whl
- Upload date:
- Size: 4.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3dc6f07d9fae882f2ef436e6598fd136078469edede5eb9758c9933129ba6c97
|
|
| MD5 |
b3a11feba740e80c1c6c27dbb550ee6f
|
|
| BLAKE2b-256 |
a432b07a8c57029781d7ea91cdfa005df4d9224f0fb9b368af804d7abd49eb28
|
Provenance
The following attestation bundles were made for codetrellis-1.2.0-py3-none-any.whl:
Publisher:
release.yml on chaudhary-keshav/codetrellis-matrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codetrellis-1.2.0-py3-none-any.whl -
Subject digest:
3dc6f07d9fae882f2ef436e6598fd136078469edede5eb9758c9933129ba6c97 - Sigstore transparency entry: 1212497925
- Sigstore integration time:
-
Permalink:
chaudhary-keshav/codetrellis-matrix@fe8f2635649d55e3b69719ca731f3e52618b9d77 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/chaudhary-keshav
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fe8f2635649d55e3b69719ca731f3e52618b9d77 -
Trigger Event:
push
-
Statement type: