This prompt is designed for developers, legal engineers, and compliance teams who need a structured, reviewable assessment of license obligations, compatibility conflicts, and attribution requirements before a new dependency is merged. The primary job-to-be-done is to act as a compliance gate: it takes a proposed component, its declared license, and your product's context, and returns a machine-readable decision—pass, blocked, or needs-review—along with a detailed rationale. Use this prompt when a new open-source library, model, or dataset is proposed in a pull request, during a CI/CD pipeline check, or as part of a standard due diligence workflow for a new vendor or upstream dependency. It is not a replacement for legal advice, and it should never be the final word on complex copyleft interactions or patent grant interpretations.
Prompt
Open Source License Compliance Gate Prompt

When to Use This Prompt
A practical guide to deploying the Open Source License Compliance Gate Prompt as a blocking or conditional-pass decision point before integrating open-source code or AI model weights into your product.
The prompt is most effective when it has access to the full license text, not just the SPDX identifier. A license's practical obligations—such as notice requirements, source-distribution triggers, and attribution formats—are often in the fine print. You should wire this prompt into an application harness that retrieves the LICENSE file from the repository or package metadata and injects it into the [LICENSE_TEXT] placeholder. The prompt also requires your product's context: its distribution model (SaaS, on-prem, embedded), its own license, and any existing obligations from the dependency tree. Without this context, the model cannot assess compatibility or propagation risk. A common failure mode is feeding the prompt only a license name like "MIT" and expecting a deep analysis; the output will be shallow and unreliable. Always provide the full text.
Do not use this prompt for one-off, informal code snippets copied from forums or gists where no license is declared. In those cases, the prompt will correctly flag the absence of a license as a blocking condition, but the real-world resolution is a human decision about risk tolerance, not a prompt output. Similarly, do not use this prompt to evaluate the patent landscape or to make fair-use determinations for proprietary code; those require qualified legal analysis. The next step after reading this section is to review the prompt template, adapt the placeholders to your dependency-ingestion pipeline, and set up the evaluation checks described later in this playbook to catch copyleft propagation errors and hallucinated license terms.
Use Case Fit
Where the Open Source License Compliance Gate Prompt works, where it fails, and what you must provide before relying on it.
Good Fit: Standard License Review
Use when: evaluating a single component against a well-known license (MIT, Apache 2.0, GPLv3, BSD). The prompt reliably extracts obligations, checks compatibility, and flags copyleft propagation. Guardrail: always provide the full license text or a verified SPDX identifier; never ask the model to recall a license from memory.
Bad Fit: Legal Advice or Multi-License Negotiation
Avoid when: the output will be treated as legal advice, used to make a final compliance decision without human review, or applied to complex multi-component stacks with implicit licensing. Guardrail: this prompt is a triage and analysis tool, not a replacement for qualified legal review. Always route borderline or high-risk findings to a human reviewer.
Required Input: License Text and Usage Context
What to watch: the prompt will hallucinate obligations or miss restrictions if it does not have the exact license text and a clear description of the intended use (distribution, modification, SaaS, internal tool). Guardrail: design the harness to require both [LICENSE_TEXT] and [USAGE_CONTEXT] as mandatory fields before the gate runs. Block execution if either is missing.
Operational Risk: Copyleft Propagation Errors
What to watch: the model may fail to recognize that linking to a GPL library or modifying an AGPL file triggers copyleft obligations for the consuming codebase. This is the highest-severity failure mode. Guardrail: add an eval check that specifically tests whether the output correctly identifies copyleft propagation when the usage context includes 'modification' or 'linking' with a strong copyleft license.
Operational Risk: Compatibility Blind Spots
What to watch: the model may approve a combination of licenses (e.g., GPLv2 and Apache 2.0) that are known to be incompatible, or miss attribution stacking requirements across multiple components. Guardrail: maintain a curated, human-reviewed compatibility matrix for your most common license pairs and use it as a secondary validation step after the prompt runs.
Not a Replacement: Dual-License and OSS Policy Decisions
What to watch: the prompt cannot interpret your organization's internal open-source policy, decide between dual-license options, or assess business risk tolerance. Guardrail: the gate output should always include a needs_human_review flag for any finding that involves policy interpretation, commercial licensing, or patent grant analysis.
Copy-Ready Prompt Template
A copy-ready prompt that evaluates open-source license compliance and returns a structured JSON gate decision your application can enforce.
This prompt template implements a compliance gate for open-source license evaluation. It is designed to be integrated into a CI/CD pipeline, a dependency review workflow, or an AI-assisted legal review queue. The prompt instructs the model to act as a compliance analyst, comparing a proposed use case against the text of a specific open-source license. The output is a strict JSON object containing a decision, a risk_level, and a structured list of obligations and conflicts. This allows your application to automatically block non-compliant actions, route ambiguous cases for human review, and log an auditable compliance record.
textYou are an open-source license compliance analyst. Your task is to evaluate whether a proposed use of open-source software or AI model weights complies with the provided license text. You must be conservative. If the license terms are ambiguous or the proposed use is not clearly permitted, flag it for human review. ## INPUT [LICENSE_TEXT] [PROPOSED_USE_CASE] [CONTEXT] ## CONSTRAINTS - Base your analysis strictly on the provided [LICENSE_TEXT]. Do not infer permissions from common practice or other licenses. - If the [PROPOSED_USE_CASE] involves distribution, modification, or integration into a proprietary product, pay special attention to copyleft clauses (e.g., GPL, AGPL) and attribution requirements. - If the [LICENSE_TEXT] is missing, unclear, or appears to be a non-standard variant, set the decision to "NEEDS_REVIEW". - Do not provide legal advice. Your output is a preliminary compliance assessment for a human reviewer or an automated gate. ## OUTPUT_SCHEMA Return a single JSON object with the following structure: { "decision": "COMPLIANT" | "NON_COMPLIANT" | "NEEDS_REVIEW", "risk_level": "LOW" | "MEDIUM" | "HIGH" | "CRITICAL", "summary": "A one-sentence summary of the assessment.", "obligations": [ { "type": "ATTRIBUTION" | "SOURCE_DISCLOSURE" | "LICENSE_INCLUSION" | "STATE_CHANGES" | "PATENT_GRANT" | "OTHER", "description": "Specific action required by the license.", "compliant": true | false } ], "conflicts": [ { "clause": "The specific license clause causing the conflict.", "reason": "Why the proposed use violates this clause." } ], "human_review_required": true | false, "review_reason": "Explanation if human review is required, otherwise null." } ## RISK_LEVEL - LOW: All obligations can be met with standard tooling (e.g., adding a NOTICE file). - MEDIUM: A copyleft license is involved, but the proposed use may not trigger its core conditions. - HIGH: A copyleft license is involved, and the proposed use likely triggers source-disclosure obligations. - CRITICAL: The proposed use clearly violates the license terms, or the license is incompatible with the project's overall licensing.
To adapt this prompt, replace the [LICENSE_TEXT] placeholder with the full text of the license in question, extracted directly from the repository's LICENSE file or the SPDX standard text. The [PROPOSED_USE_CASE] should be a detailed, factual description of how the software will be used, including whether it will be modified, distributed, or linked. The optional [CONTEXT] field can include the project's own license and any relevant company policy. After pasting the prompt, validate that the model's JSON output conforms to the schema before your application acts on the decision field. For high-risk use cases, always route NEEDS_REVIEW and HIGH/CRITICAL risk decisions to a human legal reviewer.
Prompt Variables
Inputs required for the Open Source License Compliance Gate Prompt to produce a reliable, grounded assessment. Each variable must be populated before the prompt is assembled and sent.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[COMPONENT_DESCRIPTION] | Describes the open-source component, library, or model weights being evaluated. | react@18.2.0 (MIT) used as a frontend dependency in a commercial SaaS product. | Must be a non-empty string. Check for ambiguous names that could map to multiple packages. |
[USAGE_CONTEXT] | Explains how the component will be used, modified, or distributed. | Linked as an unmodified npm dependency; no source changes; distributed as part of a Docker image to enterprise customers. | Must describe the interaction type: dynamic link, static link, modification, distribution, or SaaS usage. Required for copyleft analysis. |
[LICENSE_TEXT] | The full text of the license file from the component's repository or package. | MIT License Copyright (c) 2023 ... | Must be the verbatim license text. Validate that it is not truncated. If the license is a standard SPDX identifier without full text, flag for human review. |
[SPDX_IDENTIFIER] | The SPDX license identifier, if known. | MIT | Must match a valid SPDX identifier from the official list. If null, the prompt must derive the license type from [LICENSE_TEXT]. |
[DEPENDENCY_GRAPH] | A list of the component's own dependencies and their licenses, if available. | react@18.2.0 -> loose-envify@1.4.0 (MIT), js-tokens@4.0.0 (MIT) | If null, the prompt must note that transitive dependency analysis is incomplete. Validate that the structure is a parseable list or JSON. |
[ORGANIZATIONAL_POLICY] | The internal open-source policy or constraints that apply. | Permissive licenses only; copyleft requires legal review; no AGPL in distributed products. | Must be a non-empty string. If the policy is complex, provide a summary of the key constraints. Validate that it does not contradict the license text. |
[OUTPUT_SCHEMA] | The required JSON schema for the compliance assessment output. | { "compliance_status": "compliant|non_compliant|needs_review", ... } | Must be a valid JSON Schema object. Validate that it includes fields for obligations, conflicts, and attribution requirements. |
Implementation Harness Notes
Wire the compliance gate prompt into a production application with validation, retries, logging, and human escalation paths.
This prompt is designed to be called from a script, microservice, or workflow orchestrator that can parse the structured JSON output and act on the gate_decision field. The integration point is a simple request-response pattern: your application sends the prompt with the required inputs and receives a compliance assessment. The critical work happens after the model responds. You must treat the model's output as a signal that requires deterministic handling, not as a final decision that can be passed directly to the next step in your pipeline without verification.
Implement a JSON schema validator that checks the model's response against the expected output structure before any decision logic runs. The validator should confirm the presence and type of gate_decision (enum: pass, blocked, needs-review), license_obligations (array), compatibility_conflicts (array), and attribution_requirements (array). If validation fails, retry the prompt once with a temperature of 0.1 to reduce output variance while preserving enough flexibility to escape the malformed generation path. If the second attempt also fails validation, escalate immediately: store the malformed output, create a ticket in the legal review queue with the raw response attached, and halt the pipeline. Never attempt more than two automated retries for a compliance gate—silent failures here create regulatory exposure.
On a pass decision, log the full assessment—including the raw model response and the parsed gate decision—to your audit store with a timestamp, the input context hash, and the model version. Allow the workflow to continue. On a needs-review decision, create a ticket in the legal review queue with the complete prompt output, the input context, and a priority flag. The ticket should contain enough context for a human reviewer to make a decision without re-running the analysis from scratch. On a blocked decision, halt the pipeline immediately, notify the compliance team via your incident channel, and store the blocking rationale with the same audit traceability as a pass. The blocked path should never be silently logged; it requires active human attention. Always store the raw model response and the parsed gate decision together—never discard the raw output after parsing, as it is your evidence for audit and debugging.
For model selection, use a model with strong instruction-following and structured output capabilities. The prompt relies on the model correctly interpreting legal text and producing consistent JSON, so prefer models with proven performance on legal reasoning benchmarks. If you are using a self-hosted or open-weight model, run additional eval checks on your specific license types before trusting the gate in production. Implement a dead-letter queue for any response that cannot be parsed after retries, and monitor the rate of needs-review and blocked decisions as a leading indicator of policy drift or model behavior changes. The most common production failure mode is not a wrong decision but a malformed output that your parser silently treats as a pass—your schema validation and retry logic are your primary defenses against this.
Expected Output Contract
Defines the structured JSON payload the model must return for the Open Source License Compliance Gate. Use this contract to validate responses before passing the result to downstream approval or blocking logic.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
compliance_status | enum: compliant | non_compliant | needs_review | Must be exactly one of the three enum values. Reject any other string. | |
license_identified | string | Must match a known SPDX identifier or a recognized license name from the provided [LICENSE_TEXT]. Reject if null or empty. | |
obligations | array of strings | Each string must be a distinct obligation extracted from the license (e.g., 'attribution', 'source_disclosure'). Reject if array is empty when status is compliant. | |
compatibility_conflicts | array of objects | If present, each object must contain 'conflict_with' (string) and 'reason' (string) fields. Null allowed if no conflicts exist. | |
attribution_required | boolean | Must be true or false. Reject if null. If true, the 'attribution_text' field must be populated. | |
attribution_text | string or null | Required only if 'attribution_required' is true. Must be a non-empty string containing the exact attribution notice. Validate null is allowed when false. | |
copyleft_propagation_risk | enum: none | weak | strong | Must be exactly one of the three enum values. Reject if missing. 'strong' status must trigger a human review escalation. | |
blocking_rationale | string or null | Required if 'compliance_status' is 'non_compliant'. Must contain a specific, non-generic reason citing the license term. Reject empty strings. |
Common Failure Modes
The most frequent ways an open-source license compliance gate prompt breaks in production and how to prevent each failure before it reaches a human reviewer or blocks a legitimate workflow.
Copyleft Propagation Blindness
What to watch: The model treats a permissive dependency as copyleft or, more dangerously, misses that a copyleft library (GPL, AGPL, SSPL) propagates its terms to the combined work. This creates a false sense of safety and can taint proprietary code. Guardrail: Require the prompt to explicitly enumerate each dependency's license type and state the propagation rule before concluding. Add an eval check that injects a known strong-copyleft dependency and verifies the gate flags it.
License Incompatibility Overlooked
What to watch: The prompt correctly identifies two licenses but fails to detect that they impose conflicting obligations (e.g., GPLv2 and Apache 2.0). The output approves a combination that is legally impossible to distribute. Guardrail: Include a step that cross-references all detected licenses against a known compatibility matrix provided in the system prompt. Test with a known incompatible pair and require a blocking decision.
Attribution Requirement Omission
What to watch: The prompt correctly classifies a permissive license (MIT, BSD, Apache) but omits the specific attribution text, copyright notice location, or disclaimer reproduction requirement. The output says 'approved' without actionable compliance instructions. Guardrail: Require the output schema to include a mandatory attribution_requirements field with the exact text to reproduce. Validate that this field is non-empty for all permissive licenses.
Hallucinated License Identification
What to watch: When the input contains only a package name or a vague reference, the model confidently invents a license type from training data rather than requesting the actual LICENSE file. This is the most dangerous failure mode because it creates a false audit trail. Guardrail: The prompt must refuse to classify any dependency without explicit license text or a verified SPDX identifier. If the input lacks a license field, the gate must output needs-evidence and block progress.
Dual-License Simplification
What to watch: A dependency offers a choice of licenses (e.g., GPL or commercial). The model picks the most permissive interpretation and ignores that the user's use case may only be compatible with the more restrictive option. Guardrail: The prompt must detect dual-license declarations and evaluate compliance against the most restrictive applicable option unless the user explicitly selects a specific license with documented eligibility.
Model Weight vs. Code License Confusion
What to watch: The prompt applies software license logic to AI model weights, conflating open-source code definitions with model licenses (RAIL, Llama Community License, OpenRAIL). It misses use restrictions, acceptable use policies, or downstream model distribution terms. Guardrail: Include a dedicated classification step that distinguishes code licenses from model licenses. If a model license is detected, route to a separate evaluation path that checks for use restrictions and downstream obligations beyond copyright.
Evaluation Rubric
Criteria for testing the Open Source License Compliance Gate Prompt before deployment. Each row defines a pass standard, a failure signal to monitor in production, and a test method that can be automated or run manually.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
License Identification Accuracy | Correctly identifies the primary license from [LICENSE_TEXT] for all SPDX-listed licenses in the golden set. | Output contains a license name not present in the input text or misidentifies a copyleft license as permissive. | Run against a golden dataset of 50 license texts with known SPDX identifiers. Assert exact match on license name. |
Copyleft Propagation Detection | Flags copyleft obligations (GPL, AGPL, SSPL) when [USE_CASE] involves distribution or network service in a proprietary context. | Fails to flag a copyleft license when the use case triggers distribution or SaaS propagation clauses. | Test with 10 copyleft license + proprietary distribution use case pairs. Require true positive on obligation flag. |
Attribution Requirement Completeness | Lists all required attribution elements (copyright notice, license text, changes statement) when license mandates them. | Omits a required attribution element (e.g., missing copyright notice for MIT license). | Validate output against a checklist of required attribution fields per license type. Assert all required fields are present. |
Compatibility Conflict Detection | Correctly identifies license incompatibility when [DEPENDENCY_LICENSES] contains conflicting terms (e.g., GPL-2.0 and Apache-2.0). | Approves a combination known to be incompatible or fails to cite the specific conflicting clause. | Use 5 known-incompatible license pairs. Assert conflict flag is true and reasoning cites the conflicting obligation. |
Hallucinated Clause Prevention | All cited obligations and clauses are directly traceable to the provided [LICENSE_TEXT]. No fabricated restrictions. | Output references a clause number, restriction, or exception not present in the input license text. | Parse output for clause references. For each, verify substring exists in [LICENSE_TEXT]. Fail if any reference is not found. |
Uncertainty Disclosure | When [LICENSE_TEXT] is ambiguous, incomplete, or contains dual-licensing options, the output explicitly flags uncertainty and recommends human review. | Output presents a definitive compliance decision without noting ambiguity when the license text is truncated or contains 'or later' clauses. | Test with 5 intentionally ambiguous or truncated license snippets. Assert human_review_recommended is true and uncertainty_reason is not null. |
Output Schema Adherence | Output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed. | Output is missing required fields, contains extra untyped fields, or fails JSON parse. | Validate output with a JSON Schema validator against the expected schema. Assert no validation errors. |
False Positive Resistance | Does not flag permissive licenses (MIT, BSD-2, Apache-2.0) as blocking for standard distribution use cases. | Blocks or escalates a permissive license for a use case that is clearly allowed by the license terms. | Run 10 permissive license + standard use case pairs. Assert compliance_status is 'compliant' and blocking_conditions is empty. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a single license type (e.g., MIT, Apache 2.0, GPL-3.0). Use a simple pass/fail output schema. Skip full SPDX identifier validation and copyleft propagation analysis. Focus on the core question: "Does [PROPOSED_USE] comply with [LICENSE_TEXT]?"
Prompt modification
codeYou are a license compliance checker. Given a license text and a proposed use, return a JSON object with "compliant" (boolean) and "reasoning" (string). Do not analyze compatibility with other licenses. Do not check attribution format. License: [LICENSE_TEXT] Proposed Use: [PROPOSED_USE]
Watch for
- Overly broad "compliant" determinations without obligation analysis
- Missing copyleft triggers when the use involves distribution
- No distinction between permissive and reciprocal licenses

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us