Skip to content
CodeLifter
Search/ Browse prompts
CodeLifter Forum

How do you write a contributing rule about AI-generated code?

Staff answerWritten by CodeLifter editors · AI code policies1 replyupdated

Short answer

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.

Written by CodeLifter editors · Staff, CodeLifter ·
CiteCodeLifter 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.
  1. Staff, 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.

    1. Stance. Banned, allowed with conditions, or allowed on normal terms.
    2. Scope. Code only, or also documentation, issues, bug reports, review comments and images.
    3. Disclosure. Whether contributors must say they used a tool, and in what format.
    4. Responsibility. Who answers for the code, its licence and its correctness.
    5. 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 extractive label Repeat 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 CONTRIBUTING file can sit in the repository root, docs or .github, and that people opening a pull request or an issue see a link to it. If there is more than one, GitHub picks .github first, then the root, then docs.

    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 from CONTRIBUTING.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?

    1. Make it checkable. "Disclose AI use" can be checked if it means a named trailer or a template field. "Use AI responsibly" cannot.
    2. 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.
    3. 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.
    4. Say who is exempt. Ghostty's rules apply to outside contributors; maintainers are exempt. If your project does that, write it down.
    5. 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.md or a linked AI_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.
    2
    ReplyLink

Plain text or simple Markdown. Links are nofollow. Your email is never shown.

  1. 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."

CodeLifter Forum. Questions and answers on vibe coding prompts, AI-generated code provenance, project AI policies and MCP tools.