Skip to content

Commit 6e99faa

Browse files
authored
Add content on attribution for code generated by AI agents or assistants (#1093)
* Add Copilot Agent section * Create AI-Assisted Authorship section * Add git log example * Update Copilot narrative * Move attribution to Copilot section * Add remark about trailers for attribution * Editorial pass * Add stronger statement about policy considerations
1 parent ef3ee97 commit 6e99faa

File tree

2 files changed

+72
-32
lines changed

2 files changed

+72
-32
lines changed

docs/developer-experience/copilots.md

Lines changed: 69 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,105 @@
11
# Copilots
22

3-
There are a number of AI tools that can improve the developer experience. This article will discuss tooling that is available as well as advice on when it might be appropriate to use such tooling.
3+
There are a number of AI tools that can improve the developer experience. This article will discuss tooling that is available as well as advice on when it might be appropriate to use such tooling and how to attribute AI-generated code.
44

5-
## GitHub Copilot
5+
## AI-Assisted Coding Tools
66

7-
The current version of GitHub Copilot can provide code completion in many popular IDEs. For instance, the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) that can be installed from the VS Code Marketplace. It requires a GitHub account to use. For more information about what IDEs are supported, what languages are supported, cost, features, etc., please checkout out the information on [Copilot](https://github.com/features/copilot) and [Copilot for Business](https://resources.github.com/copilot-for-business/).
7+
### GitHub Copilot Extension
88

9-
Some example use-cases for GitHub Copilot include:
9+
GitHub Copilot is an extension that adds AI-assisted coding capabilities to an IDE. For instance, the [GitHub Copilot for VS Code extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) can be installed from the VS Code Marketplace. It requires a GitHub account to use, and usage is limited without a subscription. For more information about what IDEs are supported, what languages are supported, cost, features, etc., please check out the information on [Copilot](https://github.com/features/copilot) and [Copilot for Business](https://resources.github.com/copilot-for-business/).
10+
11+
As of late 2025, some example use cases for GitHub Copilot include:
12+
13+
- **Code Completion**. Copilot can provide code completion suggestions as you type. If you want Copilot to write something useful for you, try writing a comment that describes what your code is going to do - it can often take it from there.
1014

1115
- **Write Documentation**. For example, the above paragraph was written using Copilot.
1216

1317
- **Write Unit Tests**. Given that setup and assertions are often consistent across unit tests, Copilot tends to be very accurate.
1418

15-
- **Unblock**. It is often hard start writing when staring at a blank page, Copilot can fill the space with something that may or may not be what you ultimately want to do, but it can help get you in the right head space.
19+
- **Unblock**. It is often hard to start writing when staring at a blank page. Copilot can fill the space with something that may or may not be what you ultimately want to do, but it can help get you in the right headspace.
1620

17-
If you want Copilot to write something useful for you, try writing a comment that describes what your code is going to do - it can often take it from there.
21+
- **Explain**. Copilot can explain what the code is doing in natural language.
1822

19-
## GitHub Copilot Labs
23+
- **Generate Tests**. Copilot can generate unit tests for your code.
2024

21-
Copilot has a [GitHub Copilot labs extension](https://githubnext.com/projects/copilot-labs/) that offers additional features that are not yet ready for prime-time. For VS Code, you can install it from the VS Code Marketplace. These features include:
25+
You can also chat with Copilot to ask it to edit your code, including across multiple files. Beyond just writing code, consider using chat to:
2226

23-
- **Explain**. Copilot can explain what the code is doing in natural language.
27+
- **Build SQL Indexes**. Given a query, Copilot can generate a SQL index that will improve the performance of the query.
2428

25-
- **Translate**. Copilot can translate code from one language to another.
29+
- **Write Regular Expressions**. These are notoriously difficult to write, but Copilot can generate them for you if you give some sample input and describe what you want to extract.
2630

27-
- **Brushes**. You can select code that Copilot then modifies inline based on a "brush" you select, for example, to make the code more readable, fix bugs, improve debugging, document, etc.
31+
- **Improve and Validate**. If you are unsure of the implications of writing code a particular way, you can ask questions about it. For instance, you might ask if there is a way to write the code that is more performant or uses less memory. Once it gives you an opinion, you can ask it to provide documentation validating that assertion.
2832

29-
- **Generate Tests**. Copilot can generate unit tests for your code. Though currently this is limited to JavaScript and TypeScript.
33+
- **Write Code**. Given prompting by the developer it can write code that you can one-click deploy into existing or new files.
3034

31-
## GitHub Copilot X
35+
- **Debug**. Copilot can analyze your code and propose solutions to fix bugs.
3236

33-
The next version of Copilot offers a number of new use-cases beyond code completion. These include:
37+
You can also use configuration files and extensions to customize and extend Copilot's capabilities. For example:
3438

35-
- **Chat**. Rather than just providing code completion, Copilot will be able to have a conversation with you about what you want to do. It has context about the code you are working on and can provide suggestions based on that context. Beyond just writing code, consider using chat to:
39+
- **Custom instruction files.** You can create [custom instructions files](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions#about-repository-custom-instructions-for-copilot) that provide Copilot with additional context about your project, such as coding conventions, preferred libraries, or specific patterns you want it to follow.
3640

37-
- **Build SQL Indexes**. Given a query, Copilot can generate a SQL index that will improve the performance of the query.
41+
- **Prompt files.** You can create [prompt files](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions#enabling-and-using-prompt-files) to store reusable prompts or templates that can be easily accessed from the Copilot chat interface.
3842

39-
- **Write Regular Expressions**. These are notoriously difficult to write, but Copilot can generate them for you if you give some sample input and describe what you want to extract.
43+
- **MCP Servers.** You can use [MCP servers](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) to expand the capabilities of Copilot by providing it access to external tools or services, such as connecting to a project management system (such as Jira or Azure DevOps) or custom APIs (such as the Azure resource manager API).
4044

41-
- **Improve and Validate**. If you are unsure of the implications of writing code a particular way, you can ask questions about it. For instance, you might ask if there is a way to write the code that is more performant or uses less memory. Once it gives you an opinion, you can ask it to provide documentation validating that assertion.
45+
### GitHub Copilot Coding Agent
4246

43-
- **Explain**. Copilot can explain what the code is doing in natural language.
47+
The [GitHub Copilot Coding Agent](https://docs.github.com/en/copilot/how-tos/agents/copilot-coding-agent) is an AI software development agent that can be assigned to work on issues within the GitHub work management system such as fixing bugs or implementing new features. Once an issue has been assigned to the Copilot Agent, the bot analyzes the work item, creates a branch, starts a virtual environment to execute and test the code iteratively, authors commits, and opens a pull request for review.
4448

45-
- **Write Code**. Given prompting by the developer it can write code that you can one-click deploy into existing or new files.
49+
### ChatGPT / Copilot Chat
4650

47-
- **Debug**. Copilot can analyze your code and propose solutions to fix bugs.
51+
For coding, generic AI chat tools such as ChatGPT and Copilot chat are less useful, but they still have their place. GitHub Copilot will only answer "questions about coding" and its interpretation of that rule can be a little restrictive. Some cases for using ChatGPT, Copilot chat, or M365 Researcher include:
4852

49-
It can do most of what Labs can do with "brushes" as "topics", but whereas Labs changes the code in your file, the chat functionality just shows what it would change in the window. However, there is also an "inline mode" for GitHub Copilot Chat that allows you to make changes to your code inline which does not have this same limitation.
53+
- **Write Documentation**. Copilot can write documentation, but using ChatGPT or Copilot chat, you can expand your documentation to include business information, use-cases, additional context, etc.
5054

51-
## ChatGPT / Bing Chat
55+
- **Change Perspective**. ChatGPT can impersonate a persona or even a system and answer questions from that perspective. For example, you can ask it to explain what a particular piece of code does from the perspective of a user. You might have ChatGPT imagine it is a database administrator and ask it to explain how to improve a particular query.
5256

53-
For coding, generic AI chat tools such as ChatGPT and Bing Chat are less useful, but they still have their place. GitHub Copilot will only answer "questions about coding" and it's interpretation of that rule can be a little restrictive. Some cases for using ChatGPT or Bing Chat include:
57+
### Prompt Engineering
5458

55-
- **Write Documentation**. Copilot can write documentation, but using ChatGPT or Bing Chat, you can expand your documentation to include business information, use-cases, additional context, etc.
59+
Chat AI tools are only as good as the prompts you give them. The quality and appropriateness of the output can vary greatly depending on the prompt. In addition, many of these tools restrict the number of prompts you can send in a given amount of time. To learn more about prompt engineering, you might review some [background open source prompt engineering documentation](https://github.com/brexhq/prompt-engineering) and how it applies to [crafting prompts for Copilot chat](https://code.visualstudio.com/docs/copilot/chat/prompt-crafting).
5660

57-
- **Change Perspective**. ChatGPT can impersonate a persona or even a system and answer questions from that perspective. For example, you can ask it to explain what a particular piece of code does from the perspective of a user. You might have ChatGPT imagine it is a database administrator and ask it to explain how to improve a particular query.
61+
### Considerations
62+
63+
If you make use of AI tools, it is important to understand how the data (including private or commercial code) might be used by the system. You can read more about how GitHub copilot handles your data and code at the [GitHub Copilot Privacy FAQ](https://github.com/features/copilot/#faq) and how to [manage Copilot policies](https://docs.github.com/en/copilot/how-tos/manage-your-account/manage-policies). Many organizations have policies that restrict the use of AI tools when working with proprietary code or data, so it is important to check for applicable policies before using these tools.
64+
65+
## Attributing AI-Assisted Code Authorship
66+
67+
When using AI tools to generate code, it can be beneficial to maintain transparency about authorship for accountability, code review, and auditing purposes. This can be done easily by using [Git trailers](https://git-scm.com/docs/git-interpret-trailers) that append structured metadata to the end of commit messages.
68+
69+
### Agentic Code Authorship
70+
71+
When using agentic AI tools to generate code, such as the GitHub Coding Agent feature where a GitHub issue (such as a story or task) can be assigned to a software engineering bot that creates a branch, writes commits, and opens a pull request, authorship is typically attributed using tool-specific mechanisms that follow conventions similar to pair programming. For example, the GitHub Coding Agent creates its commits using the agent as an author with the supervising person acknowledged using the `Co-authored-by` trailer in the commit message. This allows AI-generated code to be attributed to the agent while still giving credit (and accountability) to the person who supervised or initiated the task.
72+
73+
### IDE Assistant Attribution
74+
75+
When using an AI coding assistant inside an IDE, such as the GitHub Copilot extension in Visual Studio Code, consider adopting a team convention to provide attribution in cases when the commit consists of primarily AI-generated code. This might occur when:
76+
77+
* More than 50% of the lines in the commit were generated by AI
78+
* The AI provided the core logic or algorithmic approach
79+
* Substantial code blocks were accepted from AI suggestions
80+
81+
This can be done by appending one or more custom trailers in the commit message, such as:
5882

59-
When using Bing Chat, experiment with modes, sometimes changing to Creative Mode can give the results you need.
83+
```text
84+
Assistant-model: GPT-4o
85+
```
6086

61-
## Prompt Engineering
87+
Because most Git tooling expects `Co-authored-by` trailers to be formatted as email addresses, you should use a different trailer key to avoid confusion and to distinguish authorship from assistance.
6288

63-
Chat AI tools are only as good as the prompts you give them. The quality and appropriateness of the output can vary greatly depending on the prompt. In addition, many of these tools restrict the number of prompts you can send in a given amount of time. To learn more about prompt engineering, you might review some open source documentation [here](https://github.com/brexhq/prompt-engineering).
89+
Trailers can be added manually at the end of a commit message, or by using the `git commit` command with the `--trailer` option:
6490

65-
## Considerations
91+
```sh
92+
git commit --message "Implement feature" --trailer "Assistant-model: GPT-4o"
93+
```
6694

67-
It is important when using AI tools to understand how the data (including private or commercial code) might be used by the system. Read more about how GitHub Copilot handles your data and code [here](https://resources.github.com/copilot-for-business/).
95+
Trailers can be displayed using the [pretty formats](https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt-trailersoptions) option to `git log` command. For example, for a formatted history showing the hash, author name, and assistant models used for each commit:
96+
```sh
97+
git log --color --pretty=format:"%C(yellow)%h%C(reset) %C(blue)%an%C(reset) [%C(magenta)%(trailers:key=Assistant-model,valueonly=true,separator=%x2C)%C(reset)] %s%C(bold cyan)%d%C(reset)"
98+
```
99+
```text
100+
2100e6c Author [GPT-4.1,Claude Sonnet 4] Test commit 4 (HEAD -> work-item-8)
101+
7120221 Author [GPT-4.1] Test commit 3
102+
ea03d91 Author [] Test commit 2
103+
f93fd8e Author [GPT-4o] Test commit 1
104+
dde0159 Copilot [] Test work item (#7) (origin/main, origin/HEAD)
105+
```

docs/source-control/git-guidance/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,12 @@ The essential parts of a commit message are:
254254
255255
* subject line: a short description of the commit, maximum 50 characters long
256256
* body (optional): a longer description of the commit, wrapped at 72 characters, separated from the subject line by a blank line
257+
* trailers (optional): additional metadata about the commit in the form of key-value pairs on separate lines such as `Co-authored-by: <name> <email>` that can be used to indicate co-authors, reviewers, or other relevant information
257258
258259
You are free to structure commit messages; however, git commands like `git log` utilize above structure.
259260
Therefore, it can be helpful to follow a convention within your team and to utilize git best.
260261
261-
For example, [Conventional Commits](https://www.conventionalcommits.org/) is a lightweight convention that complements [SemVer](https://semver.org/), by describing the features, fixes, and breaking changes made in commit messages. See [Component Versioning](../component-versioning.md) for more information on versioning.
262+
For example, [Conventional Commits](https://www.conventionalcommits.org/) is a lightweight convention that complements [SemVer](https://semver.org/), by describing the features, fixes, and breaking changes made in commit messages. See [Component Versioning](../component-versioning.md) for more information on versioning. You might also use Git trailers to add structured metadata to your commits, such as [attributing code generated with AI assistance](../../developer-experience/copilots.md#ide-assistant-attribution).
262263
263264
For more information on commit message conventions, see:
264265
@@ -269,6 +270,7 @@ For more information on commit message conventions, see:
269270
* [How to Write Better Git Commit Messages](https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages)
270271
* [Information in commit messages](https://wiki.openstack.org/wiki/GitCommitMessages#Information_in_commit_messages)
271272
* [On commit messages](http://who-t.blogspot.com/2009/12/on-commit-messages.html)
273+
* [Git trailers](https://git-scm.com/docs/git-interpret-trailers)
272274
273275
## Managing Remotes
274276

0 commit comments

Comments
 (0)