All AI-generated code should be open source. I built a one-command audit that finds which of your files that covers.
On 15 November 2026, Jakub T. Jankiewicz (jcubic - jQuery Terminal, LIPS Scheme, isomorphic-git maintainer) published "All AI-generated code should be Open Source" (jakub.jankiewicz.org). It reached over 1,100 points and 600 comments on Hacker News (checked 16 November 2026). Two arguments: (1) models learn from scraped open source and Stack Overflow content under licences that require attribution, so closing the output as proprietary is "licence laundering"; (2) purely AI-generated code has no human author, so it gets no US copyright protection (US Copyright Office AI guidance Part 2, 29 January 2025; Thaler v. Perlmutter) - while the UK and some other countries DO protect machine-generated works. He calls on developers to release AI code under an open-source licence or CC0. The strongest rebuttal on Hacker News: if AI code has no copyright, putting an open-source licence on it is meaningless. US law does NOT require open source - this is a normative claim, not a legal rule. I do not take a side in that debate. I built owncode to answer the prior question every team needs first: which of your files are AI output at all, and which of them can you actually license, sell, and protect?
The numbers behind the gap
Black Duck 2026 OSSRA: 68% of the 947 commercial codebases audited contained licence conflicts - the largest single-year jump in the study's eleven-year history (up from 56%). The primary driver of the surge, in Black Duck's own account, is the proliferation of third-party dependencies; AI coding assistants are a major contributor alongside that growth, generating snippets derived from copyleft-licensed repositories without retaining licence metadata. Black Duck calls it "licence laundering". Only 54% of surveyed organisations check AI-generated code for IP and licence risks, vs 76% who check it for security vulnerabilities. In early 2026 an AI-assisted rewrite of the LGPL-licensed chardet library (chardet 7.0, rewritten with Claude and relicensed MIT, disputed by the original author) raised the question whether AI-mediated "clean room" reimplementation is independent work at all. Most AI coding tools leave no trace in version control. Claude Code defaults to Co-Authored-By: Claude trailers, but that is one point on a broader spectrum. Teams ship AI-written code with no record of who owns it - and no decision is made until a dispute arrives.
What it does
owncode is a zero-dependency TypeScript CLI (Node 20+). It reconstructs, from git history and markers already in the repo, which files are human-written, AI-assisted, or pure AI output - then maps each file to an ownership verdict under the US Copyright Office rule, plus licence-header and attribution coverage. No install-before-you-write, no daemon, no hooks, no git notes. It works on any repo exactly as it stands today.
Install from source only - the owncode package is not published to npm yet (the name is unclaimed; npm returned 404 when checked on 16 November 2026):
git clone https://github.com/techdevfun/owncode.git
cd owncode
npm install
npm run build
node dist/cli.js audit .
Four commands plus init:
owncode audit [path] [--json] [--since <ref>] [--config <file>]
owncode check --baseline <file> [--path <dir>]
owncode diff <baseline-a> <baseline-b>
owncode explain <file>
owncode init
-
audit: per-file provenance + verdicts. Exit 0 = no AT-RISK / UNPROTECTED file; 1 = at least one risky file; 2 = usage error or not a git repo. -
check: FAIL only on NEW risky files vs a saved baseline - the CI gate for existing projects. Fixed findings are listed, not failed. -
diff: new / fixed / unchanged findings between two baselines. -
explain: drill-down for one file, every evidence item (trailer, marker, commit SHA, licence-header status) behind its verdict. -
init: writesowncode.config.jsonwith the default policy.
Verdict rules
| Verdict | Meaning |
|---|---|
| OWNABLE | Human-authored, or human-edited after AI generation, licence header present, no attribution gap. (Human authorship is the US Copyright Office test; the verdict is a heuristic, not a legal opinion.) |
| AT-RISK | AI-attributed with no human edit after, OR licence header missing, OR third-party code without attribution. Needs a human decision before licensing/selling. |
| UNPROTECTED | Pure AI output: 100% of commits touching the file are AI-attributed, no human author anywhere in the file's history, no licence header. Under US Copyright Office guidance this file is likely uncopyrightable in the US - the UK and some other jurisdictions protect machine-generated works. |
| UNKNOWN | History too thin to judge (single commit, squashed history, no trailers, no markers). Reported separately with a coverage percentage. Never silently counted as human. |
Provenance signals (all local, git only, no network, no LLM)
-
S1 Commit trailers -
Co-Authored-By: <Claude / ChatGPT / Copilot / Codex / Gemini / agent>orGenerated-By:in commit messages. Human author + AI trailer = AI-assisted. -
S2 In-file AI markers -
Generated by,Generated with,AI-generated,Co-Authored-Byin header comments,DO NOT EDIT - generatedstyle banners. -
S3 Agent paths - files under
.ai/,agent/, or with.gen./.ai.infixes, unless a human commit later rewrote them. - S4 Human-edit ratio - share of commits touching the file that are human-authored. A human commit after AI generation counts as a human edit. The tool CANNOT verify review depth - say so on every output.
- S5 Licence header - SPDX identifier or copyright line in the first 40 lines. Absent = finding.
-
S6 Attribution gap - files under
vendor/,third_party/,external/without a NOTICE / attribution / licence file nearby = finding.
The demo, with real output
The GIF runs the real CLI on a synthetic fixture repo (built with real git commits, labelled synthetic in the transcript and README): one human file (OWNABLE), one Claude co-authored file (AT-RISK), one pure-AI file (UNPROTECTED), one vendored file without attribution (AT-RISK); then explain on the UNPROTECTED file; then the check CI gate failing on one new pure-AI file vs a saved baseline.
$ owncode audit .
file verdict human% header signals
src/handwritten.ts OWNABLE 100 yes -
src/helper.ts AT-RISK 0 yes agents:claude
src/pure-ai.ts UNPROTECTED 0 no agents:claude no-header
vendor/legacy.js AT-RISK 100 yes attribution-gap
summary: OWNABLE 1 | AT-RISK 2 | UNPROTECTED 1 | UNKNOWN 0 | attributable 100% (4/4 files)
Verdicts are heuristics under US Copyright Office guidance (Part 2, 29 Jan 2025). The UK and some other jurisdictions protect machine-generated works. Not legal advice.
exit: 1
$ owncode explain src/pure-ai.ts
file: src/pure-ai.ts
verdict: UNPROTECTED
human ratio: 0% (0 human / 1 commits, 1 AI-attributed)
agents: claude
licence header: no
reasons:
- 100% of commits are AI-attributed and no human author appears in this file's history
- no licence header
evidence commits (newest first):
6747345 Claude <noreply@anthropic.com> - Generate fib module
Generated-By: Claude Code
exit: 1
The full transcript is in demo/transcript.txt in the repo.
The live check: a real repo, not just fixtures
A fixture-only demo proves the mechanics, not the judgement. During the build, owncode was also run against a real public repo that carries Co-Authored-By: Claude commits: multigres/multigres ("Vitess for Postgres"), HEAD 9037375a, 2,602 files. Sample commit 42a829a9 carries Co-Authored-By: Claude Sonnet 5.5, human author Mats Kindahl, and the file it touches (go/observability/metriccatalog/catalog_generated.go) is OWNABLE with a Claude agent signal over 31 commits - human edits after the AI trailer, so trailer detection is exercised on real history, not only on fixtures.
Depth-30 run (30 commits, --all, about 4 seconds):
- OWNABLE 1,861 | AT-RISK 20 | UNPROTECTED 0 | UNKNOWN 721 | attributable 72% (1,881/2,602 files) - exit 1.
Full-clone run (full history: 1,380 commits, --all, about 5 seconds):
- OWNABLE 1,849 | AT-RISK 436 | UNPROTECTED 1 | UNKNOWN 316 | attributable 88% (2,286/2,602 files) - exit 1.
The full-clone AT-RISK count is driven by missing licence headers (420 of 436 files - mostly config, docs, and YAML with multi-commit history and no SPDX/copyright header), not by AI signals: only 5 files carry markers, 10 carry agent trailers, 0 sit on agent paths, and there are ZERO generated-do-not-edit / do-not-edit-generated banner markers anywhere in the repo. 38 files carry Claude (29) or Copilot (12) trailer signals; most are OWNABLE (human edit after the AI commit) or AT-RISK (no human edit after, or no header). The depth-30 AT-RISK count fell from 96 to 20 after the classical-generator allowlist landed - the 72 classical-banner files, the 8 generated/ agent-path files, and the eks.md prose false positive are all gone.
How it compares (checked 16 November 2026)
| Tool | Form | What it does well | What it cannot do (owncode's wedge) |
|---|---|---|---|
| git-ai (acunniffe/git-ai, usegitai.com) | CLI + daemon | True line-level attribution when installed from day one: agent hooks plus a background daemon; stores line ranges per agent session in git notes (refs/notes/ai); git-ai blame, git-ai stats
|
FORWARD-ONLY: a repo that never installed git-ai has zero provenance. Requires adoption before the code is written. No licence-decision layer: no OWNABLE / AT-RISK / UNPROTECTED verdict, no licence-header coverage, no third-party attribution check. |
| ScanCode Toolkit (AboutCode) | Python CLI | Detects licences, copyrights and package manifests; snippet-level matching against a licence database (can flag a 15-line function matching a GPL original even with renamed variables); local, JSON output | Detects licences present in code. Does not attribute AI vs human authorship, does not answer copyrightability, is a heavyweight scan, not a CI ownership gate. |
| FOSSA CLI | CLI + SaaS backend | Dependency-level + snippet-level licence analysis, policy enforcement in CI, GitHub check status per PR | SaaS backend, dependency-level focus; no AI-authorship reconstruction; commercial terms. |
| Snyk Open Source | CLI + CI plugins | Licence compliance module, policy-based blocking surfaced inline in pull requests (Team/Enterprise plans) | Paid tiers; scans dependencies and generated code for licences, does not reconstruct who wrote a file or whether it is copyrightable. |
| REUSE (FSFE) | CLI | Checks SPDX licence/copyright headers per file | Checks headers exist. Does not ask who wrote the file, whether it is AI output, or whether it can be protected. |
| licensee (GitHub) | CLI / Ruby gem | Detects the repository LICENSE | Repo-level only; no per-file answer. |
| claimtrace (own factory, #19) | CLI | Verifies agent claims against the session transcript | Different axis: report-vs-transcript. owncode is file-vs-history + licence. |
| skill-lock (own factory, #18) | CLI | Pre-run integrity pin/verify for agent skills | Different axis: skill integrity, not code ownership. |
Where rivals beat us (read this before trusting owncode alone): git-ai has true line-level attribution when installed from day one - owncode reconstructs file-level provenance from history, which is coarser and loses signal when history is squashed or rebased; ScanCode has deep snippet matching against licence databases - owncode does marker and heuristic detection with no snippet database; FOSSA/Snyk have commercial databases and remediation guidance. owncode v0.1.0 is a heuristic audit, not legal advice, and says so on every output.
Honest limits
- Heuristic, not proof. A marker in prose-adjacent docs, an agent commit made by a human with no marker, or a squashed history all degrade the verdict. The UNKNOWN bucket and the attributable-coverage percentage report that degradation on every run. A wrong verdict is the worst failure for a gate - owncode never over-claims.
-
Classical generated code is exempt from S2, with a known residue. Banners naming a classical generator (protoc, stringer, mockgen, Thrift,
make proto, or any named non-AI tool) do not count as AI markers, a baregenerated/path segment does not count as an agent path, andDO NOT EDIT - generatedprose does not fire. S2 cannot yet tell every classical banner from an AI banner on its own - the allowlist covers banners that name a classical tool; a bare banner with no tool named still fires, and a banner naming an unknown tool still fires (conservative). Residue in the live runs: 5 proseauto-generatedhits (4 files withauto-generatedin ordinary comments, plusCLAUDE.mdon its documentation line) still land AT-RISK - disclosed, and they land AT-RISK (human decision needed), never UNPROTECTED. Fenced-code-block awareness is on the roadmap. -
One UNPROTECTED file in the live full-clone run is not AI-written code.
.github/linters/.codespellrclands UNPROTECTED because its only commit is by dependabot[bot] - a bot author counts as non-human, so 100% non-human commits with no header lands UNPROTECTED. It is a bot-maintenance file, and the bot-author rule is the cause. Disclosed in the README rather than hidden. - Legal statements are sourced and dated, never universal. Every legal sentence cites US Copyright Office guidance Part 2 (29 January 2025) and Thaler v. Perlmutter, carries the UK / other-jurisdictions caveat, and ends with "not legal advice" in the README, the CLI help, and the JSON output.
- Squashed / rebased history loses trailers. Coverage % exposes it; UNKNOWN is the verdict for thin history. The depth-30 run shows it live: 721 UNKNOWN files, inflated by only 30 commits of history. For forward capture (line-level, from day one), git-ai is the honest alternative - see the comparison table.
- A human commit cannot prove human review. The tool records that a human touched the file, not how carefully they reviewed the AI output.
- No snippet database. owncode does marker and heuristic detection. It cannot tell you that a 15-line function matches a GPL original - ScanCode can.
- File-level, not line-level. A file that is 90% human and 10% AI is one verdict. Line-level attribution needs git-ai installed before the code is written.
-
Performance. The audit runs two
git logpasses over the whole repo plus one read per file. A 2,602-file repo audited in about 4-5 seconds during the live runs; the default 2,000-file cap keeps very large repos bounded (use--allto opt out).
CI flow
- run: npm ci
- run: npm run build
- run: npm test
- run: node dist/cli.js audit . --save-baseline owncode-baseline.json
- run: node dist/cli.js check --baseline owncode-baseline.json
Keep the baseline file outside the repo or untracked: a baseline committed into the repo gets audited like any other file. The workflow in .github/workflows/ci.yml runs the unit + e2e suite and the live smoke test on Node 20.x and 22.x.
Tests and verification
49/49 tests passing (39 unit + 10 e2e), tsc strict clean, npm run lint (eslint + prettier) clean, CI green on Node 20 and 22. The test suite covers the failure modes, not just the happy path: trailer parsing (all known agent names + unknown trailer ignored), marker detection (header + body, false-positive guard on words like "generated" in normal prose, classical-banner allowlist), SPDX header detection, verdict rules (all four verdicts + boundary cases: 100% AI, 50/50, human-after-AI), baseline diff (new/fixed/unchanged), config loading, plus e2e on fixture git repos built with real commits.
Feedback welcome in the repo issues. The roadmap (fenced-code-block awareness for marker detection, an optional git-notes reader reusing git-ai's refs/notes/ai, SPDX licence allowlist enforcement with --strict-licences, npm publish of owncode) is in the README.

Top comments (0)