Specs you can run

GWT

In GWT, the spec is the program. Read the rules, run them, and trace each result back to the behavior that produced it. Built for people to understand and review as AI helps write the code.

The same file can also carry GIVEN / WHEN / THEN scenarios for tests. Capture real runs and compare behavior changes without creating a second implementation of the rules. GWT runs directly, with exact numbers and source-backed explanations.

Readable rules

WHEN quote delivery for <parcel> into <quote>
  GIVEN parcel is Parcel
  AND quote is Quote
  REQUIRE parcel.weight_grams > 0
  DECIDE
    WHEN parcel.weight_grams > 5000
      set quote.status to "manual"
      set quote.fee to 0
    WHEN parcel.member
      set quote.status to "standard"
      set quote.fee to 0
    WHEN parcel.weight_grams <= 1500
      set quote.status to "standard"
      set quote.fee to 5
    ELSE
      set quote.status to "standard"
      set quote.fee to 9

Traceable decisions

Example input1,500g parcel · Nonmember

  1. Positive weight requiredPassed
  2. Heavier than 5,000g?No
  3. Member?No
  4. At or below 1,500g?Matched
Selected branch writes
Status
standard
Fee
5
Explore the full execution evidence →

How it works

Write It. Run It. Check It.

A GWT file shows the setup, the behavior, the input and output, and the examples that prove it works.

Walk through the basics

State Is Visible

Records and tables show the data the behavior reads and writes.

Behavior Has Names

Reusable WHEN blocks read like real workflow steps.

JSON Has A Shape

REQUEST says what input is required. OUTPUT says what result is returned.

Failure Is Clear

Missing data and bad shapes fail loudly instead of turning into silent defaults.

Examples Prove It

Scenarios live in the same file, so examples can be read and run in CI.

Evidence Stays Reviewable

Captured Execution Cases preserve what ran; corpora name the cases that matter for repeatable old/new review.

Try a real change

Extend A Delivery Fee Band

Raise the low-fee weight limit from 1,000g to 1,500g. Check which customers pay less, and whether membership benefits, heavy-parcel handling, and invalid-input rejection still hold.

Run the walkthrough
Input1,500g parcel, nonmember
BeforeAbove 1,000g: fee 9
AfterAt or below 1,500g: fee 5
EvidenceCompare the conditions and writes in both source revisions

Behavior review

See What A Rule Change Actually Changes

Capture integrity-checked executions, give important cases stable domain names, replay them against two real program versions, and open a self-contained review dossier.

Read the evidence workflow
  1. capture an Execution Case
  2. group named cases in a corpus
  3. compare baseline and candidate behavior
  4. review source-backed evidence in an offline page

Rust foundation

Readable Behavior, Native Execution

The Rust engine checks and executes GWT source. Use the command line, embed it in a Rust application, or run the WebAssembly build in a browser. The language has its own explicit semantics.

Explore host integration
  1. check typed contracts and behavior
  2. execute with exact numbers and explicit limits
  3. capture inputs, source, and execution evidence
  4. compare revisions and record review decisions

Try it

Run It Locally

Use GWT to check a policy, run a request, and review a proposed change.

Get GWT and follow the example

Check Your Rules

Validate the policy and run its embedded scenarios.

gwt validate delivery.gwt

Run A Request

Send a parcel’s weight and membership status to the delivery policy.

gwt run delivery.gwt \
  --request "quote delivery" \
  --input parcel.json

Review A Change

Compare captured requests with the proposed policy and explore the evidence in your browser.

gwt review delivery.corpus.json \
  --candidate proposed.gwt \
  --html delivery-review.html

Boundaries

Current Status

GWT is experimental. GWT is aimed at workflows whose rules need to stay readable, executable, and reviewable. Whether it improves human understanding is still to be measured.

Read the principles