Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 11 min read Deep dive mediumAdept

Indexing code at scale with Glean

Glean is Meta's open-source code indexing system that stores arbitrary language-specific facts about source code in RocksDB and exposes them through Angle, a declarative logic-based query language that can derive language-neutral views, much like SQL views. Incremental indexing stacks immutable databases so each layer can add or hide facts, which brings indexing cost down to O(fanout) rather than O(repository) and lets the index serve multiple revisions without full copies. At Meta, Glean, together with the Glass symbol server, powers cross-language code navigation and C++ IDE acceleration alongside clangd. It also drives generated documentation, stable symbol IDs and diff sketches for code review, static analysis and commit search, with simple queries returning in about a millisecond.

Assumes: code navigation and LSP basicsDatalog-style or SQL queriesmonorepo development

Related posts

  • A brief history of code search at GitHub

    GitHub Engineering mediumAdept

    GitHub's code search evolved from a public-only Solr index plus `git grep` for private repos, to a decade-long Elasticsearch deployment that grew to 162 nodes, 1.25PB of storage and over 53 billion indexed files. Natural-language text analysis fits source code poorly. GitHub's custom tokenizer dropped punctuation and could not do substring or regex matching. An experiment that indexed special characters made indexing 43-100% slower, grew the index 18-28% and slowed typical queries about 2.1x. A short-lived exact-match beta also failed to balance its resource cost against corpus growth. Existing trigram engines like Russ Cox's and Zoekt also fell short at GitHub's scale, so GitHub built Blackbird, a bespoke engine targeting sub-second p95 global exact-match and regex queries without using much more resources than the Elasticsearch cluster.

  • The technology behind GitHub’s new code search

    GitHub Engineering mediumAdept

    GitHub built Blackbird, a Rust code search engine, because general text search engines handled punctuation, regex, and GitHub's scale poorly, and brute-force grep would yield about 0.01 QPS. It uses ngram inverted indices with lazily intersected posting-list iterators, shards by Git blob ID to deduplicate content, and delta-encodes repositories ordered by a similarity-based minimum spanning tree. Kafka decouples crawling from indexing and provides commit-level query consistency. Shards serve queries at about 100 ms p99 (roughly 640 QPS per 64-core host), and 115 TB of code fits in a 25 TB index that can be fully rebuilt in about 18 hours.

  • Beyond API Compatibility: Building a Tool to Measure the Blast Radius of Library Changes

    Netflix TechBlog mediumAdept

    Netflix's Quasar indexes symbol definitions and references across its repositories using SCIP, so library producers can see which consumers use the exact API symbols a change removes or modifies. CI builds submit SCIP indexes, which are stored as Parquet in S3 and queried with Athena. On pull requests, Quasar diffs base and head API snapshots and reports affected repositories, dependency-version distributions, sample call sites and evidence quality such as index freshness and truncation. The main lessons are to keep compatibility separate from reach, make the evidence inspectable, and never treat "no observed usages" as safe to remove. Netflix is extending the same context to coding agents via MCP for earlier warnings and assisted migrations.

  • Building a code search engine with Turso

    Turso mediumAdept

    Codemogger is an open-source code indexer and search engine for AI agents, built on a single local Turso (SQLite-compatible) file using native vector columns and full-text search. Tree-sitter splits code into function and struct chunks, which are embedded locally with all-MiniLM-L6-v2 and stored as int8-quantized vector8(384) columns (395 vs 1,536 bytes per vector). Brute-force cosine search over 40,000 TypeScript compiler chunks takes about 240ms on an M2, and BM25 keyword search with name/signature weights takes 1-4ms. Results are merged with Reciprocal Rank Fusion (0.6 vector, 0.4 FTS), and a TypeScript SDK accepts any embedding function and indexes incrementally by file hash.

  • Fast regex search: indexing text for agent tools · Cursor

    Cursor mediumAdept

    Agents lean heavily on regex search, and ripgrep's full scan can take over 15 seconds in large monorepos, so Cursor builds local indexes specifically to accelerate regex queries. The post traces the lineage of regex indexing: n-gram inverted indexes from Zobel et al. (1993) and Russ Cox's Google Code Search trigram approach, including how regexes are decomposed into trigram AND/OR queries, then livegrep's suffix arrays and GitHub Project Blackbird's trigram posting lists augmented with probabilistic masks (position and next-character bloom filters) to approximate '3.5-grams'. It weighs the tradeoffs of each: index size, query decomposition cost, and difficulty of dynamic updates.

The quest for software engineering knowledge.

Look:
Layout: