Labsco
patchorbit logo

Domscribe

β˜… 171

from patchorbit

Build-time DOM-to-source mapping for coding agents

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup
<p align="center"> <img src="./docs/logo.png" alt="Domscribe" width="200" /> </p> <h1 align="center">Domscribe</h1> <p align="center"> <a href="https://www.npmjs.com/search?q=%40domscribe"><img src="https://img.shields.io/npm/v/%40domscribe/core?label=npm&color=cb3837" alt="npm version" /></a> <a href="https://github.com/patchorbit/domscribe/actions"><img src="https://img.shields.io/github/actions/workflow/status/patchorbit/domscribe/ci.yml?label=CI" alt="CI status" /></a> <a href="#"><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Narrator/1bedc40fc56874758abd3b7caf4d6748/raw/domscribe-coverage.json" alt="test coverage" /></a> <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license" /></a> <img src="https://img.shields.io/badge/TypeScript-5.x-3178c6?logo=typescript&logoColor=white" alt="TypeScript" /> <img src="https://img.shields.io/badge/node-%3E%3D18-417e38?logo=node.js&logoColor=white" alt="Node.js >= 18" /> <a href="https://github.com/patchorbit/domscribe/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen" alt="PRs welcome" /></a> </p> <p align="center"> <a href="https://www.npmjs.com/package/@domscribe/react"><img src="https://img.shields.io/badge/React-61DAFB?style=flat&logo=react&logoColor=black" alt="React" /></a> <a href="https://www.npmjs.com/package/@domscribe/vue"><img src="https://img.shields.io/badge/Vue-4FC08D?style=flat&logo=vuedotjs&logoColor=white" alt="Vue" /></a> <a href="https://www.npmjs.com/package/@domscribe/next"><img src="https://img.shields.io/badge/Next.js-000000?style=flat&logo=nextdotjs&logoColor=white" alt="Next.js" /></a> <a href="https://www.npmjs.com/package/@domscribe/nuxt"><img src="https://img.shields.io/badge/Nuxt-00DC82?style=flat&logo=nuxt&logoColor=white" alt="Nuxt" /></a> &nbsp;&nbsp; <a href="https://www.npmjs.com/package/@domscribe/transform"><img src="https://img.shields.io/badge/Vite-646CFF?style=flat&logo=vite&logoColor=white" alt="Vite" /></a> <a href="https://www.npmjs.com/package/@domscribe/transform"><img src="https://img.shields.io/badge/Webpack-8DD6F9?style=flat&logo=webpack&logoColor=black" alt="Webpack" /></a> <a href="https://www.npmjs.com/package/@domscribe/transform"><img src="https://img.shields.io/badge/Turbopack-000000?style=flat&logo=turborepo&logoColor=white" alt="Turbopack" /></a> </p> <p align="center"> <img src="https://img.shields.io/badge/Claude_Code-d97706?style=flat&logo=anthropic&logoColor=white" alt="Claude Code" /> <img src="https://img.shields.io/badge/GitHub_Copilot-000?style=flat&logo=githubcopilot&logoColor=white" alt="GitHub Copilot" /> <a href="https://cursor.directory/plugins/domscribe"><img src="https://img.shields.io/badge/Cursor-000?style=flat&logo=cursor&logoColor=white" alt="Cursor" /></a> <a href="https://geminicli.com/extensions/?name=patchorbitdomscribe"><img src="https://img.shields.io/badge/Gemini-4285F4?style=flat&logo=googlegemini&logoColor=white" alt="Gemini" /></a> <img src="https://img.shields.io/badge/Kiro-a855f7?style=flat&logoColor=white" alt="Kiro" /> </p> <p align="center"> <a href="https://domscribe.com"><img src="./docs/demo.gif" alt="Domscribe demo β€” click an element, capture context, resolve to source" /></a> </p>

AI coding agents edit your source files blind β€” they can't see your running frontend, and your frontend can't tell them where to look.

Domscribe bridges both directions: click a DOM element to tell your agent what to change, or let your agent query any source location to see exactly what it looks like live in the browser. Build-time stable IDs, deep runtime context (props, state, DOM), framework-agnostic, any MCP-compatible agent. Zero production impact.


Features

Code β†’ UI: Let the agent see the browser

Your agent calls domscribe.query.bySource with a file path and line number and gets back the live DOM snapshot, current props, component state, and rendered attributes β€” directly from the running browser. No human interaction needed.

<p align="center"> <img src="./docs/code-to-ui.png" alt="Code β†’ UI: Let the agent see the browser" width="900" /> </p>

[!TIP] Agents don't spontaneously query runtime state β€” prompt them explicitly: "Fix the button color β€” use domscribe to check what CSS classes it has before changing anything." Your dev server must be running with the target page open in the browser.

UI β†’ Code: Point and tell

Click any element in the browser overlay, describe the change in plain English, and submit. Domscribe captures the element's source location, runtime context, and your instruction as an annotation. The agent claims it, navigates to the exact file and line, and implements the change. The overlay shows the agent's response in real time via WebSocket.

<p align="center"> <img src="./docs/ui-to-code.png" alt="UI β†’ Code: Point and tell" width="900" /> </p>

More

  • 🎯 Build-time stable IDs β€” deterministic data-ds attributes injected via AST, stable across HMR and fast refresh
  • 🧩 Framework-agnostic β€” React 18-19, Vue 3, Next.js 15-16, Nuxt 3+, with an extensible adapter interface
  • πŸ“¦ Any bundler β€” Vite 5-7, Webpack 5, Turbopack
  • πŸ” Deep runtime capture β€” live props, state, and DOM snapshots via React fiber walking and Vue VNode inspection
  • πŸ›‘οΈ Zero production impact β€” all instrumentation stripped in production builds, enforced in CI
  • πŸ”’ PII redaction β€” emails, tokens, and sensitive patterns automatically scrubbed before leaving the browser
  • πŸ“ Annotations live in your repo β€” stored as JSON files in .domscribe/annotations/, exposed via REST APIs that MCP wraps for agent access
  • πŸ“‘ Real-time feedback β€” WebSocket relay pushes agent responses to the browser overlay as they happen

