Quick Start
Go from a checked-out repository to ranked search results in a few minutes. This page runs the same flow two ways — through the CodeEngine Python facade and through the rce-code CLI — using nothing but the offline default install.
The shape is identical either way: open or create an index for a repo, index it, embed its chunks, then search and build a repo map. Indexing and embedding are incremental, so re-running them on an unchanged tree is nearly free.
Using Python
Open or create the index
CodeEngine.open_or_create opens the index database for a repo (creating and migrating it on first use) and returns a ready facade. The index lives at <repo>/.rce/code/index.db.
Index and embed
index() walks the repo, parses with tree-sitter, chunks along definition boundaries, extracts symbols and references, and resolves the call graph. embed() then embeds any chunks that lack a current embedding — with the default offline HashingEmbedder, no network is used.
Run a hybrid search
search_hybrid fuses lexical, semantic, and symbol results with Reciprocal Rank Fusion and returns a list of SearchResult. Each hit carries a score and the matched chunk.
Build a repo map, then close
build_repo_map renders a relevance-ranked, token-budgeted map of the repository, optionally biased toward focused files. Call close() when you are done to release the database connection.
The whole flow as a single script:
Offline by default
HashingEmbedder is deterministic and needs no network, so semantic and hybrid search work right after install. Pass a real embedder to open_or_create when you want embedding quality — OpenAI-compatible, sentence-transformers, or your own. See Embedders.Using the CLI
Installing the package provides a rce-code command. Every subcommand takes --repo, which defaults to the current directory (.). The CLI mirrors the Python flow.
Run rce-code search-hybrid before embed and you still get lexical and symbol matches — semantic results join the fusion once chunks are embedded. Pass -k / --top-k to a search command to change the result count, and repeat --focus to bias the repo map toward several files.
See all options
rce-code --help for the full subcommand list, or rce-code <command> --help for a single command's flags. Other subcommands include search (lexical), search-semantic, grep, symbols, find, refs, callers, and callees.