<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Yash's Dev Notes]]></title><description><![CDATA[Technical write-ups on Rust engines, Playwright MCP automation, Chrome CDP verification, and open-source dev tools built by Yash Kashyap.]]></description><link>https://yashh2313.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 21 Nov 2026 16:35:57 GMT</lastBuildDate><atom:link href="https://yashh2313.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Cutting Playwright MCP Runs from 35k Tokens to $0 Local Replay]]></title><description><![CDATA[How I stopped browser MCPs from burning 35k tokens per Playwright test, fixed an offsetParent bug on position:fixed modals, and exported .spec.ts.]]></description><link>https://yashh2313.hashnode.dev/cutting-playwright-mcp-runs-from-35k-tokens-to-0-local-replay</link><guid isPermaLink="true">https://yashh2313.hashnode.dev/cutting-playwright-mcp-runs-from-35k-tokens-to-0-local-replay</guid><category><![CDATA[playwright]]></category><category><![CDATA[Testing]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Yash Kashyap]]></dc:creator><pubDate>Fri, 20 Nov 2026 18:48:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6affdfe7cca8816ac825e912/955c96f6-12b7-4f93-b794-692172a6bf56.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<pre><code class="language-text">TimeoutError: locator('button.submit-btn') not found
=========================== logs ===========================
waiting for locator('button.submit-btn')
</code></pre>
<p>If you've asked Claude Code, Cursor, or Antigravity to run end-to-end Playwright tests on a web app, you've probably watched it fail in two annoying ways. Either the agent reads your JSX files, guesses CSS selectors blind, and trips over CSS modules or client hydration. Or it connects to a live browser MCP that pulls a huge DOM dump or screenshot after every single click.</p>
<p>By step 12 of a normal checkout flow, you've burned 35,000 tokens, waited over a minute, watched <code>/compact</code> eat half your session context, and guaranteed that re-running the exact same regression test tomorrow costs another <code>$0.85</code> in API tokens.</p>
<p>For open-ended UI exploration that cost makes sense. When you already know the login or checkout flow you want to verify, it's pointless. So I built <a href="https://github.com/yashh1323/auto-qa"><code>auto-qa</code></a> (MIT) to pull the LLM out of the click loop, run Playwright locally for <code>$0</code>, and compile passing runs into plain <code>.spec.ts</code> files.</p>
<p><img src="https://raw.githubusercontent.com/yashh1323/auto-qa/main/assets/auto-qa-hero-card.png" alt="Auto-QA 3-Stage Pipeline and Benchmarks" /></p>
<h2>Moving the LLM out of the click loop</h2>
<p>Instead of keeping an LLM attached on every action, <code>auto-qa</code> works either as a standalone <code>SKILL.md</code> CLI or a local stdio JSON-RPC 2.0 MCP server (<code>scripts/mcp-server.js</code>, exposing 7 <code>auto_qa_*</code> tools) around one simple flow:</p>
<p>First, <code>scripts/discover.js</code> opens the page in headless Chromium (<code>Playwright 1.64+</code>), blocks background Service Workers (<code>serviceWorkers: 'block'</code>), auto-dismisses blocking <code>alert()</code>/<code>confirm()</code>/<code>beforeunload</code> dialogs, and reads <code>page.accessibility.snapshot()</code> plus interactive nodes into roughly <code>1,200</code> tokens instead of dumping raw HTML.</p>
<p>Next, your agent reads that ~1.2k-token surface map once and writes a declarative <code>plan.json</code> (<code>"Click Sign In"</code>, <code>"Fill Email"</code>, <code>"Assert Dashboard visible"</code>).</p>
<p>From there, <code>scripts/executor.js</code> executes the whole sequence locally in Playwright (<code>~10.3s</code> for 14 steps locally, <code>$0.00</code> token cost on repeat runs), and <code>scripts/compiler.js</code> exports passing flows to standard <code>@playwright/test</code> <code>.spec.ts</code> files you can commit straight into CI.</p>
<h2>The <code>offsetParent</code> bug that ate an afternoon</h2>
<p>Writing a local JSON runner took a couple hours. Making it stop dropping buttons inside production checkout drawers took most of the real debugging.</p>
<p><img src="https://raw.githubusercontent.com/yashh1323/auto-qa/main/assets/auto-qa-modal-card.png" alt="Auto-QA Fixed Modal Isolation and Native Playwright .spec.ts Mapping" /></p>
<p>Like plenty of DOM crawlers, my first visibility filter checked <code>el.offsetParent !== null</code>. It looked clean on static forms, then completely skipped <code>position: fixed</code> checkout drawers, cookie banners, and floating sidebars because <code>offsetParent</code> returns <code>null</code> on fixed elements in standard browsers.</p>
<p><code>discover.js</code> now checks computed style and <code>getBoundingClientRect()</code> instead, and <code>executor.js</code> explicitly looks for active modal overlays (<code>div[role="dialog"]:not(.hidden)</code>, <code>.modal:not(.hidden)</code>, <code>[aria-modal="true"]:not(.hidden)</code>) so locator resolution searches inside the open modal before falling back to the rest of the page:</p>
<pre><code class="language-js">const modalLocator = page.locator(
  'div[role="dialog"]:not(.hidden), .modal:not(.hidden), [aria-modal="true"]:not(.hidden)'
);
const hasActiveModal =
  (await modalLocator.count()) &gt; 0 &amp;&amp;
  (await modalLocator.first().isVisible().catch(() =&gt; false));