How It Works

<p align="center"> <img src="./docs/architecture.png" alt="Domscribe architecture diagram" /> </p>

1. Inject. The bundler plugin parses each source file, injects HMR-stable data-ds IDs via xxhash64, and records each mapping in .domscribe/manifest.jsonl.

2. Capture. Framework adapters (React fiber walking, Vue VNode inspection) extract live props, state, and component metadata. The overlay UI lets you click any element and see its full context.

3. Relay. A localhost Fastify daemon connects the browser and your agent via REST, WebSocket, and MCP stdio. A file lock prevents duplicate instances across dev server restarts.

4. Agent. Your coding agent connects via MCP to query by source (see what any line looks like live) or process annotations (claim, implement, and respond to UI change requests).


Comparison

FeatureDomscribeStagewiseDevInspector MCPReact GrabFrontman
Build-time stable IDsβœ… data-ds via AST❌ Runtime (CDP)❌ No stable IDs❌ _debugSource❌ Runtime framework introspection
DOMβ†’source manifestβœ… JSONL, append-only❌❌❌❌
Codeβ†’live DOM queryβœ… Agent queries source, gets live runtime❌❌❌❌
Runtime props/stateβœ… Fiber + VNode walking⚠️ Shallow⚠️ DOM-level + JS eval❌ HTML + component names only⚠️ Props only (framework APIs)
Multi-frameworkβœ… React Β· Vue Β· Next.js Β· Nuxt Β· extensible⚠️ React onlyβœ… React + Vue + Svelte + Solid + Preact❌ React only⚠️ Next.js + Astro + Vite
Multi-bundlerβœ… Vite + Webpack + Turbopack❌ N/A (Electron browser)βœ… Vite + Webpack + Turbopack❌ N/A❌ Dev server middleware
MCP toolsβœ… 12 tools + 4 prompts❌ Proprietary protocol (Karton)βœ… 9 tools⚠️ Lightweight add-on❌ Internal MCP only
Agent-agnosticβœ… Any MCP client❌ Bundled Electron agentβœ…βœ…βŒ Bundled Elixir agent
In-app element pickerβœ… Lit shadow DOMβœ… Built-in browser selectorβœ… Inspector barβœ… Hover-to-captureβœ… Chat interface
Source mappingβœ… Deterministic (AST IDs)⚠️ AI-inferred⚠️ AST-injected (not stable)⚠️ _debugSource (workaround needed)⚠️ Runtime framework introspection
Licenseβœ… MIT⚠️ AGPLβœ… MITβœ… MIT⚠️ Apache + AGPL

No single competitor combines build-time stable IDs, deep runtime capture, bidirectional source↔DOM querying, and an MCP tool surface in a framework-agnostic way.


MCP Tools

The agent-facing surface β€” tools, prompts, wire schemas, and error envelope β€” is listed below as a human-readable index.

ToolDescription
domscribe.query.bySourceQuery a source file + line and get live runtime context (props, state, DOM snapshot)
domscribe.manifest.queryFind manifest entries by file path, component name, or element ID
domscribe.manifest.statsManifest coverage statistics (entry count, file count, component count, cache hit rate)
domscribe.resolveResolve a data-ds element ID to its source location (file, line, col, component)
domscribe.resolve.batchResolve multiple element IDs in one call
domscribe.annotation.processAtomically claim the next queued annotation (prevents concurrent agent conflicts)
domscribe.annotation.respondAttach agent response and transition to PROCESSED
domscribe.annotation.updateStatusManually transition annotation status
domscribe.annotation.getRetrieve annotation by ID
domscribe.annotation.listList annotations with status/filter options
domscribe.annotation.searchFull-text search across annotation content
domscribe.statusRelay daemon health, manifest stats, queue counts

See the @domscribe/mcp README for detailed tool schemas, response formats, and prompt definitions.


Packages

PackageDescription
@domscribe/coreZod schemas, RFC 7807 error system, ID generation, PII redaction, constants
@domscribe/manifestAppend-only JSONL manifest, IDStabilizer (xxhash64), BatchWriter, ManifestCompactor
@domscribe/relayFastify HTTP/WS server, MCP stdio adapter, annotation lifecycle
@domscribe/transformParser-agnostic AST injection (Acorn, Babel, VueSFC), bundler plugins
@domscribe/runtimeBrowser-side ElementTracker, ContextCapturer, BridgeDispatch
@domscribe/overlayLit web components (shadow DOM), element picker, annotation UI
@domscribe/reactReact fiber walking, props/state extraction, Vite + Webpack plugins
@domscribe/vueVue 3 VNode resolution, Composition + Options API support, Vite + Webpack plugins
@domscribe/nextwithDomscribe() config wrapper for Next.js 15 + 16
@domscribe/nuxtNuxt 3+ module with auto-relay and runtime plugin
domscribeCLI binary (domscribe serve, status, stop, init, mcp)
@domscribe/mcpStandalone MCP server binary (domscribe-mcp)
@domscribe/test-fixturesBlack-box integration + e2e suite (not published)

Contributing

Copy & paste β€” that's it
pnpm install
nx run-many -t build test lint typecheck

Conventions are in .claude/rules/. PRs welcome.


License

MIT