They must make architecture enforceable, not advisory. Define component boundaries, allowed dependencies, and complexity thresholds in machine-readable policy, then block merges that violate them. Without that control, agent-generated changes will gradually create duplication, coupling, and hidden maintenance risk that weakens both security and delivery.
Why This Matters for Security Teams
AI-assisted development changes the speed and shape of change, but it does not remove architectural responsibility. When code generation can add new services, dependencies, and repeated patterns in minutes, drift becomes a governance problem, not just a code review problem. Security teams need architecture to be enforceable because advisory standards are too easy to bypass under delivery pressure. That is why controls on dependency boundaries, dependency depth, and approved libraries matter as much as vulnerability scanning.
This issue is especially visible when generated code normalises unsafe patterns across many files. NIST SP 800-53 Rev 5 Security and Privacy Controls makes the broader point that configuration and change control must be deliberate, not implicit. In practice, many security teams encounter architectural drift only after a service has already grown sideways through repeated agent-generated changes, rather than through intentional design review.
Where code generation also touches secrets handling, the risk compounds. NHIMG research on The State of Secrets in AppSec shows how security confidence can outpace actual control maturity, which is relevant when AI-assisted development starts reusing brittle patterns at scale.
How It Works in Practice
Organisations limit drift by translating architecture into machine-readable policy and checking it at the point of change. The practical pattern is simple: define allowed service boundaries, approved dependency directions, maximum package depth, banned libraries, and exception paths, then block merges when a generated change violates those rules. This is more effective than relying on reviewers to spot every architectural violation after code has already been produced.
Current guidance suggests pairing policy with layered guardrails:
- Use architecture-as-code or policy-as-code to express dependency rules in a format CI can enforce.
- Run dependency and import checks on every pull request, not just on release.
- Require explicit owner approval for exceptions so drift is visible and time-bound.
- Track repeated violations as a signal that the model prompt, scaffold, or developer workflow is steering agents toward the wrong design.
- Couple enforcement with package and service inventories so hidden duplication can be detected early.
For development environments that already use AI assistants, the best control point is the merge gate. That is where architectural intent, security rules, and delivery velocity can be balanced without assuming the model will infer boundaries correctly. NHIMG analysis of the Salesloft OAuth token breach underscores how fast drift in trust assumptions can turn into security exposure when tokens, integrations, and privilege paths are left loosely governed. These controls tend to break down in monorepos with weak ownership because dependency rules become noisy and teams start bypassing them to keep delivery moving.
Common Variations and Edge Cases
Tighter architectural enforcement often increases review overhead, requiring organisations to balance design consistency against developer throughput. That tradeoff is real, especially when teams are still standardising service ownership or migrating legacy systems that already contain inconsistent patterns.
There is no universal standard for this yet, so current guidance suggests treating architectural policy as graduated rather than absolute. For legacy codebases, it may be more practical to freeze new coupling while allowing short-lived exceptions for remediation work. For greenfield AI-assisted projects, stricter rules can be applied earlier because the cost of correction is lower.
Edge cases usually appear in three places: generated test scaffolding that mirrors bad production structure, shared utility packages that quietly become dumping grounds, and rapid prototype branches that later get promoted without redesign. NIST SP 800-53 Rev 5 Security and Privacy Controls is useful here because it reinforces the principle that change control must remain traceable even when the source of change is an agent or assistant. In security-sensitive environments, the safest approach is to treat repeated policy exceptions as architectural debt that must be retired, not normalised.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10, CSA MAESTRO and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST AI RMF and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | A3 | Agent-generated code can create unsafe design drift at scale. |
| CSA MAESTRO | M1 | Addresses governance for autonomous agent workflows and approvals. |
| NIST AI RMF | GOVERN | Architectural drift is a governance and accountability risk for AI systems. |
| NIST CSF 2.0 | PR.IP-1 | Supports documented, controlled change processes for code and architecture. |
| OWASP Non-Human Identity Top 10 | NHI-06 | Generated code can amplify misuse of secrets and identity patterns. |
Assign ownership for AI-assisted changes and enforce review accountability.
Related resources from NHI Mgmt Group
- How should teams keep AI-assisted development from weakening enterprise trust?
- How do organisations keep AI-assisted access changes accountable?
- How do organisations keep AI-assisted remediation from becoming over-automated?
- How can organisations reduce the risk of prompt drift in AI-assisted workflows?