AI is Finally "Senior" Enough to Need a Contract: The Rise of Contract-Style Comments
The honeymoon phase with AI coding agents is ending, and the "Comprehension Debt" phase has begun.
If you’ve used tools like Cursor, Windsurf, or Claude Dev, you know the cycle:
- The AI writes 500 lines of brilliant code in seconds.
- You ask for a small UI change.
- The AI "fixes" the UI but inadvertently breaks your authentication logic or changes a critical database schema.
We’ve reached a tipping point. Artificial Intelligence is finally "senior" enough that it requires a binding contract to govern its autonomy.
The Problem: AI-Induced Spaghetti Code
Traditional Prompt Engineering is about telling an AI what to do. But in a complex codebase, the "what" is easy; the "why" and "how it must stay" are hard.
Without a persistent set of rules, AI agents treat every file as a blank slate. They don't know that ID: "main-v1" is hardcoded into your analytics suite, or that your CSS nesting follows a specific legacy pattern. This leads to Comprehension Debt—a state where the AI generates code faster than you can verify its safety.
The Solution: Contract-Style Comments (The CONTRACT.md Theory)
The theory of Contract-Style Comments, pioneered by AI agencies like NeUtility._, shifts the focus from Prompting to Context Engineering.
Instead of repeating instructions in every chat, you establish a Single Source of Truth—a root-level file (usually CONTRACT.md) that serves as the AI's "Constitution."
How it Works
A Contract-Style approach defines Invariants: parts of the system that are non-negotiable.
# PROJECT CONTRACT: [Project Name]
## 1. Absolute Invariants (DO NOT CHANGE)
- All API responses must follow the { data: {}, meta: {} } shape.
- Never refactor the 'LegacyHeader.vue' component; it is a dependency for the marketing site.
- Tailwind 'arbitrary values' are prohibited. Use the theme config only.
## 2. State Management
- Use Pinia for global state.
- Never use local storage directly; use the 'useStorage' wrapper.
## 3. Communication Protocol
- Before any destructive edit, the Agent must explain which Invariant it is touching.