mongo-java-driver AGENTS.md

Project instructions for contributing to the MongoDB Java Driver, a Java library for connecting applications to MongoDB databases.

In plain words
What is it for?
Making focused changes across the driver’s Gradle modules while following Jira naming, testing, documentation, and API-versioning rules.
Why use it?
They clarify the project structure, branch and commit rules, review requirements, and compatibility constraints before code is changed.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/mongodb/mongo-java-driver/agents-md
Clone the repo
git clone --depth 1 https://github.com/mongodb/mongo-java-driver

Made for: Codex, OpenCode.

Per session 997 This file is loaded in full into every session.
When invoked 997 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00997 $0.00997
Opus 5 $0.00498 $0.00498
Sonnet 5 $0.00199 $0.00199
Haiku 4.5 $0.00100 $0.00100

Measured yesterday against content hash 084be397b8d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mongo-java-driver AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 99 lines

How it starts

The opening of the file, as written. The whole thing — 99 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md - MongoDB Java Driver

All changes require human review. Breaking changes to public API require a major version bump — always warn if binary compatibility is affected. Also consult .AGENTS.md / ~/.AGENTS.md if present for local agent settings.

Architecture: Multi-module Gradle project: bsondriver-coredriver-sync/driver-reactive-streams → language wrappers (driver-kotlin-sync, driver-kotlin-coroutine, driver-scala).

See .agents/references/project-guide for module structure and dependency graph. Each module has its own AGENTS.md.

Git

The default branch is main (not master). Always use main when comparing, diffing, or creating branches.

  • Branch naming: JAVA-XXXX matching the Jira ticket (e.g., JAVA-6143)
  • Commits: Keep commits logical and reviewable — each commit should be a coherent unit of change
  • TODO comments: Must reference a Jira ticket if the work belongs to a different ticket: // TODO JAVA-XXXX reasoning for the todo

Core Rules

  • Read before modifying — understand existing code and patterns first
  • Minimal changes only — no drive-by refactoring or unrelated changes
  • Preserve existing comments — only remove if provably incorrect
  • No rewrites without explicit permission
  • When stuck or uncertain: stop, explain, propose alternatives, ask

Build

Gradle with Kotlin DSL. Build JDK: 17+. Source baseline: Java 8. Versions in gradle/libs.versions.toml.

  • Java 8 baseline: no Java 9+ language features unless the module raises sourceCompatibility.
  • Kotlin 1.8 with JVM target 1.8; all Kotlin modules enforce explicitApi().

Details for both are in .agents/references/style-reference.

./gradlew check                        # Full validation (format + static checks + tests)
./gradlew :driver-core:test            # Single module tests
./gradlew integrationTest -Dorg.mongodb.test.uri="mongodb://localhost:27017"

Read the full file on GitHub · 99 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 99 lines · 997 tokens per session scan A 084be397b8d7

Subscribe to this mod's changes

mongo-java-driver AGENTS.md is an instructions file published in the GitHub repository mongodb/mongo-java-driver (2,660 stars, last pushed 3d ago), licensed Apache-2.0. It adds 997 tokens to every session, about $0.0050 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.