Generative AI tools, especially coding agents, help tidywater development. They can streamline routine updates, find errors, and improve code quality and test coverage. Contributors may use them on any part of tidywater.
tidywater’s outputs are used to make engineering decisions, so they have to match the published models the package implements. This policy explains how to use AI tools without putting that correctness, or the package’s design, at risk. It applies to code, documentation, tests, data, issues, pull requests, and review comments.
1. Disclose AI use
- Pull requests: Include a short statement of how AI was used, for example “Generated by Claude Code” or “Code generated by Claude, description written by me.” Also say which part of section 3 the change falls under.
-
Commits: Where the tool supports it, keep the AI agent’s attribution trailer (for example,
Co-Authored-By:) on commits the agent wrote. - Issues, comments, and reviews: Mark any AI-generated text. Do not present AI output as your own analysis.
- You do not need to disclose minor help such as spell-checking or single-line autocomplete.
You are responsible for everything you submit, whatever tools you used. If an agent generated your whole PR, review it yourself before you ask anyone else to.
2. Use the repository’s agent instructions
AGENTS.md explains the package’s architecture, domain guardrails, testing, and performance rules for coding agents. Make sure your agent reads it. Some tools load it automatically; for others, point the tool to it (for example, add @AGENTS.md to a CLAUDE.md).
3. Limits on agent-written code
a. Changes that do not affect outputs. Examples are refactors, performance work, messages, documentation, tests, and tooling. The golden regression tests (tests/testthat/test-regression-*.R) pin the current output of every exported model. They and the rest of the test suite must pass without accepting new snapshots or changing expected values. If anything has to change, use 3b or 3c.
b. Changes that affect outputs and that the agent has verified against the source publication.
- The agent can read the source (paper, report, manual, or standard), and the roxygen documentation cites it.
- Tests compare outputs to values from that publication. Values the agent generated itself or copied from the current code do not count.
- The PR lists each changed or added equation, constant, and coefficient with its page or table in the source, notes any departure from the publication, and lists which golden snapshots changed and why.
New models must meet 3b. If the agent cannot read the source, a human must write or check the reference tests.
c. Changes that affect outputs but that have not been verified against a publication. Examples are bug fixes and changes to unit handling, input validation, defaults, or chaining. A bug fix may change an equation, coefficient, or constant when the existing code does not match its publication, as long as the PR explains the discrepancy. These changes are allowed, but the PR must list every golden snapshot that changed, with old and new values and the reason for each. Reviewers go through these in detail (section 6). A change the PR cannot explain is treated as a bug.
Any change to numeric output under 3b or 3c also needs a NEWS.md entry under “Breaking changes”.
4. Keep the package’s architecture
tidywater’s structure was chosen deliberately by drinking water practitioners, and the project is committed to keeping it. This includes the water class, function naming, the paired single-water and _df functions, units, and how models are validated and chained (see AGENTS.md). Agent-written code must follow existing patterns. Changes to the architecture or public interface need an issue agreed with a core developer before work starts. A human makes the design decision; the agent only implements it. Do not submit large unrequested restructurings or cleanup written by an agent.
5. New dependencies
Each new dependency is a long-term maintenance and security risk, and agents tend to add packages to solve small problems. Any package an agent adds to DESCRIPTION, and any new tool or GitHub Action that downloads or runs third-party code, gets extra scrutiny in review. The PR must call it out and explain why base R or an existing dependency will not do.
6. Human review
Every PR is reviewed by at least one human other than the submitter. An AI review can help but does not replace a human review: if you use an agent to review a PR, a human must still review both the agent’s comments and the original PR.
- Focus on the tests. Tests are how reviewers see what an agent actually changed. They must be thorough enough to show what the change does, including edge cases, warnings, and errors, without relying on the agent’s summary. Reviewers may ask for more.
- To keep the CRAN package fast, wrap long-running tests in
testthat::skip_on_cran()so they still run on CI. Most_dfhelper tests already do this. - For 3b changes, check the cited values against the source publication. For 3c changes, go through every changed golden value.
- Reviewers may ask for an AI-assisted PR to be split up, explained, or reworked if it is too large or unclear to review.
Maintainers may close issues or PRs that look AI-generated and that the submitter has not reviewed or understood. Repeat cases may be handled under the Code of Conduct.
