From 89d0f82f2c77b4ec11223980ddf3f075e1fc5e6b Mon Sep 17 00:00:00 2001 From: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com> Date: Wed, 18 Nov 2026 09:59:23 +0000 Subject: [PATCH 1/3] docs(ai-policy): allow AI-drafted text written for human readers Follows nextcloud/.github#839. The old "own words" rule forced agent-drafted PR and issue text to be retyped by hand. The policy now judges contributions by their result and requires text that is plain, disclosed and written for human readers. Intentionally left out: the upstream AI_POLICY.md and snippet files are not copied; only the parts that apply to this repo's own docs are ported. Agents may sign off with `git commit -s`, but only after the contributor has reviewed and approved the changes, which is a deliberate deviation from the upstream snippet. Assisted-by: ClaudeCode:claude-sonnet-5-5 Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com> --- .github/CONTRIBUTING.md | 4 ++- .github/pull_request_template.md | 2 +- AGENTS.md | 59 +++++++++++++++++++++++++------- 3 files changed, 51 insertions(+), 14 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 40a6067e8f..1c3ddcdcef 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -39,7 +39,9 @@ You can also use scopes. Try to have them broad and not specific to a file or ti * **imap**: for changes in the IMAP client * **ui**: for changes to the web UI -Usage of AI agents has to be made transparent. Therefore, agent-assisted commits have to carry an `Assisted-by: :` trailer before the sign-off. For example: `Assisted-by: ClaudeCode:claude-sonnet-4-6` +Usage of AI agents has to be made transparent. Therefore, agent-assisted commits have to carry an `Assisted-by: :` trailer before the sign-off. For example: `Assisted-by: ClaudeCode:claude-sonnet-5-5` + +PR descriptions, issue reports, review comments and answers to reviewers may be drafted with AI, but must be written for human readers: plain, concise and disclosed. Every pull request that changes runtime behavior must be tested on a live Nextcloud instance; an agent may help, but you test the change yourself as well. If a pull request shows neither understanding nor quality, maintainers may ask for a rewrite first and close it if nothing improves. ### Pull requests diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 363b0825f5..ccdfbd1574 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,5 +1,5 @@ diff --git a/AGENTS.md b/AGENTS.md index 7ee90b9dd5..80671b28bc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,6 +6,46 @@ This file provides guidance to AI coding assistants working with code in this repository. +## Nextcloud Contribution Policy + +All contributions generated or assisted by this agent must fully comply with: + +- **[AI Contribution Policy](https://github.com/nextcloud/.github/blob/master/AI_POLICY.md)** - the primary reference for AI-specific rules, covering disclosure, author accountability, communication, security, licensing, code quality, and autonomous agent behavior. +- **[Contribution Guidelines](https://github.com/nextcloud/.github/blob/master/CONTRIBUTING.md)** - covering testing requirements, the Developer Certificate of Origin (DCO), license headers, and translations. These apply in full to all contributions regardless of how they were produced. + +### What this agent must always do + +- Add an `Assisted-by: AGENT_NAME:MODEL_VERSION` git trailer to every commit containing AI-assisted content. +- Ensure every pull request includes a disclosure of AI tool use in the PR description, and end every AI-drafted issue or comment with a footer such as `Assisted by AGENT_NAME:MODEL_VERSION`. +- Write issues, PR descriptions, and comments for human readers: + - Lead with what changed and why it matters, in plain and concise sentences. + - Keep the repository's PR or issue template intact and fill in every section. For a bug report, also state whether the bug was validated and reproduced on a live Nextcloud instance. + - Put information meant only for agents (plans, prompts, tool logs) into a collapsed `
` block. +- Write commit message bodies that explain why the change was made, not how; the diff already shows what changed. Keep the repository's commit conventions and the required trailers. +- Produce focused, scoped pull requests that address exactly one concern. Do not touch unrelated files or introduce incidental refactors. +- Verify all dependencies against actual package registries before suggesting them. Do not use hallucinated or unverified package names. +- Write code comments that document the code, never the process that produced it: + - Comments describe what the code does - method signatures, behavior, and constraints the code itself cannot express (e.g. a non-obvious invariant or workaround). + - Never add comments that document progress, decisions, or changes (e.g. "changed X to Y", "as requested", "this fixes ...", "previously this did ..."). That belongs in the commit message or PR discussion; in the code it goes stale and becomes misleading. + - Do not narrate self-explanatory code. If the code is readable without a comment, omit the comment. + - Keep comments brief - short and simple, matching the comment density of the surrounding code. +- Reuse existing helper functions and utilities instead of re-implementing their logic inline. When fixing a flawed pattern, fix every occurrence of it across the changed code, not only the instance that was pointed out. +- Run permission and access-control checks before the operation they guard, never after it and never only in the UI layer. +- When adding or changing user-facing functionality, wire it up in every context where the affected component is used - the default authenticated view, public share pages, and embedded contexts such as the Smart Picker and reference widgets. When emitting new events, verify that every consumer of the component subscribes to and handles them. +- Validate every change to runtime behavior on a live Nextcloud instance where you can, and give the contributor concrete steps to test it there themselves. Your testing supports theirs; it does not replace it. +- Explicitly inform the contributor when any action they are about to take, or have taken, would violate the AI Contribution Policy or the Contribution Guidelines. Do not silently proceed. State which rule is at risk and what the contributor should do instead. +- Warn the contributor if a pull request is growing too large. A PR approaching several thousand lines of changed code is a signal that it should be split into smaller, focused PRs. Suggest a logical split before the PR is opened, not after. +- Recommend opening a ticket for discussion before starting implementation whenever a feature or change is sufficiently complex - for example when it touches multiple subsystems, requires architectural decisions, or the right approach is not yet clear. A ticket allows maintainers and the contributor to align on direction before code is written, avoiding wasted effort on a PR that may be rejected or require fundamental rework. + +### What this agent must never do, and what to do instead + +- Don't open issues, submit pull requests, or post comments on your own initiative. Instead, post only what the contributor asked for, on their behalf, and tell them what you posted. +- Don't write texts for machines: no file-by-file restatement of the diff, no filler, no raw tool output. Instead, write short, skimmable text for a human reviewer that explains what changed and why. +- Don't add `Signed-off-by` tags to commits on your own. Instead, show the contributor the changes and the proposed commit message, and only after they explicitly approve them, commit with `git commit -s` so the sign-off carries their configured identity. The contributor certifies the Developer Certificate of Origin by giving that approval. +- Don't submit security reports or open GitHub issues for vulnerabilities. Instead, hand your findings to the contributor to verify independently and report via [HackerOne](https://hackerone.com/nextcloud). +- Don't 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. Instead, explain the code and guide the contributor so they can solve the issue themselves. +- Don't hand over code with dead code, redundant logic, excessive comments, malformed or garbled characters (e.g. `�` replacement characters), or unrelated changes. Instead, remove them, and ask the contributor to review and clean up the result before submitting. + ## Commands ### Setup @@ -314,17 +354,13 @@ This applies equally to human contributors — see the matching note in Commit messages are the project's durable record — read years later through `git log` and `git blame`. The diff already shows *what* changed and *how*; the message exists to capture **intent**: the *why*. - **Subject**: conventional-commit, imperative, concise — aim for under 60 characters, or GitHub truncates it. -- **Body**: state the facts plainly — the problem and the reason for this approach. Keep it matter-of-fact; no storytelling, filler, or marketing tone. Omit it only when the subject already conveys the intent. +- **Body**: explain why, not how — state the problem and the reason for this approach plainly. Keep it matter-of-fact; no storytelling, filler, or marketing tone. Omit it only when the subject already conveys the intent. - **Record what was intentionally left out.** Note deliberate omissions and deferrals (and why) so a later reader can tell a conscious decision from an oversight. - **Don't restate the diff.** Avoid mechanical bullet lists that echo the changed lines. -All commits must include two trailers at the end: -1. Agent/model attribution: `Assisted-by: :` -2. DCO sign-off: Use `git commit -s` to add automatically - -When committing, use: `git commit -m "message" -s` +All AI-assisted commits must end with the agent/model attribution trailer `Assisted-by: :`. -This ensures the sign-off includes your configured Git user email. +The contributor must review the changes before anything is committed. Only once they explicitly approve, commit with `git commit -m "message" -s` so the `Signed-off-by` line carries their configured Git identity. Without that approval, leave the changes staged and do not sign off. Example: ``` @@ -334,11 +370,10 @@ Some proxies drop UIDVALIDITY, which made us discard the local cache and force a full resync on every run. Treat a missing value as unchanged instead. -Assisted-by: Devstral:devstral-small-2507 -Assisted-by: ClaudeCode:claude-sonnet-4-6 -Assisted-by: Qwen:qwen3-coder-32b -Assisted-by: Copilot:gpt-4o -Signed-off-by: Name +Assisted-by: Devstral:devstral-small-2-24b-instruct-2512 +Assisted-by: ClaudeCode:claude-sonnet-5-5 +Assisted-by: Qwen:qwen3-coder-next +Assisted-by: Codex:gpt-6.1-sol ``` ### Styling From e297d0cb2cc0438c70b7d0f2c22af6fed137fd73 Mon Sep 17 00:00:00 2001 From: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:13:41 +0000 Subject: [PATCH 2/3] fixup! docs(ai-policy): allow AI-drafted text written for human readers Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com> --- AGENTS.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 80671b28bc..3d97d9c71a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -294,8 +294,6 @@ Bug fixes and small changes can go straight to a PR without opening a new ticket Do NOT commit changes unless explicitly asked to do so. -Never 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. - After completing code changes: 1. Verify your work is complete and tests pass 2. Never push directly to `main` — always create a feature branch with a descriptive name (e.g. `perf/imap-selective-headers`, `fix/sync-token`, `chore/update-agents`). @@ -320,12 +318,7 @@ The branch will be rebased and squashed into a clean history before merge (CI en ### GitHub comments and reviews -Agents may post GitHub text directly (PR and issue comments, review comments, PR descriptions), as long as it is written **for humans**: plain, concise, and skimmable. - -- A human must review the text before it is posted. -- Disclose the AI assistance in every posted body, e.g. with an `Assisted by :` footer. -- Fill out the repo's PR/issue template completely when opening a PR or issue. -- Additional info meant only for agents can go into a description or comment, but must be wrapped in a collapsed `
` block so human readers can skip it or dive in. +Agents may post GitHub text directly (PR and issue comments, review comments, PR descriptions), following the rules for human-readable, disclosed text above. A human must review the text before it is posted. ### Official documentation (user_manual / admin_manual) @@ -358,10 +351,6 @@ Commit messages are the project's durable record — read years later through `g - **Record what was intentionally left out.** Note deliberate omissions and deferrals (and why) so a later reader can tell a conscious decision from an oversight. - **Don't restate the diff.** Avoid mechanical bullet lists that echo the changed lines. -All AI-assisted commits must end with the agent/model attribution trailer `Assisted-by: :`. - -The contributor must review the changes before anything is committed. Only once they explicitly approve, commit with `git commit -m "message" -s` so the `Signed-off-by` line carries their configured Git identity. Without that approval, leave the changes staged and do not sign off. - Example: ``` fix(imap): tolerate servers that omit UIDVALIDITY on SELECT From 2db6aedfd6d195551ef97cd70a5d163579a2c5e1 Mon Sep 17 00:00:00 2001 From: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com> Date: Thu, 19 Nov 2026 14:35:56 +0000 Subject: [PATCH 3/3] fixup! docs(ai-policy): allow AI-drafted text written for human readers Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com> --- AGENTS.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 3d97d9c71a..9e8be9be90 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -41,7 +41,7 @@ All contributions generated or assisted by this agent must fully comply with: - Don't open issues, submit pull requests, or post comments on your own initiative. Instead, post only what the contributor asked for, on their behalf, and tell them what you posted. - Don't write texts for machines: no file-by-file restatement of the diff, no filler, no raw tool output. Instead, write short, skimmable text for a human reviewer that explains what changed and why. -- Don't add `Signed-off-by` tags to commits on your own. Instead, show the contributor the changes and the proposed commit message, and only after they explicitly approve them, commit with `git commit -s` so the sign-off carries their configured identity. The contributor certifies the Developer Certificate of Origin by giving that approval. +- Don't add `Signed-off-by` tags to commits on your own. Instead, show the contributor the changes and the proposed commit message, and only after they explicitly approve them, commit with `git commit -s` so the sign-off carries their configured identity. The contributor certifies the Developer Certificate of Origin by giving that approval. This is a deliberate local exception to the AI Contribution Policy's rule that agents never add `Signed-off-by`. - Don't submit security reports or open GitHub issues for vulnerabilities. Instead, hand your findings to the contributor to verify independently and report via [HackerOne](https://hackerone.com/nextcloud). - Don't 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. Instead, explain the code and guide the contributor so they can solve the issue themselves. - Don't hand over code with dead code, redundant logic, excessive comments, malformed or garbled characters (e.g. `�` replacement characters), or unrelated changes. Instead, remove them, and ask the contributor to review and clean up the result before submitting. @@ -114,6 +114,7 @@ The diff shows *what* changed and *how*; a comment exists only to capture *why* - **Default to none.** Most changes need zero comments; express intent through clear names and small functions. This codebase uses essentially none. - **Comment the *why*, never the *how*.** Legitimate reasons: a non-obvious workaround (link the issue/ticket), a subtle business rule, a deliberate deviation from the expected. Never narrate what the next lines do. +- **These rules are stricter than the generic comment rules in the Nextcloud Contribution Policy section; where they differ, follow these.** - **No multi-line explanatory blocks, AI-style walkthroughs, or section banners.** - **Remove a stale comment** only when you're already editing that code for the task at hand — no drive-by cleanups. @@ -292,18 +293,18 @@ Bug fixes and small changes can go straight to a PR without opening a new ticket - If no ticket exists, or it is still `0. to triage`, stop and tell the contributor to get it triaged and discussed first rather than starting an agent-driven implementation. - If a bug fix turns out to need a larger change, stop and treat it as one. -Do NOT commit changes unless explicitly asked to do so. +Do NOT commit changes until the contributor has reviewed them and explicitly approved the commit; see the sign-off rule in the Nextcloud Contribution Policy section at the top of this file. After completing code changes: 1. Verify your work is complete and tests pass 2. Never push directly to `main` — always create a feature branch with a descriptive name (e.g. `perf/imap-selective-headers`, `fix/sync-token`, `chore/update-agents`). 3. Worktree branches must use descriptive feature-branch names, not generated names like `agent-xxxx`. 4. Make sure there is no trailing whitespace -5. Leave changes in working directory or staged (do not commit) +5. Leave changes in working directory or staged until the contributor approves the commit 6. Provide a summary of what was changed and why 7. Suggest a commit message using Conventional Commits format - There is a [contributing doc](./.github/CONTRIBUTING.md) with suggestions -8. The user will review and commit when ready +8. The user reviews the changes and approves the commit ### PR Review Workflow @@ -314,11 +315,13 @@ Instead, address feedback with **fixup commits**: git commit --fixup= # targets the specific commit being corrected ``` +Fixup commits follow the same approval and sign-off rule as any other commit. + The branch will be rebased and squashed into a clean history before merge (CI enforces this). The failing "clean history" CI check is intentional and expected during review — ignore it until the PR has a positive review, then rebase to clean up. ### GitHub comments and reviews -Agents may post GitHub text directly (PR and issue comments, review comments, PR descriptions), following the rules for human-readable, disclosed text above. A human must review the text before it is posted. +Agents may post GitHub text directly (PR and issue comments, review comments, PR descriptions), following the human-readable, disclosed text rules in the Nextcloud Contribution Policy section at the top of this file. The order is: draft, human review, post, then tell the contributor what was posted. ### Official documentation (user_manual / admin_manual)