↓ Skip to main content

Quality and Autonomy in an AI Software Factory

·11 mins
Michael Hönnig
Author
Michael Hönnig
Until autumn 2027 only available for consulting engagements with a small number of hours – remote, in German and English.

Risk-aware changes, independent verification and human responsibility

An AI software factory can implement changes largely autonomously. The real architectural problem begins, however, at the latest when it has to decide which changes may proceed without human review – and which may not.

This article covers the control and feedback functions of a factory: dynamic change decomposition, verification, risk control, approval, CI/CD, governance and monitoring. The basic architecture with agentic coding tools, harnesses, model access and orchestration is described in Anatomy of an AI Software Factory.

Splitting Changes by Risk
#

A feature rarely consists only of changes of the same risk class. Suppose a change to authorization first requires restructuring the code. After that, the actual functional change to authorization is relatively small. Finally, the new structure is tidied up.

A single pull request would mix everything: a lot of behavior-neutral, low-risk refactoring and a small but possibly security-critical change. The most critical spot then determines the review effort for the entire diff: A human reviewer would have to work through all of it to find the one sensitive change.

Agents, however, can easily split the work by risk class, so that several separately reviewable change units emerge. And a factory should demand that. An established term for the preparatory restructuring is Preparatory Refactoring. Afterwards, low-risk and critical feature parts are separated; a final cleanup can follow. Each unit is then reviewed and approved according to its own risk. There need not be exactly four changes as in the diagram.

Dynamic Decomposition of a Feature Request into Separately Reviewable Changes by Risk ClassA feature request goes into dynamic change planning, which splits the work and adapts to new insights. It produces separately reviewable change units: a behavior-neutral preparatory refactoring, low-risk feature parts, highlighted critical changes such as authorization, and a cleanup refactoring that tidies up the new structure. Then follow the individual review with a risk assessment per change and the integration with a check of the combined effect. A colored arrow leads back to change planning with new insights.Feature RequestDynamic Change Planningsplits and adapts to new insightsSeparately Reviewable Change UnitsPreparatoryRefactoringbehavior-neutralLow-RiskFeature Partslow riskCriticalChangese.g. authorizationCleanupRefactoringtidy up new structureIndividual Reviewand risk assessment per changeIntegrationand check of the combined effectnew insights
Example of a dynamic decomposition. The order and the actual dependencies are task-specific; the diagram does not imply that all changes can be carried out in parallel.

The factory should, in principle, initiate such a decomposition itself and – within its rules – be able to check it. In a strongly human-driven Light Factory, the decision can rest with the developer. A dashboard can flag changes that mix parts of different risk, without automatically interrupting the work.

The goal is not to make every change minimally small, but to separate parts of different risk from one another, so that the share requiring human review remains manageable. With sufficient safeguards, a large refactoring can proceed automatically, while a small change to the permission system is presented to a human.

But: even a refactoring with unchanged tests is not risk-free. And several individually uncritical changes can become critical in combination. Therefore, assessing the individual changes in isolation is not always sufficient; integration additionally checks the combined effect.

Verification: More Than “Tests Green”
#

The factory must be able to check results, ideally independently of the instance that produced them. This includes functional tests, technical tests, static analyses, security and performance checks. Formal verification and mathematical proofs can provide additional evidence for suitable tasks.

A catalog of all test types does not belong here. For the architecture, three questions matter most:

What is checked? Functional acceptance or BDD tests describe the desired behavior; technical tests additionally check edge cases, components and integrations. Regression tests are not a separate opposing category: acceptance tests can detect regressions, too.

Who defines the expectations? An agent can derive tests from requirements. Especially for functional acceptance criteria, a human review of the expectations can make sense. Technical unit and integration tests can often be created and maintained in a more automated way. More important than the label “unit” are the size of the tested unit and its refactoring safety (see Not Unit Tests, but Our Units Are the Problem).

