Configuration
Engineering Corpus has no single settings file. Its settings sit in four places: the data folder, environment variables, the slice config that lists your repos, and the flags of each command. The flags are in the command reference.
The data folder
Section titled “The data folder”The engine keeps everything in one data folder per user. It picks the folder in this order:
--data-diron the command.- The
ENGINEERING_CORPUS_DATAenvironment variable, with a leading~expanded. $XDG_DATA_HOME/engineering-corpus, whenXDG_DATA_HOMEis an absolute path. A relative one is ignored.~/.local/share/engineering-corpus.
The folder is the same for every command, so corpus serve started in any project finds the index you built. Inside it:
| Entry | Holds |
|---|---|
index/ |
The search index. |
models/ |
The embedding model, downloaded from Hugging Face the first time it is needed, about 600 MB. |
repos/ |
A shallow bare clone of each indexed repo. |
registry.sqlite |
The list of repos, each repo’s license verdict and its secret-scan state. |
format.json |
The index format and the embedding the index was built with. See “Install and update”. |
eval/latest.json |
The last report of corpus eval, unless you chose another --out. |
Two folders sit elsewhere. corpus demo keeps its own index in ~/.cache/engineering-corpus/demo, though it takes the
model from the default data folder. The hooks keep a small state file per session in $XDG_CACHE_HOME/engineering-corpus/hooks,
or ~/.cache/engineering-corpus/hooks when XDG_CACHE_HOME is not set, and drop files older than 30 days.
Environment variables
Section titled “Environment variables”| Variable | What it does |
|---|---|
ENGINEERING_CORPUS_DATA |
The data folder. The Docker image sets it to /data. |
XDG_DATA_HOME |
Parent of the default data folder, when absolute. |
XDG_CACHE_HOME |
Parent of the hooks’ state folder. |
GH_TOKEN, GITHUB_TOKEN |
A GitHub token. The engine uses the first one that is set, for corpus stars, for the trust labels corpus index reads and for corpus bench --tool github. Without one, GitHub’s limit for unauthenticated requests applies. A token with characters a token cannot have is refused and the command exits with status 2. |
BETTERLEAKS |
The path of the Betterleaks binary. Default: betterleaks on PATH. The scan needs Betterleaks 1.x. |
ORT_DYLIB_PATH |
The ONNX Runtime library to load. Default: the one in the installed onnxruntime wheel. |
ENGINEERING_CORPUS_EMBED_THREADS |
The number of threads the embedder uses: a whole number from 1 to 256, or default for the runtime’s own choice. Unset, the engine uses the number of cores minus two on Apple silicon with six or more cores, and the runtime’s choice everywhere else. Whenever a number applies, the embedder’s workers do not spin-wait between operators. Any other value is reported once on standard error and ignored. The reranker keeps the runtime’s choice. |
ENGINEERING_CORPUS_HOOKS |
off, 0, false or no turns the hooks off, the write hook too when it is on. Case and surrounding spaces do not matter. |
ENGINEERING_CORPUS_WRITE_HOOK |
on, 1, true or yes turns the write hook on. It is off by default, and off it prints nothing and loads nothing. Case and surrounding spaces do not matter. |
ENGINEERING_CORPUS_HOOKS_DEBUG |
Any value makes a hook print the error it hid. Without it a hook prints nothing on failure. |
ENGINEERING_CORPUS_IMAGE |
Set in the Docker image. With it, corpus demo prints a docker run connect line instead of a uvx one. |
Before it starts Betterleaks, the engine removes BETTERLEAKS_CONFIG, GITLEAKS_CONFIG, BETTERLEAKS_CONFIG_TOML and
GITLEAKS_CONFIG_TOML from the scanner’s environment.
The slice config
Section titled “The slice config”The slice config is a TOML file that lists the repos to index. corpus stars writes one, and corpus index reads it.
./slice.toml is the default name. This is the file corpus demo uses:
[[repos]]url = "https://github.com/pallets/itsdangerous"default_branch = "main"licence = "BSD-3-Clause"commit = "672971d66a2ef9f85151e53283113f33d642dabd"
[[repos]]url = "https://github.com/BurntSushi/walkdir"default_branch = "master"licence = "Unlicense"commit = "6fd031c82ba5a4204b4ce6eae73dacb00dc072ec"The key is spelled licence, as the file reads it. Prose on this site writes “license”.
| Key | Where | Meaning |
|---|---|---|
exclude_owners |
top level | A list of owner name prefixes to leave out, ignoring case. A prefix may use only ASCII letters, digits and hyphens, up to 39 characters. A prefix no GitHub name can start with is an error, so a filter never silently matches nothing. |
url |
[[repos]] |
The repo’s https://github.com/OWNER/NAME address. Required. |
default_branch |
[[repos]] |
The branch to clone. Required. A name git would read as an option or that holds .. is refused. |
licence |
[[repos]] |
The repo’s declared license, as an SPDX expression. Optional. Without it the engine decides from the files. |
licence_overrides |
[[repos]] |
A table from a path inside the repo to a license expression, for a verdict you know is wrong. A plain path only, with no wildcard. The license policy explains overrides. |
private |
[[repos]] |
true marks a private repo, and intake skips it. The engine does not check visibility on GitHub, so it skips only what you mark. |
commit |
[[repos]] |
A full 40-character lowercase commit SHA to pin. Optional. |
Intake skips a repo marked private or whose owner matches exclude_owners, and says so on standard error. A key the file
should not have, a value of the wrong type or a repo listed twice stops the command with status 2, and an unknown key comes
with a hint at the key you probably meant.
The slice config has no key for file size. The engine itself keeps a file up to 2,000,000 bytes when it is source code, Markdown or reStructuredText, and up to 300,000 bytes for any other file; in a folder named test, tests, __tests__, testdata, spec or fixtures every file keeps the 300,000 limit. A minified or generated file is left out at any size. A documentation aggregate named llms-full or llms-txt is left out too, as generated; a short llms.txt stays. Index your stars lists what the summary line counts as skipped.
Install and update
Section titled “Install and update”Each channel has its own command for installing and for updating. None of them has the engine check for updates: the engine never calls home.
| Channel | Install | Update |
|---|---|---|
PyPI, with uv |
uvx engineering-corpus demo, or uv tool install engineering-corpus |
uvx engineering-corpus@latest --version refreshes uv’s copy and ends (serve would wait for a client, with nothing printed); restart your client to start the server again. Or uv tool upgrade engineering-corpus |
| Claude Code plugin | claude plugin marketplace add SOURCE, then claude plugin install engineering-corpus@engineering-corpus |
claude plugin marketplace update, then claude plugin update engineering-corpus, then restart Claude Code |
| Codex plugin | codex plugin marketplace add SOURCE, then codex plugin add engineering-corpus@engineering-corpus |
codex plugin marketplace upgrade refreshes a Git marketplace |
| Docker | docker pull ghcr.io/ymcbzrgn/engineering-corpus (linux/amd64 only) |
Pull again |
The package is on PyPI, so the uvx and uv tool lines work. To run the engine from a source checkout instead, use
uv run corpus. The plugin commands in the table are the ones --help lists for each client, and the
install commands are the ones the agent pack page ran. The update commands were not run. The Docker image is on GHCR, so docker pull works.
uvx engineering-corpus@latest --version prints the version and ends. With serve on the end it would wait for a client’s messages instead, and with nothing after the name it prints its usage and exits with status 2. Codex has no plugin update command, and nothing documents that an installed plugin follows a refreshed marketplace. If it still shows the old version after codex plugin marketplace upgrade, run codex plugin remove engineering-corpus@engineering-corpus, then add it again with codex plugin add engineering-corpus@engineering-corpus.
What happens to your index
Section titled “What happens to your index”Each data folder records what its index holds in format.json, written after its first index:
{ "dim": 768, "embedding": "Teradata/granite-embedding-english-r2@cb87d70caafcbb4b13471cee19238c50d2548a7f/onnx/model-fp32.onnx max 1024 tokens, pipeline 1", "engine": "0.1.0", "format": 1}format is the version of the index’s tables, columns and chunk text. embedding and dim name the model that made the
vectors and their width. engine says which version wrote the file, for people reading it, and the engine never compares it.
Every command compares this file with the running engine, and one of these happens:
- The two match, and the command goes on.
- The folder has no
format.jsonand holds no index. The first index writes the file. - The folder has no
format.jsonbut holds an index from before the file existed. When a sample of 16 stored chunks produces the same keys under this engine’s embedding, the engine adopts the index and writes the file. When it does not, the command stops and prints the rebuild command. - The folder was built with another embedding or vector width, or in an older format the engine cannot migrate. The
command stops and prints the command to run,
corpus index CONFIG --rebuild. The rebuild drops the whole index and embeds the repos inCONFIGagain. The clones stay. - The folder has a newer format than this engine knows. The command leaves the folder untouched and tells you to update
the package or use another
--data-dir. format.jsoncannot be read. The command stops and tells you to delete the file, so the engine checks the index again, or to rebuild.
The CHANGELOG.md in the engine’s repo states the index format of each
release with a line Index format: N. A release that changes it also carries Re-index required: yes and the command to
run. corpus demo is the one command that rebuilds its own folder without being asked, because the demo folder can be made
again.
These are real runs on copies of a data folder with four small repos indexed. In the first copy I edited format.json to read
"format": 2. In the second I changed the embedding value to the name of another model. Each refusal exits with status 1,
and the paths are shortened:
$ corpus search 'verify an HMAC signature' -k 1 --data-dir newer-copycorpus: index format: this data folder has index format 2, newer than the 1 this engine reads, so it is left alone: update engineering-corpus (for example `uvx engineering-corpus@latest`), or use another --data-dir$ corpus search 'verify an HMAC signature' -k 1 --data-dir other-embedding-copycorpus: index format: the index here was built with the embedding `Other/embedding-model@0123abcd max 512 tokens, pipeline 1 (768 dimensions)` and this engine embeds with `Teradata/granite-embedding-english-r2@cb87d70caafcbb4b13471cee19238c50d2548a7f/onnx/model-fp32.onnx max 1024 tokens, pipeline 1 (768 dimensions)`, so its vectors cannot be searched correctly: re-embed it with `corpus index <your slice config> --rebuild --data-dir other-embedding-copy` (the clones stay; every chunk is embedded again)A format.json that holds {bad stops the command too:
$ corpus search 'verify an HMAC signature' -k 1 --data-dir damaged-copycorpus: index format: damaged-copy/format.json: key must be a string at line 1 column 2: delete that file to have the engine check the index again, or re-embed with `corpus index <your slice config> --rebuild`A copy with no format.json and an index from before the file existed is adopted without a word. The search ran and
printed its hit as usual, and the folder then held a format.json with "format": 1 and this engine’s embedding:
$ corpus search 'verify an HMAC signature' -k 1 --data-dir unstamped-copy1.000 github.com/pallets/itsdangerous src/itsdangerous/signer.py:1-60 [P]