
Governance in AI-driven Engineering: Building the Right Product, and Building It Right
When teams talk about governing AI-assisted engineering today, they usually point to things that happen at the very end of the line. A senior engineer glanced at a pull request. A GitHub CI run turned green. A model wrote four hundred lines of code across ten files, nothing crashed on startup, and someone clicked merge.
That is not governance. That is just shipping code you ‘hope’ is right.
If we strip away the management buzzwords and compliance jargon, real engineering governance is surprisingly simple. It comes down to answering two distinct questions with hard evidence:
- Did we build the right product?
- Did we build the product right?
They sound like a play on words, but they describe two completely different failure modes.
- The first is about intent: Did we actually deliver the behavior the business and our users need?
- The second is about implementation: Did we build it using an architectural approach that is safe, maintainable, and sound?
If only one of these questions is verified, teams are flying blind. And when autonomous coding agents enter the picture, that blindness becomes expensive very quickly.
Two Questions, two quiet failure modes
Software can fail against these questions in ways that are invisible during a standard demo.
- Failing the first question (the wrong product) usually looks like this: the software runs, the UI looks snappy, and the happy path works. But beneath that surface, critical requirements were either misunderstood or left out entirely. Worse, unrequested features sneak in because an agent decided to “help” by adding extra flows, buttons, or flags that nobody agreed to support. The code might be bug-free, but the product could still be far from what was intended.
- Failing the second question (the product built wrong) is even more common with AI tools. Here, the feature works as intended and fulfils the user story, but the implementation takes the path of least resistance:
- Business logic is shoved directly into a UI controller to save time.
- Clean service boundaries are bypassed to make a direct database call.
- Errors are caught and swallowed with empty handlers so the script doesn’t crash.
The product looks right from the outside. But underneath, the system has problems that aren't immediately visible. They may go unnoticed during the initial demo, only to surface later when the database locks up under load or a subsequent change breaks because errors were silently swallowed.
Governance is the discipline of catching both failures before code reaches production. To do that, we have to break both intent and approach into pieces small enough to actually test.
The right product: atomic requirements you can actually test
Most software requirements start as broad, messy paragraphs.
Take a standard ticket: "Allow users to reset their passwords."
That sounds like a single task. In reality, it is a bundle of distinct business claims masquerading as one sentence:
- A signed-out user can request a password reset by providing the email address associated with their account.
- If the request is accepted, the system sends a secure reset link to that email, valid only for a defined time window.
- A user with a valid link can set a new password that conforms to our password strength rules.
- Once the password is successfully changed, that specific reset link is invalidated and cannot be used again.
- If too many reset requests originate from the same IP or email address within a given window, further requests are throttled.
One ticket sliced into 5 atomic requirements. Each one is a standalone claim about product behavior. More importantly, each one is individually testable.
An acceptance test can verify that an expired link is rejected, regardless of whether rate-limiting works. Similarly, rate-limiting can be tested independently of whether the email delivery service succeeds.
If you hand an agent the raw sentence "Allow users to reset their passwords," it will invent its own interpretation of what "done" looks like. It might implement the happy path, skip rate-limiting entirely, and leave the reset link valid indefinitely. Then it writes a couple of loose unit tests that pass, and presents a PR that looks finished.
Testing each atomic requirement directly is how teams prove they’ve built the right product. These tests sit at the top level of verification: they evaluate the system from the outside in. They ask: Did the system deliver the specific behavior we asked for?
Passing these tests is necessary, but it is still only half the battle. You can fulfill all five of those requirements and still write a technical disaster under the hood.
The product right: breaking requirements into testable design
A requirement says what must happen. It deliberately does not say how it should happen.
There are a few different ways to implement those five password reset requirements. An engineer could write clean, decoupled services that hash tokens, protect secrets, and rate-limit at the API gateway. Or an agent could hardcode SMTP credentials directly into a route handler, store raw tokens in plaintext, and bypass authentication middleware just to get the tests to turn green.
Both implementations can pass the top-level requirement tests. Only one of them is the product built right.
This is why every atomic requirement must be broken down into explicit architecture and detailed design elements before implementation begins.
1. Architecture: sequence and conditions
Architecture defines how components interact and what rules govern their boundaries. We often visualize this as sequence diagrams (who talks to whom and in what order) and flow diagrams (what conditions dictate which branch we take). In clear prose, the reset feature requires two explicit sequences and a set of conditions:
- The Request Sequence: The browser sends an email to the identity API. The API validates the format, checks the rate limit, creates a cryptographically secure token, and passes an internal message to a dedicated notification service to send the email. The browser never communicates with the mail service, never sees the raw token, and never receives mail credentials.
- The Confirmation Sequence: The user opens the link in their browser. The browser sends the token and the new password to the identity API. The API looks up the token, verifies its state, hashes the new password, updates the account, invalidates the token, and terminates all active user sessions. Data flows strictly from Client → API → Database.
- Architectural Conditions (The Branches):
- If the submitted email does not exist in the database, the API must still return the exact same generic success response as a valid email to prevent user enumeration attacks.
- If the token is expired or already used, the API must reject the update and return an explicit error without touching the credentials table.
- If the new password fails strength validation, the transaction must abort.
2. Detailed design: the concrete contracts
Detailed design takes those sequences and defines the precise interfaces and data models:
- API Contracts: The exact payload schemas, HTTP status codes, and error formats for
/api/v1/password-reset/requestand/api/v1/password-reset/confirm. - Data Models: The exact schema for the reset token record (User ID, Token Hash, Expiration Timestamp, Used At Timestamp).
- Validation Rules: The regex for email validation, minimum entropy rules for the password, and window parameters for rate-limiting.
- UI States: Explicit states for the frontend forms—input, loading, success, link expired, token already used, and rate-limited.
Each of these architectural and design decisions can be validated on its own. An integration test can be written that checks whether an invalid email returns a generic 200 response. Or a unit test to verify that the raw token is never passed to the database layer.
When these elements are specified upfront, we eliminate the agent’s ability to guess. We have explicitly defined the approach.
The bidirectional map: nothing missing, nothing extra
Breaking down requirements and designs is helpful, but the real power comes from connecting them together. You need a strict, two-way link between intent and approach:

