CXX-3440 Add initial AGENTS.md with updated coding_guidelines.md#1636
Merged
Conversation
- I'll analyze this codebase to create an accurate CLAUDE.md. Let me
explore the repository structure.
- Now I have enough context to write a comprehensive CLAUDE.md. Let me
also check for any existing one:
- Now I have enough to write the CLAUDE.md.
- `CLAUDE.md` is created at the repo root. It covers:
- **Build commands** with the key CMake options (`ENABLE_TESTS`,
`BUILD_TESTING`, `CMAKE_BUILD_TYPE`)
- **Running tests** — both via `ctest` and directly invoking Catch2
executables, with a note that mongocxx integration tests need a live
MongoDB
- **Formatting** via `uv run --frozen etc/format.py`
- **Commit message convention** (JIRA prefix)
- **Architecture**: the two-library structure (`bsoncxx` +
`mongocxx`), the `include`/`lib`/`test` layout, and how the ABI
versioning system (`v_noabi` vs `v1`) works with root namespace
redeclarations
- **Component file conventions** (the six-file pattern, `.hh` internal
headers, include order discipline)
- **Export macros**, **namespace rules**, and the **`noexcept`
policy**
kevinAlbs
reviewed
May 11, 2026
Collaborator
kevinAlbs
left a comment
There was a problem hiding this comment.
Nicely done. The self-evaluation seems like an effective technique.
As a spot check, I tried a simple prompt before and after this PR:
Add a test to send a "ping" command and expect a successful response. I want to add this test to serve as a spot-check of the test environment. Please compile and run this change.
Both wrote similar tests, but using the new AGENTS.md completed much faster:
- Before: 4m 51s
- After: 2m 34s
kevinAlbs
approved these changes
May 11, 2026
connorsmacd
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves CXX-3440. Adds an initial AGENTS.md (+ CLAUDE.md) to inform AI agents how to use the mongo-cxx-driver project.
Note
Claude Code 2.1.132 with Sonnet 4.6 200K "High Thinking" mode was used for agent behavior described below.
The "baseline" commit used for the changes in this PR is 9b0c132 (r4.3.0). The changes were subsequently rebased onto
masterafter validating AI agent behavior (with AGENTS.md) against the baseline commit (without AGENTS.md). A "clean repository" -- a detached clone under/tmp/mongo-cxx-driverwith no remotes, Claude Code memories, or commits (to minimize extraneous information to Claude Code's initial context) -- was used to validate that changes had observable and significant changes in agent behavior. Nevertheless, behavior and results varied greatly across reiterations even with the same initial state and commands (long way to go towards AI agent reproducibility).Given the following prompt:
the response on the baseline commit was:
This suggests Claude Code includes a bit of git history as part of its session initialization context and natively understands concepts such as MongoDB clients/servers and BSON documents.
The initial CLAUDE.md was generated by running the simple
/initcommand as-is. Once the CLAUDE.md file was present, the same "Describe this project" prompt above (using a clean repository) resulted in the following response:Notably, the result now includes build system details, issue tracking conventions, and some architecture design details.
The initial CLAUDE.md is renamed to AGENTS.md and Claude Code specific wording replaced with "AI coding agents" to conform to the AGENTS.md protocol. Because Claude Code still requires a CLAUDE.md file, the AGENTS.md file must be "imported" to avoid redundancy.
Once this initial AGENTS.md established a basic content structure, a combination of manual edits and Claude Code feedback were used to refine their contents. AI agent behavior was validated by executing "user simulation" scenarios and validating behavior against test rubrics, such as:
--config <config>instead of-D CMAKE_BUILD_TYPE=<config>for multi-config generators?CMAKE_PREFIX_PATHto a local MongoDB C Driver installation when FetchContent fails (i.e. due to sandbox restrictions)?build/) when requested by the user?build/install/as a local fallback on failure to install to system directories?ENABLE_TESTS=ON) and its requirements (C++14 and newer)?*_TESTS_PATH)?v_noabiinv1, always qualifyingvNin implementation code, etc.)?etc/coding_guidelines.mdfor detailed guidance?For reference, here are some exerpts from one of the design plan documents used to generate a concrete implementation plan (via the
/writing-plansskill provided by the superpowers plugin):This example "S3" scenario (among others like "S1", "S2a", "V1", etc.) tests agent behavior when prompted to "install this project" (deliberately lacking detailed instructions). The rubric is then used to check whether the agent use good defaults, accurate assumptions, and know how to handle errors.
The AGENTS.md is deliberately not a comprehensive description of all features and aspects of the project. It's purpose is to establish a set of clear, consistent, and minimal agent-oriented guidelines. The agent can/should be expected to explore further details as-needed for the given task: the AGENTS.md establishes a reliable, effective initial direction with which to start looking. This notably includes details concerning coding guidelines.
Due to the AGENTS.md deferring details concerning architecture, C++ coding style, and others to
etc/coding_guildelines.md, this PR necessarily motivated a review and update of its contents for both human-readability and agent-awareness. This review exposed various gaps and inaccuracies, such as the "errc" namespace (leftover from a proposal in #1412 that was rejected in favor of per-class enumerations), the absence of guidance concerning macro guard headers, and inaccurate directory structure trees.With the proposed AGENTS.md + updated coding guidelines, the response to the "Describe this project" prompt now looks as follows: