Skip to content
Merged
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
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ members = [
]

[workspace.package]
version = "0.20.1"
version = "0.21.0"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/codegraph-ai/codegraph"
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The server indexes the current working directory automatically.
Install the VSIX:

```bash
code --install-extension codegraph-0.20.1.vsix
code --install-extension codegraph-0.21.0.vsix
```

One VSIX serves every platform.
Expand Down Expand Up @@ -85,6 +85,23 @@ one tool and exits without the MCP stdio handshake β€” ideal for scripting.

---

## Upgrading to 0.21

Each project re-embeds once, in the background, the first time 0.21 opens it.
Stored vectors now record the model and settings that built them, and an index from 0.20.1 or earlier records none.
Keyword search keeps working while it runs.

Restart any `--watch` daemon after upgrading.
A daemon left running keeps writing vectors that 0.21 will not load, and sessions attached to it run without semantic search until it restarts.

Identifiers whose words run together, like `getUserById`, are now also embedded in word-split form.
This mostly helps natural-language search in camelCase languages such as TypeScript, Java and C#.
Pass `--split-identifiers=false` to keep the old behaviour.

`--full-body-embedding=false` now takes effect; in 0.20.1 the flag was always on.

---

## Configuration

### MCP Server flags
Expand All @@ -94,12 +111,19 @@ 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.
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.
For what this means when upgrading from 0.20.1 or earlier, see [Upgrading to 0.21](#upgrading-to-021).

#### `--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