Skip to main content

Universal Paper logo

Universal Paper

A first-order language for agreements between group purchasing organizations, suppliers, and members.

Universal Paper is a vocabulary, a grammar, and a set of validity rules. It is not an application. Anyone can verify an agreement written in it, offline, from the specification alone. The code here is a reference implementation of the language, never the language itself.

Website: universalpaper.org · Playground · FAQ

Status: UP/0.1-draft. Working draft, not yet reviewed by counsel. Until 1.0, changes to the spec may change what is valid and the hashes of Term definitions. Open questions are listed in DESIGN_NOTES.md. The pre-release audit is in AUDIT.md.

Path What it is
spec/ The language specification (start here)
DESIGN_NOTES.md What was cut, merged, or added, and why
schema/ JSON Schemas for every primitive and for trace files
src/universal_paper/ Reference interpreter (library and CLI)
examples/ Worked examples as full chains of signed events, plus traces
explorer/index.html Universal Paper Playground: an ecosystem view, the Playground (write, compare, history), and conformance (built from explorer/src/)
explorer/src/ The JavaScript second engine (up-crypto.js, up-engine.js), the random-run lab (up-lab.js), the history player (up-play.js), and the page
site/ The universalpaper.org website build (python3 site/build_site.py), deployed to GitHub Pages
tests/ Tests for every axiom, transition rule, clause form, and Term, plus cross-engine differential and fuzz tests
AUDIT.md Pre-release audit: findings, fixes, and what remains open

Quick start

Requires Python 3.11+ and Git. From an empty terminal on macOS or Linux:

git clone https://github.com/Uppercentile/universal-paper.git
cd universal-paper
python3 -m venv .venv && source .venv/bin/activate
pip install -e '.[test]'

up validate examples/conventional/bundle.json

On Windows (PowerShell), activate the environment with .venv\Scripts\Activate.ps1 instead of source .venv/bin/activate. The virtual environment keeps the install out of your system Python, which recent macOS and Linux releases refuse to modify (PEP 668).

Then try the other commands, from the same folder with the environment active:

up derive examples/conventional/bundle.json --at 2027-04-30T00:00:00Z   # status, tiers, prices and what is owed on a date
up render examples/conventional/bundle.json --chain 0                   # the agreement as contract text
up render examples/confidential/bundle.json --chain 0 --hashes-only     # the same with every private value sealed
up trace  examples/conventional/bundle.json -o conventional.trace.json  # every event, every check, every state hash
up hash   spec/06-terms/UP-Admin-Fee.json                               # the content address of a Term definition
python -m pytest                                                        # the full test suite (Node.js 20+ for the JavaScript parts)

up simulate BUNDLE EVENTS.json runs your own hypothetical events forward against a bundle.

Command Does
validate Checks every agreement and every event in a bundle against the axioms. Exit code 2 if any event is rejected.
apply Applies one event to its chain's current state and prints the new state, or the rule that rejected it.
derive Reports each agreement's status, tiers, contract prices, and obligations at a time.
simulate Runs hypothetical events forward. Signatures are not required, but Mandate limits still apply.
render Prints the human-readable agreement text, fixed by the agreement's hash.
trace Writes a trace file: every event, every check, and each evaluator's state hash.

MCP server for agents

The official Universal Paper Model Context Protocol server is a read-only layer over the reference interpreter. It lets an agent check an agreement the same way every other party does, and test whether an action is within its Mandate before anyone signs. It holds no keys, signs nothing, and writes nothing.

Use it How
Hosted, nothing to install https://mcp.universalpaper.org/mcp (Streamable HTTP, no sign-in)
Local, from PyPI uvx universal-paper-mcp
Local, from this repo pip install -e '.[mcp]' then up-mcp

Claude Code: claude mcp add --transport http universal-paper https://mcp.universalpaper.org/mcp, or locally claude mcp add universal-paper -- uvx universal-paper-mcp. Other clients: {"mcpServers": {"universal-paper": {"command": "uvx", "args": ["universal-paper-mcp"]}}}, or the hosted URL wherever a client takes a remote server. It is listed in the MCP Registry as io.github.Uppercentile/universal-paper.

The hosted endpoint (up-mcp --hosted, built from the Dockerfile) is stateless: no sessions, storage, access logs or telemetry, and it never reads file paths, so a bundle is passed as an object or JSON text. It counts calls per tool name in memory and shows the totals at /stats; that is its only usage signal. How it is deployed and released: deploy/README.md.

Tool Does
validate_bundle Checks every agreement and event against the axioms and says which rule rejected what.
derive_state Status, tiers, contract prices and obligations at a time.
check_event Dry-runs one signed event against its chain's current state.
simulate_events Runs hypothetical, unsigned events forward. Mandate limits still apply.
render_text The human-readable agreement text, fixed by its hash (optionally as an outsider sees it).
hash_object The content hash of any JSON value.
list_terms, explain_term The Term library: parameters, claims, rendering template, provenance and hash.
get_example One of the worked example bundles.

Bundles can be passed as JSON objects, JSON text, or (local server only) file paths.

Examples

All parties, identifiers, prices, rates, quantities, and dates in the examples are hypothetical.

  • Conventional: an aggregator–supplier agreement with three tiers and an admin fee, two members joining through participation and tier attestation, three months of sales reports, fee payments, one tier change, and a fee disclosure.
  • Generative: an aggregator with no staff, run entirely by an agent under a Mandate, alongside a conventional aggregator. One hospital, acting through its own agent, participates in both at once without conflict. Two out-of-bounds agent actions are rejected under A9.
  • Overlay: a 2024 contract described in Universal Paper in 2027, identified by its document hash, without renegotiation.
  • Confidential: the conventional story with every price, rate, quantity, and amount sealed. An evaluator with no disclosures reaches the same verdicts and state hashes.

