test-harness-kit
The reference kit for TRIF — the Test Recipe Interchange Format. Capture an app's testing knowledge once; run it anywhere, forever.
Get started
You need Node ≥ 18. The CLI has zero runtime dependencies. To run recipes against a live app you also need one browser engine — Playwright, or a Chrome on a debugging port.
$ npm install -g test-harness-kit # global CLI $ npx test-harness-kit start # or run without installing — guided tour # to run recipes live, one engine: $ npm i -g playwright && npx playwright install chromium # …or a Chrome: chrome --remote-debugging-port=9222 (THK_CDP_URL)
SKILL.md), or author one yourself and run it from the terminal. Both produce the same result records.Quick start (60 seconds)
Explore the bundled sample cookbooks:
$ git clone https://github.com/huytieu/test-harness-kit && cd test-harness-kit $ node cli/test-harness-kit.mjs list cookbooks wikipedia v1.0.1 recipes:8 surfaces:3 freshness:ok the-internet v1.0.2 recipes:16 surfaces:11 freshness:ok … (11 sites) $ node cli/test-harness-kit.mjs show cookbooks/wikipedia.trif TC-01 # read one recipe $ node cli/test-harness-kit.mjs run cookbooks/wikipedia.trif TC-01 --adapter playwright TC-01 PASS/clean 2.1s [intent:playwright] report: cookbooks/wikipedia.trif/results/<ts>/report.html
On your own app: init scaffolds a skeleton, then you explore the app once and write the real recipes (authoring).
$ npx test-harness-kit init my-app --url https://my-app.example $ npx test-harness-kit validate my-app.trif
How it works
→ See the one-page infographic — the loop, the five levels, and how a recipe becomes a script.
A cookbook (<app>.trif/) is a versioned artifact with five disclosure levels, so an executor loads only what one test needs:
| Level | File | Role |
|---|---|---|
| L1 router | SKILL.md | ≤1000 tokens — decides which recipe, when a model is needed |
| L2 recipe | recipes/TC-*.md | ≤400 tokens — steps + oracle for one test |
| L3 healing | healing.md | drift playbook (only on failure) |
| L4 map | map/ + anchors.json | app structure + element registry (authoring/healing) |
| ledger | coverage.json | freshness + what's covered |
Explore once (funded), write the cookbook; then any executor runs one recipe at O(1-test) context cost — read the router, then exactly one recipe. Zero-to-one-executed-test stays under 1,500 tokens.
The four verdicts
Every run returns exactly one — drift is named, never silently absorbed:
| PASS | the oracle was satisfied. |
| FAIL-BUG | a real defect — requires quoted observed evidence + one re-read. |
| FAIL-STALE | the app drifted — an anchor miss, not a bug. Emits a patch proposal. |
| BLOCKED | can't run (missing capability / unreachable app / auth). Never a fake fail. |
Honesty rules: retry once after settle before any FAIL; an anchor miss is FAIL-STALE, never an improvised path; a missing capability is BLOCKED, never a fabricated FAIL.
Binding-first runtime
Pay to learn the app, not to re-run it. A recipe that PASSes on the intent lane and is deterministic-ready graduates to a compiled script binding (Playwright and/or Katalon). The next run executes the binding — no model, no key, $0. Freshness is fingerprinted over (recipe source + resolved anchors); on miss/stale/failure the binding is dropped as suspect and the run falls back to the intent lane and heals. A binding failure is a signal, never a verdict.
$ test-harness-kit run app.trif TC-01 --adapter playwright # graduates on PASS $ test-harness-kit run app.trif TC-01 --adapter playwright # now $0 via the binding flags: --no-binding · --binding-engine <e> · --no-graduate
The four doors
One artifact, four consumption paths — each a thin wrapper over the same files.
- Agent Skills — a cookbook's
SKILL.mdrouter loads into Claude Code / Codex / Cursor. - MCP server —
test-harness-kit mcp; see below. - CLI —
npx test-harness-kitfor CI and any shell-capable agent. - Raw files — it's markdown + JSON; read a recipe and run it by hand.
MCP server any agent
Run test-harness-kit mcp and any MCP-capable agent drives the whole workflow as tools. Bundled in the CLI — upgrade the CLI, the server upgrades with it.
Claude Code
$ claude mcp add test-harness-kit -- npx test-harness-kit mcp --dir "$PWD" $ claude mcp list # → test-harness-kit: … ✔ Connected
Then, in a session: "list the TRIF cookbooks", "show recipe TC-01 in wikipedia.trif", "run TC-01 with the playwright adapter and give me the verdict".
Claude Desktop / Cursor / other clients
{
"mcpServers": {
"test-harness-kit": {
"command": "npx",
"args": ["test-harness-kit", "mcp", "--dir", "/abs/path/to/cookbooks"]
}
}
}
Tools
| Tool | Returns |
|---|---|
playbook | the operating contract (≤800 tokens) |
list_cookbooks / list_recipes | cookbook + recipe indexes |
get_recipe / get_map_shard | one recipe / one map shard |
search_cookbook | ranked matching lines (file:line) |
validate_cookbook / get_staleness | conformance / freshness |
run | executes a recipe → PASS / FAIL-BUG / FAIL-STALE / BLOCKED |
compile_binding / list_healing | recipe→script / pending patches |
CLI reference
| Command | Does |
|---|---|
list [dir] | <cookbook> | cookbooks under a dir, or recipes in one |
show <cb> <TC-id | map/<shard>> | one recipe (anchors expanded) or map shard |
search <cb> "<q>" | ranked matching lines |
init <name> --url <u> | scaffold a new cookbook |
validate <cb> | TRIF conformance check |
run <cb> <TC..> --adapter <playwright|cdp|agentic|human> | execute, binding-first; writes evidence + report. --gate[=bug,stale,blocked] CI exit codes · --junit <path> JUnit XML · --write-bindings direct graduation (default: proposals) · --render-only print the agentic protocol |
report <results-dir> [--out] | (re)generate the run report |
map <cb> [--out] | self-contained IA map HTML |
compile-binding <cb> <TC..> | recipe → script (both engines by default) |
stale <cb> [--max-age] | per-surface freshness report |
heal <cb> list|apply · measure · budgets · mcp | healing · rollups · budget self-test · MCP server |
Evidence & reports native
Every run on the Playwright engine leaves a per-recipe evidence bundle — the way a native tool records — and a detailed report is generated automatically.
| Artifact | What |
|---|---|
trace.zip | full Playwright trace (open with npx playwright show-trace) |
video/*.webm | screen recording of the run |
console.log · network.jsonl · errors.txt | console output, every request, page errors |
*.png | per-step + final screenshots |
run.json · report.html | manifest + self-contained report (pure functions of the records) |
The report shows, per recipe: the verdict, the resolved lane, a step trace, oracle checks vs observed, timing, and the evidence inline/linked. See a real report →
IA map
test-harness-kit map <cookbook> renders a self-contained, interactive map of a cookbook's information architecture — surfaces as nodes carrying their anchors, recipes, and freshness, with a detail drawer and filters. The fastest way to make a cookbook legible to a human. Open the live map →
Solutions
| The Kit | open-source (Apache-2.0): the format, the CLI, the MCP server, engine adapters, the binding runtime, sample cookbooks. Everything on this page. |
| TestVoyager | a neutral public benchmark + leaderboard for AI web test-execution tools. Entrants supply {url,intent}→verdict — TRIF not required. Spec → |
| Studio future | a planned commercial layer (open-core): visual authoring, a managed run-engine, and a cloud device interface — built on the open kit. |
TRIF is an open, vendor-neutral standard. Kit Apache-2.0 · spec CC-BY-4.0 · by Huy Tieu.