Skill compilation

Compile once. Replay for almost nothing.

Most browser agents re-run the LLM on every execution, so cost scales with usage. Twin turns a successful run into a named skill, matches re-phrased requests to it semantically, and replays it deterministically — so the curve bends the other way.

How it works

From one run to a replayable skill.

Three moves turn an unpredictable, LLM-driven browse into a deterministic program: minimize the successful path, match the next request to it by meaning, then replay it with no model in the loop.

COMPILEdiscovery runretries · dead ends · backtracksminimisecompiled skill1open(url)2fill[3] {{email}}3click[7]4extract([…])book-slot@v3 · replayableone discovery run · a program that replays the same way every time
01

A run compiles into a skill

The first time a goal succeeds, the planner’s exploration is minimized into a deterministic skill — the essential steps over indexed DOM state, with the exploration noise stripped out.

02

The semantic cache dispatches

A new, differently-worded request is embedded and vector-matched to a skill compiled earlier for the same host, then adapted to the new values — no cold start at full LLM cost.

03

Replay runs with no LLM

Call a compiled skill by name and it blind-replays deterministically — no model in the loop at all. The most-repeated workflows trend toward zero marginal LLM cost.

The surface

Two calls. One of them never touches a model.

Compilation and replay are separate, named operations in the public API — so “deterministic replay” is something you can call, not something you have to take on trust.

  • POST/api/v1/skillscompile_skill

    Discover a path once, minimize it, and store it under a name you choose.

  • POST/api/v1/skills/{name}/runrun_skill

    Replay that skill deterministically. No model is called.

  • POST/api/v1/dispatchdispatch

    Hand it a goal instead of a name: cache hit replays, cache miss compiles.

  • GET/api/v1/librarysearch_library

    Search the cross-tenant corpus of sanitized skeletons. Metadata only, free.

Compile · replayskills.shbash
# 1 · Compile once — discover, minimize, name it.
curl -X POST https://twin-browser.com/api/v1/skills \
  -H "Authorization: Bearer $TWIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "target": "https://app.example.com/invoices",
    "goal": "download the latest invoice PDF",
    "as": "latest-invoice"
  }'

# 2 · Replay forever — same call, no model in the loop.
curl -X POST https://twin-browser.com/api/v1/skills/latest-invoice/run \
  -H "Authorization: Bearer $TWIN_API_KEY"

Prefer to skip naming things? POST /api/v1/dispatch takes the goal and decides for you — replay on a cache hit, compile on a miss. The full reference lives in the API docs.

The cost ladder

The same goal gets cheaper as it repeats.

A workflow moves down this ladder on its own: you pay a model once to learn the path, then pay browser time to walk it again.

COST OF THE SAME GOAL, N TIMES0306090120036912creditsrunsbreaks even at run 6re-reason every run · 10 cr eachcompile once · 50 cr, then 1 cr a replayrates from the published card — GET /api/v1/pricing
LLM cost per run at each of the three tiers of skill reuse.
TierWhat actually runsLLM cost per run
Cold compileThe planner discovers a path and minimizes it to the essential steps. You pay the model once and keep a reusable skill.Full LLM
Dispatch cache hitA differently-worded request vector-matches an existing skill for that host and is adapted to the new values. The structure is already known.~5× cheaper
Deterministic replayA compiled skill is called by name and blind-replays against the live page. No model call at any step.~$0 LLM

Cross-tenant corpus

The structure is shared. Your data never is.

Your agents inherit skeletons the whole network has already compiled, while your values, credentials and exact paths stay yours alone.

Shared skeleton

  • The host a skill was compiled for.
  • The ordered structure of the run — which kinds of elements, in what order.
  • A short description of the intent.

Never leaves your tenant

  • Any value you or your agent typed.
  • Credentials and secrets — they stay in your vault.
  • Results, page content, or your exact compiled path.

Read the full disclosure on the security page.

FAQ

Skill compilation, answered

How is the semantic cache different from exact-match replay?
Exact-match replay only helps when the identical action repeats with known parameters. Twin’s dispatch cache vector-matches a semantically similar, re-worded request to an existing skill and adapts it — so variants hit the cache instead of cold-starting at full LLM cost.
What is the cross-tenant skill corpus?
When a task succeeds, its sanitized navigation skeleton — host and which kinds of UI elements were used, never your values or credentials — joins a shared library. Other tenants automating the same host can adapt that skeleton, so cache-hit rates climb as the network grows. Only you ever replay your own exact path.
Why does cost fall as usage grows?
Most browser infra bills up — per browser-hour, per step, per token, or per gigabyte. Twin front-loads the LLM cost into a one-time compile, then serves repeats from the semantic cache or deterministic replay. The more a workflow runs, the lower its average cost per run.
How do I compile and replay a skill?
Compile with POST /api/v1/skills (or the compile_skill MCP tool), which discovers and minimizes a path once for roughly 50 credits. Replay with POST /api/v1/skills/{name}/run (or run_skill) for about a credit, with no LLM in the loop. POST /api/v1/dispatch combines both: cache-hit replay, or cache-miss compile.

Stop paying the model twice for the same task.

Compile once, dispatch semantically, replay deterministically. The first run buys the path; every run after it walks the path you already own.