License compliance borrow check

From event4u-app/agent-config · View interactive version

License compliance borrow check is an AI agent skill from the GitHub repository event4u-app/agent-config. Paste a URL/snippet before you borrow it — detects its license, runs the derived compatibility policy, and drafts a provenance ledger entry — even before any code is written, not after

How to use this skill

Skill file

license-compliance-borrow-check

When to use

a non-trivial structure, or more than roughly ten lines of logic shape

from a source you can name (a repo, a gist, a Stack Overflow answer).

step 3 ("check license compatibility") needs a concrete answer.

never checked.

Do NOT use when:

(a for-loop, a hash map) implemented with no specific source in mind.

CODE0 to

regenerate notices instead.

CODE0.

A passing verdict is not a copying clearance

This skill answers ONE question: is the source's license compatible with

this repo's license, under the derived compatibility policy? An allow

verdict means the license permits the reuse — it says nothing about whether

the CODE0 discipline (read,

close the source, re-derive against house standards) was actually followed.

License-clean code that is still a verbatim copy is still a violation of

that rule. Run both checks; treat neither as a substitute for the other.

Procedure

  1. Identify the source — the URL or repo path being borrowed from, and

the exact commit or blob SHA the snippet was taken from (`git log -1

--format=%H -- <path>` on the source repo, or the URL's own commit ref).

  1. Detect the source's license. Check, in order: a LICENSE/

LICENSE.md/COPYING file at the source repo root; the source's

package.json "license" field; its composer.json "license" field;

an SPDX header comment in the file itself. If none resolve to a known

SPDX id, the license is unknown — never guess permissive.

  1. Detect this repo's target policy. Run:

```bash

npx tsx node_modules/@event4u/agent-config/src/scripts/detect_target_license.ts . --json

```

If license-policy.yaml exists at the repo root, read its

policy.{allow,conditional,deny} buckets directly. If it does not (dry

run only), derive the same buckets by hand from this repo's own

LICENSE file and the compatibility matrix in

node_modules/@event4u/agent-config/src/scripts/_lib/detect_target_license.ts

(COMPATIBILITY_MATRIX/classifyBorrow).

  1. Classify the borrow. Map the source's SPDX id to its source class

(permissive / weak-copyleft / gpl-2.0 / gpl-3.0 / agpl / sspl /

unknown), then read the verdict off the target's policy buckets:

allow, conditional (escalate), or deny. A source license of

unknown is always deny — no exception.

  1. Act on the verdict:

the user with the exact matrix cell that triggered it (per

CODE0) — never

auto-clear a conditional verdict.

scratch, find a permissively-licensed equivalent, or ask the

maintainer for an explicit, recorded exception.

  1. Draft the ledger entry — one JSON object matching

node_modules/@event4u/agent-config/src/scripts/schemas/provenance-borrow.schema.json (source_url,

license, source_sha, borrowed_at, files, transformation_note,

cleared_by). Write a transformation_note that names a real

structural change — rename-only phrasing (e.g. "renamed variables",

"cosmetic rename") is rejected by lint_provenance.ts even if the code

has not landed yet, so draft it honestly against what will actually

change.

  1. Present the draft to the user before appending it. Once the

re-derived code lands, append the confirmed entry to

provenance/borrows.jsonl and verify:

```bash

npx tsx node_modules/@event4u/agent-config/src/scripts/lint_provenance.ts

```

Exit 0 confirms the entry is schema-valid, license-compliant, and its

transformation note passed the rename-only phrase check.

Output format

  1. The classification verdict (allow / conditional / deny) with the

exact source class → target class cell that produced it, and the source

license's SPDX id (or unknown).

  1. The draft ledger entry as a fenced JSON block, ready to append verbatim

once the user confirms it.

  1. For conditional or deny, the specific escalation question or refusal

reason presented to the user — never a silently auto-resolved verdict.

Gotcha

code-provenance's read-close-re-derive discipline regardless of the

license verdict.

absent license file defaults to strictest (unknown → deny), not to

permissive.

stop pending human escalation; treating it as advisory is the exact

Q1 workspace-license failure mode the roadmap's council resolved against.

the policy by hand from the matrix; a missing policy file is a detection

gap, not a green light.

Do NOT

first.

linter outright and must escalate.

happening this turn.

formatting change — describe the real structural change, or don't borrow.

See also

answers step 3 of.

regenerates docs/THIRD-PARTY-NOTICES.md once the entry lands.

on-demand similarity scan for suspicious diffs, not for a single known

source.

node_modules/@event4u/agent-config/src/scripts/schemas/provenance-borrow.schema.json — the ledger + its

contract.

shape for conditional/unknown verdicts.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.