[AI] Add Agent Readiness Configuration#296
Conversation
Add CLAUDE.md at the repository root, auto-generated via the `/init` command, documenting project overview, build commands, architecture, testing conventions, important gotchas, and publishing details to help coding agents operate effectively in this codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Guide: https://fieldguide.automattic.com/coding-agents-guidelines Move project guidance content into AGENTS.md as the single source of truth for all coding agents, per the Fieldguide coding agents guidelines. Update CLAUDE.md to reference AGENTS.md via the @AGENTS.md directive. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update AGENTS.md to use agent-agnostic heading and description. Add ktlint, ktlintFormat custom tasks with source reference, benchmark androidTest tasks, sample app mention, and clarify experimentation module name in apiCheck comment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add .aiexclude file to prevent coding agents from reading build outputs, gradle caches, and local/gradle properties while allowing access to reports, outputs, and test results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add gitignore patterns for coding agent local override files. Covers AGENTS.local.md and CLAUDE.local.md for repo-level overrides, plus local files for Claude, Codex, Gemini, Cursor, and Windsurf agent directories. Junie and Copilot are excluded as Junie's entire directory is local and Copilot has no local override pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds repository-level “agent readiness” configuration so coding agents can quickly understand how to build/test the project and which files to avoid reading (e.g., build artifacts and local secrets).
Changes:
- Add
AGENTS.mdas the primary agent-facing project guide (overview, build/test commands, architecture, conventions, gotchas). - Add
CLAUDE.mdthat delegates toAGENTS.mdvia@AGENTS.md. - Add
.aiexcludeand update.gitignoreto limit agent exposure to build artifacts and ignore agent-local override files.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
CLAUDE.md |
Adds a single directive to reference AGENTS.md. |
AGENTS.md |
Introduces a consolidated guide for agent workflows and repo conventions. |
.aiexclude |
Excludes build artifacts and local config files, with allowlist-style exceptions for reports/outputs/test-results. |
.gitignore |
Removes a duplicate IntelliJ block and adds patterns to ignore agent-local override files. |
Comments suppressed due to low confidence (1)
CLAUDE.md:2
CLAUDE.mdcurrently includes a trailing blank line. If the consuming agent tooling expects the file to contain only the single@AGENTS.mddirective, consider removing the extra empty line so the file is exactly one line long.
@AGENTS.md
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| build/ | ||
| !build/reports/ | ||
| */build/ |
There was a problem hiding this comment.
If .aiexclude uses gitignore-style semantics (the patterns/negation syntax suggest it does), !build/reports/ (and the similar module rules) won’t take effect because the parent build/ directory is excluded. To ensure reports/outputs/test-results are actually included, un-exclude the parent directories and then re-exclude everything else (e.g., unignore build/ + selectively allow subpaths), or restructure the patterns accordingly.
| build/ | |
| !build/reports/ | |
| */build/ | |
| build/* | |
| !build/reports/ | |
| */build/* |
There was a problem hiding this comment.
TIL about .aiexclude. Neat. Hopefully it takes hold as a wider standard.
Regarding the syntax, Copilot's suggestion is good. From the docs:
An .aiexclude file follows the same syntax as a .gitignore file.
There was a problem hiding this comment.
Hopefully it takes hold as a wider standard.
🤞 x 🤞 ^ 🤞
| ./gradlew testDebugUnitTest # Run all unit tests | ||
| ./gradlew lintDebug # Run lint checks |
There was a problem hiding this comment.
The documented lint/test commands (lintDebug, testDebugUnitTest) don’t match what CI runs (./gradlew lint and ./gradlew test per .buildkite/pipeline.yml). Consider documenting the CI-equivalent tasks (or noting the difference) so agents reproduce CI locally without guessing the right task names.
| ./gradlew testDebugUnitTest # Run all unit tests | |
| ./gradlew lintDebug # Run lint checks | |
| ./gradlew testDebugUnitTest # Run unit tests for the debug variant (CI runs `./gradlew test`) | |
| ./gradlew lintDebug # Run lint checks for the debug variant (CI runs `./gradlew lint`) |
mokagio
left a comment
There was a problem hiding this comment.
Looking good. Only nitpicks
| build/ | ||
| !build/reports/ | ||
| */build/ |
There was a problem hiding this comment.
TIL about .aiexclude. Neat. Hopefully it takes hold as a wider standard.
Regarding the syntax, Copilot's suggestion is good. From the docs:
An .aiexclude file follows the same syntax as a .gitignore file.
| **/AGENTS.local.md | ||
| **/CLAUDE.local.md |
There was a problem hiding this comment.
I didn't know these were a thing. The docs don't mention supporting a CLAUDE.local.md file.
However, it seems to be working
Not sure if it's a compatibility thing that they'll phase out, as it's not documented, or just a standard pattern that will be maintained.
There was a problem hiding this comment.
Yea, same @mokagio and thanks for taking a closer look at it, plus testing it! 🥇
I too just found it myself as I was writing those Agent Readiness PRs, of course with AI help and support, and thought, why not adding those in there, wouldn't hurt, would it? Worse case scenario, I thought, we'll stop adding them into more repos (should that not become a standard), and maybe, delete this configuration from those repos that we've added them in already, right? Having said that, usually, this .gitignore file becomes a fire and forget file, with ignore files/folders been added in there but rarely removed/edited, only when REALLY needed... 🤷
There was a problem hiding this comment.
why not adding those in there, wouldn't hurt, would it?
Yes, I don't see any problems (other than bloat maybe) in having that in the .gitignore. Can always be removed in a future where it's no longer supported.
There was a problem hiding this comment.
(other than bloat maybe)
True @mokagio ! 👍
Can always be removed in a future where it's no longer supported.
💯
AGENTS.md
Outdated
| - Build files use **Groovy** (`build.gradle`, `settings.gradle`), not Kotlin DSL — except `benchmark/build.gradle.kts` which uses Kotlin DSL | ||
| - Dependency versions are defined as `ext` properties in root `build.gradle`, not a version catalog | ||
| - Lint treats warnings as errors (`warningsAsErrors true`). `AutomatticTracks` uses a lint baseline file |
There was a problem hiding this comment.
The first and last seem like stuff the model would notice when reading the code, without needing to be explicit
| - Build files use **Groovy** (`build.gradle`, `settings.gradle`), not Kotlin DSL — except `benchmark/build.gradle.kts` which uses Kotlin DSL | |
| - Dependency versions are defined as `ext` properties in root `build.gradle`, not a version catalog | |
| - Lint treats warnings as errors (`warningsAsErrors true`). `AutomatticTracks` uses a lint baseline file | |
| - Dependency versions are defined as `ext` properties in root `build.gradle`, not a version catalog |
There was a problem hiding this comment.
Good comment @mokagio ! 💯
I was thinking about that too, in the end chose to keep it in there because this version catalog is indeed the standard nowadays (years now), and I think AI would try to enforce this standard, maybe creating such a version catalog pattern, that is, instead of using the existing legacy ext properties pattern this repo uses. What I wanted here, is for AI to avoid doing that, thinking in version catalog terms, thus me being explicit giving it instructions on how dependency versions are and should be defined on this repo, being (somehow) explicit that we DON'T WANT version catalog. Does that make any sense to you? 💭 (I probably over-complicating this 😊 for sure)
There was a problem hiding this comment.
Thanks for clarifying. That makes sense to me.
Just to be clear, I am suggesting to remove the "Build files use Groovy" and "Lint treats warnings as errors..." entries because that info is already specified in the document and to keep the version catalog note, which appears in the gotchas for the first time.
There was a problem hiding this comment.
Ah, 🤦 here @mokagio , and thanks for keeping at it with me... for some reason I read the commit suggestion and that got my brain confused, thinking this comment was about that, while it was about everything else but that, not sure what happened there, apologies... 🫣
- Build files use Groovy (
build.gradle,settings.gradle), not Kotlin DSL — exceptbenchmark/build.gradle.ktswhich uses Kotlin DSL
I would still keep that in there because it is not making sure that AI knows that Groovy is the standard in there and not Kotlin DSL, except for this one module, just to avoid confusion and help AI chose the right standard. 🤔
- Lint treats warnings as errors (
warningsAsErrors true).AutomatticTracksuses a lint baseline file
We could definitely remove that, I agree, will do! 👍
|
Ship it |
Remove the lint warnings-as-errors gotcha from the important gotchas section as it is discoverable by agents when reading the build files directly. PR Comment: #296 (comment) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Closes: AINFRA-2083
Description
Add coding agent readiness configuration following the coding agents guidelines (PCYsg-1bzA-p2). This sets up the repository so that coding agents can understand the project structure, build commands, conventions, and gotchas without manual guidance.
Changes:
CLAUDE.mdauto-generated via/init, then updated to referenceAGENTS.mdvia the@AGENTS.mddirectiveAGENTS.mdas the single source of truth for all coding agents, documenting project overview, build commands, architecture, testing conventions, and important gotchas.aiexcludeto restrict agent access to build artifacts while allowing reports, outputs, and test results.gitignorewith local override patterns for popular coding agents (Claude, Codex, Gemini, Cursor, Windsurf) and remove a duplicate IntelliJ block. Junie and Copilot are excluded as Junie's entire directory is local and Copilot has no local override patternAssessment:
AGENTS.mddocuments project overview, build commands, architecture, testing conventions, and gotchas.CLAUDE.mdpoints to it via@AGENTS.md..aiexcluderestricts access to build artifacts and sensitive files../gradlew assembleDebug), run tests (./gradlew testDebugUnitTest), lint (./gradlew lintDebug), and check code style (./gradlew ktlint) — all documented inAGENTS.md. The bootstrap step (cp gradle.properties-example gradle.properties) is also documented. CI already runs all of these via Buildkite.sampletracksappexists for manual testing but there's no automated E2E path. Thebenchmarkmodule has instrumented tests but those measure performance, not user-facing behavior..java-version(21) and Gradle wrapper (9.0.0) are pinned.gradle.properties-exampleserves as the env template..gitignoreincludes agent local override patterns for all major coding agents. No additional setup scripts or containers needed for this library.Testing Steps
CLAUDE.mdcontains only@AGENTS.mdAGENTS.mddocuments build commands, architecture, testing conventions, and gotchas.aiexcludeexcludes build artifacts but allowsreports/,outputs/, andtest-results/.gitignoreincludes local override patterns for agent config files and no longer has duplicate IntelliJ block