Skip to main content

aipr

CI Python License Stars

AI Policy Read - read an open-source repository's AI contribution policy before you (or your agent) contribute.

aipr fetches the governance files that usually carry AI rules (CONTRIBUTING.md, AI_POLICY.md, AGENTS.md, CLAUDE.md, ...), classifies the repository's stance with weighted phrase matching, and answers one question: can an AI-assisted or autonomous contribution land here?

$ aipr asciimoo/hister
aipr: asciimoo/hister
[BLOCKED] human-only policy
sources: CONTRIBUTING.md, README.md
confidence: 1.0  score: 19.0
autonomous contribution: NOT SAFE - require human co-authorship
  [+5.0] ...Issues and PR descriptions must be fully human-written...
  [+5.0] ...AI should never be the main author of the PR...

$ aipr apache/maka
aipr: apache/maka
[UNKNOWN] no explicit AI policy found
exit=2

Why

More repositories are publishing explicit AI policies - from "we welcome AI-assisted work" to "agents are strictly forbidden". Violating one burns the contributor (and, for autonomous agents, the operator): rejected PRs at best, blocks at worst. aipr makes the check mechanical and cheap, for humans deciding where to spend review effort and for agents deciding where to spend their quota.

Install

# 1. From PyPI
pip install aipr-py

# 2. Standalone from GitHub
pip install git+https://github.com/yunaremaia/aipr.git
# requires Python 3.10+; GH_TOKEN recommended (anonymous API calls rate-limit fast)
export GH_TOKEN=ghp_xxx   # classic token with public repo read access

# 3. As a GitHub CLI extension (recommended)
gh extension install yunaremaia/aipr

The gh extension install method is the easiest — after install, gh aipr OWNER/REPO works immediately.

No dependencies beyond the standard library. pytest only to develop.

Usage

Standalone

aipr OWNER/REPO            # classify a GitHub repository
aipr --text FILE           # classify a local governance file
aipr --json OWNER/REPO     # machine-readable output
aipr --sarif OWNER/REPO    # SARIF 2.1.0 output for GitHub Code Scanning

As a GitHub CLI extension

After gh extension install yunaremaia/aipr, use gh aipr identically:

gh aipr OWNER/REPO
gh aipr --json OWNER/REPO
gh aipr --sarif OWNER/REPO
gh aipr --text FILE

Exit codes are preserved (0/1/2) for CI conditionals.

init — scaffold AI policy files

Generate AI_POLICY.md and AI_TOOL_POLICY.md in your repo:

aipr init [--dir .] [--type disclose|permissive|human_only] [--org ORG]

Presets:

  • permissive — explicitly welcomes AI-assisted contributions (aipr-safe)
  • disclose_ok (default) — allowed with Assisted-by: AI disclosure trailer
  • human_only — AI must not be the main author (NOT autonomous-safe)

Verdicts

Verdict Meaning Autonomous-safe?
human_only AI must not be the main author / human-written only / bans agents no
restrictive heavy process: mandatory disclosure + human-in-the-loop requirements no
disclose_ok allowed with a disclosure trailer (Assisted-by: AI) yes*
permissive explicitly welcomes AI-assisted contributions yes
unknown no explicit policy found ask first

* still follow the disclosure rules - "safe" means no human co-authorship required by policy, not no obligations.

Exit codes (for CI and agents)

Code Meaning
0 all inspected repos are autonomous-safe
1 at least one repo is restricted or human-only
2 at least one repo is unknown / no policy found (ranks worse than 1)
64 usage error

Batch mode: aipr owner/repo1 owner/repo2 ... prints one block per repo (JSON array with --json) and the exit code reflects the worst result — so an unverified repo can never pass a gate silently.

Policy fetches are cached on disk for 24h (~/.cache/aipr, configurable via AIPR_CACHE_DIR / AIPR_CACHE_TTL), so repeated scans cost zero API calls. Use --no-cache to force a fresh fetch.

How classification works

