Sub topic 9
Disclosing AI assistance
This chapter assumes you know the pull request workflow, have done code review in a team, and have used an AI coding assistant. It covers why a team asks authors to disclose AI assistance, what a useful disclosure contains, and how to collect it without creating friction.
Why disclose
Disclosure does not shift responsibility. The author still owns the change, as the previous chapter on accountability set out. Disclosure gives reviewers and the team three practical things:
- Review focus. A reviewer who knows a large block was generated can check for plausible but wrong logic, invented APIs, and missing edge cases.
- Policy compliance. The team can confirm that only approved tools were used and that restricted data stayed out of prompts.
- Traceability. If a defect or license question appears later, the team can find which changes involved a tool.
What to disclose
Keep the rule simple enough that people follow it. A workable policy asks for three facts:
- Whether an AI tool was used.
- Which tool, and for what scope (for example "test scaffolding" or "the parser rewrite").
- A confirmation that no secrets, customer data, or restricted code were shared with it.
Decide up front what counts as use. Many teams exempt trivial assistance such as autocomplete of a few tokens or spelling fixes. Write that threshold into the policy, or authors will guess differently.
Collect it in the pull request template
The easiest place to record disclosure is the pull request template. It appears on every pull request, so no one has to remember a separate step.
<!-- .github/pull_request_template.md -->
## What changed and why
## How I verified it
- [ ] I read and understand every line in this PR
- [ ] I ran the tests locally
- [ ] New or changed behavior has tests
## AI assistance (per team policy)
- [ ] No AI tool was used
- [ ] AI tool used for part of this change (tool and scope: ____ )
- [ ] No secrets, customer data, or restricted code were shared with the toolThe verification checkboxes sit next to the disclosure section on purpose. They remind the author that the same standard applies whether or not a tool was involved.
Common errors
- Treating disclosure as a penalty. If authors fear a disclosed change will be judged more harshly, they will stop disclosing. Say in the policy that disclosure is neutral and that every change meets the same bar.
- Vague entries. "Used AI" tells the reviewer nothing. Ask for the tool and the scope.
- Unchecked boxes with no follow-up. A checkbox only records a claim. It does not prove the claim.
- Disclosing in a place no one reads. Chat messages and commit trailers are easy to lose. Keep the record in the pull request.
What disclosure cannot do
A checkbox cannot detect undisclosed use, and you should not try to build a detector. Generated code is hard to identify reliably, and false accusations damage trust. Rely on the controls that work regardless of authorship: required review and required tests.
Optional: commit trailers
Some teams also add a trailer to commit messages, which survives after the pull request is merged and the template text is hard to search.
Fix retry logic in payment client
Assisted-by: ExampleAssistant (drafted unit tests)Use this only if you will actually query it. Otherwise it adds work without benefit.
Exercise
A teammate says, "If I disclose AI use, my reviewer will assume the code is worse." Name two things in the policy that address this concern.
Show answer
First, state explicitly that disclosure is neutral and every change meets the same review and testing standard. Second, make the disclosure section a normal part of the pull request template that everyone completes, so it is routine and not a mark against one author. Required checks and code owner review also apply equally to all changes.
Exercise
Why is a pull request template checkbox not enough to enforce the rule that restricted code must not be shared with AI tools?
Show answer
A checkbox only records the author's claim. It cannot detect what was actually shared. Enforcement needs other controls, such as approved tool configuration, data-sharing rules, and secret scanning in CI.