Skip to content

Add agent skills for building and testing - #8034

Draft
csadorf wants to merge 10 commits into
NVIDIA:mainfrom
csadorf:skills/building-and-testing
Draft

Add agent skills for building and testing#8034
csadorf wants to merge 10 commits into
NVIDIA:mainfrom
csadorf:skills/building-and-testing

Conversation

@csadorf

@csadorf csadorf commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Adds AGENTS.md with general guidelines and reference to the two new skills: build-cuml and test-cuml

The build-cuml skill is somewhat opinionated about how to setup the build environment. That's intentional to avoid ambiguity and make sure that multiple agents don't interfere with each other (or at least make that less likely).

The test-cuml skill is fairly comprehensive, but that's because there are many different ways to run tests.

Closes #8103

@csadorf
csadorf requested a review from a team as a code owner April 29, 2026 21:33
@csadorf
csadorf requested review from betatim, gforsyth and mgrauer April 29, 2026 21:33
@csadorf csadorf added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Apr 29, 2026
Comment thread .github/CODEOWNERS Outdated
Comment on lines +24 to +25
/AGENTS.md @rapidsai/cuml-python-codeowners @rapidsai/cuml-cpp-codeowners
/.agents/ @rapidsai/cuml-python-codeowners @rapidsai/cuml-cpp-codeowners

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should consider creating a dedicated @rapidsai/cuml-agent-instructions-owners team.

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces foundational agent instruction materials: an onboarding document (AGENTS.md) that navigates agents to dedicated build and test skill pages, comprehensive runbooks for building and testing cuML workflows, ownership rules for the new agent documentation structure, and CI workflow updates to exclude agent documentation from unrelated job triggers.

Changes

Agent Instruction Documentation

