← FlawFerret2

FlawFerret2

Architecture

FlawFerret2 moves a captured testing signal through several systems before an AI agent touches any code, and it never touches a repository or opens a pull request without a human approving each stage.

Pipeline

Browser extension -> Next.js web dashboard -> Fastify/Zod API -> Prisma/PostgreSQL (Neon) -> ferret-runner worker -> Codex (AI coding agent) -> Playwright validation -> GitHub draft pull request

Job and run state model

Job and run state is event-sourced: explicit JobStatus and JobEventType enums cover the full lifecycle, from job creation through Codex invocation, validation, and PR creation.

Human-in-the-loop safety

Codex execution and PR creation are separate, explicit manual-approval steps. Both are default-disabled via feature flags (FERRET_RUNNER_ENABLE_CODEX, FERRET_RUNNER_ENABLE_PR_CREATION). The AI agent cannot modify a repository or open a pull request without a human approving each stage.

Stack

Languages

  • TypeScript (strict mode repo-wide)

Frontend

  • Next.js (App Router)
  • React

Backend

  • Fastify
  • Zod (shared request/response schema validation)
  • Swagger / OpenAPI (endpoint spec; Swagger UI to exercise and validate endpoints during development)

Database

  • PostgreSQL (Neon)
  • Prisma ORM
  • Event sourcing for job/run state

AI agent tooling

  • OpenAI Codex CLI/SDK (AI coding agent)
  • Claude Code subagents
  • MCP (Model Context Protocol) tool integration

Browser extension

  • Chrome Extension Manifest V3
  • vanilla TypeScript

Testing

  • Playwright (AI-generated-change validation)
  • Node built-in test runner (tsx --test)

Infra & integration

  • GitHub (draft PR automation)
  • Jira
  • Slack (incoming webhook notifications)

Tooling

  • pnpm monorepo workspaces