agentleFS
MicrosoftKnown publishermicrosoft/bf-tree/.github/copilot-instructions.md

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

Dec 2025: 0 mentionsJan 2026: 6 mentionsFeb 2026: 0 mentionsMar 2026: 1 mentionApr 2026: 1 mentionMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 1 mentionOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/bf-tree repository that our weekly crawl found: only 9 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about microsoft/bf-tree

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

On GitHub · 3

On Hacker News · 1

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
  1. Very specific:

    Shuttle-aware concurrency: All synchronization imports (Arc, Mutex, thread, atomics) come from crate::sync, not directly from std.

    line 49
  2. Very specific:

    Copyright header: Every source file starts with // Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.

    line 53

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

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 clippy

Rust 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:

  1. BfTree (src/tree.rs) — The top-level API struct. Owns root page, config, storage, WAL, and snapshot manager.
  2. 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.
  3. 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.
  4. Storage (src/storage.rs) — PageTable maps PageID → PageLocation (Mini, Full, Base/disk, Null). LeafStorage coordinates between the circular buffer and the backing VFS.
  5. VFS layer (src/fs/) — Pluggable filesystem backends: MemoryVfs, StdVfs, IoUringVfs (Linux), SpdkVfs (Linux, optional).
  6. WAL (src/wal/) — Optional write-ahead log for durability.
  7. Snapshot/Recovery (src/snapshot.rs) — CPR-style consistent snapshots taken concurrently with reads/writes.

Concurrency model

  • The sync module (src/sync.rs) conditionally re-exports either std::sync or shuttle::sync based on the shuttle feature 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 from crate::sync, not directly from std. 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!, and timer! macros which expand to no-ops without the appropriate feature flag.
  • Config uses builder-style setters: Config fields are pub(crate) with public setter methods (e.g., config.cb_min_record_size(4)).
  • unsafe impl Send + Sync on BfTree — 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; rstest for parameterized tests.
  • Platform-specific code: Linux-specific I/O (io_uring, SPDK) is behind #[cfg(target_os = "linux")]. Windows uses windows-sys for threading primitives.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.