-
Notifications
You must be signed in to change notification settings - Fork 21.9k
AGENTS.md: add AGENTS.md with guidelines for AI agents #33890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
31273c2
docs: add AGENTS.md with pre-commit guidelines for AI agents (#568)
gballet 955d9d8
specify that we don't need to list _every_ directory in the summary line
gballet 174cd28
agents: few tweaks
lightclient 8bc104f
agents: more tweaks
lightclient File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # AGENTS | ||
|
|
||
| ## Guidelines | ||
|
|
||
| - **Keep changes minimal and focused.** Only modify code directly related to the task at hand. Do not refactor unrelated code, rename existing variables or functions for style, or bundle unrelated fixes into the same commit or PR. | ||
| - **Do not add, remove, or update dependencies** unless the task explicitly requires it. | ||
|
|
||
| ## Pre-Commit Checklist | ||
|
|
||
| Before every commit, run **all** of the following checks and ensure they pass: | ||
|
|
||
| ### 1. Formatting | ||
|
|
||
| Before committing, always run `gofmt` and `goimports` on all modified files: | ||
|
|
||
| ```sh | ||
| gofmt -w <modified files> | ||
| goimports -w <modified files> | ||
| ``` | ||
|
|
||
| ### 2. Build All Commands | ||
|
|
||
| Verify that all tools compile successfully: | ||
|
|
||
| ```sh | ||
| make all | ||
| ``` | ||
|
|
||
| This builds all executables under `cmd/`, including `keeper` which has special build requirements. | ||
|
|
||
| ### 3. Tests | ||
|
|
||
| While iterating during development, use `-short` for faster feedback: | ||
|
|
||
| ```sh | ||
| go run ./build/ci.go test -short | ||
| ``` | ||
|
|
||
| Before committing, run the full test suite **without** `-short` to ensure all tests pass, including the Ethereum execution-spec tests and all state/block test permutations: | ||
|
|
||
| ```sh | ||
| go run ./build/ci.go test | ||
| ``` | ||
|
|
||
| ### 4. Linting | ||
|
|
||
| ```sh | ||
| go run ./build/ci.go lint | ||
| ``` | ||
|
|
||
| This runs additional style checks. Fix any issues before committing. | ||
|
|
||
| ### 5. Generated Code | ||
|
|
||
| ```sh | ||
| go run ./build/ci.go check_generate | ||
| ``` | ||
|
|
||
| Ensures that all generated files (e.g., `gen_*.go`) are up to date. If this fails, first install the required code generators by running `make devtools`, then run the appropriate `go generate` commands and include the updated files in your commit. | ||
|
|
||
| ### 6. Dependency Hygiene | ||
|
|
||
| ```sh | ||
| go run ./build/ci.go check_baddeps | ||
| ``` | ||
|
|
||
| Verifies that no forbidden dependencies have been introduced. | ||
|
|
||
| ## Commit Message Format | ||
|
|
||
| Commit messages must be prefixed with the package(s) they modify, followed by a short lowercase description: | ||
|
|
||
| ``` | ||
| <package(s)>: description | ||
| ``` | ||
|
|
||
| Examples: | ||
| - `core/vm: fix stack overflow in PUSH instruction` | ||
| - `eth, rpc: make trace configs optional` | ||
| - `cmd/geth: add new flag for sync mode` | ||
|
|
||
| Use comma-separated package names when multiple areas are affected. Keep the description concise. | ||
|
|
||
| ## Pull Request Title Format | ||
|
|
||
| PR titles follow the same convention as commit messages: | ||
|
|
||
| ``` | ||
| <list of modified paths>: description | ||
| ``` | ||
|
|
||
| Examples: | ||
| - `core/vm: fix stack overflow in PUSH instruction` | ||
| - `core, eth: add arena allocator support` | ||
| - `cmd/geth, internal/ethapi: refactor transaction args` | ||
| - `trie/archiver: streaming subtree archival to fix OOM` | ||
|
|
||
| Use the top-level package paths, comma-separated if multiple areas are affected. Only mention the directories with functional changes, interface changes that trickle all over the codebase should not generate an exhaustive list. The description should be a short, lowercase summary of the change. | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something we realised when triaging #33846 is that we're not really running gofmt or we would've caught those. Isn't the lint step already enough to let it know that there is style issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the lint step would be enough, but it also probably doesn't hurt to put it in the prompt proactively and avoids a few additional tool calls.