On-Demand Software Factories with Recursive Language Models in SuperQode

In our previous post, Introducing SuperQode Factory Early Preview, we outlined the architecture for an open-source, local-first software factory built directly into SuperQode. That initial release established the core delivery contract: a versioned seven-layer factory.yaml specification (Factories-as-code, Data and context, Compute, Inference, Improvement, Orchestration, and Access) with governance enforced across every layer.

Under that model, every change follows a deterministic and auditable execution lifecycle. Teams commit their factory definition alongside application code, queue pinned trials as durable WorkOrders, execute stages in isolated Git worktrees while hidden acceptance evaluators remain masked inside an OS sandbox, verify the exact candidate through SuperGauge (SHIP, HOLD, or REJECT), authorize working-tree delivery with a cryptographic human signature, and run guarded optimization against held-out trial suites.

Early adoption across real codebases surfaced a clear operational bottleneck: while a version-controlled factory.yaml provides the right long-term foundation, authoring the initial specification, configuring stack-specific regression commands, and attaching verification skills from a blank file requires unnecessary manual setup. SuperQode now includes On-Demand Software Factories powered by Recursive Language Models (RLM), alongside conditional specification gating, deterministic five-dimension merge risk, built-in verification skills with visual proof, and structured onboarding.

Watch the demo

The recording is the fast path on examples/factory/demo. Triage classifies a clear totals() bug, sets needs-spec to false, and skips the spec stage. Implement and verify then run on grok-cli/grok-4.7. The ambiguous-feature route, which pauses before the spec stage, is the other path described below.

Build on demand

Teams should not have to hand-author boilerplate YAML before running their first governed trial. In Factory Studio under Build -> Describe (and via sq factory describe --rlm in the CLI or :factory describe --rlm in the TUI), developers can now trigger Build On-Demand Software Factory against any repository.

Rather than assembling an unstructured prompt from arbitrary source files, SuperQode delegates repository inspection to its Recursive Language Model (RLM) context engine:

  • Lazy, read-only context mounting: The repository is exposed as an external RLMContext data handle inside SuperQode’s bundled sandboxed Monty REPL. Corpus size and file layout are inspected lazily from metadata before reading content. Environment secrets (.env, .pem, .key), lockfiles, and the entire .superqode/ tree, including protected evaluators, stay excluded.
  • Automated stack, verification, and risk profiling: The inspection routine reads repository manifests (pyproject.toml, package.json, Package.swift, Cargo.toml, go.mod) and up to three GitHub Actions workflows to extract real regression commands, infer the target application surface (Web, macOS, or CLI), and identify sensitive paths such as authentication, database migrations, or deployment pipelines.
  • Host-bounded recursive sub-queries: When a model is configured and permitted by route policy, SuperQode executes up to two bounded recursive sub-queries (architecture-and-stages and verification-and-risk) to refine stage instructions, acceptance requirements, and repository-specific verification gotchas, recording complete token and file provenance. When no model is connected, local RLM inspection still produces a validated repository-native proposal in milliseconds.
  • Strict Factories-as-Code compliance: Nothing executes invisibly in memory and existing release_authority signing policies are preserved verbatim. Factory Studio presents an inspection receipt detailing scanned manifests, selected stages and agent roles, regression checks, and interactive checkboxes for recommended skills. Applying the proposal opens the validated factory.yaml directly in the editable Definition view for human review and Git commit.
SHELL
# Inspect a repository read-only and compile a tailored FactorySpec draft
sq factory describe --rlm

# Refine with a connected model. Write the model as provider/model.
sq factory describe --rlm "Require specification review for auth and schema changes" --model grok-cli/grok-4.7

A generated factory starts on the no-subscription route, which allows only local models. A cloud model or a Grok subscription connected as grok-cli/grok-4.7 needs default_route: best before a trial will call it. The model has to be written as provider/model.

Triage, spec, and build