How effective are the checks? Mutation tests, for example, check whether tests detect artificially introduced faults. Good mutation results increase confidence in the tests, but prove neither the completeness of the requirements nor the safety of a change.

The details of test granularity, software metrics and formal verification belong in separate posts. For the factory, this is enough: The significance of the evidence must feed into the approval decision.

Static Analyses: Automated Execution, Deliberately Set Rules
#

Complexity limits, coupling rules, architecture guidelines and security policies can be checked automatically. The quality standards, however, should remain under controlled human responsibility. AI agents may propose changes, but must not silently weaken thresholds just to pass a check.

This makes governance a prerequisite for meaningful automation: Without stable, verifiable rules, the factory could move its own bar.

Two Levels of Risk Control
#

For a Gray Factory, risk control is especially central. It pays to distinguish between static criticality and dynamic change risk.

The static classification describes, for example, the protection needs of a repository or module. A backend for permission management can have stricter requirements than a less critical presentation component. Existing classifications from an information security management system – such as the protection needs assessment according to BSI IT-Grundschutz or the classification of information according to ISO/IEC 27001 – are a sensible reference point for this. Protection needs and the risk of a concrete change are, however, not the same.

The dynamic assessment only looks at the actual change: affected files, diff, test results, security findings, architecture changes and, where applicable, the context of further changes. A rule-based checker, a specialized classification model or an LLM can be involved. A classifier need not be an autonomous agent; its classification can be processed further by the factory control. For example, my review gate Werkrevisor combines deterministic rules with a model review and uses Jev as a classifier: Simple PRs can be merged without humans, risky ones end up with me (more on this in Anatomy of an AI Software Factory).

Two Levels of Risk ControlOn the left, the static level: a repository or module has protection needs, that is, a static criticality; from this follow policies with thresholds, review depth and required evidence. On the right, the dynamic level: a finished change with its diff and affected files yields evidence from tests, analyses and security findings. Both feed into the highlighted dynamic risk assessment by rules, a classifier or an LLM. The question whether the approval rules are met has three exits: yes leads to an automatic pass, review required leads to a human decision with deliberate responsibility, which can also request changes and thus lead to rework, and no leads to rework or blocking. From there, a colored arrow leads back to implementation, that is, to the change, which is then assessed again with new evidence.Static LevelDynamic LevelRepository / Moduleprotection needs, static criticalityPoliciesthresholds, review depth, evidenceFinished Changediff, affected filesEvidencetests, analyses, security findingsDynamic Risk Assessmentrules, classifier or LLMApproval rulesmet?yesreview requirednoAutomatic Passrules metHuman Decidesdeliberate responsibilityReworkor blockchanges requestedback toimplementation
Static classification sets the rules; the dynamic assessment judges the concrete change. The diagram does not prescribe a fixed merge or deployment point.

A static classification can also influence the sensitivity of a classifier and the required evidence. It should be maintained and reviewed in the event of significant changes. The factory may propose updates; authorizing such rule changes is a governance question.

Human Approval: Responsibility Instead of Repeated Interruption
#

Human reviews are not automatically necessary because humans can judge code better than AI. Rather, they can be required because an organization demands deliberate human responsibility for certain changes.

This presupposes that the reviewer can actually see and assess the change, the risks and the available evidence. Merely nodding it through does not serve this purpose.

Typical triggers of mandatory approvals can be team rules, security-critical changes or hard size and complexity limits. During the work, the factory can display risk notices in the dashboard without stopping the agent. A binding decision often only makes sense after implementation, when the change is available as a whole.

Exceptions are actions that could have irreversible consequences already during processing, such as deleting production data. These may require prior approval. The exact position of such control points depends on the system, environment and reversibility.

The Light, Gray and Dark operating models differ mainly in which decisions may be made autonomously: In Light Factories, human reviews are a regular part; Gray Factories request them based on risk; Dark Factories try to design the regular flow without individual human decisions. This is no statement that the technical components must be fundamentally different. This is covered in more detail in Gray Software Factory: Autonomy by Risk, Not by Dogma.

