Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,28 @@ one tool and exits without the MCP stdio handshake β€” ideal for scripting.
| `--workspace <path>` | current dir | Directories to index (repeatable for multi-project) |
| `--exclude <dir>` | β€” | Directories to skip (repeatable) |
| `--embedding-model <model>` | `bge-small` | `bge-small` (384d, fast), `jina-code-v2` (768d, 6Γ— slower), `granite-97m` (384d, 32K ctx, ~3Γ— slower), or `static` (model2vec, 256d β€” ~100Γ— faster indexing, no ONNX; needs a local model dir, see below) |
| `--full-body-embedding` | `true` | Embed full function body (~50 lines) for better semantic search and duplicate detection |
| `--full-body-embedding` | `true` | Embed full function body (~50 lines) for better semantic search and duplicate detection. Takes a value: `--full-body-embedding=false` turns it off |
| `--split-identifiers` | `true` | Also embed the word-split form of identifiers whose words are run together, so `getUserById` embeds as "get user by id" too. Names already separated by `_` or `-` are left alone, since they tokenise into the same words; a leading or trailing delimiter separates nothing, so `_handleClick` is split like `handleClick`. Takes a value: `--split-identifiers=false` embeds raw names, as releases up to 0.20.1 did |
| `--max-files <n>` | 5000 | Maximum files to index |
| `--profile <name>` | `all` | Filter the exposed MCP tool surface to a named subset (see below) |
| `--graph-only` | off | Skip embedding generation β€” build the graph and serve structural tools only. No ONNX model load, 10-50Γ— faster indexing. Semantic search and memory tools unavailable. For CI / one-shot graph queries. |
| `--run-tool <name>` | β€” | One-shot mode: index, run a single tool, print its result, exit. No MCP handshake. Pair with `--tool-args '<json>'`. |

`--split-identifiers` and `--full-body-embedding` both change the text every
symbol is embedded from, and vectors built from different text cannot be ranked
against each other.
A project's stored vectors are therefore stamped with the settings that built
them - `--embedding-model` included, since models differ in dimension - and are
ignored by any process configured differently.
An index written by 0.20.1 or earlier carries no stamp, so it is re-embedded the
first time this version opens it; changing any of the three re-embeds in the
background rather than requiring a manual reindex.
Run `--watch` with the same flags as the sessions that read the project, so both
sides share one set instead of re-embedding over each other.
A daemon left running across an upgrade keeps writing vectors the new build
cannot match, and sessions attached to it serve without semantic search until it
is restarted - so restart `--watch` after upgrading.

#### `--embedding-model static` β€” model2vec fast indexing

Static (model2vec) embeddings replace the ONNX transformer with a token→vector
Expand Down
10 changes: 9 additions & 1 deletion crates/codegraph-memory/examples/embed_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,15 @@ fn metrics(ranks: &[usize]) -> Scores {

/// Returns (semantic-only, hybrid 0.4*BM25 + 0.6*cosine) scores.
fn evaluate(engine: &VectorEngine, syms: &[Sym]) -> (Scores, Scores) {
let split = std::env::var("CODEGRAPH_SPLIT_IDS").is_ok();
// Presence is not the question - `CODEGRAPH_SPLIT_IDS=0` must mean off.
// `is_ok()` made setting it to 0 turn the feature ON, which silently turned
// an A/B run into two identical arms. `=1` is the one spelling this harness
// documents, so it is the one spelling it accepts.
//
// Note this forces splitting on every identifier, unlike the engine, which
// applies it only to delimiter-free names: the point of this harness is to
// measure the lever in isolation.
let split = std::env::var("CODEGRAPH_SPLIT_IDS").as_deref() == Ok("1");
let sym_texts: Vec<String> = syms
.iter()
.map(|s| {
Expand Down
Loading
Loading