Skip to content

Commit 6d180cf

Browse files
joyeecheungaduh95
authored andcommitted
doc: refactor the AI guidelines
The earlier version of the document contains duplications and has become logically disconnected after iteration. This patch wordsmiths it a bit to make it more coherent: - Merge policy points that have been repeated in the guidelines into the opening policy. - Remove redundant taglines. - Reword the paragraphs so that they appear more logical: -> decision making and accountability is human-only -> AI assistance is not prohibited -> disclosure and licensing -> verification and review requirement -> other off limits items (automation, good first issues) - Reword the guidelines to contextualize the suggestions with the use of AI instead of being generic. - Change the tone of the document to be more in line with other documents we have (e.g. avoid being too imperative or calling out "you" constantly) Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com> PR-URL: #65269 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
1 parent 9180666 commit 6d180cf

1 file changed

Lines changed: 65 additions & 64 deletions

File tree

doc/contributing/ai-guidelines.md

Lines changed: 65 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
11
# AI use policy and guidelines
22

3-
* [Core principle](#core-principle)
4-
* [When AI is used in contributions](#when-ai-is-used-in-contributions)
5-
* [When AI is used in communications](#when-ai-is-used-in-communications)
3+
* [Node.js AI use policy](#nodejs-ai-use-policy)
4+
* [Practical guidelines](#practical-guidelines)
5+
* [Naming AI tools in disclosures](#naming-ai-tools-in-disclosures)
6+
* [When AI is used in code contributions](#when-ai-is-used-in-code-contributions)
7+
* [When AI is used in communications](#when-ai-is-used-in-communications)
68

79
This document aligns with the [OpenJS Foundation AI Coding Assistants Policy][].
810

9-
## Core principle
11+
## Node.js AI use policy
1012

11-
Tools should never replace human judgment, regardless of whether they are
12-
powered by AI.
13+
In the Node.js project, decision making should always be based on human judgement
14+
instead of machine automation, regardless of whether the automation
15+
is powered by AI. Contributors must take full responsibility for their actions in
16+
the Node.js project.
1317

14-
Node.js requires contributors to understand and take full responsibility for
15-
every change they propose. The answer to "Why is X an improvement?" can
16-
never be "I'm not sure. The AI did it."
18+
The Node.js project does not prohibit the use of AI tools in contributions, but
19+
when the contribution is generated with AI, the contributor should disclose the use
20+
of such tools, and what the contributor does to personally verify the generated output.
21+
The changes submitted to the Node.js code base must still satisfy
22+
the project's [Developer's Certificate of Origin][] and licensing requirements.
1723

18-
If AI tools assisted in generating a contribution, acknowledge that honestly.
19-
Regardless of how much code is generated by AI, disclosure does not serve
20-
as a disclaimer of responsibility.
21-
22-
Be aware that the mention of for-profit trademarks or commercial brands in
23-
commit messages, which are part of the code base, can be abused for
24-
profit-driven marketing. If the disclosure involves for-profit trademarks or
25-
commercial brands, it's recommended to either anonymize the branding (e.g. say
26-
`a frontier reasoning model`, `a closed-source coding agent` instead of
27-
`<brand>`), or only mention the for-profit brand/trademark in the PR
28-
description, but not in the commit message, unless the message would not have
29-
made sense without mentioning the specific brand/trademark. These
30-
recommendations only apply to for-profit tools/models, not any non-profit ones.
31-
32-
Pull requests that contain AI-generated code the contributor has not
24+
Contributors who choose to submit changes generated with AI must be able to explain
25+
the value proposition and the implementation of their contributions during the
26+
review process. Disclosure about the use of AI does not serve as a disclaimer of this
27+
responsibility. Pull requests with AI-generated code that the contributor has not
3328
personally understood, tested, and verified waste collaborator time and
3429
will be subject to closure without additional review. Contributors who
3530
repeatedly submit such changes, show no understanding of the project or
@@ -42,53 +37,59 @@ approved in advance by the project. To request approval, either open an issue in
4237
be done in the form of a GitHub workflow, submit a pull request to add the
4338
workflow and use the usual pull request review process to seek consensus.
4439

45-
## When AI is used in contributions
46-
47-
Contributors may use AI tools to assist with contributions, but such tools
48-
never replace human judgment.
49-
50-
When using AI as a coding assistant:
51-
52-
* **Understand the codebase first.** Do not skip familiarizing yourself with
53-
the relevant subsystem. Always verify analysis generated by tools against
54-
the actual source code with human judgement.
40+
It's prohibited to use AI to automate fixes to issues marked as "good first issue".
41+
These issues are meant to help new human contributors, not an AI, learn about the
42+
code base and the contribution processes.
5543

56-
* **Own every line you submit.** You are responsible for all code in your
57-
pull request, regardless of how it was created. The submitted changes
58-
must satisfy the project's [Developer's Certificate of Origin][] and licensing
59-
requirements. Be prepared to explain any change in detail during review.
44+
## Practical guidelines
6045

61-
* **Keep the commits logical.** The [commit message guidelines][]
62-
and [commit squashing guidelines](./pull-requests.md#commit-squashing)
63-
must be followed regardless of what tool is used in the pull request.
46+
### Naming AI tools in disclosures
6447

65-
* **Test thoroughly.** Existing tests should not be removed or modified
66-
without human verification. It is crucial to verify, with human judgement,
67-
the correctness of new tests against the intended behavior of the feature
68-
being tested, independently of how the implementation happens to behave.
69-
70-
* **Do not disappear.** If you open a PR, follow it through. Respond to
71-
feedback and iterate until the work lands or is explicitly closed. If you
72-
can no longer pursue it, close the PR. Stalled PRs block progress.
73-
74-
* **Do not use AI to claim "good first issue" tasks.** These issues exist to
75-
help new contributors learn the codebase and processes hands-on.
76-
77-
* **Keep the comments useful.** Verify with human judgement that the
78-
comments are necessary and accurate. Remove comments that simply
79-
restate what the code does. Add comments only where the logic is non-obvious.
80-
81-
## When AI is used in communications
48+
Be aware that the mention of for-profit trademarks or commercial brands in
49+
commit messages, which are part of the code base, can be abused for
50+
profit-driven marketing. If the disclosure involves for-profit trademarks or
51+
commercial brands, it's recommended to either anonymize the branding (e.g. say
52+
`a frontier reasoning model`, `a closed-source coding agent` instead of
53+
`<brand>`), or only mention the for-profit brand/trademark in the PR
54+
description, but not in the commit message, unless the message would not have
55+
made sense without mentioning the specific brand/trademark. These
56+
recommendations only apply to for-profit tools/models, not any non-profit ones.
8257

83-
Node.js values concise, precise communication that respects collaborator and
84-
contributor time.
58+
### When AI is used in code contributions
59+
60+
* Contributors should treat the analysis generated by AI tools as a hypothesis
61+
instead of a fact, and verify the output against the actual source code before
62+
making any decisions.
63+
* Commits must still follow the [commit message guidelines][] and
64+
[commit squashing guidelines](./pull-requests.md#commit-squashing),
65+
even if they are organized with the help of AI tools.
66+
* Existing tests should not be removed or modified without human verification.
67+
When new tests are added with the help of AI, contributors should personally
68+
verify that the new tests are necessary and test the intended behavior
69+
instead of merely reflecting how the implementation happens to behave.
70+
* If the comments are generated by AI, contributors should personally verify
71+
that the comments are accurate. The comments should not restate what the code
72+
does but instead should provide additional context that's not obvious from the code
73+
itself, such as the history or motivation behind the choices.
74+
* During the review process, responses to feedback should be made by contributors
75+
based on their own judgement and must not be automated by AI tools. Contributors
76+
are expected to iterate in this manner until the work lands or is explicitly closed.
77+
If they are unable to follow the review process personally, they should close
78+
the PR so that someone else can take over the work.
79+
80+
### When AI is used in communications
81+
82+
In the Node.js project, if a contributor chooses to use AI for assistance in communications, they
83+
should respect the time spent by other contributors reading and responding to their
84+
communication, and avoid increasing the cognitive load of others with their own use of AI.
8585

8686
* **Do not paste messages generated entirely by AI** in pull requests, issues,
8787
or the project's communication channels. Such communication may be removed in
88-
accordance to [the Node.js moderation policy][].
89-
* **Verify claims about the code with human judgement before using them in
90-
communications**. Results from AI tools should only be treated as hypothesis.
91-
Link to actual code, documentation and specifications as source of truth.
88+
accordance with [the Node.js moderation policy][].
89+
* When making a claim based on AI output in discussions, contributors should
90+
personally verify the claim. Contributors are expected to provide a link
91+
to actual code, documentation or specifications, instead of an AI summary of
92+
them, as source of truth during discussions.
9293
* Grammar and spell-check tools are acceptable when they improve clarity and
9394
conciseness.
9495

0 commit comments

Comments
 (0)