Systems Engineering Principles for AI-Assisted Software Development

Dr Raminderpal Singh

raminderpalsingh.com · March 2026

Abstract AI coding agents generate functional software rapidly but bypass the engineering discipline required for production-grade systems. Left unconstrained, they collapse requirements, architecture, design, and implementation into a single pass — producing fast code with no structure, no testability, and no traceability. This paper applies the VP-model (Virtual Prototype model), a derivative of the V-model originating from the University of Karlsruhe (1998), to constrain AI coding agents through layered prototyping at each abstraction level. The method enforces test-first development via filesystem locks and cryptographic hash audits, and produces running executable prototypes at the system and architecture levels before implementation begins. Validated on a real FastAPI application conversion (1,045 LOC POC → production-grade codebase with 169 tests, zero lint warnings, strict type checking), the approach detected a genuine production defect that would survive conventional code review. A multi-tier decomposition extension scales the method to codebases of 15,000–50,000 LOC by combining developer-supplied architectural knowledge with LLM-based verification at each tier. The framework, tooling, and documentation are available at aicodeguard.dev.
Section 1

Introduction

The problem

AI coding agents (Claude Code, Cursor, GitHub Copilot) produce functional code with inadequate test coverage. Left unconstrained, they write tests and implementation simultaneously — coupling test design to implementation decisions. They write tests that verify implementation correctness rather than independently specifying expected behaviour. They omit boundary conditions and edge cases. They silently modify test assertions to match implementation output when the implementation is incorrect.

The consequence is exponentially faster technical debt. The last 20 years over-emphasised coding and under-emphasised architecture, design, and modelling. AI now does the coding — and it will be better at it than humans. The human's value is therefore entirely in the upper branches of the V: requirements elicitation, architecture, separation of concerns, and modelling.

"If you are using AI for coding, you must have software engineering discipline — or you are completely lost."

The VP-model

The VP-model (Virtual Prototype model) is a derivative of the V-model, originating from German academic and industrial work — specifically the University of Karlsruhe, 1998 [1]. It extends the standard V-model by adding prototyping at each layer of abstraction — not only at implementation, but at system, subsystem, and module design levels. Three prototype loops exist, one at each abstraction layer, each feeding forward into the corresponding test layer on the right branch.

The VP-model predates Agile but is structurally compatible with iterative execution. It is not waterfall — it is applied iteratively: each sprint or increment passes through the V-model layers at the appropriate level of atomicity. Early sprints weight requirements and architecture; later sprints shift to implementation. Each layer has its own prototype and test artefact, so iteration at one layer does not destabilise others.

Prototype Prototype Prototype Requirements Elicitation System Specification System Design Subsystem Design Module Design System Use System Delivery System Test Subsystem Test Module Test IMPLEMENTATION
Figure 1: VP-model · Recreated from Karlsruhe (1998) reference [1]

The human role

The human is a systems engineer, not a coder. Primary activities: requirements elicitation, option generation (diverge), option selection (converge), architecture and separation decisions. AI is a cognitive assistant — it generates options, executes implementation, and flags trade-offs. Grady Booch's framing applies directly: "When AI writes the code, the architect is still accountable" [3].

AI coding orchestration tools can enforce this discipline through mechanisms such as filesystem locks, cryptographic hash audits, and state machine constraints — making the process auditable and the output traceable.

Section 2

Method

Four-layer structure

The VP-model operates across four abstraction layers [1]. At each layer, a prototype targets the specific risks of that layer, not a general demonstration of the product. Prototypes at higher layers are stubs — they announce "I am here" but execute nothing. As modules are developed, stubs are replaced with real implementations.

Left Branch (Development)Prototype LoopRight Branch (Validation)
Requirements Elicitation / System SpecificationPrototype — System levelSystem Use / System Delivery
System Design / Subsystem DesignPrototype — Subsystem levelSystem Test / Subsystem Test
Module DesignPrototype — Module levelModule Test
Implementation(base of V)—

What the VP-model changes from the V-model

The V-model and VP-model share the same right branch (validation) and the same four abstraction layers. The difference is entirely on the left branch — what exists before implementation begins at each layer. The V-model produces text artefacts only. The VP-model produces running prototypes at the two highest levels.

LayerStage nameWhat is builtDefect class caught
Layer 1 — User Requirements A mock API with hardcoded responses, built and run before the plan is written. The response schema is verified against what callers actually need. Wrong response schema — a user-level failure that propagates through all four layers undetected in the V-model.
Layer 2 — Architecture Skeleton Interface contracts converted to type-annotated Python stubs (raise NotImplementedError) before any task implementation. mypy strict must pass. Interface mismatches as type errors before implementation commits to them — wrong return type, missing parameter, circular dependency.
Cost of fixing late vs early Cost to fix a wrong schema at the requirements stage: change a document. Cost to fix the same flaw at the validate stage: potentially redesign the API module, service contracts, and response models — with all downstream tests broken.

Enforcement mechanisms

The method is implemented as a set of Claude Code custom slash commands, git hooks, and state files that enforce test-first development on an LLM coding agent. The system prevents the AI from writing implementation code without first writing failing test cases, and prevents it from modifying test cases once implementation begins.