Directing every incoming work item straight to an implementation agent works for well-scoped defects, but underspecified feature requests require architectural alignment before code is written. SuperQode now includes a conditional Triage, spec and build starter blueprint that places human review at two deliberate control points:

  • Triage: Evaluates the incoming goal and must finish with one output named decision. Inside it, complexity is small, medium, or large, needs-spec is true or false, and summary is one sentence. The only accepted handoff is a single line, SUPERQODE_OUTPUT: {"decision":{"complexity":"small","needs-spec":false,"summary":"one sentence"}}.
  • Conditional Spec Gate (Human Gate 1): When needs-spec is true, the run pauses before the specstage starts. Approving the gate unlocks the spec writer. It is not a review of a spec that has already been written. After approval, that stage asks clarifying questions and writes the expected behavior and verification plan before implementation.
  • Fast path for well-scoped fixes: When needs-spec is false, the pipeline skips spec and goes straight to isolated implementation in a Git worktree. That is the path in the video.
  • Verify gate, then SuperGauge: The verify stage also pauses for approval before it runs. After every stage has finished, Verify candidate… runs SuperGauge in a sandbox against pinned evaluator probes. The verdict is SHIP, HOLD, or REJECT. A visible command such as python3 self_check.py is a self-check. SuperGauge requires a separate file declared with purpose: evaluator, for example evals/cli-probes.json referenced by evaluator: cli-probes. A trial prepared before that file was committed keeps the old snapshot and cannot produce the dial.

Within Factory Studio’s Workflow view, conditional when predicates now render in plain English so branching behavior is transparent to every reviewer.

How SuperGauge works inside the factory

SuperGauge is not another model stage. It runs only after every workflow stage has finished, from Verify candidate… in Factory Studio or sq factory verify --execute. The agent does not grade itself. The factory takes the exact Git tree the trial produced, copies it into a fresh directory, and scores that copy from the outside.

  • Pinned probes, not the visible test command. python3 self_check.py is a self-check the agent can read and edit. SuperGauge ignores that command. Each acceptance check must name a file declared with purpose: evaluator, such as evals/cli-probes.json. The file is a list of cases: a Python command, optional stdin, the expected stdout, and the expected return code. Those cases are sealed into the factory snapshot when the trial is prepared. A later edit to the probe file does not change a trial that was already queued.
  • The evaluator stays out of the candidate. Evaluator paths are omitted from the copy the probes run against. Workers are not given those files. If a worker tries to write one, the verdict is REJECT. If a worker tries to read one, the verdict is HOLD so a person can review the run. After the copy is made, SuperGauge hashes the candidate and rejects it when an evaluator file appears verbatim inside it.
  • A sandbox, then one scratch directory per case. SuperGauge first runs a readiness probe inside the sandbox. If isolation is unavailable, it records missing evidence and holds. It does not fall back to an unconfined command. Each case then runs with the development Python in its own scratch directory. The controller compares stdout, stderr, and the return code from outside the candidate process. It does not import the application.
  • One verdict from that evidence. Every held-out case must pass, isolation must have been applied, and the evaluators must have stayed hidden. That is SHIP. A failed case is REJECT. Missing evidence, a short result list, or a worker that tried to read an evaluator is HOLD. An optional model judge can hold or reject. It cannot turn a failure into SHIP. SHIP is a quality recommendation. Applying the change to the working tree still requires a signed human approval bound to that same candidate.
  • The dial is a record, not a log. The result is an Agent Quality Record bound to the factory digest, the harness digest, and the candidate tree. Factory Studio shows it on the trial’s Pipeline tab. Five-dimension Merge Risk sits beside it as an advisory badge. Risk does not change the verdict.

Risk, skills, and proof

