Skip to main content
Glama

jevnav

Page truth for browser agents — and decisions that replay, test and audit.

CI PyPI Python MCP registry Marketplace License

https://github.com/user-attachments/assets/502550ec-77d4-439e-b334-fe7007f946b9

jevnav is a browser layer for agents and tests. It reads a page as facts (structure, computed styles, the controls on screen), lets Jev — TypeSafe's model for structured questions — pick the element for an intent with a calibrated probability, gates risky or uncertain actions to a human, and records every decision in a trace that replay re-checks offline in CI.

  • Page truth, not pixels. outline, styles and diff return what the browser resolved — font-size 32px → 28px between a mockup and the running app is something an agent can fix. No screenshots in the decision loop.

  • Evidence, not confidence. Each decision carries its probability, the gate verdict and its cost. A site change that breaks a recorded decision makes replay exit 1 — no model call, no API key.

  • Works where your agent works. CLI, Python/pytest, an MCP server for Claude Code, Cursor, Codex and friends, and a GitHub Action.

Why it exists — selector tests break when a label changes; LLM browser agents are confident, unauditable and occasionally wrong: docs/why.md.

Install

uv tool install jevnav          # or: pip install jevnav  (the MCP server is included)
playwright install chromium     # one-time browser download

Requires Python 3.10+. Deciding (go, run, browse, goal) needs a TypeSafe API key in TYPESAFE_API_KEY or ~/.config/typesafe/apikey.txt. replay, diff, outline and styles need no key — that is the point.

Related MCP server: playwright-mcp-server

Quickstart

1. Let Jev drive — state a goal and the outcome that proves it:

jevnav go --goal "sign in with the demo account and open the pricing page" \
  --start https://app.example.com/login \
  --context email=demo@example.com --context password="${ACME_PASSWORD}" \
  --success "#pricing.visible" \
  --report goal.md
status: done — outcome verified against the page
steps: 5 — auto 4, review 0, blocked 0

One Jev request per step; every step is gated and traced. The loop stops when the goal is met, when nothing on the page can make progress (stuck), when the gate wants a human (review), when the page stops changing (no_progress), or at --max-steps. done is a claim — --success turns it into evidence (verified, or unverified and the run fails). --dry-run decides without acting.

2. Or script the flow and let Jev resolve each intent:

# flows/acme-login/flow.yaml
id: acme-login
start: https://app.example.com/login
steps:
  - intent: "Sign in to the existing account"
    action: click
  - intent: "Type the password"
    action: fill
    value: "${ACME_PASSWORD}"   # read from the environment, never written to the trace
  - intent: "Submit the login form"
    action: click
jevnav run flows/acme-login/flow.yaml --report run.md

3. Replay it in CI — offline, deterministic, no key:

jevnav replay acme-login.trace.jsonl            # re-resolve every recorded decision
jevnav replay acme-login.trace.jsonl --execute  # also re-run the actions + check --success
steps 3  verdicts: ok 3

Change Sign in to Log in on the site and the same replay fails:

[01] changed   Sign in to the existing account
      no element now has 'button|sign in' (was 'Sign in' / 'button')

Exit code 1, with the reason. That is the regression test.

Page truth for your agent

The facts a coding agent needs about a rendered page, without a screenshot: outline(selector) for a region's structure (tags, headings, text, boxes), styles(selector, props) for the computed values, page_state() for the controls jevnav can act on.

jevnav diff compares a mockup with the running app as facts and exits 1 on drift:

jevnav diff new-ui.html http://localhost:3000 --report ui-diff.md

element

property

mockup

app

h1 [Pricing]

font-size

32px

28px

button#cta [Start free]

border-radius

8px

4px

The report also lists structure differences (missing, new and moved elements; boxes compared with a 4px --tolerance). The loop for "here is a new UI, update the codebase": the agent reads both pages with jevnav, edits the code itself, re-runs diff until it exits 0, then pins the outcome with goal(..., success="<selector>") so replay --execute keeps checking it. jevnav reports; it never edits your repository and never compares pixels.

Gates

Every decision gets one of three verdicts:

verdict

meaning

auto

confidence at or above the threshold and nothing risky — the action runs

review

a human confirms first: low p, a risky intent, or a truncated candidate list

blocked

no decision was possible (the model answered none, or the call failed)

review and blocked never execute. Thresholds and risky patterns live in an optional gates.yaml; defaults ship for nine languages:

