•8 minutes read Technical Level: High

From Multi-Agent Code Generation to a Deterministic Software Factory (sf-factory)

How Integrant Labs evolved beyond ad-hoc frontier coding loops to sf-factory—pairing human-in-the-loop Product Owner and Architecture gates with isolated Git worktrees, AI-generated UAT documentation, and Playwright UI-to-database verification.

AH
Andrew Hall
Principal & Chief Systems Architect, Integrant Labs
#software-factory #sf-factory #ai-engineering #architecture #playwright #testing
From Multi-Agent Code Generation to a Deterministic Software Factory (sf-factory)
Why Frontier Code Generation Alone Hit a Delivery CeilingIn our May 2026 retrospective on AI coding harnesses, we documented how frontier models eliminated much of 2025's brittle persona choreography. For single-feature edits inside a clean repository, a strong frontier model with minimal harness config could inspect the codebase, write a migration, update the UI, and pass local checks in one coherent loop.However, shipping concurrent multi-sprint roadmaps across real production platforms—our unreleased specialist periodontal clinical platform, our native language-learning apps ChangThai and KoalaEnglish, and commercial client platforms—quickly exposed a harder ceiling. Ad-hoc multi-agent code generation does not scale cleanly to continuous commercial delivery.When multiple coding agents run in parallel without an explicit engineering state machine around them, four predictable failure modes emerge:Requirements Ambiguity Leaking Into Code: Informal prompts and chat threads leave edge cases, security boundaries, and commercial non-goals underspecified. Agents fill those gaps with plausible guesses that diverge from stakeholder intent.Silent Cross-Branch Collisions: Parallel agents working without a declared file-ownership manifest routinely edit the same shared routes, configuration files, or verification scripts—creating subtle merge regressions that only surface late in integration.Superficial UI Tests That Mask Persistence Bugs: Left to write their own checks, coding agents tend to assert that a button rendered or a toast appeared while mocking away database state or skipping server-side validation.Inconsistent UAT & Release Evidence: Even when code works, stakeholders and QA leads are handed sprawling commit diffs instead of structured, traceable User Acceptance Testing (UAT) sign-off artifacts tied back to original acceptance criteria.To move past prompt-to-PR heuristics, we built sf-factory: a deterministic, human-in-the-loop software factory that treats AI code generation as one bounded stage inside a disciplined engineering pipeline.Enter sf-factory: A Deterministic, Human-in-the-Loop Software Factorysf-factory is not a free-form autonomous chat swarm. It is an artifact-driven engineering state machine where every stage produces a versioned, inspectable contract before the next stage is permitted to run.Structured Product Owner (sf-po) & System Architecture (sf-arch) GatesInstead of feeding raw stakeholder notes straight into a coding agent, sf-factory enforces two upstream governance stages:Intake to Scoped Epics & Atomic Issues (sf-po): Stakeholder feedback, product vision invariants, and domain constraints are decomposed into structured Epics and atomic Issue specifications. Every issue carries explicit acceptance criteria, explicit non-goals, affected areas, database/UI impact flags, and an issue dependency graph (DAG).Mandatory Human-in-the-Loop Governance: Nothing advances from product scoping to architecture—or from architecture to implementation—without Principal human review. We resolve commercial trade-offs, security posture, regulatory constraints, and scope boundaries before a single line of implementation code is generated.Contract-First Architecture Specs (sf-arch): Once an issue is approved, the architecture stage produces a file-exact technical specification. That spec locks data model invariants, API and HTTP contracts, explicit test requirements across every verification tier, and a parallel execution manifest declaring exactly which files the issue is authorized to touch or create.By the time an implementation agent starts work, ambiguity has already been engineered out of the loop.Isolated Git Worktrees & Conflict-Aware Parallel ExecutionIn 2025, teams spun up git worktree checkouts manually to stop persona agents from overwriting each other's uncommitted files. In sf-factory, workspace isolation is deterministic and manifest-bounded.Each approved issue executes inside its own isolated Git worktree on a dedicated issue branch (sf-dev), governed by three explicit lists from its architecture specification:touch_files: Existing repository files authorized for modification.create_files: New source files, content entries, assets, or test specs authorized for creation.shared_touchpoints: High-contention infrastructure files (such as shared route manifests or end-to-end verification suites) where parallel tracks must keep edits narrowly scoped and merge-clean.# Deterministic issue isolation in sf-factory git worktree add <isolated-worktree-dir> -b issue/ISS-XXX # Bounded execution against declared touch_files, create_files & shared_touchpoints # Ephemeral test DBs, build caches, and orchestration metadata stay strictly unstaged Ephemeral SQLite test databases, Nitro build artifacts, and local runtime caches are strictly isolated per worker and excluded from Git staging. Parallel issues can execute concurrently without port collisions, database locks, or dirty working trees—and when they merge, diff review is focused exclusively on authorized changes.Multi-Tier Verification: AI-Generated UAT & Playwright UI-to-Database SuitesSpeed without proof is just faster technical debt. In sf-factory, every worktree must clear a three-tier verification pipeline (sf-suite) with zero human babysitting before it is eligible for final code review:UNIT Tier: Full static verification—strict ESLint rules and complete vue-tsc / TypeScript typechecking across application code, API handlers, and @nuxt/content schemas—must exit cleanly with zero errors.INTEGRATION Tier: Full production SSR bundle compilation followed by automated smoke verification against a live server process, asserting HTTP status codes, canonical 301 redirects, 404 handling, security headers (nosniff, DENY, HSTS), sitemap accuracy, API contracts, and authentication lockdown rules.PLAYWRIGHT_UI_DB Tier: Real browser Playwright E2E test cases that exercise rendered user flows end-to-end and query the underlying SQLite / LibSQL database directly via @libsql/client. During rapid worktree iteration, targeted Playwright specs run on worker-isolated ports; at integration, full regression suites confirm zero side effects across the platform. A UI flow cannot pass against stubbed responses or broken persistence.Pairing Playwright Optimization with AI-Generated UAT DocumentationAutomated test execution alone still leaves a translation gap between engineering and product sign-off. sf-factory closes that gap by pairing targeted Playwright test generation with AI-generated User Acceptance Testing (UAT) documents.Because every issue starts with structured acceptance criteria and finishes with deterministic test outputs, the factory synthesizes traceable UAT packages—mapping each acceptance criterion to the exact automated Playwright assertions, API/database checks, and step-by-step manual verification scenarios needed for stakeholder sign-off. Our Principal Architect and in-house QA engineers spend their time validating business intent and edge cases rather than writing boilerplate test scripts or chasing flaky environments.Comparison: Ad-Hoc Multi-Agent Codegen vs. sf-factoryDimensionAd-Hoc Multi-Agent CodegenDeterministic Software Factory (sf-factory)Requirements IntakeFree-form prompts & chat threadsStructured Epics, atomic Issues, explicit acceptance criteria & non-goals (sf-po)Architectural ControlEmergent during coding; prone to driftContract-first technical specs with file-exact manifests (sf-arch) & human gatesWorkspace IsolationManual branches or ad-hoc worktree sprawlDeterministic per-issue Git worktrees with touch_files & shared_touchpointsQA & E2E TestingOften mocked or UI-only checksMandatory UNIT, INTEGRATION SSR smoke & PLAYWRIGHT_UI_DB (browser + SQLite) tiersUAT & Release ReadinessRaw PR diffs and manual release notesAI-generated UAT sign-off documents mapped directly to verified acceptance criteriaHuman Engineering RolePrompt babysitting & late-stage diff triageUpstream Product/Architecture gatekeeping, security review & final release sign-offWhat This Means for Commercial Deliverysf-factory does not replace senior software engineers—it multiplies them. At Integrant Labs, Principal Architect Andrew Hall leads architectural governance, security review, and system design directly alongside our in-house Thailand (SEA) engineering and QA team.For CTOs, founders, and clinical or commercial venture partners, that combination delivers a tangible commercial advantage:Predictable Architectural Integrity: Every sprint is governed by explicit specifications, clean TypeScript/schema contracts, and human-in-the-loop Principal review before code merges.Higher Assurance Per Dollar: Automated Playwright UI-to-database verification and AI-generated UAT documentation compress QA cycles while catching regressions that manual spot-checks miss.Transparent Commercial Structure: Whether you engage us for AI Custom Application Development or scoped 4-Hour AUD Engineering Sessions, you get senior architectural accountability amplified by sf-factory throughput—without Australian CBD agency overhead.If you are planning a new AI-enabled product, modernizing a legacy platform, or looking to bring deterministic engineering rigor to an existing roadmap, engage Integrant Labs to scope an initial architecture and delivery sprint.

We use an essential preference cookie for site functionality and optional privacy-first analytics (Plausible) to improve our website. Privacy Policy