Auto-generate AI context docs (CLAUDE.md / AGENTS.md) for any codebase
Project description
Your AI agent is flying blind. Fix it in one command.
gitcontext
Generate CLAUDE.md / AGENTS.md files for any codebase in seconds. Static analysis detects your stack, architecture, commands, and conventions. --deep mode uses Gemini or Claude to produce a rich context doc from actual source code.
The Problem
AI coding agents (Claude Code, Cursor, Copilot) work better with context files. Writing them manually is tedious and they go stale. Most repos have nothing, so your agent guesses wrong about your build system, test commands, and architecture.
Before: Agent hallucinates your project structure, runs wrong commands, misses conventions.
After: One command generates a context doc. Your agent knows your stack instantly.
$ gitcontext . --output CLAUDE.md
Quick Start
Run on your repo in 10 seconds:
pip install gitcontext
gitcontext . --output CLAUDE.md
That's it. Commit the file and your AI agent instantly knows your stack, commands, and architecture.
Install
pip install gitcontext
For AI-enhanced deep analysis:
pip install 'gitcontext[all]' # Gemini + Claude support
Usage
# Analyze current directory
gitcontext .
# Analyze any local repo
gitcontext /path/to/repo
# Analyze a GitHub repo directly (shallow clones it)
gitcontext https://github.com/huggingface/lerobot
# Write output to file
gitcontext . --output CLAUDE.md
# AGENTS.md format (slightly different structure)
gitcontext . --format agents
# Deep mode: LLM reads your source code for richer output
export GEMINI_API_KEY=... # or ANTHROPIC_API_KEY
gitcontext . --deep --output CLAUDE.md
# Choose model for deep analysis
gitcontext . --deep --model gemini-2.5-pro
Example Output (Static)
Running gitcontext . on huggingface/lerobot:
## Project Overview
lerobot — State-of-the-art Machine Learning for Real-World Robotics in Pytorch
## Tech Stack
Python · PyTorch · Hugging Face Transformers · Hugging Face Datasets · Gymnasium · uv
## Development Setup
uv sync --locked
## Key Commands
uv run pytest tests
pre-commit run --all-files
## Architecture
- benchmarks/ — Performance benchmarks
- docker/ — Docker configuration
- docs/ — Documentation
- examples/ — Example scripts and tutorials
- src/ — Source code
- tests/ — Test suite
## Entry Points
- lerobot-calibrate = lerobot.scripts.lerobot_calibrate:main
- lerobot-record = lerobot.scripts.lerobot_record:main
- lerobot-train = lerobot.scripts.lerobot_train:main
- ... and 14 more (see pyproject.toml)
## CI/CD
CI: GitHub Actions (benchmark_tests, docker_publish, documentation, fast_tests, full_tests)
Generated in ~2 seconds. No API key needed.
Deep Mode (--deep)
Deep mode sends your key source files (configs, entry points, core modules) to an LLM and generates a comprehensive context doc with:
- Architecture explanations (the why, not just file names)
- Conventions and patterns (naming, config systems, inheritance)
- Common gotchas and non-obvious behaviors
- Exact setup and contribution workflows
export GEMINI_API_KEY=your-key # Free tier works fine
gitcontext . --deep --output CLAUDE.md
Auto-detects provider from environment variables. Set GEMINI_API_KEY or GOOGLE_API_KEY for Gemini, ANTHROPIC_API_KEY for Claude.
See examples/output-deep-lerobot.md for sample deep output.
Supported Languages & Frameworks
| Category | Detected |
|---|---|
| Languages | Python, TypeScript, JavaScript, Rust, Go, Java, C/C++, Ruby, Kotlin |
| Python Frameworks | FastAPI, Flask, Django, PyTorch, TensorFlow, Click, Pydantic |
| JS/TS Frameworks | React, Next.js, Express, Vite, Svelte |
| Build Systems | pip, uv, poetry, npm, yarn, pnpm, cargo, go mod, cmake, make |
| CI/CD | GitHub Actions, GitLab CI, CircleCI, Jenkins |
| Test Frameworks | pytest, unittest, jest, vitest, cargo test, go test |
How It Works
- Walk the repo file tree (respects
.gitignorepatterns, skips binaries) - Detect languages by extension ratio, frameworks by dependency files, build/test/CI by config files
- Generate structured markdown from detections
With --deep:
- Select the ~15-20 most important files (configs, entry points, largest source modules)
- Send to Gemini/Claude with a prompt tuned for generating contributor-facing docs
- Output the LLM-generated CLAUDE.md
Total context sent to the LLM is capped at ~80K characters to stay within free tier limits.
Comparison
| gitcontext | gitingest | Manual | Nothing | |
|---|---|---|---|---|
| Auto-detects stack | Yes | No (dumps raw files) | N/A | N/A |
| Structured output | Yes | No | Yes | No |
| Works on any repo | Yes | Yes | No (per-repo effort) | N/A |
| AI-enhanced mode | Yes | No | No | No |
| Speed | ~2s static, ~15s deep | Varies | Hours | 0s |
| Output quality | High (targeted) | Raw dump | Highest | None |
gitingest gives you a raw file dump to paste into an LLM. gitcontext gives you a finished, structured context doc ready to commit.
GitHub Action
Keep your context doc up to date automatically. Add this to .github/workflows/update-context.yml:
name: Update CLAUDE.md
on:
push:
branches: [main]
paths:
- 'src/**'
- 'pyproject.toml'
- 'package.json'
- 'Cargo.toml'
jobs:
update-context:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jashshah999/gitcontext@main
with:
deep: false
output: CLAUDE.md
commit: true
For deep mode, add your API key as a repository secret and set deep: true:
- uses: jashshah999/gitcontext@main
with:
deep: true
output: CLAUDE.md
commit: true
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
See examples/workflow.yml for the full example.
Contributing
git clone https://github.com/jashshah999/gitcontext.git
cd gitcontext
pip install -e '.[all]'
pytest tests
PRs welcome. Keep it simple — the goal is a tool that works on any repo without configuration.
License
MIT
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 gitcontext_ai-0.1.0.tar.gz.
File metadata
- Download URL: gitcontext_ai-0.1.0.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f371bdf262f70e6ee3af42cf2cd45aad763e6fb8e2828776a2c8472743df2e3
|
|
| MD5 |
4b12e9dc26ce9b07c4de64232689c2d7
|
|
| BLAKE2b-256 |
804f8646486e17f9d9426f55f93b37d62ad4b04630323c34f397756cd9a6d73e
|
File details
Details for the file gitcontext_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gitcontext_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f67db5d56497c0c8aaff5abb12cb242d58f50319bd532fa5bb12a3b0d5f6ab51
|
|
| MD5 |
93402ec8c32b05c4727393549b2f6c68
|
|
| BLAKE2b-256 |
5b9c93edfde2ae46825061c318539ffdf24d5ebe4e605659e5ac3b7c38d49e21
|