AI models degrade past 130k tokens. ContextKit keeps you under 30k — without losing what matters.
Dumping your whole codebase into Claude or Cursor leads to hallucinations because there's too much noise. The AI has a massive context window, but its attention span still degrades over long contexts. ContextKit extracts the minimal, maximally relevant context for your specific task.
pip install contextkit# Index your codebase (run once, auto-updates)
contextkit index
# Generate context and copy to clipboard
contextkit build "fix the JWT token validation bug" --copyContextKit — Context Builder
──────────────────────────────────────────────────
✦ Task "fix the JWT token validation bug"
✦ Index size 2,847 symbols, 94 files
Resolving relevant files...
✓ auth/validators.py (direct match — "JWT", "token", "validation")
✓ auth/models.py (referenced by validators.py)
✓ auth/exceptions.py (imported by validators.py)
✓ tests/test_validators.py (test file for validators.py)
✗ payment/processor.py (excluded — unrelated to JWT)
✗ api/routes/*.py (excluded — no token logic)
✦ Context bundle 4 files, 847 lines
✦ Token estimate ~11,200 tokens (vs 94,000 full codebase)
✦ Reduction 88% fewer tokens
Copied to clipboard ✓
──────────────────────────────────────────────────
Paste into Claude/Cursor/ChatGPT and ask your question.
- Index: Builds a local dependency graph + symbol map of your codebase.
- Score Relevance: Scores files by relevance to task description using keyword (and optionally semantic) matching.
- Walk Dependency Graph: Pulls in transitive dependencies for the most relevant files.
- Bundle: Assembles the context bundle within a defined token budget.
Works with Claude, ChatGPT, Cursor, Copilot, Gemini (any AI tool that accepts text).
| Project Size | Reduction |
|---|---|
| Small | 60% |
| Medium | 80% |
| Large | 88% |
You can configure contextkit build using CLI arguments:
--max-tokens: Limit token count (default: 30000).--output: File format (markdown, xml, plain).--semantic: Opt-in to semantic embedding (requiressentence-transformers).
This tool is part of a suite of open-source AI-powered developer tools built by the same team:
| Tool | What it does |
|---|---|
| RootCause | Auto-diagnose failing tests — AI root cause + fix |
| ErrorMentor | Auto-diagnose production errors — correlate logs with git commits |
| TestGap | Find untested code paths after every commit |
| HalluCheck | Catch AI hallucinations in code diffs |
| IntentDiff | Understand what a diff actually does semantically |
| DepSecure | Block vulnerable dependencies at commit time |
| ArchGuard | Enforce microservice architecture rules across repos |
| SpendSentry | Monitor cloud spend in real time — alert before costs spiral |
| ContextKit | Build minimal AI context bundles — 88% fewer tokens |
MIT