How do you write a contributing rule about AI-generated code?
A contributing rule about AI-generated code is a short section in CONTRIBUTING.md, or a linked AI_POLICY.md, that answers five questions: is AI help allowed, what it covers, how to disclose it, who is responsible for the result, and what maintainers do when a contribution breaks the rule. Copy the structure from projects that already publish one.
Cite
CodeLifter Forum, "How do you write a contributing rule about AI-generated code?", https://codelifter.com/forum/posts/how-do-you-write-a-contributing-rule-about-ai-generated-code/, accessed 2026-11-27.- CodeLifter editorsStaffStaff, CodeLifter ·
What does the rule need to decide?
Write the decisions down before you write any prose. The published policies quoted below answer the same handful of questions, even when their answers differ.
- Stance. Banned, allowed with conditions, or allowed on normal terms.
- Scope. Code only, or also documentation, issues, bug reports, review comments and images.
- Disclosure. Whether contributors must say they used a tool, and in what format.
- Responsibility. Who answers for the code, its licence and its correctness.
- Enforcement. What a maintainer does with a contribution that ignores the rule.
A sixth question matters for automated tools: whether an agent may open pull requests or post comments without a human approving each one.
How do existing projects word it?
Three published policies show the range. All three pages were read on 16 October 2026.
Question LLVM Ghostty curl Stance Any tool, with a human in the loop Allowed for text and code, with strict rules Accepted if the code meets the normal requirements Scope Code, RFCs, issues, security reports, review comments Code, issues, discussions; no AI media Pull requests, security reports, translation Disclosure Label "substantial amounts of tool-generated content", for example an Assisted-by:trailer"All AI usage in any form must be disclosed", naming the tool and the extent Must reveal it when an AI tool found the problem you report Responsibility "The contributor is always the author and is fully accountable" The human "must fully understand all code" "The burden is on them to ensure no unlicensed code is submitted" Agents Bans agents that act "without human approval" Not addressed Not addressed Enforcement A canned reply and an extractivelabelRepeat offenders go on a public denouncement list Users who submit made-up reports are banned LLVM also forbids using AI tools to fix issues labelled
good first issue, because those exist so new contributors can learn the codebase. curl adds a line worth borrowing: "if someone can spot that the contribution was made with the help of AI, you have more work to do."If you are leaning towards a ban, the thread on which projects ban AI-generated contributions quotes the wording Gentoo, QEMU, Servo and others use, and the reasons they give.
Where should the rule live?
GitHub's documentation on contributor guidelines says a
CONTRIBUTINGfile can sit in the repository root,docsor.github, and that people opening a pull request or an issue see a link to it. If there is more than one, GitHub picks.githubfirst, then the root, thendocs.Two layouts work:
- A section in
CONTRIBUTING.md. Best when the rule is a paragraph or two. Contributors already get pointed at this file. - A separate
AI_POLICY.md, linked fromCONTRIBUTING.md. Ghostty does this. It suits a longer rule, or one you want other projects to find and copy. LLVM keeps its rule on its own documentation page.
Either way, put one sentence about AI in the pull request template too, so the question is asked at the moment someone submits.
A template you can adapt
This is a starting point for a project that allows AI help with disclosure. Change each line to match your decisions; do not keep a line you will not enforce.
## Use of AI tools You may use AI coding tools to help with a contribution. If you do: 1. Say so. Add `Assisted-by: <tool name>` as a commit trailer, and say in the pull request description what the tool did. 2. Read and test every line before you ask for review. You must be able to explain the change without the tool. 3. You are responsible for the licence of what you submit. Do not submit code you have reason to think was copied from another project. 4. Write the pull request description and any issue yourself. Translation tools are fine. 5. Do not let an agent open pull requests or post comments in this repository without you approving each one. Maintainers may close a contribution that does not follow these rules, with a link to this section.Line 1 follows the trailer LLVM and the Linux kernel use; the Assisted-by trailer thread shows how to check for it in CI. Line 3 restates the rule most projects already have for all code. The CodeLifter guide to disclosing AI in commits compares the trailer formats in use.
What makes a rule work in practice?
- Make it checkable. "Disclose AI use" can be checked if it means a named trailer or a template field. "Use AI responsibly" cannot.
- Say what happens next. LLVM gives maintainers a ready-made reply to paste. That keeps enforcement consistent and stops each reviewer inventing their own tone.
- Separate issues from code. A fabricated bug report costs maintainers time before anyone looks at code, which is why curl writes a separate rule for reports.
- Say who is exempt. Ghostty's rules apply to outside contributors; maintainers are exempt. If your project does that, write it down.
- Date it. Put the date of the last change at the top. Contributors, and trackers such as the CodeLifter AI-code policy tracker, need to know which version they read.
A rule cannot tell you whether a contribution was written with AI; it can only make the contributor state it and stand behind it. For the separate question of checking whether generated code matches existing open source code, see how do you check whether AI-generated code copied open source code.
Short version
- Decide stance, scope, disclosure, responsibility and enforcement before you write.
- Put the rule in
CONTRIBUTING.mdor a linkedAI_POLICY.md, and ask about it in the pull request template. - Use a named, checkable disclosure, such as an
Assisted-by:trailer. - Keep the human contributor responsible for the code and its licence.
- Say what maintainers will do with contributions that break the rule.
Write something first.
Give people something to work with: at least 30 words on what happened and what you tried.
That is too long. Keep it under 6,000 characters.
Write the question as the title, 15 to 140 characters, no links.
Pick a category.
Add a name (2 to 40 characters, no links).
That email address does not look right.
That was quick. Read the thread, then try again.
The form expired. Reload the page and post again.
Something went wrong with the form. Reload and try again.
Please complete the check and post again.
Limit reached for now. Try again later.
This thread is closed to new replies.
This thread no longer accepts replies.
Something went wrong with the form. Reload and try again.
Post a reply or question first (name and email), then this browser can vote, edit and accept answers.
You cannot vote on your own post.
Only the author (within 30 days) or the forum team can do that.
That email already has an account. Use your sign-in link instead.
New accounts are paused for the moment. Try again later.
That was already posted.
1 answer
- CodeLifter editorsStaffStaff, CodeLifter ·
Should an AI rule also cover issues and bug reports? Yes, and it is often the more urgent part. A pull request at least comes with code a reviewer can run; a generated bug report has to be investigated before anyone knows whether it is real. curl's contribution guide says that if you asked an AI tool to find problems in curl, you "must make sure to reveal this fact" in the report, and must double-check the findings first, because "AI-based tools frequently generate inaccurate or fabricated results." It also advises against pasting an AI-written report at all: if a tool found something real, "write the report yourself and explain the problem as you have learned it." curl states that it bans users "immediately" for made-up reports.
LLVM's AI tool policy lists "Issues or security vulnerabilities" and "Comments and feedback on pull requests" among the contributions it covers. Ghostty's AI policy allows AI help in issues and discussions only if the content was "reviewed and edited by a human before submission." A practical wording for your own file: "Reports found with an AI tool must say so, must be reproduced by you, and must be written in your own words."