This article proposes that effective governance of AI-driven systems lies not in dynamic prompts but in static, version-controlled files that define architectural constraints. It introduces a "constraint pyramid" framework, categorizing rules by strength and layer, to establish a robust and auditable system for managing AI output and preventing drift, emphasizing that the system lives in these structured files, not ephemeral prompts.
Read original on Dev.to #architectureWhen building systems that leverage large language models (LLMs), a primary challenge is ensuring the AI's output remains consistent, adheres to defined boundaries, and aligns with architectural principles. Traditional prompt engineering, where constraints are embedded directly in conversational prompts, is often insufficient. Prompts are ephemeral, easily ignored, and difficult to verify, leading to "system drift" where the AI's behavior diverges from design expectations over time.
The core thesis is that system governance for AI applications should shift from "words-in-chat" (prompts) to "rules-in-files." Files provide a stable, verifiable, and enforceable architectural boundary that models read before generation, making constraints a "ground truth" rather than a suggestion.
The article introduces a "constraint pyramid" framework, an organizational structure for defining AI governance. This pyramid consists of five layers, each translating the layer above it and narrowing the scope for the layer below. Constraint flows down, dictating what the model can do, while accountability flows up, providing an audit trail.
Strategy —— README / constitution : what this is, its boundaries
↕ Architecture —— ADR set : where the limits are, what won't be revisited
↕ Contracts —— spec + runbook : what exactly must be delivered
↕ Gates —— pre-submit checks : what is not allowed to become code
↕ Implementation— constrained output : the model's work, fenced in from above This layered approach ensures that every piece of generated code can be traced back through gates, contracts, architectural decisions, and ultimately to strategic intent. The key is to arrange these constraints in files, from fewer, heavier, more abstract rules at the top to more numerous, specific rules closer to the actual model output.
Beyond the pyramid's layers, constraints are categorized by their strength, ensuring the model understands the criticality of each rule:
Properly assigning rules to these tiers prevents the AI from treating all directives as mere suggestions, thus maintaining system integrity. A healthy system also incorporates a feedback loop where model deviations inform updates to the constraint layers, making the system adaptive and "alive."