MechanismFailure mode prevented
Filesystem lock (chmod a-w)Test modification during implementation — OS-level permission that cannot be bypassed by the LLM
SHA-256 hash auditAny test change between specification and implementation — cryptographic comparison of every test file
State machine rulesSkipping the test-first cycle — each task must pass through null → red → green → null
Pre-commit hookCommitting code with failing tests — runs pytest before allowing git commit

The lifecycle progresses through seven stages: setup → requirements → plan → skeleton → build (per module: red → green → commit) → integrate → validate → done. At the implementation layer (Layer 4), the AI agent operates autonomously. Every layer above it requires human judgement: what the system must do, how it is decomposed, what the boundaries are, what constitutes correct behaviour at the edges.

⚠ Honest trade-off The VP-model adds two stages before the plan, which takes time. The V-model is faster to the first line of production code. The VP-model is faster to a correct production codebase, because it front-loads the discovery of the defects that are most expensive to fix late. Whether that trade-off is worth it depends on the cost of late defects in your domain.
Section 3

Worked Example: Image Analysis Application

The following applies VP-model principles to a concrete case: a FastAPI image analysis application initially built as an AI-generated proof of concept. The POC has two endpoints (/health and /analyze), a single dependency (uv), and no test coverage. The POC works — it accepts an image upload, runs analysis, and returns a result. What it lacks is structure, testability, and verifiable correctness.

Layer 1 — System prototype

Before touching the POC code, define what the production system must do for its users. Build a mock API returning hardcoded responses that exercises the full HTTP workflow — upload, process, retrieve result. Validate that the response schema is useful.

⚠ What AI-generated POCs typically skip The POC returns {"message": "Analysis complete", "filename": "...", "size_bytes": ...} — which contains no actual analysis result. That is a user-level failure, invisible until this layer is examined. The schema was redesigned before any architecture work began.

Layer 2 — Architecture prototype

Decompose the system into four modules: processing (domain logic, no knowledge of HTTP), service (orchestration, file lifecycle), api (routes, schemas, input validation at boundary), app (factory, middleware, exception handlers). The architecture prototype is a set of running stubs: each module exports its typed public interface, imports correctly from modules below, and the dependency graph is verified as a DAG.

Layers 3–4 — Design, specification, and implementation

For each module, write task-level specifications as failing tests before any production implementation. Each task follows a red → green → commit cycle. Tests are SHA-256 hashed before implementation begins; the hash is verified after implementation to confirm no test was modified.

Validation (right branch)

Validation levelWhat is checked
Module testsEach module satisfies its specification. Tests pass in randomised order. Coverage ≥ 80% per file.
Integration testsReal cross-module interactions with no mocks. Error propagation verified: ProcessingError → HTTP 500, ValidationError → HTTP 400, NotFoundError → HTTP 404.
System / E2E testsFull workflow via HTTP client. Invalid inputs return structured JSON 4xx, no stack traces exposed.
User acceptanceApplication starts without error. /health returns HTTP 200. API documentation accessible. README covers installation and usage.

Results

The conversion produced 1,014 LOC of production source across 18 files, 2,213 LOC of tests across 17 files, 19 atomic commits with zero lint warnings and zero type errors in strict mode. A boundary condition test for border_percent=0 detected a genuine production defect where mask[-0:] selected the entire array instead of an empty slice — a NumPy negative-zero indexing bug that would survive conventional code review.

Section 4

Scaling: Multi-Tier Decomposition

The single-run VP-model workflow handles POCs up to ~2,500 LOC. Beyond that, the AI agent's context window fills with accumulated source, tests, and conversation history — degrading quality and forcing compaction. The solution is decomposition: adding orchestration tiers above the existing VP-model Builder. Each tier analyses a larger scope, splits it into smaller units, defines the interface contracts between them, and delegates downward. The Builder — unchanged — converts each unit independently.

At every tier, the developer supplies architectural knowledge via a structured questionnaire, and the LLM's task shifts from comprehending the codebase to verifying the developer's claims against the code. Verification scales far beyond comprehension.

Terminology: Layers are VP-model abstraction levels (Layer 1 User through Layer 4 Implementation). Tiers are decomposition scope levels (Tier 1 Builder, Tier 2 Decomposer, Tier 3 Meta-Decomposer). Levels are dependency DAG positions for parallelism.

