Skip to content

Commit 4f9cc63

Browse files
committed
feat: add AI-assisted contributing guidelines and policy
Signed-off-by: kyteinsky <kyteinsky@gmail.com>
1 parent f76f3d1 commit 4f9cc63

6 files changed

Lines changed: 385 additions & 0 deletions

File tree

.github/AI_POLICY.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<!--
2+
- SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
3+
- SPDX-License-Identifier: MIT
4+
-->
5+
6+
# AI Contribution Policy
7+
8+
This document provides guidance for AI tools and developers using AI assistance when contributing to Nextcloud. It applies to all repositories under the [Nextcloud GitHub organization](https://github.com/nextcloud/), including the server, clients, apps, and the community app ecosystem.
9+
10+
This policy complements the existing [Contribution Guidelines](CONTRIBUTING.md). The requirements around testing, the Developer Certificate of Origin, license headers, and security reporting described there continue to apply in full - this document addresses how they extend to AI-assisted contributions.
11+
12+
---
13+
14+
## Requirements
15+
16+
### Disclosure
17+
18+
Every pull request containing AI-assisted code, documentation, or tests must declare this in the PR description. PRs found to have undisclosed AI use might be closed.
19+
20+
For full traceability at the commit level, each commit containing AI-assisted content must include an `Assisted-by:` git trailer:
21+
22+
```
23+
Assisted-by: AGENT_NAME:MODEL_VERSION
24+
```
25+
26+
The agent name and model version identify the AI tool. Basic development tools such as git, compilers, editors, and static analyzers are not listed - these are standard parts of any development workflow regardless of AI involvement.
27+
28+
The PR description disclosure explains how AI was used; the commit trailer ensures that provenance is permanently recorded in version history and available to future contributors, auditors, and tooling.
29+
30+
Examples:
31+
32+
```
33+
Assisted-by: Devstral:devstral-small-2507
34+
Assisted-by: ClaudeCode:claude-sonnet-4-6
35+
Assisted-by: Qwen:qwen3-coder-32b
36+
Assisted-by: Copilot:gpt-4o
37+
```
38+
39+
### Author Accountability
40+
41+
The contributor is the legal and moral author of every line they submit. If a reviewer asks "why does this work this way?" and the answer is "the AI wrote it," the PR will be closed. This applies to code, comments, documentation, and tests alike. You must be able to explain, defend, and modify any content you submit.
42+
43+
### Human-Written Communication
44+
45+
Issues, PR descriptions, and review comments must be in the contributor's own words. Translation assistance and grammar/spelling help are acceptable exceptions and do not need to be disclosed - the intent of this rule is to ensure that the ideas, reasoning, and decisions in community communication come from the contributor.
46+
47+
This requirement extends through the entire review process. Contributors must respond to reviewer questions and implement requested changes themselves. Passing maintainer feedback into an AI and posting whatever comes out is not an acceptable substitute for genuine engagement. If a contributor cannot explain or implement a requested change because they do not understand their own submission, the PR will be closed.
48+
49+
### Security and Dependency Scrutiny
50+
51+
AI tools hallucinate package names, produce subtly broken access controls, and may reproduce vulnerable patterns from their training data. Contributors must manually verify all dependencies, access control logic, authentication patterns, and security implications in AI-generated code before submitting - the risk of undetected errors is higher than with hand-written code and warrants extra care.
52+
53+
For general security requirements applicable to all contributions, see the [Contribution Guidelines](CONTRIBUTING.md). Security vulnerabilities must be reported via [HackerOne](https://hackerone.com/nextcloud) following Nextcloud's [security policy](https://nextcloud.com/security/), not via public issues. AI-generated security reports must be independently verified before submission; unverified reports might be closed without response.
54+
55+
### No Autonomous Agent Submissions
56+
57+
AI agents must not open issues, submit pull requests, post review comments, or send security reports autonomously. Every contribution must be composed, reviewed, and submitted by a human. This includes agentic workflows where an AI browses the codebase, plans changes across multiple files, and generates commits - the human contributor remains responsible for reviewing all output before anything is submitted.
58+
59+
AI agents must not add `Signed-off-by` tags: only humans can legally certify the [Developer Certificate of Origin](https://github.com/nextcloud/server/blob/master/contribute/developer-certificate-of-origin).
60+
61+
### Licensing and Copyright Compliance
62+
63+
Contributors must ensure AI-generated code contains no material from sources incompatible with the license of the repository or app they are contributing to. Each Nextcloud repository and app carries its own license - contributors are responsible for knowing which applies. For guidance on license headers, see [HowToApplyALicense.md](https://github.com/nextcloud/server/blob/master/contribute/HowToApplyALicense.md).
64+
65+
The applicable test has three parts: the AI tool's terms must permit open-source use of its output; no third-party copyrighted material may be reproduced; and any included material must use a compatible open-source license. If generated code appears identical or suspiciously similar to code from an incompatible source, it must be removed or replaced with an original implementation. Ignorance of AI-generated provenance is not a defense.
66+
67+
### Code Quality and Cleanup
68+
69+
AI output must be cleaned before submission. Dead code, redundant logic, excessive comments, inconsistent style, unused variables, structural drift, and unrelated file changes must all be removed. Submitting large AI code blobs without meaningful oversight - sometimes called "vibe coding" or "prompt dumping" - is prohibited.
70+
71+
Signs of a disallowed submission include: large unreviewed AI blobs; obvious mechanical mistakes a human would fix in minutes; code that has clearly never been executed; and pull requests that shift debugging and cleanup work onto maintainers rather than the contributor. As required by the [Contribution Guidelines](CONTRIBUTING.md), all changed and added code must be unit tested - AI-generated code is not exempt from this requirement.
72+
73+
New features must be tested on a live Nextcloud instance by the contributor before submission. Providing test instructions for an AI agent to execute is not a substitute for human testing.
74+
75+
---
76+
77+
## Guidelines
78+
79+
### Focused and Scoped Pull Requests
80+
81+
A pull request should address exactly one thing. AI-generated code frequently drifts in scope due to imprecise prompting, touching unrelated files or introducing incidental refactors. If a PR description does not match its diff, that is a signal the contributor did not review their own changes. Large changes must be broken into multiple focused commits or separate PRs.
82+
83+
### Maintainer Discretion
84+
85+
Maintainers have unreviewable authority to close AI-assisted contributions for quality, complexity, scope, or community-fit reasons. A contribution that costs reviewers more time than it returns value to the project is extractive and will be closed, regardless of how many rounds of review it has already received. The golden rule applies: a contribution should be worth more to the project than the time it takes to review.
86+
87+
### Beginner Issues
88+
89+
AI tools must not be used to fully automate the resolution of issues labeled [`good first issue`](https://github.com/issues?q=org%3Anextcloud+label%3A%22good+first+issue%22) or similar beginner-friendly labels. These issues exist to create a learning path for new contributors who will become future maintainers. Take a beginner issue only if you genuinely intend to learn and continue contributing to Nextcloud.
90+
91+
---
92+
93+
## Scope and Updates
94+
95+
This policy applies to all contributions to repositories and apps under the Nextcloud GitHub organization, by all contributors. It will be reviewed and updated as AI tooling, open-source best practices, and applicable law evolve. Suggested changes are welcome via pull requests.

.github/CONTRIBUTING.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2021-2026 Nextcloud GmbH and Nextcloud contributors
3+
SPDX-License-Identifier: MIT
4+
-->
5+
6+
## Submitting issues
7+
8+
If you have questions about how to install or use Nextcloud, please direct these to our [forum][forum].
9+
10+
### Guidelines
11+
* Please search the existing issues first, it's likely that your issue was already reported or even fixed.
12+
- Go to one of the repositories, click "issues" and type any word in the top search/command bar.
13+
- More info on [search syntax within github](https://help.github.com/articles/searching-issues)
14+
* __SECURITY__: Report any potential security bug to us via [our HackerOne page](https://hackerone.com/nextcloud) following our [security policy](https://nextcloud.com/security/) instead of filing an issue in our bug tracker.
15+
* The issues in other components should be reported in their respective repositories: You will find them in our [GitHub Organization](https://github.com/nextcloud/)
16+
* Report the issue using one of our templates, they include all the information we need to track down the issue.
17+
18+
Help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues.
19+
20+
[forum]: https://help.nextcloud.com/
21+
22+
## Contributing to Source Code
23+
24+
Thanks for wanting to contribute source code to Nextcloud. That's great!
25+
26+
Please read the [Developer Manuals][devmanual] to learn how to create your first application or how to test the Nextcloud code.
27+
28+
### AI-assisted contributions
29+
30+
Nextcloud allows contributions made with the help of AI tools. You are the author of everything you submit - AI assistance does not change that responsibility.
31+
32+
* **Disclosure:** Declare AI tool use in the PR description and add an `Assisted-by: AGENT_NAME:MODEL_VERSION` git trailer to each affected commit.
33+
34+
* **Accountability:** You must be able to explain, defend, and modify every line you submit. If a reviewer asks why something works a certain way, "the AI wrote it" is not an answer.
35+
36+
* **Communication:** PR descriptions, review comments, and issue reports must be written in your own words. This applies throughout the review process - passing reviewer feedback to an AI and posting whatever comes out is not acceptable.
37+
38+
* **Quality:** AI output must be quality assured by the human, i.e. reviewed, cleaned up, and tested before submission. New features must be tested on a live instance by you, not by an agent. Code that has never been executed, or that shifts debugging work onto maintainers, will not be accepted.
39+
40+
* **Licensing:** Ensure AI-generated code contains no material incompatible with the license of the repository you are contributing to.
41+
42+
For the full policy including autonomous agent rules, security reports, and beginner issues, read the [AI Contribution Policy][aipolicy].
43+
44+
### Tests
45+
46+
In order to constantly increase the quality of our software we can no longer accept pull request which submit un-tested code.
47+
It is a must have that changed and added code segments are unit tested.
48+
In some areas unit testing is hard (aka almost impossible) as of today - in these areas refactoring WHILE fixing a bug is encouraged to enable unit testing.
49+
50+
### Sign your work
51+
52+
We use the Developer Certificate of Origin (DCO) as a additional safeguard
53+
for the Nextcloud project. This is a well established and widely used
54+
mechanism to assure contributors have confirmed their right to license
55+
their contribution under the project's license.
56+
Please read [contribute/developer-certificate-of-origin][dcofile].
57+
If you can certify it, then just add a line to every git commit message:
58+
59+
````
60+
Signed-off-by: Random J Developer <random@developer.example.org>
61+
````
62+
63+
Use your real name (sorry, no pseudonyms or anonymous contributions).
64+
If you set your `user.name` and `user.email` git configs, you can sign your
65+
commit automatically with `git commit -s`. You can also use git [aliases](https://git-scm.com/book/tr/v2/Git-Basics-Git-Aliases)
66+
like `git config --global alias.ci 'commit -s'`. Now you can commit with
67+
`git ci` and the commit will be signed.
68+
69+
### Apply a license
70+
71+
In case you are not sure how to add or update the license header correctly please have a look at [contribute/HowToApplyALicense.md][applyalicense]
72+
73+
[devmanual]: https://docs.nextcloud.com/server/latest/developer_manual/
74+
[dcofile]: https://github.com/nextcloud/server/blob/master/contribute/developer-certificate-of-origin
75+
[applyalicense]: https://github.com/nextcloud/server/blob/master/contribute/HowToApplyALicense.md
76+
[aipolicy]: https://github.com/nextcloud/.github/blob/master/AI_POLICY.md
77+
78+
## Translations
79+
Please submit translations via [Transifex][transifex].
80+
81+
[transifex]: https://explore.transifex.com/nextcloud

.github/workflows/ai-policy.yml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: AI Policy
10+
11+
on:
12+
pull_request:
13+
types: [opened, synchronize, reopened]
14+
branches: [master, main]
15+
16+
permissions:
17+
contents: read
18+
# Required to add the "AI assisted" label via `gh pr edit --add-label`
19+
pull-requests: write
20+
# Required to create the "AI assisted" label via the REST labels endpoint
21+
# (labels are an issues-scoped resource in the GitHub API)
22+
issues: write
23+
24+
concurrency:
25+
group: ai-policy-${{ github.head_ref || github.run_id }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
check-ai-trailers:
30+
runs-on: ubuntu-latest-low
31+
steps:
32+
- name: Collect PR commit messages
33+
id: collect
34+
env:
35+
GH_TOKEN: ${{ github.token }}
36+
COMMITS_URL: ${{ github.event.pull_request.commits_url }}
37+
run: |
38+
set -euo pipefail
39+
gh api ${COMMITS_URL} | jq -r '.[] | .commit.message' > /tmp/pr_commits.txt
40+
echo "--- PR commit messages ---"
41+
cat /tmp/pr_commits.txt
42+
echo "--------------------------"
43+
44+
- name: Define shared agent detection patterns
45+
run: |
46+
set -euo pipefail
47+
48+
# Email addresses known to be used by coding agents.
49+
# These should never appear in Signed-off-by because the DCO can only be attested by a human.
50+
EMAIL_PATTERN="copilot@github\.com\
51+
|noreply@anthropic\.com\
52+
|devin@cognition\.ai\
53+
|devin@cognition-labs\.com\
54+
|aider@aider\.chat\
55+
|noreply@aider\.chat\
56+
|codex@openai\.com\
57+
|cursor@anysphere\.com\
58+
|windsurf@codeium\.com\
59+
|codeium@codeium\.com\
60+
|amazon-q@amazon\.com\
61+
|codewhisperer@amazon\.com\
62+
|gemini-code-assist@google\.com\
63+
|openhands@all-hands\.dev\
64+
|swe-agent@princeton\.edu"
65+
66+
# Strip embedded whitespace (used above only for readability)
67+
EMAIL_PATTERN=$(echo "$EMAIL_PATTERN" | tr -d ' \n')
68+
echo "AGENT_EMAIL_PATTERN=${EMAIL_PATTERN}" >> "$GITHUB_ENV"
69+
70+
# Display-name prefixes used by known coding agents (shared by Signed-off-by and Co-Authored-By checks)
71+
# shellcheck disable=SC2016
72+
echo 'AGENT_NAMES=GitHub Copilot|Claude( [A-Za-z0-9. -]+)?|Devin( AI)?|aider( \(.*\))?|OpenAI Codex|Cursor( AI)?|Windsurf|Amazon Q|CodeWhisperer|Gemini Code Assist|OpenHands|SWE-agent|AutoCodeRover|Tabnine' >> "$GITHUB_ENV"
73+
74+
- name: Check for AI-assistant / Assisted-by trailers
75+
id: ai_trailers
76+
run: |
77+
set -euo pipefail
78+
AI_ASSISTED=false
79+
if grep -qiE '^(AI-assistant|Assisted-by|AI-Assisted-By):' /tmp/pr_commits.txt; then
80+
AI_ASSISTED=true
81+
echo "Found AI-assistant/Assisted-by/AI-Assisted-By trailer(s):"
82+
grep -iE '^(AI-assistant|Assisted-by|AI-Assisted-By):' /tmp/pr_commits.txt
83+
fi
84+
echo "ai_assisted=${AI_ASSISTED}" >> "$GITHUB_OUTPUT"
85+
86+
- name: Check for coding-agent Signed-off-by trailers
87+
id: agent_signoff
88+
run: |
89+
set -euo pipefail
90+
91+
EMAIL_HITS=$(grep -iE "^Signed-off-by:.*<(${AGENT_EMAIL_PATTERN})>" /tmp/pr_commits.txt 2>/dev/null || true)
92+
NAME_HITS=$(grep -iE "^Signed-off-by: *(${AGENT_NAMES}) *[<(]" /tmp/pr_commits.txt 2>/dev/null || true)
93+
94+
AGENT_LINES=$(printf '%s\n%s' "$EMAIL_HITS" "$NAME_HITS" | sort -u | sed '/^[[:space:]]*$/d')
95+
96+
AGENT_SIGNOFF=false
97+
if [ -n "$AGENT_LINES" ]; then
98+
AGENT_SIGNOFF=true
99+
fi
100+
101+
echo "agent_signoff=${AGENT_SIGNOFF}" >> "$GITHUB_OUTPUT"
102+
{
103+
echo "agent_lines<<AGENT_EOF"
104+
echo "${AGENT_LINES}"
105+
echo "AGENT_EOF"
106+
} >> "$GITHUB_OUTPUT"
107+
108+
- name: Check for coding-agent Co-Authored-By trailers
109+
id: co_authored
110+
run: |
111+
set -euo pipefail
112+
113+
EMAIL_HITS=$(grep -iE "^Co-Authored-By:.*<(${AGENT_EMAIL_PATTERN})>" /tmp/pr_commits.txt 2>/dev/null || true)
114+
NAME_HITS=$(grep -iE "^Co-Authored-By: *(${AGENT_NAMES}) *[<(]" /tmp/pr_commits.txt 2>/dev/null || true)
115+
116+
CO_AUTHORED=false
117+
if [ -n "$EMAIL_HITS" ] || [ -n "$NAME_HITS" ]; then
118+
CO_AUTHORED=true
119+
echo "Found coding-agent Co-Authored-By trailer(s):"
120+
printf '%s\n%s' "$EMAIL_HITS" "$NAME_HITS" | sort -u | sed '/^[[:space:]]*$/d'
121+
fi
122+
123+
echo "co_authored=${CO_AUTHORED}" >> "$GITHUB_OUTPUT"
124+
125+
- name: Create 'AI assisted' label if absent
126+
if: steps.ai_trailers.outputs.ai_assisted == 'true' || steps.agent_signoff.outputs.agent_signoff == 'true' || steps.co_authored.outputs.co_authored == 'true'
127+
env:
128+
GH_TOKEN: ${{ github.token }}
129+
run: |
130+
gh api "repos/${{ github.repository }}/labels" \
131+
--method POST \
132+
-f name="AI assisted" \
133+
-f color="d93f0b" \
134+
-f description="This PR contains AI-assisted commits" \
135+
2>/dev/null || true
136+
137+
- name: Label PR as AI assisted
138+
if: steps.ai_trailers.outputs.ai_assisted == 'true' || steps.agent_signoff.outputs.agent_signoff == 'true' || steps.co_authored.outputs.co_authored == 'true'
139+
env:
140+
GH_TOKEN: ${{ github.token }}
141+
run: |
142+
gh pr edit "${{ github.event.pull_request.number }}" \
143+
--repo "${{ github.repository }}" \
144+
--add-label "AI assisted"
145+
echo "Added 'AI assisted' label to PR #${{ github.event.pull_request.number }}"
146+
147+
- name: Fail on coding-agent Signed-off-by
148+
if: steps.agent_signoff.outputs.agent_signoff == 'true'
149+
env:
150+
AGENT_LINES: ${{ steps.agent_signoff.outputs.agent_lines }}
151+
AGENTS_MD_URL: https://github.com/${{ github.repository }}/blob/${{ github.base_ref }}/AGENTS.md
152+
run: |
153+
echo "::error title=Coding-agent sign-off detected::A Signed-off-by trailer from a known coding agent was found in one or more commits."
154+
echo ""
155+
echo "Offending trailer(s):"
156+
echo "${AGENT_LINES}"
157+
echo ""
158+
echo "The 'Signed-off-by' trailer represents the Developer Certificate of Origin (DCO)"
159+
echo "and must only be attested by a human contributor."
160+
echo "Please amend the affected commit(s) to remove the coding-agent sign-off"
161+
echo "and replace it with an 'Assisted-by' trailer, for example:"
162+
echo ""
163+
echo " Assisted-by: Claude Code:claude-sonnet-4-6"
164+
echo ""
165+
echo "References:"
166+
echo " • AGENTS.md (this repository)"
167+
echo " ${AGENTS_MD_URL}"
168+
echo " • AI Contribution Policy"
169+
echo " https://github.com/nextcloud/.github/blob/master/AI_POLICY.md"
170+
echo " • Contribution Guidelines"
171+
echo " https://github.com/nextcloud/.github/blob/master/CONTRIBUTING.md"
172+
exit 1

0 commit comments

Comments
 (0)