index_codebase
Index a codebase's Python, Rust, and Markdown chunks for search, with incremental or forced full re-indexing to support locating relevant code by text or meaning.
Instructions
Index a codebase's words for search.
Splits Python, Rust and Markdown files into functions, classes, methods, module
docstrings and document sections, and stores them with their words; it embeds nothing,
and a server set to search by meaning too embeds them on its next search.
search_code indexes on its own; call this only to re-index everything.
With force: true, it re-indexes everything even if files haven't changed; a model
whose weights nothing pins, as a local path, has its vectors dropped too, so a server
set to search by meaning embeds every chunk again on its next search. Otherwise, only
new and modified files are indexed (incremental).
Args: project_path: Absolute path to the project; a directory inside a git repository indexes the whole repository, unless the repository ignores it or holds the user's home directory. Left out, the client's workspace root, which must lie in a git repository. force: Re-index all files regardless of changes.
Returns: The root of the project indexed, and what the run indexed and deleted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | ||
| project_path | No | Absolute path to the project, or to a directory inside its git repository. Left out, the client's workspace root: the directory Claude Code was started in, which must lie in a git repository. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_root | Yes | The root of the project whose index this is: a directory inside a git repository is indexed, and reported, with its whole repository. | |
| files_deleted | Yes | ||
| files_indexed | Yes | ||
| chunks_indexed | Yes | ||
| duration_seconds | Yes |