TIER 3 — META-DECOMPOSER DEVELOPER INPUT M1 Subsystem map (3–7 areas) M3 Communication patterns M4 Cross-subsystem data 7 questions · 30–60 min LLM VERIFIES Top-level import graph vs map Cross-subsystem coupling audit Design Review Report ~10K tokens context (not 200K) OUTPUT Super-chunk definitions (3–5 subsystems) Cross-subsystem contracts (protocols, types) Design Review: boundary gaps surfaced Developer reviews → resolves → proceeds TIER 2 — DECOMPOSER Subsystem A (~10K LOC) Developer: 15 questions LLM verifies + Design Review → 8 chunks of ~1,200 LOC TIER 2 — DECOMPOSER Subsystem B (~10K LOC) Developer: 15 questions LLM verifies + Design Review → 8 chunks of ~1,200 LOC TIER 2 — DECOMPOSER Subsystem C (~10K LOC) Developer: 15 questions LLM verifies + Design Review → 8 chunks of ~1,200 LOC PARALLEL — SAME DEPENDENCY LEVEL TIER 1 — BUILDER (existing VP-model orchestrator, per chunk) Each chunk: setup → requirements → plan → skeleton → build (red/green) → integrate → validate Full profile for API/app chunks · Lite profile for domain/service chunks (~80%) ASSEMBLER — SYSTEM INTEGRATION Cross-chunk + cross-subsystem integration · System E2E · Production readiness → PRODUCTION READY / CONDITIONALLY READY / NOT READY design review 2 tiers: 3K–15K LOC · 3 tiers: 15K–50K LOC · Binding constraint: developer knowledge, not LLM context
Figure 2: Multi-tier decomposition — developer knowledge compresses at each tier, LLM verifies rather than comprehends  ·  click to open full size ↗

Developer knowledge at each tier

TierDeveloper providesLLM does
Meta-Decomposer (Tier 3)Subsystem map: 3–7 major areas, communication patterns, shared resources. 7 questions, 30–60 min.Verifies top-level import graph against the map. Produces Design Review flagging discrepancies. Outputs super-chunk definitions + contracts.
Decomposer (Tier 2)Per-subsystem boundaries, data flow, shared state, quality assessment. 15 questions, 15–30 min per subsystem.Verifies import graph within subsystem. Produces Design Review + chunk definitions + cross-chunk contracts.
Builder (Tier 1)Spot-check reviews only after the first chunk calibrates trust.Runs the VP-model lifecycle. Full profile for API/CLI chunks (all layers). Lite profile for domain chunks (skip Layer 1, simplify Layer 2). ~80% of chunks are Lite.

The Design Review loop

At every tier, the LLM compares the developer's answers to the actual code and produces a Design Review Report before proceeding. The report surfaces boundary mismatches, abstraction gaps, dependency direction violations, undisclosed shared state, and underestimated complexity. The developer's architectural understanding improves regardless of whether they proceed with the conversion — the Design Review Report is valuable as a standalone artefact.

Full vs Lite builder profiles

Not all chunks need the full VP-model. A domain-logic chunk has no HTTP interface — its exports are fully defined by the cross-chunk contract. Lite chunks skip Layer 1 (no mock API — nothing to prototype), simplify Layer 2 (external stubs from contract), and defer Layer 1–2 validation to the Assembler. Layers 3–4 (test-first build) are unchanged — test-first discipline applies regardless.

POC sizeTiersCalendar time (with parallelism)
≤ 2,500 LOC1 tier (Builder only)3–6 days
2,500 – 15,000 LOC2 tiers (Decomposer + Builder)1–2.5 weeks
15,000 – 50,000 LOC3 tiers (Meta-Decomposer + Decomposer + Builder)2.5–4 weeks
Section 5

Discussion

Common objections

ObjectionResponse
"This is just waterfall."The VP-model is applied iteratively — each sprint passes through relevant abstraction layers. The discipline is maintaining layer separation within each cycle, not sequencing all layers before implementation.
"Good engineers already do this."They do, when given time and authority. AI coding agents do not — left unconstrained, they collapse all layers into a single implementation pass. The framework is a guardrail on the agent, not the human.
"Why does AI coding need systems engineering?"Because AI makes coding faster but does not make architectural decisions. Without explicit layer separation, faster code generation accelerates technical debt accumulation.

Relationship to MBSE

A model-based systems engineering approach is structurally compatible — models are layered by definition. The formalism (UML, ArchiMate, SysML) can and should be delegated to AI. The human stays at the systems level: choosing what to model, what constraints to impose, what separations to enforce.

Known limitations

Section 6

Next Steps

The following priorities address the known weaknesses identified in Section 5.

The underlying shift The practical consequence of AI-assisted coding is not that software engineers become redundant. It is that the value of engineering skill moves entirely up the abstraction stack — toward requirements, architecture, and separation of concerns — and away from implementation. The VP-model provides a concrete framework for operating at those levels deliberately.
References

References

  1. University of Karlsruhe (1998). Code Generation for an Open Rapid Prototyping Environment Supporting Heterogeneous System Design. Original VP-model paper — the academic foundation for the three-layer prototype loop structure.
  2. Forsberg, K. & Mooz, H. (1991). The Relationship of System Engineering to the Project Cycle. Original V-model formalisation in systems engineering. Referenced widely in aerospace and defence contexts.
  3. Booch, G. Recent writing on AI and software architecture. "When AI writes the code, the architect is still accountable."
  4. Boehm, B. & Turner, R. (2004). Balancing Agility and Discipline. The definitive treatment of applying structured engineering disciplines within iterative development cycles.
  5. Hohpe, G. Software architect and author of Enterprise Integration Patterns. Writes on the enduring importance of architecture in an era of automated implementation.
  6. Singh, R. (2026). Test-First Orchestrator: AI Code Guard. Framework, tooling, and documentation. https://aicodeguard.dev