A modular toolkit for LLM-powered codebase understanding.
Project description
kit 🛠️ Code Intelligence Toolkit
kit is a production-ready toolkit for codebase mapping, symbol extraction, code search, and building LLM-powered developer tools, agents, and workflows.
Use kit to build things like code reviewers, code generators, even IDEs, all enriched with the right code context. Work with kit directly from Python, or with MCP + function calling, REST, or CLI.
kit also ships with a damn fine PR reviewer that works with your choice of LLM, at just the cost of tokens, showcasing the power of this library for building full products.
Explore the Full Documentation for detailed usage, advanced features, and practical examples.
Three Powerful Components
1. Core Toolkit - Build Your Own AI Developer Tools
The foundation that powers everything: a production-ready library for codebase mapping, symbol extraction, and intelligent code search. Build your own code reviewers, generators, IDE plugins, or any LLM-powered development tool. Features a comprehensive CLI and Python API.
2. Kit Dev MCP - Supercharge Your AI Assistant
An enhanced MCP (Model Context Protocol) server that gives Cursor, Windsurf, Claude Code, and VS Code super-powered context capabilities:
- Smart context building for any development task
- Real-time file watching and change detection
- AST-based pattern matching to find code by structure
- Documentation research for any package
- Symbol extraction and dependency analysis
- And much more
→ Explore Kit Dev MCP Documentation
3. AI PR Reviewer - Production-Ready Code Reviews
A complete, customizable pull request reviewer that rivals paid services:
- Whole repo context analysis
- Custom review profiles for your organization
- Security vulnerability detection
- Performance analysis
- Works from CLI or CI/CD
- Just pay for tokens
Quick Installation
Install from PyPI
pip install cased-kit
# With ML features for advanced code analysis (includes PyTorch, sentence-transformers)
pip install cased-kit[ml]
# Everything (including MCP server and all features)
pip install cased-kit[all]
Install Globally with uv (Recommended for CLI usage)
If you want to use the kit CLI globally without affecting your system Python, use uv tool install. This creates an isolated environment for kit while making the CLI available from anywhere:
# Install the base kit CLI globally
uv tool install cased-kit
# With ML features for advanced code analysis (includes PyTorch, sentence-transformers)
uv tool install cased-kit[ml]
# Everything (including MCP server and all features)
uv tool install cased-kit[all]
After installation, the kit and kit-dev-mcp commands will be available globally. To manage your uv tool installations:
# List installed tools
uv tool list
# Uninstall if needed
uv tool uninstall cased-kit
Install from Source
git clone https://github.com/cased/kit.git
cd kit
uv venv .venv
source .venv/bin/activate
uv pip install -e .
Basic Toolkit Usage
Python API
from kit import Repository
# Load a local repository
repo = Repository("/path/to/your/local/codebase")
# Load a remote public GitHub repo
# repo = Repository("https://github.com/owner/repo")
# Load a private GitHub repo (automatically uses KIT_GITHUB_TOKEN if set)
# repo = Repository("https://github.com/owner/private-repo")
# Or explicitly: repo = Repository("https://github.com/owner/private-repo", github_token="ghp_...")
# Load a repository at a specific commit, tag, or branch
# repo = Repository("https://github.com/owner/repo", ref="v1.2.3")
# Explore the repo
print(repo.get_file_tree())
# Output: [{"path": "src/main.py", "is_dir": False, ...}, ...]
print(repo.extract_symbols('src/main.py'))
# Output: [{"name": "main", "type": "function", "file": "src/main.py", ...}, ...]
# Access git metadata
print(f"Current SHA: {repo.current_sha}")
print(f"Branch: {repo.current_branch}")
# Read one file
main_py = repo.get_file_content("src/main.py")
# Read many files in one round-trip
contents = repo.get_file_content([
"src/main.py",
"src/utils/helper.py",
"tests/test_main.py",
])
print(contents["src/utils/helper.py"])
Command Line Interface
kit also provides a comprehensive CLI for repository analysis and code exploration:
# Get repository file structure
kit file-tree /path/to/repo
# Extract symbols (functions, classes, etc.)
kit symbols /path/to/repo --format table
# Search for code patterns
kit search /path/to/repo "def main" --pattern "*.py"
# Find symbol usages
kit usages /path/to/repo "MyClass"
# Export data for external tools
kit export /path/to/repo symbols symbols.json
# Initialize configuration for reviews
kit review --init-config
# Review GitHub PRs
kit review --dry-run https://github.com/owner/repo/pull/123
kit review https://github.com/owner/repo/pull/123
# Review local git diffs (no PR required!)
kit review main..feature # Compare branches
kit review HEAD~3..HEAD # Review last 3 commits
kit review --staged # Review staged changes
# Generate PR summaries for quick triage
kit summarize https://github.com/owner/repo/pull/123
kit summarize --update-pr-body https://github.com/owner/repo/pull/123
# Generate intelligent commit messages from staged changes
git add . # Stage your changes first
kit commit # Analyze and commit with AI-generated message
The CLI supports all major repository operations with Unix-friendly output for scripting and automation. See the CLI Documentation for comprehensive usage examples.
Key Toolkit Capabilities
kit helps your apps and agents understand and interact with codebases, with components to build your own AI-powered developer tools.
-
Explore Code Structure:
- High-level view with
repo.get_file_tree()to list all files and directories. You can also pass a subdirectory for a more limited scan. - Dive down with
repo.extract_symbols()to identify functions, classes, and other code constructs, either across the entire repository or within a single file. - Use the new (as of 1.1.0) and faster
repo.extract_symbols_incremental()to get fast, cache-aware symbol extraction—best when dealing with small changes to repositories.
- High-level view with
-
Pinpoint Information:
- Run regular expression searches across your codebase using
repo.search_text(). - Track specific symbols (like a function or class) with
repo.find_symbol_usages(). - Find code by structure with AST-based pattern matching (async functions, try blocks, class inheritance, etc.).
- Run regular expression searches across your codebase using
-
Prepare Code for LLMs & Analysis:
- Break down large files into manageable pieces for LLM context windows using
repo.chunk_file_by_lines()orrepo.chunk_file_by_symbols(). - Get the full definition of a function or class off a line number within it using
repo.extract_context_around_line().
- Break down large files into manageable pieces for LLM context windows using
-
Generate Code Summaries:
- Use LLMs to create natural language summaries for files, functions, or classes using the
Summarizer(e.g.,summarizer.summarize_file(),summarizer.summarize_function()). - Works with any LLM: free local models (Ollama), or cloud models (OpenAI, Anthropic, Google).
- Build a searchable index of these AI-generated docstrings with
DocstringIndexerand query it withSummarySearcherfor intelligent code discovery.
- Use LLMs to create natural language summaries for files, functions, or classes using the
-
Analyze Code Dependencies:
- Map import relationships between modules using
repo.get_dependency_analyzer()to understand your codebase structure. - Generate dependency reports and LLM-friendly context with
analyzer.generate_dependency_report()andanalyzer.generate_llm_context().
- Map import relationships between modules using
-
Repository Versioning & Historical Analysis:
- Analyze repositories at specific commits, tags, or branches using the
refparameter. - Compare code evolution over time, work with diffs, ensure reproducible analysis results
- Access git metadata including current SHA, branch, and remote URL with
repo.current_sha,repo.current_branch, etc.
- Analyze repositories at specific commits, tags, or branches using the
-
Multiple Access Methods:
- Python API: Direct integration for building applications and scripts.
- Command Line Interface: 11+ commands for shell scripting, CI/CD, and automation workflows.
- TypeScript / Node Client:
npm install @runcased/kitfor type-safe wrapper that shells out to the same CLI. - REST API: HTTP endpoints for web applications and microservices.
- MCP Server: Model Context Protocol integration for AI agents and development tools.
High-Performance Incremental Analysis
kit's incremental analysis system provides intelligent caching that dramatically improves performance for repeated symbol extraction operations. This system is particularly powerful for development workflows where you're iterating on code and need fast analysis of changes.
Key Performance Benefits:
- 25x faster symbol extraction on warm cache scenarios
- Per-file incremental analysis: Only analyzes files that have actually changed
- Multi-strategy cache invalidation: Uses file modification time, size, and content hash for accurate change detection
- Automatic git state detection: Invalidates caches when you switch branches, commit, merge, or rebase
- LRU cache management: Automatically manages memory usage with configurable cache size limits
Manual Cache Management:
# Get performance statistics
stats = repo.get_incremental_stats()
print(f"Cache hit rate: {stats['cache_hit_rate']}")
# Clean up stale entries
repo.cleanup_incremental_cache()
# Clear all cached data
repo.clear_incremental_cache()
MCP Server (Kit Dev MCP)
The kit tool includes an enhanced MCP (Model Context Protocol) server called Kit Dev MCP that allows AI agents and development tools to interact with codebases programmatically. This MCP server provides advanced context capabilities beyond basic file operations.
Key Features:
- Smart context building for any development task
- Real-time file watching and change detection
- AST-based pattern matching (find async functions, error handlers, etc.)
- Documentation research for any package
- Symbol extraction and dependency analysis
- Integration with Cursor, Windsurf, Claude Code, and VS Code
→ Full Kit Dev MCP Documentation
Quick Setup
Add a stanza like this to your MCP configuration:
{
"mcpServers": {
"kit-dev-mcp": {
"command": "uvx",
"args": ["--from", "cased-kit", "kit-dev-mcp"],
"env": {
"KIT_GITHUB_TOKEN": "ghp_your_token_here" // Optional: for private repos
}
}
}
}
This requires you have uvx installed (pip install uvx or pipx install uvx).
If you have installed cased-kit with pip or some other method, you can invoke with python:
{
"mcpServers": {
"kit-dev-mcp": {
"command": "python",
"args": ["-m", "kit.mcp.dev"]
}
}
}
The python executable invoked must be the one where cased-kit is installed.
If you see ModuleNotFoundError: No module named 'kit', ensure the Python
interpreter your MCP client is using is the correct one.
kit-powered Features & Utilities
As both demonstrations of this library, and as standalone products,
kit ships with MIT-licensed, CLI-based pull request review and summarization features.
PR Reviews
The pull request reviewer ranks with the better closed-source paid options, but at
a fraction of the cost with cloud models. At Cased we use kit extensively
with models like Sonnet 4 and gpt4.1, paying just for the price of tokens.
kit review --init-config
kit review https://github.com/owner/repo/pull/123
Key Features:
- Whole repo context: Uses
kitso has all the features of this library - Production-ready: Rivals paid services, but MIT-licensed; just pay for tokens
- Custom context profiles: Organization-specific coding standards and review guidelines automatically applied
- Cost transparency: Real-time token usage and pricing
- Fast: No queuing, shared services: just your code and the LLM
- Works from wherever: Trigger reviews with the CLI, or run it via CI
kit also has first-class support for free local models via Ollama.
No API keys, no costs, no data leaving your machine.
📖 Complete PR Reviewer Documentation
PR Summaries
For quick PR triage and understanding, kit includes a fast, cost-effective PR summarization feature.
Perfect for teams that need to quickly understand what PRs do before deciding on detailed review.
kit summarize https://github.com/owner/repo/pull/123
kit summarize --update-pr-body https://github.com/owner/repo/pull/123
Key Features:
- 5-10x cheaper than full reviews (~$0.005-0.02 vs $0.01-0.05+)
- Fast triage: Quick overview of changes, impact, and key modifications
- PR body updates: Automatically add AI summaries to PR descriptions for team visibility
- Same LLM support: Works with OpenAI, Anthropic, Google, and free Ollama models
- Repository intelligence: Leverages symbol extraction and dependency analysis for context
Commit Messages
Generate intelligent commit messages from staged changes using the same repository intelligence:
git add . # Stage your changes
kit commit # Analyze and commit with AI-generated message
Documentation
Explore the Full Documentation for detailed usage, advanced features, and practical examples. Full REST documentation is also available.
Kit Dev MCP Documentation - Complete guide for the enhanced MCP server
📝 Changelog - Track all changes and improvements across kit releases
License
MIT License
Contributing
- Local Development: Check out our Running Tests guide to get started with local development.
- Project Direction: See our Roadmap for future plans and focus areas.
- Discord: Join the Discord to talk kit and Cased
To contribute, fork the repository, make your changes, and submit a pull request.
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 cased_kit-2.0.0rc3.tar.gz.
File metadata
- Download URL: cased_kit-2.0.0rc3.tar.gz
- Upload date:
- Size: 309.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce78b3d23f7b068a5c180435907905b47edaaaeb2d6967a3f2bd63ca0caaa258
|
|
| MD5 |
6e095111194db741a2a3c0edd8eaf03f
|
|
| BLAKE2b-256 |
28ba61c7f3d9b03f00023342ed1254296bfe14f554c4a76dd1913c4fa5ec341b
|
File details
Details for the file cased_kit-2.0.0rc3-py3-none-any.whl.
File metadata
- Download URL: cased_kit-2.0.0rc3-py3-none-any.whl
- Upload date:
- Size: 191.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d811d21af4b72e574f77e705357f0d53cabd186384076814fb31c48167b5b0b9
|
|
| MD5 |
b266010fdf86c349979b354ac968a500
|
|
| BLAKE2b-256 |
a291d9f23b7f60512cee2ff4480dfcb6f5b69da742f3f91842834757182af4e3
|