Tests that adapt. Changes you approve.

Write tests in Gherkin.Pay for AI once.Replay forever.

An AI agent executes each scenario in a real browser on the first run and records a deterministic cache. Every later run is replayed by Saffron in a real browser, at zero LLM tokens and at Playwright's speed. When the UI changes, the agent heals mid-run and files a reviewable proposal, like snapshot testing for user journeys.

Get startedRead the docsCommunity
cached adapted failed
$ saffron run
 
GREENSign the guestbook and leave a note cache · 0 tokens
YELLOWNote after the standard guests 4/5 seeded ✓
GREENGuest count via step set cache · 0 tokens
GREENSuccessful login cache · 0 tokens
GREENLogin with a credentials table cache · 0 tokens
GREENFailed login shows an error (ex. 1) cache · 0 tokens
GREENFailed login shows an error (ex. 2) cache · 0 tokens
 
6 passed, 1 adapted, 0 failed · 5 AI calls · $0.61
report: .saffron/reports/latest.html

output from the bundled example suite · 6/7 replayed from cache · one novel scenario recorded and verified

The rules

Six rules that keep it honest

Saffron's culture is honesty over convenience. The runner refuses to hide costs, refuses to heal assertions, and refuses to change your suite without a commit.

01 · Assertions

Assertions are sacred

No Then is healed by default: enforced mechanically in the runner, not by prompt discipline. Projects may opt in to adaptable mid-scenario checkpoints; the final assertion block of every scenario stays strict under every policy.

02 · States

Three result states

Green: replayed from cache. Gold: recorded or adapted by the agent this run; the proposal awaits review, stamped verified or honestly unverified. Red: failed. No fourth category.

03 · Diagnosis

Diagnose before adapting

The agent decides whether the failure is UI drift or a real application defect. Defects surface as red, not as a silent heal.

04 · Caches

Caches are git artifacts

.saffron/cache lives in your repo and gets reviewed like snapshots. Diffs are readable. Nothing changes on CI without a commit.

05 · Proposals

Verified proposals

Every recording is proof-replayed with zero AI before it is filed. A proposal that cannot replay deterministically never leaves the machine.

06 · Cost

Honest cost reporting

Prompt-cache reads and writes are shown alongside token counts. The number at the bottom of the report is the real bill.

How it works

Record once, replay forever, heal when the UI moves

Every scenario travels one of three paths. The runner picks the path automatically based on cache state and the outcome of the replay.

First run

An AI agent drives a real browser through Playwright MCP, and Saffron records what it does as semantic actions in a JSON cache: ARIA role and accessible name first, CSS only as a fallback. The cache is verified by a zero-AI replay before it is written.

Every later run

Saffron replays the recorded actions in a real browser, on Playwright's browser engine. No agent is loaded, no MCP, no tokens: it runs at Playwright's speed.

Mid-run failure

When a cached step fails, the agent takes over in the same browser via CDP, adapts around the drift, finishes the scenario, and files a proposal with a cache diff and a suggested feature-file edit. Nothing is applied without your review.

Your .saffron and .feature files Gherkin, parsed into scenarios, with step sets expanded. Is there a committed cache for it? YES NO, OR STALE EVERY RUN · 0 TOKENS Zero-AI replay Saffron replays the cached actions in a real browser. GREEN all steps pass RED a Then fails: never healed ACTION FAILS AFTER RETRIES UI MOVED · AI HEALS Agent heals in place Same browser session, from the failed step on. FIRST RUN · AI RECORDS Known steps replay Wordings recorded before are reused, zero AI. Agent records the gaps Drives the real browser, only for the new steps. PROOF BEFORE REVIEW Candidate cache What the agent did, as replayable JSON. Zero-AI proof replay The recording must replay on its own to count. One refine pass Then re-verified. FAILS RE-VERIFY Proposal Verified or unverified, with a narrative and a diff. YELLOW YOU REVIEW saffron accept Nothing is applied without you. Committed cache JSON in git, reviewed like a snapshot. NEXT RUN REPLAYS FOR FREE Every run writes an HTML and JSON report status · AI calls · tokens · cache traffic · cost or plan usage · adaptations · feature diffs
Execution model
Economics

Cost scales with novel steps, not with runs

Real numbers from an internal checkout suite, at API rates. A new scenario gets cheaper as the suite grows because the agent seeds from every step it has already recorded. A cached replay spends no LLM tokens; it still costs what any Playwright run costs in CI minutes, and a heal is a new, smaller AI session when the UI changes.

ScenarioCost
Full unseeded recording$2.07
Tuned inner loop$1.16
Seeded recording, 6-step scenario, one novel step$0.15
Every cached replay after that0 tokens

New scenarios get cheaper as the suite grows, because cost scales with novel steps only.

Editors and agents

Works where you already work

One install per tool. JetBrains and VS Code get highlighting, completion with recorded/divergent/unrecorded badges, StepSet navigation, diagnostics, run buttons and a Saffron panel with proposals, tags, health and the report. Claude Code gets the same language server, the MCP tools and the agent skill.

JetBrains

Saffron plugin for IntelliJ, WebStorm, PyCharm, Rider

File type, highlighting and the language server, plus run configurations, right-click Run and a Saffron tool window with proposals, tags, health and an embedded dashboard. Community editions included.

Open on JetBrains MarketplaceSource

