agentleFS
MongoDBKnown publishermongodb/mongo-csharp-driver/AGENTS.md

mongo-csharp-driver

AGENTS.md3.2k starsChanged 4 months agoApache-2.0View on GitHub

The driver follows strict semantic versioning: breaking changes to the public surface require a major-version bump. Breaks are always measured against the latest released version of the assembly (the most recent published NuGet package), not against the current state of main. A public API that was added and then changed or removed within the current unreleased development cycle never shipped, so it is not a break. Releases are tagged v<major>.<minor>.<patch> (e.g. v3.9.0). Find the baseline with the GitHub release list,…

Trending

Quiet since September.about the whole repository

Dec 2025: 0 mentionsJan 2026: 1 mentionFeb 2026: 0 mentionsMar 2026: 1 mentionApr 2026: 1 mentionMay 2026: 2 mentionsJun 2026: 0 mentionsJul 2026: 1 mentionAug 2026: 1 mentionSep 2026: 2 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the mongodb/mongo-csharp-driver repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about mongodb/mongo-csharp-driver

The biggest 5 of 40 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 40

Talked about on GitHub (40 times).

On GitHub · 40

35 more on GitHub

The file

We split this AGENTS.md into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 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.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    ConfigureAwait(false): All library awaits use ConfigureAwait(false).

    line 44
  2. Very specific:

    Run all tests: dotnet test tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj -f net10.0

    line 49
  3. Very specific:

    Run a single test class: dotnet test tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj -f net10.0 --filter …

    line 50
  4. Very specific:

    When /review-areas is invoked with a PR number, an additional reviewer runs alongside the others:

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md 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
AGENTS.md

AGENTS.md - CSharpDriver

Overview

The C# driver for MongoDB.

Tech Stack

  • .NET library projects producing NuGet packages
  • Multi-targeted to net472, net6.0, net8.0, and net10.0 (see src/Directory.Build.props)
  • xUnit + FluentAssertions for testing