This bidirectional map enforces two critical rules:
1. Every requirement must be covered by design
Every atomic requirement must have a corresponding architectural or detailed design element that explains how it will be implemented.
When that connection is missing, the requirement may be overlooked during implementation, or the engineer or agent writing the code may be left to make architectural decisions without an agreed design. Mapping requirements forward helps identify these gaps before they reach implementation.
2. Every design element must exist for an approved requirement
The reverse is equally important. Every design element should be traceable to an approved requirement, directly or through the architecture it supports. Without that connection, additional functionality or complexity can enter the system without an explicit decision to include it.
This is particularly relevant when working with AI agents, which may introduce plausible additions beyond the agreed scope. Those additions can increase code complexity, attack surface, and maintenance costs without contributing to the intended product.
Mapping design backward helps identify unjustified additions before they become part of the implementation. Together, these two directions establish a clear relationship between intent and implementation: every requirement has a defined technical approach, and every design decision has a reason to exist.
The V-model: Verify & Validate
The V-model provides a useful framework for connecting what we intend to build with how we validate what has been built. Its relevance extends beyond traditionally regulated industries, particularly as AI agents take on more work across the SDLC.
Here's how those relationships work:

- On the way down (the left side), you decompose: You start with atomic requirements (what the product must do). You break those down into architecture (sequences and boundaries). You break those down into detailed design (contracts and schemas). Finally, you implement the code.
- On the way up (the right side), you validate: You don't just run a blanket test suite. You test each layer against its matching specification. Unit tests validate the detailed contracts. Integration tests validate the architectural boundaries and sequences. System tests validate the requirements.
The most valuable part of the V is the horizontal link across.
A unit test doesn't just run code; it specifically verifies a detailed design rule. An integration test doesn't just ping endpoints; it validates that the architectural sequence holds. An acceptance test proves that an atomic requirement was satisfied.
In the past, experienced engineering teams could sometimes bypass writing all of this down because the senior engineers held the entire system architecture in their heads. They knew the unwritten rules. They caught the violations during code review because they understood the intent.
AI coding agents do not have that background context. They only have the immediate prompt. If requirements,architectural boundaries, and test contracts are not specified clearly, the agent will optimize for the only thing it knows how to do: make the immediate script run without throwing an error (now).
What this means for engineering leaders
Governance cannot be reduced to a checklist at the PR review stage, after an agent has already generated twenty files. By then, a human reviewer is left trying to reconstruct the original intent and architectural decisions from a large, plausible-looking diff.
True governance is built upfront:
- Building the right product because every requirement was broken into an atomic, testable claim, and verified with tests designed to fail if that claim was not met.
- Building the product right because every requirement was broken into explicit architectural sequences and design contracts, verified with tests designed to fail if those boundaries were violated.
- Nothing was missed or added because the requirements and the designs were mapped to each other before anyone wrote a line of code.
When teams have that structure in place, AI agents stop being unpredictable black boxes that generate technical debt. They become reliable execution engines operating within explicit guardrails.