Automated test pass rates confirm functional execution, but engineering teams also need structured risk signals to prioritize code review depth. We integrated three complementary evidence capabilities into Factory Studio and trial inspection:

  • Deterministic Five-Dimension Merge Risk: Embedded inside the SuperGauge verdict card, every candidate is evaluated deterministically across Alignment, Impact, Verification, Rollback cost(reversible two-way changes versus one-way schema or API migrations), and Error detection. The assessment surfaces an advisory Low, Medium, or High risk badge alongside concrete review gaps, without ever overriding SuperGauge’s deterministic SHIP / HOLD / REJECT verdict.
  • Built-in Factory skills: Versioned Markdown skills can be scaffolded into skills/ and bound to harnesses in one action. merge-risk directs implementation stages to address risk gaps before handoff, while ui-verification provides Web (Playwright), macOS App, and CLI presets with a structured ## Gotchas section that accumulates repository-specific verification knowledge over time.
  • Visual Proof gallery and PR handoff: Screenshots and recordings appear in Trial Changes & Checksonly when a stage saved them under .superqode/factory-proof/. A CLI fix such as totals() can show the diff and Merge Risk with an empty gallery. When proof files exist, the pane offers full-size inspection, Finder reveal, and one-click Markdown export combining the SuperGauge verdict, the five-dimension Merge Risk table, and the Visual Proof summary.

Tour and next steps

To lower the learning curve without altering the core Factory Studio workspace, we added two progressive guidance surfaces:

  • Standalone Interactive Software Factory Tour: Available directly from the Welcome screen and the Factory Studio header (Tour). Five interactive slides demonstrate factory anatomy, live conditional Triage routing (Ambiguous feature versus Clear bug), reusable skills, SuperGauge with Merge Risk and Visual Proof, and guarded optimization loops, with keyboard navigation and an Auto-play mode requiring no API key or open project.
  • Collapsible Next-Step Progress Strip: Tracks five evidence-backed workspace milestones (Pick workflow -> Check & save -> First trial -> Checks & gates -> Measure & improve), pairing each completed state with a single next action, one-click Use current model binding, and clickable starter goal templates.

What’s next

On-Demand Software Factories establish the first half of combining Recursive Language Models with governed software engineering: treating a repository as inspectable data to compile a validated, Git-owned factory.yaml.

Our next architectural milestone extends this foundation to On-Demand Recursive Software Factories(spawn_factory). Under that model, a committed parent factory.yaml governs a root RLM foreman capable of dynamically spawning isolated, SuperGauge-verified child sub-factories for multi-service and monorepo changes, bounded by monotonic depth and budget attenuation, an explicit human decomposition gate prior to fan-out, immutable run-level spec snapshots, and optional promotion of reusable sub-factories back into permanent repository code.

Try the public demo

The repository in the video is already open source under the Apache 2.0 license, in examples/factory/demo. Copy that folder and open it in Factory Studio. It is a small faulty Python CLI: app.py, self_check.py, suite.json, and the merge-risk and ui-verification skills. It deliberately has no finished factory.yaml. Build On-Demand Software Factory writes that file, which is the point of the walkthrough.

For the fast path in the video, prepare a trial with this goal:

Fix the bug in totals() in app.py. When two rows share a category, add their amounts instead of keeping only the last one. python3 self_check.py totals must pass. Do not change active() or ordered(), and do not add new features.

Triage should set needs-spec to false and skip spec. The same folder includes evals/cli-probes.json, four hidden totals probes. Build On-Demand Software Factory pins that file as purpose: evaluator and sets evaluator: cli-probes on the regression check. After verify finishes, Verify candidate… can return a SuperGauge verdict. A trial prepared before that pin keeps the old snapshot and will not return one. DEMO-WALKTHROUGH.md also has an open-ended goal for the spec gate. scripts/run-factory-demo.py writes separate per-case probes for its scripted totals, active, and ordered runs.

Get started

Install or upgrade SuperQode:

SHELL
uv tool upgrade superqode
# or install fresh
curl -fsSL https://superqode.dev/install.sh | sh

Download SuperQode for macOS, launch the Software Factory tour from the Welcome screen, or open examples/factory/demo and select Build On-Demand Software Factory. Revisit SuperQode Factory Early Preview, or review the Software Factory documentation.

P.S: Originally  published at the Superagentic AI blog here