# flows/acme-login/gates.yaml
min_confidence: 0.9        # scripted flows: one question per step, well calibrated
loop_min_confidence: 0.5   # goal loop: four questions at once, p runs lower
risky:
  - "\\b(delete|remove|purchase|pay)\\b"   # matched against intent + element name + role
intents:
  "delete the *": { min_confidence: 0.99 }
truncated: review          # the page had more than 255 candidates

The goal loop uses a lower threshold on purpose: measured correct loop decisions land at p 0.41–0.99 and wrong ones at 0.39–0.47, so its safety comes from deterministic checks instead — fill on a button is refused, a field with no context value is blocked, two steps that change nothing stop the run, risky patterns always go to review, and the outcome is verified against --success.

MCP server

claude mcp add --scope user jevnav -- uvx jevnav mcp

Or, for Cursor, Claude Desktop, VS Code and other clients:

{
  "mcpServers": {
    "jevnav": {
      "command": "uvx",
      "args": ["jevnav", "mcp"],
      "env": { "TYPESAFE_API_KEY": "..." }
    }
  }
}

No URL or flags needed: the agent opens pages with goto, one server serves every site, and each session writes an auditable jevnav-session.trace.jsonl (--no-trace opts out). The deciding tools are what no other browser MCP has:

tool

what it does

browse(intent, action, value, min_confidence)

one step: Jev picks the element, the gate decides, only auto acts

goal(goal, context_json, max_steps, success)

drive the whole way; returns done / stuck / review plus the verification

goto(url) · page_state() · summary()

open a page, list what jevnav can act on, session totals

Plus 28 acting and inspecting tools (forms, keys, uploads, tabs, console, network, styles, outline, emulation, tracing, Lighthouse), each with MCP annotations so the host knows which calls change state. A decision costs about $0.00004 and ~330ms, and the page never enters the LLM's context. Full tool reference, security flags and when to pick jevnav vs. Playwright or chrome-devtools-mcp: docs/mcp.md.

CI — GitHub Action

- uses: dtduc-git/jevnav@v0
  with:
    trace: examples/local-demo/demo.trace.jsonl
    execute: "true"          # also re-run the recorded actions
    report: replay.md

No model call, no API key, ~30 seconds. Fails when a recorded target changed, became ambiguous, or a recorded --success selector is no longer visible. Inputs: trace, report, execute, json, version (default latest from PyPI, or local for a checkout). @v0 floats; pin a release tag such as @v0.2.2 for fully reproducible CI.

pytest

The jev fixture ships with the package: an ordinary Playwright test gets Jev decisions, and every test writes a trace that replays in CI.

def test_sign_in(jev):
    jev.goto("https://app.example.com/login")
    jev.fill("the email address", "demo@example.com")
    jev.fill("the password field", "${DEMO_PASSWORD}")
    jev.click("the sign-in button")
    jev.expect("#welcome")
DEMO_PASSWORD=... pytest --jev-trace-dir=traces
DEMO_PASSWORD=... jevnav replay --execute traces/test_sign_in.trace.jsonl   # offline, no key

A review verdict fails the test before the action runs, ${VAR} values are recorded by name only, and jev.page is the real Playwright page for everything else. Runnable example with a committed trace: examples/pytest-interop/.

Your own browser

jevnav go --goal "..."                                          # fresh headless Chromium (default)
jevnav go --goal "..." --user-data-dir ~/.cache/jevnav-profile --headed   # persistent profile
jevnav go --goal "..." --cdp http://127.0.0.1:9222              # attach to a running Chrome

Log in once with --headed and every later run reuses the profile; --cdp drives the Chrome you already have open, keeps its own settings (so it refuses --user-data-dir, --locale, --timezone and --user-agent) and never closes it. Both work on run, go, replay and mcp, and so does --browser for firefox or webkit (plus --locale, --timezone, --user-agent). Profile paths and cookies never reach a trace.

Evidence

what

result

source

element picks on real sites (9 sites, jev-1.13.0)

41/41 scored cases correct; 30/30 at the p ≥ 0.9 gate

research/browser-element-selection.md

decision latency and cost

p50 365ms, $0.000153 per decision

same

goal loop (local fixture, 4 goals × 2 wordings)

8/8 goals correct, incl. the impossible one (stuck)

docs/evidence.md

driving tasks vs. chrome-devtools-mcp (same LLM, n=2)