python3 examples/build_examples.py rebuilds every bundle and trace. Output is byte-identical across runs. Example keys and salts are derived from fixed seeds so the examples are reproducible; real keys and salts must be random.

Playground page

Open explorer/index.html in a browser. It is one self-contained file; apart from web fonts it makes no network requests. Its look follows the shared design tokens in explorer/src/tokens.css, also used by the developer explainer. It has four parts:

  • How it works: a scroll explainer that follows one fee clause from words to a fingerprint, signatures, and a caught edit, computed live. On a phone the visual pins at the top and the steps scroll under it.
  • Vision: an illustration of where Universal Paper could sit, under apps for contracting, procurement, pricing, and settlement, with agents acting for parties under Mandates. The apps are hypothetical. The events are not: each scenario is generated, signed, and checked by the engine in the page, including an agent action outside its Mandate that every party rejects.
  • Playground: start from an example and change the few things people try first (the fee, the length, the supplier, whether the rate is sealed) while the cover sheet, the contract, and the fingerprint update. Every clause stays editable under “Edit every clause”. Compare shows what changed between two versions, clause by clause and word by word, and whether existing signatures still cover it. History signs the agreement and plays it forward: enter monthly sales and payments and see the reports, fees, and the status of every duty on any date.
  • Conformance: the test suite by file, the audit findings, and a button that runs random agreements and attacks in the browser against eight invariants.

Everything live runs on a second, independent engine in JavaScript (explorer/src/). tests/test_js_conformance.py requires it to reproduce every Python trace, rendering, and simulation byte for byte, and to pass every invariant on 60 fixed seeds. Rebuild the page after editing explorer/src/ with python3 tools/build_explorer.py; add --run-tests to run the suite first and record the result shown on the page (explorer/conformance-results.json). The plain build is deterministic so CI can check the committed page.

How it is tested

python -m pytest runs about 170 tests in a few minutes. Node.js 20 or later is needed for the JavaScript parts, which are skipped without it. CI runs everything on Python 3.11 to 3.13.

  • Rules. Every axiom (A1 to A13), every transition rule, and every clause form has tests that build small hypothetical agreements and try to break them.
  • Every Term. All sixteen Terms are executed in a valid agreement, every parameter is checked against its declared type, and every claim type is attested, acknowledged, and attempted with ill-typed data.
  • Two engines, one answer. The JavaScript engine must reproduce every Python trace, render, and simulation byte for byte, including a trace for every claim type of every Term. Differential tests run both engines on tens of thousands of seeded random inputs (canonical JSON, hashes, Ed25519 edge cases, times, periods, exact decimals, type checks) and require identical results, including identical rejections.
  • Published vectors. Ed25519 against RFC 8032, SHA-256 and SHA-512 against known digests, and a check that the small-order key table is exactly the curve's torsion points.
  • Hostile input. Hypothesis mutates signed example events and feeds arbitrary JSON to the evaluator: altered events are always rejected, nothing crashes or hangs, and derived values stay computable. HYPOTHESIS_PROFILE=deep runs a longer search.
  • Reproducibility. Rebuilding the Term library, examples, traces, and the Playground page must produce byte-identical files.

See CONTRIBUTING.md for the full list and how to add tests.

Contributing and security

Contributions to the specification and the code are welcome: see CONTRIBUTING.md and the Code of Conduct. Please report vulnerabilities privately, as described in SECURITY.md. Changes are recorded in CHANGELOG.md.

Licenses

Universal Paper was created by Uppercentile, which offers it to the market for free. Anyone may use, implement, extend, fork, and build commercial products on it, without permission or payment. No account, fee, or license key is ever required.

What License
Specification, Term library, and documentation (spec/, DESIGN_NOTES.md, website text) CC BY 4.0
Code, JSON Schemas, tools, tests, and test vectors Apache-2.0 (see NOTICE)
Example agreements, bundles, and traces (examples/) CC0 1.0 (public domain)

To credit the specification: "Universal Paper" specification by Uppercentile, https://universalpaper.org, licensed under CC BY 4.0. Details: universalpaper.org/license. Uppercentile is the specification's steward, not its owner; see the neutrality charter.

Metadata

Release files for universal-paper 0.1.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 universal-paper 0.1.0
File Size Uploaded Provenance Actions
universal_paper-0.1.0.tar.gz 87.7 kB With provenance Details for universal_paper-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for universal-paper 0.1.0
File Interpreter ABI Platform Actions
universal_paper-0.1.0-py3-none-any.whl Python 3 none any Details for universal_paper-0.1.0-py3-none-any.whl

Total release size: 153.2 kB

Release files / universal_paper-0.1.0.tar.gz

Download URL universal_paper-0.1.0.tar.gz
Size 87.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ea21fce0465a3aa5ddd6dc64683de816df165ab5c3e32ec2a26c01e684c26650
BLAKE2b-256 checksum
How to use checksums
0756587b1d0265001535ca4650be48b3e587e88ce810df6b0eb567ebf93bb749
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 24, 2026.

Transparency log

Release files / universal_paper-0.1.0-py3-none-any.whl

Download URL universal_paper-0.1.0-py3-none-any.whl
Size 65.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ee32ac1270e0c49bc8db091f24a683f953d082a53e8db15809865ef14bef942
BLAKE2b-256 checksum
How to use checksums
c603ce1934280cdad8b7cb1b8e94830067b333add2643728bd5c1aa648e82cb8
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 24, 2026.

Transparency log

Security for universal-paper 0.1.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 universal_paper-0.1.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 24, 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