Sub topic 3
Can AI-generated code be copyrighted?
This chapter assumes you know the basics from earlier chapters: copyright protects original expression fixed by a human author, and software source code qualifies as a literary work. It also assumes you use an AI coding assistant and review code in Git. This is general education, not legal advice. The law differs by country and is still changing.
The working model
Copyright asks who made the creative choices. Two cases sit at the ends of a range:
- AI-generated: the tool produces the code from a short prompt, and the human makes no meaningful creative choices in the result. Little or no copyright is likely to exist in that output.
- AI-assisted: the human designs the structure, selects and edits suggestions, and writes substantial parts. The human's contribution can be protected.
Most real work falls between the two ends. The question is how much of the protected expression traces to a person rather than to the tool.
What counts as a human contribution
Guidance from the US Copyright Office points in this direction. Writing a prompt, even a detailed one, is generally treated as giving instructions to the tool and not as authorship of the output. Human contributions that can count include:
- Original code you write yourself, including code you write around or in place of generated code.
- Substantial modification. Rewriting generated code so that your choices shape the result.
- Selection and arrangement. Choosing and combining many elements into an original whole. Protection then covers the arrangement, not each raw piece.
A single accepted autocomplete of one line is unlikely to be protectable. A module whose design, interfaces and logic you decided, with the tool filling in routine parts, is on much firmer ground.
Why this matters for licensing
A license is permission granted by the copyright holder. If no one holds copyright in a piece of code, there is nothing to license in it. Consequences:
- You can usually still use and ship the code.
- You may have little ability to stop others from copying that unprotected part.
- A license header covers only what you actually own. Claiming more than that is inaccurate.
Separately, protection for your own contribution does not remove other people's rights. If the output reproduces existing code, that code keeps its original owner and license. A later chapter covers this.
A practical habit
Record what you did, not only what the tool did. This commit message states the human work next to the AI assistance:
Rewrite pagination helper
Drafted with an AI assistant, then restructured by hand.
I chose the cursor design and wrote the error handling myself.
AI-Assisted: yes
Reviewed-by: Jane Developer <[email protected]>The trailers are a team convention, not a standard. A record like this helps if you later need to show where human authorship lies.
Common errors
| Mistake | Why it is a problem |
|---|---|
| Treating a long prompt as authorship of the output | Current US guidance treats prompts as instructions, not control over the result |
| Assuming all AI-touched code is public domain | Human-authored and sufficiently modified parts can be protected |
| Applying a license header to untouched tool output without thought | The header may claim rights that do not exist |
| Ignoring jurisdiction | The US, UK and EU treat authorship differently, as the next chapter shows |
Exercise
A developer asks an assistant for a 200-line parser from a one-sentence prompt and commits it unchanged. Another developer designs a parser's grammar and API, uses the assistant for boilerplate, and rewrites the core logic. Which developer is more likely to hold copyright in the committed code, and why?
Show answer
The second developer. Their creative choices (design, selection, rewriting) are human authorship that copyright can protect. The first developer's code is raw tool output from a short prompt, where little or no human authorship exists. Neither case removes any rights of third parties if the output copies existing code.