Overview
The Legal Context Protocol reference implementation: the ATR, its hash, and the hash bound into payments.
For AI agents: this page as Markdown, and llms.txt, the index of every page.
When one AI agent buys from another, it reads terms, perhaps negotiates, and pays. The Legal Context Protocol (LCP) binds the payment to the agreement's record: where the payment the buyer approves carries the record's hash, it shows which exact record the buyer approved, and that approval is the buyer's acceptance of that record; where it does not, the pairing's statement of what it proves says so.
@integraledger/lcp is its reference
implementation, for TypeScript and JavaScript. It assembles the record, hashes it, and carries the hash in the
payment, or beside it in an agreement payment, on the x402, MPP, checkout and card pairings it implements: on EVM
chains, Solana, the XRP Ledger and every other rail the rails guide lists.
npm install @integraledger/lcpIt needs Node.js >=24.22.1 (or Cloudflare Workers) and an ESM project. Getting started runs a
first payment in one program, and Upgrading says what a release may change and what changed in
0.6.0.
How it works
- The seller assembles the record. The Agentic Transaction Record holds a format marker, a per-transaction id, the values that tie it to this payment, and whatever the parties agreed, byte for byte.
- The seller advertises its hash. H goes into the payment challenge, beside an
httpslink to the seller's copy. - The buyer compares before it signs. It fetches the bytes, hashes them, and signs nothing unless they hash to H.
- The payment carries H. On most pairings the buyer signs a payment with H in the field its protocol or rail
provides: a nonce, a memo, a salt, an invoice field. Where the pairing's
data.coverageisnone, no public act the payer signs carries H, whatever the buyer signs, and the agreement payment, made first, is the proof. Each pairing'sdata.coveragesays which. - Anyone holding the record can match it. The seller reads H back from the payment where the pairing's
claimsis true, and on most rails from the settlement on chain.
The package fixes the bytes, the hash and where H rides. It does not decide what the record says, and it never compares amount, payee, asset, timing or payer with the record's content: that is between the parties, and the record is what they agreed.
Terms
These pages use each term in one sense:
| Term | Meaning |
|---|---|
| Agentic Transaction Record (ATR) | The agreement's record: the exact bytes the seller serves; assemble writes them as one JSON object. |
| ATR hash (H) | SHA-256 over the ATR's exact bytes. |
| Legal Context Protocol (LCP) | The pattern this package implements: H bound into the payment, so that where the payment the buyer approves carries H, that approval is the buyer's acceptance of that exact record; where it does not, the pairing's data.proves says so. |
| Pairing | A payment protocol, scheme and rail combination, such as x402/exact/eip155/eip3009. |
| Binding | How H rides in a pairing's payment: the field its specification defines. |
| Binding slot | The ATR member, written by the pairing's tie, that records the payment's values (the options and the request); assemble's binding argument. |
Binding, BINDINGS | In the API, a pairing object is typed Binding, and BINDINGS holds every pairing. |
| Buyer gate | The buyer-side check that compares the served bytes with H before anything is signed. |
| Seller | The party serving the resource. |
| Facilitator | The x402 role that verifies and settles. |
| Settler | This repository's x402 facilitator, @integraledger/profile-facilitator. |
| Vectors | The shared test cases that fix the rules byte for byte across languages. |
Where to start
| You are | Read |
|---|---|
| New to LCP | Getting started: one x402 payment, both sides, in one program. |
| Building a seller | Seller: assemble, advertise, check the payment, read the settlement. |
| Building a buyer | Buyer and the buyer gate. |
| Selling by channel, session or subscription | Channels, sessions and subscriptions. |
| Working on one protocol | x402, MPP, or agentic checkouts for ACP, UCP, AP2, ACK, card networks and A2A. |
| Working on one chain | Rails: the field H rides in on each chain and on Lightning. |
| Publishing your terms | Discovery: the document at /.well-known/legal-context.json. |
| Running an x402 facilitator | The settler and Run the settler: this repository's facilitator for the x402 pairings it settles. |
| Upgrading from an earlier release | Upgrading: what a 0.x release may change, and each change a caller of 0.5.x makes for 0.6.0. |
| Implementing LCP in another language | Vectors and the vector files. |
The documentation
- Concepts explain each rule: the ATR, the ATR hash, binding, pairings, the buyer gate, refusals, vectors and the settler.
- Guides walk each flow with a program you can run: seller, buyer, channels, sessions and subscriptions, x402, MPP, agentic checkouts, rails, discovery and running the settler.
- Reference: entry points, pairings, vector files and the API are generated from the package; refusal codes is written by hand, and CI checks that it lists every code the package returns. The settler reference is written by hand.
A citation LCP §N names section N of the published
Legal Context Protocol v1.0.
Every TypeScript program in these pages is compiled and run against the package in CI, and its output is checked
against what the page shows, except the settler's, which need a Postgres database and are marked no-check.
For AI agents
The documentation site publishes llms.txt, an index of every page that
names the versions the pages document. Each of its sections opens with one file of all its pages, with that file's
size: concepts,
guides,
reference and
API.
llms-full.txt holds every page in one file, larger than most context
windows. Each page is Markdown at its address with .md added, such as
/getting-started.md, or at its own address for a request whose
Accept header ranks text/markdown at least as high as text/html.
The site also serves the protocol's documents as this package ships them. Each profile is at /profiles/<name>.md,
listed in /profiles/llms.txt and gathered in
/profiles/llms-full.txt; each vector file is at
/vectors/<name>.json, listed in /vectors/llms.txt.
Source and license
The source is at github.com/IntegraLedger/integra-protocol, under the Apache-2.0 license. The buyer packages are documented at agenticterms.integraledger.com.
Last updated on