Yes, you can legally use code generated by Sourcegraph Cody in commercial software. But if your legal counsel assumes that "ownership" equals "zero copyright liability," they are walking into an open-source licensing trap.
At 365Finds, we look past vendor marketing promises to inspect the actual contractual terms and runtime behavior. Sourcegraph's contracts make the division of ownership clear: you own the code Cody produces for you. However, Sourcegraph's legal terms also explicitly shift the burden of open-source license compliance right back onto your engineering team.
If Cody outputs a 40-line snippet lifted verbatim from a GPLv3 or AGPL codebase, and your engineers ship it inside a proprietary commercial product, you cannot simply blame the AI. Here is exactly how Sourcegraph Cody handles intellectual property, how its code attribution guardrails work, what Enterprise Copyright Indemnity actually protects, and how platform engineering teams must configure their legal defense line.
The Contractual Core: Ownership vs. Compliance Liability
To understand your legal standing, you have to read two documents side-by-side: the standard Sourcegraph Terms of Service (specifically Section 3.2) and the Sourcegraph AI Terms of Use (Section 1).
Sourcegraph's position on intellectual property ownership is unequivocal:
"As between the parties, you own all Inputs to and Outputs generated by your use of Sourcegraph. You retain all right, title, and interest in and to User Content, including any Outputs adopted by You."
You do not pay royalties on Cody-generated code. Sourcegraph claims no copyright over your completions. Under contract law, the generated artifacts belong to your organization.
Then comes the contractual caveat in Section 1 of the AI Terms:
"You retain ownership of your code and responsibility for ensuring any code snippets emitted by Sourcegraph comply with software licenses and copyright law."
This single sentence draws the legal battleground. Sourcegraph hands you the intellectual property rights, but Sourcegraph does not warrant that every emitted string of syntax is free from third-party open-source obligations. In Section 8 of the AI Terms, Sourcegraph further reinforces that outputs are provided "as is" and without warranty of any kind, mandating that you are solely responsible for reviewing and validating any code prior to production use.
If Cody regurgitates copyleft code, you own the output—and you own the infringement liability.
Why Cody Replicates Less Code—And Where Copyleft Risk Remains
Most AI coding assistants act as probabilistic word completion engines trained on vast public internet scrapers. Ask a generic LLM to write an authentication wrapper or a red-black tree, and it will often recall memorized blocks of existing GitHub code verbatim.
Sourcegraph Cody takes a fundamentally different architectural path. It operates through Sourcegraph's Code Graph.
Instead of guessing syntax in isolation, Cody parses your local IDE state, your private repository structure, multi-repo symbol graphs, and contextual embeddings. When an engineer asks Cody to refactor an internal API or generate a unit test, Cody grounds its prompt inside your proprietary code graph.
Because the generation is anchored to your proprietary domain symbols, classes, and architectural conventions, Cody naturally hallucinates or regurgitates public open-source code far less frequently than generalist AI models.
Yet copyleft contamination remains a distinct risk in two specific scenarios:
- Generic utility algorithms and boilerplate: When an engineer prompts Cody for generic algorithmic solutions (e.g., cryptographic helper functions, protocol parsers, sorting implementations) where private context offers no reference points, the underlying LLM falls back on its baseline training weights.
- Aggressive refactoring across public repositories: If your Sourcegraph instance indexes external open-source dependencies alongside your private codebase, context retrieval can pull third-party open-source snippets directly into Cody's active prompt window.
If that emitted code originates from a library licensed under copyleft regimes such as GNU GPL, AGPL, or Eclipse Public License (EPL), integrating it into closed-source commercial software can trigger license obligations to disclose your proprietary source code.
Technical Defense: How Attribution Guardrails Operate
To prevent verbatim open-source replication from reaching the developer's screen, Sourcegraph built an attribution verification system known as Guardrails for Public Code.
The Matching Mechanism
When Cody generates a completion, the Attribution Guardrails mechanism intercepts the output and runs an exact string match against an indexed corpus of approximately 290,000 public open-source repositories spanning all software license types.
The operational parameters are precise:
- Threshold: The guardrail triggers only on code snippets that are at least 10 lines long.
- Detection Method: Exact string matching.
- Scope: Covers Sourcegraph Enterprise instances routing through Sourcegraph Cody Gateway across VS Code, JetBrains IDEs, and the Sourcegraph Web application. It does not support Bring Your Own Key (BYOK) setups where an enterprise routes directly to self-managed model endpoints.
Admin Configuration: Enforcing the Gate
By default, attribution guardrails are disabled. To protect enterprise codebases, platform administrators must explicitly activate and enforce the feature in the Sourcegraph site configuration:
{
"attribution.enabled": true,
"attribution.mode": "enforced"
}
Under "attribution.mode": "enforced", Cody's IDE extensions (VS Code v1.82+ and JetBrains v7.82+) withhold the code completion from displaying in the editor until the attribution check against the public repository index completes. In Cody Chat, if a snippet passes or triggers a match, Cody flags the attribution status directly within the conversation window.
The Limits of Exact String Matching
At 365Finds, we caution engineering leaders against treating attribution guardrails as an infallible firewall.
Because the engine checks for exact string matches across 10 or more contiguous lines, subtle alterations introduced by the model—such as renamed variables, reordered parameters, modified indentation, or inline comments—can cause an infringing snippet to slip past the 10-line exact match threshold. Furthermore, Sourcegraph has noted deprecation and architectural shifts around legacy guardrail modules in newer releases as backends evolve toward frontier foundation models. Relying solely on IDE-level regex or string matching is not an enterprise compliance strategy.
Enterprise Copyright Indemnity: Dissecting the Fine Print
To address corporate legal friction, Sourcegraph provides an Enterprise Intellectual Property Indemnification clause. However, there is a stark divide between commercial marketing rhetoric and actual legal protection.
Who Qualifies?
Indemnification is strictly reserved for Enterprise License customers who have executed a formal, negotiated Order Form.
- If your developers use Cody Free or Cody Pro via credit card self-serve tiers, you receive zero copyright indemnity. Self-serve tiers are provided "as is," and Sourcegraph even reserves the right to use Pro/Free AI User Content to detect abuse and improve services unless users explicitly opt out.
- Under an Enterprise License, Sourcegraph commits to zero data retention with partner model providers (Anthropic, OpenAI) and contractually bars model training on your private codebase.
What Does the Indemnity Cover?
Under Section 5 of the AI Terms and Section 12.2 of the Sourcegraph Terms of Service: Sourcegraph agrees to defend and indemnify qualifying enterprise customers against third-party claims alleging that the use of Sourcegraph AI Tools or generated Outputs infringes or misappropriates a third party's intellectual property or copyright.
Critical Exclusions You Must Note
Indemnity is not an unconditional blanket check. Sourcegraph's defense obligations are subject to strict conditions:
- Latest Supported Versions: You must be running the latest version of the Software and IDE extensions.
- Filters Must Be Active: You must utilize the filters and guardrails provided by the Services. If your administration turned off attribution checks, your indemnity posture weakens significantly.
- No Unauthorized Combinations: The claim cannot arise from your own modifications or unauthorized combinations of the Services with external tooling.
- License Compliance vs. Direct Infringement: Indemnification defends against third-party IP infringement lawsuits; it is not an insurance policy that absolves your organization from downstream open-source license compliance disputes if your engineers fail to verify license terms.
The 365Finds Governance Blueprint: 4 Mandatory Steps for Enterprise Rollouts
For enterprise engineering directors, open-source compliance officers, and legal counsel deploying Sourcegraph Cody at scale, 365Finds recommends establishing a four-tier operational governance model:
[ Developer Prompts Cody ]
│
▼
[ Step 1: Cody Code Graph Grounds Context in Private Repos ]
│
▼
[ Step 2: Sourcegraph Attribution Guardrails (attribution.mode: enforced) ]
│ (Blocks verbatim 10+ line public OSS matches)
▼
[ Developer Commits Code ]
│
▼
[ Step 3: CI/CD Pipeline Software Composition Analysis (SCA) ]
│ (Black Duck / Snyk / FOSSA scans snippet-level license ASTs)
▼
[ Step 4: Enterprise Audit Logging & Prompt Provenance Archiving ]
1. Mandate the Enterprise Tier with Executed IP Terms
Never permit engineering teams to adopt Cody Pro or Free accounts for production proprietary software. Secure a Cody Enterprise contract with explicit execution of Section 5 AI Terms of Use and confirmed zero data retention. Ensure the contract includes indemnification covering both Cody Gateway and supported partner LLM outputs.
2. Enforce Attribution Guardrails at the Instance Level
Configure "attribution.enabled": true and "attribution.mode": "enforced" globally within your Sourcegraph site admin dashboard. Do not leave attribution checking as an optional developer-side IDE toggle.
3. Deploy Downstream SCA Scanners in CI/CD
Treat all AI-generated code as third-party code. Real-time IDE guardrails catch exact matches, but they cannot replace AST-based (Abstract Syntax Tree) license scanners. Maintain automated Software Composition Analysis (SCA) tools—such as Black Duck, FOSSA, or Snyk—in your continuous integration pipelines. These scanners detect partial code reuse, snippet signatures, and copyleft licenses (GPLv2/v3, AGPL, LGPL) before branches merge into protected production codebases.
4. Archive Prompt and Completion Logs for Legal Provenance
In copyright litigation, proving independent creation or tracing provenance is paramount. Ensure your Cody Enterprise deployment enables administrative audit logging for AI interactions. Retaining provenance records demonstrates institutional good faith, establishes when and how code was generated, and provides the documentation required if your legal team ever needs to invoke Sourcegraph's indemnification clause.
Sourcegraph Cody provides one of the strongest context architectures and legal indemnity frameworks in enterprise developer tooling. However, contracts do not write code—developers do. Coupling Cody's Code Graph intelligence with enforced attribution filters and mandatory CI/CD composition scanning is how modern engineering organizations capture generative productivity without surrendering copyright ownership.