Agent-First Development / Specimen

Agent-First Development: software built as commands that people and agents both call. Not AI that writes your code.

Preview, on npm

Specimen

A test bench for components.
Every run leaves evidence.

Specimen renders a component in real Chromium and writes down its markup, layout, styles, state and accessibility tree. Compare two captures to see what changed. It runs Storybook-format stories without Storybook.

npm install --save-dev @lushly-dev/specimen-cli@preview

Two capturesOne diff

specimen diff bar.json bar-token-changed.json

status
changed
dom
0
layout
24
styles
8
state
0
a11y
0

What that says The markup is identical. It still moved.

19 commands
The command line, an MCP server and your code run the same ones and get the same result.
Five channels
Markup, layout, styles, state and accessibility, each marked complete or partial.
No Storybook needed
It runs stories in Storybook's format, with their plays and accessibility checks.
Fig. 01The commands

Two captures in.
What changed, out.

Try itPick a line under the prompt, or type your own. The captures are files a real browser wrote. The comparison runs here.

Fig. 02The capture

A capture says what it saw
and what it didn't.

One capture is one JSON file. It carries where it came from and how complete each channel is. A comparison refuses captures from different browsers, and a missing channel is never read as unchanged.

Where it came from

Open this capture The specimen it rendered

How complete it is

Channel Status What it covers

Read from the capture file when this page loaded.

Fig. 03The layers

Which layer do you need?
There are three.

The bench knows nothing about AFD and needs none of it. The command layer sits on the bench, and the command line and the server sit on the commands. The project you inspect needs none of them installed.

Endpoints

specimen-cli

The specimen binary. One JSON result on stdout, and exit code 1 when a check fails.

specimen-server

An MCP server over stdio, with every command as a tool. It runs from a checkout for now and is not on npm.

Integration

specimen-afd

The 19 commands and their schemas. The command line and the server both run these.

specimen-fast-af

A plugin for FAST-AF components: their schema, their commands and their themes.

Foundation

specimen

The bench, the comparison, the story runner and the schemas.

specimen-host

The native host, in Rust. It bundles each case, serves it from memory and drives Chromium. One prebuilt package per platform.

Fig. 04The code

However you reach it,
it is one bench.

@lushly-dev/specimenIn your process
import { createSpecimenBench, diffObservations } from '@lushly-dev/specimen';

const bench = await createSpecimenBench({ root: './components' });
try {
  const before = await bench.render({ id: 'button' });
  const after = await bench.render({ id: 'button-padded' });
  const comparison = diffObservations(before, after);
  // { status: 'changed', differences: [...], limitations: [...] }
} finally {
  await bench.close(); // ends the host and its browser
}
Creating a bench starts nothing. The first render starts the host, outside your process, and each render gets a new browser context.
Fig. 05The stories

Your stories.
No Storybook.

Specimen runs a story the way Storybook's test runner does: compose the annotations, render, run the play, then check accessibility with axe. A story that leans on something Specimen does not reproduce fails. It is never run without it.

407
stories in FAST-AF's suite, which now runs on Specimen alone.
0
disagreements with Storybook, over three full runs of that suite.
1.6–1.8×
the CPU per story, on a first measurement. It costs more than Storybook there.
¼
of the memory in its largest process, on the same measurement.
Fig. 06The pack

What the runs learned.
Written for an agent.

A component pack is one JSON file for each component and one for the library's shared rules. Specimen builds it from the cases you already run, and every fact in it carries a basis: verified, observed, declared or authored.

  1. specimen pack

    Runs every case twice and writes the records. A case that fails, or shows something different in each pass, contributes nothing.

  2. specimen pack-check

    Builds the same way, writes nothing, and exits 1 when a committed record differs. This is the drift check for CI.

  3. specimen pack-export ./dist

    Adds a catalog with a digest for every record, from the committed files alone. It needs no browser.

pack/data/bench/components/change-bar.json
The record Specimen built for this page's component, as committed. The design side draws it as the brief an agent reads.
Fig. 07The list

One list holds
all 19 commands.

The names come from the command definitions loaded on this page.

Fig. 08The start

Install the layer
you'll stand on.

Command line
npm install --save-dev @lushly-dev/specimen-cli@preview
The browser
npx playwright install --only-shell chromium
In your code
npm install @lushly-dev/specimen@preview zod
As commands
npm install @lushly-dev/specimen-afd@preview @lushly-dev/afd-core @lushly-dev/afd-server zod

Status

Preview. On npm under the preview tag, with prebuilt hosts for macOS and for Linux on glibc. On Windows the host builds from source until its package is released. It runs in Chromium only. A diff compares structure, and pixel comparison exists only in the theme audit. The first render that cannot find the browser names the version to install.