Inspiration

We are entering the age of AI Code Generation. Tools like GitHub Copilot and Cursor have made writing code incredibly fast, but they introduced a new problem: The Trust Gap.

When an AI generates a UI component, it often looks correct syntactically but fails visually—buttons are invisible (opacity-0), z-indices clash, or layouts break on render. We realized that developers were spending more time verifying AI code than they used to spend writing it. We asked ourselves:

What if we had an agent that didn't just write code, but actually spun up a browser, looked at the screen, and fixed its own mistakes until the feature was perfect?

That question gave birth to BotIntern.

What it does

BotIntern is a CLI-based Autonomous QA Agent for Next.js applications. It closes the loop between "Code Generation" and "User Reality."

It Verifies Reality: Instead of standard unit tests, BotIntern runs "Vibe Checks"—runtime visual verifications using a headless browser.

It Heals Code: If a check fails (e.g., "Login button is not visible"), BotIntern doesn't just report the bug. It reads the project's source code, identifies the component causing the regression, and surgically patches the React code to fix the issue.

It Guarantees Quality: The agent runs in a self-healing loop until all visual requirements are met.

How I built it

BotIntern is architected as a local Agentic Loop running on Node.js. It consists of three core engines:1. The Vibe Engine (DSL Interpreter)We realized that writing raw Playwright scripts is brittle and prone to "hallucination" by LLMs. To solve this, we created a Domain Specific Language (DSL) called "Vibe Shorthand" ($V_{dsl}$).Instead of complex selectors, developers write intent:YAML- see: "Welcome Back"

  • type: "user@example.com" into: "Email"
  • click: "Sign In" Our interpreter translates these high-level intents into executable Playwright actions. The "Safe Merge" Guardrail To prevent the agent from destroying the codebase, we implemented a "Read-Many, Write-One" architecture.

Test Suite: Immutable (The Truth).

Source Code: Mutable (The Variable). The agent is allowed to be creative with the implementation to satisfy the requirement, but it cannot lower the bar by modifying the test.

Challenges I ran into

The Zombie Process Nightmare: Managing the lifecycle of the Next.js development server (npm run dev) alongside the Playwright runner was difficult. We faced race conditions where the test would start before the server was ready, or the server would become a "zombie process" after the CLI exited. We solved this by implementing a custom Promise-based Lock system for child processes.

Hallucinated Selectors: Early versions of the AI tried to click buttons by guessing random IDs (#submit-btn-123). This inspired the creation of the Vibe DSL, which forces the AI to interact with elements by visible text, mimicking human behavior.

Infinite Loops: Occasionally, the AI would try to fix a bug, fail, and try the same fix again. We had to implement a Retry Budget and a "History Awareness" feature so the agent knows what it already tried.

Accomplishments that I am proud of

Building a DSL: We successfully designed and implemented a custom YAML-based language that abstracts complex testing logic into plain English.

True Self-Healing: Seeing the agent successfully detect an invisible button, edit the page.tsx file to remove opacity-0, and pass the test without human intervention was a magical moment.

CLI UX: We built a robust CLI using commander that feels like a professional tool (botintern verify --fix), complete with a global login system (botintern login).

What I learned

Agentic Workflows > RAG: We learned that simply "Chatting" with code isn't enough. You need an Action Loop (Plan $\rightarrow$ Act $\rightarrow$ Observe $\rightarrow$ Correct) to build truly useful tools. The Importance of AST: We learned that treating code as a tree structure (rather than plain text) is essential for safe automated editing. Process Management: We gained deep experience in Node.js child_process and handling standard I/O streams programmatically. CI/CD integrations: Implementing github workflows to deploy package to npm on each commit.

What's next for Botintern

Visual Regression Snapshots: Adding pixel-perfect diffing to catch unintended layout shifts. Multi-Framework Support: Expanding beyond Next.js to support SvelteKit and Vue.

Built With

Share this project:

Updates