const scope = hasActiveModal ? modalLocator.first() : page;
</code></pre>
<p>Inside <code>resolveElement()</code>, actions pick role, label, placeholder, or attribute fallbacks based on whether the step intends to <code>fill</code> or <code>click</code>, so backdrop elements don't hijack clicks behind an active dialog.</p>
<h2>What breaks when you point a crawler at third-party sites</h2>
<p>Running a Playwright crawler against client sites you didn't write gets weird fast. Untrusted button text with brackets, quotes, or backslashes can break generated regexes, CSS attribute selectors, or exported TypeScript if you interpolate labels directly.</p>
<p><code>compiler.js</code> and <code>executor.js</code> run <code>sanitizeRegexPattern()</code>, <code>escapeRegex()</code>, and <code>escapeCssString()</code> on every selector, restrict navigation strictly to <code>http:</code> and <code>https:</code> via <code>assertValidHttpUrl()</code> (blocking <code>file:///</code>, <code>javascript:</code>, <code>data:</code>, and Windows UNC paths), and jail MCP file writes inside your workspace with <code>assertInsideDirectory()</code>. <code>npm test</code> runs all 6 security and PII redaction checks (<code>AU-01</code> to <code>AU-06</code>).</p>
<h2>Running it locally</h2>
<p>It isn't published on npm (<code>npmjs.org/auto-qa</code> doesn't exist; <code>package.json</code> uses <code>auto-qa-engine</code>), so grab it from git for now:</p>
<pre><code class="language-bash">git clone https://github.com/yashh1323/auto-qa.git
cd auto-qa
npm install
npx playwright install chromium

npm run doctor
npm test

