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 replays with plain Playwright 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 docsGitHub
cached adapted failed
$ saffron run
 
GREENSign the guestbook and leave a note cache · 147ms
YELLOWNote after the standard guests 4/5 seeded ✓
GREENGuest count via step set cache · 160ms
GREENSuccessful login cache · 90ms
GREENLogin with a credentials table cache · 99ms
GREENFailed login shows an error (ex. 1) cache · 84ms
GREENFailed login shows an error (ex. 2) cache · 91ms
 
6 passed, 1 adapted, 0 failed · 5 AI calls · $0.61
report: .saffron/reports/latest.html

actual 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 Playwright via MCP and records semantic actions: 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

Plain Playwright replays the recorded actions against your app. No agent is loaded, no tokens are spent, and scenarios finish in about a hundred milliseconds each.

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 Plain Gherkin. Parsed into scenarios, step sets expanded. Is there a committed cache for it? YES NO, OR STALE EVERY RUN · 0 TOKENS Zero-AI replay Plain Playwright drives the cached actions. 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 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. The GitHub button points at this site's repository, which also hosts the issue tracker.

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

23 capabilities · in saffron-ai 0.7.1
Changelog →

Runner core

5
  • Record once, replay at zero tokens
  • Mid-run healing into verified proposals
  • Sacred assertions, with an assertion policy
  • Step reuse: new recordings seeded from old ones
  • Cross-browser replay, parallel workers, heal model

Writing tests

4
  • Step sets and the .saffron dialect
  • Tables, doc strings and Scenario Outlines
  • Secrets as {env:VAR}, masked in everything Saffron writes
  • 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

4
  • VS Code extension and JetBrains plugin
  • Run from the IDE, panels and a dashboard
  • Claude Code plugin with the language server
  • Agent skill, MCP server and saffron init

Reports and history

4
  • 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

2
  • Public npm package, free for any use
  • Generated docs site and one changelog

Ahead

10 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.

Failure screenshots and video

What the page looked like when a step failed, in the report and one click away in the IDE. Video per scenario, kept only for failures if you prefer.

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

Sharding and parallel recording

Parallel replay is shipped. Next: split a suite across CI machines, and let independent scenarios record or heal at the same time.

Chrome, Edge and a browser matrix

Replay on Chromium, Firefox and WebKit is shipped. Next: branded Chrome and Edge, every engine in one run, 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.