DEV Community

Leon
Leon

Posted on

Programs Beat Prompts: How Tap Turns AI into a Compiler for Browser Automation

#ai

The Problem

Every time you ask an AI agent to do something in a browser, it costs money and time. Click here, type there, extract that — the AI figures it out from scratch every single time.

What if AI only had to figure it out once?

Tap: The Compiler Approach

Tap is a protocol + toolchain that turns AI's interface operations into deterministic programs (.tap.js files):

  1. Forge — AI observes the page (network, DOM, a11y tree) and writes a tap program
  2. Verify — Test the tap with different inputs
  3. Run forever — The tap replays deterministically. Zero AI cost.
First run:  AI inspects → writes .tap.js     ($0.50)
Every run:  .tap.js replays deterministically ($0.00)
Enter fullscreen mode Exit fullscreen mode

How It Works

8 core operations + 17 built-in operations = complete browser control protocol.

A tap program is plain JavaScript:

export default {
  site: "github",
  name: "trending",
  async run(tap) {
    await tap.nav("https://github.com/trending")
    return tap.eval(() => {
      return [...document.querySelectorAll('article.Box-row')].map(el => ({
        repo: el.querySelector('h2 a')?.textContent?.trim(),
        stars: el.querySelector('.octicon-star')?.parentElement?.textContent?.trim()
      }))
    })
  }
}
Enter fullscreen mode Exit fullscreen mode

Multi-Runtime

The same tap runs on:

  • Chrome Extension — Uses chrome.scripting (undetectable)
  • Playwright — Headless capable, CI/CD friendly
  • macOS — Native apps via Accessibility API

A new runtime implements 8 methods, gets 17 built-in operations for free.

Community Skills

119 community skills across 55 sites — tap-skills (open source).

Why Not Just Use Playwright?

Playwright Tap
Who writes scripts? You AI forges them
Cost per run N/A $0.00 (deterministic)
Runtimes 1 3+ (Chrome, Playwright, macOS)
Community scripts No ecosystem 119 skills

Get Started

curl -fsSL https://leonting1010.github.io/tap/install.sh | sh
tap github trending
tap hackernews hot
Enter fullscreen mode Exit fullscreen mode

Homepage: leonting1010.github.io/tap
Skills (open source): github.com/LeonTing1010/tap-skills


Programs beat prompts. AI forges once, programs run forever.

Top comments (0)