Project Structure

  • src/MongoDB.Bson/ - BSON for MongoDB
  • src/MongoDB.Driver/ - C# driver for MongoDB
  • src/MongoDB.Driver.Encryption/ - Client encryption (CSFLE with KMS).
  • src/MongoDB.Driver.Authentication.AWS/ - AWS IAM authentication
  • tests/MongoDB.Driver.Tests/ - Main C# driver tests
  • tests/MongoDB.Bson.Tests/ - BSON handling tests
  • tests/*/TestHelpers - Common test utilities
  • tests/* - Specialized tests; less common
  • tests/MongoDB.Driver.Tests/Specifications/ are JSON-driven tests using a common runner.

Editing

  • Be careful to preserve file BOMs.

Versioning conventions

The driver follows strict semantic versioning: breaking changes to the public surface require a major-version bump. Breaks are always measured against the latest released version of the assembly (the most recent published NuGet package), not against the current state of main. A public API that was added and then changed or removed within the current unreleased development cycle never shipped, so it is not a break.

Releases are tagged v<major>.<minor>.<patch> (e.g. v3.9.0). Find the baseline with the GitHub release list, not local git tag (a clone's tags are frequently stale and miss recent releases):

  • Absolute latest published version: gh release list --limit 1 --json tagName,isLatest.
  • A specific major's latest line: the highest v<major>.* from gh release list --limit 100 --json tagName.

Diff the file at that release tag against the working tree to confirm a change is observable to an upgrading consumer (git fetch --tags first if the tag isn't local, then git show <tag>:<path>).

What counts as a break: public signature / default / visibility changes; an interface member added to any public interface (the driver multi-targets net472, which can't consume default interface methods, so this is a hard break); behavior changes on an unchanged public signature; behavior changes affecting serialized BSON shape (element name, representation, discriminator, Guid representation).

What does not count as a break:

  • Changes to anything internal — regardless of InternalsVisibleTo (which exists only to expose internals to first-party test/benchmark assemblies and Moq's proxy stub). Internal code is never part of the public surface.
  • Changes to the exception type thrown for an unsupported feature (a not-yet-implemented LINQ operator, an unsupported mapping, a guard rejecting something the driver doesn't support). Only the exception type of a supported, documented operation is part of the contract.

Async conventions

  • Paired sync/async public surface. Public methods that perform I/O come in pairs: a sync method (Foo) and an async counterpart (FooAsync) that accepts a CancellationToken. When adding, changing, or [Obsolete]-marking either side, do the same to the other. Operations under src/MongoDB.Driver/Core/Operations/ duplicate this pairing internally (Execute / ExecuteAsync) — bug fixes must land on both paths; do not collapse them by calling Task.Delay(...).GetAwaiter().GetResult() or similar sync-over-async shortcuts.
  • ConfigureAwait(false). All library awaits use ConfigureAwait(false); the driver does not assume a synchronization context. Application code calling the driver may use whatever it likes.
  • Cancellation / CSOT propagation. CancellationToken and OperationContext (the CancellationToken + deadline bundle threaded through Core/Operations/ and the wire layer) must be passed through unchanged. Substituting a fresh OperationContext or passing CancellationToken.None mid-stack drops the caller's deadline — see the discussion in src/MongoDB.Driver/Core/AGENTS.md and src/MongoDB.Driver/Core/Operations/AGENTS.md.

Commands

  • Build: dotnet build CSharpDriver.sln
  • Run all tests: dotnet test tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj -f net10.0
  • Run a single test class: dotnet test tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj -f net10.0 --filter "FullyQualifiedName~ClassName"

Testing

  • Tests cannot be run in parallel.
  • A MongoDB connection is always available locally, so "integration" tests can be run as well as unit tests. Some test suites also require additional environment variables — if you need to run those tests and the variables are not set, stop and tell the user which variables are needed rather than working around it.
Feature areaRequired environment variables
Atlas SearchATLAS_SEARCH_TESTS_ENABLED, ATLAS_SEARCH_URI
CSFLE / auto-encryptionCRYPT_SHARED_LIB_PATH
CSFLE with KMS mock serversKMS_MOCK_SERVERS_ENABLED
CSFLE with AWS KMSCSFLE_AWS_TEMPORARY_CREDS_ENABLED
CSFLE with Azure KMSCSFLE_AZURE_KMS_TESTS_ENABLED
CSFLE with GCP KMSCSFLE_GCP_KMS_TESTS_ENABLED
AWS authenticationAWS_TESTS_ENABLED
GSSAPI / KerberosGSSAPI_TESTS_ENABLED, AUTH_HOST, AUTH_GSSAPI
OIDC authenticationOIDC_ENV
X.509 authenticationMONGO_X509_CLIENT_CERTIFICATE_PATH, MONGO_X509_CLIENT_CERTIFICATE_PASSWORD
PLAIN authenticationPLAIN_AUTH_TESTS_ENABLED
SOCKS5 proxySOCKS5_PROXY_SERVERS_ENABLED

Commit and PR Conventions

  • The first commit message and the PR message start with a JIRA number: CSHARP-1234: Description
  • The branch name will usually match the JIRA number: CSHARP-1234

Functional areas

Each area below has its own AGENTS.md (auto-loaded when working in that subtree) and a corresponding read-only reviewer subagent in .claude/agents/.

AreaLocationReviewer
BSON & Serializationsrc/MongoDB.Bson/AGENTS.mdbson-reviewer
Connection & Transport (SDAM)src/MongoDB.Driver/Core/AGENTS.mdtransport-reviewer
Operations, Sessions & Transactionssrc/MongoDB.Driver/Core/Operations/AGENTS.mdoperations-reviewer
Authenticationsrc/MongoDB.Driver/Authentication/AGENTS.md (+ src/MongoDB.Driver.Authentication.AWS/AGENTS.md)auth-reviewer
Public API: client facades & settingssrc/MongoDB.Driver/AGENTS.md (router)client-api-reviewer
Public API: CRUD builders DSLsrc/MongoDB.Driver/AGENTS.md (router)builders-reviewer
Aggregation & Change Streamssrc/MongoDB.Driver/AGENTS.md (router) + Core/Operations/AGENTS.mdaggregation-reviewer
LINQ Providersrc/MongoDB.Driver/Linq/AGENTS.mdlinq-reviewer
GridFSsrc/MongoDB.Driver/GridFS/AGENTS.mdgridfs-reviewer
Atlas Search & Vector Searchsrc/MongoDB.Driver/Search/AGENTS.mdsearch-reviewer
Client-Side Encryption (CSFLE / QE)src/MongoDB.Driver.Encryption/AGENTS.md (+ src/MongoDB.Driver/Encryption/AGENTS.md)encryption-reviewer
Diagnostics: Eventssrc/MongoDB.Driver/Core/Events/AGENTS.mddiagnostics-reviewer
Diagnostics: Loggingsrc/MongoDB.Driver/Core/Logging/AGENTS.mddiagnostics-reviewer
GeoJSON Object Modelsrc/MongoDB.Driver/GeoJsonObjectModel/AGENTS.mdgeojson-reviewer
Spec conformance & test infratests/MongoDB.Driver.Tests/Specifications/AGENTS.md (+ tests/MongoDB.Driver.TestHelpers/AGENTS.md)spec-conformance-reviewer

Cross-cutting reviewers

These reviewers have no per-area AGENTS.md; they apply a single hygiene lens across the whole diff and run on every invocation of the /review-areas skill.

ConcernReviewer
Security: secrets, TLS/crypto, redaction, deserialization safetysecurity-reviewer
Public API / SemVerapi-stability-reviewer
Async/threading hygieneasync-reviewer

PR-summary reviewer (external PR mode only)

When /review-areas is invoked with a PR number, an additional reviewer runs alongside the others:

ConcernReviewer
Holistic "what does this PR do, and is it a good change?" — reads the PR body and the full diffpr-summary-reviewer

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.