jevnav 8/8, chrome-devtools-mcp 6/8; chrome-devtools 2.4× faster end to end

research/driving-benchmark.md

replay

deterministic: offline, no key, exit 1 on a broken decision

run it on your own traces

Small samples with a single annotator: read them as direction, not proof. jevnav's advantage is decision cost and evidence, not wall-clock speed on small pages. Method, caveats and the tool-level comparison: docs/evidence.md.

How it works

jevnav architecture

  • A shortlist, not the page. Visible interactive elements from every frame and open shadow root, ranked by how likely a human would act on them and capped at 120 (--max-candidates, hard cap 254). Each carries role, accessible name, type, href, placeholder and a scope, so three "Email" fields stay distinguishable.

  • One question per step. The shortlist plus none becomes a choice question; Jev answers with one element and its probability.

  • Fingerprints, never positions. An element's identity is role|name. The trace stores every candidate's fingerprint as the model saw it, and actions and replay resolve by fingerprint with a uniqueness check, so a shifted page cannot click the wrong thing.

  • Replay verdicts. ok, moved, changed, ambiguous, error — the last three fail. --normalize REGEX relaxes known churn such as Cart (3) → Cart (4); strict is the default.

The trace format is a public contract: SPEC.md. Interactive architecture diagram: docs/architecture.html. Beyond the web: docs/games.md (Jev playing a game from structured state, measured against a random control).

Non-goals

  • Not a planner. go/goal drive toward a goal you state; deciding what to do stays with you or your agent — jevnav decides where, and records why.

  • No pixel decisions. No screenshots or canvas vision in the decision loop (screenshot exists for humans), and no text generation — fill values come from your flow, context or environment.

  • No hosted service, no telemetry. Nothing leaves the machine except the question sent to your configured Jev endpoint.

Privacy

Traces contain page URLs, element names and your actions — never screenshots. The goal loop also sends a short digest of the page's visible text and current form values (passwords masked); scripted flows send neither. ${ENV} values are recorded by name only. Add *.trace.jsonl to your .gitignore and audit a trace before sharing it. See SECURITY.md for the authority boundary of the MCP server.

Suite

jevnav is the browser piece of a verification stack: mcplint (MCP configs), harnessguard (agent harnesses), jevassert + jev-packs (calibrated decision packs), and jev-table.

License

Apache-2.0 · Releases and changelog

Available Tools

33 tools
browseA
Destructive

Find the element matching an intent and, if the gate allows it, act on it.

    Returns the gate verdict (auto / review / blocked), the confidence, the
    target element and its Playwright selector. Only ``auto`` decisions are
    executed. On large pages even precise intents score 0.8-0.95, so pass
    ``min_confidence`` to set your own bar; risky patterns and the
    deterministic checks still apply and cannot be overridden.
    

Inputs: intent (required), value, action, min_confidence. Returns: result

close_pageA
Destructive

Close the tab at this index (see tabs). If it was the tab being driven, jevnav drives the last remaining one; closing the only tab, or an out-of-range index, is an error. Returns the tabs that remain.

Inputs: index (required). Returns: result

consoleA
Read-onlyIdempotent

Recent console messages and page errors, newest last (observation only; not part of a trace). Returns {messages:[{type, text}]}, where type is the console method (log, info, warning, error, debug, ...) or pageerror; only_errors keeps warning, error and pageerror. Read it after an action to see what the page complained about.

Inputs: limit, only_errors. Returns: result

dialog_policyA
Destructive

Answer dialogs from now on. match=None sets the session default; with a match, adds a rule for dialogs whose text contains it (an earlier rule with the same text is replaced). Applies to future dialogs only; dialogs already seen stay recorded.

Inputs: match, action. Returns: result

dialogsA
Read-onlyIdempotent

Every alert/confirm/prompt seen, with the policy that resolved it.

Inputs: no named parameters. Returns: result

dragA
Destructive

Drag the element at source_selector onto target_selector. The drag runs immediately with no confirmation, so a wrong target can change page state.

Inputs: source_selector (required), target_selector (required). Returns: result

emulateA
Idempotent