Layer / File(s) Summary
Root Agent Onboarding
AGENTS.md
New onboarding document establishing repository layout (cpp/, python/cuml/, ci/, docs/), directing agents to build and test skills before making changes, defining contribution and review conventions.
Build Skill Documentation
.agents/build-cuml/SKILL.md
Comprehensive build runbook documenting quick-start commands, environment verification, build targets (default, libcuml, cuml, prims), key flags (--ccache, --allgpuarch, --singlegpu), environment variables, fast-iteration patterns, ccache/sccache setup and validation, post-build verification, common failure remediation, and manual cmake+pip fallback.
Test Skill Documentation
.agents/test-cuml/SKILL.md
Consolidated test runbook covering C++ gtests via ctest and direct binaries, Python single-GPU pytest from python/cuml/tests/, dask multi-GPU tests via ci/run_cuml_dask_pytests.sh, cuml.accel proxy estimator tests, upstream sklearn/umap/hdbscan tests with xfail-list management, integration tests with cudf.pandas, result analysis, common gotchas, and key resource references.
Workflow Configuration and Ownership
.github/CODEOWNERS, .github/workflows/pr.yaml
Assigns joint ownership of **/AGENTS.md and **/.agents/** to cuML Python and C++ teams; updates five PR job groups (build_docs, test_cpp, test_notebooks, test_python_conda, test_python_wheels) to exclude agent documentation paths, replacing !**/*/agents.md with !**/AGENTS.md and !**/.agents/**.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • rapidsai/cuml#7919: Modifies .github/CODEOWNERS to add new ownership rules (wiki/ and notebooks/), demonstrating ongoing codeowner structure maintenance pattern.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main changes: adding new agent skills for building and testing cuML.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description accurately describes the changeset as adding AGENTS.md and two new skills (build-cuml and test-cuml) for agent onboarding and build/test guidance.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
.agents/build-cuml/SKILL.md (2)

356-362: Run codespell (and markdownlint) on .agents/ docs before merge.

Given the amount of new markdown content, I recommend running:

  • codespell across .agents/ (per coding guidelines: “Check for spelling mistakes using codespell”)
  • markdown linting to catch any remaining MD028/MD051 style issues.

If you want, I can draft the exact commands for your repo’s existing tooling.
Based on learnings, doc/offboarding materials are expected to be robust and precise for agent workflows, so catching lint/spelling early reduces friction.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/build-cuml/SKILL.md around lines 356 - 362, Run codespell and a
markdown linter over the new .agents docs and fix any findings before merging;
specifically run codespell across the .agents directory and run your repo's
markdownlint configuration against .agents/build-cuml/SKILL.md (check the
"Additional resources" section and other new headings for MD028/MD051 and
spelling errors), then commit corrected markdown and spelling fixes so the PR
contains lint-clean documentation.

81-88: Optional style: “Pick the right env file” → “Pick the correct env file”.

This is flagged as a redundancy (“right” used nearby). It’s not functionally important, but easy to polish.

🛠️ Proposed diff
-#### Step 1: Pick the right env file
+#### Step 1: Pick the correct env file
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/build-cuml/SKILL.md around lines 81 - 88, Replace the heading text
"Pick the right env file" with "Pick the correct env file" in SKILL.md to remove
the redundancy; update the section title string (the heading symbol) so the new
wording appears exactly where the current "Pick the right env file" heading is
used.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/build-cuml/SKILL.md:
- Around line 21-32: The blockquote under "Important (sm_121 / new arch + conda
RAPIDS libs)" contains a stray blank line that breaks markdownlint MD028; remove
the blank line so the quoted paragraph remains contiguous (ensure the closing
``` of the inline code example is immediately followed by the next quoted line
like "> Bug details: …"), and make sure the following "Note on env layout"
paragraph is a separate blockquote (each quoted line prefixed with "> ") without
stray characters or hyphens.
- Around line 46-54: Update the broken markdown link fragment: replace the
reference `#step-3-exclude-the-env-from-git-and-the-editor` with
`#step-2-configure-exclusions` so the `.conda-env` exclusion link points to the
actual heading "#### Step 2: Configure exclusions"; ensure the link in the
paragraph describing the per-worktree conda env (the sentence containing
`.conda-env/` and the existing anchor) is the one changed.

In @.agents/test-cuml/SKILL.md:
- Around line 91-105: In the "Dask tests (multi-GPU)" section update the
misspelled protocol name "UCXX" to "UCX" everywhere—including the prose and the
example lines that mention the `--run_ucx` flag and the canonical entry point
`ci/run_cuml_dask_pytests.sh`—so the documented flag and wording consistently
use `UCX` (single "X") instead of "UCXX".

---

Nitpick comments:
In @.agents/build-cuml/SKILL.md:
- Around line 356-362: Run codespell and a markdown linter over the new .agents
docs and fix any findings before merging; specifically run codespell across the
.agents directory and run your repo's markdownlint configuration against
.agents/build-cuml/SKILL.md (check the "Additional resources" section and other
new headings for MD028/MD051 and spelling errors), then commit corrected
markdown and spelling fixes so the PR contains lint-clean documentation.
- Around line 81-88: Replace the heading text "Pick the right env file" with
"Pick the correct env file" in SKILL.md to remove the redundancy; update the
section title string (the heading symbol) so the new wording appears exactly
where the current "Pick the right env file" heading is used.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ceec5084-eb7d-4a96-8fc4-a639b89046a0

📥 Commits

Reviewing files that changed from the base of the PR and between 0a81eaa and db51db7.

📒 Files selected for processing (4)
  • .agents/build-cuml/SKILL.md
  • .agents/test-cuml/SKILL.md
  • .github/CODEOWNERS
  • AGENTS.md

Comment thread .agents/build-cuml/SKILL.md Outdated
Comment thread .agents/build-cuml/SKILL.md Outdated
Comment thread .agents/test-cuml/SKILL.md

@mgrauer mgrauer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally content looks good and we can always iterate.

To support progressive disclosure (allowing an agent to be token efficient when holding the skill in the context window, but not invoking the skill) can you split the skills into skill+references? I am biased towards leaner skills.

I think the split should roughly be:

  • skill - general context, when to invoke the skill - supports the decision of "should I invoke this skill?"
  • references - specific commands, technical details - anything that can be deferred until the "invoke this skill" decision is made

See here as an example of referring to references

@betatim

betatim commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

First off, I think we should have an AGENTS.md and skills for developers. But you guessed it, here comes a but :D

One unresolved problem for me is how to have skills or opinionated things in AGENTS.md and allow people to have their own "wonderfully unique" setup. I don't really want my agent to start using the way of setting up envs described in the "how to setup an env" skill.

As a comparison, I have been using these lines in my local AGENTS.md for a few months now and am very happy:

## Running commands

- Use a conda environment for building, testing and benchmarking, running commands like `gh`, etc.
- **Which env:** cuML envs are named `cuml-YYYYMMDD`. Use the one with the latest date (e.g. run `conda env list` and pick the `cuml-*` env whose date suffix is greatest).

---

## Building the project

- After making code changes, rebuild the project. Use `cd ~/git/cuml && PARALLEL_LEVEL=8 ./build.sh --nolibcumltest  --ccache` to do that
- The project needs rebuilding after changes to Python only code and to the tests as well. Not only C++ code.

This seems to be more than enough for the agent to (a) use "the right" existing env (which might or might not contain specially installed versions that I hand picked for the current task) and (b) reliably build the project.

But even these ten lines are somehow opinionated. Maybe we could make ~/git/cuml a variable, but things like the env naming scheme, or not having tools like gh available globally are probably special to my setup. So the customisation problem remains.

I think we need to iterate a bit to find the smallest common denominator that most people can agree to and include a mechanism to customise things. For example, maybe including "Check agents/AGENTS.md for instructions that override those found here" and then having a local agents/AGENTS.md that contains custom instructions (not tested if this works, just an idea).


My full AGENTS.md https://gist.github.com/betatim/190a78c7a23788ab6237a93b42137182

@csadorf

csadorf commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

@betatim I think we can and should try to make the skill robust against alternative approaches for conda env management, but I consider your suggested date-based approach for conda env naming significantly more opinionated than what I suggested.

Bottom-line is that development environment management is typically the thing that my agents get hung upon and the approach outlined here seems to work.

Have you tried this skill in combination with your AGENTS.md yet?

@csadorf

csadorf commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

I'll attempt to make the skills more modular and generic to accommodate alternative environment management conventions. I think it will require a bit of tuning to get that right, but I think it's important to get it right since it's essentially the crux of the entire "build cuml" flow.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/setup-dev-environment/SKILL.md:
- Around line 132-141: The script reads DRIVER_CUDA but never enforces the
documented R580 rule; parse DRIVER_CUDA to extract a numeric major driver
version (e.g., DRIVER_CUDA_MAJOR from DRIVER_CUDA by splitting on '.' and
converting to an integer) and include it in the selection logic: set
CUDA_TAG=129 if DRIVER_CUDA_MAJOR < 580 OR if CC < 7.5 (the existing Volta
check), otherwise set CUDA_TAG=131. Update the conditional that currently
references CC to also check DRIVER_CUDA_MAJOR and use those variables
(DRIVER_CUDA, DRIVER_CUDA_MAJOR, CC, CUDA_TAG) so old drivers (<R580) on
non-Volta GPUs correctly choose cuda-129.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: be814abb-99d2-40aa-a4c7-8d2f342c4a07

📥 Commits

Reviewing files that changed from the base of the PR and between db51db7 and 61adf89.

📒 Files selected for processing (6)
  • .agents/build-cuml/SKILL.md
  • .agents/setup-dev-environment/SKILL.md
  • .agents/test-cuml/SKILL.md
  • .github/CODEOWNERS
  • .github/workflows/pr.yaml
  • AGENTS.md
✅ Files skipped from review due to trivial changes (3)
  • .github/CODEOWNERS
  • AGENTS.md
  • .agents/test-cuml/SKILL.md

Comment thread .agents/setup-dev-environment/SKILL.md Outdated
@mgrauer

mgrauer commented May 6, 2026

Copy link
Copy Markdown
Contributor

If you are able to get a revised version of this up by Friday, I could give it a test drive with claude and codex.

Are there specific prerequisites you have in mind? They may be written somewhere, but just to double check, e.g., can I assume just a clean repo checkout and no conda / pip env setup as a starting point?

@betatim

betatim commented May 7, 2026

Copy link
Copy Markdown
Contributor

I've added these two skills to my local checkout. I'll report back what happens as I do work.

Maybe a way forward is to adjust the skills so that an agent can tell that they don't need to use them. As a human on a "foreign" system I will look around if mamba is available or if there is a .venv, etc. Basically some heuristics to figure out "what is the preferred way of using Python on this system?". And if there is no existing way that I can find I'll do my preferred thing. I have no idea how we could teach an agent this (I'm not even sure I could write down my "algorithm"). But somehow that is what we need.

I agree that using dates in the env name is something many people would describe as "wonderfully weird". The reason I do it is that setting up a new env takes a long time, building cuml in it takes a while on top. So I try to re-use my existing env as much as possible.

@betatim

betatim commented May 7, 2026

Copy link
Copy Markdown
Contributor

n.b. my version of Cursor is convinced that .agents/ is not a directory it looks in for skills, so I created a symlink from .cursor/skills to .agents/skills. We might have to create a few aliases liek this

@csadorf

csadorf commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

I'm considering to pull the env management out of this PR and get at least the build and test skills merged. I can probably come up with a testing framework that lets us evaluate how well the env management works with in combination with some other custom setups.

@csadorf
csadorf force-pushed the skills/building-and-testing branch from 61adf89 to 62957a4 Compare May 8, 2026 19:53
@copy-pr-bot

copy-pr-bot Bot commented May 8, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@csadorf

csadorf commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

I've stripped the env management from this PR.

@csadorf

csadorf commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

@betatim Did you get a chance to test this? Or any other thoughts?

@csadorf csadorf added the DO NOT MERGE Hold off on merging; see PR for details label Jun 2, 2026
@csadorf csadorf removed the DO NOT MERGE Hold off on merging; see PR for details label Jul 8, 2026
@csadorf
csadorf marked this pull request as draft August 6, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add agent guidance for building and testing cuML

4 participants