Generate AI context (rules + docs + conventions) from your codebase for Cursor, Claude Code, GitHub Copilot, and Continue.dev.
Stop maintaining 4 different rule files. Stop wasting tokens re-reading the same code. Let contextkit automatically extract your project's knowledge and export it to every AI coding tool your team uses.
Your team uses multiple AI coding tools:
- π¦ Cursor (
.cursorrules) - π§ Claude Code (
CLAUDE.md) - πͺ GitHub Copilot (
copilot-instructions.md) - π© Continue.dev (
.continue/rules/)
Every time someone joins or a new tool is adopted, rules get duplicated, drift apart, or disappear. Meanwhile, every developer keeps feeding the same codebase to the AI β burning tokens on every prompt.
$ cd my-project
$ contextkit init .
π Analyzing codebase...
π Extracted 14 coding rules
π Generated 6 doc sections
πΎ Exported to 4 formats
β¨ Done! Token savings: 71.3% (4,487 β 1,288 tokens)One command. Four formats. Zero duplication.
pip install contextkit# Analyze and generate context
contextkit init .
# Watch for changes and auto-regenerate
contextkit watch .
# Validate existing context files
contextkit validate .
# Compare with last snapshot
contextkit diff .ai-context
# Health check + auto-fix
contextkit doctor . --fix
# Merge multiple rule files
contextkit merge .cursorrules CLAUDE.md --output merged.md
# Generate a config file
contextkit config
# Create team plugins
contextkit plugin create team-standards
# Set up CI/CD
contextkit hook pre-commit
contextkit hook github-actionBy default, contextkit creates a .ai-context/ directory with:
.ai-context/
βββ cursor/
β βββ .cursorrules # Single-file format
β βββ .cursor/rules/ # Modular format (newer Cursor)
β βββ 00-project.md
β βββ 01-tech-stack.md
β βββ 02-conventions.md
β βββ 03-architecture.md
βββ claude/
β βββ CLAUDE.md # For Claude Code
β βββ API.md # (if API routes detected)
βββ copilot/
β βββ .github/
β βββ copilot-instructions.md
βββ continue/
βββ .continue/rules/
βββ project.md
βββ style.md
βββ naming.md
βββ architecture.md
βββ error_handling.md
βββ testing.md
βββ imports.md
βββ documentation.md
# New dev clones the repo
git clone ...
contextkit init .
# Now their AI assistant "knows" the codebase from day 1# Team switches from Cursor to Claude Code
contextkit init . --formats claude
cp .ai-context/claude/CLAUDE.md .
# All coding rules transferred automatically# Half uses Cursor, half uses Claude Code
contextkit init . --formats cursor,claude,copilot
# Everyone gets the same contextcontextkit estimate .
# β Token savings: 71%
# β Monthly savings (10 devs): $106ββββββββββββββββββββββββββββββββββββββββββββββββ
β YOUR CODEBASE β
β (Python, JS/TS, Go, Rust, etc.) β
ββββββββββββββββββββ¬ββββββββββββββββββββββββββββ
β
ββββββββββββΌβββββββββββ
β 1. ANALYZER β β Detects languages, frameworks,
β β lint/format configs, structure
ββββββββββββ¬βββββββββββ
β
ββββββββββββΌβββββββββββ
β 2. RULE EXTRACTOR β β Heuristics + optional LLM
β β (naming, style, error handling...)
ββββββββββββ¬βββββββββββ
β
ββββββββββββΌβββββββββββ
β 3. DOC GENERATOR β β Auto-generates architecture,
β β setup, API surface docs
ββββββββββββ¬βββββββββββ
β
ββββββββββββΌβββββββββββ
β 4. MULTI-FORMAT β β Exports to .cursorrules,
β EXPORTER β CLAUDE.md, copilot, continue
βββββββββββββββββββββββ
- β Naming conventions (snake_case, camelCase, etc.)
- β Linters/formatters (Black, Ruff, Prettier, ESLint, etc.)
- β Framework conventions (FastAPI async/await, React hooks, Go naming)
- β Error handling patterns (HTTPException, Result types, etc.)
- β Testing rules (pytest fixtures, Jest patterns)
- β Import organization (isort, absolute imports)
- β Documentation standards (docstrings, JSDoc)
- β Project overview (from README + pyproject.toml + package.json)
- β Architecture (structure type, entry points, key components)
- β Tech stack (languages, frameworks, tooling)
- β Setup instructions (package manager-aware)
- β API surface (detected from FastAPI/Express routes)
Tested on 3 sample projects:
| Project | Language | Rules | Token Savings |
|---|---|---|---|
| FastAPI Task Manager | Python | 14 | 71.3% |
| Next.js E-commerce | TypeScript | 10 | 34.8% |
| Go URL Shortener | Go | 2 | 81.7% |
contextkit init [PATH] [OPTIONS]
Options:
-o, --output DIR Output directory (default: .ai-context)
-f, --formats LIST Comma-separated: cursor,claude,copilot,continue
--no-llm Skip LLM analysis (faster, no API key needed)
--llm-model MODEL LLM model (default: claude-sonnet-4-5)
-n, --name NAME Override project name
-v, --verbose Verbose outputANTHROPIC_API_KEYβ Required for LLM-powered rule extraction (optional)
By default, contextkit uses heuristics (regex, AST analysis, config detection) to extract rules. This is fast, deterministic, and works offline.
For deeper insights, set ANTHROPIC_API_KEY and contextkit will additionally call Claude to extract:
- Architecture patterns specific to your codebase
- Non-obvious conventions
- Domain-specific rules
The heuristics run first, then LLM-extracted rules are merged in. If the LLM call fails, the heuristics still work.
| Feature | contextkit | Cursor | Mintlify | Greptile |
|---|---|---|---|---|
| Auto-generate from code | β | β | β | |
| Multi-tool export | β | β | β | β |
| Open source | β | β | β | β |
| Self-hosted | β | β | β | |
| Token optimization | β | β | N/A | β |
| Code + Docs unified | β | β | β | |
| Watch mode | β | β | β | β |
| Validation | β | β | β | β |
| Snapshot diff | β | β | β | β |
| Config file | β | β | β | |
| Plugin system | β | β | β | β |
| CI/CD hooks | β | β | β | β |
| Multi-source merge | β | β | β | β |
| Health diagnostics | β | β | β | β |
| Free | β | β |
- v0.1 β MVP with heuristic extraction + multi-format export
- v0.2 β Config file, validate, diff, watch, Java/C# support
- v0.3 β Plugin system, hooks, doctor, merge
- v0.4 β Web dashboard for team management
- v0.5 β VS Code extension
- v0.6 β Real-time context updates via webhooks
- v1.0 β Team centralization (SSO, audit, RBAC)
# Clone
git clone https://github.com/itsurge/contextkit
cd contextkit
# Install in editable mode
pip install -e ".[dev]"
# Test on sample repos
cd ../test-repos/fastapi-sample
contextkit init . --no-llmWe welcome PRs! Especially:
- π More language support (Rust, Java, C#, Ruby)
- π§ Smarter rule extraction
- π¦ New export formats
- π Bug fixes
- π Documentation
MIT β see LICENSE
The AI coding revolution is happening, but most teams are stuck in a messy reality:
- Multiple AI tools in use
- Outdated or missing rule files
- Wasted tokens re-reading the same code
- No standardization
contextkit fixes this with a single command that works for every tool.
Built with β€οΈ by developers who got tired of writing the same .cursorrules four times.