Skip to content

Commit ac56057

Browse files
chandlercjonmeow
andauthored
Guidance on AI coding tools (#5670)
Establish some guidance on using AI coding tools when contributing to the Carbon Language project. These tools have growing popularity and interest, and it would be good to have a clear and actively documented set of guidance for folks interested or already using them. --------- Co-authored-by: Jon Ross-Perkins <[email protected]>
1 parent ad8d01d commit ac56057

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

CONTRIBUTING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2525
- [Collaboration systems](#collaboration-systems)
2626
- [Getting access](#getting-access)
2727
- [Contribution tools](#contribution-tools)
28+
- [Using AI-based contribution tools](#using-ai-based-contribution-tools)
2829
- [Contribution guidelines and standards](#contribution-guidelines-and-standards)
2930
- [Guidelines and philosophy for contributions](#guidelines-and-philosophy-for-contributions)
3031
- [How to say things](#how-to-say-things)
@@ -228,6 +229,25 @@ as well as helpful tooling that will ease the contribution process. For example,
228229
[pre-commit](https://pre-commit.com) is used to simplify
229230
[code review](/docs/project/code_review.md).
230231

232+
#### Using AI-based contribution tools
233+
234+
All submissions to Carbon need to follow our
235+
[Contributor License Agreement (CLA)](#contributor-license-agreements-clas), in
236+
which contributors agree that their contribution is an original work of
237+
authorship. This doesn’t prohibit the use of coding assistance tools, but what’s
238+
submitted does need to be a contributor’s original creation.
239+
240+
All contributions, regardless of what tools are used, are also still subject to
241+
normal code review and our
242+
[guidelines and standards](#contribution-guidelines-and-standards) below.
243+
244+
Additionally, we want contributions to Carbon to also be viable as contributions
245+
to LLVM so that we can move things between these projects where relevant. We
246+
selected our license in part for this reason, and the same should be true for
247+
the use of AI-based coding tools. Any contributions to Carbon should also abide
248+
by the guidance in the
249+
[LLVM Developer Policy around AI generated code](https://llvm.org/docs/DeveloperPolicy.html#ai-generated-contributions).
250+
231251
### Contribution guidelines and standards
232252

233253
All documents and pull requests must be consistent with the guidelines and

proposals/p5670.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Guidance on AI coding tools
2+
3+
<!--
4+
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
5+
Exceptions. See /LICENSE for license information.
6+
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
-->
8+
9+
[Pull request](https://github.com/carbon-language/carbon-lang/pull/5670)
10+
11+
<!-- toc -->
12+
13+
## Table of contents
14+
15+
- [Abstract](#abstract)
16+
- [Problem](#problem)
17+
- [Background](#background)
18+
- [Proposal](#proposal)
19+
- [Rationale](#rationale)
20+
- [Alternatives considered](#alternatives-considered)
21+
- [Place more restrictions around AI-based tool usage when contributing](#place-more-restrictions-around-ai-based-tool-usage-when-contributing)
22+
23+
<!-- tocstop -->
24+
25+
## Abstract
26+
27+
Establish some guidance on using AI coding tools when contributing to the Carbon
28+
Language project. These tools have growing popularity and interest, and it would
29+
be good to have a clear and actively documented set of guidance for folks
30+
interested or already using them.
31+
32+
## Problem
33+
34+
AI-based coding tools are wildly popular at this point and we should have active
35+
guidance about how and when to use them when contributing to Carbon rather than
36+
being reactive.
37+
38+
## Background
39+
40+
- [LLVM Developer Policy guidance on AI generated code](https://llvm.org/docs/DeveloperPolicy.html#ai-generated-contributions)
41+
42+
## Proposal
43+
44+
All submissions to Carbon need to follow our Contributor License Agreement
45+
(CLA), in which contributors agree that their contribution is an original work
46+
of authorship. This doesn’t prohibit the use of coding assistance tools, but
47+
what’s submitted does need to be a contributor’s original creation.
48+
49+
Carbon's license was also selected specifically to maintain full compatibility
50+
between any contributions to Carbon and contributions to LLVM so that we can
51+
potentially move things between these projects easily. We want the same to be
52+
true regarding the use of AI-based coding tools, and so any contributions to
53+
Carbon should also abide by the guidance in the
54+
[LLVM Developer Policy around AI generated code](https://llvm.org/docs/DeveloperPolicy.html#ai-generated-contributions)
55+
56+
This proposal updates our contributing documentation to contain both these
57+
points.
58+
59+
## Rationale
60+
61+
- [Community and culture](/docs/project/goals.md#community-and-culture)
62+
- Explicitly documenting what is and isn't required when contributing to
63+
Carbon makes the project more open and welcoming to new contributors.
64+
65+
## Alternatives considered
66+
67+
### Place more restrictions around AI-based tool usage when contributing
68+
69+
We could consider adopting more restrictions on how AI-based tools can be used
70+
as part of contributing to Carbon. However, at this point we don't have a
71+
compelling rationale for this.
72+
73+
There are real concerns around the quality of code output from AI-based tools in
74+
some cases. However, we should not rely on avoiding the tools to provide
75+
protection from low-quality code. Instead, as we already do, we have a system of
76+
code review, coding standards, and extensive testing to ensure high-quality
77+
contributions regardless of the tools used. **The quality, correctness, and
78+
utility expectations of contributions are true regardless of which tools are
79+
used as part of authoring the contribution.**
80+
81+
We have also seen abuse where large volumes of automatically generated
82+
"contributions" have been sent to projects, overwhelming their community. Again,
83+
this is never OK, regardless of which tools are used to achieve it. We hold the
84+
contributors responsible for using any and all tools responsibly and making
85+
useful and constructive contributions with them.
86+
87+
Last but not least, we also understand that there may contributors who do not
88+
wish to use these tools. Currently, we are not proposing any tools in the
89+
required workflow of the project.

0 commit comments

Comments
 (0)