<!--- This file has been generated from an external template. Please do not modify it directly. -->
<!--- Changes should be contributed to https://github.com/munich-quantum-toolkit/templates. -->

# AI Usage Guidelines

We acknowledge that AI tools (Large Language Models, code completion engines
like GitHub Copilot, etc.) have become helpful assistants for many developers.
We allow the use of these tools to assist with contributions, provided that
their use is transparent, responsible, and that a **human remains in the loop**
at all times.

This guide outlines our policy on AI-assisted contributions to ensure code
quality, maintainability, and legal compliance.

## Core Principles

### 1. You are Responsible

**You are responsible for every line of code you submit.**

Regardless of whether code was written by you or generated by an AI tool, you
are the author and are fully accountable for the contribution. You must:

- Fully understand the code you are submitting.
- Be able to explain the reasoning behind the code and how it interacts with the
  rest of the codebase.
- Verify that the code is correct, efficient, and follows our coding standards.

**Do not blindly copy-paste AI-generated code.** If you cannot explain it, do
not submit it.

### 2. Human in the Loop

**Humans remain accountable for AI-assisted contributions.**

AI agents may implement changes and manage issue and pull request workflows when
a human explicitly authorizes the scope and relevant external actions. The human
remains the driver and is responsible for the resulting contribution.

- **Review:** You must read and review all AI-generated code and relevant public
  text before merging or otherwise accepting the contribution. You remain
  accountable for public text posted within an authorized scope.
- **Edit:** AI-generated code often requires significant editing to meet project
  standards and correctness.
- **Verify:** Ensure the code actually solves the problem and doesn’t introduce
  subtle bugs or security vulnerabilities.
- **Authorize:** Explicitly authorize agents before they create, edit, submit,
  or comment on issues and pull requests. A single authorization may cover a
  clearly scoped task; per-message approval is not required. Remain accountable
  for all external communication that agents submit on your behalf. Actions
  outside the authorized scope require fresh authorization.

### 3. Communication

**AI tools may be used to prepare and manage issue and pull request workflows,
including descriptions, comments, and code reviews, when a human has authorized
the action and remains responsible for the result.**

AI-generated communication can be incorrect, irrelevant, or overly generic. Keep
it accurate, specific, and useful to reviewers and contributors. Do not post
low-quality, repetitive, or unsolicited messages.

Every agent-authored or agent-edited public text body must begin with the
following visible disclosure:

`🤖 *AI text below* 🤖`

This requirement applies to issue and pull request descriptions, review bodies,
inline review comments, issue-style comments, replies, and other submitted text
bodies. Pull request and issue titles are exempt. When editing existing
human-authored text, preserve the original content and add the disclosure at the
beginning of the edited field.

### 4. Transparency and Disclosure

Transparency helps the community understand the role of these tools and develop
best practices.

**AI assistance must be disclosed in the PR description.** This helps reviewers
understand how the tools were used and where human verification was applied.

- **PR Description**: Briefly state how AI tools materially assisted the
  contribution. If an agent authored or edited the description, use the visible
  disclosure required in the [communication policy]().
- **Commit Messages**: We recommend adding an
  `Assisted-by: [Model Name] via [Tool Name]` trailer to commits prepared with
  AI assistance. For example:
  `Assisted-by: Claude Sonnet 4.6 via GitHub Copilot`.

### 5. Licensing and Copyright

You are responsible for ensuring that your contribution does not violate any
third-party licenses or copyrights.

- **Originality**: Your submission must be your own original work of authorship.
- **Training Data**: Be aware that some AI tools may generate code that is
  substantially similar to their training data. You must ensure that you have
  the right to contribute the generated code under
  [our license](https://github.com/munich-quantum-toolkit/sqr/blob/main/LICENSE).

## Extractive Contributions

Processing pull requests and comments for MQT SQR requires significant
maintainer time and energy. Sending unreviewed AI output to open-source projects
shifts the burden of verifying correctness from the contributor to the
maintainer. We classify such contributions as “extractive” because they consume
more community resources than they provide in value.

Our **golden rule** is that a contribution should be valuable enough to justify
the review effort. Nadia Eghbal captures this concept in her book
 *[Working in Public](https://press.stripe.com/working-in-public)*:

> “When attention is being appropriated, producers need to weigh the costs and
> benefits of the transaction. To assess whether the appropriation of attention
> is net-positive, it’s useful to distinguish between *extractive* and
> *non-extractive* contributions. Extractive contributions are those where the
> marginal cost of reviewing and merging that contribution is greater than the
> marginal benefit to the project’s producers. In the case of a code
> contribution, it might be a pull request that’s too complex or unwieldy to
> review, given the potential upside.” — Nadia Eghbal

Before AI tools became widespread, open-source project maintainers would often
review all changes sent to the project simply because submitting a pull request
was a sign of interest from a potential long-term contributor. However, AI tools
now allow the rapid generation of large volumes of code, which can easily
overwhelm maintainers if submitted without careful review. Our policy exists to
ensure that maintainer time is spent on high-quality interactions rather than
debugging AI-generated code.

### Sustainable Open Source

The Munich Quantum Toolkit (MQT) is committed to remaining free, open-source,
and permissively licensed. We want to build a welcoming community where aspiring
quantum software engineers can learn and grow. Reviewing contributions is a key
part of this mentorship.

However, to keep the project sustainable, we must prioritize non-extractive
contributions. By thoroughly reviewing and understanding your AI-assisted code
before submission, you ensure that your contribution is a net positive for the
project. This helps us maintain a healthy ecosystem where both the software and
its contributors can thrive.

## Prohibited Uses

- **“Good First Issues”**: Do not use AI tools to solve issues labeled as “good
  first issue”. These are intended as learning opportunities for new
  contributors. Automating them defeats the purpose.
- **Spam**: Do not use AI to generate low-quality, repetitive, or unsolicited
  comments or reviews (“AI Slop”).
- **Unreviewed Code**: Merging or accepting code that you, as a human, have not
  reviewed and tested yourself.

## Summary

We want to foster a welcoming community where developers can learn and grow. AI
tools can be great for productivity, but they should not replace critical
thinking or the learning process. If a maintainer judges that a contribution
relies too heavily on unverified AI generation or lacks sufficient human
understanding (“extractive contribution”), we may request that you revise it or
close the PR.

---

Parts of this guide were inspired by or adapted from the contribution guidelines
of

- [Astral](https://github.com/astral-sh/uv/blob/c89a78ec085077f6344b0439ddf07fdad7336310/CONTRIBUTING.md),
- [Qiskit](https://github.com/Qiskit/qiskit/blob/cd8701690723d3d9602fac63fe0bd7ea618799be/CONTRIBUTING.md#use-of-ai-tools), and
- [LLVM](https://github.com/llvm/llvm-project/blob/9b6391f9c439c9926e8587b7b940e9a1e98a7819/llvm/docs/AIToolPolicy.md), including the sources therein, such as
  [Fedora Council Policy Proposal: Policy on AI-Assisted Contributions (fetched 2026-03-12)](https://communityblog.fedoraproject.org/council-policy-proposal-policy-on-ai-assisted-contributions/), <!-- rumdl-disable-line MD013 -->
  which is licensed under the
  [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/),

with the help of Gemini 3 Pro (Preview). The links above serve as attribution.