Weighted regex matching over concatenated governance text. Restrictive phrases score positive ("must be fully human-written" +5), permissive ones negative ("we warmly welcome AI-assisted" -3.5). The strongest signals force the verdict; weak mixed signals lean restrictive on purpose - when in doubt, do not send a bot.

Known limits: English-only patterns; phrase matching cannot understand nuance; a repo can carry policy in unusual files we don't probe. Treat UNKNOWN as "read it yourself".

CI/CD Integration

Block PRs Violating AI Policy

Drop .github/workflows/aipr.yml into your repository to automatically block pull requests targeting repos with human-only or restrictive AI policies:

# .github/workflows/aipr.yml – block PRs against repos with human-only AI policies
name: AI Policy Check
on:
  pull_request:
    branches: [main, master]

jobs:
  aipr:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-python@v5
        with:
          python-version: "3.10"
      - run: pip install git+https://github.com/yunaremaia/aipr.git
      - name: Check AI policy
        run: |
          aipr "$GITHUB_REPOSITORY" --json || true
          # Exit 1 = human_only/restrictive (block)
          # Exit 2 = unknown (warn, not block)
          aipr "$GITHUB_REPOSITORY" --json | jq -e '.verdict == "human_only" or .verdict == "restrictive"' && exit 1 || exit 0

GitHub Code Scanning (SARIF)

Use --sarif to output SARIF 2.1.0 (Static Analysis Results Interchange Format) and upload to GitHub Code Scanning. This surfaces AI policy compliance as alerts in the GitHub Security tab.

# Generate SARIF output
aipr --sarif OWNER/REPO > aipr-results.sarif
# Upload to GitHub Code Scanning via GitHub Actions:
#   github/codeql-action/upload-sarif with sarif_file: aipr-results.sarif

Verdict mapping to SARIF levels:

  • human_only / restrictive → error (blocks contribution)
  • unknown → warning (needs manual review)
  • permissive / disclose_ok → note (safe to proceed)

Example GitHub Actions workflow snippet:

name: AI Policy Check (SARIF)
on:
  pull_request:
    branches: [main]

jobs:
  aipr-check:
    runs-on: ubuntu-latest
    permissions:
      security-events: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - run: pip install git+https://github.com/yunaremaia/aipr.git
      - run: aipr --sarif ${{ github.event.pull_request.head.repo.full_name }} > aipr-results.sarif
      - uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: aipr-results.sarif

Status

Early beta - battle-tested against a handful of real policies (hister, modular, polars, MDAnalysis, maka). Rule additions welcome: open an issue with the policy text and the verdict you expected.

If this tool is useful to you, a star helps other people find it.

  • agent-guard — enforce guardrails on AI agent tool calls
  • agentcost — track and attribute LLM spend per agent
  • gfi — find well-scoped good first issues to start on
  • oss-contribution-finder — find OSS projects ready to contribute to

Part of a family of focused, single-purpose developer tools — each one does one thing and does it well.

License

MIT

Metadata

Release files for aipr-py 0.2.5

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

Source distribution (sdist)

Source distribution for aipr-py 0.2.5
File Size Uploaded
aipr_py-0.2.5.tar.gz 30.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aipr-py 0.2.5
File Interpreter ABI Platform
aipr_py-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 49.0 kB

Release files / aipr_py-0.2.5.tar.gz

Download URL aipr_py-0.2.5.tar.gz
Size 30.0 kB
Tags Source
SHA-256 checksum
How to use checksums
54a5590072b7afaf8b3efb3971d4de9064be8e8e7a0486c78960f815aa3567c0
BLAKE2b-256 checksum
How to use checksums
249ec20c8fa78c1a91079730ace618895654bdbab945d6e5dd30bc6fc0e31f65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 1, 2026.

Transparency log

Release files / aipr_py-0.2.5-py3-none-any.whl

Download URL aipr_py-0.2.5-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c5be31fec09c919d716c99dd6b773c9f17361964573b28a01a735f8ced5c86c
BLAKE2b-256 checksum
How to use checksums
bffedf1fc014f596fc30e6ff5138839d11e38dd43884f7166e067669554f0410
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files

0.2.4

2 release files

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