Emulate media, geolocation ("lat,lon"), connectivity and a slow device. Media overrides (color scheme, reduced motion, forced colors) apply to the current tab; geolocation and offline apply to the whole browser context, so later tabs and loads keep them. Fields you omit are left unchanged. The position persists context-wide, but only an http(s) origin that called emulate can read it (that origin gets the geolocation permission); call emulate again after navigating elsewhere. cpu_throttle slows the current tab's CPU by that factor (4 = four times slower; 1 restores full speed). network_conditions throttles the current tab's network with a preset ("Slow 3G", "Fast 3G", "Slow 4G", "Fast 4G", or "No throttling" to switch it off) or with explicit latency_ms/download_kbps/upload_kbps. A network call replaces the tab's whole network profile (unset latency is 0, unset throughput is unthrottled) rather than editing it. Throttling lasts until changed and needs a chromium server (it goes through CDP); on firefox/webkit it is refused before anything else is applied.

Inputs: media, offline, latency_ms, geolocation, +7 more. Returns: result

fill_formA
Destructive

Fill several fields in one call. fields_json is a JSON list of {selector|intent, value, action?}; action is fill (default), select, check or type. fill and select replace the value, type appends, check ticks when value is true-like ("true", "1", "yes", "on" or omitted) and clears otherwise. An intent is resolved by Jev against the page's text, search, combobox, checkbox and radio inputs — or, when the page has none of those, any interactive element. Returns {filled:[...]}; a field with neither selector nor intent is an error.

Inputs: fields_json (required). Returns: result

goalA
Destructive

Drive the browser towards a goal: Jev decides every step, jevnav acts.

    ``context_json`` is a JSON object of values the goal may need, e.g.
    {"email": "a@b.c", "password": "${PW}"}. ``success`` is a selector that
    must be visible when the goal is done: pass it and the outcome comes
    back verified or the run is reported as unverified. Returns the outcome
    (done, stuck, review, ...), the steps taken, cost and the verification.
    Risky steps stop the loop and come back unexecuted.
    

Inputs: goal (required), success, max_steps, context_json. Returns: result

gotoA
Idempotent

Open a URL in the current tab, replacing its content, and wait until the DOM is ready. Returns {url, title, elements}, where elements is the number of interactive elements found; call page_state for the candidate list.

Inputs: url (required). Returns: result

heap_snapshotA
Destructive

Write a Chromium heap snapshot of the current page to a file (default: jevnav-heap-.heapsnapshot under --file-root, which defaults to the working directory and must be set explicitly if the server runs from / or $HOME; the path must stay inside it), for Chrome DevTools > Memory. A snapshot is a full JS heap dump, often hundreds of MB; an existing file at the same path is overwritten. Use it to chase a memory leak, not for routine inspection — it changes nothing on the page, and it is chromium-only.

Inputs: path. Returns: result

lighthouseA
Idempotent

Run Lighthouse (through npx) against the current or given URL and return the scores. Needs node/npx on PATH (npx fetches Lighthouse on first use), takes tens of seconds, and does not change the page.

Inputs: url, categories. Returns: result

networkA
Read-onlyIdempotent

Recent network requests, newest last; only_failed keeps 4xx/5xx and transport errors. Each entry carries method, url, status, resource, error (for failed requests) and id — pass that id to network_detail for headers and body.

Inputs: limit, only_failed. Returns: result

network_detailA
Read-onlyIdempotent

Headers and (text) body of one recorded request: pass the id from network's output, or url_contains for the newest matching URL. Reads jevnav's own network buffer; nothing is re-requested.

Inputs: id, url_contains. Returns: result

new_pageA

Open a new tab (optionally at a URL) and drive it from now on.

Inputs: url. Returns: result

outlineA
Read-onlyIdempotent

Structural outline of a page or region: the shape an agent can act on, without a screenshot. Returns {selector, count, elements}, one entry per heading, landmark, section, form, label, control, link, image or text block inside selector (default "body"), capped at limit (default 200) in document order; each entry carries tag, level (h1-h6), text, ownText, leaf, name, id, classes and box [x, y, width, height]. A selector that matches nothing falls back to the whole body (the result still echoes the selector you asked for). Use it before editing a region or diffing a mockup against the app — page_state is the clickable list, styles the computed CSS, screenshot for humans. Reads only.

Inputs: limit, selector. Returns: result

page_stateA
Read-onlyIdempotent

Current URL, title and the interactive elements jevnav can see. The elements it can act on carry a jevnav data-jevcid stamp.

Inputs: no named parameters. Returns: result

perf_metricsA
Read-onlyIdempotent

