ui-loop is a tool that provides "visual feedback within the context budget" for coding agents, released in three forms: an MCP server, a CLI, and a Claude Code plugin. Its core goal is to let agents see the rendered result after modifying the UI while avoiding a full screenshot filling up the context window.
Purpose and capabilities On each capture, ui-loop does not return a full screenshot; instead it returns: a short structured text summary, plus small cropped images containing only the regions that changed since the last capture, all kept within a user-specified token budget. The text summary always includes: page title, final URL, viewport, deduplicated console errors/warnings and uncaught exceptions (with a cap), failed requests with status code ≥ 400 (with a cap), horizontal overflow (document.scrollWidth > innerWidth), layout shifts of watchSelectors (default h1,h2,nav,main,button,[role=dialog]), axe-core violations (default impact ≥ serious, with a cap); for diffs, it also includes the pixel change percentage, the bounding box of each region, and the nearest element at its center (tag, role, text snippet).
Usage Installation methods include: Claude Code plugin (recommended; registers the MCP server, PostToolUse hook, and skills), pure MCP server (add configuration in .cursor/mcp.json), and installation from a GitHub URL for Copilot, Codex, and Cursor via plugin.json and mcp.json in the repository root. Chromium is resolved in the order of UI_LOOP_CHROMIUM, Playwright's bundled Chromium, and common system paths; if none is found, you can run npx playwright install chromium or set UI_LOOP_CHROMIUM.
Typical workflow: ui_detect_dev_server detects the dev server → ui_capture establishes a baseline before editing (the first call returns a downsampled full image) → edit → ui_diff returns the text summary and budgeted crops of changed regions → call ui_region if you need a closer look → after fixing, call ui_dif againf (each diff becomes a new baseline) → ui_assert ends with a plain-text check. After installing the plugin, the PostToolUse hook automatically runs a diff when *.tsx|jsx|css|scss|mdx files are edited and a dev server is detected, and injects a summary of no more than 1500 characters, without images, as additional context, without blocking the tool call.
Budget and storage Each tool accepts maxTokens (default 4000). The allocation order is: text summary (always included, usually 100–300 tokens) → region crops included from largest to smallest by area (each padded by 16px, longest edge downsampled to ≤ 512px, until the budget is exceeded) → omitted items are explicitly stated → full screenshots are included only when a label is first captured or when includeFull: true. Image tokens are estimated using the Anthropic formula ceil(width × height / 750), and text is estimated as ceil(chars / 4); other models are billed differently, so this estimate should be treated as an upper-bound heuristic. Capture files are stored in .ui-loop/captures/<label>/<timestamp>.png and .json, and ui-loop init adds .ui-loop/ to .gitignore.
Use cases and limitations Suitable for coding-agent workflows that need to verify "did my change render correctly". Limitations include: static URL capture only, with no support for clicks, input, or authentication flows; pixel diffs are sensitive to animations, carousels, timestamps, and non-deterministic data (CSS animations/transitions are paused, but content that changes on every load will still show as changed); fullPage diffs produce large regions when page height changes, so viewport capture is more stable; route inference covers only the Next.js App Router, and other frameworks default to / unless UI_LOOP_ROUTE or UI_LOOP_URL is set; token estimation follows the Anthropic formula, and actual billing varies by model and provider; axe-core checks only the rendered DOM and does not include keyboard navigation checks; Cursor hooks are best-effort, and their hook contract changes between versions. The project is under the MIT license.