█

AI/TLDR

Buy me a coffee
Buy me a coffee

CocoIndex Code

AST-based semantic code search your coding agent can call

Code Indexing & SearchOpen source
Language
Python
License
Apache-2.0
IN SHORT

What is CocoIndex Code?

CocoIndex Code is a command-line semantic code search tool for a single repository. It sits in the Code Indexing & Search category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed Apache-2.0. To get started: install the CLI.

Overview

CocoIndex Code is a command-line semantic code search tool for a single repository. It chunks source files along their abstract syntax tree rather than on fixed line counts, embeds those chunks, and stores the index locally, so a query like "find how user sessions are managed" returns the functions that actually do that work instead of a list of files that happen to contain the words.

The project is built on CocoIndex, a Rust data transformation engine from the same authors, and ships as the `ccc` command. A background daemon starts on first use and keeps the index warm; the index itself lives in an LMDB database under `.cocoindex_code/` in the project, and the whole pipeline runs on the machine — the batteries-included install pulls in `sentence-transformers` so local embeddings work with no API key at all.

Its reason for existing is the coding agent rather than the human: the repository doubles as a plugin marketplace, so Claude Code, Grok and Oh My Pi can install a `ccc` skill that teaches the agent to index and search on its own, and `ccc mcp` exposes the same search as an MCP stdio server for any other client. The README's claim for the approach is a roughly 70% token saving on code exploration compared with reading files outright.

What it does

  • AST-aware chunking via CocoIndex's Rust engine, so retrieved chunks are whole functions and classes rather than arbitrary line windows
  • Local embeddings out of the box with the `[full]` install — `Snowflake/snowflake-arctic-embed-xs` is the default, and no API key is required
  • Three ways for an agent to reach it: an installable `ccc` skill, an MCP stdio server (`ccc mcp`), or the CLI directly
  • Incremental indexing driven by editor hooks — `SessionStart` and `PostToolUse` re-index only what changed
  • `ccc grep` does structural search-by-example with no index at all, for one-off queries
  • `ccc doctor` diagnoses settings, daemon health, embedding model, file matching and index status in one command

Getting started

Install the CLI, then either hand it to your coding agent as a skill or drive it yourself. The daemon starts automatically the first time you index.

Install the CLI

The `[full]` extra bundles sentence-transformers so local embeddings work without a cloud provider. Use pipx or uv — the README documents both.

bashbash
pipx install 'cocoindex-code[full]'
# or
uv tool install --upgrade 'cocoindex-code[full]'

Give it to your coding agent as a skill

This is the recommended path: the skill teaches the agent to initialize, index and search on its own, and keeps the index current as you work. No `ccc init` needed.

bashbash
npx skills add cocoindex-io/cocoindex-code

Or drive the CLI yourself

Useful for manual control, re-indexing after a settings change, or searching outside an agent. You can skip `ccc init` and go straight to `ccc index`, which auto-initializes a new project.

bashbash
ccc init                                # initialize project (creates settings)
ccc index                               # build the index
ccc search "authentication logic"       # search!

Or register it as an MCP server

`ccc mcp` runs the same search over MCP stdio, for clients that prefer a tool call to a skill.

bashbash
claude mcp add cocoindex-code -- ccc mcp

Check on it

`ccc status` reports chunk count, file count and the language breakdown; `ccc doctor` runs the full diagnostic when something looks wrong.

bashbash
ccc status
ccc doctor

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Stop a coding agent from burning its context window reading whole files just to locate one function
  • Search an unfamiliar repository by intent — "where do we validate webhooks?" — instead of guessing at grep patterns
  • Keep code search entirely on your own machine, with local embeddings and no API key or upload
  • Give several agents (Claude Code, Codex, Cursor) one shared index of the same project through MCP

How CocoIndex Code compares

CocoIndex Code alongside other open-source code indexing & search tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
CodeGraph★ 79.3kBuilds a local SQLite knowledge graph of a codebase with a Rust tree-sitter kernel, keeps it in sync through a file watcher, and serves symbols, call paths and blast radius to coding agents over MCP.
codebase-memory-mcp★ 49.4kA native MCP server that indexes a repository into a persistent tree-sitter knowledge graph of functions, call chains and routes, queried by agents through 15 tools.
GitNexus★ 49kIndexes a codebase into a knowledge graph of dependencies, call chains and execution flows, then exposes it to Claude Code, Cursor and Codex through MCP tools.
code-review-graph★ 33kA local-first code intelligence graph built with Tree-sitter that serves precise, incrementally-updated structural context to AI coding tools over MCP, so they read only the code a task needs.
XERJ★ 22.9kSingle-binary, Elasticsearch-compatible search engine whose autoindex command turns any folder of code, docs, logs or PDFs into typed indices that AI coding agents query via CLI or MCP instead of grepping.
Claude Context★ 12.7kAn MCP server that indexes your codebase into a vector database so AI coding agents can find relevant code by meaning instead of loading whole folders.
Graft★ 11.6kBuilds a persistent knowledge graph of your codebase as linked markdown files, then feeds the matching nodes to coding agents so they stop re-exploring the repo on every task.
CocoIndex Code★ 3kAST-based semantic code search your coding agent can call