Settings → Plugins → Marketplace → search "Saffron"

VS Code

Saffron extension for VS Code

Highlighting, completion with status badges, StepSet navigation, diagnostics, right-click Run, a Saffron side panel with proposals, tags and health, and an in-editor dashboard.

code --install-extension ChathurangaJayasinghe.saffron-vscode

Claude Code

Saffron plugin for Claude Code

The language server, so Claude sees diagnostics and navigates StepSets while it edits .saffron files, the MCP server with search_steps, list_step_sets and project_status, and the Saffron agent skill, as one plugin.

Open on GitHub
/plugin marketplace add s-chathuranga-j/saffron-claude-plugin
/plugin install saffron@saffron

JetBrains, Visual Studio Code and Claude are trademarks of their respective owners, shown to indicate compatibility. Saffron is not affiliated with or endorsed by them.

Get started

A few commands to your first zero-token run

npm i -D saffron-ai
npx playwright install chromium
npx saffron init --examples # config, agent skill, Saucedemo example suite
 
npx saffron run # agent records, files proposals
npx saffron accept --all # promote proposals to caches
npx saffron run # 0 LLM tokens, the whole suite in seconds

No step definitions, no glue code. Write plain Gherkin (or .saffron), point saffron.config.json at your app, and run. The agent needs Claude Code auth or an ANTHROPIC_API_KEY on the first run only: replay-only CI needs no AI access at all, runs cross-browser (--browser chrome|msedge|firefox|webkit), and parallelizes with --workers N.

No app to point it at yet? saffron init --examples installs a handful of short .saffron scenarios against the public demo shop at saucedemo.com (login, a Scenario Outline, cart, checkout, StepSets at the start and mid-scenario), with the config and a .env.example ready. The first run records them for about $3 of AI usage; every run after that is free. The docs walk through it step by step.

Saffron is live on npm: free to use, including commercially. Bug reports, feature requests and questions live in the public community repository, linked from the Community page.

Roadmap

What is shipped, what is ahead

Shipped is what is in the package you install today, grouped by what it lets you do. Ahead is ordered by how close it is, not by a date.

Shipped

40 capabilities · in saffron-ai 0.8.5
Changelog →

Runner core

13
  • Record once, replay at zero tokens
  • Mid-run healing into verified proposals
  • Proposals bound to what you reviewed: stale ones cannot be accepted
  • Recordings validated on read, problems named by path
  • Heal notes that name the kind of change, checked against the recording
  • Sacred assertions, with an assertion policy
  • Step reuse: new recordings seeded from old ones
  • Cross-browser replay, parallel workers, heal model
  • Google Chrome and Microsoft Edge, recording included
  • Setup and teardown commands around a run
  • Sharding across CI machines, with one merged report
  • Re-record a wrong recording, and prune the ones nothing owns
  • A baseURL with a path or query, for variants behind a flag

Writing tests

6
  • Step sets and the .saffron dialect
  • Tables, doc strings and Scenario Outlines
  • Secrets as {env:VAR}, masked in everything Saffron writes
  • Test data in a data folder: values, lists, Examples from a file
  • Values that are new on every run, and data per environment
  • Guided first run with an example suite

Real-world pages

4
  • Dialogs, uploads, drag-and-drop, iframes
  • Network-aware steps, in plain prose
  • Multi-tab scenarios, in plain prose
  • Dynamic values and date templates

Editors and agents

7
  • VS Code extension and JetBrains plugin
  • Run from the IDE, panels and a dashboard
  • Last run in the IDE, with the failure screenshot one click away
  • Proposals, orphans, tags and health panels in both IDEs
  • {data:...} completion, hover and diagnostics
  • Claude Code plugin with the language server
  • Agent skill, MCP server and saffron init

Reports and history

7
  • Failure screenshots, embedded in the report
  • saffron diff: what a proposal changes, field by field
  • Retries visible per step
  • Cost by how the run was paid for
  • Run history, trends, chronic scenarios
  • saffron status for panels and dashboards
  • Multi-tag filter, tags in the report JSON

Distribution

3
  • Public npm package, free for any use
  • Generated docs site and one changelog
  • Configuration reference, and a community repo for issues

Ahead

9 items · nearest first
Full roadmap →
Next

Designed, waiting for a slot

Multi-session scenarios

Two users in one scenario, each in its own browser context: buyer and seller, sender and receiver.

Run one scenario

A file:line form in the CLI, then gutter run icons per Scenario in JetBrains and VS Code, and an exclude-tags filter.

Execution replay

Not a video: step through a run with the DOM inspectable at every action and the network alongside, navigated by your Given, When and Then.

Later

Scoped, not scheduled

Parallel recording and healing

Parallel replay and sharding across CI machines are shipped. Next: let independent scenarios record or heal at the same time, under a concurrency cap.

A browser matrix in one run

Chromium, Chrome, Edge, Firefox and WebKit are shipped. Next: every engine in one command with per-browser results, and device profiles.

Multi-provider agents

Record and heal with models beyond Claude, behind the same provider interface.

LLM-less MCP replay

Replay through the MCP surface with no model in the loop.

Shared step library

Level 2 of step reuse, gated on evidence from real suites rather than scheduled.

Horizon

Direction, not a date

Open-core SaaS layer

Hosted history and review for teams. The CLI never requires it.