This page explains how to install codebase-index and make it available in Claude Code, Codex CLI, or OpenCode.
Distribution:
codebase-indexis not on PyPI. It is installed directly from GitHub viagit+https://...@<tag>. Pin to a release tag (e.g.@v1.3.0) for reproducible installs; use@mainto track the latest.
- New user: use Option 1.
- Working across many repos: use Option 2.
- CLI-only usage (without skill scaffolding): use Option 3.
- Advanced local features (watch/embeddings): use Option 4.
- Python: 3.11 or later
- OS: macOS, Linux, Windows
- Disk: ~50 MB for the package + SQLite index (varies by project size)
- Memory: ~200 MB during indexing (varies by project size)
Install the tagged GitHub release and scaffold the skill into your project:
cd your-project
pip install "codebase-index @ git+https://github.com/denfry/codebase-index.git@v1.3.0"
codebase-index init
codebase-index indexIn an interactive terminal, init opens a target picker and marks detected CLIs.
For automation, use --target claude|codex|opencode|auto|all.
This writes the selected CLI instructions (.claude/skills/..., Codex AGENTS.md
plus .codex/skills/..., or OpenCode command/agent files), a resolved config.json,
and adds the cache directory to .gitignore. Use --force to overwrite an existing
install, or --with-hooks to auto-merge the Claude Code PostToolUse update hook into
.claude/settings.json (a reviewable example is also written as a reference copy).
Clone once and symlink into multiple projects:
# Clone to a central location
git clone https://github.com/denfry/codebase-index.git ~/codebase-index
# Install the Python package
cd ~/codebase-index
pip install -e .
# Symlink into each project
ln -s ~/codebase-index/skill ~/.claude/skills/codebase-index# Using pip from the tagged GitHub release
pip install "codebase-index @ git+https://github.com/denfry/codebase-index.git@v1.3.0"
# Using pipx from GitHub (isolated environment)
pipx install "git+https://github.com/denfry/codebase-index.git@v1.3.0"
# Using uv from GitHub
uv tool install "git+https://github.com/denfry/codebase-index.git@v1.3.0"
# From source (editable mode)
git clone https://github.com/denfry/codebase-index.git
cd codebase-index
pip install -e ".[dev]"# With local embeddings support
pip install -e ".[embeddings-local]"
# With file watching support
pip install -e ".[watch]"
# With all optional features
pip install -e ".[embeddings-local,watch,dev]"As of 1.3.0, this documentation treats GitHub tag installs as the verified
path. PyPI, uvx codebase-index init, Homebrew tap installation, signed
checksums, and SBOMs are distribution targets for a more complete release story.
Target future commands:
uvx codebase-index init
pipx install codebase-index
brew install denfry/tap/codebase-indexOn a machine with only Python + pipx:
pipx install "git+https://github.com/denfry/codebase-index.git@v1.3.0"
cd /path/to/your/repo
codebase-index init # writes .claude/skills/codebase-index/ + .gitignore rules
codebase-index index # builds .claude/cache/codebase-index/index.sqlite
codebase-index --json search "<a term from your code>" # -> {"index": {"exists": true, ...}}If search returns "exists": true with results, the install is healthy. Maintainers can run the
same path automatically with python scripts/release_smoke.py.
codebase-index --help
codebase-index doctorExpected output:
=== codebase-index Doctor ===
[OK] Python 3.12 (requires 3.11+)
[OK] codebase-index package installed (v1.3.0)
[OK] tree-sitter is available
[INFO] Cache directory not yet created: ...
[INFO] Skill not installed in .claude/skills/
[INFO] No config file (using defaults)
All checks passed.
After installing the Python package, ensure the skill is available to Claude Code:
- The skill directory should be at
.claude/skills/codebase-index/in your project. - The
SKILL.mdfile must be present in the skill directory. - Claude Code will automatically detect and use the skill for codebase questions.
If the skill is not detected:
# Run the install script
python skill/scripts/install.py
# Or manually copy
cp -r skill/ .claude/skills/codebase-index/To keep the index fresh after edits, you can enable a PostToolUse hook in Claude Code. Run codebase-index init --with-hooks to auto-merge the hook into .claude/settings.json (a reviewable example is also written to .claude/skills/codebase-index/examples/hooks/settings.json as a reference copy). The merge is idempotent — running init --with-hooks again won't duplicate the hook.
Use codebase-index doctor to verify which hooks are enabled. For heavy editing sessions, consider watch mode instead (see below).
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [
{
"type": "command",
"command": "codebase-index update --quiet >/dev/null 2>&1 &",
"timeout": 5
}
]
}
]
}
}For heavy editing sessions, watch mode keeps the index fresh via a debounced filesystem observer. Requires the [watch] extra:
pip install "codebase-index[watch] @ git+https://github.com/denfry/codebase-index.git@v1.3.0"
codebase-index watch --debounce 500The watcher coalesces bursts of file edits into a single incremental update after a quiet window, so it never blocks or thrashes the edit loop. Ctrl-C to stop. Without watchdog installed, watch exits with a clear error and install guidance.
The index is stored in:
.claude/cache/codebase-index/
├── index.sqlite # SQLite database with FTS5
├── config.json # Resolved configuration
└── logs/ # Indexing logs (if enabled)
This directory is in the default .gitignore and should never be committed.
Ensure the package is installed and in your PATH:
pip show codebase-index
python -m codebase_index --helpIf using pipx:
pipx ensurepath
source ~/.bashrc # or ~/.zshrcSymbol extraction requires tree-sitter:
pip install tree-sitter tree-sitter-language-packRun an incremental update (mtime/sha/git aware, safe to run from a hook or watcher):
codebase-index updateNarrow to git-changed files since a ref:
codebase-index update --since HEAD~1Force re-check of every file:
codebase-index update --allOr a full rebuild:
codebase-index index- Verify the skill directory exists:
.claude/skills/codebase-index/SKILL.md - Check Claude Code settings for skill discovery paths.
- Run
codebase-index doctorto verify the installation.
If doctor warns about external embeddings, check your config:
cat .codeindex.json | grep allow_externalSet allow_external to false to disable external API calls.
pip install "codebase-index @ git+https://github.com/denfry/codebase-index.git@v1.3.0"
cd your-project
codebase-index init
codebase-index index
codebase-index doctor
codebase-index search "where is authentication implemented?"If the command returns ranked results and recommended reads, your setup is complete.