# Test the compiler offline right away
node scripts/cli.js compile examples/client-login-checkout.json -o tests/e2e/checkout.spec.ts
</code></pre>
<p>I used this setup to run the 31 end-to-end login and editor tests (<code>auto_qa_tests/</code>) against <a href="https://yashh2313.hashnode.dev/why-ai-essay-detectors-fail-so-i-built-a-rust-proof-of-write-engine">Clio</a>, my Next.js and Rust writing app.</p>
<h2>Where this won't help</h2>
<p>Skip this for two cases: full-screen <code>&lt;canvas&gt;</code> or WebGL apps (games, canvas editors, 3D views) where semantic DOM/ARIA locators are blind, and random exploratory fuzzing where you don't know what flow you're testing yet and actually want a turn-by-turn agent poking around.</p>
]]></content:encoded></item><item><title><![CDATA[Why AI Essay Detectors Fail, So I Built a Rust Proof-of-Write Engine]]></title><description><![CDATA[How Clio replaces post-hoc AI essay detectors with TipTap Session Replay and a zero-unsafe Rust (Axum/Rayon) engine without webcam spyware.]]></description><link>https://yashh2313.hashnode.dev/why-ai-essay-detectors-fail-so-i-built-a-rust-proof-of-write-engine</link><guid isPermaLink="true">https://yashh2313.hashnode.dev/why-ai-essay-detectors-fail-so-i-built-a-rust-proof-of-write-engine</guid><category><![CDATA[Rust]]></category><category><![CDATA[Next.js]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Yash Kashyap]]></dc:creator><pubDate>Fri, 20 Nov 2026 10:49:55 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6affdfe7cca8816ac825e912/4d1229cd-229a-47f7-a0f4-ff40cd4c23a6.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Post-hoc AI essay detectors fail in both directions at once. Non-native English writers who use formal grammar get falsely flagged by perplexity classifiers all the time, while passing generated prose through a basic paraphrase prompt walks right past those same checks. When an accusation lands, the teacher is staring at a single opaque number and the student can't show they spent three hours actually drafting and revising.</p>
<p>That setup is unfair to honest writers and irritatingly easy to game. Worse, the usual edtech fix of browser lockdowns and continuous webcam recording crosses privacy lines I wanted nothing to do with.</p>
<p>So I built <a href="https://github.com/yashh1323/Clio"><code>Clio</code></a> (MIT), an open-source writing studio and authorship auditor that records <strong>how</strong> an essay was composed inside the browser canvas rather than guessing from finished text, backed by a Pure-Rust verification engine (<code>engine-rust/</code>). Live demo: <a href="https://clio-three.vercel.app">clio-three.vercel.app</a>.</p>
<p><img src="https://raw.githubusercontent.com/yashh1323/Clio/main/assets/demo-video.gif" alt="Clio Working Session Replay and Authorship Intelligence Demo" /></p>
<h2>Two design rules: no spyware, no black-box scores</h2>
<p>Before touching any detection math, I wrote down two hard invariants in the codebase.</p>
<p>First, Clio won't use webcams, microphones, or OS-level hooks. It runs inside a standard Next.js 16 + TipTap ProseMirror editor with <code>IndexedDB</code> (<code>ClioDB</code>) offline autosave and Supabase PostgreSQL (<code>7</code> tables protected by Row Level Security), observing only what happens inside the editor canvas.</p>
<p>Second, there are no opaque percentages on their own. Instead of outputting "84% AI," Clio hands educators a scrubbable <strong>Session Replay</strong> timeline alongside physical signals inside the document (discrete paste events and keystroke cadence histograms), so a student can actually point to their editing history.</p>
<p>On the Rust side (<code>engine-rust</code>), the compute service enforces <code>#![forbid(unsafe_code)]</code>, makes zero outbound network calls, and compares internal engine API keys in constant time using bitwise XOR folding. If Rust isn't running locally (for example, on a serverless preview deployment), a Strangler Fig proxy in Next.js (<code>lib/engine.ts</code>) falls back cleanly to TypeScript.</p>
<h2>Four independent verification layers in Pure Rust (<code>Axum 0.8</code> + <code>Rayon</code>)</h2>
<p>Any single detector has an obvious bypass. Instead of betting on one metric, <code>engine-rust</code> evaluates four separate layers.</p>
<h3>1. Lexical Winnowing &amp; Containment (<code>src/winnowing.rs</code>)</h3>
<p>Raw substring hashing misses edited patches, while comparing global Jaccard similarity misses a copied paragraph buried inside a long original essay. Clio implements Schleimer, Wilkerson, and Aiken's Winnowing algorithm (<code>k = 5</code>, guarantee threshold <code>t = 12</code>, sliding window <code>w = t - k + 1 = 8</code>) over 64-bit FNV-1a shingle hashes with deterministic rightmost tie-breaking:</p>
<pre><code class="language-rust">pub const NOISE_THRESHOLD_K: usize = 5;
pub const GUARANTEE_THRESHOLD_T: usize = 12;
pub const WINDOW_SIZE_W: usize = GUARANTEE_THRESHOLD_T - NOISE_THRESHOLD_K + 1;
</code></pre>
<p>Instead of symmetric Jaccard, it computes asymmetric Broder containment <code>C(A, B) = |S(A) ∩ S(B)| / |S(A)|</code>, so lifting 200 words out of a 2,000-word source still flags a 90% collision inside that block without blowing up the index.</p>
<h3>2. Parallel MinHash LSH (<code>src/similarity.rs</code>)</h3>
<p>To compare an essay against a whole class cohort without <code>O(N^2)</code> full-text scans, <code>similarity.rs</code> computes 128 universal hash permutations in parallel using <code>rayon::prelude::*</code> and buckets candidates with 64x2 Locality-Sensitive Hashing bands.</p>
<h3>3. Intrinsic Stylometry &amp; Semantic Projection (<code>src/stylometry.rs</code>, <code>src/semantic.rs</code>)</h3>
<p>If a student writes half an essay in their normal voice and pastes generated or ghostwritten paragraphs into the middle, global checks miss the seam. <code>stylometry.rs</code> slides a 250-word window (<code>stride = 50</code>) tracking 50 English function words via Burrows' Delta alongside Yule's length-invariant Characteristic <code>K</code>. Alongside it, <code>semantic.rs</code> projects words and character trigrams into a pure-Rust 64-dimensional vector space with synonym clustering to catch word-swapped paraphrasing.</p>
<h3>4. Log-Normal Keystroke Process Telemetry (<code>src/telemetry_advanced.rs</code>)</h3>
<p>Human typing roughly follows Log-Normal Inter-Keystroke Interval (IKI) distributions punctured by planning pauses (<code>P-bursts</code>) and backspacing cycles (<code>R-bursts</code>). Macro scripts and typing bots either emit unnaturally uniform intervals or fake randomness with flat uniform jitter.</p>
<p>To avoid pulling C bindings or external crates just to evaluate a normal CDF in the Kolmogorov-Smirnov test (<code>D_KS</code>), <code>telemetry_advanced.rs</code> implements a zero-allocation <code>erf_approx()</code> using Abramowitz &amp; Stegun Formula 7.1.26 (<code>&lt; 1.5e-7</code> error):</p>
<pre><code class="language-rust">pub struct ProcessAuditResult {
    pub is_authentic: bool,
    pub confidence_score: f64,
    pub p_burst_mean: f64,
    pub r_burst_mean: f64,
    pub revision_ratio: f64,
    pub cognitive_pause_ratio: f64,
    pub log_mean: f64,
    pub log_std_dev: f64,
    pub ks_d_statistic: f64,
    pub rapid_interval_count: usize,
    pub valid_interval_count: usize,
    pub flags: Vec&lt;String&gt;,
    pub method: String,
}
</code></pre>
<p>Export reports don't spawn headless Chrome or Node PDF wrappers either: <code>src/pdf.rs</code> writes raw ISO 32000-1 PDF 1.4 byte offsets directly in Rust.</p>
<h2>Verification &amp; live demo accounts</h2>
<p>Right now <code>engine-rust</code> passes <code>69/69</code> Cargo tests (<code>cargo clippy --all-targets -- -D warnings</code> clean) and the web tier passes <code>31/31</code> security and E2E Playwright QA suites (<code>auto_qa_tests/</code>).</p>
<p>You can click through the live app without registering first at <strong><a href="https://clio-three.vercel.app/login">clio-three.vercel.app/login</a></strong>:</p>
<ul>
<li>Teacher login (<code>teacher</code> / <code>ClioTeacher2026!</code>) for Session Replay and similarity reports</li>
<li>Student login (<code>student</code> / <code>ClioStudent2026!</code>) for the TipTap writing studio (faculty signup invite code: <code>CLIO-FACULTY-2026</code>)</li>
</ul>
<p>Repo (MIT): <a href="https://github.com/yashh1323/Clio">github.com/yashh1323/Clio</a></p>
<h2>What browser software still can't stop</h2>
<p>There is one boundary Clio deliberately doesn't cross. If someone puts an AI-generated draft on a second monitor and manually types every sentence into the TipTap editor at human speed (pausing occasionally, fixing a typo here and there), no purely web-sandboxed telemetry will catch it reliably. Stopping that requires cameras, keyloggers, or locked-down hardware, which breaks trust with every honest student in the room.</p>
]]></content:encoded></item><item><title><![CDATA[Frontend Skills Kept Breaking My Dashboards, So I Added Chrome CDP]]></title><description><![CDATA[I've been using frontend skills like Anthropic's frontend-design and ui-ux-pro-max in Claude Code and Cursor. On blank landing pages they help a lot…]]></description><link>https://yashh2313.hashnode.dev/frontend-skills-kept-breaking-my-dashboards-so-i-added-chrome-cdp</link><guid isPermaLink="true">https://yashh2313.hashnode.dev/frontend-skills-kept-breaking-my-dashboards-so-i-added-chrome-cdp</guid><category><![CDATA[Web Development]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[Frontend Development]]></category><dc:creator><![CDATA[Yash Kashyap]]></dc:creator><pubDate>Fri, 20 Nov 2026 09:25:54 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6affdfe7cca8816ac825e912/85518a90-4e10-455d-91dc-cf353eb8bae9.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I've been using frontend skills like Anthropic's <code>frontend-design</code> and <code>ui-ux-pro-max</code> in Claude Code and Cursor. On blank landing pages they help a lot. Things kept going sideways whenever I dropped them into an existing React or Next.js codebase just to fix a settings view or clean up a data table.</p>
<p>Half the time the agent put oversized editorial headings into an admin layout, or wrapped sections in <code>100vw</code> and gave mobile a horizontal scrollbar. And once a long session hit <code>/compact</code>, whatever layout rules I'd typed at the start fell out of context anyway.</p>
<p>I wanted the agent to stop guessing purely from prompts and verify what Chrome actually renders, so I split my setup into an MIT skill called <a href="https://github.com/yashh1323/atelier-ui"><code>atelier-ui</code></a>.</p>
<p><img src="https://raw.githubusercontent.com/yashh1323/atelier-ui/main/docs/assets/showcase-banner.png" alt="atelier-ui verified builds across Brand Sites, SaaS Consoles, and 3D WebGL Shaders" /></p>
<h2>Splitting one giant prompt into a ~5 KB router</h2>
<p>Keeping 1,500 lines of marketing typography rules loaded while you're editing an admin table doesn't end well.</p>
<p>Instead of dumping everything upfront, <a href="https://github.com/yashh1323/atelier-ui/blob/main/SKILL.md"><code>SKILL.md</code></a> acts as a tiny router with three steps:</p>
<ol>
<li><code>scripts/detect-env.mjs</code> reads <code>package.json</code> and checks which local browsers are installed once, so the skill never assumes global CLIs are present.</li>
<li><code>01-intake.md</code> settles open questions in one turn and writes the brief to <code>.atelier/BRIEF.md</code>. Even if a long session compacts twice, the constraints stay on disk.</li>
<li>The agent loads only the build module for your task: <code>02-brand-site.md</code> for marketing pages, <code>03-app-ui.md</code> for dashboards and existing codebases, or <code>04-3d-visual.md</code> for Three.js and WebGL scenes.</li>
</ol>
<p>The line in <code>03-app-ui.md</code> that mattered most in practice is disabling landing-page hero gating and dealt themes from <code>library/themes.json</code> completely. Existing Tailwind tokens and <code>components/ui/</code> primitives stay untouched, numeric tables keep <code>tabular-nums</code>, and controls have to handle default, hover/focus-visible, disabled, loading, empty, and error states.</p>
<h2>Checking mechanical CSS bugs at 0 LLM tokens</h2>
<p>Asking an agent in prose to remember <code>prefers-reduced-motion</code> and avoid <code>transition: all</code> works for roughly 200 lines. Moving those checks into <a href="https://github.com/yashh1323/atelier-ui/blob/main/scripts/lint-ui.mjs"><code>scripts/lint-ui.mjs</code></a> takes them out of the prompt completely.</p>
<p>Here's one rule from <code>lint-ui.mjs</code>:</p>
<pre><code class="language-js">{
  id: 'no-100vw',
  severity: 'FAIL',
  exts: ['.css', '.html', '.jsx', '.tsx', '.vue', '.svelte', '.astro'],
  test: (line) =&gt; /\b100vw\b|(?:^|[^\w-])w-screen(?![\w-])/.test(line),
  msg: 'Avoid `100vw` / `w-screen` (causes horizontal scrollbar overflow). Use `100%` / `w-full`.',
},
</code></pre>
<p>Two small fixes cut out most of the false positives when running this on real repos. <code>stripCommentsPreserveLines()</code> replaces <code>&lt;!-- --&gt;</code>, <code>{/* */}</code>, and <code>/* */</code> comment blocks with spaces while keeping line breaks intact (and ignores <code>https://</code> when stripping <code>//</code> comments) so reported line numbers still match your editor. The <code>no-outline-none</code> rule also explicitly allows Tailwind patterns like <code>focus-visible:outline-none focus-visible:ring-2</code> instead of rejecting valid focus rings.</p>
<h2>Checking real Chrome pixels without installing Playwright</h2>
<p>Even clean CSS breaks on mobile once real webfonts and sticky headers render. At the same time, forcing everyone who installs a <code>SKILL.md</code> to pull a 200 MB Playwright and Chromium bundle slows down quick setups and clutters <code>package.json</code>.</p>
<p><code>05-qa-gate.md</code> delegates first: if <code>impeccable</code> or <code>agent-browser</code> is already on your <code>PATH</code>, it uses that. When neither is installed (the usual case on a clean machine), <a href="https://github.com/yashh1323/atelier-ui/blob/main/scripts/check-ui.mjs"><code>scripts/check-ui.mjs</code></a> runs with zero npm dependencies by driving whichever Chrome, Edge, Chromium, or Brave binary is already on disk over Node 22's built-in <code>WebSocket</code> client.</p>
<p>In one pass it starts a local static server (<code>resolveSafeFile()</code> blocks <code>..</code> and sibling-prefix path escapes) or attaches to <code>--url http://localhost:3000</code>. It fails immediately on the layout regressions that hurt most in practice: <code>1440x900</code> or <code>390x844</code> horizontal overflow, and sticky headers overlapping <code>&lt;h1&gt;</code>. The same run also checks for unloaded webfonts, zero-size SVGs or canvases, <code>oklch</code> WCAG AA contrast errors, <code>console.error</code> output, and blank WebGL frames under <code>--shots</code>. Passing <code>--full --sheet</code> stitches desktop and mobile captures into one <code>review-sheet.png</code>, so a zero-context critic pass only needs a single image turn.</p>
<h2>3 live builds and how to try it</h2>
<p>I put together a three-mode showcase (<a href="https://yashh1323.github.io/atelier-ui-showcase/">yashh1323.github.io/atelier-ui-showcase</a>) with Nordhavn Timber (brand site), DriftGate Console (dark ops UI), and Meridian 04 (WebGL2 astrolabe). Eleven headless Chrome smoke tests in <code>tests/smoke.mjs</code> run against them in GitHub Actions (<code>docs/PROOFS.md</code>).</p>
<p>Include the GitHub prefix if you test the installer, because bare <code>atelier-ui</code> on npm belongs to a different author:</p>
<pre><code class="language-bash">npx github:yashh1323/atelier-ui install
npx github:yashh1323/atelier-ui doctor

# Or via vercel-labs/skills
npx skills add yashh1323/atelier-ui
</code></pre>
<p>Repo: <a href="https://github.com/yashh1323/atelier-ui">github.com/yashh1323/atelier-ui</a> (MIT)</p>
<p>It won't rescue an unclear brief or supply good design taste on its own, and <code>check-ui.mjs</code> needs Node 22+ plus a Chromium-family browser installed on the machine.</p>
]]></content:encoded></item></channel></rss>