SW Factory — how it works
Act 1 / 5
A request arrives. One sentence in Linear. Everything after this happens without you chasing it.
1 issue in · 0 meetings
A request arrives. One sentence in Linear. Everything after this happens without you chasing it.
1 issue in · 0 meetings
The Analyst reads the codebase and writes a spec. For UI work an architect draws it first. Then you approve scope and cost.
2 agents · spec.md + ui-spec.md · your first gate
Opus writes the code. A second Opus reviews the diff it did not write. Pixels get verified against the spec.
3 agents · ~40 min · no human in the loop
Security audits the diff. Performance benchmarks it. The Tester runs Playwright against a real browser. Three gates, in parallel.
3 agents in parallel · ~9 min wall clock
Staging deploys, the machine screenshots the live URL, and you approve production. Deploy takes two minutes.
2 agents · your second and last gate
The record
None of the above arrived finished. It was built in the open, one commit at a time, and most of what makes it trustworthy today came from something going wrong first. What follows is not the marketing version: every milestone has a date and a commit behind it.
A green marker means the machine learned something new. An amber one means a human deliberately took capability back. The amber ones matter more — they are the moments the factory chose to be slower in order to be trusted.
From an empty repository to a line that deploys on its own.
The first commit was not code — it was the architecture. A token budget and cost accounting sat in the harness skeleton from day one, not bolted on after the first surprising invoice. That detail shaped everything after it: the factory knew what it cost before it knew how to work.
Initial commit — the architecture. A flat orchestrator-worker pattern, with a deterministic orchestrator in code instead of an improvising model.
A harness with a token budget and cost capture. The single choke point every model call passes through.
The quality chain. Analyst → Developer → Review → Security → Tester. Halt on failure, and handoffs by file rather than by conversation.
The first real run failed. Agents span to their turn limit without finishing. The toolkit was showing them tools they were not allowed to use, so they kept trying them. The fix was to restrict which tools are visible, not merely which are permitted.
Model tiering. A cheap, a mid and a frontier model by role. Never the expensive one for everything.
A context engine. Agents receive the project's own documentation instead of searching blind.
Cross-issue learning. The factory remembers finished work, reusable components and its own failures.
Always-on. A task moved in the tracker starts the line by itself. From here the factory runs, rather than gets run.
Then fifteen commits about deployment: timeouts, tooling inside the sandbox, environment injection, rebasing on resume. The last mile cost more work than the entire pipeline.
Request → spec → code → review → tests → staging → production, with no human in the middle. On one project, and without brakes.
The day the factory got approval gates and learned not to loop.
One task failed its tests three times in a row. Each time the developer agent tried to repair the implementation; after three rounds the bill was €8.92 and the credits ran out. The conclusion was not to improve the retry loop. It was to delete it.
Human approval gates. A production deploy needs an explicit approval from every team member. No agent can trigger one.
Authenticated webhooks and run locks. Concurrent runs stop overwriting each other's state.
A cost estimate before development. The work is sized S/M/L/XL and the harness derives the expected tokens and euros from it.
The end of the test fix loop. Failing tests stop the line for human review. The code-review loop stayed — cheaper, and a higher return.
The factory remembers failures. What broke, at which gate and why, is visible to future runs on similar work.
One gate, two meanings. The same approval state covers signing off the spec before development and signing off before production.
The factory lost the ability to spend money unobserved. You approve the specification before the first expensive token is spent.
Four commits carrying thirteen tasks. The factory stopped being blind to design.
A dedicated role appeared between analysis and development — the UI Architect. Not to make things pretty, but because a design decision taken in passing while writing code is a design decision taken by accident. At the same time the context engine stopped behaving like a vacuum cleaner and started behaving like a librarian.
UI Architect and design context. A project's design system — colour, spacing, components, UX conventions — is extracted from the repository and stored. The agent reads it instead of inventing it.
Structural summaries instead of whole files. The most relevant files in full, the rest as structure. The tokens saved are visible in the context itself.
Prompt caching. The static agent definition goes first and the task last, so the expensive part of the prompt can be reused. Cache hit rate is measured on every call.
A circuit breaker. Three identical failures on similar work within a week block the next attempt. The factory stops walking into the same wall on its own.
Semantic search over past work, and adaptive budget calibration from history — which can only tighten a budget, never loosen it.
A design knowledge base. 161 product categories, 85 styles, 74 typographic pairings, 99 UX guidelines. The harness retrieves candidates at zero token cost; the agent chooses between them.
The output stopped looking generated. And the cost of a task started falling without the quality falling with it.
The Golden Stack. Five products, five different technologies, one migration.
The largest single leap in this history, and the least AI-flavoured thing in it. Five products ran on five different stacks, so every task needed different context, different scripts, different tests. The decision: one stack for everything, a feature freeze, five waves, big bang. In four days every project was unified and back in production.
A lint gate inside the sandbox. Zero tokens, and it catches exactly what an expensive model would otherwise be spent on.
A cost report. Spend per project and per agent, estimate against actual, cache hit rate.
The Golden Stack as a canonical standard. Machine-readable version pins and a compliance checker alongside the prose.
The standard is injected into prompts. It is not a document sitting on a disk; it is an input to every decision the agents make.
A monthly upgrade watch. When a pinned technology ships a major version, a task opens by itself. Every project moves together, or none does.
Tooling travels with the repository. Every device — desktop, phone, web session — sees the same pinned version.
Migration complete. All five projects on one stack, in production, behind CI quality gates.
Stale documentation is a bug. Because it goes straight into an agent's prompt as truth.
A new project joins with a single command instead of a week of integration. The factory stopped being a tool for one product and became a line.
The factory stopped depending on a single model vendor — and got a security baseline.
In one day a layer appeared that separates what has to be done from who does it. Any role can run on a different vendor's model, with the same permissions and the same accounting. Quality is not settled by an AI referee but by measured outcome: did the build pass, did review pass, what did it cost, how long did it take.
A runner contract. Budget and cost accounting sit above every vendor and cannot be bypassed by swapping the model underneath.
Second and third vendor adapters, behind the same permission layer as the first.
A quality scorecard and leaderboard. Plain scoring, no AI referee. Historical quality, cost and speed per vendor.
This website joined as the sixth project. From here the factory builds its own site through its own line.
One security baseline for every project and for the factory itself. The Security Auditor receives it as a checklist and fails a change that breaks a mandatory rule.
Five product rules. Dark only, mobile first, findability, English first, store readiness — mandatory for every current and future project.
If one model provider gets expensive or goes down, the line keeps running. Security and the product minimum are not checked at the end; they are inputs to the brief.
The first time the factory looked at what it had made.
Until this point UI was judged blind — from a written spec, without a single pixel. Visual defects were found by hand, late. Three things arrived together: verification against the live staging URL, a visual check of real screenshots, and, most importantly, a place for a human to deposit knowledge that exists nowhere in the code.
Staging verification. After deployment the line walks the real URL, takes screenshots, runs tests against it and attaches the evidence to the task.
Visual QA. Mobile at 390px and desktop at 1280px, checked for defects. Explicitly a guardian of intent, not a judge of beauty — there is no AI rubric for aesthetics.
A two-mode UI Architect. Extend mode for incremental work, where novelty is a bug; define mode for a new page, where a design thesis and an anti-generic check are required.
A brain for human knowledge. A person writes a note; agents retrieve it with a tool. Agents may read it, never write it.
An art director and a direction pack. A project's design direction as a document that gets parsed and fed into the line.
And the reality of operations: the machine's memory ceiling went from 512 MB to 2.5 GB, because the old limit had been killing runs outright.
“It works” stopped being a claim by an agent and became a screenshot and a green test against a live address. Knowledge only a human holds finally has somewhere to go.
The densest stretch in the whole history — and the first time a customer got a key.
The factory built itself as a product. The desktop site is a single screen of nine acts with a live 3D scene; a phone gets a document built from the same content, written once. Then came the change that alters the relationship with a customer: a portal with a login, a dashboard, live task status and visible spend.
A cinematic hero. Shader cores, a 2,400-particle field, a hand-rolled bloom — and a frame-rate watchdog that degrades one way only, so a struggling phone simplifies the scene and never flickers back.
A capability gate. The shell is chosen by viewport and input device, not by graphics card. The server always renders the document, so the content survives even where the 3D cannot.
The Analog Core landing. Nine acts, one source of content for both desktop and phone.
Live data, projects, ideas, a model arena. The site stopped being a brochure and became a window into a running line.
Analytics with consent, sitemap, legal layer, plus a four-step project wizard.
A small commit that says a lot: unsubstantiated vendor claims were deleted from the arena because they were not backed by measurement.
Security rules and a prototype generation pipeline.
The customer portal. Sign-in, activation, dashboard, admin panel, approval functions, security rules and indexes.
The line syncs task state into the portal. A customer can see what is happening to their request without having to ask.
Transparency became a feature instead of a promise. You get an account, live status, visible spend, and the approval.
The factory started running experiments on itself.
The old context engine pre-packed context. The new one inverts it: a minimal core plus tools the agent uses to pull exactly what it needs, at the moment it needs it. No tokens spent on context nobody read. On top sits the layer that turns this into science rather than opinion — feature flags, telemetry, and a mandatory classification of every failure. Was it bad context, or bad judgement?
A lean core and just-in-time retrieval. The agent decides what to pull; the server verifies it is allowed to have it.
Failure attribution. Every failure is classified — context missing, wrong or ignored, against reasoning, implementation or test error.
Feature flags and telemetry. One field switches the whole engine back to the previous version. 130 tests cover it.
Model choice in the admin interface. Vendor and budget mode per project, set through a screen instead of in code, with a leaderboard of historical quality, cost and speed.
One source of truth for project configuration. The pipeline reads it live, with a cache and a fallback.
Verification that a pull request is genuinely merged before a production deploy runs.
Cost per run. Run and loop counts, and a token spend indicator inside the customer dashboard.
This page. And a single shared header across every screen the factory owns.
The factory can measure whether a new version of its own brain beats the last one — and roll it back with a single switch when it does not.
A four-turn process, corpus distillation, and the end of pre-packed context.
The Analyst agent was rewritten from scratch. Instead of receiving a wall of context it might not need, it now follows a structured four-turn process: scope identification, codebase exploration, memory retrieval, then synthesis. At the end of every run, a distiller compresses the work into a corpus record worth keeping — so the next Analyst learns from the last one.
Provider Health Check. A manual smoke test of all registered providers from the admin UI — nine models tested, results stored with history.
Process page. An interactive visualization of the entire pipeline, with collapsible phases and mode/provider filters.
Self-service onboarding. A four-step wizard that lets a new project join the factory without touching code.
n8n installed. The automation layer for the growth loop — n8n.tokenwise.sk live with nginx, SSL, and daily backups to GCS.
MDX blog infrastructure. Weekly AI articles now deploy through the same pipeline as code.
Context Engine V0. The Planner was removed; a minimal core plus JIT retrieval replaced pre-packed context. The Analyst now decides what to pull.
Four-turn Analyst. A structured process: scope → exploration → memory → synthesis. 130 tests cover the new engine.
Analyst context restoration. An audit found most of V0 was dead in production. Fixed in one wave — project briefs, retrieval traces, and spec validation now work.
Corpus distillation. One Haiku call at the end of each run turns the work into a structured record — approach summary, lessons, what to avoid. €0.02 per call.
Audit pages. Native Next.js pages replaced iframe embeds for pipeline audit reports.
Measurement layer. O-series optimizations: founder comments filter, provider telemetry, budget mechanisms unified across all paths.
Social media publishing. GTM Wave 4: direct Meta Graph API calls from the pipeline. Articles with growth:article label auto-post to Facebook and Instagram after production deploy.
The Analyst stopped being a reader of walls and became a thinker with a process. Every run leaves behind knowledge the next one can use.
Ordered by impact rather than by date. Each one changed what the factory can do, not how it looks.
Not bolted on after the first surprising invoice. Every model call passes through one place that counts tokens and euros — and that still holds now that several vendors are in play.
After a task burned €8.92 on three failed repair attempts, the factory stopped trying again. Failing tests halt the line and call a person. A production deploy needs an explicit approval.
Five products, five stacks, one four-day migration. Since then, onboarding a new product is a single command rather than a week of integration. The biggest throughput gain in the history.
A task changes state and the pipeline starts without anyone pressing anything. This is the difference between a tool and a line.
Any role can run on a different provider, with identical permissions and identical accounting. Quality is settled by measured outcome, not by an AI referee.
Staging verification walks the live address and files the evidence. Visual QA checks mobile and desktop screenshots. “It works” stopped being an agent's opinion.
Your own account, the stage your request is in, and what it has consumed. Transparency as a feature rather than a promise.
Design stopped being a by-product of writing code. The project's design system is read from the repository instead of reinvented on every task.
The factory learns from finished work, reused components and its own failures. Since July it also has a place for the knowledge that will never be in the code.
Agents pull context on demand, every failure is classified by cause, and every change to the engine can be measured and reverted with one switch.
A four-turn structured process replaced the wall-of-context approach. Scope first, then exploration, then memory, then synthesis — and a distiller that turns every run into a lesson for the next one.
That is the whole point of measuring instead of guessing. If you want your product built on this line, the next era starts with your brief.