<a id="ai-policy"></a>

# AI Policy

“AI” herein refers to generative AI tools like large language models (LLMs)
that can generate, edit, and review software code, create and manipulate
images, or generate human-like communication.

## Responsibility

You are responsible for any code you submit to ESMValTool’s repositories,
regardless of whether it was manually written or generated by AI. You must
understand and be able to explain the code you submit as well as the existing
related code. It is not acceptable to submit a patch that you cannot understand
and explain yourself.
In explaining your contribution, do not use AI to automatically generate
comments, pull request descriptions, or issue descriptions. Refer to
[Coding with AI: Opportunities and Responsibilities for Researchers](https://southampton-rsg-training.github.io/coding-with-ai/index.html)
for an introduction to using AI in research and software development.

## Disclosure

You must disclose whether AI has been used to assist in the development of
your pull request.
If so, you must document which tool(s) have been used, how they were used,
and specify what code or text is partially or fully AI generated. We will
politely reject any pull request that does not include the disclosure.

## Code Quality

Contributors are expected to submit code that meets
[ESMValTool’s standards](code_documentation.html.md#contributing-code-docs).
We will politely reject pull requests that we deem to be
“[AI generated and of little substantive value](https://en.wikipedia.org/wiki/AI_slop)”.
Do not waste developers’ time by submitting code that is fully or mostly
generated by AI, and doesn’t meet our standards. In particular, AI tools tend
to produce lengthy, verbose code and documentation. Please edit it down so it
is concise and easy for humans to read and review.

## Communication

When interacting with developers (forums, discussions,
issues, pull requests, etc.) do not use AI to speak for you, except for
translation or grammar editing.
Human-to-human communication is essential for an
open source community to thrive.

If you suspect that a contributor has used AI in a way that violates this
policy, please point them to this document and politely ask them to update
their contribution accordingly.

## AI Agents

The use of an AI agent that writes code and then submits a pull request
autonomously is not permitted. A human must check any generated code and
submit a pull request according to the ‘Responsibility’ section above.

## AI for research

Refer to
[Coding with AI: Opportunities and Responsibilities for Researchers](https://southampton-rsg-training.github.io/coding-with-ai/index.html)
for an introduction to using AI in research and software development.
When using AI to assist with research, be aware that some AI tools train on
your input and may use it to generate content for others.
This is especially true for free AI services and often the default setting for
paid services.
Never use such tools with private repositories
that may contain unpublished research, as you may inadvertently leak (other people’s)
private code, documentation, and results to competing researchers or the
general public.

## Copyright

All code in ESMValTool is released under the Apache-2.0 copyright license.
Contributors to ESMValTool license their code under the same license when it
is included in ESMValTool’s version control repository. That means
contributors must own the copyright of any code submitted to ESMValTool or
must include the Apache-2.0 compatible open source license(s) associated with
the submitted code in the patch. Code generated by AI may infringe on
copyright and it is the submitter’s responsibility to not infringe. We reserve
the right to reject any pull requests, AI-generated or not, where the
copyright is in question.

## Other Resources

While these do not formally form part of ESMValTool’s AI policy, the following
resources may be helpful in understanding some pitfalls associated with using
AI to contribute to ESMValTool:

- [https://llvm.org/docs/AIToolPolicy.html](https://llvm.org/docs/AIToolPolicy.html)
- [https://github.com/melissawm/open-source-ai-contribution-policies](https://github.com/melissawm/open-source-ai-contribution-policies)
- [https://blog.scientific-python.org/scientific-python/community-considerations-around-ai/](https://blog.scientific-python.org/scientific-python/community-considerations-around-ai/)

## Acknowledgements

We thank the NumPy developers for their AI policy, upon which this document is
largely based.
