Hypagon Gateway

JEV (Just-Enough-View) page compaction

JEV keeps large pages out of the agent's context window. Instead of returning a full page Markdown dump, the agent gets a compact surface index (Tier 1) and fetches only the sections it needs from an in-memory depth store (Tier 2).

Availability

Optional, not experimental:

Modes

Mode Behaviour
prefer Tools lead with the index and descriptions steer reads to it. Full-page reads still work.
enforce Unscoped page reads are refused with JEV_REQUIRED; the agent must use jev_index โ†’ read_section.

enforce applies to observe(as:"markdown"), observe(as:"text"), and GET /markdown (the get_page_markdown / harvest_markdown aliases).

Allowed while enforcing:

budget: 0 means "the whole construct", so it is treated as unbounded and refused.

Refusal contract

{
  "success": false,
  "code": "JEV_REQUIRED",
  "error": "Unscoped page reads are disabled while JEV enforce is on. โ€ฆ",
  "page": { "url": "โ€ฆ", "tokens": 14823, "sections": 8 },
  "next": [
    { "tool": "jev_index" },
    { "tool": "read_section", "arguments": { "section_id": "sec_1" } }
  ],
  "override": { "parameter": "full", "value": true, "note": "bypasses the funnel and is logged" }
}

HTTP status is 409.

Safety valves

Tools

Tool Route Purpose
jev_index GET /jev/index Build/refresh the surface index for the active page.
read_section POST /jev/read Fetch one section body (include_children for nested subsections).
search_page POST /jev/search Keyword/regex scan over all folded section text, with snippets.
โ€” GET /jev/stats Funnel counters and JEV status.

Preferred reading path

JEV is not just available when it is active โ€” the tool surface is arranged so it is the default way to read a page:

Activation and mode are read when the MCP server starts, so after flipping the switch in Settings, reconnect the MCP client (or restart the app) to reorder tools/list and adopt the enforce text. While JEV is off the three tools are not registered at all โ€” their schemas cost ~1k tokens per request, so a disabled feature must not bill. The bridge side โ€” the gate, the funnel, the navigate nudge, and the route errors โ€” is live either way.

Implementation

Limits

This is token discipline, not a security boundary. read_url, capture(rendered), screenshots and evaluate_javascript can still pull bytes without going through the funnel.

JEV covers page reads only. Hypagon REST (wrap_run) is outside it: a wrapper response is already projected by the response recipe, with maxItems, maxChars and maxFieldChars, plus the pagination cap.