Skip to main content

oss-ai-policy-check

Finds a repository's AI contribution policy and links every line it cites at a fixed commit, so you can check the text yourself. When it cannot decide what the policy says, it answers needs-review instead of guessing.

The strength of the tool is locating the policy text and pointing at the exact lines. The class it puts on top (banned, restricted, disclosure-required, ...) is a hint with a confidence level, not a ruling: read the cited lines. Contributors and coding agents get the rules before they open a pull request; maintainers can test that a machine finds the policy they wrote.

Quick start

Python 3.10 or newer, no dependencies, no login. The optional Claude mode adds one extra package and your own key (see Claude mode).

uvx oss-ai-policy-check owner/repo
pip install oss-ai-policy-check && oss-ai-policy-check owner/repo

pipx run oss-ai-policy-check owner/repo works too. As a GitHub Action (pinned to a release tag; for the strictest pinning use the full commit SHA of the tag, see docs/action.md):

permissions:
  contents: read

steps:
  - id: policy
    uses: KemalG-u/oss-ai-policy-check@v0.3.0
    with:
      repo: owner/repo        # default: the repository running the workflow
      fail-on: banned         # empty means report only

From a clone of this repository:

python -m venv .venv
.venv/bin/python -m pip install -e .        # Windows: .venv/Scripts/python
.venv/bin/oss-ai-policy-check owner/repo