Chromium performance counters for the current page, read over CDP: DOM nodes, JS heap size, layout and task durations. Cheap telemetry for spotting growth between actions; for real profiling use chrome-devtools. Reads the page, changes nothing, chromium only.

Inputs: no named parameters. Returns: result

press_keyA
Destructive

Press a key or a combination ("Control+A", "Shift+Enter"). With a selector, presses on that element (first match); without, on the page. Acts immediately — a shortcut or Enter can submit or delete — and returns {key, selector}.

Inputs: key (required), selector. Returns: result

read_jsA
Destructive

Evaluate a JS expression in the page and return its value. This is arbitrary JavaScript: an expression can change page state, so treat it as an action and keep it for reading values only (disable with --no-eval).

Inputs: expression (required). Returns: result

resizeA
Idempotent

Resize the browser viewport to width x height. The size persists for the session and can change what the page renders (responsive layout).

Inputs: width (required), height (required). Returns: result

routeA

Stub or block requests matching a URL pattern (testing). The stub persists until unroute; the call is recorded as an action, never part of a replay path.

Inputs: pattern (required), body, abort, status, +1 more. Returns: result

screenshotA
Destructive

Save a PNG of the page (or one element) to a path, for a human to look at.

Inputs: path, selector, full_page. Returns: result

scrollA

Scroll the page down or up by pixels of document height.

Inputs: amount, direction. Returns: result

select_pageA
Idempotent

Drive the tab at this index (see tabs). The switch is immediate; the tab keeps its state, and an out-of-range index is an error.

Inputs: index (required). Returns: result

stylesA
Read-onlyIdempotent

Computed styles for the elements matching a selector (the facts behind a visual diff).

Inputs: selector (required), limit, props. Returns: result

summaryA
Read-onlyIdempotent

This session so far: steps, auto/review/blocked counts, cost, latency.

Inputs: no named parameters. Returns: result

tabsA
Read-onlyIdempotent

List the open pages and which one jevnav is driving.

Inputs: no named parameters. Returns: result

trace_startA

Start a Playwright trace (open it later with npx playwright show-trace).

Inputs: screenshots. Returns: result

trace_stopA
Destructive

Stop the Playwright trace started by trace_start and write the zip to path (default: jevnav-trace-.zip under --file-root, which defaults to the working directory and must be set explicitly if the server runs from / or $HOME; the path must stay inside it). The zip holds snapshots and, if enabled, screenshots of everything since trace_start — open it with npx playwright show-trace <path>. Stopping without a started trace is an error; passing the same path again overwrites that zip. Chromium, Firefox and WebKit all support it.

Inputs: path. Returns: result

unrouteA
Idempotent

Remove one route stub, or all of them.

Inputs: pattern. Returns: result

upload_filesA
Destructive

Set files on a file input, chosen by a CSS selector or by an intent Jev resolves. With an intent and several file inputs, the choice goes through the gate first. Every path must exist and sit inside --file-root (default: the working directory; set it explicitly if the server runs from / or $HOME); the call replaces the input's current selection. Returns {files, status, reason, target, executed} — status "review" or "blocked" means nothing was set.

Inputs: paths (required), intent, selector. Returns: result

wait_forA
Read-onlyIdempotent

Wait until text or a selector appears, then report the page like page_state (element stamps included).

Inputs: text, selector, timeout_ms. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 33 tools

    Disambiguation4/5

    Most tools have distinct purposes and detailed descriptions that clarify boundaries (e.g., page_state vs outline vs styles, browse vs goal). A few adjacent tools like wait_for/page_state and the many diagnostic tools could still be confused, but the set is largely unambiguous.

    Naming Consistency3/5

    All names use snake_case, but conventions are mixed: action verbs (goto, scroll, press_key), noun-like observation tools (page_state, console, network), and noun_verb pairs (trace_start/trace_stop). Readable but not a consistent verb_noun pattern.

    Tool Count2/5

    33 tools is too many for the apparent scope. While browser automation is broad, many advanced diagnostic tools (perf_metrics, heap_snapshot, lighthouse, trace_start/stop, network_detail) could be consolidated or made optional, making the surface heavy.

    Completeness4/5

    Core browser automation is well-covered: navigation, element interaction, forms, tabs, network/dialog observation and interception, emulation, and performance/tracing. Minor gaps exist (e.g., explicit hover/double-click, cookie/storage, iframe handling) but agents can often work around them.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers