-
Notifications
You must be signed in to change notification settings - Fork 3.9k
CASSANDRA-21301: add AGENTS.md and CLAUDE.md #4734
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # Agent Instructions for Apache Cassandra | ||
|
|
||
| > These instructions apply to all AI-assisted contributions to `apache/cassandra`. | ||
|
|
||
| ## Apache Cassandra | ||
| Apache Cassandra is a NoSQL distributed database. This is the official Git repository | ||
|
|
||
| ## Environment | ||
|
|
||
| - Java 11 (default) or 17. | ||
| - Python 3 for `cqlsh` and dtests. | ||
| - Apache Ant >= 1.10 for all builds. Do NOT attempt to use Maven, Gradle, or any other build tool. Cassandra uses Ant exclusively. | ||
| - Do NOT attempt to install dependencies, you do not have Internet access | ||
|
|
||
| ## Build | ||
|
|
||
| ```bash | ||
| ant build # compile all classes (includes Accord submodule) | ||
| ant jar # build the main JAR | ||
| ant clean # remove locally created artifacts | ||
| ant realclean # remove entire build directory and downloaded artifacts | ||
| ``` | ||
|
Comment on lines
+15
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not a blocker for this PR at all, but i find its best to not let the harnest know / touch |
||
|
|
||
| Do NOT run `ant build` if you only need to verify a small change compiles. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how do you test compile then? |
||
|
|
||
| ## Testing | ||
|
|
||
| - Do NOT run the entire test suite(`ant test`). Run only the specific test(s) relevant to your change. | ||
|
|
||
| ```bash | ||
| # Run a single unit test class | ||
| ant testsome -Dtest.name=org.apache.cassandra.service.StorageServiceServerTest -Dtest.methods=testGetAllRangesEmpty | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Differentiating how to run unit vs. integration could be useful. Though I think it's more likely that just adding a SKILL.md for running tests that has a distilled extraction of guidance from So - maybe a quick example here + pointing to build.xml w/some string bread crumbs to know what to search for could be a decent 1st step.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is an area i feel we should have a script. For example the above is 100% wrong, and is what 90% of Cassandra dev use =D CI uses We also have different test scopes and they have their own command or special flags... this is way too much to put in a agents file and really should just be a script to make it idiot proof (LLMs do stupid things, try to make this deterministic when possible) |
||
| ``` | ||
|
|
||
| - When fixing a bug, first create a regression test that reproduces the failure, then implement the fix and verify. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not a blocker for this patch, but this is an area where skills can help. How to work with CQLTester, how to work with jvm-dtest, how to work with
do we have any example JIRA where this went well? I find claude makes really horrible tests. It will try to create a fake unit test that makes no sense then it defines success as it made the logic handle its test... but you actually go through Cassandra and everything is broken. |
||
| - Provide test(s) coverage for all new or modified code. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how? this is vague so LLMs are likely to make up random numbers; if we care about this (which we don't track) it should be deterministic |
||
|
|
||
| ## Linting and Code Checks | ||
|
|
||
| ```bash | ||
| ant check # runs checkstyle, RAT license check, and builds | ||
| ant checkstyle # checkstyle only | ||
|
Comment on lines
+41
to
+42
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a reason the harness should use checkstyle vs |
||
| ``` | ||
|
|
||
| ## Code Style | ||
| Cassandra enforces style via Checkstyle (`ant checkstyle`). Key rules are included in `checkstyle.xml` file. | ||
| General style: | ||
| - 4-space indentation, no tabs. | ||
| - Braces on a new line below control statements (Allman style). | ||
| - Brace-less style for single-line control statements. | ||
| - Match existing code style in the file you are editing. | ||
| - All new files must include the Apache License 2.0 header. | ||
| - Concise English documentation is required for complex classes and methods; trivial ones may not require them. | ||
|
Comment on lines
+45
to
+53
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sadly this is misleading and the actual style guide is at https://cassandra.apache.org/_/development/code_style.html The only way for a agent to know our style guide is to read that rule; and this is manual and lacking deterministic checks
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That style guide comes from the code right? We could just have a .md redirect pointing to that file for digging into specifics around style. Not sure when an LLM would be triggered to check that vs. just inferring from the local context from files.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't this in the website project?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ## Git Workflow | ||
| - Do NOT commit unless explicitly asked. | ||
| - Commit messages should reference the JIRA issue. Disclose that AI assistance was used in the PR description. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. honestly I think we should remove this. Logically this is only needed if the committer pushes this on the author (many don't), and is done after the review. For agent files you need them to work in 100% of sessions, and this section isn't applicable majority of the time. For example, how does it learn the JIRA?, how does it learn the reviewers? how does it learn that a reviewer gave code feedback and should be be included as a co-author? what should the commit message be and is it in-sync with JIRA (we are required to push context to JIRA as a source of truth)? |
||
|
|
||
| ``` | ||
| CASSANDRA-XXXXX: Brief description of the change | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the format does not match the agreed commit message described in https://cassandra.apache.org/_/development/how_to_commit.html |
||
| Author: Your Name <your.email@example.com> | ||
|
|
||
| Co-authored-by: GitHub Copilot | ||
| Co-authored-by: Claude | ||
| Co-authored-by: gemini-code-assist | ||
| ``` | ||
|
Comment on lines
+63
to
+66
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't think this is agreed to yet. Mick proposed in slack (informal) to use the Linux Kernal way of |
||
|
|
||
| - Do NOT modify submodule references without understanding the implications. Submodule changes must be committed and pushed before the parent Cassandra commit. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need this comment? this tells the LLM to hack around Accord rather than make clean fixes. Why are we asking harnesses to own git? |
||
|
|
||
| ## Boundaries | ||
|
|
||
| - 🚫 Never modify generated files in `src/gen-java/` — they are built from `src/antlr/` grammars. | ||
| - 🚫 Never modify files in `lib/` — these are managed dependencies. | ||
| - 🚫 Never commit secrets, credentials, or API keys. | ||
| - 🚫 Never run the full test suite (`ant test`) — it takes hours. Run targeted tests only. | ||
| - 🚫 Never bypass Checkstyle violations without a suppression comment explaining why. | ||
| - 🚫 Never create summary or documentation files unless explicitly asked. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i feel like this should be removed; harnesses are better at maintaining docs than us humans... so actually making sure features are documented should be desired? |
||
| - ⚠️ Ask before modifying the CQL grammar (`src/antlr/Cql.g`) — changes cascade widely. | ||
| - ⚠️ Ask before modifying `modules/accord/` — it is a separate repository. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a git thing, this tells the harness to hack when the proper solution is to update accord. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @AGENTS.md | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this isn't a symlink in git, so when you checkout you get |
||
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.
we support 21 in runtime now as well