SYSTEM Cited by 1 source
mbt index (Metals Build Tool index)¶
The mbt index (mbt = Metals Build Tool) is the
content-addressed index at the heart of
Metals v2. It is the main enabler of the "useful
immediately" contract — low
time-to-initial-intelligence — by
giving Metals repo-wide information before any build sync.
(Source: sources/2026-08-11-databricks-open-sourcing-metals-v2)
What it is¶
A content-addressed index of workspace sources, structured as a hash map from source file → file-local summary. Each entry records:
- the file's package declarations,
- definitions with their source locations (powering workspace symbol search and jump-to-definition), and
- compact bloom filters of the identifiers the file references (letting Metals quickly rule out files that cannot contain a reference before doing precise checks — powering broad find-references and find-implementations).
How reuse works¶
Metals discovers files via git ls-files --stage and uses Git blob OIDs to
decide which entries can be reused. When a file changes its blob OID changes, so
Metals recomputes just that file's entry and replaces it — everything else is
reused. Because each entry is derived from a single file, incremental updates
are straightforward (content-hash-incremental-index).
What it can answer before build sync¶
- diagnostics for cross-file references
- fuzzy symbol search
- jump-to-definition across the repo (but not into external dependencies or generated code — that needs build metadata via BSP)
- broad find-references / find-implementations via the per-document bloom filters
Numbers (Databricks monorepo)¶
- 936MB persisted, uncompressed
- 2.9M symbols across 142k+ Scala/Java/Protobuf files
- clean build 22s at full utilization across 32 cores
- parse a pre-built index from disk in 5s
- feeds the Scala fallback compiler's in-memory source-layout index in <50ms
Seen in¶
Related¶
- systems/metals-v2
- content-addressed-index
- concepts/bloom-filter
- incremental-indexing
- build-free-repo-index