Waysafe

Quickstart

There’s no hosted API yet — clone the public repo and this is the fastest path to a real decision: not a mock, the actual evaluate() engine, running locally. Verified from a clean clone just before writing this page, ~13.5 seconds end to end on a warm npm cache (a first install over the real network will take longer; nothing here waits on a database or a compiler API key):

git clone https://github.com/getwaysafe/waysafe.git
cd waysafe
npm install
npm run build -w @waysafe/core -w @waysafe/sdk
npm run quickstart
Why this runs in-memory rather than against SQLite

packages/db’s schema uses native Postgres enums, String[] columns, and (the disqualifying one) real SELECT ... FOR UPDATE row locking that the cumulative-spend guarantee depends on, none of which SQLite can express — so the in-memory adapter already built for npm test is the zero-setup path, not a shortcut around it.

The build step is real, not optional — dist/ is gitignored, so a clean clone has no @waysafe/sdk to import until it’s built. Real, unedited output from that run, sections 1–4 (connect, compile, create and authenticate a mandate, and the first decision — an ALLOW, from the real engine):

1. Connect
  started a local Waysafe API on 127.0.0.1:54400 (in-memory, no database)
  connected to http://127.0.0.1:54400

2. Compile a natural-language instruction into a policy
  summary: Spend up to $500 per calendar month on office supplies at Amazon and Staples, never more than $150 at once, with your approval required at any other merchant.
  assumption: Read 'never more than $150' as a hard limit: transactions above it are denied, not sent to you for approval. Say 'ask me before spending more than $150' if you would rather approve them.
  assumption: Mapped 'Amazon' to amazon.com and 'Staples' to staples.com.
  assumption: Blocked gambling, cash advance, crypto, adult, and firearms outright.
  assumption: Set this authority to expire in 30 days.

3. Register an agent, and create + authenticate a mandate for it
  mandate: mdt_01m2rnka6g0c8acmtq2ka9e3wv (PENDING_AUTHENTICATION)
  authenticated -- the mandate is now ACTIVE
  agent key minted: wsf_live_a463ba08...  (shown once -- store it now)

4. Ask permission for a purchase that's clearly within the mandate
  decision: ALLOW  status: AUTHORIZED
    - ALLOW_WITHIN_MANDATE: The action is within the delegated authority.

Same run, same mandate, a purchase over the hard cap:

7. A purchase over the hard cap -- DENY. This is a normal return value, not a thrown error
  decision: DENY  status: DENIED
    - DENY_TRANSACTION_LIMIT_EXCEEDED: The amount exceeds the per-transaction maximum of $150.00.
  asExecutable() on a DENY: null

Sections 5–6 and 8–10 of the same run (execution, a step-up resolved by a real approver mandate after a rejected self-approval attempt, a typed SDK error, and independently verifying the signed evidence chain) are elided here for density — run npm run quickstart yourself to see them, or read examples/quickstart.ts directly.