bf-tree
Copilot instructions1.1k starsChanged 6 months agoMITView on GitHub
Rust toolchain is pinned to 1.95.0 via rust-toolchain.toml. Bf-Tree is a concurrent, larger-than-memory B+-tree range index. The core data flow:
Trending
Quiet since September.thin dataabout the whole repository
Who's talking about microsoft/bf-tree
- A Hacker News story“Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index”Hacker News · Jan 28, 2026 · 143 points
- @xiangpeng.systems“After two years since publication, Bf-Tree is finally open-sourced github.com/microsoft/bf... The GitHub …”Bluesky · Jan 29, 2026 · 11 likes
- @sungkim.bsky.social“Microsoft's Bf-Tree A modern read-write-optimized concurrent larger-than-memory range index in Rust. Repo: …”Bluesky · Jan 30, 2026 · 6 likes
- @hackernewsbot.bsky.social“Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index | Discussion”Bluesky · Jan 28, 2026 · 3 likes
- @spinscale.bsky.social“Bf-Tree is a modern read-write-optimized concurrent larger-than-memory range index in Rust from MS Research …”Bluesky · Mar 10, 2026 · 2 likes
The biggest 5 of 9 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 9
Talked about on Bluesky, GitHub and Hacker News (9 times).
On Bluesky · 5
- Jan 29, 2026After two years since publication, Bf-Tree is finally open-sourced github.com/microsoft/bf... The GitHub repo just hit the Hacker News… — @xiangpeng.systems11 likes and reposts
- Jan 30, 2026Microsoft's Bf-Tree A modern read-write-optimized concurrent larger-than-memory range index in Rust. Repo: github.com/microsoft/bf... — @sungkim.bsky.social6 likes and reposts
- Jan 28, 2026Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index | Discussion — @hackernewsbot.bsky.social3 likes and reposts
- Mar 10, 2026Bf-Tree is a modern read-write-optimized concurrent larger-than-memory range index in Rust from MS Research SSD optimized (requires random… — @spinscale.bsky.social2 likes and reposts
- Jan 29, 2026Bf-Tree A Modern Concurrent Larger-Than-Memory Range Index https://lobste.rs/s/651hoq #compsci #databases #rust — @lobsters-feed.bsky.social2 likes and reposts
On GitHub · 3
- Sep 6, 2026Bf-tree:Stack overflow in `ScanIter::next` when scanning across many deleted records — microsoft/garnet0 reactions
- Apr 1, 2026Replace B-tree core with Bf-Tree for concurrent writers — varun29ankuS/shodh-redb0 reactions · 1 comment
- Jan 29, 2026Digest: 2026-01-29 06:51 — flexatone/assistant-research0 reactions
On Hacker News · 1
- Jan 28, 2026Bf-Tree: modern read-write-optimized concurrent larger-than-memory range index143 points · 22 comments
The file
We split this copilot-instructions.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 49
Shuttle-aware concurrency: All synchronization imports (Arc, Mutex, thread, atomics) come from crate::sync, not directly from std.
- Very specific: line 53
Copyright header: Every source file starts with // Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions for bf-tree
Build, Test, and Lint
# Build (release mode recommended — debug builds are large)
cargo build --release
# Run all unit tests
cargo test
# Run a single test by name
cargo test test_tree_insert_read_1
# Run shuttle concurrency tests (deterministic thread interleaving exploration, ~5 min)
cargo test --features "shuttle" --release shuttle_bf_tree_concurrent_operations
# Run benchmarks
cd benchmark
env SHUMAI_FILTER="inmemory" MIMALLOC_LARGE_OS_PAGES=1 cargo run --bin bftree --release
# Lint (pre-commit hooks enforce formatting)
cargo fmt --check
cargo clippyRust toolchain is pinned to 1.95.0 via rust-toolchain.toml.
Architecture
Bf-Tree is a concurrent, larger-than-memory B+-tree range index. The core data flow:
BfTree(src/tree.rs) — The top-level API struct. Owns root page, config, storage, WAL, and snapshot manager.- Circular Buffer (
src/circular_buffer/) — A custom lock-free memory allocator for in-memory "mini pages." Pages transition through lifecycle states: NotReady → Ready → BeginTombstone → Tombstone → Evicted. The freelist reclaims tombstoned memory. - Nodes (
src/nodes/) — Inner nodes (4KB fixed) and leaf nodes (variable, up to 32KB). Leaf nodes hold KV data in "mini pages" that can be promoted to full pages. - Storage (
src/storage.rs) —PageTablemapsPageID→PageLocation(Mini, Full, Base/disk, Null).LeafStoragecoordinates between the circular buffer and the backing VFS. - VFS layer (
src/fs/) — Pluggable filesystem backends:MemoryVfs,StdVfs,IoUringVfs(Linux),SpdkVfs(Linux, optional). - WAL (
src/wal/) — Optional write-ahead log for durability. - Snapshot/Recovery (
src/snapshot.rs) — CPR-style consistent snapshots taken concurrently with reads/writes.
Concurrency model
- The
syncmodule (src/sync.rs) conditionally re-exports eitherstd::syncorshuttle::syncbased on theshuttlefeature flag. This allows deterministic concurrency testing without code changes. - Custom synchronization primitives live in
src/utils/(rw_lock.rs,inner_lock.rs,atomic_wait.rs). - Optimistic locking with version checks is the primary concurrency pattern — see the
check_parent!macro.
Key Conventions
- Shuttle-aware concurrency: All synchronization imports (
Arc,Mutex,thread, atomics) come fromcrate::sync, not directly fromstd. This enables shuttle-based deterministic testing. New concurrent code must follow this pattern. - Feature-gated metrics: Metrics are compiled out by default. Use the
counter!,histogram!, andtimer!macros which expand to no-ops without the appropriate feature flag. - Config uses builder-style setters:
Configfields arepub(crate)with public setter methods (e.g.,config.cb_min_record_size(4)). unsafe impl Send + SynconBfTree— the tree manages raw pointers internally; concurrency safety is maintained by the custom locking protocol.- Copyright header: Every source file starts with
// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license. - Test organization: Tests live in
src/tests/as a#[cfg(test)]module. Proptest is used for property-based testing;rstestfor parameterized tests. - Platform-specific code: Linux-specific I/O (io_uring, SPDK) is behind
#[cfg(target_os = "linux")]. Windows useswindows-sysfor threading primitives.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

