GitHub

Configuration

An RCE Code index is configured with one object: CodeConfig, a frozen dataclass. It names the repository to index, where the SQLite database lives, the ingest limits, and whether embeddings are enabled. Pass an instance to CodeEngine.open_or_create(repo_path, config=...), or omit it and let the facade build a default one from the repo path.

Import it from the package root:

import
from rce.code import CodeConfig

Frozen and validated on construction

CodeConfig is @dataclass(frozen=True) — fields cannot be reassigned after construction. Its __post_init__ derives db_path and normalizes repo_path to a Path at construction time (described below).

Fields

FieldTypeDefaultDescription
repo_pathPathrequiredThe tree to index. The only required field. Accepts a str or Path; it is coerced to a Path in __post_init__.
db_pathPath | NoneNone<repo>/.rce/code/index.dbSQLite database location. When left as None, it is derived in __post_init__ as repo_path / ".rce" / "code" / "index.db".
max_file_sizeint1_000_000 (bytes)Ingest limit: files larger than this are skipped.
max_chunk_linesint60Ingest limit on chunk size, in lines.
enable_embeddingsboolFalseWhether semantic embedding is on.
vector_backendstr"numpy"Vector backend: "numpy" (the portable default) or "sqlite-vec". See Vector Backends.
extra_ignoretuple[str, ...]() (empty tuple)Additional ignore globs, layered on top of the built-in ignore set.

enable_embeddings vs. embedding behavior

enable_embeddings is a configuration flag and defaults to False. Whether embeddings are actually computed is driven by calling engine.embed() and by which embedder you pass to open_or_create; see Embedders.

Construction and __post_init__

Because the dataclass is frozen, __post_init__ uses object.__setattr__ to perform two normalizations the moment a config is built:

  • db_path derivation. If db_path is None, it is set to repo_path / ".rce" / "code" / "index.db". After construction, db_path is therefore never None open_or_create relies on this and asserts it.
  • repo_path coercion. repo_path is wrapped in Path(...), so passing a plain string is fine; it is stored as a Path.
post_init.py
from rce.code import CodeConfig
# repo_path given as a str is coerced to Path; db_path is derived.
cfg = CodeConfig(repo_path="/path/to/repo")
print(type(cfg.repo_path)) # <class 'pathlib.PosixPath'>
print(cfg.db_path) # /path/to/repo/.rce/code/index.db

Examples

Default configuration

The simplest path is to skip the config entirely and let CodeEngine.open_or_create build a default CodeConfig from the repo path:

default.py
from rce.code import CodeEngine
# open_or_create builds CodeConfig(repo_path=Path(repo)) for you.
engine = CodeEngine.open_or_create("/path/to/repo")
# index DB at /path/to/repo/.rce/code/index.db
engine.close()

Equivalently, construct the config explicitly and pass it in:

explicit_default.py
from rce.code import CodeEngine, CodeConfig
cfg = CodeConfig(repo_path="/path/to/repo")
engine = CodeEngine.open_or_create("/path/to/repo", config=cfg)
engine.close()

Custom db_path

Override db_path to keep the index outside the repository — useful for read-only checkouts or shared cache directories:

custom_db.py
from pathlib import Path
from rce.code import CodeEngine, CodeConfig
cfg = CodeConfig(
repo_path="/path/to/repo",
db_path=Path("/var/cache/rce-code/repo.db"),
)
engine = CodeEngine.open_or_create("/path/to/repo", config=cfg)
engine.close()

sqlite-vec vector backend

Switch the vector backend from the default "numpy" to "sqlite-vec". See Vector Backends for the trade-offs and the extra dependency it requires:

sqlite_vec.py
from rce.code import CodeEngine, CodeConfig
cfg = CodeConfig(
repo_path="/path/to/repo",
vector_backend="sqlite-vec",
)
engine = CodeEngine.open_or_create("/path/to/repo", config=cfg)
engine.index()
engine.embed()
engine.close()

Extra ignore globs and ingest limits

Layer additional ignore globs on top of the built-in set, and tighten the ingest limits:

tuning.py
from rce.code import CodeConfig
cfg = CodeConfig(
repo_path="/path/to/repo",
extra_ignore=("*.min.js", "vendor/**"),
max_file_size=500_000, # skip files larger than 500 KB
max_chunk_lines=40,
)

Where config feeds in

repo_path, max_file_size, max_chunk_lines, and extra_ignore shape the indexing pipeline; db_path selects the SQLite store; and vector_backend selects how embeddings are stored and queried for semantic search.