Skip to main content

file_policy

Diff-scoped file policy runner for verification rule packs. One combined git changed-path pass, per-path read cache, TOML rule registry, JSON-lines violations, and exit codes for CI.

Rule pack corpora are authored in agent-standards (file_policy/rule_packs/<slug>/). Assemble copies only <slug>.py into app repos as flat file-policy/packs/<slug>.py; policy and fixtures ship in file-policy/assembled_policy.py. This repo is the engine only.

Install

Engine development:

pip install -e ".[dev]"

App repos: assemble.py verification writes file-policy/requirements.txt from agent-standards file_policy/engine_version.txt. This repo: pushes to main run .github/workflows/release.yml: tests, then if PyPI already has the version in pyproject.toml CI bumps the patch, then builds and publishes in the same run (see AGENTS.md — bot pushes do not enqueue a second workflow run). Optional tag v* still publishes. scripts/verify/file_policy.ps1 bootstraps .venv-file-policy.

pip install file-policy==0.1.12

One-time publish setup (then forget it): On PyPI → file-policy → Publishing, add a trusted publisher — Owner sidboilie, Repository file-policy, Workflow release.yml, Environment (leave blank). GitHub repo can stay private; the PyPI wheel is public and needs no install auth. No PYPI_API_TOKEN secret.

CLI

python -m file_policy run --repo ROOT [--manifest file-policy/manifest.toml] [--packs PACKS_DIR] [--git-base BASE] [--scope changed|full] [--verbose]
python -m file_policy rule test SLUG --repo ROOT [--manifest file-policy/manifest.toml] [--packs PACKS_DIR]
python -m file_policy rule new SLUG --packs PACKS_DIR [--kind per-file|multi-file]

Exit codes: 0 clean, 1 violations, 2 usage/config errors.

Rule pack layout

Authoring (agent-standards): file_policy/rule_packs/<slug>/ with meta.toml, fixtures.toml, and <slug>.py.

Pack language: meta.toml must declare exactly one language: language = "…" (dart, rust, sql, …). Do not use languages (invalid). fixtures.toml does not define language per row; any stray language key there is ignored — meta.toml is the only language source.

App repo after assemble: file-policy/packs/<slug>.py (scripts only) plus file-policy/assembled_policy.py and file-policy/manifest.toml.

Legacy: PACKS_DIR/<slug>/ with meta.toml is still supported when not using assembled_policy.

MDL (minimal data loading)

from file_policy import run_minimal_data_loading

violations = run_minimal_data_loading(repo_root, config_dict, git_base)

Tests

python -m pytest tests/ -q

Metadata

Release files for file-policy 0.1.13

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

Source distribution (sdist)

Source distribution for file-policy 0.1.13
File Size Uploaded Provenance Actions
file_policy-0.1.13.tar.gz 25.9 kB With provenance Details for file_policy-0.1.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for file-policy 0.1.13
File Interpreter ABI Platform Actions
file_policy-0.1.13-py3-none-any.whl Python 3 none any Details for file_policy-0.1.13-py3-none-any.whl

Total release size: 56.9 kB

Release files / file_policy-0.1.13.tar.gz

Download URL file_policy-0.1.13.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f4a2483ea6234d01212e4429f82c64f0bc3b950f5994622d54a1be3bc218cd33
BLAKE2b-256 checksum
How to use checksums
a36c3113b2802b336062b7923ddcd60a9bf8d4ec7ce375017682af7224819587
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 6, 2026.

Transparency log

Release files / file_policy-0.1.13-py3-none-any.whl

Download URL file_policy-0.1.13-py3-none-any.whl
Size 31.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58cae48593032726a1efa03cec66901b373c8b7362d5713c19b4d4114db9fc84
BLAKE2b-256 checksum
How to use checksums
5494553218fdc24b57561d9d8d4afd5add49120ac0f69e3dc1ced318cf42612f
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 6, 2026.

Transparency log

Security for file-policy 0.1.13

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 file_policy-0.1.13.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 6, 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