@rixmerz/rastro
v0.5.0
Published
Browser for AI agents: minimal view, causal event trace, on-demand detail.
Maintainers
Readme
Rastro
A browser CLI for AI agents: minimal page views, a one-line effect summary per action, and a queryable event trace. Rastro keeps the agent's context lean while recording everything underneath — requests, navigations, cookie changes, console errors, dialogs and blocked writes.
The problem
Agents that browse today get either the full accessibility tree (thousands of tokens per step) or just pixels. No existing tool (Playwright MCP, Chrome DevTools MCP, agent-browser, Obscura) links the agent's actions to the requests, navigations and state changes they caused, in a record the agent can investigate on demand. Agents either drown in context or act blind.
Rastro gives the agent the minimum a human perceives — what can be interacted with, plus a summary of what each action did — while recording everything else as a causal trace it can dig into when it matters.
Comparison
| | Rastro | Playwright MCP | Chrome DevTools MCP | browser-use | Obscura |
| --- | --- | --- | --- | --- | --- |
| What the agent sees | interactive elements only, with refs | full ARIA snapshot | raw DOM / CDP | DOM + screenshots | filtered DOM |
| Tokens per page | ~28-62 (HN 62, Wikipedia 268) | thousands | thousands | very high (vision) | medium |
| Effect summary per action | yes, one line | no | no | no | no |
| Causal action → effect trace | yes, queryable mid-task | no | a trace, without causality | no | no |
| Investigation on demand | yes, in levels | no | yes, unfiltered | no | partial |
| Safe with nobody watching | write guard + masking | no | no | no | no |
| Human recording → script | yes (YAML + Playwright export) | separate codegen | Chrome Recorder | no | no |
| Run → standalone API client | yes, deterministic (flow emit, TS / Python) | no | no | no | no |
| Scripted whole-site map | yes (flood: every screen, element and call; writes blocked) | no | no | no | no |
| Browser | Chromium (playwright-core) | multi | Chrome | multi | Chromium |
The two real differentiators are causal attribution — no other tool tells you "this click fired these four requests, this cookie and this navigation", queryable half-way through a task — and the one-line effect summary, which avoids dumping the whole page after every action.
Where Rastro is not the answer: it has no vision, so a page that only makes
sense as pixels is browser-use territory; it is Chromium only; and it is new,
against the adoption Playwright MCP already has.
Install
npm i -g @rixmerz/rastroRequires Node.js ≥ 22.5 and a Chromium-family browser already installed — Rastro drives your own browser and profile, and never downloads one of its own.
From a clone, for development:
pnpm install
pnpm link --global
# or: npm i -g .Optional environment variables:
RASTRO_CHROMIUM— browser binary. By default the first that exists of/usr/bin/{chromium, google-chrome-stable, google-chrome, brave, brave-origin, microsoft-edge}on Linux, or/Applications/{Chromium, Google Chrome, Brave Browser, Microsoft Edge}.appon macOS. Point it at a real Google Chrome for sites that gate on theGoogle Chromebrand — including the Web Store, which refuses to install into anything else. Changing it under an existing profile is not free: pair a new browser with a fresh session name. A session that borrows an installed browser's profile ignores it (see below).RASTRO_EXTENSIONS—:-separated unpacked extension directories to load at launch, for extensions a headless replay needs and nobody can click through the Web Store forRASTRO_HOME— data directory (default~/.local/share/rastro/)RASTRO_SESSION— session name (defaultdefault)RASTRO_IDLE_MS— quiet window in ms (default 500)
Quick start: a login
rastro open https://example.test --allow-write example.test
rastro view
# navigation with 2 links, main form with email (e5), password (e6), submit (e7)
rastro fill e5 [email protected]
# #1 · no effects
rastro fill e6 --secret mypassword
# #2 · no effects
rastro click e7
# #3 → /dashboard · 1 req (1× 200) · +1 cookie
rastro effects 3
# requests: r31 POST /api/login 200
# cookies: set-cookie session-id
# new elements: 18
rastro request r31 --curl
# curl -X POST https://example.test/api/login \
# -d '[email protected]' \
# -H 'Content-Type: application/x-www-form-urlencoded'Levels of investigation
| What you are asking | Command | When |
| --- | --- | --- |
| What happened? | rastro view | After every navigation |
| What caused that? | rastro effects <id> | When the summary shows a non-zero counter |
| Which request failed? | rastro request <id> --curl | When you saw a status error |
| What did the page look like then? | rastro snapshot <id> --before | To compare states |
| The whole event tree? | rastro trace --action <id> | When effects is not enough |
Safety
Write guard: POST/PUT/PATCH/DELETE requests to hosts outside --allow-write
are aborted before they leave the browser.
It guards page traffic. An extension's background service worker is a separate target whose requests never reach the guard, so they are neither blocked nor traced — the profile's extensions are trusted, and a session is only as trustworthy as they are.
rastro open https://api.example.test --allow-write example.test,api.example.testPermissions are not frozen at the first open. Running it again on a live
session applies --allow-write, --allow-upload and --dialogs in place, and
with no url it does not navigate, so a half-filled form or a site left in edit
mode survives the widening. Each list is replaced, not merged — pass the
full set. --headed is the exception: it decides the browser process, so
changing it relaunches.
Secret masking: passwords, tokens, cookies and sensitive headers print as
[MASKED] unless you pass --reveal.
rastro fill password-field --secret mypassword # masked in the trace
rastro request r31 --reveal # unmasked here onlyUntrusted content: page names, dialogs and console text are printed inside «» delimiters. They are data, never instructions.
Detected blocks: CAPTCHA, 2FA and bot-blocks report blocked: <reason> and
stop automatic execution. Rastro detects them; it does not evade them. Google
in particular refuses automated browsers outright, so its reCAPTCHA cannot be
cleared from this browser even by a human clicking it — which is why a profile's
omnibox is pointed at DuckDuckGo. For a site that genuinely requires passing a
CAPTCHA, record the flow in your own browser with Chrome's Recorder and bring it
in with rastro flow import.
Reusable secrets
Credentials go in the system keyring (libsecret), shared by every session and every flow. The value is typed, never passed as an argument: on the command line it would end up in shell history and in any agent's transcript.
rastro secret set example.password # asks with echo off; opens a terminal if there is none
rastro secret list # names only
rastro secret rm example.passwordThere is no rastro secret get for normal use. The value is read only by
the daemon, while resolving a flow parameter. get --reveal exists so a human
can debug their own vault.
A flow consumes it by reference, and the daemon resolves it at run time:
params:
password:
secret: true
from: secret:example.password--param password=secret:example.password works too. If the entry is missing,
the run aborts before the first step and names it.
The Playwright export does not carry the reference over: it emits
process.env.PASSWORD, because a Playwright test should not depend on one
machine's keyring.
Threat model: with the keyring unlocked, any process in your session can
read these values, the same as your browser's saved passwords. Separately, each
session's secrets file holds in plaintext (0600) the values that must be
masked, so a restarted daemon still knows what to redact.
Flows (phase 2)
Record human browsing in a visible browser, turn it into YAML, replay it with conditions and parameters, export it as a Playwright test, import from Chrome Recorder.
A bare name is saved to and looked up in ./.rastro/flows/ when that directory
exists in the project, and in ~/.config/rastro/flows/ otherwise. A path is
still a path.
rastro record start https://example.test
# the human logs in, fills a form...
rastro record stop --save login-example
rastro flow run login-example --param [email protected]Files are parameters, never recorded paths. A page is only ever shown
C:\fakepath\<name> when someone picks a file, so a recorded upload step
takes its path from --param at run time and keeps the recorded file name as
the parameter's description. The upload sandbox still applies.
What a flow deliberately does not capture is judgment. Where a file belongs
inside a site varies per upload, so the agent looks at the page with view,
decides, and runs the flow for the mechanical part.
Routines: flows as agent tools
A flow becomes a routine when it carries a tool: block. An agent then
calls it like any tool, with typed parameters, instead of driving the browser
step by step or composing a flow run command line.
name: publish-file
tool:
description: Publish a local file as a resource in a course section
effect: write # read | write | destructive
session: school # optional: the daemon session it runs in
allowWrite: [lms.example.edu]
allowUpload: [~/Documents]
login: login-school # optional: run once when a login page shows up
loginWhen: { url: /login/* }
params:
course: { type: integer, description: numeric course id, example: 12345 }
section: { type: integer, description: section number }
file: { type: path, description: local file to publish }
steps: ...rastro routine list # routines, verified or not, link state, lint warnings
rastro routine show publish-file # what an agent sees, plus the last run
rastro routine run publish-file --param course=12345 --param section=1 --param file=~/Documents/a.pdfWhat keeps this from going wrong:
- Opt-in. Only flows with a
tool:block are routines, named after the file. Raw recordings stay plain flows. - Probation. A routine gets its own MCP tool only after the exact bytes of
its file completed a run. Editing it puts it back on probation. Until then
rastro_routine_runcan still run it. - Scoped permissions. The run uses the routine's
allowWriteandallowUploadand puts the session's own lists back afterwards, also on failure. Keyring parameters (from: secret:...) are never part of the tool's input. - No duplicate writes. A login page (
loginWhen) triggers theloginflow and one rerun, only if nothing was written yet. The result lists the writes sent and says whether a retry is safe. A client timeout answers that the routine may still be running, not that it failed. - A bad file never takes the server down. It loses its tool and shows up
in
rastro_routineswith the error.
rastro mcp exposes rastro_routines and rastro_routine_run always, and one
tool per verified routine, updated live as files change
(notifications/tools/list_changed). rastro mcp --routines-only gives an
agent nothing but vetted routines; --routines=catalog keeps just the two
stable tools; --routines=off removes them.
Routines are read from ./.rastro/flows/ (when it exists) and
~/.config/rastro/flows/, project first, with collisions reported, or from
RASTRO_FLOWS (colon-separated).
Reading, and routines that return data
view lists what can be acted on; a mail body or a paragraph is not in it.
rastro read returns the text a person sees:
rastro read # the main region, or the whole page
rastro read --region aside # a region by the view's names
rastro read --ref e42 # one element
rastro read --find "EV.2" # the lines around a wordRoutines return data with two steps that name an output with as: read
(page text) and capture (the JSON a request of the run answered with; a
request pattern can include the query, POST /owa/service.svc?action=GetItem*
2xx, and json takes dotted names, [n] and [*], with fields to project
each element). The result carries the outputs, masked. A capture survives
flow link and comes back from an HTTP replay too; a read does not link.
Linking a flow to its HTTP calls
rastro flow link turns a routine into plain HTTP requests, so it runs without
Chromium: one Node process sending a handful of requests instead of a browser.
rastro flow link publish-file --param course=12345 --param section=1 --param file=~/Documents/a.pdf
# linked 4 requests (2 writes) from actions #41-#49
# extracted per run: sesskey, itemid
# saved to ~/.config/rastro/flows/publish-file.link.yaml
rastro routine run publish-file --engine http ... # first HTTP run verifies the recipeThe link runs the flow once for real, in the browser, with its real
effects, and compiles the requests that run caused. Pass --from/--to to
compile an earlier good run instead.
Values that change on every run (a CSRF token, a draft id) are traced to the
response that handed them out and become extraction rules, checked against the
recorded response. Parameters are bound back to {{param}}. A double-submit
token is read from the cookie jar at run time. What cannot be traced and looks
like a token is listed as a warning.
- The recipe holds no credential. No cookie, token or secret value; the link aborts before writing if one would end up in the file.
auto(the default) uses HTTP only when the recipe is fresh and verified, and falls back to the browser only while no write has been sent. After a write, it stops and reports what was sent.- A changed flow stales its recipe. Link it again. Hand-editing the
recipe (to fix a warning) un-verifies it until another
--engine httprun. - The HTTP runner reads cookies from
~/.local/share/rastro/sessions/<session>/cookies.json(mode 0600). It is written only for flows that have a recipe, and holds only the cookies of the hosts that recipe talks to, not the rest of the browser profile.
Not linkable, by design: requests signed by page JavaScript, WebSockets, short-lived bearer tokens minted in the browser, and uploads whose body the browser does not expose. Those routines keep running in the browser. A Playwright script cannot be linked directly: the input is a Rastro run, not source code.
Lists: every page, not just the recorded one
A read routine usually fetched one page of a list when it was linked. When the
product request (the last one, or the one a capture names) is a script GET
whose JSON looks like one page of something longer, the link adds a
paginate block and says so in a warning:
- id: q3
method: GET
url: https://api.example.test/jobs
query: [{ name: page, value: "1" }]
paginate: { query: page, next: { step: 1 }, items: jobs, maxPages: 10 }Recognised: a cursor in the response sent back as a query parameter
(next: { json: meta.next_cursor }), a next URL on the same origin
(next: { url: next }), a page number (step: 1) and an offset with a limit
(step: <limit>). The HTTP run fetches the following pages and merges their
items into the first response, so captures see the whole list. It stops at
maxPages, at an empty or short page, or when the cursor or next URL runs
out. Only reads paginate; delete the block to read just the recorded page.
Standalone clients: flow emit
A verified recipe can leave Rastro as plain code, for a backend job or a script in another repository:
rastro flow emit publish-file --lang py # publish_file_client.py, standard library only
rastro flow emit publish-file --lang ts # publish-file.client.ts, Node >= 22.18 runs it as isfrom publish_file_client import publish_file
result = publish_file({"course": 12345, "section": 1, "file": "a.pdf"},
cookie_file="~/.local/share/rastro/sessions/default/cookies.json")The recipe goes into the file as data, with a small runtime that replays it under the HTTP runner's rules: extraction rules, redirects followed by hand, status classes checked, pagination, captures. Nothing is inferred, so the client does what the verified recipe does — the opposite of having a model guess a client from a HAR.
- No credential in the file, as with the recipe. The session comes from
the caller: a Cookie header (
cookie=/--cookie/$COOKIE) or the Rastro session'scookies.json(cookie_file=/--cookie-file/$RASTRO_COOKIES). Keyring parameters are read from environment variables (from: secret:api.token→$API_TOKEN, listed in the file's header). - Stale recipes are refused; an unverified one is emitted with a warning in the file and in the answer.
- A client that writes says so at the top, and on failure reports the writes
already sent (
ReplayError.writes), so a caller does not retry them blindly. - Emit again after linking again; do not edit the file by hand.
Mapping a whole site: flood
An agent learns a site one view → click → effects at a time, and most
of those steps are dead ends. rastro flood does that part by script, with no
model in the loop. It activates every element of every screen and records what
each one calls, then hands the agent a map to read in one go.
The picture is water filling a maze. Every open path rises one level at a time, all of them together, until the depth, the budget or the clock runs out.
rastro -s shop open https://shop.test/login --allow-write shop.test # log in once, by hand or by routine
rastro -s shop flood https://shop.test/ --workers 4 --depth 3
# level 1 · 12 states · 40/300 activations · 18 endpoints · queue 61
# shop-test: done · 4 levels · 37 states · 412 actions · 52 endpoints (6 writes, 6 blocked) · 0 unexplored · 3m12s
# map: ~/.local/share/rastro/floods/shop-test/map.md
rastro flood show shop-test # the map, about 4k tokens: writes, reads, states, blocks
rastro flood show shop-test E7 # one endpoint: who calls it, samples, how to dig in
# E7 GET shop.test/api/orders/{id} 200 json ×12 ← S4 «Ver pedido» +3
# flood-shop-test-w2#88 r311 https://shop.test/api/orders/1042
# rastro -s flood-shop-test-w2 request r311 --curl · rastro -s flood-shop-test-w2 effects 88
rastro flood show shop-test S4 # one state: each element, what it did, where it led
rastro flood resume shop-test --from S4 --depth +2 # flood one branch deeper- Pipes.
--workers Nruns N sessions in parallel,flood-<name>-w1…wN, draining one shared queue shallowest-first. Each worker is a session of its own because attribution is one action at a time per page. All of them start with the cookies and storage of the session you runfloodfrom, so you log in once. - States, not URLs. A screen is its URL template plus its controls, so
/orders/1and/orders/2are one state, and a dialog opened in place is another. Ids, numbers inside names (page-{n}.html) andindex.htmlare folded. Slugs are learned from sibling links: five links that differ only in one segment (/tag/love/,/tag/life/, …) make it{slug}. A worker reaches a state by its URL, then the clicks that led there. Thirty links to the same template are tried once, the 20 identical «Add to basket» buttons of a list once, and a header or nav control once per flood. - Polite, never stealthy. The default rate is 2 actions per second per
host, across all workers, with jitter and a concurrency cap. A 429 or 503
halves the rate and honours
Retry-After. robots.txt is respected unless--ignore-robots. A CAPTCHA, 2FA or bot wall pauses the host, and two in a row stop it. Flood detects and backs off. It does not change the fingerprint, rotate identities or solve challenges. - Writes are found, not sent. The write guard keeps its default: nothing is
allowed. A blocked write is recorded with its method, URL and body (masked),
so the map shows what a form would send, with its field names. Buttons named
like logout, delete, pay, unsubscribe and the like are listed but never
clicked, in English and Spanish.
--skipadds names to that list and--includelets one through. Forms get neutral filler before a submit ([email protected],1). Password fields are never filled. - Drillable. Every activation is a normal action (
[flood]inhistory) in its worker's trace, soeffects,request --curlandsnapshotwork on it, after the flood too. - Background.
--detachreturns at once.flood status,flood stop(the map keeps what was left as unexplored) andflood listfollow it. Over MCP:rastro_flood_start,rastro_flood_status,rastro_flood_map,rastro_flood_resume,rastro_flood_stop.
Limits: --depth 3, --budget 300 (elements tried), --time 10m,
--rate 2, --concurrency 2. Maps live in ~/.local/share/rastro/floods/<name>/
(map.json, map.md).
Machine-readable output
With --json, every command prints one line:
{"schemaVersion":1,"ok":true,"data":{"action":3,"requests":1}}
{"schemaVersion":1,"ok":false,"error":{"kind":"runtime","message":"the recipe is stale…","hint":"run flow link again, then emit"}}data is what the command returns; a routine that ran and failed is
ok: false with its result in data. The text error still goes to stderr.
Exit codes: 0 success, 1 runtime error, 2 usage error. schemaVersion
changes when the envelope or a command's data changes shape.
Using a browser profile you already have
Every session gets its own profile by default. A session can instead borrow a profile of a browser you already use, with its logins, cookies and extensions:
rastro profiles
# rastro Rastro's own profile for session "default" ← this session
# chromium:Default Chromium "Work" · free
# brave-origin:Default Brave Origin "Personal" · IN USE: Brave Origin is open (pid 3382), it must be closed before Rastro can use this profile
rastro -s personal profile use brave-origin:Personal # by directory or by the name the browser shows
# personal: Brave Origin Default "Personal" · writes blocked everywhere by default — Brave Origin must be closed while this session runs
rastro -s personal open https://mail.example.test
# profile: Brave Origin Default "Personal" (the user's own) · Brave Origin must stay closed until this session closes (rastro close)
rastro -s personal close # gives the profile back
rastro -s personal profile use rastro # back to Rastro's own profileopen --profile <ref> binds and opens in one step. The binding sticks to the
session, so routines that name that session use it too. Known browsers:
chromium, chrome, brave, brave-origin, edge, vivaldi.
Writes stay blocked by default here too, and a borrowed profile is where that
matters most: every write goes out with your real accounts. The hosts you
trust the session with can be saved with the binding, so they apply to every
open without repeating them:
rastro -s personal profile use brave-origin:Personal --allow-write youtube.com,google.com
rastro -s personal open https://www.youtube.com
# profile: Brave Origin Default "Personal" (the user's own) · writes allowed to youtube.com, google.com · ...An explicit open --allow-write replaces the saved list for that run, and
--allow-write '*' allows every host. Binding again without --allow-write
clears the list. Only the CLI saves it; over MCP, allowWrite on rastro_open
applies to one run.
The browser has to be closed first. Chromium lets one process at a time
use a profile. If the browser is open, open fails at once and says so;
Rastro never closes it for you. It matters both ways: while a session holds
the profile, starting the browser by hand hands the new window to Rastro's
instance (headless by default) instead of opening one. Close the session
before you use the browser again: a session with its browser open does not
close itself, however long it sits idle.
What Rastro does to keep the profile yours:
- It launches the browser that owns the profile, never
RASTRO_CHROMIUM, so a profile is not opened by another brand or an older version. - It keeps the system keyring (no
--password-store=basic), so saved logins can be decrypted. A distro wrapper's flags file, such as~/.config/brave-origin-flags.conf, still applies. - It does not touch the profile's preferences (no DuckDuckGo seeding).
- Your saved tabs survive. A browser writes its open tabs as the profile's
last session when it closes, so "continue where you left off" would reopen
Rastro's tabs. Rastro copies
Sessions/aside before launching and puts it back after closing. If the session is killed withkill --force(or crashes), that copy is kept assessions/<name>/profile-sessions-backup.previnstead of being restored over tabs you may have opened since.
Your open tabs are not restored inside the Rastro session: it starts on a blank page with your logins in place.
Daemon control
Every session has its own daemon. ps shows it as rastro[<session>] and its
pid is in ~/.local/share/rastro/sessions/<session>/daemon.pid.
rastro status # running | busy | stopped, per session
rastro -s my-session close # clean stop (needs the daemon to answer)
rastro -s my-session kill # by signal, for a wedged daemon
rastro -s my-session kill --forcebusy is not a failure: the daemon handles one request at a time, so during a
navigation or a long flow it answers busy and is perfectly alive.
Claude Code plugin
Install
The plugin ships the skill, the agent and an MCP entry that runs rastro mcp,
so the CLI has to be on PATH first — npm i -g @rixmerz/rastro. Without it the
plugin installs and every tool call fails with rastro: command not found.
npm i -g @rixmerz/rastro
claude plugin install /path/to/rastro/pluginOr copy plugin/skills/rastro/ and plugin/agents/navegador.md into
~/.claude/skills/ and ~/.claude/agents/.
Use
/rastro View the page, then click on something and read the summaryDelegate a multi-step goal:
/navegador Log in with [email protected] | password and verify dashboard accessMap a whole site and ask about it:
/navegador Map https://shop.test with a flood and list the endpoints that writeMCP tools in Claude Code:
claude mcp add rastroExports
rastro export har [path] # HTTP Archive 1.2, for any HAR tool
rastro export perfetto [path] # Chrome Trace Event Format, for ui.perfetto.dev
rastro export pw-trace [path] # Playwright trace.zip (if opened with --pw-trace)Architecture
Agent / human
↓
CLI (rastro)
↓
local daemon (Unix socket)
↓
Playwright + CDP ← Chromium
↓
SQLite trace (append-only)Each session has its own daemon, browser profile and persistent trace.
Development
pnpm test # test suite
pnpm typecheck # TypeScript
pnpm lint # ESLintLicense
Apache License 2.0. See LICENSE.
Version history in CHANGELOG.md. Normative specifications in openspec/specs/.
