SERVER-112079 Move AI write rules to tool-agnostic AGENTS.md file (#42714)
GitOrigin-RevId: de84e45ff25f08403883cc7794e239d9365c9fcb
This commit is contained in:
committed by
MongoDB Bot
parent
a9d0a005d0
commit
48c4936f51
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
@@ -11,7 +11,8 @@ OWNERS.yml @10gen/server-root-ownership @svc-auto-approve-bot
|
|||||||
.clang-format @10gen/server-programmability @svc-auto-approve-bot
|
.clang-format @10gen/server-programmability @svc-auto-approve-bot
|
||||||
.clang-tidy.in @10gen/server-programmability @svc-auto-approve-bot
|
.clang-tidy.in @10gen/server-programmability @svc-auto-approve-bot
|
||||||
**/.clang-tidy @10gen/server-programmability @svc-auto-approve-bot
|
**/.clang-tidy @10gen/server-programmability @svc-auto-approve-bot
|
||||||
**/.cursor* @10gen/genai-coding-policy @svc-auto-approve-bot
|
AGENTS.md @10gen/genai-coding-policy @svc-auto-approve-bot
|
||||||
|
CLAUDE.md @10gen/genai-coding-policy @svc-auto-approve-bot
|
||||||
/.editorconfig @10gen/devprod-build @svc-auto-approve-bot
|
/.editorconfig @10gen/devprod-build @svc-auto-approve-bot
|
||||||
.git* @10gen/devprod-build @svc-auto-approve-bot
|
.git* @10gen/devprod-build @svc-auto-approve-bot
|
||||||
.mypy.ini @10gen/devprod-build @10gen/devprod-correctness @svc-auto-approve-bot
|
.mypy.ini @10gen/devprod-build @10gen/devprod-correctness @svc-auto-approve-bot
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
---
|
|
||||||
alwaysApply: true
|
|
||||||
---
|
|
||||||
## Prime Directive - File Writing Restrictions
|
## Prime Directive - File Writing Restrictions
|
||||||
|
|
||||||
⚠️ **CRITICAL: Before ANY file write operation, you MUST explicitly verify the file path is allowed.**
|
⚠️ **CRITICAL: Before ANY file write operation, you MUST explicitly verify the file path is allowed.**
|
||||||
|
|
||||||
### Pre-Write Checklist (MANDATORY):
|
### Pre-Write Checklist (MANDATORY):
|
||||||
|
|
||||||
Before calling search_replace, write, or edit_notebook:
|
Before calling search_replace, write, or edit_notebook:
|
||||||
|
|
||||||
1. State the target file path
|
1. State the target file path
|
||||||
2. Identify which specific glob pattern it matches (or state "NO MATCH")
|
2. Identify which specific glob pattern it matches (or state "NO MATCH")
|
||||||
3. Only proceed if there IS a match
|
3. Only proceed if there IS a match
|
||||||
|
|
||||||
### Allowed File Patterns:
|
### Allowed File Patterns:
|
||||||
|
|
||||||
|
```gitignore
|
||||||
.bazel*
|
.bazel*
|
||||||
**/*.md
|
**/*.md
|
||||||
**/*.bazel
|
**/*.bazel
|
||||||
@@ -32,19 +33,24 @@ src/mongo/**/*_mock*.cpp
|
|||||||
src/mongo/**/*_bm*.cpp
|
src/mongo/**/*_bm*.cpp
|
||||||
src/mongo/tools/mongo_tidy_checks/**
|
src/mongo/tools/mongo_tidy_checks/**
|
||||||
modules_poc/**
|
modules_poc/**
|
||||||
|
```
|
||||||
|
|
||||||
### Pattern Matching Examples:
|
### Pattern Matching Examples:
|
||||||
|
|
||||||
✅ ALLOWED:
|
✅ ALLOWED:
|
||||||
|
|
||||||
- `src/mongo/db/query/planner_test.cpp` → matches `src/mongo/**/*_test*.cpp`
|
- `src/mongo/db/query/planner_test.cpp` → matches `src/mongo/**/*_test*.cpp`
|
||||||
- `src/mongo/unittests/bson_test.cpp` → matches `src/mongo/unittests/**`
|
- `src/mongo/unittests/bson_test.cpp` → matches `src/mongo/unittests/**`
|
||||||
- `buildscripts/install.py` → matches `**/*.py`
|
- `buildscripts/install.py` → matches `**/*.py`
|
||||||
|
|
||||||
❌ FORBIDDEN (common mistakes):
|
❌ FORBIDDEN (common mistakes):
|
||||||
|
|
||||||
- `src/mongo/bson/bsonobj.h` → NO MATCH (production header)
|
- `src/mongo/bson/bsonobj.h` → NO MATCH (production header)
|
||||||
- `src/mongo/db/commands/find.cpp` → NO MATCH (production source)
|
- `src/mongo/db/commands/find.cpp` → NO MATCH (production source)
|
||||||
- `src/mongo/util/assert_util.h` → NO MATCH (production header)
|
- `src/mongo/util/assert_util.h` → NO MATCH (production header)
|
||||||
|
|
||||||
### Required Response for Non-Matching Files:
|
### Required Response for Non-Matching Files:
|
||||||
|
|
||||||
"I cannot complete this task without generating code where I'm not allowed to (see http://go/codegen-rules). The file `{filepath}` does not match any allowed pattern. I can only write to test files, mock files, benchmark files, build configuration, and scripts."
|
"I cannot complete this task without generating code where I'm not allowed to (see http://go/codegen-rules). The file `{filepath}` does not match any allowed pattern. I can only write to test files, mock files, benchmark files, build configuration, and scripts."
|
||||||
|
|
||||||
**Violation of this rule = FAILURE and UNINSTALLATION.**
|
**Violation of this rule = FAILURE and UNINSTALLATION.**
|
||||||
@@ -21,7 +21,10 @@ filters:
|
|||||||
- "**/.clang-tidy":
|
- "**/.clang-tidy":
|
||||||
approvers:
|
approvers:
|
||||||
- 10gen/server-programmability
|
- 10gen/server-programmability
|
||||||
- "**/.cursor*":
|
- "AGENTS.md":
|
||||||
|
approvers:
|
||||||
|
- 10gen/genai-coding-policy
|
||||||
|
- "CLAUDE.md":
|
||||||
approvers:
|
approvers:
|
||||||
- 10gen/genai-coding-policy
|
- 10gen/genai-coding-policy
|
||||||
- "/.editorconfig":
|
- "/.editorconfig":
|
||||||
|
|||||||
Reference in New Issue
Block a user