Options: --ref REF (branch, tag or SHA), --path DIR (read a local clone of owner/repo instead of GitHub), --format text|json|markdown|sarif, --fail-on banned|restricted|disclosure-required|needs-review, --no-cache (skip the disk cache), --no-org (do not read the owner's .github repository), --classifier rules|claude and --model ID (optional Claude mode, below), --version. Fetched files are cached on disk by repository and commit SHA (%LOCALAPPDATA%\oss-ai-policy-check\cache on Windows, $XDG_CACHE_HOME or ~/.cache elsewhere).

Example output

Abridged output of a real run on 2026-11-22. Repositories change their policies; the SHA shows what was read.

VERDICT restricted - ghostty-org/ghostty @ 6d244209978e599277904ff3ced7b8a2ebcc528d (6d244209978e)
confidence: high
read status: complete within scope
evidence (12):
  - restricted (high): AI_POLICY.md:21 - - **No AI-generated media is allowed (art, images, videos, audio, etc.).**
    https://github.com/ghostty-org/ghostty/blob/6d244209978e599277904ff3ced7b8a2ebcc528d/AI_POLICY.md#L21
  - disclosure-required (high): AI_POLICY.md:5 - - **All AI usage in any form must be disclosed.** You must state
    https://github.com/ghostty-org/ghostty/blob/6d244209978e599277904ff3ced7b8a2ebcc528d/AI_POLICY.md#L5
  ... (10 more)
AI mentions without a classified rule (10):
  - ... (listed in full, not hidden)

When the files hold AI-policy text the tool cannot decide on, it says so instead of guessing (abridged):

VERDICT needs-review - mozilla-firefox/firefox @ a3178f3cbfac6e25d5bc7b6365c4ff520a42205e (a3178f3cbfac)
confidence: low
NEEDS HUMAN REVIEW (no-rule-decision): These paragraphs name AI and state a rule, but no rule of the tool decided on them.
evidence (4):
  - needs-review (low): docs/contributing/ai-coding.md:13 - AI-assisted contributions must meet the same standards of correctness, security, and maintainability as any other
    https://github.com/mozilla-firefox/firefox/blob/a3178f3cbfac6e25d5bc7b6365c4ff520a42205e/docs/contributing/ai-coding.md#L13
  ... (3 more)

Verdicts

One verdict per report, strongest signal first. Treat it as a hint: confidence (high or low) says how sure the tool is about what it read, and complete is a separate flag.

verdict meaning
banned a quoted line says AI-assisted work is refused
restricted AI use is conditional: a human in the loop, own-voice descriptions, limits on scope
disclosure-required AI use has to be disclosed or labelled
needs-review the tool abstains: the files hold AI-policy text it cannot decide on credibly (no rule matched it, or the signals conflict, for example a welcome next to a ban). A person must read the cited paragraphs; this is not permission
permitted explicit, positive evidence only, never inferred from silence (emitted for an explicit welcome statement such as "AI-assisted contributions are welcome")
no-policy-found no AI-policy text in the scanned scope; this is not permission

The tool abstains instead of guessing: no-policy-found is returned only when no paragraph pairs an AI term with a policy verb. A ban sentence that carries a narrowing qualifier ("unreviewed", "fully", "unless") is reported as restricted, not banned, and marked low confidence; so is a verdict that rests on one sentence or on a loose heuristic rule. The order of precedence is in docs/schema.md.

complete is false when a candidate file could not be read, a tree was truncated, the file limit was hit, or repository discovery failed.

"No policy found" and "could not read" are different answers. A file that does not exist is recorded as missing: nothing is there. A file that exists but failed to load is recorded as error: unknown. When complete is false and nothing restrictive was found, the tool exits with code 3 and says no decision is possible, because a restriction may sit in the file it could not read. Printing "no policy" in that case would tell a contributor that AI use is fine when the tool simply did not see the text.

Exit codes

code meaning
0 permitted, no-policy-found, disclosure-required or needs-review
10 restricted
20 banned
11 disclosure-required, only with --fail-on disclosure-required or needs-review
12 needs-review, only with --fail-on needs-review
3 incomplete and undecided: complete is false and nothing restrictive was found
2 usage error

--fail-on V exits non-zero only when the verdict is at least as strict as V. A banned or restricted verdict stands even when complete is false. The JSON report is schema_version "2" (it adds the needs-review verdict, confidence and review_reason; migration notes are in docs/schema.md).

Claude mode (optional)

Off by default. The default classifier is deterministic: fixed rules, no key, no network beyond GitHub. Claude mode is an opt-in second reader for the paragraphs the rules find hard:

pip install 'oss-ai-policy-check[claude]'
export ANTHROPIC_API_KEY=...
oss-ai-policy-check owner/repo --classifier claude [--model ID]

It needs your own Anthropic credentials; the tool never reads, prints or logs a key. Only the AI-policy paragraphs of the fetched files are sent to the Anthropic API under your account. Every evidence line and link is still built from the fetched files, never from the model's text, and a failed call keeps the deterministic verdict. How the two verdicts are combined, what is sent, cost and failure behaviour: docs/llm-mode.md. Measured effect: Measured accuracy.

GitHub Action

The action reads a repository's policy, writes the report to the job summary and returns the verdict as an output (example in the quick start above). It runs the deterministic rules only; Claude mode is not available in the action. Inputs, outputs, permissions and more examples are in docs/action.md.

Measured accuracy

Both modes were run once on a 60-repository set that had never been used to write or tune a rule or the prompt (called gold4 here). Labels are one person's reading of the written rubric (tests/golden/RUBRIC.md), pinned to commit SHAs. "Correct" means the verdict equals the label; a needs-review answer counts as not correct.

correct decided rows correct needs-review policy missed Wilson 95% interval (correct)
Rules only (default) 42 of 60 (70.0%) 42 of 53 7 3 57% - 80%
Claude mode (--classifier claude) 55 of 60 (91.7%) 55 of 56 4 1 82% - 96%

"Decided rows" are the rows where the tool gave a class instead of abstaining. "Policy missed" is a repository that has an AI policy but got no-policy-found.

Caveats, all of which matter:

  • n = 60 and a single run. The two intervals do not overlap, but a different 60 repositories or a second run (the model's output is not deterministic) would move the figures.
  • The judge was Claude Sonnet 5.5 through a subscription, standing in for the API model. The default model of Claude mode is claude-opus-5-5, which was not the model measured.
  • The labels were written by one annotator.
  • A label is a reading of the policy text at one commit; the label itself can be wrong or arguable at the restricted / disclosure-required boundary.

What this means in practice: the evidence lines and links are exact and are the product; the class is a hint with a confidence level. In this run Claude mode gave fewer wrong decided verdicts (1 against 11), fewer abstentions and fewer missed policies, at the price of a key, a network call per repository and non-deterministic output (docs/llm-mode.md). Older figures on the 151-repository development set, which was read while tuning the rules, are optimistic and kept only as history in docs/limitations.md.

How it works and its limits

  • How it works: which files are read and how the verdict is chosen.
  • Limitations: known gaps and how to report a wrong classification.

The classifier is regex based and can be wrong in both directions. A verdict is not legal advice and not permission to contribute with AI. The text of the policy itself is what counts: follow the linked lines, not the label.

Privacy

No token is needed. In the default mode the tool makes read-only GET requests for public files to GitHub's REST API (api.github.com) and to raw.githubusercontent.com, and sends nothing else anywhere: the repository name, branch and file paths are the only data in those requests. It does not clone the repository, run any of its code, or write to GitHub. An optional GITHUB_TOKEN or GH_TOKEN only raises the API rate limit and goes to those two GitHub hosts only; the gh CLI is used only as a fallback when the REST API is rate limited or unreachable. No analytics, no telemetry, and the report never includes local paths. The only thing written locally is the commit-keyed file cache (--no-cache turns it off). Quotes are cut at 15 words and 300 characters.

With --classifier claude the AI-policy paragraphs of the fetched public files are also sent to the Anthropic API under your account, with your credentials; nothing else is sent.

Project

AI-USE.md says how this repository is produced. Contributions: CONTRIBUTING.md. Security reports: SECURITY.md. Changes: CHANGELOG.md. License: MIT, see LICENSE.

Metadata

Release files for oss-ai-policy-check 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oss-ai-policy-check 0.3.0
File Size Uploaded Provenance Actions
oss_ai_policy_check-0.3.0.tar.gz 163.7 kB With provenance Details for oss_ai_policy_check-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oss-ai-policy-check 0.3.0
File Interpreter ABI Platform Actions
oss_ai_policy_check-0.3.0-py3-none-any.whl Python 3 none any Details for oss_ai_policy_check-0.3.0-py3-none-any.whl

Total release size: 227.2 kB

Release files / oss_ai_policy_check-0.3.0.tar.gz

Download URL oss_ai_policy_check-0.3.0.tar.gz
Size 163.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dd64ff408597fde9f86dfdf6695956f16de9e51b42f7c0d458c692fb9470de49
BLAKE2b-256 checksum
How to use checksums
f3b264db11f222a5064db0fdfb7200de4796361eb46dc68fd0e897d5a6820217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / oss_ai_policy_check-0.3.0-py3-none-any.whl

Download URL oss_ai_policy_check-0.3.0-py3-none-any.whl
Size 63.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d507f9b4b489a1629e04b837848a6defa257f35493db0ed0187b5158373d612
BLAKE2b-256 checksum
How to use checksums
c62e2829bfc3b9f11d1df5001f7a6727c6231b2879521dae55416e2158ddfbc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for oss-ai-policy-check 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for oss_ai_policy_check-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page