CI/CD, Git and the Question of the Right Control Point
#

GitHub, GitLab or Gitea can provide version control, pull requests and reviews. CI/CD systems run builds, tests, scans and deployments. The factory can control such systems and interpret their results without implementing them itself.

Pull requests are not a must. But they are a practical mechanism when human approvals or traceable separate changes are required. Alternatively, suitable commits, branches and other approval mechanisms can be used.

Likewise, there is no universal point in time for assessing combination risks. A merge is not the same as a production deployment. Changes can be reversible or hard to undo; test, staging and acceptance stages can lie between integration and production.

The factory must take into account the combined effect of related changes. When it checks this and what consequences follow depends on criticality, reversibility and downstream safeguards.

Dashboard, Notifications and Governance
#

A dashboard can display status, progress, quality evidence, risk notices and pending approvals. Notifications can be sent via messenger or email. A mere notice should be clearly distinguishable from a mandatory human decision.

Risk control decides whether an intervention is required. Dashboard and notification system make this decision visible and enable the response. These are different functions, even if one product offers both.

Governance defines the limits of autonomy: permissions, permitted tools, budgets, quality rules, review obligations and responsibilities. Particularly important is who may change these rules. A factory should not be able to loosen its own controls on its own authority to finish faster.

Two Feedback Loops
#

The factory does not just process work items. It can detect new work itself – from two different sources. This is a different classification than in Three Feedback Loops of Sustainable AI Software Development: There, it is about the correctness, performance and architecture of the software itself, here about the origin of new work, from the product or from the production process.

Product feedback: Monitoring reports unusual latencies, error clusters or outages. Security scans discover new vulnerabilities in dependencies. This can give rise to corrective work items that go through the same review and approval process as human requirements.

Process feedback: Recurring build failures, flaky tests, high model costs or problematic reviews reveal weaknesses in the production process. The factory can propose improvements from this; changes to its own policies remain separately controlled.

Two Feedback Loops: Product and Process FeedbackAt the top center, the highlighted factory process with review and approval; at the bottom center, the work item that leads into the factory process. On the left, the product feedback loop: the factory process delivers software, monitoring reports latencies, errors and security findings, and a work item results from them. On the right, the process feedback loop: the factory process produces process data from builds, tests, costs and reviews; from this the factory proposes improvements, which also become work items. Human requirements flow into the same work item. Rule changes branch off, dashed, to governance: authorized only. From governance, a dashed arrow leads back to the factory process: only approved rules apply there.Softwaredelivered, in operationFactory Processreview & approvalProcess Databuilds, tests,costs, reviewsMonitoringlatencies, errors,security findingsWork Itemnewly detected workImprovementproposed by factoryRequirementsfrom humansGovernancechanging rulesauthorized onlyrule changeapproved rules applyProduct feedbackProcess feedback
Product and process feedback can trigger new work items. Self-observation does not automatically mean self-authorization to change the rules.

A concrete example: a nightly dependency scan detects a new vulnerability. The factory identifies a suitable secure version, updates the dependency, runs tests and security checks and assesses the change risk. With sufficient evidence and matching rules, the upgrade can proceed automatically; otherwise, a human is involved. Good tests and mutation results help, but do not guarantee complete compatibility.

Conclusion: Controlled Autonomy Is an Architectural Task
#

An AI software factory does not need as many human stops as possible. It needs traceable quality evidence, risk-appropriate decisions and clear responsibilities.

Dynamic change decomposition can isolate critical changes and shrink reviews. Independent verification provides the evidence. Static protection classes and dynamic change assessments determine when a human must decide. CI/CD and monitoring close the loop without necessarily being part of a monolithic factory product.

These functions can be combined with different agents, models and platforms. The corresponding vendor-neutral overall architecture is described in the previous article. What matters is less how autonomous a factory appears, than rather which decisions it is actually allowed to make autonomously, and by which rules.

Sources and Further Reading
#

Discuss on X

This article was translated from German with AI assistance.