Skip to main content

pywrit

The Writ CLI — the gate before the write.

pip install pywrit
writ key --email you@company.com

Find the consequential writes your agents can perform. writ scan . is a free, local scan (no API key) that lists the writes it finds in your agent code. Then gate them: Writ is an allow/deny gate you put in front of your agent's writes, and each check writes a tamper-evident receipt to your audit log. No more wondering who called what, or when.

writ scan finds 4 writes in a Python agent; writ scan --apply gates all of them

What it does

  • writ key — Get a free API key (1,000 receipts/month, no card)
  • writ check — Ask the gate before a write (ALLOW or DENY)
  • writ revoke — Kill switch: revoke a principal's tokens in one click
  • writ receipts — See your audit log
  • writ scan — Find writes in your repo (Python: scan + instrument; TS/JS: scan only)

Scanning a repo

writ scan ./my-repo                       # report writes, print the diff, write writ-policy.json
writ scan ./my-repo --apply               # prompt, then insert gates (Python files only)
pip install 'pywrit[polyglot]'            # optional: also scan TypeScript / JavaScript

writ scan on a TypeScript support agent: 1 of 5 write sites gated

  • Python (.py): parsed with the stdlib ast, no extra dependencies. Finds DB calls, HTTP clients, file writes, email, queues, and AWS SDK writes. writ scan --apply inserts a _writ_check(...) gate at the top of each writing function.
  • TypeScript / JavaScript (.ts .tsx .js .jsx .mjs .cjs): scan only, never rewritten, and needs the polyglot extra (tree-sitter). Without it, writ scan prints a one-line install hint and keeps scanning Python. Each finding is listed as file:line [category] rule function(): snippet, and its verb goes into writ-policy.json like a Python finding. Detected:
    • HTTP: fetch / axios / got / ky / superagent with a literal POST/PUT/PATCH/DELETE method, axios.post|put|patch|delete, http(s).request with a write method
    • Files: fs.writeFile, appendFile, unlink, rm, rename, mkdir, … plus Sync and fs/promises variants
    • SQL: literal INSERT/UPDATE/DELETE/DROP/ALTER/… strings passed to query / execute / raw (including tagged templates such as prisma.$executeRaw)
    • SDKs: Stripe create|update|del (e.g. stripe.refunds.create), Prisma create|update|upsert|delete|deleteMany|updateMany, knex/db builders insert|update|del, child_process exec/spawn
    • A function that already calls writCheck(...) / writ_check(...) counts as gated.
  • Skipped: node_modules, dist, build, hidden dirs such as .git and .next, virtualenvs, and test files. TS/JS scanning also skips vendor, *.d.ts, *.min.js, and files over 1 MB, and respects .gitignore when the repo is a git checkout.
  • TS/JS limitations: calls are matched by name, so HTTP methods, SQL strings, or options held in variables (fetch(url, opts), db.query(sql)) are not detected, and route definitions like router.post(...) are deliberately not flagged. The Writ Score grades Python findings only; the ts/js gated: N/M line is the TS/JS coverage number.

Docs

Full docs at docs.withwrit.com. Quickstart at docs.withwrit.com/quickstart.


Packaging notes (for maintainers)

Installable distribution of the Writ CLI. pip install pywrit gives you the writ command — no curl + chmod dance.

Layout

  • pyproject.toml — package metadata, writ console-script entry point
  • writ_cli/__init__.py — version
  • writ_cli/cli.py — the CLI itself (stdlib-only: argparse, json, urllib; TS/JS scanning imports tree-sitter only when the polyglot extra is installed)
  • tests/ — scanner tests: python -m unittest discover -s tests
  • Demo GIFs: recorded with VHS from docs/tapes/*.tape (repo root: docs/tapes/render.sh)

Relationship to gate/web/writ

gate/web/writ is the self-contained single-file script served by the Lambda at /writ (the curl -fsSL ... -o writ download path). It must stay a single file with no install step.

writ_cli/cli.py is the PyPI package source. The two files are currently byte-identical by copy. If you change CLI behavior, update both and keep them in sync — the download path and the pip path must behave the same.

Build & test locally

cd cli
python -m build                    # needs `pip install build`
pip install -e .                   # editable install, creates the `writ` command
writ --help

Publish

cd cli
python -m build
twine upload dist/*

Metadata

Release files for pywrit 0.1.4

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

Source distribution (sdist)

Source distribution for pywrit 0.1.4
File Size Uploaded Provenance Actions
pywrit-0.1.4.tar.gz 89.1 kB Without provenance Details for pywrit-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pywrit 0.1.4
File Interpreter ABI Platform Actions
pywrit-0.1.4-py3-none-any.whl Python 3 none any Details for pywrit-0.1.4-py3-none-any.whl

Total release size: 175.9 kB

Release files / pywrit-0.1.4.tar.gz

Download URL pywrit-0.1.4.tar.gz
Size 89.1 kB
Tags Source
SHA-256 checksum
How to use checksums
68df63574a5cc5e492a3fb14f266df4b9921c2c9328af9321a2394f8d1fc45cc
BLAKE2b-256 checksum
How to use checksums
37d299688c922613f4e82547359d6ba6ebb91d7c75113187cb8e499322ac066f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / pywrit-0.1.4-py3-none-any.whl

Download URL pywrit-0.1.4-py3-none-any.whl
Size 86.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6ce1fcbe2df2ae886a18b69e01f557259ad74391c98d978c63453637872e58b
BLAKE2b-256 checksum
How to use checksums
147013fe54f1e94384833e48c381c0b5dc538ebe6be0954e1470888f8a2e4bbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for pywrit 0.1.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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