{"slug": "your-ai-generated-code-has-no-license", "title": "Your AI-Generated Code Has No License", "summary": "A developer argues that AI-generated code pasted into production arrives without a license, copyright header, or author, leaving projects to decide by default what happens to unlicensed code. The piece recommends recording AI assistance mechanically via a git commit trailer such as \"Assisted-by: claude-code,\" enforced by a pre-commit hook, and warns that adding license clauses about AI-generated code rarely establishes copyright since most jurisdictions require human authorship. It also notes that major assistants differ in indemnification and duplication-filter guarantees, and that vendor terms change.", "body_md": "Your team pastes AI-generated code into production every day. That code arrives with no license, no copyright header, and no author. The argument that all AI-generated code should be open source is interesting, but it describes a world that does not exist yet. Until it does, your project decides what happens to unlicensed code by default.\n\nBy the end of this article you will know how to check what your AI tools actually promise, how to record the origin of generated code, and how to write a policy that holds up in a code review.\n\nWhen a human contributes to your MIT-licensed repo, the commit carries a name and the project's license covers the contribution. When Copilot or a coding agent generates a function, neither applies. The code is a suggestion from a model trained on public repositories of mixed licenses.\n\nTwo failure modes follow from this:\n\nNeither failure is about whether the model copied GPL code verbatim. Both are about your inability to answer questions about your own codebase.\n\nThe major assistants differ in what they guarantee, and the differences matter more than the open source debate. Read the terms before you rely on any of them.\n\nGitHub Copilot offers a commercial indemnity for paying customers who enable the relevant setting, plus a duplication filter that blocks suggestions matching public code. Google's Gemini Code Assist and Amazon Q Developer make their own distinct claims about training data and indemnification. These policies change. Check each vendor's current documentation rather than trusting a blog post, including this one.\n\n| Tool approach | Tradeoff | Fits when | \n|---|---|---|\n| Indemnified commercial assistant | Cost, vendor lock-in | Regulated or acquisition-bound codebases | \n| Self-hosted open model | You own the output and the risk | Strict data controls, sensitive repos | \n| Generic chatbot copy-paste | No guarantee at all | Prototypes, never shipped code | \n\nThe last row is the common one, and it is the risky one.\n\nA policy nobody can follow in the editor is useless. The cheapest working approach: mark generated code at commit time and keep the marking mechanical.\n\nA simple convention is a commit trailer your tooling can grep for:\n\n```\n# Record AI assistance in the commit itself\ngit commit -m \"Add retry logic for webhook delivery\" \\\n  -m \"Assisted-by: claude-code\"\n```\n\nGit trailers are machine-readable key-value pairs that land in the commit object. You can then audit history without reading a single diff:\n\n```\n# Count commits with recorded AI assistance\ngit log --format=\"%(trailers:key=Assisted-by,valueonly)\" \\\n  | grep -c .\n```\n\nThis costs one line per commit and survives branch rebases better than code comments do.\n\nManual conventions decay in weeks. Enforce the convention with a `pre-commit` hook so the check runs before the commit exists:\n\n```\n# .pre-commit-config.yaml\nrepos:\n  - repo: local\n    hooks:\n      - id: ai-provenance\n        name: require Assisted-by trailer when flagged\n        entry: scripts/check-ai-provenance.sh\n        language: system\n        stages: [commit-msg]\n```\n\nThe script inspects the diff for large blocks of new code and the commit message for the trailer. It exists to start a conversation, not to block work: a developer who used an assistant but skipped the trailer fixes the message and proceeds.\n\nKeep the threshold generous. A hook that fires on every commit gets disabled in a day.\n\nSome teams respond by adding a clause to the project license about AI-generated code. This rarely holds. Your license governs what others may do with your code. It does not establish that you hold copyright in code a model produced, because copyright requires human authorship in most jurisdictions and purely generated output may not qualify.\n\nThe practical consequence: substantial AI-generated code may sit in your repo with no enforceable copyright on your side. That is usually fine for internal tools. It matters when you license a library commercially or need to defend the codebase in a dispute. For that path, require meaningful human modification of generated code before it ships, and keep the `Assisted-by` trail so you can show what you changed.\n\nThe case for open-sourcing AI-generated code has a real kernel: models train on open source, so the output owes something back. But it skips the nearer problem. Teams ship unlicensed, undocumented-origin code right now, and no license applies until someone chooses one and records it.\n\nStart smaller than a manifesto. Pick one assistant with terms you understand. Add the trailer convention. Enforce it with a hook. That gives you a codebase where every line has an answer to \"where did this come from\" -- which is the property the open source argument is really reaching for.\n\n`Assisted-by: <tool>` give you a grep-able provenance record for one line of effort per commit.`pre-commit` commit-msg hook, and keep its threshold generous so people do not disable it.\n[All AI-generated code should be Open Source](https://jakub.jankiewicz.org/blog/ai-code-open-source/) argues the normative case for open sourcing AI output. This article adds the practitioner's side: concrete provenance conventions, enforcement tooling, and the licensing failure modes the original does not cover.\n\nThese write-ups are researched and published with no paywall, sponsor, or tracking. If one saved you an afternoon, a small tip keeps them coming.\n\nUSDT, USDC or USDD · TRC-20 (Tron)\n\n```\nTFTNsfyomKrnUutRjBTGVULp19ByW29KbY\n```\n\n", "url": "https://wpnews.pro/news/your-ai-generated-code-has-no-license", "canonical_source": "https://dev.to/robust_true_try/your-ai-generated-code-has-no-license-2edl", "published_at": "2026-11-15 21:44:56+00:00", "updated_at": "2026-11-15 21:50:55.279079+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-products"], "entities": ["GitHub Copilot", "Google", "Gemini Code Assist", "Amazon Q Developer", "Claude Code"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/your-ai-generated-code-has-no-license", "markdown": "https://wpnews.pro/news/your-ai-generated-code-has-no-license.md", "text": "https://wpnews.pro/news/your-ai-generated-code-has-no-license.txt", "jsonld": "https://wpnews.pro/news/your-ai-generated-code-has-no-license.jsonld"}}